From a9f7a0c284677611efd2c535f15b5c95f57048c7 Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 25 May 2011 15:01:49 +0000 Subject: [PATCH] Added a game specific property to disable the speaker on real Wiimotes. Fixes issue 4185. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7559 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/BootManager.cpp | 5 ++++- Source/Core/Core/Src/CoreParameter.cpp | 4 +++- Source/Core/Core/Src/CoreParameter.h | 1 + .../Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 +- Source/Core/DolphinWX/Src/ISOProperties.cpp | 15 +++++++++++++++ Source/Core/DolphinWX/Src/ISOProperties.h | 3 ++- 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index ee6fdd7267..ed415a4ae9 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -54,7 +54,7 @@ namespace BootManager struct ConfigCache { bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bMMUBAT, - bVBeam, bFastDiscSpeed, bMergeBlocks, bDSPHLE; + bVBeam, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bDisableWiimoteSpeaker; int iTLBHack; }; static ConfigCache config_cache; @@ -98,6 +98,7 @@ bool BootCore(const std::string& _rFilename) config_cache.bFastDiscSpeed = StartUp.bFastDiscSpeed; config_cache.bMergeBlocks = StartUp.bMergeBlocks; config_cache.bDSPHLE = StartUp.bDSPHLE; + config_cache.bDisableWiimoteSpeaker = StartUp.bDisableWiimoteSpeaker; // General settings game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread); @@ -110,6 +111,7 @@ bool BootCore(const std::string& _rFilename) game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks); game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE); + game_ini.Get("Wii", "DisableWiimoteSpeaker",&StartUp.bDisableWiimoteSpeaker, StartUp.bDisableWiimoteSpeaker); // Wii settings if (StartUp.bWii) @@ -149,6 +151,7 @@ void Stop() StartUp.bFastDiscSpeed = config_cache.bFastDiscSpeed; StartUp.bMergeBlocks = config_cache.bMergeBlocks; StartUp.bDSPHLE = config_cache.bDSPHLE; + StartUp.bDisableWiimoteSpeaker = config_cache.bDisableWiimoteSpeaker; } } diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 7d4dec83d9..ce6412a528 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -59,7 +59,7 @@ SCoreStartupParameter::SCoreStartupParameter() iRenderWindowWidth(640), iRenderWindowHeight(480), bRenderWindowAutoSize(false), bFullscreen(false), bRenderToMain(false), - bProgressive(false), + bProgressive(false), bDisableWiimoteSpeaker(false), iTheme(0), iPosX(100), iPosY(100), iWidth(800), iHeight(600) { @@ -100,6 +100,8 @@ void SCoreStartupParameter::LoadDefaults() bJITPairedOff = false; bJITSystemRegistersOff = false; + bDisableWiimoteSpeaker = false; + m_strName = "NONE"; m_strUniqueID = "00000000"; } diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 4a1b43a4fa..da6508262a 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -120,6 +120,7 @@ struct SCoreStartupParameter int SelectedLanguage; bool bWii; + bool bDisableWiimoteSpeaker; // Interface settings bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 0793900900..8588eac0ba 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -190,7 +190,7 @@ bool Wiimote::Write() Report rpt; bool audio_written = false; - if (m_audio_reports.Pop(rpt)) + if (m_audio_reports.Pop(rpt) && !Core::g_CoreStartupParameter.bDisableWiimoteSpeaker) { IOWrite(rpt.first, rpt.second); delete[] rpt.first; diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 4774edc0f6..d0d6023d80 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -321,6 +321,9 @@ void CISOProperties::CreateGUIControls(bool IsWad) // Wii Console EnableProgressiveScan = new wxCheckBox(m_GameConfig, ID_ENABLEPROGRESSIVESCAN, _("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); EnableWideScreen = new wxCheckBox(m_GameConfig, ID_ENABLEWIDESCREEN, _("Enable WideScreen"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + DisableWiimoteSpeaker = new wxCheckBox(m_GameConfig, ID_DISABLEWIIMOTESPEAKER, _("Disable Wiimote Speaker"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + DisableWiimoteSpeaker->SetToolTip(_("Mutes the Wiimote speaker. Fixes random disconnections on real wiimotes. No effect on emulated wiimotes.")); + // Video UseZTPSpeedupHack = new wxCheckBox(m_GameConfig, ID_ZTP_SPEEDUP, _("ZTP hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER); UseZTPSpeedupHack->SetToolTip(_("Enable this to speed up The Legend of Zelda: Twilight Princess. Disable for ANY other game.")); @@ -365,6 +368,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbWiiOverrides->ShowItems(false); EnableProgressiveScan->Hide(); EnableWideScreen->Hide(); + DisableWiimoteSpeaker->Hide(); } else { @@ -375,6 +379,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) } sbWiiOverrides->Add(EnableProgressiveScan, 0, wxLEFT, 5); sbWiiOverrides->Add(EnableWideScreen, 0, wxLEFT, 5); + sbWiiOverrides->Add(DisableWiimoteSpeaker, 0, wxLEFT, 5); wxStaticBoxSizer * const sbVideoOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Video")); @@ -889,6 +894,11 @@ void CISOProperties::LoadGameConfig() else EnableWideScreen->Set3StateValue(wxCHK_UNDETERMINED); + if (GameIni.Get("Wii", "DisableWiimoteSpeaker", &bTemp)) + DisableWiimoteSpeaker->Set3StateValue((wxCheckBoxState)bTemp); + else + DisableWiimoteSpeaker->Set3StateValue(wxCHK_UNDETERMINED); + if (GameIni.Get("Video", "ZTPSpeedupHack", &bTemp)) UseZTPSpeedupHack->Set3StateValue((wxCheckBoxState)bTemp); else @@ -977,6 +987,11 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("Wii", "Widescreen", EnableWideScreen->Get3StateValue()); + if (DisableWiimoteSpeaker->Get3StateValue() == wxCHK_UNDETERMINED) + GameIni.DeleteKey("Wii", "DisableWiimoteSpeaker"); + else + GameIni.Set("Wii", "DisableWiimoteSpeaker", DisableWiimoteSpeaker->Get3StateValue()); + if (UseZTPSpeedupHack->Get3StateValue() == wxCHK_UNDETERMINED) GameIni.DeleteKey("Video", "ZTPSpeedupHack"); else diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 291f515ee1..0add6e9451 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -72,7 +72,7 @@ private: wxCheckBox *CPUThread, *SkipIdle, *MMU, *MMUBAT, *TLBHack; wxCheckBox *VBeam, *FastDiscSpeed, *BlockMerging, *DSPHLE; // Wii - wxCheckBox *EnableProgressiveScan, *EnableWideScreen; + wxCheckBox *EnableProgressiveScan, *EnableWideScreen, *DisableWiimoteSpeaker; // Video wxCheckBox *UseZTPSpeedupHack, *PHackEnable; wxButton *PHSettings; @@ -138,6 +138,7 @@ private: ID_PHSETTINGS, ID_ENABLEPROGRESSIVESCAN, ID_ENABLEWIDESCREEN, + ID_DISABLEWIIMOTESPEAKER, ID_EDITCONFIG, ID_EMUSTATE, ID_EMU_ISSUES,