mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Config: Port BluetoothPassthrough settings to new config system.
This commit is contained in:
parent
5c6dc5002f
commit
526887899e
@ -91,7 +91,6 @@ private:
|
||||
int iSelectedLanguage = 0;
|
||||
PowerPC::CPUCore cpu_core = PowerPC::CPUCore::Interpreter;
|
||||
float m_EmulationSpeed = 0;
|
||||
bool m_bt_passthrough_enabled = false;
|
||||
std::string m_strGPUDeterminismMode;
|
||||
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
|
||||
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
|
||||
@ -121,7 +120,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
||||
cpu_core = config.cpu_core;
|
||||
m_EmulationSpeed = config.m_EmulationSpeed;
|
||||
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
|
||||
m_bt_passthrough_enabled = config.m_bt_passthrough_enabled;
|
||||
|
||||
for (int i = 0; i != MAX_BBMOTES; ++i)
|
||||
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
|
||||
@ -189,7 +187,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
|
||||
}
|
||||
|
||||
config->m_strGPUDeterminismMode = m_strGPUDeterminismMode;
|
||||
config->m_bt_passthrough_enabled = m_bt_passthrough_enabled;
|
||||
}
|
||||
|
||||
static ConfigCache config_cache;
|
||||
@ -357,7 +354,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
StartUp.bMMU = netplay_settings.m_MMU;
|
||||
StartUp.bFastmem = netplay_settings.m_Fastmem;
|
||||
StartUp.bHLE_BS2 = netplay_settings.m_SkipIPL;
|
||||
StartUp.m_bt_passthrough_enabled = false;
|
||||
if (netplay_settings.m_HostInputAuthority && !netplay_settings.m_IsHosting)
|
||||
config_cache.bSetEmulationSpeed = true;
|
||||
}
|
||||
|
@ -298,4 +298,13 @@ const Info<bool> MAIN_DEBUG_JIT_BRANCH_OFF{{System::Main, "Debug", "JitBranchOff
|
||||
const Info<bool> MAIN_DEBUG_JIT_REGISTER_CACHE_OFF{{System::Main, "Debug", "JitRegisterCacheOff"},
|
||||
false};
|
||||
|
||||
// Main.BluetoothPassthrough
|
||||
|
||||
const Info<bool> MAIN_BLUETOOTH_PASSTHROUGH_ENABLED{
|
||||
{System::Main, "BluetoothPassthrough", "Enabled"}, false};
|
||||
const Info<int> MAIN_BLUETOOTH_PASSTHROUGH_VID{{System::Main, "BluetoothPassthrough", "VID"}, -1};
|
||||
const Info<int> MAIN_BLUETOOTH_PASSTHROUGH_PID{{System::Main, "BluetoothPassthrough", "PID"}, -1};
|
||||
const Info<std::string> MAIN_BLUETOOTH_PASSTHROUGH_LINK_KEYS{
|
||||
{System::Main, "BluetoothPassthrough", "LinkKeys"}, ""};
|
||||
|
||||
} // namespace Config
|
||||
|
@ -250,4 +250,11 @@ extern const Info<bool> MAIN_DEBUG_JIT_SYSTEM_REGISTERS_OFF;
|
||||
extern const Info<bool> MAIN_DEBUG_JIT_BRANCH_OFF;
|
||||
extern const Info<bool> MAIN_DEBUG_JIT_REGISTER_CACHE_OFF;
|
||||
|
||||
// Main.BluetoothPassthrough
|
||||
|
||||
extern const Info<bool> MAIN_BLUETOOTH_PASSTHROUGH_ENABLED;
|
||||
extern const Info<int> MAIN_BLUETOOTH_PASSTHROUGH_VID;
|
||||
extern const Info<int> MAIN_BLUETOOTH_PASSTHROUGH_PID;
|
||||
extern const Info<std::string> MAIN_BLUETOOTH_PASSTHROUGH_LINK_KEYS;
|
||||
|
||||
} // namespace Config
|
||||
|
@ -27,7 +27,8 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
||||
{
|
||||
for (const std::string_view section :
|
||||
{"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons",
|
||||
"DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie", "Input", "Debug"})
|
||||
"DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie", "Input", "Debug",
|
||||
"BluetoothPassthrough"})
|
||||
{
|
||||
if (config_location.section == section)
|
||||
return true;
|
||||
|
@ -93,6 +93,8 @@ public:
|
||||
|
||||
layer->Set(Config::SESSION_USE_FMA, m_settings.m_UseFMA);
|
||||
|
||||
layer->Set(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED, false);
|
||||
|
||||
if (m_settings.m_StrictSettingsSync)
|
||||
{
|
||||
layer->Set(Config::GFX_HACK_VERTEX_ROUDING, m_settings.m_VertexRounding);
|
||||
|
@ -91,7 +91,6 @@ void SConfig::SaveSettings()
|
||||
SaveGeneralSettings(ini);
|
||||
SaveInterfaceSettings(ini);
|
||||
SaveCoreSettings(ini);
|
||||
SaveBluetoothPassthroughSettings(ini);
|
||||
SaveUSBPassthroughSettings(ini);
|
||||
|
||||
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
@ -196,16 +195,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||
core->Set("CustomRTCValue", m_customRTCValue);
|
||||
}
|
||||
|
||||
void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
|
||||
|
||||
section->Set("Enabled", m_bt_passthrough_enabled);
|
||||
section->Set("VID", m_bt_passthrough_vid);
|
||||
section->Set("PID", m_bt_passthrough_pid);
|
||||
section->Set("LinkKeys", m_bt_passthrough_link_keys);
|
||||
}
|
||||
|
||||
void SConfig::SaveUSBPassthroughSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* section = ini.GetOrCreateSection("USBPassthrough");
|
||||
@ -231,7 +220,6 @@ void SConfig::LoadSettings()
|
||||
LoadGeneralSettings(ini);
|
||||
LoadInterfaceSettings(ini);
|
||||
LoadCoreSettings(ini);
|
||||
LoadBluetoothPassthroughSettings(ini);
|
||||
LoadUSBPassthroughSettings(ini);
|
||||
}
|
||||
|
||||
@ -341,16 +329,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||
core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
|
||||
}
|
||||
|
||||
void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
|
||||
|
||||
section->Get("Enabled", &m_bt_passthrough_enabled, false);
|
||||
section->Get("VID", &m_bt_passthrough_vid, -1);
|
||||
section->Get("PID", &m_bt_passthrough_pid, -1);
|
||||
section->Get("LinkKeys", &m_bt_passthrough_link_keys, "");
|
||||
}
|
||||
|
||||
void SConfig::LoadUSBPassthroughSettings(IniFile& ini)
|
||||
{
|
||||
IniFile::Section* section = ini.GetOrCreateSection("USBPassthrough");
|
||||
|
@ -128,12 +128,6 @@ struct SConfig
|
||||
bool bLockCursor = false;
|
||||
std::string theme_name;
|
||||
|
||||
// Bluetooth passthrough mode settings
|
||||
bool m_bt_passthrough_enabled = false;
|
||||
int m_bt_passthrough_pid = -1;
|
||||
int m_bt_passthrough_vid = -1;
|
||||
std::string m_bt_passthrough_link_keys;
|
||||
|
||||
// USB passthrough settings
|
||||
std::set<std::pair<u16, u16>> m_usb_passthrough_devices;
|
||||
bool IsUSBDeviceWhitelisted(std::pair<u16, u16> vid_pid) const;
|
||||
@ -243,13 +237,11 @@ private:
|
||||
void SaveGeneralSettings(IniFile& ini);
|
||||
void SaveInterfaceSettings(IniFile& ini);
|
||||
void SaveCoreSettings(IniFile& ini);
|
||||
void SaveBluetoothPassthroughSettings(IniFile& ini);
|
||||
void SaveUSBPassthroughSettings(IniFile& ini);
|
||||
|
||||
void LoadGeneralSettings(IniFile& ini);
|
||||
void LoadInterfaceSettings(IniFile& ini);
|
||||
void LoadCoreSettings(IniFile& ini);
|
||||
void LoadBluetoothPassthroughSettings(IniFile& ini);
|
||||
void LoadUSBPassthroughSettings(IniFile& ini);
|
||||
|
||||
void SetRunningGameMetadata(const std::string& game_id, const std::string& gametdb_id,
|
||||
|
@ -486,7 +486,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
|
||||
// Load and Init Wiimotes - only if we are booting in Wii mode
|
||||
bool init_wiimotes = false;
|
||||
if (core_parameter.bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||
if (core_parameter.bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
{
|
||||
if (init_controllers)
|
||||
{
|
||||
|
@ -681,7 +681,7 @@ void WiimoteScanner::ThreadFunc()
|
||||
{
|
||||
// We don't want any remotes in passthrough mode or running in GC mode.
|
||||
const bool core_running = Core::GetState() != Core::State::Uninitialized;
|
||||
if (SConfig::GetInstance().m_bt_passthrough_enabled ||
|
||||
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED) ||
|
||||
(core_running && !SConfig::GetInstance().bWii))
|
||||
continue;
|
||||
|
||||
|
@ -515,7 +515,7 @@ void Kernel::AddStaticDevices()
|
||||
|
||||
// OH1 (Bluetooth)
|
||||
AddDevice(std::make_unique<DeviceStub>(*this, "/dev/usb/oh1"));
|
||||
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||
if (!Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
AddDevice(std::make_unique<BluetoothEmuDevice>(*this, "/dev/usb/oh1/57e/305"));
|
||||
else
|
||||
AddDevice(std::make_unique<BluetoothRealDevice>(*this, "/dev/usb/oh1/57e/305"));
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "Common/Network.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/Device.h"
|
||||
@ -38,8 +38,8 @@ constexpr u8 REQUEST_TYPE = static_cast<u8>(LIBUSB_ENDPOINT_OUT) |
|
||||
|
||||
static bool IsWantedDevice(const libusb_device_descriptor& descriptor)
|
||||
{
|
||||
const int vid = SConfig::GetInstance().m_bt_passthrough_vid;
|
||||
const int pid = SConfig::GetInstance().m_bt_passthrough_pid;
|
||||
const int vid = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_VID);
|
||||
const int pid = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_PID);
|
||||
if (vid == -1 || pid == -1)
|
||||
return true;
|
||||
return descriptor.idVendor == vid && descriptor.idProduct == pid;
|
||||
@ -49,9 +49,11 @@ static bool IsBluetoothDevice(const libusb_interface_descriptor& descriptor)
|
||||
{
|
||||
constexpr u8 SUBCLASS = 0x01;
|
||||
constexpr u8 PROTOCOL_BLUETOOTH = 0x01;
|
||||
if (SConfig::GetInstance().m_bt_passthrough_vid != -1 &&
|
||||
SConfig::GetInstance().m_bt_passthrough_pid != -1)
|
||||
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_VID) != -1 &&
|
||||
Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_PID) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return descriptor.bInterfaceClass == LIBUSB_CLASS_WIRELESS &&
|
||||
descriptor.bInterfaceSubClass == SUBCLASS &&
|
||||
descriptor.bInterfaceProtocol == PROTOCOL_BLUETOOTH;
|
||||
@ -499,7 +501,7 @@ void BluetoothRealDevice::FakeSyncButtonHeldEvent(USB::V0IntrMessage& ctrl)
|
||||
|
||||
void BluetoothRealDevice::LoadLinkKeys()
|
||||
{
|
||||
const std::string& entries = SConfig::GetInstance().m_bt_passthrough_link_keys;
|
||||
std::string entries = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_LINK_KEYS);
|
||||
if (entries.empty())
|
||||
return;
|
||||
for (const auto& pair : SplitString(entries, ','))
|
||||
@ -556,7 +558,7 @@ void BluetoothRealDevice::SaveLinkKeys()
|
||||
std::string config_string = oss.str();
|
||||
if (!config_string.empty())
|
||||
config_string.pop_back();
|
||||
SConfig::GetInstance().m_bt_passthrough_link_keys = config_string;
|
||||
Config::SetBase(Config::MAIN_BLUETOOTH_PASSTHROUGH_LINK_KEYS, config_string);
|
||||
}
|
||||
|
||||
bool BluetoothRealDevice::OpenDevice(libusb_device* device)
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/CommonTitles.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/IOS/Device.h"
|
||||
#include "Core/IOS/ES/ES.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
@ -967,14 +967,14 @@ static std::shared_ptr<IOS::HLE::Device> GetBluetoothDevice()
|
||||
|
||||
std::shared_ptr<IOS::HLE::BluetoothEmuDevice> GetBluetoothEmuDevice()
|
||||
{
|
||||
if (SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
return nullptr;
|
||||
return std::static_pointer_cast<IOS::HLE::BluetoothEmuDevice>(GetBluetoothDevice());
|
||||
}
|
||||
|
||||
std::shared_ptr<IOS::HLE::BluetoothRealDevice> GetBluetoothRealDevice()
|
||||
{
|
||||
if (!SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||
if (!Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
return nullptr;
|
||||
return std::static_pointer_cast<IOS::HLE::BluetoothRealDevice>(GetBluetoothDevice());
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
@ -308,7 +309,7 @@ void WiimoteControllersWidget::LoadSettings()
|
||||
m_wiimote_ciface->setChecked(SConfig::GetInstance().connect_wiimotes_for_ciface);
|
||||
m_wiimote_continuous_scanning->setChecked(SConfig::GetInstance().m_WiimoteContinuousScanning);
|
||||
|
||||
if (SConfig::GetInstance().m_bt_passthrough_enabled)
|
||||
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
|
||||
m_wiimote_passthrough->setChecked(true);
|
||||
else
|
||||
m_wiimote_emu->setChecked(true);
|
||||
@ -321,7 +322,8 @@ void WiimoteControllersWidget::SaveSettings()
|
||||
SConfig::GetInstance().m_WiimoteEnableSpeaker = m_wiimote_speaker_data->isChecked();
|
||||
SConfig::GetInstance().connect_wiimotes_for_ciface = m_wiimote_ciface->isChecked();
|
||||
SConfig::GetInstance().m_WiimoteContinuousScanning = m_wiimote_continuous_scanning->isChecked();
|
||||
SConfig::GetInstance().m_bt_passthrough_enabled = m_wiimote_passthrough->isChecked();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED,
|
||||
m_wiimote_passthrough->isChecked());
|
||||
|
||||
WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, m_wiimote_real_balance_board->isChecked() ?
|
||||
WiimoteSource::Real :
|
||||
|
Loading…
Reference in New Issue
Block a user