From 9680d3ac95f733e9bf67fa778706771b8c1c746a Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 23 Feb 2011 10:01:04 +0000 Subject: [PATCH] Added an option to disable the Wiimote speaker. The checkbox has 3 states: Ticked = Clear sound but a bit unresponsive to controls Filled = Same as r7225 Clear = Disable speaker The option is in the Wii tab of the configuration. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7231 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/ConfigManager.cpp | 4 +++- Source/Core/Core/Src/ConfigManager.h | 1 + Source/Core/Core/Src/HLE/HLE_Misc.cpp | 30 +++++++++++++++++------- Source/Core/DolphinWX/Src/ConfigMain.cpp | 19 ++++++++++++++- Source/Core/DolphinWX/Src/ConfigMain.h | 2 ++ 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index c2f07e927a..4228946239 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -222,6 +222,7 @@ void SConfig::SaveSettings() ini.Set("Core", "WiiSDCard", m_WiiSDCard); ini.Set("Core", "WiiKeyboard", m_WiiKeyboard); + ini.Set("Core", "WiimoteSpeaker", m_WiimoteSpeaker); ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); @@ -349,7 +350,8 @@ void SConfig::LoadSettings() ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false); ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); - ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true); + ini.Get("Core", "WiimoteSpeaker", &m_WiimoteSpeaker, false); + ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true); ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index a3d66bde9c..87b0a9ef06 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -33,6 +33,7 @@ struct SConfig : NonCopyable bool m_WiiKeyboard; bool m_WiiAutoReconnect[4]; bool m_WiiAutoUnpair; + int m_WiimoteSpeaker; bool m_WiimoteReconnectOnLoad; // name of the last used filename diff --git a/Source/Core/Core/Src/HLE/HLE_Misc.cpp b/Source/Core/Core/Src/HLE/HLE_Misc.cpp index b9da971608..82633076db 100644 --- a/Source/Core/Core/Src/HLE/HLE_Misc.cpp +++ b/Source/Core/Core/Src/HLE/HLE_Misc.cpp @@ -23,6 +23,7 @@ #include "../HW/Memmap.h" #include "../Host.h" #include "CoreTiming.h" +#include "ConfigManager.h" namespace HLE_Misc { @@ -288,21 +289,32 @@ u8 isBusyPoll = 0; // Hack: Wiimotes are never too busy to process speaker data void IsBusyStream() { - isBusyPoll++; - - // Signal that the wiimote is idle for a few cycles, allowing sound - // to be processed. - if (isBusyPoll < 5) + if (SConfig::GetInstance().m_WiimoteSpeaker == 1) { - // Wiimote is idle GPR(3) = 0; } + else if (SConfig::GetInstance().m_WiimoteSpeaker == 2) + { + isBusyPoll++; + + // Signal that the wiimote is idle for a few cycles, allowing sound + // to be processed. + if (isBusyPoll < 5) + { + // Wiimote is idle + GPR(3) = 0; + } + else + { + // Wiimote is busy + GPR(3) = 1; + if (isBusyPoll >= 8) + isBusyPoll = 0; + } + } else { - // Wiimote is busy GPR(3) = 1; - if (isBusyPoll >= 8) - isBusyPoll = 0; } NPC = LR; } diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 1c9813ca33..b7663d10b0 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -164,6 +164,7 @@ EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged) EVT_CHECKBOX(ID_WII_SD_CARD, CConfigMain::WiiSettingsChanged) EVT_CHECKBOX(ID_WII_KEYBOARD, CConfigMain::WiiSettingsChanged) +EVT_CHECKBOX(ID_WII_WIIMOTE_SPEAKER, CConfigMain::WiiSettingsChanged) EVT_CHECKBOX(ID_WII_WIIMOTE_RECONNECT, CConfigMain::WiiSettingsChanged) @@ -503,6 +504,12 @@ void CConfigMain::InitializeGUIValues() WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("BT.BAR")); WiiSensBarSens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData("BT.SENS")); WiimoteMotor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData("BT.MOT")); + if (SConfig::GetInstance().m_WiimoteSpeaker == 1) + WiimoteSpeaker->Set3StateValue(wxCHK_CHECKED); + else if (SConfig::GetInstance().m_WiimoteSpeaker == 2) + WiimoteSpeaker->Set3StateValue(wxCHK_UNDETERMINED); + else + WiimoteSpeaker->Set3StateValue(wxCHK_UNCHECKED); WiimoteReconnectOnLoad->SetValue(SConfig::GetInstance().m_WiimoteReconnectOnLoad); // Wii - Misc @@ -825,6 +832,7 @@ void CConfigMain::CreateGUIControls() WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator); WiiSensBarSens = new wxSlider(WiiPage, ID_WII_BT_SENS, 0, 0, 4); WiimoteMotor = new wxCheckBox(WiiPage, ID_WII_BT_MOT, _("Wiimote Motor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + WiimoteSpeaker = new wxCheckBox(WiiPage, ID_WII_WIIMOTE_SPEAKER, _("Wiimote Speaker"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); WiimoteReconnectOnLoad = new wxCheckBox(WiiPage, ID_WII_WIIMOTE_RECONNECT, _("Reconnect Wiimote On Load State"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); // Misc Settings @@ -846,7 +854,8 @@ void CConfigMain::CreateGUIControls() wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); sWiimoteSettings->Add(WiiSensBarSens, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sWiimoteSettings->Add(WiimoteMotor, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5); - sWiimoteSettings->Add(WiimoteReconnectOnLoad, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5); + sWiimoteSettings->Add(WiimoteSpeaker, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5); + sWiimoteSettings->Add(WiimoteReconnectOnLoad, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5); sbWiimoteSettings = new wxStaticBoxSizer(wxHORIZONTAL, WiiPage, _("Wiimote Settings")); sbWiimoteSettings->Add(sWiimoteSettings); @@ -1267,6 +1276,14 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event) case ID_WII_BT_MOT: SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", WiimoteMotor->IsChecked()); break; + case ID_WII_WIIMOTE_SPEAKER: + if (WiimoteSpeaker->Get3StateValue() == wxCHK_CHECKED) + SConfig::GetInstance().m_WiimoteSpeaker = 1; + else if (WiimoteSpeaker->Get3StateValue() == wxCHK_UNDETERMINED) + SConfig::GetInstance().m_WiimoteSpeaker = 2; + else + SConfig::GetInstance().m_WiimoteSpeaker = 0; + break; case ID_WII_WIIMOTE_RECONNECT: SConfig::GetInstance().m_WiimoteReconnectOnLoad = WiimoteReconnectOnLoad->IsChecked(); break; diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 007978b43a..b70f88b3d0 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -117,6 +117,7 @@ private: ID_WII_BT_BAR, ID_WII_BT_SENS, ID_WII_BT_MOT, + ID_WII_WIIMOTE_SPEAKER, ID_WII_WIIMOTE_RECONNECT, ID_WII_IPL_SSV, @@ -219,6 +220,7 @@ private: wxChoice* WiiSensBarPos; wxSlider* WiiSensBarSens; wxCheckBox* WiimoteMotor; + wxCheckBox* WiimoteSpeaker; wxCheckBox* WiimoteReconnectOnLoad; // Misc