Config: Port WiiKeyboard setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 05:00:46 +01:00
parent f19cf1753b
commit b2da738c81
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
5 changed files with 6 additions and 8 deletions

View File

@ -106,6 +106,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::MAIN_FASTMEM.GetLocation(),
&Config::MAIN_TIMING_VARIANCE.GetLocation(),
&Config::MAIN_WII_SD_CARD.GetLocation(),
&Config::MAIN_WII_KEYBOARD.GetLocation(),
// UI.General

View File

@ -111,7 +111,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
{
core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]);
}
core->Set("WiiKeyboard", m_WiiKeyboard);
core->Set("WiimoteContinuousScanning", m_WiimoteContinuousScanning);
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface);
@ -142,7 +141,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
}
core->Get("WiiKeyboard", &m_WiiKeyboard, false);
core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false);
core->Get("WiimoteControllerInterface", &connect_wiimotes_for_ciface, false);

View File

@ -50,7 +50,6 @@ struct BootParameters;
struct SConfig
{
// Wii Devices
bool m_WiiKeyboard;
bool m_WiimoteContinuousScanning;
bool m_WiimoteEnableSpeaker;
bool connect_wiimotes_for_ciface;

View File

@ -10,7 +10,7 @@
#include "Common/IniFile.h"
#include "Common/Logging/Log.h"
#include "Common/Swap.h"
#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "Core/Core.h" // Local core functions
#include "Core/HW/Memmap.h"
#include "InputCommon/ControlReference/ControlReference.h" // For background input check
@ -210,7 +210,7 @@ std::optional<IPCReply> USB_KBD::Write(const ReadWriteRequest& request)
std::optional<IPCReply> USB_KBD::IOCtl(const IOCtlRequest& request)
{
if (SConfig::GetInstance().m_WiiKeyboard && !Core::WantsDeterminism() &&
if (Config::Get(Config::MAIN_WII_KEYBOARD) && !Core::WantsDeterminism() &&
ControlReference::GetInputGate() && !m_message_queue.empty())
{
Memory::CopyToEmu(request.buffer_out, &m_message_queue.front(), sizeof(MessageData));
@ -231,7 +231,7 @@ bool USB_KBD::IsKeyPressed(int key) const
void USB_KBD::Update()
{
if (!SConfig::GetInstance().m_WiiKeyboard || Core::WantsDeterminism() || !m_is_active)
if (!Config::Get(Config::MAIN_WII_KEYBOARD) || Core::WantsDeterminism() || !m_is_active)
return;
u8 modifiers = 0x00;

View File

@ -714,14 +714,14 @@ void Settings::SetSDCardInserted(bool inserted)
bool Settings::IsUSBKeyboardConnected() const
{
return SConfig::GetInstance().m_WiiKeyboard;
return Config::Get(Config::MAIN_WII_KEYBOARD);
}
void Settings::SetUSBKeyboardConnected(bool connected)
{
if (IsUSBKeyboardConnected() != connected)
{
SConfig::GetInstance().m_WiiKeyboard = connected;
Config::SetBaseOrCurrent(Config::MAIN_WII_KEYBOARD, connected);
emit USBKeyboardConnectionChanged(connected);
}
}