From 12d3f5e2a875549ea59ecde56ccad1f0ca50e417 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Sun, 1 Sep 2024 14:00:56 +0400 Subject: [PATCH] Config: Rename MAIN_WII_SPEAK_CONNECTED to MAIN_WII_SPEAK_MUTED --- .../features/settings/model/BooleanSetting.kt | 4 ++-- .../settings/ui/SettingsFragmentPresenter.kt | 6 +++--- Source/Android/app/src/main/res/values/strings.xml | 2 +- Source/Core/Core/Config/MainSettings.cpp | 3 +-- Source/Core/Core/Config/MainSettings.h | 2 +- Source/Core/Core/IOS/USB/Emulated/Microphone.cpp | 2 +- Source/Core/Core/IOS/USB/Emulated/WiiSpeak.cpp | 14 -------------- Source/Core/Core/IOS/USB/Emulated/WiiSpeak.h | 1 - .../Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp | 12 ++++++------ 9 files changed, 15 insertions(+), 31 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt index c89ebdf2db9f..b01fb6b90734 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/BooleanSetting.kt @@ -238,10 +238,10 @@ enum class BooleanSetting( "EmulateWiiSpeak", false ), - MAIN_WII_SPEAK_CONNECTED( + MAIN_WII_SPEAK_MUTED( Settings.FILE_DOLPHIN, Settings.SECTION_EMULATED_USB_DEVICES, - "WiiSpeakConnected", + "WiiSpeakMuted", false ), MAIN_SHOW_GAME_TITLES( diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt index 1eaa5ef1a470..6b2d20d3bc82 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt @@ -888,10 +888,10 @@ class SettingsFragmentPresenter( ) ) sl.add( - InvertedSwitchSetting( + SwitchSetting( context, - BooleanSetting.MAIN_WII_SPEAK_CONNECTED, - R.string.disconnect_wii_speak, + BooleanSetting.MAIN_WII_SPEAK_MUTED, + R.string.mute_wii_speak, 0 ) ) diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index db9b5918d680..9612fc5ec8b0 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -926,7 +926,7 @@ It can efficiently compress both junk data and encrypted Wii data. Please select a compatible figure file Wii Speak - Mute Wii Speak + Mute Wii Speak Missing Microphone Permission Wii Speak emulation requires microphone permission. You might need to restart the game for the permission to be effective. diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 2125a861a7f9..34ab3d2d1b16 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -578,8 +578,7 @@ const Info MAIN_EMULATE_WII_SPEAK{{System::Main, "EmulatedUSBDevices", "Em const Info MAIN_WII_SPEAK_MICROPHONE{ {System::Main, "EmulatedUSBDevices", "WiiSpeakMicrophone"}, ""}; -const Info MAIN_WII_SPEAK_CONNECTED{{System::Main, "EmulatedUSBDevices", "WiiSpeakConnected"}, - false}; +const Info MAIN_WII_SPEAK_MUTED{{System::Main, "EmulatedUSBDevices", "WiiSpeakMuted"}, true}; // The reason we need this function is because some memory card code // expects to get a non-NTSC-K region even if we're emulating an NTSC-K Wii. diff --git a/Source/Core/Core/Config/MainSettings.h b/Source/Core/Core/Config/MainSettings.h index dae372b15144..1d5a512aeeac 100644 --- a/Source/Core/Core/Config/MainSettings.h +++ b/Source/Core/Core/Config/MainSettings.h @@ -356,7 +356,7 @@ extern const Info MAIN_EMULATE_SKYLANDER_PORTAL; extern const Info MAIN_EMULATE_INFINITY_BASE; extern const Info MAIN_EMULATE_WII_SPEAK; extern const Info MAIN_WII_SPEAK_MICROPHONE; -extern const Info MAIN_WII_SPEAK_CONNECTED; +extern const Info MAIN_WII_SPEAK_MUTED; // GameCube path utility functions diff --git a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp index e370d719d7f9..5df29cf116bd 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp +++ b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp @@ -186,7 +186,7 @@ u16 Microphone::ReadIntoBuffer(u8* ptr, u32 size) bool Microphone::HasData() const { - return m_samples_avail > 0 && Config::Get(Config::MAIN_WII_SPEAK_CONNECTED); + return m_samples_avail > 0 && !Config::Get(Config::MAIN_WII_SPEAK_MUTED); } const WiiSpeakState& Microphone::GetSampler() const diff --git a/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.cpp b/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.cpp index 46540c77f62c..fe45e8b61d8c 100644 --- a/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.cpp +++ b/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.cpp @@ -94,12 +94,6 @@ int WiiSpeak::SubmitTransfer(std::unique_ptr cmd) m_vid, m_pid, m_active_interface, cmd->request_type, cmd->request, cmd->value, cmd->index, cmd->length); - // Without a proper way to reconnect the emulated Wii Speak, - // this error after being raised prevents some games to use the microphone later. - // - // if (!IsMicrophoneConnected()) - // return IPC_ENOENT; - switch (cmd->request_type << 8 | cmd->request) { case USBHDR(DIR_DEVICE2HOST, TYPE_STANDARD, REC_INTERFACE, REQUEST_GET_INTERFACE): @@ -162,9 +156,6 @@ int WiiSpeak::SubmitTransfer(std::unique_ptr cmd) int WiiSpeak::SubmitTransfer(std::unique_ptr cmd) { - // if (!IsMicrophoneConnected()) - // return IPC_ENOENT; - auto& system = m_ios.GetSystem(); auto& memory = system.GetMemory(); @@ -404,9 +395,4 @@ void WiiSpeak::GetRegister(const std::unique_ptr& cmd) const break; } } - -bool WiiSpeak::IsMicrophoneConnected() const -{ - return Config::Get(Config::MAIN_WII_SPEAK_CONNECTED); -} } // namespace IOS::HLE::USB diff --git a/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.h b/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.h index e4cf8f4e84b1..cc612d8d080b 100644 --- a/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.h +++ b/Source/Core/Core/IOS/USB/Emulated/WiiSpeak.h @@ -75,7 +75,6 @@ class WiiSpeak final : public Device void GetRegister(const std::unique_ptr& cmd) const; void SetRegister(const std::unique_ptr& cmd); - bool IsMicrophoneConnected() const; EmulationKernel& m_ios; const u16 m_vid = 0x057E; diff --git a/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp b/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp index 6772a023f8ad..093c08b778b5 100644 --- a/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp +++ b/Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp @@ -52,11 +52,11 @@ void WiiSpeakWindow::CreateMainWindow() m_config_group = new QGroupBox(tr("Microphone Configuration")); auto* config_layout = new QHBoxLayout(); - auto checkbox_mic_connected = new QCheckBox(tr("Connect"), this); - checkbox_mic_connected->setChecked(Config::Get(Config::MAIN_WII_SPEAK_CONNECTED)); - connect(checkbox_mic_connected, &QCheckBox::toggled, this, + auto checkbox_mic_muted = new QCheckBox(tr("Mute"), this); + checkbox_mic_muted->setChecked(Config::Get(Config::MAIN_WII_SPEAK_MUTED)); + connect(checkbox_mic_muted, &QCheckBox::toggled, this, &WiiSpeakWindow::SetWiiSpeakConnectionState); - config_layout->addWidget(checkbox_mic_connected); + config_layout->addWidget(checkbox_mic_muted); m_combobox_microphones = new QComboBox(); m_combobox_microphones->addItem(QLatin1String("(%1)").arg(tr("Autodetect preferred microphone")), @@ -86,9 +86,9 @@ void WiiSpeakWindow::EmulateWiiSpeak(bool emulate) m_config_group->setVisible(emulate); } -void WiiSpeakWindow::SetWiiSpeakConnectionState(bool connected) +void WiiSpeakWindow::SetWiiSpeakConnectionState(bool muted) { - Config::SetBaseOrCurrent(Config::MAIN_WII_SPEAK_CONNECTED, connected); + Config::SetBaseOrCurrent(Config::MAIN_WII_SPEAK_MUTED, muted); } void WiiSpeakWindow::OnEmulationStateChanged(Core::State state)