/** * * 女医ハック DirectShowフィルタ * Copyright (C) 2008 id:yuaaaa * * $Id$ */ #include #include #include #include #include #include "IDirectJoyHack.h" #include "vfiltprop.h" #include "resource.h" using namespace System::Windows; CUnknown * WINAPI CDirectJoyHackProperties::CreateInstance(LPUNKNOWN lpunk, HRESULT *phr) { //ASSERT(phr); CUnknown *punk = new CDirectJoyHackProperties(lpunk, phr); if (punk == NULL) { if (phr) *phr = E_OUTOFMEMORY; } return punk; } // CreateInstance CDirectJoyHackProperties::CDirectJoyHackProperties(LPUNKNOWN lpunk, HRESULT *phr) : CBasePropertyPage(NAME("DirectJoyHack Property Page"), lpunk, IDD_FILTER_PROPPAGE, IDS_NAME) { //m_pSoundTouch = NULL; } HRESULT CDirectJoyHackProperties::OnConnect(IUnknown * punk) { // Get ISoundTouch interface // if (punk == NULL) { DbgBreak("You can't call OnConnect with a NULL pointer!!"); return(E_POINTER); } //ASSERT(m_pSoundTouch == NULL); HRESULT hr = punk->QueryInterface(IID_IDirectJoyHack, (void **) &m_pDirectJoyHack); if (FAILED(hr)) { DbgBreak("Can't get IDirectJoyHack interface!"); return E_NOINTERFACE; } CheckPointer(m_pDirectJoyHack,E_FAIL); //m_pSoundTouch->get_TouchKey(&m_iTouchRate); //SetDlgItemInt( m_hwnd, IDC_EDIT1, m_iTouchRate, TRUE ); //gcnew System::Windows::Forms::Form return NOERROR; } // OnConnect HRESULT CDirectJoyHackProperties::OnDisconnect() { CheckPointer(m_pDirectJoyHack,E_UNEXPECTED); m_pDirectJoyHack->Release(); m_pDirectJoyHack = NULL; return NOERROR; } HRESULT CDirectJoyHackProperties::OnDeactivate(void) { return NOERROR; } INT_PTR CDirectJoyHackProperties::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: this->m_hwnd = hwnd; if ( !form ) { form = gcnew FilterPropertyFrom( m_pDirectJoyHack ); } SetParent( (HWND)form->Handle.ToPointer(), hwnd ); form->Show(); return TRUE; case WM_DESTROY: form = NULL; //System::GC::Collect(); return TRUE; case WM_KEYDOWN: return FALSE; default: return FALSE; } return FALSE; } //Property Form FilterPropertyFrom::FilterPropertyFrom( IDirectJoyHack *pVFT ) { if ( !pVFT ) { throw "IVideoFilter is null!!"; } this->m_pDirectJoyHack = pVFT; this->InitializeComponent(); this->get_Settings(); } void FilterPropertyFrom::testtt(System::Object ^sender, Forms::KeyEventArgs ^e) { return; } void FilterPropertyFrom::InitializeComponent() { this->button_reload = gcnew Forms::Button(); this->button_file = gcnew Forms::Button(); this->check_hidesub = gcnew Forms::CheckBox(); this->check_immediate = gcnew Forms::CheckBox(); this->check_debugout = gcnew Forms::CheckBox(); this->check_dcache = gcnew Forms::CheckBox(); this->check_utf8 = gcnew Forms::CheckBox(); this->label_predelay = gcnew Forms::Label(); this->label_sufdelay = gcnew Forms::Label(); this->num_delay = gcnew Forms::NumericUpDown(); this->text_filename = gcnew Forms::TextBox(); this->SuspendLayout(); this->text_filename->ReadOnly = true; this->text_filename->Location = System::Drawing::Point(10,10); this->text_filename->Size = System::Drawing::Size(260,20); this->text_filename->Text = ""; this->button_file->Location = System::Drawing::Point(275,10); this->button_file->Size = System::Drawing::Size(18,20); this->button_file->Text = _T("..."); this->button_file->Click += gcnew System::EventHandler(this, &FilterPropertyFrom::button_file_Click); this->button_reload->Location = System::Drawing::Point(10,40); this->button_reload->Size = System::Drawing::Size(60,27); this->button_reload->Text = _T("&Reload"); this->button_reload->Click += gcnew System::EventHandler(this, &FilterPropertyFrom::button_reload_Click); this->check_hidesub->Location = System::Drawing::Point(10,80); this->check_hidesub->Text = _T("&Hide Subtitles"); this->check_hidesub->CheckedChanged += gcnew System::EventHandler(this, &FilterPropertyFrom::controls_Change); this->check_immediate->Location = System::Drawing::Point(10,100); this->check_immediate->Text = _T("&Apply changes immediately"); this->check_immediate->CheckedChanged += gcnew System::EventHandler(this, &FilterPropertyFrom::controls_Change); this->check_utf8->Location = System::Drawing::Point(10,120); this->check_utf8->Text = _T("&Use UTF-8"); this->check_utf8->CheckedChanged += gcnew System::EventHandler(this, &FilterPropertyFrom::controls_Change); this->check_debugout->Location = System::Drawing::Point(10,140); this->check_debugout->Text = _T("&Show Debug Informations"); this->check_debugout->CheckedChanged += gcnew System::EventHandler(this, &FilterPropertyFrom::controls_Change); this->check_dcache->Location = System::Drawing::Point(10,160); this->check_dcache->Text = _T("&Disable cache"); this->check_dcache->CheckedChanged += gcnew System::EventHandler(this, &FilterPropertyFrom::controls_Change); this->check_hidesub->Size = System::Drawing::Size(200,16); this->check_immediate->Size = System::Drawing::Size(200,16); this->check_utf8->Size = System::Drawing::Size(200,16); this->check_debugout->Size = System::Drawing::Size(200,16); this->check_dcache->Size = System::Drawing::Size(200,16); this->label_predelay->Text = "Delay:"; this->label_predelay->Location = System::Drawing::Point(150,47); this->label_predelay->Size = System::Drawing::Size(36,12); this->num_delay->Location = System::Drawing::Point(192,45); this->num_delay->Size = System::Drawing::Size(70,19); this->num_delay->TextAlign = Forms::HorizontalAlignment::Right; this->num_delay->ReadOnly = false; this->num_delay->Maximum = System::Int32::MaxValue; this->num_delay->Minimum = System::Int32::MinValue; this->num_delay->ValueChanged += gcnew System::EventHandler(this, &FilterPropertyFrom::controls_Change); this->label_sufdelay->Text = "frames (1/60sec)"; this->label_sufdelay->Location = System::Drawing::Point(265,47); this->label_sufdelay->Size = System::Drawing::Size(94,12); this->StartPosition = Forms::FormStartPosition::Manual; this->Location = System::Drawing::Point(0,0); this->ClientSize = System::Drawing::Size(360,190); this->FormBorderStyle = Forms::FormBorderStyle::None; //this->BackColor = System::Drawing::Color::Red; this->KeyDown += gcnew Forms::KeyEventHandler(this, &FilterPropertyFrom::testtt); this->Controls->Add( this->button_reload ); this->Controls->Add( this->button_file ); this->Controls->Add( this->text_filename ); this->Controls->Add( this->check_hidesub ); this->Controls->Add( this->check_immediate ); this->Controls->Add( this->check_utf8 ); this->Controls->Add( this->check_debugout ); this->Controls->Add( this->check_dcache ); this->Controls->Add( this->label_predelay ); this->Controls->Add( this->label_sufdelay ); this->Controls->Add( this->num_delay ); this->ResumeLayout(false); } void FilterPropertyFrom::button_reload_Click(System::Object ^sender, System::EventArgs ^e) { this->m_pDirectJoyHack->reload_File(); } void FilterPropertyFrom::button_file_Click(System::Object ^sender, System::EventArgs ^e) { Forms::OpenFileDialog ^filediag = gcnew Forms::OpenFileDialog(); filediag->Title = _T("Choose HackENT file"); filediag->Filter = _T("HackENT file (*.txt)|*.txt|All Files (*.*)|*.*"); if (filediag->ShowDialog() == Forms::DialogResult::OK) { this->text_filename->Text = filediag->FileName; } this->put_Settings(); } void FilterPropertyFrom::controls_Change(System::Object ^sender, System::EventArgs ^e) { this->put_Settings(); } void FilterPropertyFrom::get_Settings() { bool b_temp; this->m_pDirectJoyHack->get_HideSubtitles ( &b_temp ); this->check_hidesub->Checked = b_temp; this->m_pDirectJoyHack->get_ChangeImmediate ( &b_temp ); this->check_immediate->Checked = b_temp; this->m_pDirectJoyHack->get_DebugOutput ( &b_temp ); this->check_debugout->Checked = b_temp; this->m_pDirectJoyHack->get_DisableCache ( &b_temp ); this->check_dcache->Checked = b_temp; __int32 i32temp; this->m_pDirectJoyHack->get_Delay ( &i32temp ); this->num_delay->Value = i32temp; WCHAR filename[MAX_PATH]; this->m_pDirectJoyHack->get_FileName ( filename ); this->text_filename->Text = gcnew System::String(filename); } void FilterPropertyFrom::put_Settings() { this->m_pDirectJoyHack->put_HideSubtitles ( this->check_hidesub->Checked ); this->m_pDirectJoyHack->put_ChangeImmediate ( this->check_immediate->Checked ); this->m_pDirectJoyHack->put_Delay ( System::Decimal::ToInt32(this->num_delay->Value) ); this->m_pDirectJoyHack->put_DebugOutput ( this->check_debugout->Checked ); this->m_pDirectJoyHack->put_DisableCache ( this->check_dcache->Checked ); pin_ptr pin_file = PtrToStringChars(this->text_filename->Text); this->m_pDirectJoyHack->put_FileName ( (WCHAR*)pin_file ); }