From ae7c64ec134799183487adb5104c6908cf282240 Mon Sep 17 00:00:00 2001 From: "sl1nk3.s" Date: Mon, 31 Jan 2011 00:33:09 +0000 Subject: [PATCH] Clean some DSP code, Fixes issue 4011. Move some GUI code around for no apparent reason. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6995 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/CPU.cpp | 4 + Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp | 5 - Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h | 8 - Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp | 5 - Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h | 11 -- Source/Core/Core/Src/PluginDSP.h | 9 -- Source/Core/DolphinWX/Src/ConfigMain.cpp | 183 +++++++++++----------- Source/Core/DolphinWX/Src/ConfigMain.h | 8 +- 8 files changed, 103 insertions(+), 130 deletions(-) diff --git a/Source/Core/Core/Src/HW/CPU.cpp b/Source/Core/Core/Src/HW/CPU.cpp index 0b7f4ccb3b..c1f2312c1f 100644 --- a/Source/Core/Core/Src/HW/CPU.cpp +++ b/Source/Core/Core/Src/HW/CPU.cpp @@ -18,11 +18,13 @@ #include "Common.h" #include "Thread.h" +#include "../PluginDSP.h" #include "../PluginManager.h" #include "../PowerPC/PowerPC.h" #include "../Host.h" #include "../Core.h" #include "CPU.h" +#include "DSP.h" namespace { @@ -115,12 +117,14 @@ void CCPU::EnableStepping(const bool _bStepping) { PowerPC::Pause(); CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PAUSE); + DSP::GetPlugin()->DSP_ClearAudioBuffer(true); } else { PowerPC::Start(); m_StepEvent.Set(); CPluginManager::GetInstance().EmuStateChange(PLUGIN_EMUSTATE_PLAY); + DSP::GetPlugin()->DSP_ClearAudioBuffer(false); } } diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp index 7603d36a2e..f638c717fb 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp @@ -133,11 +133,6 @@ void DSPHLE::DoState(PointerWrap &p) GetUCode()->DoState(p); } -void DSPHLE::EmuStateChange(PLUGIN_EMUSTATE newState) -{ - DSP_ClearAudioBuffer((newState == PLUGIN_EMUSTATE_PLAY) ? false : true); -} - // Mailbox fuctions unsigned short DSPHLE::DSP_ReadMailBoxHigh(bool _CPUMailbox) { diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h index a3972f26d2..cab228ac1d 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h @@ -33,15 +33,7 @@ public: virtual void Shutdown(); virtual bool IsLLE() { return false; } - /* - GUI - virtual void Config(void *_hwnd); - virtual void About(void *_hwnd); - virtual void *Debug(void *Parent, bool Show); - */ - virtual void DoState(PointerWrap &p); - virtual void EmuStateChange(PLUGIN_EMUSTATE newState); virtual void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short); virtual void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short); diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp index 80e47c2809..3b217dea70 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp @@ -77,11 +77,6 @@ void DSPLLE::DoState(PointerWrap &p) p.Do(m_cycle_count); } -void DSPLLE::EmuStateChange(PLUGIN_EMUSTATE newState) -{ - DSP_ClearAudioBuffer((newState == PLUGIN_EMUSTATE_PLAY) ? false : true); -} - /* ECTORTODO void *DllDebugger(void *_hParent, bool Show) { diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h index 10ce96744e..c41cf951e2 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h @@ -29,20 +29,9 @@ public: virtual void Initialize(void *hWnd, bool bWii, bool bDSPThread); virtual void Shutdown(); - virtual bool IsLLE() { return true; } - void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals); - - /* - GUI - virtual void Config(void *_hwnd); - virtual void About(void *_hwnd); - virtual void *Debug(void *Parent, bool Show); - */ - virtual void DoState(PointerWrap &p); - virtual void EmuStateChange(PLUGIN_EMUSTATE newState); virtual void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short); virtual void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short); diff --git a/Source/Core/Core/Src/PluginDSP.h b/Source/Core/Core/Src/PluginDSP.h index 56b918bf5a..45975f0831 100644 --- a/Source/Core/Core/Src/PluginDSP.h +++ b/Source/Core/Core/Src/PluginDSP.h @@ -19,7 +19,6 @@ #define _PLUGINDSP_H_ -#include "Plugin.h" // TODO: Only here for EmuStateChange #include "ChunkFile.h" class PluginDSP @@ -32,15 +31,7 @@ public: virtual void Initialize(void *hWnd, bool bWii, bool bDSPThread) = 0; virtual void Shutdown() = 0; - /* - GUI - virtual void Config(void *_hwnd) = 0; - virtual void About(void *_hwnd) = 0; - virtual void *Debug(void *Parent, bool Show) = 0; - */ - virtual void DoState(PointerWrap &p) = 0; - virtual void EmuStateChange(PLUGIN_EMUSTATE newState) = 0; virtual void DSP_WriteMailBoxHigh(bool _CPUMailbox, unsigned short) = 0; virtual void DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short) = 0; diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index d3c191399c..fa26061b52 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -407,9 +407,90 @@ void CConfigMain::InitializeGUIValues() GCSystemLang->SetSelection(startup_params.SelectedLanguage); // Gamecube - Devices - // Not here. They use some locals over in CreateGUIControls for initialization, - // which is why they are still there. + wxArrayString SlotDevices; + SlotDevices.Add(_(DEV_NONE_STR)); + SlotDevices.Add(_(DEV_DUMMY_STR)); + SlotDevices.Add(_(EXIDEV_MEMCARD_STR)); + SlotDevices.Add(_(EXIDEV_GECKO_STR)); +#if HAVE_PORTAUDIO + SlotDevices.Add(_(EXIDEV_MIC_STR)); +#endif + wxArrayString SP1Devices; + SP1Devices.Add(_(DEV_NONE_STR)); + SP1Devices.Add(_(DEV_DUMMY_STR)); + SP1Devices.Add(_(EXIDEV_BBA_STR)); + SP1Devices.Add(_(EXIDEV_AM_BB_STR)); + + wxArrayString SIDevices; + SIDevices.Add(_(DEV_NONE_STR)); + SIDevices.Add(_(SIDEV_STDCONT_STR)); + SIDevices.Add(_(SIDEV_GBA_STR)); + SIDevices.Add(_(SIDEV_AM_BB_STR)); + + for (int i = 0; i < 3; ++i) + { + bool isMemcard = false; + + // Add strings to the wxChoice list, the third wxChoice is the SP1 slot + if (i == 2) + GCEXIDevice[i]->Append(SP1Devices); + else + GCEXIDevice[i]->Append(SlotDevices); + + switch (SConfig::GetInstance().m_EXIDevice[i]) + { + case EXIDEVICE_NONE: + GCEXIDevice[i]->SetStringSelection(SlotDevices[0]); + break; + case EXIDEVICE_MEMORYCARD_A: + case EXIDEVICE_MEMORYCARD_B: + isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[2]); + break; + case EXIDEVICE_MIC: + GCEXIDevice[i]->SetStringSelection(SlotDevices[4]); + break; + case EXIDEVICE_ETH: + GCEXIDevice[i]->SetStringSelection(SP1Devices[2]); + break; + case EXIDEVICE_AM_BASEBOARD: + GCEXIDevice[i]->SetStringSelection(SP1Devices[3]); + break; + case EXIDEVICE_GECKO: + GCEXIDevice[i]->SetStringSelection(SlotDevices[3]); + break; + case EXIDEVICE_DUMMY: + default: + GCEXIDevice[i]->SetStringSelection(SlotDevices[1]); + break; + } + if (!isMemcard && i < 2) + GCMemcardPath[i]->Disable(); + } + for (int i = 0; i < 4; ++i) + { + // Add string to the wxChoice list + GCSIDevice[i]->Append(SIDevices); + + switch (SConfig::GetInstance().m_SIDevice[i]) + { + case SI_GC_CONTROLLER: + GCSIDevice[i]->SetStringSelection(SIDevices[1]); + break; + case SI_GBA: + GCSIDevice[i]->SetStringSelection(SIDevices[2]); + break; + case SI_AM_BASEBOARD: + GCSIDevice[i]->SetStringSelection(SIDevices[3]); + break; + default: + GCSIDevice[i]->SetStringSelection(SIDevices[0]); + break; + } + // Remove the AM baseboard from the list, only the first list can select it + if (i == 0) + SIDevices.RemoveAt(SIDevices.GetCount() - 1); + } // Wii - Wiimote WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("BT.BAR")); @@ -475,7 +556,6 @@ void CConfigMain::InitializeGUITooltips() // Audio tooltips EnableDTKMusic->SetToolTip(_("This is used to play music tracks, like BGM.")); EnableThrottle->SetToolTip(_("This is used to control game speed by sound throttle.\nDisabling this could cause abnormal game speed, such as too fast.\nBut sometimes enabling this could cause constant noise.\n\nKeyboard Shortcut : Hold down to instantly disable Throttle.")); - DSPEngine->SetToolTip(_("please someone fill this tooltip i have no idea what to say :D")); FrequencySelection->SetToolTip(_("Changing this will have no effect while the emulator is running!")); BackendSelection->SetToolTip(_("Changing this will have no effect while the emulator is running!")); @@ -661,8 +741,7 @@ void CConfigMain::CreateGUIControls() wxDefaultPosition, wxDefaultSize, 0); BackendSelection = new wxChoice(AudioPage, ID_BACKEND, wxDefaultPosition, wxDefaultSize, wxArrayBackends, 0, wxDefaultValidator, wxEmptyString); - FrequencySelection = new wxChoice(AudioPage, ID_FREQUENCY, wxDefaultPosition, - wxDefaultSize, wxArrayRates, 0, wxDefaultValidator, wxEmptyString); + FrequencySelection = new wxChoice(AudioPage, ID_FREQUENCY); FrequencySelection->Append(_("48,000 Hz")); FrequencySelection->Append(_("32,000 Hz")); @@ -696,7 +775,6 @@ void CConfigMain::CreateGUIControls() AudioPage->SetSizerAndFit(sAudioPage); - // TODO : Warning the following code hurts // Gamecube page // IPL settings sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, _("IPL Settings")); @@ -710,97 +788,25 @@ void CConfigMain::CreateGUIControls() GCEXIDeviceText[0] = TEXT_BOX(GamecubePage, _("Slot A")); GCEXIDeviceText[1] = TEXT_BOX(GamecubePage, _("Slot B")); GCEXIDeviceText[2] = TEXT_BOX(GamecubePage, wxT("SP1 ")); - const wxString SlotDevices[] = {_(DEV_NONE_STR), _(DEV_DUMMY_STR), _(EXIDEV_MEMCARD_STR), _(EXIDEV_GECKO_STR) - #if HAVE_PORTAUDIO - , _(EXIDEV_MIC_STR) - #endif - }; - static const int numSlotDevices = sizeof(SlotDevices)/sizeof(wxString); - const wxString SP1Devices[] = { _(DEV_NONE_STR), _(DEV_DUMMY_STR), _(EXIDEV_BBA_STR), _(EXIDEV_AM_BB_STR) }; - static const int numSP1Devices = sizeof(SP1Devices)/sizeof(wxString); - GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA, wxDefaultPosition, - wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator); - GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB, wxDefaultPosition, - wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator); - GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1, wxDefaultPosition, - wxDefaultSize, numSP1Devices, SP1Devices, 0, wxDefaultValidator); + GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA); + GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB); + GCEXIDevice[2] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SP1); GCMemcardPath[0] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTA_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); GCMemcardPath[1] = new wxButton(GamecubePage, ID_GC_EXIDEVICE_SLOTB_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); - // Can't move this one without making the 4 const's etc. above class members/fields, - // TODO : lies, wxArrayString + wxChoice->Create. - for (int i = 0; i < 3; ++i) - { - bool isMemcard = false; - switch (SConfig::GetInstance().m_EXIDevice[i]) - { - case EXIDEVICE_NONE: - GCEXIDevice[i]->SetStringSelection(SlotDevices[0]); - break; - case EXIDEVICE_MEMORYCARD_A: - case EXIDEVICE_MEMORYCARD_B: - isMemcard = GCEXIDevice[i]->SetStringSelection(SlotDevices[2]); - break; - case EXIDEVICE_MIC: - GCEXIDevice[i]->SetStringSelection(SlotDevices[4]); - break; - case EXIDEVICE_ETH: - GCEXIDevice[i]->SetStringSelection(SP1Devices[2]); - break; - case EXIDEVICE_AM_BASEBOARD: - GCEXIDevice[i]->SetStringSelection(SP1Devices[3]); - break; - case EXIDEVICE_GECKO: - GCEXIDevice[i]->SetStringSelection(SlotDevices[3]); - break; - case EXIDEVICE_DUMMY: - default: - GCEXIDevice[i]->SetStringSelection(SlotDevices[1]); - break; - } - if (!isMemcard && i < 2) - GCMemcardPath[i]->Disable(); - } - //SI Devices wxStaticText* GCSIDeviceText[4]; GCSIDeviceText[0] = TEXT_BOX(GamecubePage, _("Port 1")); GCSIDeviceText[1] = TEXT_BOX(GamecubePage, _("Port 2")); GCSIDeviceText[2] = TEXT_BOX(GamecubePage, _("Port 3")); GCSIDeviceText[3] = TEXT_BOX(GamecubePage, _("Port 4")); + GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0); + GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1); + GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2); + GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3); - // SIDEV_AM_BB_STR must be last! - const wxString SIDevices[] = {_(DEV_NONE_STR),_(SIDEV_STDCONT_STR),_(SIDEV_GBA_STR),_(SIDEV_AM_BB_STR)}; - static const int numSIDevices = sizeof(SIDevices)/sizeof(wxString); - GCSIDevice[0] = new wxChoice(GamecubePage, ID_GC_SIDEVICE0, wxDefaultPosition, - wxDefaultSize, numSIDevices, SIDevices, 0, wxDefaultValidator); - GCSIDevice[1] = new wxChoice(GamecubePage, ID_GC_SIDEVICE1, wxDefaultPosition, - wxDefaultSize, numSIDevices - 1, SIDevices, 0, wxDefaultValidator); - GCSIDevice[2] = new wxChoice(GamecubePage, ID_GC_SIDEVICE2, wxDefaultPosition, - wxDefaultSize, numSIDevices - 1, SIDevices, 0, wxDefaultValidator); - GCSIDevice[3] = new wxChoice(GamecubePage, ID_GC_SIDEVICE3, wxDefaultPosition, - wxDefaultSize, numSIDevices - 1, SIDevices, 0, wxDefaultValidator); - // Can't move this one without making the 2 const's etc. above class members/fields. - for (int i = 0; i < 4; ++i) - { - switch (SConfig::GetInstance().m_SIDevice[i]) - { - case SI_GC_CONTROLLER: - GCSIDevice[i]->SetStringSelection(SIDevices[1]); - break; - case SI_GBA: - GCSIDevice[i]->SetStringSelection(SIDevices[2]); - break; - case SI_AM_BASEBOARD: - GCSIDevice[i]->SetStringSelection(SIDevices[3]); - break; - default: - GCSIDevice[i]->SetStringSelection(SIDevices[0]); - break; - } - } // Populate the Gamecube page sGamecubeIPLSettings = new wxGridBagSizer(); @@ -1096,14 +1102,13 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event) ac_Config.m_EnableJIT = DSPEngine->GetSelection() == 1; ac_Config.Update(); break; - case ID_BACKEND: - VolumeSlider->Enable(SupportsVolumeChanges(std::string(BackendSelection->GetStringSelection().mb_str()))); - break; case ID_VOLUME: ac_Config.m_Volume = VolumeSlider->GetValue(); ac_Config.Update(); VolumeText->SetLabel(wxString::Format(wxT("%d %%"), VolumeSlider->GetValue())); break; + case ID_BACKEND: + VolumeSlider->Enable(SupportsVolumeChanges(std::string(BackendSelection->GetStringSelection().mb_str()))); default: ac_Config.m_EnableDTKMusic = EnableDTKMusic->GetValue(); ac_Config.m_EnableThrottle = EnableThrottle->GetValue(); @@ -1532,4 +1537,4 @@ void CConfigMain::AddResolutions() } } #endif -} +} \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 93fe2fe554..512adb4f2e 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -58,8 +58,12 @@ public: ID_WIIPAGE, ID_PATHSPAGE, ID_PLUGINPAGE, + }; - ID_CPUTHREAD, +private: + enum + { + ID_CPUTHREAD = 1010, ID_IDLESKIP, ID_ENABLECHEATS, ID_FRAMELIMIT, @@ -144,7 +148,6 @@ public: ID_DSP_ABOUT, }; -private: wxNotebook* Notebook; wxPanel* PathsPage; @@ -184,7 +187,6 @@ private: wxCheckBox* EnableDTKMusic; wxCheckBox* EnableThrottle; wxArrayString wxArrayBackends; - wxArrayString wxArrayRates; wxChoice* BackendSelection; wxChoice* FrequencySelection;