Skip to content

Commit

Permalink
Config: Rename MAIN_WII_SPEAK_CONNECTED to MAIN_WII_SPEAK_MUTED
Browse files Browse the repository at this point in the history
  • Loading branch information
sepalani committed Sep 22, 2024
1 parent 4e0b576 commit 12d3f5e
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
2 changes: 1 addition & 1 deletion Source/Android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ It can efficiently compress both junk data and encrypted Wii data.
<string name="select_compatible_figure">Please select a compatible figure file</string>

<string name="emulate_wii_speak">Wii Speak</string>
<string name="disconnect_wii_speak">Mute Wii Speak</string>
<string name="mute_wii_speak">Mute Wii Speak</string>
<string name="wii_speak_permission_warning">Missing Microphone Permission</string>
<string name="wii_speak_permission_warning_description">Wii Speak emulation requires microphone permission. You might need to restart the game for the permission to be effective.</string>
</resources>
3 changes: 1 addition & 2 deletions Source/Core/Core/Config/MainSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,7 @@ const Info<bool> MAIN_EMULATE_WII_SPEAK{{System::Main, "EmulatedUSBDevices", "Em
const Info<std::string> MAIN_WII_SPEAK_MICROPHONE{
{System::Main, "EmulatedUSBDevices", "WiiSpeakMicrophone"}, ""};

const Info<bool> MAIN_WII_SPEAK_CONNECTED{{System::Main, "EmulatedUSBDevices", "WiiSpeakConnected"},
false};
const Info<bool> 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.
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Config/MainSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ extern const Info<bool> MAIN_EMULATE_SKYLANDER_PORTAL;
extern const Info<bool> MAIN_EMULATE_INFINITY_BASE;
extern const Info<bool> MAIN_EMULATE_WII_SPEAK;
extern const Info<std::string> MAIN_WII_SPEAK_MICROPHONE;
extern const Info<bool> MAIN_WII_SPEAK_CONNECTED;
extern const Info<bool> MAIN_WII_SPEAK_MUTED;

// GameCube path utility functions

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/IOS/USB/Emulated/Microphone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions Source/Core/Core/IOS/USB/Emulated/WiiSpeak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ int WiiSpeak::SubmitTransfer(std::unique_ptr<CtrlMessage> 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):
Expand Down Expand Up @@ -162,9 +156,6 @@ int WiiSpeak::SubmitTransfer(std::unique_ptr<IntrMessage> cmd)

int WiiSpeak::SubmitTransfer(std::unique_ptr<IsoMessage> cmd)
{
// if (!IsMicrophoneConnected())
// return IPC_ENOENT;

auto& system = m_ios.GetSystem();
auto& memory = system.GetMemory();

Expand Down Expand Up @@ -404,9 +395,4 @@ void WiiSpeak::GetRegister(const std::unique_ptr<CtrlMessage>& cmd) const
break;
}
}

bool WiiSpeak::IsMicrophoneConnected() const
{
return Config::Get(Config::MAIN_WII_SPEAK_CONNECTED);
}
} // namespace IOS::HLE::USB
1 change: 0 additions & 1 deletion Source/Core/Core/IOS/USB/Emulated/WiiSpeak.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class WiiSpeak final : public Device

void GetRegister(const std::unique_ptr<CtrlMessage>& cmd) const;
void SetRegister(const std::unique_ptr<CtrlMessage>& cmd);
bool IsMicrophoneConnected() const;

EmulationKernel& m_ios;
const u16 m_vid = 0x057E;
Expand Down
12 changes: 6 additions & 6 deletions Source/Core/DolphinQt/EmulatedUSB/WiiSpeakWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 12d3f5e

Please sign in to comment.