diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp index 73ac6ed728..721b2cdf28 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp @@ -19,17 +19,17 @@ #include "Config.h" #include "ConfigDlg.h" -BEGIN_EVENT_TABLE(ConfigDialog, wxDialog) -EVT_BUTTON(wxID_OK, ConfigDialog::SettingsChanged) -EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, ConfigDialog::SettingsChanged) -EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, ConfigDialog::SettingsChanged) -EVT_CHECKBOX(ID_ENABLE_THROTTLE, ConfigDialog::SettingsChanged) -EVT_CHECKBOX(ID_ENABLE_RE0_FIX, ConfigDialog::SettingsChanged) -EVT_CHECKBOX(ID_DISABLE_STREAMING, ConfigDialog::SettingsChanged) -EVT_COMMAND_SCROLL(ID_VOLUME, ConfigDialog::VolumeChanged) +BEGIN_EVENT_TABLE(DSPConfigDialogHLE, wxDialog) +EVT_BUTTON(wxID_OK, DSPConfigDialogHLE::SettingsChanged) +EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, DSPConfigDialogHLE::SettingsChanged) +EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogHLE::SettingsChanged) +EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogHLE::SettingsChanged) +EVT_CHECKBOX(ID_ENABLE_RE0_FIX, DSPConfigDialogHLE::SettingsChanged) +EVT_CHECKBOX(ID_DISABLE_STREAMING, DSPConfigDialogHLE::SettingsChanged) +EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogHLE::VolumeChanged) END_EVENT_TABLE() -ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) +DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { // Load config settings @@ -107,7 +107,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl } // Add audio output options -void ConfigDialog::AddBackend(const char* backend) +void DSPConfigDialogHLE::AddBackend(const char* backend) { // Update values m_BackendSelection->Append(wxString::FromAscii(backend)); @@ -124,11 +124,11 @@ void ConfigDialog::AddBackend(const char* backend) #endif } -ConfigDialog::~ConfigDialog() +DSPConfigDialogHLE::~DSPConfigDialogHLE() { } -void ConfigDialog::VolumeChanged(wxScrollEvent& WXUNUSED(event)) +void DSPConfigDialogHLE::VolumeChanged(wxScrollEvent& WXUNUSED(event)) { ac_Config.m_Volume = m_volumeSlider->GetValue(); ac_Config.Update(); @@ -136,7 +136,7 @@ void ConfigDialog::VolumeChanged(wxScrollEvent& WXUNUSED(event)) m_volumeText->SetLabel(wxString::Format(wxT("%d %%"), m_volumeSlider->GetValue())); } -void ConfigDialog::SettingsChanged(wxCommandEvent& event) +void DSPConfigDialogHLE::SettingsChanged(wxCommandEvent& event) { g_Config.m_EnableHLEAudio = m_buttonEnableHLEAudio->GetValue(); g_Config.m_EnableRE0Fix = m_buttonEnableRE0Fix->GetValue(); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h index 9371ce9146..853874cd37 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h @@ -24,16 +24,16 @@ #include #include "AudioCommon.h" -class ConfigDialog : public wxDialog +class DSPConfigDialogHLE : public wxDialog { public: - ConfigDialog(wxWindow *parent, + DSPConfigDialogHLE(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); - virtual ~ConfigDialog(); + virtual ~DSPConfigDialogHLE(); void AddBackend(const char *backend); private: diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp index 42a442f1d4..cd2a976aea 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Blocks.cpp @@ -42,7 +42,7 @@ // Make the wxTextCtrls scroll with each other -void CDebugger::DoScrollBlocks() +void DSPDebuggerHLE::DoScrollBlocks() { // ShowPosition = in letters // GetScrollPos = number of lines from the top @@ -75,13 +75,13 @@ void CDebugger::DoScrollBlocks() }*/ } -void CDebugger::ScrollBlocksMouse(wxMouseEvent& event) +void DSPDebuggerHLE::ScrollBlocksMouse(wxMouseEvent& event) { DoScrollBlocks(); event.Skip(); // otherwise we remove the regular behavior, for example scrolling } -void CDebugger::ScrollBlocksCursor(wxScrollWinEvent& event) +void DSPDebuggerHLE::ScrollBlocksCursor(wxScrollWinEvent& event) { DoScrollBlocks(); event.Skip(); // otherwise we remove the regular behavior, for example scrolling diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp index e47da3bca4..832cfb96f9 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp @@ -42,38 +42,38 @@ // ======================================================================================= // Event table and class -BEGIN_EVENT_TABLE(CDebugger,wxDialog) - EVT_CLOSE(CDebugger::OnClose) // on close event +BEGIN_EVENT_TABLE(DSPDebuggerHLE,wxDialog) + EVT_CLOSE(DSPDebuggerHLE::OnClose) // on close event - EVT_BUTTON(ID_UPD,CDebugger::OnUpdate) // buttons + EVT_BUTTON(ID_UPD,DSPDebuggerHLE::OnUpdate) // buttons // left cotrols - EVT_CHECKLISTBOX(IDC_CHECKLIST5, CDebugger::OnOptions) // options - EVT_CHECKLISTBOX(IDC_CHECKLIST6, CDebugger::OnShowAll) - EVT_RADIOBOX(IDC_RADIO0,CDebugger::ShowBase) // update frequency + EVT_CHECKLISTBOX(IDC_CHECKLIST5, DSPDebuggerHLE::OnOptions) // options + EVT_CHECKLISTBOX(IDC_CHECKLIST6, DSPDebuggerHLE::OnShowAll) + EVT_RADIOBOX(IDC_RADIO0,DSPDebuggerHLE::ShowBase) // update frequency // right cotrols - EVT_RADIOBOX(IDC_RADIO0,CDebugger::ShowBase) - EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency - EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets - EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings + EVT_RADIOBOX(IDC_RADIO0,DSPDebuggerHLE::ShowBase) + EVT_RADIOBOX(IDC_RADIO1,DSPDebuggerHLE::ChangeFrequency) // update frequency + EVT_RADIOBOX(IDC_RADIO2,DSPDebuggerHLE::ChangePreset) // presets + EVT_CHECKLISTBOX(IDC_CHECKLIST1, DSPDebuggerHLE::OnSettingsCheck) // settings - EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, CDebugger::UpdateMail) // mails - EVT_RADIOBOX(IDC_RADIO3,CDebugger::ChangeMail) - EVT_CHECKLISTBOX(IDC_CHECKLIST2, CDebugger::OnGameChange) // gc - EVT_CHECKLISTBOX(IDC_CHECKLIST3, CDebugger::OnGameChange) // wii - EVT_CHECKLISTBOX(IDC_CHECKLIST4, CDebugger::MailSettings) // settings + EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, DSPDebuggerHLE::UpdateMail) // mails + EVT_RADIOBOX(IDC_RADIO3,DSPDebuggerHLE::ChangeMail) + EVT_CHECKLISTBOX(IDC_CHECKLIST2, DSPDebuggerHLE::OnGameChange) // gc + EVT_CHECKLISTBOX(IDC_CHECKLIST3, DSPDebuggerHLE::OnGameChange) // wii + EVT_CHECKLISTBOX(IDC_CHECKLIST4, DSPDebuggerHLE::MailSettings) // settings - //EVT_RIGHT_DOWN(CDebugger::ScrollBlocks) - //EVT_LEFT_DOWN(CDebugger::ScrollBlocks) - //EVT_MOUSE_EVENTS(CDebugger::ScrollBlocks) - //EVT_MOTION(CDebugger::ScrollBlocks) + //EVT_RIGHT_DOWN(DSPDebuggerHLE::ScrollBlocks) + //EVT_LEFT_DOWN(DSPDebuggerHLE::ScrollBlocks) + //EVT_MOUSE_EVENTS(DSPDebuggerHLE::ScrollBlocks) + //EVT_MOTION(DSPDebuggerHLE::ScrollBlocks) - //EVT_SCROLL(CDebugger::ScrollBlocks) - //EVT_SCROLLWIN(CDebugger::ScrollBlocks) + //EVT_SCROLL(DSPDebuggerHLE::ScrollBlocks) + //EVT_SCROLLWIN(DSPDebuggerHLE::ScrollBlocks) END_EVENT_TABLE() -CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title, +DSPDebuggerHLE::DSPDebuggerHLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) , m_GPRListView(NULL) @@ -131,16 +131,16 @@ CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title, //m_bl95, m_PageBlock, sBlock m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBTRACK, - wxScrollWinEventHandler(CDebugger::ScrollBlocksCursor), (wxObject*)NULL, this); + wxScrollWinEventHandler(DSPDebuggerHLE::ScrollBlocksCursor), (wxObject*)NULL, this); m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBRELEASE, - wxScrollWinEventHandler(CDebugger::ScrollBlocksCursor), (wxObject*)NULL, this); + wxScrollWinEventHandler(DSPDebuggerHLE::ScrollBlocksCursor), (wxObject*)NULL, this); m_bl95->Connect(wxID_ANY, wxEVT_MOTION, - wxMouseEventHandler(CDebugger::ScrollBlocksMouse), (wxObject*)NULL, this); + wxMouseEventHandler(DSPDebuggerHLE::ScrollBlocksMouse), (wxObject*)NULL, this); m_bl95->Connect(wxID_ANY, wxEVT_MOUSEWHEEL, - wxMouseEventHandler(CDebugger::ScrollBlocksMouse), (wxObject*)NULL, this); + wxMouseEventHandler(DSPDebuggerHLE::ScrollBlocksMouse), (wxObject*)NULL, this); } -CDebugger::~CDebugger() +DSPDebuggerHLE::~DSPDebuggerHLE() { // empty IniFile file; @@ -154,7 +154,7 @@ CDebugger::~CDebugger() // ======================================================================== // System functions // -------------- -void CDebugger::OnClose(wxCloseEvent& /*event*/) +void DSPDebuggerHLE::OnClose(wxCloseEvent& /*event*/) { // Save the window position when we hide the window to IniFile file; @@ -165,18 +165,7 @@ void CDebugger::OnClose(wxCloseEvent& /*event*/) EndModal(0); } -void CDebugger::DoHide() -{ - Hide(); -} - -void CDebugger::DoShow() -{ - Show(); - DoShowConsole(); // The console goes with the wx window -} - -void CDebugger::OnUpdate(wxCommandEvent& /*event*/) +void DSPDebuggerHLE::OnUpdate(wxCommandEvent& /*event*/) { this->NotifyUpdate(); } @@ -186,19 +175,18 @@ void CDebugger::OnUpdate(wxCommandEvent& /*event*/) // ========================================================================== // Save and load settings // -------------- -void CDebugger::Save(IniFile& _IniFile) const +void DSPDebuggerHLE::Save(IniFile& _IniFile) const { // TODO2: get the screen resolution and make limits from that if(GetPosition().x < 1000 && GetPosition().y < 1000 - && GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000 - ) + && GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000) { _IniFile.Set("SoundWindow", "x", GetPosition().x); _IniFile.Set("SoundWindow", "y", GetPosition().y); _IniFile.Set("SoundWindow", "w", GetSize().GetWidth()); _IniFile.Set("SoundWindow", "h", GetSize().GetHeight()); } - _IniFile.Set("SoundWindow", "Console", m_options->IsChecked(3)); // save settings + // save settings _IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection()); _IniFile.Set("SoundWindow", "ScanMails", m_gcwiiset->IsChecked(0)); _IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1)); @@ -206,7 +194,7 @@ void CDebugger::Save(IniFile& _IniFile) const } -void CDebugger::Load(IniFile& _IniFile) +void DSPDebuggerHLE::Load(IniFile& _IniFile) { int x,y,w,h; _IniFile.Get("SoundWindow", "x", &x, GetPosition().x); @@ -215,12 +203,6 @@ void CDebugger::Load(IniFile& _IniFile) _IniFile.Get("SoundWindow", "h", &h, GetSize().GetHeight()); SetSize(x, y, w, h); - // Show console or not - bool Console; - _IniFile.Get("SoundWindow", "Console", &Console, m_options->IsChecked(3)); - m_options->Check(3, Console); - DoShowConsole(); - // Show number base _IniFile.Get("SoundWindow", "ShowBase", &bShowBase, !m_RadioBox[0]->GetSelection()); m_RadioBox[0]->SetSelection(!bShowBase); @@ -241,7 +223,7 @@ void CDebugger::Load(IniFile& _IniFile) ////////////////////////////////////////////////////////////////////////////////////////// // Create GUI controls // ------------- -void CDebugger::CreateGUIControls() +void DSPDebuggerHLE::CreateGUIControls() { SetTitle(wxT("Sound Debugging")); @@ -350,12 +332,10 @@ SetTitle(wxT("Sound Debugging")); m_options->Append(wxT("Save to file")); m_options->Append(wxT("Only looping")); m_options->Append(wxT("Show all")); - m_options->Append(wxT("Show console")); m_options->Check(0, gSaveFile); m_options->Check(1, gOnlyLooping); m_options->Check(2, gShowAll); - m_options->Check(3, gSaveFile); m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40, m_options->GetCount() * 15)); @@ -563,7 +543,7 @@ SetTitle(wxT("Sound Debugging")); // ======================================================================================= // Settings -void CDebugger::OnSettingsCheck(wxCommandEvent& event) +void DSPDebuggerHLE::OnSettingsCheck(wxCommandEvent& event) { gSSBM = m_settings->IsChecked(0); gSSBMremedy1 = m_settings->IsChecked(1); @@ -576,12 +556,12 @@ void CDebugger::OnSettingsCheck(wxCommandEvent& event) // ======================================================================================= // Change preset -void CDebugger::ChangePreset(wxCommandEvent& event) +void DSPDebuggerHLE::ChangePreset(wxCommandEvent& event) { DoChangePreset(); } -void CDebugger::DoChangePreset() +void DSPDebuggerHLE::DoChangePreset() { if(m_RadioBox[2]->GetSelection() == 0) gPreset = 0; @@ -595,7 +575,7 @@ void CDebugger::DoChangePreset() // ======================================================================================= // Show base -void CDebugger::ShowBase(wxCommandEvent& event) +void DSPDebuggerHLE::ShowBase(wxCommandEvent& event) { if(m_RadioBox[0]->GetSelection() == 0) bShowBase = true; @@ -605,12 +585,12 @@ void CDebugger::ShowBase(wxCommandEvent& event) // ======================================================================================= // Change update frequency -void CDebugger::ChangeFrequency(wxCommandEvent& event) +void DSPDebuggerHLE::ChangeFrequency(wxCommandEvent& event) { DoChangeFrequency(); } -void CDebugger::DoChangeFrequency() +void DSPDebuggerHLE::DoChangeFrequency() { if(m_RadioBox[1]->GetSelection() == 0) gUpdFreq = 0; @@ -624,17 +604,14 @@ void CDebugger::DoChangeFrequency() // ======================================================================================= // Options -void CDebugger::OnOptions(wxCommandEvent& event) +void DSPDebuggerHLE::OnOptions(wxCommandEvent& event) { gSaveFile = m_options->IsChecked(0); gOnlyLooping = m_options->IsChecked(1); gShowAll = m_options->IsChecked(2); - gSaveFile = m_options->IsChecked(3); - - if(event.GetInt() == 3) DoShowConsole(); } -void CDebugger::OnShowAll(wxCommandEvent& event) +void DSPDebuggerHLE::OnShowAll(wxCommandEvent& event) { /// Only allow one selection at a time for (u32 i = 0; i < m_opt_showall->GetCount(); ++i) @@ -647,24 +624,7 @@ void CDebugger::OnShowAll(wxCommandEvent& event) else giShowAll = -1; } -// -------------- - - -// ======================================================================================= -// Show or hide console window -void CDebugger::ShowHideConsole(wxCommandEvent& event) -{ - DoShowConsole(); -} - -void CDebugger::DoShowConsole() -{ - ConsoleListener* console = LogManager::GetInstance()->getConsoleListener(); - if(m_options->IsChecked(3) && !console->IsOpen()) - console->Open(); -} - -void CDebugger::NotifyUpdate() +void DSPDebuggerHLE::NotifyUpdate() { if (m_GPRListView != NULL) { diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h index 7d9ac23595..dbecba70bc 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.h @@ -19,8 +19,8 @@ // ////////////////////////////////////////////////////////////////////////////////////////// -#ifndef __CDebugger_h__ -#define __CDebugger_h__ +#ifndef __DSPDebuggerHLE_h__ +#define __DSPDebuggerHLE_h__ // general things #include @@ -51,42 +51,41 @@ class CPBView; class IniFile; -// Window settings -#undef CDebugger_STYLE -#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE -class CDebugger : public wxDialog +class DSPDebuggerHLE : public wxDialog { private: DECLARE_EVENT_TABLE(); public: - CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = CDebugger_STYLE); + DSPDebuggerHLE(wxWindow *parent, + wxWindowID id = 1, + const wxString &title = wxT("Sound Debugger"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); - virtual ~CDebugger(); + virtual ~DSPDebuggerHLE(); void Save(IniFile& _IniFile) const; void Load(IniFile& _IniFile); - void DoHide(); void DoShow(); void NotifyUpdate(); void OnUpdate(wxCommandEvent& event); - void ShowHideConsole(wxCommandEvent& event); // options + // options void ShowBase(wxCommandEvent& event); - void DoShowConsole(); - //void OnlyLooping(wxCommandEvent& event); void OnOptions(wxCommandEvent& event); void OnShowAll(wxCommandEvent& event); - void ChangeFrequency(wxCommandEvent& event); // update frequency + // update frequency + void ChangeFrequency(wxCommandEvent& event); void DoChangeFrequency(); void ChangePreset(wxCommandEvent& event); void DoChangePreset(); - void OnSettingsCheck(wxCommandEvent& event); // settings + // settings + void OnSettingsCheck(wxCommandEvent& event); // ============== Mail void DoUpdateMail(); @@ -161,8 +160,6 @@ class CDebugger : public wxDialog ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook ID_LOG, ID_LOG1, // mails ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92, - ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values - }; void OnClose(wxCloseEvent& event); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp index c2c4786312..6ad3f501e7 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/File.cpp @@ -27,7 +27,7 @@ #if defined(HAVE_WX) && HAVE_WX #include "../Debugger/Debugger.h" -extern CDebugger* m_frame; +extern DSPDebuggerHLE* m_DebuggerFrame; #endif #include "../Debugger/File.h" @@ -88,7 +88,7 @@ int PrintFile(int a, char *fmt, ...) { #if defined(DEBUG_HLE) && defined(_WIN32) - if(m_frame->gSaveFile) + if(m_DebuggerFrame->gSaveFile) { char s[StringSize]; va_list argptr; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Logging.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Logging.cpp index d0a9307f23..b51f21b7e9 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Logging.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Logging.cpp @@ -51,7 +51,7 @@ // ------------- // Externals -extern CDebugger* m_frame; +extern DSPDebuggerHLE* m_DebuggerFrame; //int PBSize = 128; // Parameter blocks @@ -148,7 +148,7 @@ std::vector numberRunning(NUMBER_OF_PBS); // Classes -extern CDebugger* m_frame; +extern DSPDebuggerHLE* m_DebuggerFrame; ////////////////////////// @@ -160,7 +160,7 @@ std::string writeTitle(int a, bool Wii) std::string b; if(a == 0) { - if(m_frame->bShowBase) // show base 10 + if(m_DebuggerFrame->bShowBase) // show base 10 { b = " adpcm adpcm_loop\n"; b = b + " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n"; @@ -173,7 +173,7 @@ std::string writeTitle(int a, bool Wii) } else if(a == 1) { - if(m_frame->bShowBase) // show base 10 + if(m_DebuggerFrame->bShowBase) // show base 10 { b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n"; } @@ -184,7 +184,7 @@ std::string writeTitle(int a, bool Wii) } else if(a == 2) { - if(m_frame->bShowBase) // show base 10 + if(m_DebuggerFrame->bShowBase) // show base 10 { b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n"; } @@ -195,7 +195,7 @@ std::string writeTitle(int a, bool Wii) } else if(a == 3) { - if(m_frame->bShowBase) // show base 10 + if(m_DebuggerFrame->bShowBase) // show base 10 { if(Wii) b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n"; @@ -244,7 +244,7 @@ std::string writeMessage(int a, int i, bool Wii) */ if(a == 0) { - if(m_frame->bShowBase) // base 10 (decimal) + if(m_DebuggerFrame->bShowBase) // base 10 (decimal) { if(Wii) // Wii { @@ -280,7 +280,7 @@ std::string writeMessage(int a, int i, bool Wii) } else if(a == 1) { - if(m_frame->bShowBase) // base 10 (decimal) + if(m_DebuggerFrame->bShowBase) // base 10 (decimal) { sprintf(buf,"%c%02i %10s/%10s %10s | %6s %6s | %u %u %u | %u %u %u %u %u %08x %08x %08x %08x %08x %08x", 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(), @@ -316,7 +316,7 @@ std::string writeMessage(int a, int i, bool Wii) } else if(a == 2) { - if(m_frame->bShowBase) + if(m_DebuggerFrame->bShowBase) { sprintf(buf,"%c%02i %10s/%10s %10s | %05i %05i | %i %i | %10s %10s", 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(), @@ -342,7 +342,7 @@ std::string writeMessage(int a, int i, bool Wii) */ else if(a == 3) { - if(m_frame->bShowBase) + if(m_DebuggerFrame->bShowBase) { if(Wii) // Wii { @@ -532,23 +532,23 @@ bool PrepareConditions(bool Wii, int i, ParamBlockType &PBs) { bool Conditions; - if (m_frame->gOnlyLooping) // show only looping blocks + if (m_DebuggerFrame->gOnlyLooping) // show only looping blocks { Conditions = PBs[i].audio_addr.looping ? true : false; } - else if (m_frame->gShowAll) // show all blocks + else if (m_DebuggerFrame->gShowAll) // show all blocks { Conditions = true; } - else if (m_frame->giShowAll > -1) // show all blocks + else if (m_DebuggerFrame->giShowAll > -1) // show all blocks { - if (m_frame->giShowAll == 0) + if (m_DebuggerFrame->giShowAll == 0) Conditions = (i < 31); - else if(m_frame->giShowAll == 1) + else if(m_DebuggerFrame->giShowAll == 1) Conditions = (i > 30 && i < 61); - else if(m_frame->giShowAll == 2) + else if(m_DebuggerFrame->giShowAll == 2) Conditions = (i > 60 && i < 91); - else if(m_frame->giShowAll == 3) + else if(m_DebuggerFrame->giShowAll == 3) Conditions = (i > 90 && i < 121); } else // show only the ones that have recently been running @@ -640,7 +640,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // Control how often the screen is updated, and then update the screen // -------------- if(a == 0) count1++; // a == 0 when Logging is called before the blocks are updated - if (m_frame->gUpdFreq > 0 && count1 > (200/m_frame->gUpdFreq)) + if (m_DebuggerFrame->gUpdFreq > 0 && count1 > (200/m_DebuggerFrame->gUpdFreq)) { // ======================================================================================= @@ -712,7 +712,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // -------------- char buffer [1000] = ""; std::string sbuff; - sbuff = writeTitle(m_frame->gPreset, Wii); + sbuff = writeTitle(m_DebuggerFrame->gPreset, Wii); // ============== @@ -733,7 +733,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // -------------------------------------- // Save playback history text string for the console and GUI debugger // ------------------ - if(m_frame) + if(m_DebuggerFrame) { std::string guipr; // gui progress @@ -750,7 +750,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, } u32 run = atoi( guipr.c_str()); - m_frame->m_GPRListView->m_CachedRegs[1][i] = run; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[1][i] = run; guipr.clear(); } @@ -771,41 +771,41 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // Hopefully this is false if we don't have a debugging window and so it doesn't cause a crash - if(m_frame) + if(m_DebuggerFrame) { - m_frame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i]; - m_frame->m_GPRListView->m_CachedRegs[3][i] = gsampleEnd[i]; - m_frame->m_GPRListView->m_CachedRegs[4][i] = gloopPos[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[3][i] = gsampleEnd[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[4][i] = gloopPos[i]; - m_frame->m_GPRListView->m_CachedRegs[5][i] = gvolume_left[i]; - m_frame->m_GPRListView->m_CachedRegs[6][i] = gvolume_right[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[5][i] = gvolume_left[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[6][i] = gvolume_right[i]; - m_frame->m_GPRListView->m_CachedRegs[7][i] = glooping[i]; - m_frame->m_GPRListView->m_CachedRegs[8][i] = gloop1[i]; - m_frame->m_GPRListView->m_CachedRegs[9][i] = gloop2[i]; - m_frame->m_GPRListView->m_CachedRegs[10][i] = gloop3[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[7][i] = glooping[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[8][i] = gloop1[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[9][i] = gloop2[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[10][i] = gloop3[i]; - m_frame->m_GPRListView->m_CachedRegs[11][i] = gis_stream[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[11][i] = gis_stream[i]; - m_frame->m_GPRListView->m_CachedRegs[12][i] = gaudioFormat[i]; - m_frame->m_GPRListView->m_CachedRegs[13][i] = gsrc_type[i]; - m_frame->m_GPRListView->m_CachedRegs[14][i] = gcoef[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[12][i] = gaudioFormat[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[13][i] = gsrc_type[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[14][i] = gcoef[i]; - m_frame->m_GPRListView->m_CachedRegs[15][i] = gfrac[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[15][i] = gfrac[i]; - m_frame->m_GPRListView->m_CachedRegs[16][i] = gratio[i]; - m_frame->m_GPRListView->m_CachedRegs[17][i] = gratiohi[i]; - m_frame->m_GPRListView->m_CachedRegs[18][i] = gratiolo[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[16][i] = gratio[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[17][i] = gratiohi[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[18][i] = gratiolo[i]; - m_frame->m_GPRListView->m_CachedRegs[19][i] = gupdates1[i]; - m_frame->m_GPRListView->m_CachedRegs[20][i] = gupdates2[i]; - m_frame->m_GPRListView->m_CachedRegs[21][i] = gupdates3[i]; - m_frame->m_GPRListView->m_CachedRegs[22][i] = gupdates4[i]; - m_frame->m_GPRListView->m_CachedRegs[23][i] = gupdates5[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[19][i] = gupdates1[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[20][i] = gupdates2[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[21][i] = gupdates3[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[22][i] = gupdates4[i]; + m_DebuggerFrame->m_GPRListView->m_CachedRegs[23][i] = gupdates5[i]; } // add new line - sbuff = sbuff + writeMessage(m_frame->gPreset, i, Wii); strcpy(buffer, ""); + sbuff = sbuff + writeMessage(m_DebuggerFrame->gPreset, i, Wii); strcpy(buffer, ""); sbuff = sbuff + "\n"; } // end of if(Conditions) @@ -818,13 +818,13 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // Write global values // --------------- int nOfBlocks; - int span = m_frame->gLastBlock - m_addressPBs; + int span = m_DebuggerFrame->gLastBlock - m_addressPBs; if(Wii) - nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 256; + nOfBlocks = (m_DebuggerFrame->gLastBlock-m_addressPBs) / 256; else - nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 192; + nOfBlocks = (m_DebuggerFrame->gLastBlock-m_addressPBs) / 192; sprintf(buffer, "\nThe parameter blocks span from %08x to %08x (%s bytes) impl. %i blocks | numberOfPBs %i | _iSize %i\n", - m_addressPBs, m_frame->gLastBlock, ThS(span).c_str(), nOfBlocks, numberOfPBs, _iSize); + m_addressPBs, m_DebuggerFrame->gLastBlock, ThS(span).c_str(), nOfBlocks, numberOfPBs, _iSize); sbuff = sbuff + buffer; strcpy(buffer, ""); // =============== @@ -834,7 +834,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // --------------- sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i\nSequenced %i | Volume %i | Reset %i | Only looping %i | Save file %i\n", gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced, - gVolume, gReset, m_frame->gOnlyLooping, m_frame->gSaveFile); + gVolume, gReset, m_DebuggerFrame->gOnlyLooping, m_DebuggerFrame->gSaveFile); sbuff = sbuff + buffer; strcpy(buffer, ""); // =============== @@ -895,9 +895,9 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs, // New values are written so update - DISABLED - It flickered a lot, even worse than a // console window. So for now only the console windows is updated. /* - if(m_frame) + if(m_DebuggerFrame) { - m_frame->NotifyUpdate(); + m_DebuggerFrame->NotifyUpdate(); } */ @@ -914,7 +914,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii) { /* Doing all this may have a noticable CPU effect, so we can disable it completely this way. But remember that "Save to file" will not write anything then either. */ - if (m_frame->gUpdFreq > 0) + if (m_DebuggerFrame->gUpdFreq > 0) { int version; // AX version int numberOfPBs; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp index c274e08892..906fe4f90c 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Mails.cpp @@ -46,14 +46,14 @@ // Declarations and definitions // ------------- extern std::vector sMailLog, sMailTime; -extern CDebugger* m_frame; +extern DSPDebuggerHLE* m_DebuggerFrame; /////////////////////////////// // ======================================================================================= // Update mail window // -------------- -void CDebugger::DoUpdateMail() +void DSPDebuggerHLE::DoUpdateMail() { //Console::Print("i %i %i\n", sFullMail.size(), sMailLog.size()); @@ -68,17 +68,17 @@ void CDebugger::DoUpdateMail() } -void CDebugger::UpdateMail(wxNotebookEvent& event) +void DSPDebuggerHLE::UpdateMail(wxNotebookEvent& event) { DoUpdateMail(); - /* This may be called before m_frame is fully created through the + /* This may be called before m_DebuggerFrame is fully created through the EVT_NOTEBOOK_PAGE_CHANGED, in that case it will crash because this is accessing members of it */ - if(StoreMails && m_frame) ReadDir(); + if(StoreMails && m_DebuggerFrame) ReadDir(); } // Change mail from radio button change -void CDebugger::ChangeMail(wxCommandEvent& event) +void DSPDebuggerHLE::ChangeMail(wxCommandEvent& event) { //Console::Print("abc"); DoUpdateMail(); @@ -91,7 +91,7 @@ void CDebugger::ChangeMail(wxCommandEvent& event) // ======================================================================================= // Read out mails from dir // -------------- -void CDebugger::ReadDir() +void DSPDebuggerHLE::ReadDir() { CFileSearch::XStringVector Directories; //Directories.push_back("Logs/Mail"); @@ -157,7 +157,7 @@ void CDebugger::ReadDir() // ======================================================================================= // Check for duplicates and count files from all_all_files // -------------- -bool CDebugger::NoDuplicate(std::string FileName) +bool DSPDebuggerHLE::NoDuplicate(std::string FileName) { for (u32 i = 0; i < all_files.size(); i++) { @@ -168,7 +168,7 @@ bool CDebugger::NoDuplicate(std::string FileName) } // Count the number of files for each game -u32 CDebugger::CountFiles(std::string FileName) +u32 DSPDebuggerHLE::CountFiles(std::string FileName) { int match = 0; @@ -187,7 +187,7 @@ u32 CDebugger::CountFiles(std::string FileName) // ======================================================================================= // Read file from harddrive // -------------- -std::string CDebugger::Readfile_(std::string FileName) +std::string DSPDebuggerHLE::Readfile_(std::string FileName) { char c; // declare a char variable FILE *file; // declare a FILE pointer @@ -220,7 +220,7 @@ std::string CDebugger::Readfile_(std::string FileName) } // Read file -void CDebugger::Readfile(std::string FileName, bool GC) +void DSPDebuggerHLE::Readfile(std::string FileName, bool GC) { u32 n = CountFiles(FileName); // count how many mails we have u32 curr_n = 0; @@ -264,7 +264,7 @@ void CDebugger::Readfile(std::string FileName, bool GC) // ======================================================================================= // Read the file to the text window // --------------- -void CDebugger::OnGameChange(wxCommandEvent& event) +void DSPDebuggerHLE::OnGameChange(wxCommandEvent& event) { if(event.GetId() == 2006) { @@ -286,7 +286,7 @@ void CDebugger::OnGameChange(wxCommandEvent& event) } // Settings -void CDebugger::MailSettings(wxCommandEvent& event) +void DSPDebuggerHLE::MailSettings(wxCommandEvent& event) { //for (int i = 0; i < all_all_files.size(); ++i) //Console::Print("s: %s \n", all_all_files.at(i).c_str()); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp index 951404cb54..2bb67a8eb6 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp @@ -20,7 +20,7 @@ #if defined(HAVE_WX) && HAVE_WX #include "../Debugger/Debugger.h" //#include "../Logging/File.h" // For PrintFile() -extern CDebugger* m_frame; +extern DSPDebuggerHLE* m_DebuggerFrame; #endif #include #include "../Config.h" @@ -98,7 +98,7 @@ void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, va_list ap) vsprintf(Msg, _fmt, ap); #if defined(HAVE_WX) && HAVE_WX -if(m_frame->ScanMails) +if(m_DebuggerFrame->ScanMails) { if(strcmp(Msg, "Begin") == 0) @@ -128,12 +128,12 @@ if(m_frame->ScanMails) sMailLog.push_back(TmpMailLog); // Save file to disc - if(m_frame->StoreMails) + if(m_DebuggerFrame->StoreMails) { SaveLogFile(TmpMailLog, saveNext, 1, Wii); } - m_frame->DoUpdateMail(); // update the view + m_DebuggerFrame->DoUpdateMail(); // update the view saveNext = 0; } } @@ -157,7 +157,7 @@ if(m_frame->ScanMails) void CUCode_AX::SaveMail(bool Wii, u32 _uMail) { #if defined(HAVE_WX) && HAVE_WX -if(m_frame->ScanMails) +if(m_DebuggerFrame->ScanMails) { int i = 0; std::string sTemp; @@ -192,11 +192,11 @@ if(m_frame->ScanMails) // Compare this mail to old mails u32 addnew = 0; - for (u32 j = 0; j < m_frame->sMail.size(); j++) + for (u32 j = 0; j < m_DebuggerFrame->sMail.size(); j++) { - if(m_frame->sMail.at(j).length() != sTemp.length()) + if(m_DebuggerFrame->sMail.at(j).length() != sTemp.length()) { - //wxMessageBox( wxString::Format("%s \n\n%s", m_frame->sMail.at(i).c_str(), + //wxMessageBox( wxString::Format("%s \n\n%s", m_DebuggerFrame->sMail.at(i).c_str(), // sTemp.c_str()) ); addnew++; } @@ -204,10 +204,10 @@ if(m_frame->ScanMails) // In case the mail didn't match any saved mail, save it - if(addnew == m_frame->sMail.size()) + if(addnew == m_DebuggerFrame->sMail.size()) { - //Console::Print("%i | %i\n", addnew, m_frame->sMail.size()); - u32 resizeTo = (u32)(m_frame->sMail.size() + 1); + //Console::Print("%i | %i\n", addnew, m_DebuggerFrame->sMail.size()); + u32 resizeTo = (u32)(m_DebuggerFrame->sMail.size() + 1); // ------------------------------------ // get timestamp @@ -219,15 +219,15 @@ if(m_frame->ScanMails) sMailTime.push_back(Msg); // ------------------------------------ - m_frame->sMail.push_back(sTemp); // save the main comparison mail + m_DebuggerFrame->sMail.push_back(sTemp); // save the main comparison mail std::string lMail = sTemp + "------------------\n" + sTempEnd; - m_frame->sFullMail.push_back(lMail); + m_DebuggerFrame->sFullMail.push_back(lMail); // enable the radio button and update view - if(resizeTo <= m_frame->m_RadioBox[3]->GetCount()) + if(resizeTo <= m_DebuggerFrame->m_RadioBox[3]->GetCount()) { - m_frame->m_RadioBox[3]->Enable(resizeTo - 1, true); - m_frame->m_RadioBox[3]->Select(resizeTo - 1); + m_DebuggerFrame->m_RadioBox[3]->Enable(resizeTo - 1, true); + m_DebuggerFrame->m_RadioBox[3]->Select(resizeTo - 1); } addnew = 0; @@ -235,9 +235,9 @@ if(m_frame->ScanMails) // ------------------------------------ // Save as file - if(m_frame->StoreMails) + if(m_DebuggerFrame->StoreMails) { - //Console::Print("m_frame->sMail.size(): %i | resizeTo:%i\n", m_frame->sMail.size(), resizeTo); + //Console::Print("m_DebuggerFrame->sMail.size(): %i | resizeTo:%i\n", m_DebuggerFrame->sMail.size(), resizeTo); SaveLogFile(lMail, resizeTo, 0, Wii); } @@ -268,7 +268,7 @@ int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num) #if defined(HAVE_WX) && HAVE_WX #if defined(_DEBUG) || defined(DEBUGFAST) - if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location + if(m_DebuggerFrame) m_DebuggerFrame->gLastBlock = blockAddr + p*2 + 2; // save last block location #endif #endif } @@ -321,7 +321,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) #if defined(HAVE_WX) && HAVE_WX // write logging data to debugger - if (m_frame && _pBuffer) + if (m_DebuggerFrame && _pBuffer) { CUCode_AX::Logging(_pBuffer, _iSize, 0, false); } @@ -408,7 +408,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize) } #if defined(HAVE_WX) && HAVE_WX // write logging data to debugger again after the update - if (m_frame && _pBuffer) + if (m_DebuggerFrame && _pBuffer) { CUCode_AX::Logging(_pBuffer, _iSize, 1, false); } @@ -453,7 +453,7 @@ void CUCode_AX::SaveLog(const char* _fmt, ...) { #if defined(HAVE_WX) && HAVE_WX va_list ap; va_start(ap, _fmt); - if(m_frame) SaveLog_(false, _fmt, ap); + if(m_DebuggerFrame) SaveLog_(false, _fmt, ap); va_end(ap); #endif } @@ -488,7 +488,7 @@ bool CUCode_AX::AXTask(u32& _uMail) bool bExecuteList = true; #if defined(HAVE_WX) && HAVE_WX - if(m_frame) SaveMail(false, _uMail); // Save mail for debugging + if(m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging #endif while (bExecuteList) { diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp index 0036752f94..3cf31a7cdc 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AXWii.cpp @@ -20,7 +20,7 @@ #if defined(HAVE_WX) && HAVE_WX #include "../Debugger/Debugger.h" //#include "../Logging/File.h" // For PrintFile -extern CDebugger * m_frame; +extern DSPDebuggerHLE * m_DebuggerFrame; #endif #include "../MailHandler.h" @@ -110,7 +110,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) // ------------------------------------------- // write logging data to debugger #if defined(HAVE_WX) && HAVE_WX - if (m_frame && _pBuffer) + if (m_DebuggerFrame && _pBuffer) { lCUCode_AX->Logging(_pBuffer, _iSize, 0, true); @@ -119,7 +119,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) int p = numberOfPBs - 1; if(numberOfPBs > p) { - if(PBs[p].running && !m_frame->upd95) + if(PBs[p].running && !m_DebuggerFrame->upd95) { const u32 blockAddr = (u32)(PBs[p].this_pb_hi<< 16) | PBs[p].this_pb_lo; const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr); @@ -127,24 +127,24 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) { if(i == 10 || i == 34 || i == 41 || i == 46 || i == 46 || i == 58 || i == 60 || i == 68 || i == 88 || i == 95) - {m_frame->str0 += "\n"; m_frame->str95 += "\n";} + {m_DebuggerFrame->str0 += "\n"; m_DebuggerFrame->str95 += "\n";} std::string line = StringFromFormat("%02i|%02i : %s : %s", i/2, i, - m_frame->PBn[i].c_str(), m_frame->PBp[i].c_str() + m_DebuggerFrame->PBn[i].c_str(), m_DebuggerFrame->PBp[i].c_str() ); for (u32 j = 0; j < 50 - line.length(); ++j) line += " "; - m_frame->str0 += line; + m_DebuggerFrame->str0 += line; - m_frame->str0 += "\n"; - m_frame->str95 += StringFromFormat(" : %02i|%02i : %04x%04x\n", + m_DebuggerFrame->str0 += "\n"; + m_DebuggerFrame->str95 += StringFromFormat(" : %02i|%02i : %04x%04x\n", i/2, i, Common::swap16(pSrc[i]), Common::swap16(pSrc[i+1])); } - m_frame->m_bl95->AppendText(wxString::FromAscii(m_frame->str95.c_str())); - m_frame->m_bl0->AppendText(wxString::FromAscii(m_frame->str0.c_str())); - m_frame->upd95 = true; + m_DebuggerFrame->m_bl95->AppendText(wxString::FromAscii(m_DebuggerFrame->str95.c_str())); + m_DebuggerFrame->m_bl0->AppendText(wxString::FromAscii(m_DebuggerFrame->str0.c_str())); + m_DebuggerFrame->upd95 = true; } } } @@ -217,7 +217,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs) #if defined(HAVE_WX) && HAVE_WX // write logging data to debugger again after the update - if (m_frame && _pBuffer) + if (m_DebuggerFrame && _pBuffer) { lCUCode_AX->Logging(_pBuffer, _iSize, 1, true); } @@ -241,7 +241,7 @@ void CUCode_AXWii::SaveLog(const char* _fmt, ...) #if defined(HAVE_WX) && HAVE_WX va_list ap; va_start(ap, _fmt); - if(m_frame) + if(m_DebuggerFrame) lCUCode_AX->SaveLog_(true, _fmt, ap); va_end(ap); #endif @@ -271,7 +271,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail) bool bExecuteList = true; #if defined(HAVE_WX) && HAVE_WX - if(m_frame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging + if(m_DebuggerFrame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging #endif if (false) { diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h index c49d44c5ad..e1b099d618 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX_Voice.h @@ -60,7 +60,7 @@ inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num) #if defined(HAVE_WX) && HAVE_WX #if defined(_DEBUG) || defined(DEBUGFAST) - if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location + if(m_DebuggerFrame) m_DebuggerFrame->gLastBlock = blockAddr + p*2 + 2; // save last block location #endif #endif } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index 325e0b1a09..ea6637710e 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -21,9 +21,10 @@ #if defined(HAVE_WX) && HAVE_WX #include "ConfigDlg.h" +DSPConfigDialogHLE* m_ConfigFrame = NULL; #include "Debugger/File.h" // For file logging -#include "Debugger/Debugger.h" // For the CDebugger class -CDebugger* m_frame = NULL; +#include "Debugger/Debugger.h" +DSPDebuggerHLE* m_DebuggerFrame = NULL; #endif #include "ChunkFile.h" @@ -65,7 +66,10 @@ struct DSPState }; DSPState g_dspState; -// wxWidgets: Create the wxApp +// Standard crap to make wxWidgets happy +#ifdef _WIN32 +HINSTANCE g_hInstance; + #if defined(HAVE_WX) && HAVE_WX class wxDLLApp : public wxApp { @@ -74,72 +78,69 @@ class wxDLLApp : public wxApp return true; } }; - -IMPLEMENT_APP_NO_MAIN(wxDLLApp) +IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif -// DllMain -#ifdef _WIN32 -HINSTANCE g_hInstance = NULL; - -BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle - DWORD dwReason, // reason called - LPVOID lpvReserved) // reserved +BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle + DWORD dwReason, // reason called + LPVOID lpvReserved) // reserved { switch (dwReason) { case DLL_PROCESS_ATTACH: { - - // more stuff wx needs +#if defined(HAVE_WX) && HAVE_WX wxSetInstance((HINSTANCE)hinstDLL); int argc = 0; char **argv = NULL; wxEntryStart(argc, argv); - - // This is for ? - if ( !wxTheApp || !wxTheApp->CallOnInit() ) + if (!wxTheApp || !wxTheApp->CallOnInit()) return FALSE; +#endif } - break; + break; case DLL_PROCESS_DETACH: - wxEntryCleanup(); // use this or get a crash +#if defined(HAVE_WX) && HAVE_WX + wxEntryCleanup(); +#endif break; - default: break; } g_hInstance = hinstDLL; - return(TRUE); + return TRUE; +} +#endif + +#if defined(HAVE_WX) && HAVE_WX +wxWindow* GetParentedWxWindow(HWND Parent) +{ +#ifdef _WIN32 + wxSetInstance((HINSTANCE)g_hInstance); +#endif + wxWindow *win = new wxWindow(); +#ifdef _WIN32 + win->SetHWND((WXHWND)Parent); + win->AdoptAttributesFromHWND(); +#endif + return win; } #endif -// Exported fuctions - -// Create debugging window - We could use use wxWindow win; new CDebugger(win) -// like nJoy but I don't know why it would be better. - There's a lockup -// problem with ShowModal(), but Show() doesn't work because then -// DLL_PROCESS_DETACH is called immediately after DLL_PROCESS_ATTACH. void DllDebugger(HWND _hParent, bool Show) { #if defined(HAVE_WX) && HAVE_WX - if (m_frame && Show) // if we have created it, let us show it again - { - m_frame->DoShow(); - } - else if (!m_frame && Show) - { - m_frame = new CDebugger(NULL); - m_frame->Show(); - } - else if (m_frame && !Show) - { - m_frame->DoHide(); - } + if (!m_DebuggerFrame) + m_DebuggerFrame = new DSPDebuggerHLE(GetParentedWxWindow(_hParent)); + + if (Show) + m_DebuggerFrame->Show(); + else + m_DebuggerFrame->Hide(); #endif } @@ -169,18 +170,23 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) void DllConfig(HWND _hParent) { #if defined(HAVE_WX) && HAVE_WX - // (shuffle2) TODO: reparent dlg with DolphinApp - ConfigDialog dlg(NULL); + if (!m_ConfigFrame) + m_ConfigFrame = new DSPConfigDialogHLE(GetParentedWxWindow(_hParent)); // add backends std::vector backends = AudioCommon::GetSoundBackends(); for (std::vector::const_iterator iter = backends.begin(); - iter != backends.end(); ++iter) { - dlg.AddBackend((*iter).c_str()); + iter != backends.end(); ++iter) + { + m_ConfigFrame->AddBackend((*iter).c_str()); } - // Show the window - dlg.ShowModal(); + + // Only allow one open at a time + if (!m_ConfigFrame->IsShown()) + m_ConfigFrame->ShowModal(); + else + m_ConfigFrame->Hide(); #endif } @@ -211,12 +217,12 @@ void Shutdown() #if defined(HAVE_WX) && HAVE_WX // Reset mails - if (m_frame) + if (m_DebuggerFrame) { sMailLog.clear(); sMailTime.clear(); - m_frame->sMail.clear(); - m_frame->sMailEnd.clear(); + m_DebuggerFrame->sMail.clear(); + m_DebuggerFrame->sMailEnd.clear(); } #endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.h b/Source/Plugins/Plugin_DSP_HLE/Src/main.h index 03fb624f1c..745a333c94 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.h @@ -23,7 +23,7 @@ #if defined(HAVE_WX) && HAVE_WX #include "Debugger/Debugger.h" - extern CDebugger* m_frame; + extern DSPDebuggerHLE* m_DebuggerFrame; #endif extern SoundStream *soundStream; diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index f181c3384f..e3b767ec52 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -50,6 +50,7 @@ SoundStream *soundStream = NULL; bool bIsRunning = false; +// Standard crap to make wxWidgets happy #ifdef _WIN32 HINSTANCE g_hInstance; diff --git a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp index 8bea7ca5a5..825e5a5d5e 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.cpp @@ -26,48 +26,48 @@ DInput m_dinput; #endif -BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) - EVT_CLOSE(ConfigDialog::OnClose) - EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick) - EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout) +BEGIN_EVENT_TABLE(PADConfigDialogSimple,wxDialog) + EVT_CLOSE(PADConfigDialogSimple::OnClose) + EVT_BUTTON(ID_CLOSE,PADConfigDialogSimple::OnCloseClick) + EVT_BUTTON(ID_PAD_ABOUT,PADConfigDialogSimple::DllAbout) - EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged) - EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged) - EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged) - EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged) - EVT_CHECKBOX(ID_DISABLE,ConfigDialog::ControllerSettingsChanged) + EVT_CHECKBOX(ID_ATTACHED,PADConfigDialogSimple::ControllerSettingsChanged) + EVT_CHECKBOX(ID_X360PAD,PADConfigDialogSimple::ControllerSettingsChanged) + EVT_CHOICE(ID_X360PAD_CHOICE,PADConfigDialogSimple::ControllerSettingsChanged) + EVT_CHECKBOX(ID_RUMBLE,PADConfigDialogSimple::ControllerSettingsChanged) + EVT_CHECKBOX(ID_DISABLE,PADConfigDialogSimple::ControllerSettingsChanged) // Input recording #ifdef RERECORDING - EVT_CHECKBOX(ID_RECORDING,ConfigDialog::ControllerSettingsChanged) - EVT_CHECKBOX(ID_PLAYBACK,ConfigDialog::ControllerSettingsChanged) - EVT_BUTTON(ID_SAVE_RECORDING,ConfigDialog::ControllerSettingsChanged) + EVT_CHECKBOX(ID_RECORDING,PADConfigDialogSimple::ControllerSettingsChanged) + EVT_CHECKBOX(ID_PLAYBACK,PADConfigDialogSimple::ControllerSettingsChanged) + EVT_BUTTON(ID_SAVE_RECORDING,PADConfigDialogSimple::ControllerSettingsChanged) #endif - EVT_BUTTON(CTL_A,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_B,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_X,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_Y,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_Z,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_START,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_L,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_R,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_MAINUP,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_MAINDOWN,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_MAINLEFT,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_MAINRIGHT,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_SUBUP,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_SUBDOWN,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_SUBLEFT,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_SUBRIGHT,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_DPADUP,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_DPADDOWN,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_DPADLEFT,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_DPADRIGHT,ConfigDialog::OnButtonClick) - EVT_BUTTON(CTL_HALFPRESS,ConfigDialog::OnButtonClick) + EVT_BUTTON(CTL_A,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_B,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_X,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_Y,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_Z,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_START,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_L,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_R,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_MAINUP,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_MAINDOWN,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_MAINLEFT,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_MAINRIGHT,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_SUBUP,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_SUBDOWN,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_SUBLEFT,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_SUBRIGHT,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_DPADUP,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_DPADDOWN,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_DPADLEFT,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_DPADRIGHT,PADConfigDialogSimple::OnButtonClick) + EVT_BUTTON(CTL_HALFPRESS,PADConfigDialogSimple::OnButtonClick) END_EVENT_TABLE() -ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) +PADConfigDialogSimple::PADConfigDialogSimple(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { #ifdef _WIN32 @@ -79,11 +79,11 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl // Connect keydown to the window wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, - wxKeyEventHandler(ConfigDialog::OnKeyDown), + wxKeyEventHandler(PADConfigDialogSimple::OnKeyDown), (wxObject*)NULL, this); } -ConfigDialog::~ConfigDialog() +PADConfigDialogSimple::~PADConfigDialogSimple() { } @@ -118,7 +118,7 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer, //////////////////////////////////// -void ConfigDialog::CreateGUIControls() +void PADConfigDialogSimple::CreateGUIControls() { // Notebook m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); @@ -324,7 +324,7 @@ void ConfigDialog::CreateGUIControls() } } -void ConfigDialog::OnClose(wxCloseEvent& event) +void PADConfigDialogSimple::OnClose(wxCloseEvent& event) { #ifdef _WIN32 m_dinput.Free(); @@ -332,7 +332,7 @@ void ConfigDialog::OnClose(wxCloseEvent& event) EndModal(0); } -void ConfigDialog::OnKeyDown(wxKeyEvent& event) +void PADConfigDialogSimple::OnKeyDown(wxKeyEvent& event) { char keyStr[10] = {0}; if(ClickedButton != NULL) @@ -368,7 +368,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event) } // We have clicked a button -void ConfigDialog::OnButtonClick(wxCommandEvent& event) +void PADConfigDialogSimple::OnButtonClick(wxCommandEvent& event) { // Check if the Space key was set, to solve the problem that the Space key calls this function #ifdef _WIN32 @@ -386,12 +386,12 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event) ClickedButton->SetWindowStyle(wxWANTS_CHARS); } -void ConfigDialog::OnCloseClick(wxCommandEvent& event) +void PADConfigDialogSimple::OnCloseClick(wxCommandEvent& event) { Close(); } -void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event) +void PADConfigDialogSimple::ControllerSettingsChanged(wxCommandEvent& event) { int page = m_Notebook->GetSelection(); @@ -438,7 +438,7 @@ void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event) } } -void ConfigDialog::DllAbout(wxCommandEvent& event) +void PADConfigDialogSimple::DllAbout(wxCommandEvent& event) { wxString message; #ifdef _WIN32 diff --git a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.h index 0f51427bcb..639f9cfb87 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_PadSimple/Src/GUI/ConfigDlg.h @@ -33,15 +33,15 @@ #include "../XInputBase.h" #endif -class ConfigDialog : public wxDialog +class PADConfigDialogSimple : public wxDialog { public: - ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"), + PADConfigDialogSimple(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); - virtual ~ConfigDialog(); + virtual ~PADConfigDialogSimple(); private: DECLARE_EVENT_TABLE(); diff --git a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp index a6fddfb39d..d65265b921 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp @@ -16,9 +16,8 @@ // http://code.google.com/p/dolphin-emu/ -////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// // Include -// ŻŻŻŻŻŻŻŻŻŻŻŻŻ #include #include @@ -32,6 +31,7 @@ #if defined(HAVE_WX) && HAVE_WX #include "GUI/ConfigDlg.h" + PADConfigDialogSimple* m_ConfigFrame = NULL; #endif #ifdef _WIN32 @@ -55,23 +55,81 @@ #include bool KeyStatus[NUMCONTROLS]; #endif -//////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// // Declarations -// ŻŻŻŻŻŻŻŻŻŻŻŻŻ SPads pad[4]; - -HINSTANCE g_hInstance; SPADInitialize g_PADInitialize; -//////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Standard crap to make wxWidgets happy +#ifdef _WIN32 +HINSTANCE g_hInstance; + +#if defined(HAVE_WX) && HAVE_WX +class wxDLLApp : public wxApp +{ + bool OnInit() + { + return true; + } +}; +IMPLEMENT_APP_NO_MAIN(wxDLLApp) +WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); +#endif + +BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle + DWORD dwReason, // reason called + LPVOID lpvReserved) // reserved +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + { +#if defined(HAVE_WX) && HAVE_WX + wxSetInstance((HINSTANCE)hinstDLL); + int argc = 0; + char **argv = NULL; + wxEntryStart(argc, argv); + if (!wxTheApp || !wxTheApp->CallOnInit()) + return FALSE; +#endif + } + break; + + case DLL_PROCESS_DETACH: +#if defined(HAVE_WX) && HAVE_WX + wxEntryCleanup(); +#endif + break; + default: + break; + } + + g_hInstance = hinstDLL; + return TRUE; +} +#endif + +#if defined(HAVE_WX) && HAVE_WX +wxWindow* GetParentedWxWindow(HWND Parent) +{ +#ifdef _WIN32 + wxSetInstance((HINSTANCE)g_hInstance); +#endif + wxWindow *win = new wxWindow(); +#ifdef _WIN32 + win->SetHWND((WXHWND)Parent); + win->AdoptAttributesFromHWND(); +#endif + return win; +} +#endif - -////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// // Input Recording -// ŻŻŻŻŻŻŻŻŻŻŻŻŻ // Enable these to record or play back //#define RECORD_REPLAY @@ -83,7 +141,6 @@ PLUGIN_GLOBALS* globals = NULL; SPADStatus recordBuffer[RECORD_SIZE]; int count = 0; bool g_EmulatorRunning = false; -//////////////////////////////// //****************************************************************************** // Supporting functions @@ -169,57 +226,11 @@ bool IsFocus() #endif } - -#ifdef _WIN32 - -class wxDLLApp : public wxApp -{ - bool OnInit() - { - return true; - } -}; -IMPLEMENT_APP_NO_MAIN(wxDLLApp) - -WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); - -BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle - DWORD dwReason, // reason called - LPVOID lpvReserved) // reserved -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH: - { //use wxInitialize() if you don't want GUI instead of the following 12 lines - wxSetInstance((HINSTANCE)hinstDLL); - int argc = 0; - char **argv = NULL; - wxEntryStart(argc, argv); - if ( !wxTheApp || !wxTheApp->CallOnInit() ) - return FALSE; - } - break; - - case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI - break; - default: - break; - } - - g_hInstance = hinstDLL; - return(TRUE); -} - -#endif - - -const float kDeadZone = 0.1f; - // Implement circular deadzone +const float kDeadZone = 0.1f; void ScaleStickValues(unsigned char* outx, - unsigned char* outy, - short inx, short iny) + unsigned char* outy, + short inx, short iny) { float x = ((float)inx + 0.5f) / 32767.5f; float y = ((float)iny + 0.5f) / 32767.5f; @@ -616,21 +627,19 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) void DllConfig(HWND _hParent) { - //Console::Open(70, 5000); - // Load configuration LoadConfig(); // Show wxDialog -#ifdef _WIN32 - wxWindow win; - win.SetHWND(_hParent); - ConfigDialog frame(&win); - frame.ShowModal(); - win.SetHWND(0); -#elif defined(HAVE_WX) && HAVE_WX - ConfigDialog frame(NULL); - frame.ShowModal(); +#if defined(HAVE_WX) && HAVE_WX + if (!m_ConfigFrame) + m_ConfigFrame = new PADConfigDialogSimple(GetParentedWxWindow(_hParent)); + + // Only allow one open at a time + if (!m_ConfigFrame->IsShown()) + m_ConfigFrame->ShowModal(); + else + m_ConfigFrame->Hide(); #endif // Save configuration @@ -641,18 +650,13 @@ void DllDebugger(HWND _hParent, bool Show) {} void Initialize(void *init) { - //Console::Open(70, 5000); - // We are now running a game g_EmulatorRunning = true; // Load configuration LoadConfig(); - // ------------------------------------------- - // Rerecording - // ---------------------- - #ifdef RERECORDING +#ifdef RERECORDING /* Check if we are starting the pad to record the input, and an old file exists. In that case ask if we really want to start the recording and eventually overwrite the file */ if (pad[0].bRecording && File::Exists("pad-record.bin")) @@ -670,8 +674,7 @@ void Initialize(void *init) // Load recorded input if we are to play it back, otherwise begin with a blank recording if (pad[0].bPlayback) LoadRecord(); - #endif - // ---------------------- +#endif g_PADInitialize = *(SPADInitialize*)init; @@ -706,18 +709,13 @@ void DoState(unsigned char **ptr, int mode) void Shutdown() { - //Console::Print("ShutDown()\n"); - - // ------------------------------------------- // Save the recording and reset the counter - // ---------------------- - #ifdef RERECORDING +#ifdef RERECORDING // Save recording if (pad[0].bRecording) SaveRecord(); // Reset the counter count = 0; - #endif - // ---------------------- +#endif // We have stopped the game g_EmulatorRunning = false; @@ -737,7 +735,6 @@ void Shutdown() // Set buttons status from wxWidgets in the main application -// ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void PAD_Input(u16 _Key, u8 _UpDown) {} @@ -746,17 +743,14 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) // Check if all is okay if (_pPADStatus == NULL) return; - // ------------------------------------------- // Play back input instead of accepting any user input - // ---------------------- - #ifdef RERECORDING +#ifdef RERECORDING if (pad[0].bPlayback) { *_pPADStatus = PlayRecord(); return; } - #endif - // ---------------------- +#endif const int base = 0x80; // Clear pad @@ -788,14 +782,10 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) cocoa_Read(_numPAD, _pPADStatus); #endif - // ------------------------------------------- - // Rerecording - // ---------------------- - #ifdef RERECORDING +#ifdef RERECORDING // Record input if (pad[0].bRecording) RecordInput(*_pPADStatus); - #endif - // ---------------------- +#endif } @@ -950,7 +940,6 @@ void LoadConfig() file.Get(SectionName, "RumbleStrength", &pad[i].RumbleStrength, 8000); file.Get(SectionName, "XPad#", &pad[i].XPadPlayer); - // Recording #ifdef RERECORDING file.Get(SectionName, "Recording", &pad[0].bRecording, false); file.Get(SectionName, "Playback", &pad[0].bPlayback, false); @@ -986,12 +975,12 @@ void SaveConfig() file.Set(SectionName, "Rumble", pad[i].bRumble); file.Set(SectionName, "RumbleStrength", pad[i].RumbleStrength); file.Set(SectionName, "XPad#", pad[i].XPadPlayer); - // Recording + #ifdef RERECORDING file.Set(SectionName, "Recording", pad[0].bRecording); file.Set(SectionName, "Playback", pad[0].bPlayback); #endif - + for (int x = 0; x < NUMCONTROLS; x++) { file.Set(SectionName, controlNames[x], pad[i].keyForControl[x]); @@ -999,5 +988,3 @@ void SaveConfig() } file.Save(FULL_CONFIG_DIR "pad.ini"); } - - diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp index 4332d77a82..16d129c5a1 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp @@ -51,111 +51,111 @@ enum ////////////////////////////////////////////////////////////////////////////////////////// // Event table // ŻŻŻŻŻŻŻŻŻŻŻŻŻ -BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) - EVT_CLOSE(ConfigDialog::OnClose) - EVT_BUTTON(ID_CLOSE, ConfigDialog::CloseClick) - EVT_BUTTON(ID_APPLY, ConfigDialog::CloseClick) - EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick) +BEGIN_EVENT_TABLE(WiimoteConfigDialog,wxDialog) + EVT_CLOSE(WiimoteConfigDialog::OnClose) + EVT_BUTTON(ID_CLOSE, WiimoteConfigDialog::CloseClick) + EVT_BUTTON(ID_APPLY, WiimoteConfigDialog::CloseClick) + EVT_BUTTON(ID_ABOUTOGL, WiimoteConfigDialog::AboutClick) - EVT_CHECKBOX(ID_SIDEWAYSDPAD, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, ConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_CONNECT_REAL, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_USE_REAL, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_UPDATE_REAL, ConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_USE_REAL, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_UPDATE_REAL, WiimoteConfigDialog::GeneralSettingsChanged) // Recording - EVT_CHOICE(IDC_RECORD + 1, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 2, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 3, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 4, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 5, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 6, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 7, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 8, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 9, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 10, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 11, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 12, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 13, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 14, ConfigDialog::GeneralSettingsChanged) - EVT_CHOICE(IDC_RECORD + 15, ConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 1, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 2, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 3, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 4, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 5, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 6, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 7, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 8, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 9, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 10, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 11, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 12, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 13, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 14, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHOICE(IDC_RECORD + 15, WiimoteConfigDialog::GeneralSettingsChanged) - EVT_BUTTON(IDB_RECORD + 1, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 2, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 3, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 4, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 5, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 6, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 7, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 8, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 9, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 10, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 11, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 12, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 13, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 14, ConfigDialog::RecordMovement) - EVT_BUTTON(IDB_RECORD + 15, ConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 1, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 2, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 3, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 4, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 5, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 6, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 7, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 8, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 9, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 10, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 11, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 12, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 13, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 14, WiimoteConfigDialog::RecordMovement) + EVT_BUTTON(IDB_RECORD + 15, WiimoteConfigDialog::RecordMovement) // Gamepad - EVT_COMBOBOX(IDC_JOYNAME, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(ID_TRIGGER_TYPE, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(ID_TILT_INPUT, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(ID_TILT_RANGE_ROLL, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(ID_TILT_RANGE_PITCH, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(IDC_LEFT_C2S, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_TILT_INVERT_ROLL, ConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_TILT_INVERT_PITCH, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_CC_LEFT_STICK, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, ConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_CC_TRIGGERS, ConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_JOYNAME, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(ID_TRIGGER_TYPE, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(ID_TILT_INPUT, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(ID_TILT_RANGE_ROLL, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(ID_TILT_RANGE_PITCH, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(IDC_LEFT_C2S, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_TILT_INVERT_ROLL, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_TILT_INVERT_PITCH, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_CC_LEFT_STICK, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, WiimoteConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDCB_CC_TRIGGERS, WiimoteConfigDialog::GeneralSettingsChanged) // Wiimote - EVT_BUTTON(IDB_WM_A, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_WM_1, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_WM_P, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_M, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_H, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_WM_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_WM_U, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_WM_SHAKE, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_WM_PITCH_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, ConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_A, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_1, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_P, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_M, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_H, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_U, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_SHAKE, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_WM_PITCH_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, WiimoteConfigDialog::OnButtonClick) // IR cursor - EVT_COMMAND_SCROLL(IDS_WIDTH, ConfigDialog::GeneralSettingsChangedScroll) - EVT_COMMAND_SCROLL(IDS_HEIGHT, ConfigDialog::GeneralSettingsChangedScroll) - EVT_COMMAND_SCROLL(IDS_LEFT, ConfigDialog::GeneralSettingsChangedScroll) - EVT_COMMAND_SCROLL(IDS_TOP, ConfigDialog::GeneralSettingsChangedScroll) + EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteConfigDialog::GeneralSettingsChangedScroll) + EVT_COMMAND_SCROLL(IDS_HEIGHT, WiimoteConfigDialog::GeneralSettingsChangedScroll) + EVT_COMMAND_SCROLL(IDS_LEFT, WiimoteConfigDialog::GeneralSettingsChangedScroll) + EVT_COMMAND_SCROLL(IDS_TOP, WiimoteConfigDialog::GeneralSettingsChangedScroll) // Nunchuck - EVT_BUTTON(IDB_NC_Z, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_NC_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_NC_U, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_D, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_NC_SHAKE, ConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_NC_Z, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_NC_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_NC_U, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_D, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_NC_SHAKE, WiimoteConfigDialog::OnButtonClick) // Classic Controller - EVT_BUTTON(IDB_CC_A, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_B, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_X, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_Y, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_CC_P, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_M, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_H, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_CC_TL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TR, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_CC_DL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_CC_DL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_CC_LL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, ConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_CC_RL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, ConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_A, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_B, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_X, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_Y, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_P, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_M, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_H, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_TL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TR, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_DL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_DL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_LL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, WiimoteConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_CC_RL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, WiimoteConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_ANALOG_LEFT_X, ConfigDialog::GetButtons) - EVT_BUTTON(IDB_ANALOG_LEFT_Y, ConfigDialog::GetButtons) - EVT_BUTTON(IDB_ANALOG_RIGHT_X, ConfigDialog::GetButtons) - EVT_BUTTON(IDB_ANALOG_RIGHT_Y, ConfigDialog::GetButtons) - EVT_BUTTON(IDB_TRIGGER_L, ConfigDialog::GetButtons) - EVT_BUTTON(IDB_TRIGGER_R, ConfigDialog::GetButtons) + EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimoteConfigDialog::GetButtons) + EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimoteConfigDialog::GetButtons) + EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimoteConfigDialog::GetButtons) + EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimoteConfigDialog::GetButtons) + EVT_BUTTON(IDB_TRIGGER_L, WiimoteConfigDialog::GetButtons) + EVT_BUTTON(IDB_TRIGGER_R, WiimoteConfigDialog::GetButtons) - EVT_TIMER(IDTM_UPDATE, ConfigDialog::Update) - EVT_TIMER(IDTM_UPDATE_ONCE, ConfigDialog::UpdateOnce) - EVT_TIMER(IDTM_SHUTDOWN, ConfigDialog::ShutDown) - EVT_TIMER(IDTM_BUTTON, ConfigDialog::OnButtonTimer) - EVT_TIMER(IDTM_UPDATE_PAD, ConfigDialog::UpdatePad) + EVT_TIMER(IDTM_UPDATE, WiimoteConfigDialog::Update) + EVT_TIMER(IDTM_UPDATE_ONCE, WiimoteConfigDialog::UpdateOnce) + EVT_TIMER(IDTM_SHUTDOWN, WiimoteConfigDialog::ShutDown) + EVT_TIMER(IDTM_BUTTON, WiimoteConfigDialog::OnButtonTimer) + EVT_TIMER(IDTM_UPDATE_PAD, WiimoteConfigDialog::UpdatePad) END_EVENT_TABLE() ////////////////////////////////////// @@ -163,7 +163,7 @@ END_EVENT_TABLE() ////////////////////////////////////////////////////////////////////////////////////////// // Class // ŻŻŻŻŻŻŻŻŻŻŻŻŻ -ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, +WiimoteConfigDialog::WiimoteConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) : wxDialog(parent, id, title, position, size, style) { @@ -197,15 +197,15 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl UpdateGUI(); wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard - wxKeyEventHandler(ConfigDialog::OnKeyDown), + wxKeyEventHandler(WiimoteConfigDialog::OnKeyDown), (wxObject*)0, this); } -ConfigDialog::~ConfigDialog() +WiimoteConfigDialog::~WiimoteConfigDialog() { } -void ConfigDialog::OnKeyDown(wxKeyEvent& event) +void WiimoteConfigDialog::OnKeyDown(wxKeyEvent& event) { event.Skip(); @@ -263,7 +263,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event) } // Input button clicked -void ConfigDialog::OnButtonClick(wxCommandEvent& event) +void WiimoteConfigDialog::OnButtonClick(wxCommandEvent& event) { //INFO_LOG(CONSOLE, "OnButtonClick: %i\n", g_Pressed); @@ -282,7 +282,7 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event) } -void ConfigDialog::OnClose(wxCloseEvent& event) +void WiimoteConfigDialog::OnClose(wxCloseEvent& event) { g_FrameOpen = false; m_UpdatePad->Stop(); @@ -297,7 +297,7 @@ void ConfigDialog::OnClose(wxCloseEvent& event) /* Timeout the shutdown. In Windows at least the g_pReadThread execution will hang at any attempt to call a frame function after the main thread has entered WaitForSingleObject() or any other loop. We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */ -void ConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event)) +void WiimoteConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event)) { // Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy(). if(!WiiMoteReal::g_ThreadGoing) @@ -307,7 +307,7 @@ void ConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event)) } } -void ConfigDialog::CloseClick(wxCommandEvent& event) +void WiimoteConfigDialog::CloseClick(wxCommandEvent& event) { switch(event.GetId()) { @@ -333,12 +333,12 @@ void ConfigDialog::CloseClick(wxCommandEvent& event) } } -void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event)) +void WiimoteConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event)) { } // Execute a delayed function -void ConfigDialog::UpdateOnce(wxTimerEvent& event) +void WiimoteConfigDialog::UpdateOnce(wxTimerEvent& event) { switch(event.GetId()) { @@ -367,7 +367,7 @@ void ConfigDialog::UpdateOnce(wxTimerEvent& event) Input: ChangePad needs to be used when we change the pad for a slot. Slot needs to be used when we only want to save changes to one slot. */ -void ConfigDialog::DoSave(bool ChangePad, int Slot) +void WiimoteConfigDialog::DoSave(bool ChangePad, int Slot) { // Replace "" with "-1" before we are saving ToBlank(false); @@ -399,7 +399,7 @@ void ConfigDialog::DoSave(bool ChangePad, int Slot) ////////////////////////////////////////////////////////////////////////////////////////// // Bitmap box and dot // ---------------- -wxBitmap ConfigDialog::CreateBitmap() +wxBitmap WiimoteConfigDialog::CreateBitmap() { BoxW = 70, BoxH = 70; wxBitmap bitmap(BoxW, BoxH); @@ -419,7 +419,7 @@ wxBitmap ConfigDialog::CreateBitmap() dc.SelectObject(wxNullBitmap); return bitmap; } -wxBitmap ConfigDialog::CreateBitmapDot() +wxBitmap WiimoteConfigDialog::CreateBitmapDot() { int w = 2, h = 2; wxBitmap bitmap(w, h); @@ -437,7 +437,7 @@ wxBitmap ConfigDialog::CreateBitmapDot() dc.SelectObject(wxNullBitmap); return bitmap; } -wxBitmap ConfigDialog::CreateBitmapDeadZone(int Radius) +wxBitmap WiimoteConfigDialog::CreateBitmapDeadZone(int Radius) { wxBitmap bitmap(Radius*2, Radius*2); wxMemoryDC dc; @@ -453,7 +453,7 @@ wxBitmap ConfigDialog::CreateBitmapDeadZone(int Radius) //dc.SelectObject(wxNullBitmap); return bitmap; } -wxBitmap ConfigDialog::CreateBitmapClear() +wxBitmap WiimoteConfigDialog::CreateBitmapClear() { wxBitmap bitmap(BoxW, BoxH); wxMemoryDC dc; @@ -470,7 +470,7 @@ wxBitmap ConfigDialog::CreateBitmapClear() ////////////////////////////////////// -void ConfigDialog::CreateGUIControls() +void WiimoteConfigDialog::CreateGUIControls() { //////////////////////////////////////////////////////////////////////////////// @@ -1426,7 +1426,7 @@ void ConfigDialog::CreateGUIControls() // =================================================== /* Do connect real wiimote */ // ---------------- -void ConfigDialog::DoConnectReal() +void WiimoteConfigDialog::DoConnectReal() { g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked(); @@ -1440,15 +1440,6 @@ void ConfigDialog::DoConnectReal() if (g_RealWiiMoteInitialized) { WiiMoteReal::Shutdown(); - /* - if (g_WiimoteUnexpectedDisconnect) - { - #ifdef _WIN32 - PostMessage(g_ParentHWND, WM_USER, WIIMOTE_RECONNECT, 0); - g_WiimoteUnexpectedDisconnect = false; - #endif - } - */ } } } @@ -1458,7 +1449,7 @@ void ConfigDialog::DoConnectReal() /* Do use real wiimote. We let the game set up the real Wiimote reporting mode and init the Extension when we change want to use it again. */ // ---------------- -void ConfigDialog::DoUseReal() +void WiimoteConfigDialog::DoUseReal() { // Clear any eventual events in the Wiimote queue WiiMoteReal::ClearEvents(); @@ -1493,7 +1484,7 @@ void ConfigDialog::DoUseReal() // =================================================== /* Generate connect/disconnect status event */ // ---------------- -void ConfigDialog::DoExtensionConnectedDisconnected(int Extension) +void WiimoteConfigDialog::DoExtensionConnectedDisconnected(int Extension) { // There is no need for this if no game is running if(!g_EmulatorRunning) return; @@ -1509,7 +1500,7 @@ void ConfigDialog::DoExtensionConnectedDisconnected(int Extension) // =================================================== /* Change settings */ // ---------------- -void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) +void WiimoteConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) { long TmpValue; @@ -1660,7 +1651,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) // ======================================================= // Apparently we need a scroll event version of this for the sliders // ------------- -void ConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event) +void WiimoteConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event) { switch (event.GetId()) { @@ -1685,7 +1676,7 @@ void ConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event) // ======================================================= // Update the IR pointer calibration sliders // ------------- -void ConfigDialog::UpdateControls() +void WiimoteConfigDialog::UpdateControls() { // Update the slider position if a configuration has been loaded m_SliderWidth[Page]->SetValue(g_Config.iIRWidth); @@ -1705,7 +1696,7 @@ void ConfigDialog::UpdateControls() // ======================================================= // Update the enabled/disabled status // ------------- -void ConfigDialog::UpdateGUI(int Slot) +void WiimoteConfigDialog::UpdateGUI(int Slot) { //INFO_LOG(CONSOLE, "UpdateGUI: \n"); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h index 6aa18d1bb7..6570c8190b 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.h @@ -34,14 +34,16 @@ #include #include -class ConfigDialog : public wxDialog +class WiimoteConfigDialog : public wxDialog { public: - ConfigDialog(wxWindow *parent, wxWindowID id = 1, + WiimoteConfigDialog(wxWindow *parent, + wxWindowID id = 1, const wxString &title = wxT("Wii Remote Plugin Configuration"), - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS); - virtual ~ConfigDialog(); + virtual ~WiimoteConfigDialog(); // General open, close and event functions void CloseClick(wxCommandEvent& event); @@ -270,6 +272,6 @@ class ConfigDialog : public wxDialog int GetButtonWaitingID, GetButtonWaitingTimer; }; -extern ConfigDialog *frame; +extern WiimoteConfigDialog *m_ConfigFrame; #endif \ No newline at end of file diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 22a2642ba6..f8fb87f990 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -41,7 +41,7 @@ /* Function: When changing the joystick we save and load the settings and update the PadMapping and PadState array. PadState[].joy is the gamepad handle that is used to access the pad throughout the plugin. Joyinfo[].joy is only used the first time the pads are checked. */ -void ConfigDialog::DoChangeJoystick() +void WiimoteConfigDialog::DoChangeJoystick() { // Close the current pad, unless it's used by another slot //if (PadMapping[notebookpage].enabled) PadClose(notebookpage); @@ -56,7 +56,7 @@ void ConfigDialog::DoChangeJoystick() // Open the new pad if (WiiMoteEmu::PadMapping[Page].enabled) PadOpen(Page); } -void ConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4 +void WiimoteConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4 { // Check that we got a good pad if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good) @@ -69,13 +69,13 @@ void ConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4 INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID); WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID); } -void ConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4 +void WiimoteConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4 { if (SDL_JoystickOpened(WiiMoteEmu::PadMapping[Close].ID)) SDL_JoystickClose(WiiMoteEmu::PadState[Close].joy); WiiMoteEmu::PadState[Close].joy = NULL; } -void ConfigDialog::DoChangeDeadZone(bool Left) +void WiimoteConfigDialog::DoChangeDeadZone(bool Left) { if(Left) { @@ -104,7 +104,7 @@ void ConfigDialog::DoChangeDeadZone(bool Left) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ // Set the button text for all four Wiimotes -void ConfigDialog::SetButtonTextAll(int id, char text[128]) +void WiimoteConfigDialog::SetButtonTextAll(int id, char text[128]) { for (int i = 0; i < 1; i++) { @@ -116,7 +116,7 @@ void ConfigDialog::SetButtonTextAll(int id, char text[128]) } -void ConfigDialog::SaveButtonMappingAll(int Slot) +void WiimoteConfigDialog::SaveButtonMappingAll(int Slot) { //INFO_LOG(CONSOLE, "SaveButtonMappingAll()\n"); @@ -131,7 +131,7 @@ void ConfigDialog::SaveButtonMappingAll(int Slot) // Set dialog items from saved values // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void ConfigDialog::UpdateGUIButtonMapping(int controller) +void WiimoteConfigDialog::UpdateGUIButtonMapping(int controller) { // Temporary storage wxString tmp; @@ -217,7 +217,7 @@ void ConfigDialog::UpdateGUIButtonMapping(int controller) /* Populate the PadMapping array with the dialog items settings (for example selected joystick, enabled or disabled status and so on) */ // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void ConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) +void WiimoteConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) { // Temporary storage wxString tmp; @@ -265,7 +265,7 @@ void ConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int From } // Save keyboard key mapping -void ConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key) +void WiimoteConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key) { switch(Id) { @@ -325,7 +325,7 @@ void ConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key) // Replace the harder to understand -1 with "" for the sake of user friendliness // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void ConfigDialog::ToBlank(bool ToBlank) +void WiimoteConfigDialog::ToBlank(bool ToBlank) { if (!ControlsCreated) return; @@ -354,7 +354,7 @@ void ConfigDialog::ToBlank(bool ToBlank) // Update the textbox for the buttons // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void ConfigDialog::SetButtonText(int id, char text[128], int _Page) +void WiimoteConfigDialog::SetButtonText(int id, char text[128], int _Page) { // Set controller value int controller; @@ -426,7 +426,7 @@ void ConfigDialog::SetButtonText(int id, char text[128], int _Page) // Get the text in the textbox for the buttons // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -wxString ConfigDialog::GetButtonText(int id, int _Page) +wxString WiimoteConfigDialog::GetButtonText(int id, int _Page) { //INFO_LOG(CONSOLE, "GetButtonText: %i\n", id); @@ -464,12 +464,12 @@ wxString ConfigDialog::GetButtonText(int id, int _Page) is that we start another parallel loop (at least in Windows) that blocks the old loop. And our only option to wait for the old loop to finish is with a new loop, and that will block the old loop for as long as it's going on. Therefore a timer is easier to control. */ -void ConfigDialog::GetButtons(wxCommandEvent& event) +void WiimoteConfigDialog::GetButtons(wxCommandEvent& event) { DoGetButtons(event.GetId()); } -void ConfigDialog::DoGetButtons(int GetId) +void WiimoteConfigDialog::DoGetButtons(int GetId) { // ============================================= // Collect the starting values @@ -644,7 +644,7 @@ void ConfigDialog::DoGetButtons(int GetId) // ŻŻŻŻŻŻŻŻŻŻ // Convert the 0x8000 range values to BoxW and BoxH for the plot -void ConfigDialog::Convert2Box(int &x) +void WiimoteConfigDialog::Convert2Box(int &x) { // Border adjustment int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2; @@ -655,7 +655,7 @@ void ConfigDialog::Convert2Box(int &x) // Update the input status boxes // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void ConfigDialog::PadGetStatus() +void WiimoteConfigDialog::PadGetStatus() { //INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0)); @@ -821,7 +821,7 @@ void ConfigDialog::PadGetStatus() // Populate the advanced tab // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void ConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event)) +void WiimoteConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event)) { // Show the current status /* diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp index 382a1652b0..fd98318d60 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigRecording.cpp @@ -35,7 +35,7 @@ -void ConfigDialog::LoadFile() +void WiimoteConfigDialog::LoadFile() { INFO_LOG(CONSOLE, "LoadFile()\n"); @@ -77,7 +77,7 @@ void ConfigDialog::LoadFile() file.Get(SaveName.c_str(), "PlaybackSpeed", &iTmp, -1); m_RecordPlayBackSpeed[i]->SetSelection(iTmp); } } -void ConfigDialog::SaveFile() +void WiimoteConfigDialog::SaveFile() { INFO_LOG(CONSOLE, "SaveFile\n"); @@ -126,7 +126,7 @@ void ConfigDialog::SaveFile() ///////////////////////////////////////////////////////////////////////// // Create GUI // ------------ -void ConfigDialog::CreateGUIControlsRecording() +void WiimoteConfigDialog::CreateGUIControlsRecording() { //////////////////////////////////////////////////////////////////////////////// // Real Wiimote @@ -356,7 +356,7 @@ void ConfigDialog::CreateGUIControlsRecording() /* Record movement */ // ------------ -void ConfigDialog::ConvertToString() +void WiimoteConfigDialog::ConvertToString() { // Load ini file IniFile file; @@ -428,7 +428,7 @@ void ConfigDialog::ConvertToString() } // Timeout the recording -void ConfigDialog::Update(wxTimerEvent& WXUNUSED(event)) +void WiimoteConfigDialog::Update(wxTimerEvent& WXUNUSED(event)) { m_bWaitForRecording = false; m_bRecording = false; @@ -436,7 +436,7 @@ void ConfigDialog::Update(wxTimerEvent& WXUNUSED(event)) UpdateGUI(); } -void ConfigDialog::RecordMovement(wxCommandEvent& event) +void WiimoteConfigDialog::RecordMovement(wxCommandEvent& event) { m_iRecordTo = event.GetId() - 2000; @@ -467,7 +467,7 @@ void ConfigDialog::RecordMovement(wxCommandEvent& event) m_TimeoutTimer->Start(5000, true); } -void ConfigDialog::DoRecordA(bool Pressed) +void WiimoteConfigDialog::DoRecordA(bool Pressed) { // Return if we are not waiting or recording if (! (m_bWaitForRecording || m_bRecording)) return; @@ -501,7 +501,7 @@ void ConfigDialog::DoRecordA(bool Pressed) UpdateGUI(); } -void ConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes) +void WiimoteConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes) { //std::string Tmp1 = ArrayToString(_IR, 20, 0, 30); //INFO_LOG(CONSOLE, "DoRecordMovement: %s\n", Tmp1.c_str()); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp b/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp index c0f113dce5..5c6d52f91c 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ReadWiimote.cpp @@ -114,8 +114,8 @@ void handle_event(struct wiimote_t* wm) // Print battery status #if defined(HAVE_WX) && HAVE_WX - if(frame && g_Config.bUpdateRealWiimote) - frame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5)); + if(m_ConfigFrame && g_Config.bUpdateRealWiimote) + m_ConfigFrame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5)); #endif // Create shortcut to the nunchuck struct nunchuk_t* nc = NULL; @@ -170,7 +170,7 @@ void handle_event(struct wiimote_t* wm) //INFO_LOG(CONSOLE, "%s\n\n", Tmp.c_str()); #if defined(HAVE_WX) && HAVE_WX - if(frame) + if(m_ConfigFrame) { // Produce adjusted accelerometer values float _Gx = (float)(wm->accel.x - wm->accel_calib.cal_zero.x) / (float)wm->accel_calib.cal_g.x; @@ -194,37 +194,37 @@ void handle_event(struct wiimote_t* wm) if(g_Config.bUpdateRealWiimote) { // Update gauges - frame->m_GaugeRoll[0]->SetValue(wm->orient.roll + 180); - frame->m_GaugeRoll[1]->SetValue(wm->orient.pitch + 180); + m_ConfigFrame->m_GaugeRoll[0]->SetValue(wm->orient.roll + 180); + m_ConfigFrame->m_GaugeRoll[1]->SetValue(wm->orient.pitch + 180); // Show g. forces between -3 and 3 - frame->m_GaugeGForce[0]->SetValue((int)floor((wm->gforce.x * 100) + 300.5)); - frame->m_GaugeGForce[1]->SetValue((int)floor((wm->gforce.y * 100) + 300.5)); - frame->m_GaugeGForce[2]->SetValue((int)floor((wm->gforce.z * 100) + 300.5)); + m_ConfigFrame->m_GaugeGForce[0]->SetValue((int)floor((wm->gforce.x * 100) + 300.5)); + m_ConfigFrame->m_GaugeGForce[1]->SetValue((int)floor((wm->gforce.y * 100) + 300.5)); + m_ConfigFrame->m_GaugeGForce[2]->SetValue((int)floor((wm->gforce.z * 100) + 300.5)); - frame->m_GaugeAccel[0]->SetValue(wm->accel.x); - frame->m_GaugeAccel[1]->SetValue(wm->accel.y); - frame->m_GaugeAccel[2]->SetValue(wm->accel.z); + m_ConfigFrame->m_GaugeAccel[0]->SetValue(wm->accel.x); + m_ConfigFrame->m_GaugeAccel[1]->SetValue(wm->accel.y); + m_ConfigFrame->m_GaugeAccel[2]->SetValue(wm->accel.z); - frame->m_TextIR->SetLabel(wxString::Format( + m_ConfigFrame->m_TextIR->SetLabel(wxString::Format( wxT("Cursor: %03u %03u\nDistance:%4.0f"), wm->ir.x, wm->ir.y, wm->ir.z)); - //frame->m_TextAccNeutralCurrent->SetLabel(wxString::Format( + //m_ConfigFrame->m_TextAccNeutralCurrent->SetLabel(wxString::Format( // wxT("Current: %03u %03u %03u"), Gx, Gy, Gz)); - if(frame->m_bRecording) + if(m_ConfigFrame->m_bRecording) INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", Gx, Gy, Gz); //INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x\n", Gx, Gy, Gz); } // Send the data to be saved //const u8* data = (const u8*)wm->event_buf; - frame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6), + m_ConfigFrame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6), (WIIUSE_USING_EXP(wm) ? 10 : 12)); // Turn recording on and off - if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) frame->DoRecordA(true); - else frame->DoRecordA(false); + if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) m_ConfigFrame->DoRecordA(true); + else m_ConfigFrame->DoRecordA(false); // ------------------------------------ // Show roll and pitch in the status box @@ -239,10 +239,10 @@ void handle_event(struct wiimote_t* wm) int Roll = (int)wm->orient.roll * (0x8000 / 180); int Pitch = (int)wm->orient.pitch * (0x8000 / 180); // Convert it to the box - frame->Convert2Box(Roll); - frame->Convert2Box(Pitch); + m_ConfigFrame->Convert2Box(Roll); + m_ConfigFrame->Convert2Box(Pitch); // Show roll and pitch in the axis boxes - frame->m_bmpDotRightOut[0]->SetPosition(wxPoint(Roll, Pitch));*/ + m_ConfigFrame->m_bmpDotRightOut[0]->SetPosition(wxPoint(Roll, Pitch));*/ // --------------------- } #endif @@ -251,20 +251,20 @@ void handle_event(struct wiimote_t* wm) else { #if defined(HAVE_WX) && HAVE_WX - if (frame) + if (m_ConfigFrame) { - frame->m_GaugeRoll[0]->SetValue(0); - frame->m_GaugeRoll[1]->SetValue(0); + m_ConfigFrame->m_GaugeRoll[0]->SetValue(0); + m_ConfigFrame->m_GaugeRoll[1]->SetValue(0); - frame->m_GaugeGForce[0]->SetValue(0); - frame->m_GaugeGForce[1]->SetValue(0); - frame->m_GaugeGForce[2]->SetValue(0); + m_ConfigFrame->m_GaugeGForce[0]->SetValue(0); + m_ConfigFrame->m_GaugeGForce[1]->SetValue(0); + m_ConfigFrame->m_GaugeGForce[2]->SetValue(0); - frame->m_GaugeAccel[0]->SetValue(0); - frame->m_GaugeAccel[1]->SetValue(0); - frame->m_GaugeAccel[2]->SetValue(0); + m_ConfigFrame->m_GaugeAccel[0]->SetValue(0); + m_ConfigFrame->m_GaugeAccel[1]->SetValue(0); + m_ConfigFrame->m_GaugeAccel[2]->SetValue(0); - frame->m_TextIR->SetLabel(wxT("Cursor:\nDistance:")); + m_ConfigFrame->m_TextIR->SetLabel(wxT("Cursor:\nDistance:")); } #endif } diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index dfd6724d0c..588f08bd22 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -46,6 +46,7 @@ worked. #include "Logging.h" #if defined(HAVE_WX) && HAVE_WX #include "ConfigDlg.h" + WiimoteConfigDialog *m_ConfigFrame = NULL; #endif #include "Config.h" #include "pluginspecs_wiimote.h" @@ -93,34 +94,22 @@ std::vector g_UpdateTimeList (5, 0); // Movement recording std::vector VRecording(RECORDING_ROWS); -// DLL instance +// Standard crap to make wxWidgets happy +#ifdef _WIN32 HINSTANCE g_hInstance; -#ifdef _WIN32 -HWND g_ParentHWND = NULL; -#endif - #if defined(HAVE_WX) && HAVE_WX - wxWindow win; - ConfigDialog *frame = NULL; - - class wxDLLApp : public wxApp +class wxDLLApp : public wxApp +{ + bool OnInit() { - bool OnInit() - { - return true; - } - }; - IMPLEMENT_APP_NO_MAIN(wxDLLApp) - WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); + return true; + } +}; +IMPLEMENT_APP_NO_MAIN(wxDLLApp) +WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif -//////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////////////////// -// Main function and WxWidgets initialization -// ŻŻŻŻŻŻŻŻŻŻŻŻŻ -#ifdef _WIN32 BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle DWORD dwReason, // reason called LPVOID lpvReserved) // reserved @@ -128,18 +117,22 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle switch (dwReason) { case DLL_PROCESS_ATTACH: - { //use wxInitialize() if you don't want GUI instead of the following 12 lines + { +#if defined(HAVE_WX) && HAVE_WX wxSetInstance((HINSTANCE)hinstDLL); int argc = 0; char **argv = NULL; wxEntryStart(argc, argv); if (!wxTheApp || !wxTheApp->CallOnInit()) return FALSE; +#endif } - break; + break; case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI +#if defined(HAVE_WX) && HAVE_WX + wxEntryCleanup(); +#endif break; default: break; @@ -149,25 +142,38 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle return TRUE; } #endif -///////////////////////////////////// +#if defined(HAVE_WX) && HAVE_WX +wxWindow* GetParentedWxWindow(HWND Parent) +{ +#ifdef _WIN32 + wxSetInstance((HINSTANCE)g_hInstance); +#endif + wxWindow *win = new wxWindow(); +#ifdef _WIN32 + win->SetHWND((WXHWND)Parent); + win->AdoptAttributesFromHWND(); +#endif + return win; +} +#endif //****************************************************************************** // Exports //****************************************************************************** -extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo) +void GetDllInfo(PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_WIIMOTE; - #ifdef DEBUGFAST - sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)"); - #else - #ifndef _DEBUG - sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin"); - #else - sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (Debug)"); - #endif - #endif +#ifdef DEBUGFAST + sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)"); +#else +#ifndef _DEBUG + sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin"); +#else + sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (Debug)"); +#endif +#endif } void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) @@ -181,37 +187,26 @@ void DllDebugger(HWND _hParent, bool Show) {} void DllConfig(HWND _hParent) { #if defined(HAVE_WX) && HAVE_WX - - #ifdef _WIN32 - win.SetHWND(_hParent); - #endif - - //Console::Open(); + DoInitialize(); - frame = new ConfigDialog(&win); - g_FrameOpen = true; - /* We don't need to use ShowModal() anymore becaue FreeLibrary() is not called after this function - anymore */ - frame->Show(); - - #ifdef _WIN32 - win.SetHWND(0); - #endif + if (!m_ConfigFrame) + m_ConfigFrame = new WiimoteConfigDialog(GetParentedWxWindow(_hParent)); + // Only allow one open at a time + if (!m_ConfigFrame->IsShown()) + m_ConfigFrame->ShowModal(); + else + m_ConfigFrame->Hide(); #endif } -extern "C" void Initialize(void *init) +void Initialize(void *init) { // Declarations SWiimoteInitialize _WiimoteInitialize = *(SWiimoteInitialize *)init; g_WiimoteInitialize = _WiimoteInitialize; - #ifdef _WIN32 - g_ParentHWND = GetParent(g_WiimoteInitialize.hWnd); - #endif - g_EmulatorRunning = true; // Update the GUI if the configuration window is already open @@ -224,7 +219,7 @@ extern "C" void Initialize(void *init) g_ISOId = g_WiimoteInitialize.ISOId; // Load the settings g_Config.Load(); - if(frame) frame->UpdateGUI(); + if(m_ConfigFrame) m_ConfigFrame->UpdateGUI(); } #endif @@ -237,7 +232,7 @@ extern "C" void Initialize(void *init) } // If a game is not running this is called by the Configuration window when it's closed -extern "C" void Shutdown(void) +void Shutdown(void) { // Not running g_EmulatorRunning = false; @@ -245,11 +240,11 @@ extern "C" void Shutdown(void) // Reset the game ID in all cases g_ISOId = 0; - // We will only shutdown when both a game and the frame is closed + // We will only shutdown when both a game and the m_ConfigFrame is closed if (g_FrameOpen) { #if defined(HAVE_WX) && HAVE_WX - if(frame) frame->UpdateGUI(); + if(m_ConfigFrame) m_ConfigFrame->UpdateGUI(); #endif // Reset the variables @@ -264,12 +259,10 @@ extern "C" void Shutdown(void) if (g_RealWiiMoteInitialized) WiiMoteReal::Shutdown(); #endif WiiMoteEmu::Shutdown(); - - // Console::Close(); } -extern "C" void DoState(unsigned char **ptr, int mode) +void DoState(unsigned char **ptr, int mode) { #if HAVE_WIIUSE WiiMoteReal::DoState(ptr, mode); @@ -286,7 +279,7 @@ extern "C" void DoState(unsigned char **ptr, int mode) so that it knows the channel ID and the data reporting mode at all times. */ // ---------------- -extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) +void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) { DEBUG_LOG(WII_IPC_WIIMOTE, "============================================================="); const u8* data = (const u8*)_pData; @@ -315,7 +308,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 // =================================================== /* Function: Used for the initial Bluetooth HID handshake. */ // ---------------- -extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size) +void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size) { DEBUG_LOG(WII_IPC_WIIMOTE, "============================================================="); const u8* data = (const u8*)_pData; @@ -327,7 +320,7 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _ g_EmulatorRunning = false; g_WiimoteUnexpectedDisconnect = true; #if defined(HAVE_WX) && HAVE_WX - if (frame) frame->UpdateGUI(); + if (m_ConfigFrame) m_ConfigFrame->UpdateGUI(); #endif return; } @@ -356,16 +349,16 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _ /* This sends a Data Report from the Wiimote. See SystemTimers.cpp for the documentation of this update. */ // ---------------- -extern "C" void Wiimote_Update() +void Wiimote_Update() { // Tell us about the update rate, but only about once every second to avoid a major slowdown #if defined(HAVE_WX) && HAVE_WX - if (frame) + if (m_ConfigFrame) { GetUpdateRate(); if (g_UpdateWriteScreen > g_UpdateRate) { - frame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate)); + m_ConfigFrame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate)); g_UpdateWriteScreen = 0; } g_UpdateWriteScreen++; @@ -398,7 +391,7 @@ extern "C" void Wiimote_Update() #endif } -extern "C" unsigned int Wiimote_GetAttachedControllers() +unsigned int Wiimote_GetAttachedControllers() { return 1; } @@ -458,7 +451,7 @@ bool IsFocus() HWND Parent = GetParent(RenderingWindow); HWND TopLevel = GetParent(Parent); // Allow updates when the config window is in focus to - HWND Config = NULL; if (frame) Config = (HWND)frame->GetHWND(); + HWND Config = NULL; if (m_ConfigFrame) Config = (HWND)m_ConfigFrame->GetHWND(); // Support both rendering to main window and not if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config) return true; @@ -525,7 +518,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) { DisableExtensions(); #if defined(HAVE_WX) && HAVE_WX - if (frame) frame->UpdateGUI(); + if (m_ConfigFrame) m_ConfigFrame->UpdateGUI(); #endif } } @@ -565,7 +558,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) g_Config.Save(); WiiMoteEmu::UpdateEeprom(); #if defined(HAVE_WX) && HAVE_WX - if (frame) frame->UpdateGUI(); + if (m_ConfigFrame) m_ConfigFrame->UpdateGUI(); #endif INFO_LOG(CONSOLE, "%s", TmpData.c_str()); INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x\n\n", data[7], data[8]); @@ -578,7 +571,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size) g_Config.Save(); WiiMoteEmu::UpdateEeprom(); #if defined(HAVE_WX) && HAVE_WX - if (frame) frame->UpdateGUI(); + if (m_ConfigFrame) m_ConfigFrame->UpdateGUI(); #endif INFO_LOG(CONSOLE, "%s", TmpData.c_str()); INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x\n\n", data[7], data[8], data[9], data[10], data[11], data[12]); @@ -1083,9 +1076,6 @@ int GetUpdateRate() void DoInitialize() { - // Open console - //OpenConsole(true); - // Run this first so that WiiMoteReal::Initialize() overwrites g_Eeprom WiiMoteEmu::Initialize(); @@ -1099,5 +1089,3 @@ void DoInitialize() if (g_Config.bConnectRealWiimote) WiiMoteReal::Initialize(); #endif } - - diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.h b/Source/Plugins/Plugin_Wiimote/Src/main.h index df7afe86da..75d0b44c20 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.h +++ b/Source/Plugins/Plugin_Wiimote/Src/main.h @@ -59,9 +59,6 @@ struct SRecordingAll extern bool g_RealWiiMoteInitialized; extern bool g_EmulatedWiiMoteInitialized; extern bool g_WiimoteUnexpectedDisconnect; - #ifdef _WIN32 - extern HWND g_ParentHWND; - #endif // Settings extern accel_cal g_wm;