Merge pull request #10354 from AdmiralCurtiss/config-port-core-3
Config: Port EXI device and SI device settings to new config system.
This commit is contained in:
commit
1d9d9d6a6e
|
@ -66,8 +66,6 @@ public:
|
||||||
// alone on restore (false)
|
// alone on restore (false)
|
||||||
bool bSetVolume = false;
|
bool bSetVolume = false;
|
||||||
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
|
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
|
||||||
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
|
|
||||||
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice{};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
@ -78,8 +76,6 @@ private:
|
||||||
int iSyncGpuMinDistance = 0;
|
int iSyncGpuMinDistance = 0;
|
||||||
float fSyncGpuOverclock = 0;
|
float fSyncGpuOverclock = 0;
|
||||||
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
|
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
|
||||||
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
|
|
||||||
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void ConfigCache::SaveConfig(const SConfig& config)
|
void ConfigCache::SaveConfig(const SConfig& config)
|
||||||
|
@ -96,13 +92,8 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
||||||
for (int i = 0; i != MAX_BBMOTES; ++i)
|
for (int i = 0; i != MAX_BBMOTES; ++i)
|
||||||
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
|
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
|
||||||
|
|
||||||
std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
|
|
||||||
std::copy(std::begin(config.m_EXIDevice), std::end(config.m_EXIDevice), std::begin(m_EXIDevice));
|
|
||||||
|
|
||||||
bSetVolume = false;
|
bSetVolume = false;
|
||||||
bSetWiimoteSource.fill(false);
|
bSetWiimoteSource.fill(false);
|
||||||
bSetPads.fill(false);
|
|
||||||
bSetEXIDevice.fill(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigCache::RestoreConfig(SConfig* config)
|
void ConfigCache::RestoreConfig(SConfig* config)
|
||||||
|
@ -129,18 +120,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
|
||||||
WiimoteCommon::SetSource(i, iWiimoteSource[i]);
|
WiimoteCommon::SetSource(i, iWiimoteSource[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
|
||||||
{
|
|
||||||
if (bSetPads[i])
|
|
||||||
config->m_SIDevice[i] = Pads[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ExpansionInterface::MAX_EXI_CHANNELS; ++i)
|
|
||||||
{
|
|
||||||
if (bSetEXIDevice[i])
|
|
||||||
config->m_EXIDevice[i] = m_EXIDevice[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConfigCache config_cache;
|
static ConfigCache config_cache;
|
||||||
|
@ -171,17 +150,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||||
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
|
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
|
||||||
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
|
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
|
||||||
{
|
|
||||||
int source;
|
|
||||||
controls_section->Get(fmt::format("PadType{}", i), &source, -1);
|
|
||||||
if (source >= SerialInterface::SIDEVICE_NONE && source < SerialInterface::SIDEVICE_COUNT)
|
|
||||||
{
|
|
||||||
StartUp.m_SIDevice[i] = static_cast<SerialInterface::SIDevices>(source);
|
|
||||||
config_cache.bSetPads[i] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wii settings
|
// Wii settings
|
||||||
if (StartUp.bWii)
|
if (StartUp.bWii)
|
||||||
{
|
{
|
||||||
|
@ -237,12 +205,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||||
Config::AddLayer(ConfigLoaders::GenerateNetPlayConfigLoader(netplay_settings));
|
Config::AddLayer(ConfigLoaders::GenerateNetPlayConfigLoader(netplay_settings));
|
||||||
StartUp.bCPUThread = netplay_settings.m_CPUthread;
|
StartUp.bCPUThread = netplay_settings.m_CPUthread;
|
||||||
StartUp.bCopyWiiSaveNetplay = netplay_settings.m_CopyWiiSave;
|
StartUp.bCopyWiiSaveNetplay = netplay_settings.m_CopyWiiSave;
|
||||||
StartUp.m_EXIDevice[0] = netplay_settings.m_EXIDevice[0];
|
|
||||||
StartUp.m_EXIDevice[1] = netplay_settings.m_EXIDevice[1];
|
|
||||||
StartUp.m_EXIDevice[2] = netplay_settings.m_EXIDevice[2];
|
|
||||||
config_cache.bSetEXIDevice[0] = true;
|
|
||||||
config_cache.bSetEXIDevice[1] = true;
|
|
||||||
config_cache.bSetEXIDevice[2] = true;
|
|
||||||
StartUp.bSyncGPU = netplay_settings.m_SyncGPU;
|
StartUp.bSyncGPU = netplay_settings.m_SyncGPU;
|
||||||
StartUp.iSyncGpuMaxDistance = netplay_settings.m_SyncGpuMaxDistance;
|
StartUp.iSyncGpuMaxDistance = netplay_settings.m_SyncGpuMaxDistance;
|
||||||
StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance;
|
StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance;
|
||||||
|
|
|
@ -54,20 +54,41 @@ const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE{
|
||||||
{System::Main, "Core", "GCIFolderAPathOverride"}, ""};
|
{System::Main, "Core", "GCIFolderAPathOverride"}, ""};
|
||||||
const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE{
|
const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE{
|
||||||
{System::Main, "Core", "GCIFolderBPathOverride"}, ""};
|
{System::Main, "Core", "GCIFolderBPathOverride"}, ""};
|
||||||
const Info<int> MAIN_SLOT_A{{System::Main, "Core", "SlotA"},
|
|
||||||
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER};
|
const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_A{
|
||||||
const Info<int> MAIN_SLOT_B{{System::Main, "Core", "SlotB"}, ExpansionInterface::EXIDEVICE_NONE};
|
{System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER};
|
||||||
const Info<int> MAIN_SERIAL_PORT_1{{System::Main, "Core", "SerialPort1"},
|
const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_B{{System::Main, "Core", "SlotB"},
|
||||||
ExpansionInterface::EXIDEVICE_NONE};
|
ExpansionInterface::EXIDEVICE_NONE};
|
||||||
|
const Info<ExpansionInterface::TEXIDevices> MAIN_SERIAL_PORT_1{
|
||||||
|
{System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDEVICE_NONE};
|
||||||
|
|
||||||
|
const Info<ExpansionInterface::TEXIDevices>& GetInfoForEXIDevice(int channel)
|
||||||
|
{
|
||||||
|
static constexpr std::array<const Info<ExpansionInterface::TEXIDevices>*, 3> infos{
|
||||||
|
&MAIN_SLOT_A,
|
||||||
|
&MAIN_SLOT_B,
|
||||||
|
&MAIN_SERIAL_PORT_1,
|
||||||
|
};
|
||||||
|
return *infos[channel];
|
||||||
|
}
|
||||||
|
|
||||||
const Info<std::string> MAIN_BBA_MAC{{System::Main, "Core", "BBA_MAC"}, ""};
|
const Info<std::string> MAIN_BBA_MAC{{System::Main, "Core", "BBA_MAC"}, ""};
|
||||||
const Info<std::string> MAIN_BBA_XLINK_IP{{System::Main, "Core", "BBA_XLINK_IP"}, "127.0.0.1"};
|
const Info<std::string> MAIN_BBA_XLINK_IP{{System::Main, "Core", "BBA_XLINK_IP"}, "127.0.0.1"};
|
||||||
const Info<bool> MAIN_BBA_XLINK_CHAT_OSD{{System::Main, "Core", "BBA_XLINK_CHAT_OSD"}, true};
|
const Info<bool> MAIN_BBA_XLINK_CHAT_OSD{{System::Main, "Core", "BBA_XLINK_CHAT_OSD"}, true};
|
||||||
|
|
||||||
Info<u32> GetInfoForSIDevice(u32 channel)
|
const Info<SerialInterface::SIDevices>& GetInfoForSIDevice(int channel)
|
||||||
{
|
{
|
||||||
return {{System::Main, "Core", fmt::format("SIDevice{}", channel)},
|
static const std::array<const Info<SerialInterface::SIDevices>, 4> infos{
|
||||||
static_cast<u32>(channel == 0 ? SerialInterface::SIDEVICE_GC_CONTROLLER :
|
Info<SerialInterface::SIDevices>{{System::Main, "Core", "SIDevice0"},
|
||||||
SerialInterface::SIDEVICE_NONE)};
|
SerialInterface::SIDEVICE_GC_CONTROLLER},
|
||||||
|
Info<SerialInterface::SIDevices>{{System::Main, "Core", "SIDevice1"},
|
||||||
|
SerialInterface::SIDEVICE_NONE},
|
||||||
|
Info<SerialInterface::SIDevices>{{System::Main, "Core", "SIDevice2"},
|
||||||
|
SerialInterface::SIDEVICE_NONE},
|
||||||
|
Info<SerialInterface::SIDevices>{{System::Main, "Core", "SIDevice3"},
|
||||||
|
SerialInterface::SIDEVICE_NONE},
|
||||||
|
};
|
||||||
|
return infos[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
const Info<bool>& GetInfoForAdapterRumble(int channel)
|
const Info<bool>& GetInfoForAdapterRumble(int channel)
|
||||||
|
|
|
@ -31,6 +31,16 @@ namespace AudioCommon
|
||||||
enum class DPL2Quality;
|
enum class DPL2Quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ExpansionInterface
|
||||||
|
{
|
||||||
|
enum TEXIDevices : int;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace SerialInterface
|
||||||
|
{
|
||||||
|
enum SIDevices : int;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Config
|
namespace Config
|
||||||
{
|
{
|
||||||
// Main.Core
|
// Main.Core
|
||||||
|
@ -59,13 +69,14 @@ extern const Info<std::string> MAIN_AGP_CART_A_PATH;
|
||||||
extern const Info<std::string> MAIN_AGP_CART_B_PATH;
|
extern const Info<std::string> MAIN_AGP_CART_B_PATH;
|
||||||
extern const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE;
|
extern const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE;
|
||||||
extern const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE;
|
extern const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE;
|
||||||
extern const Info<int> MAIN_SLOT_A;
|
extern const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_A;
|
||||||
extern const Info<int> MAIN_SLOT_B;
|
extern const Info<ExpansionInterface::TEXIDevices> MAIN_SLOT_B;
|
||||||
extern const Info<int> MAIN_SERIAL_PORT_1;
|
extern const Info<ExpansionInterface::TEXIDevices> MAIN_SERIAL_PORT_1;
|
||||||
|
const Info<ExpansionInterface::TEXIDevices>& GetInfoForEXIDevice(int channel);
|
||||||
extern const Info<std::string> MAIN_BBA_MAC;
|
extern const Info<std::string> MAIN_BBA_MAC;
|
||||||
extern const Info<std::string> MAIN_BBA_XLINK_IP;
|
extern const Info<std::string> MAIN_BBA_XLINK_IP;
|
||||||
extern const Info<bool> MAIN_BBA_XLINK_CHAT_OSD;
|
extern const Info<bool> MAIN_BBA_XLINK_CHAT_OSD;
|
||||||
Info<u32> GetInfoForSIDevice(u32 channel);
|
const Info<SerialInterface::SIDevices>& GetInfoForSIDevice(int channel);
|
||||||
const Info<bool>& GetInfoForAdapterRumble(int channel);
|
const Info<bool>& GetInfoForAdapterRumble(int channel);
|
||||||
const Info<bool>& GetInfoForSimulateKonga(int channel);
|
const Info<bool>& GetInfoForSimulateKonga(int channel);
|
||||||
extern const Info<bool> MAIN_WII_SD_CARD;
|
extern const Info<bool> MAIN_WII_SD_CARD;
|
||||||
|
|
|
@ -75,6 +75,10 @@ static const INIToLocationMap& GetINIToLocationMap()
|
||||||
{{"Wii", "Language"}, {Config::SYSCONF_LANGUAGE.GetLocation()}},
|
{{"Wii", "Language"}, {Config::SYSCONF_LANGUAGE.GetLocation()}},
|
||||||
{{"Core", "HLE_BS2"}, {Config::MAIN_SKIP_IPL.GetLocation()}},
|
{{"Core", "HLE_BS2"}, {Config::MAIN_SKIP_IPL.GetLocation()}},
|
||||||
{{"Core", "GameCubeLanguage"}, {Config::MAIN_GC_LANGUAGE.GetLocation()}},
|
{{"Core", "GameCubeLanguage"}, {Config::MAIN_GC_LANGUAGE.GetLocation()}},
|
||||||
|
{{"Core", "PadType0"}, {Config::GetInfoForSIDevice(0).GetLocation()}},
|
||||||
|
{{"Core", "PadType1"}, {Config::GetInfoForSIDevice(1).GetLocation()}},
|
||||||
|
{{"Core", "PadType2"}, {Config::GetInfoForSIDevice(2).GetLocation()}},
|
||||||
|
{{"Core", "PadType3"}, {Config::GetInfoForSIDevice(3).GetLocation()}},
|
||||||
};
|
};
|
||||||
return ini_to_location;
|
return ini_to_location;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,13 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
||||||
&Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING.GetLocation(),
|
&Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING.GetLocation(),
|
||||||
&Config::MAIN_WIIMOTE_ENABLE_SPEAKER.GetLocation(),
|
&Config::MAIN_WIIMOTE_ENABLE_SPEAKER.GetLocation(),
|
||||||
&Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE.GetLocation(),
|
&Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE.GetLocation(),
|
||||||
|
&Config::MAIN_SLOT_A.GetLocation(),
|
||||||
|
&Config::MAIN_SLOT_B.GetLocation(),
|
||||||
|
&Config::MAIN_SERIAL_PORT_1.GetLocation(),
|
||||||
|
&Config::GetInfoForSIDevice(0).GetLocation(),
|
||||||
|
&Config::GetInfoForSIDevice(1).GetLocation(),
|
||||||
|
&Config::GetInfoForSIDevice(2).GetLocation(),
|
||||||
|
&Config::GetInfoForSIDevice(3).GetLocation(),
|
||||||
|
|
||||||
// UI.General
|
// UI.General
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ public:
|
||||||
layer->Set(Config::MAIN_DSP_HLE, m_settings.m_DSPHLE);
|
layer->Set(Config::MAIN_DSP_HLE, m_settings.m_DSPHLE);
|
||||||
layer->Set(Config::MAIN_OVERCLOCK_ENABLE, m_settings.m_OCEnable);
|
layer->Set(Config::MAIN_OVERCLOCK_ENABLE, m_settings.m_OCEnable);
|
||||||
layer->Set(Config::MAIN_OVERCLOCK, m_settings.m_OCFactor);
|
layer->Set(Config::MAIN_OVERCLOCK, m_settings.m_OCFactor);
|
||||||
layer->Set(Config::MAIN_SLOT_A, static_cast<int>(m_settings.m_EXIDevice[0]));
|
layer->Set(Config::MAIN_SLOT_A, m_settings.m_EXIDevice[0]);
|
||||||
layer->Set(Config::MAIN_SLOT_B, static_cast<int>(m_settings.m_EXIDevice[1]));
|
layer->Set(Config::MAIN_SLOT_B, m_settings.m_EXIDevice[1]);
|
||||||
layer->Set(Config::MAIN_SERIAL_PORT_1, static_cast<int>(m_settings.m_EXIDevice[2]));
|
layer->Set(Config::MAIN_SERIAL_PORT_1, m_settings.m_EXIDevice[2]);
|
||||||
layer->Set(Config::SESSION_SAVE_DATA_WRITABLE, m_settings.m_WriteToMemcard);
|
layer->Set(Config::SESSION_SAVE_DATA_WRITABLE, m_settings.m_WriteToMemcard);
|
||||||
layer->Set(Config::MAIN_RAM_OVERRIDE_ENABLE, m_settings.m_RAMOverrideEnable);
|
layer->Set(Config::MAIN_RAM_OVERRIDE_ENABLE, m_settings.m_RAMOverrideEnable);
|
||||||
layer->Set(Config::MAIN_MEM1_SIZE, m_settings.m_Mem1Size);
|
layer->Set(Config::MAIN_MEM1_SIZE, m_settings.m_Mem1Size);
|
||||||
|
|
|
@ -104,13 +104,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||||
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
|
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
|
||||||
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
|
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
|
||||||
core->Set("SyncGpuOverclock", fSyncGpuOverclock);
|
core->Set("SyncGpuOverclock", fSyncGpuOverclock);
|
||||||
core->Set("SlotA", m_EXIDevice[0]);
|
|
||||||
core->Set("SlotB", m_EXIDevice[1]);
|
|
||||||
core->Set("SerialPort1", m_EXIDevice[2]);
|
|
||||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
|
||||||
{
|
|
||||||
core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]);
|
|
||||||
}
|
|
||||||
core->Set("MMU", bMMU);
|
core->Set("MMU", bMMU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,14 +123,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||||
IniFile::Section* core = ini.GetOrCreateSection("Core");
|
IniFile::Section* core = ini.GetOrCreateSection("Core");
|
||||||
|
|
||||||
core->Get("CPUThread", &bCPUThread, true);
|
core->Get("CPUThread", &bCPUThread, true);
|
||||||
core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
|
|
||||||
core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE);
|
|
||||||
core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE);
|
|
||||||
for (size_t i = 0; i < std::size(m_SIDevice); ++i)
|
|
||||||
{
|
|
||||||
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
|
|
||||||
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
|
|
||||||
}
|
|
||||||
core->Get("MMU", &bMMU, bMMU);
|
core->Get("MMU", &bMMU, bMMU);
|
||||||
core->Get("BBDumpPort", &iBBDumpPort, -1);
|
core->Get("BBDumpPort", &iBBDumpPort, -1);
|
||||||
core->Get("SyncGPU", &bSyncGPU, false);
|
core->Get("SyncGPU", &bSyncGPU, false);
|
||||||
|
|
|
@ -114,9 +114,6 @@ struct SConfig
|
||||||
static IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
|
static IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
|
||||||
static IniFile LoadGameIni(const std::string& id, std::optional<u16> revision);
|
static IniFile LoadGameIni(const std::string& id, std::optional<u16> revision);
|
||||||
|
|
||||||
ExpansionInterface::TEXIDevices m_EXIDevice[3];
|
|
||||||
SerialInterface::SIDevices m_SIDevice[4];
|
|
||||||
|
|
||||||
SConfig(const SConfig&) = delete;
|
SConfig(const SConfig&) = delete;
|
||||||
SConfig& operator=(const SConfig&) = delete;
|
SConfig& operator=(const SConfig&) = delete;
|
||||||
SConfig(SConfig&&) = delete;
|
SConfig(SConfig&&) = delete;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/IniFile.h"
|
#include "Common/IniFile.h"
|
||||||
|
|
||||||
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/EXI/EXI_Channel.h"
|
#include "Core/HW/EXI/EXI_Channel.h"
|
||||||
|
@ -45,7 +46,7 @@ void AddMemoryCards(int i)
|
||||||
{
|
{
|
||||||
if (Movie::IsUsingMemcard(i))
|
if (Movie::IsUsingMemcard(i))
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_EXIDevice[i] == EXIDEVICE_MEMORYCARDFOLDER)
|
if (Config::Get(Config::GetInfoForEXIDevice(i)) == EXIDEVICE_MEMORYCARDFOLDER)
|
||||||
memorycard_device = EXIDEVICE_MEMORYCARDFOLDER;
|
memorycard_device = EXIDEVICE_MEMORYCARDFOLDER;
|
||||||
else
|
else
|
||||||
memorycard_device = EXIDEVICE_MEMORYCARD;
|
memorycard_device = EXIDEVICE_MEMORYCARD;
|
||||||
|
@ -57,7 +58,7 @@ void AddMemoryCards(int i)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memorycard_device = SConfig::GetInstance().m_EXIDevice[i];
|
memorycard_device = Config::Get(Config::GetInfoForEXIDevice(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Channels[i]->AddDevice(memorycard_device, 0);
|
g_Channels[i]->AddDevice(memorycard_device, 0);
|
||||||
|
@ -101,7 +102,7 @@ void Init()
|
||||||
AddMemoryCards(i);
|
AddMemoryCards(i);
|
||||||
|
|
||||||
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
|
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
|
||||||
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
|
g_Channels[0]->AddDevice(Config::Get(Config::MAIN_SERIAL_PORT_1), 2);
|
||||||
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
|
g_Channels[2]->AddDevice(EXIDEVICE_AD16, 0);
|
||||||
|
|
||||||
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
|
changeDevice = CoreTiming::RegisterEvent("ChangeEXIDevice", ChangeDeviceCallback);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/Swap.h"
|
#include "Common/Swap.h"
|
||||||
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/MMIO.h"
|
#include "Core/HW/MMIO.h"
|
||||||
|
@ -411,7 +412,7 @@ void Init()
|
||||||
}
|
}
|
||||||
else if (Movie::IsUsingPad(i))
|
else if (Movie::IsUsingPad(i))
|
||||||
{
|
{
|
||||||
SIDevices current = SConfig::GetInstance().m_SIDevice[i];
|
SIDevices current = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
// GC pad-compatible devices can be used for both playing and recording
|
// GC pad-compatible devices can be used for both playing and recording
|
||||||
if (Movie::IsUsingBongo(i))
|
if (Movie::IsUsingBongo(i))
|
||||||
s_desired_device_types[i] = SIDEVICE_GC_TARUKONGA;
|
s_desired_device_types[i] = SIDEVICE_GC_TARUKONGA;
|
||||||
|
@ -423,7 +424,7 @@ void Init()
|
||||||
}
|
}
|
||||||
else if (!NetPlay::IsNetPlayRunning())
|
else if (!NetPlay::IsNetPlayRunning())
|
||||||
{
|
{
|
||||||
s_desired_device_types[i] = SConfig::GetInstance().m_SIDevice[i];
|
s_desired_device_types[i] = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDevice(s_desired_device_types[i], i);
|
AddDevice(s_desired_device_types[i], i);
|
||||||
|
|
|
@ -81,9 +81,8 @@ bool CSIDevice_GCAdapter::GetData(u32& hi, u32& low)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSIDevice_GCController::Rumble(int pad_num, ControlState strength)
|
void CSIDevice_GCController::Rumble(int pad_num, ControlState strength, SIDevices device)
|
||||||
{
|
{
|
||||||
SIDevices device = SConfig::GetInstance().m_SIDevice[pad_num];
|
|
||||||
if (device == SIDEVICE_WIIU_ADAPTER)
|
if (device == SIDEVICE_WIIU_ADAPTER)
|
||||||
GCAdapter::Output(pad_num, static_cast<u8>(strength));
|
GCAdapter::Output(pad_num, static_cast<u8>(strength));
|
||||||
else if (SIDevice_IsGCController(device))
|
else if (SIDevice_IsGCController(device))
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Common/Swap.h"
|
#include "Common/Swap.h"
|
||||||
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/GCPad.h"
|
#include "Core/HW/GCPad.h"
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
|
@ -33,6 +34,14 @@ CSIDevice_GCController::CSIDevice_GCController(SIDevices device, int device_numb
|
||||||
m_origin.origin_stick_y = GCPadStatus::MAIN_STICK_CENTER_Y;
|
m_origin.origin_stick_y = GCPadStatus::MAIN_STICK_CENTER_Y;
|
||||||
m_origin.substick_x = GCPadStatus::C_STICK_CENTER_X;
|
m_origin.substick_x = GCPadStatus::C_STICK_CENTER_X;
|
||||||
m_origin.substick_y = GCPadStatus::C_STICK_CENTER_Y;
|
m_origin.substick_y = GCPadStatus::C_STICK_CENTER_Y;
|
||||||
|
|
||||||
|
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
|
||||||
|
RefreshConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSIDevice_GCController::~CSIDevice_GCController()
|
||||||
|
{
|
||||||
|
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSIDevice_GCController::RunBuffer(u8* buffer, int request_length)
|
int CSIDevice_GCController::RunBuffer(u8* buffer, int request_length)
|
||||||
|
@ -299,10 +308,11 @@ void CSIDevice_GCController::SendCommand(u32 command, u8 poll)
|
||||||
|
|
||||||
if (pad_num < 4)
|
if (pad_num < 4)
|
||||||
{
|
{
|
||||||
|
const SIDevices device = m_config_si_devices[pad_num];
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
CSIDevice_GCController::Rumble(pad_num, 1.0);
|
CSIDevice_GCController::Rumble(pad_num, 1.0, device);
|
||||||
else
|
else
|
||||||
CSIDevice_GCController::Rumble(pad_num, 0.0);
|
CSIDevice_GCController::Rumble(pad_num, 0.0, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poll == 0)
|
if (poll == 0)
|
||||||
|
@ -328,6 +338,15 @@ void CSIDevice_GCController::DoState(PointerWrap& p)
|
||||||
p.Do(m_last_button_combo);
|
p.Do(m_last_button_combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSIDevice_GCController::RefreshConfig()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
const SerialInterface::SIDevices device = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
|
m_config_si_devices[i] = device;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CSIDevice_TaruKonga::CSIDevice_TaruKonga(SIDevices device, int device_number)
|
CSIDevice_TaruKonga::CSIDevice_TaruKonga(SIDevices device, int device_number)
|
||||||
: CSIDevice_GCController(device, device_number)
|
: CSIDevice_GCController(device, device_number)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "Core/HW/GCPad.h"
|
#include "Core/HW/GCPad.h"
|
||||||
#include "Core/HW/SI/SI_Device.h"
|
#include "Core/HW/SI/SI_Device.h"
|
||||||
#include "InputCommon/GCPadStatus.h"
|
#include "InputCommon/GCPadStatus.h"
|
||||||
|
@ -52,6 +54,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
CSIDevice_GCController(SIDevices device, int device_number);
|
CSIDevice_GCController(SIDevices device, int device_number);
|
||||||
|
~CSIDevice_GCController() override;
|
||||||
|
|
||||||
// Run the SI Buffer
|
// Run the SI Buffer
|
||||||
int RunBuffer(u8* buffer, int request_length) override;
|
int RunBuffer(u8* buffer, int request_length) override;
|
||||||
|
@ -74,12 +77,18 @@ public:
|
||||||
static int NetPlay_InGamePadToLocalPad(int pad_num);
|
static int NetPlay_InGamePadToLocalPad(int pad_num);
|
||||||
|
|
||||||
// Direct rumble to the right GC Controller
|
// Direct rumble to the right GC Controller
|
||||||
static void Rumble(int pad_num, ControlState strength);
|
static void Rumble(int pad_num, ControlState strength, SIDevices device);
|
||||||
|
|
||||||
static void HandleMoviePadStatus(int device_number, GCPadStatus* pad_status);
|
static void HandleMoviePadStatus(int device_number, GCPadStatus* pad_status);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetOrigin(const GCPadStatus& pad_status);
|
void SetOrigin(const GCPadStatus& pad_status);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void RefreshConfig();
|
||||||
|
|
||||||
|
std::array<SIDevices, 4> m_config_si_devices{};
|
||||||
|
size_t m_config_changed_callback_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
// "TaruKonga", the DK Bongo controller
|
// "TaruKonga", the DK Bongo controller
|
||||||
|
|
|
@ -453,9 +453,10 @@ void ChangePads()
|
||||||
|
|
||||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_SIDevice[i] == SerialInterface::SIDEVICE_GC_GBA_EMULATED)
|
const SerialInterface::SIDevices si_device = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
|
if (si_device == SerialInterface::SIDEVICE_GC_GBA_EMULATED)
|
||||||
controllers[i] = ControllerType::GBA;
|
controllers[i] = ControllerType::GBA;
|
||||||
else if (SerialInterface::SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
|
else if (SerialInterface::SIDevice_IsGCController(si_device))
|
||||||
controllers[i] = ControllerType::GC;
|
controllers[i] = ControllerType::GC;
|
||||||
else
|
else
|
||||||
controllers[i] = ControllerType::None;
|
controllers[i] = ControllerType::None;
|
||||||
|
@ -473,9 +474,10 @@ void ChangePads()
|
||||||
}
|
}
|
||||||
else if (IsUsingPad(i))
|
else if (IsUsingPad(i))
|
||||||
{
|
{
|
||||||
if (SerialInterface::SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
|
const SerialInterface::SIDevices si_device = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
|
if (SerialInterface::SIDevice_IsGCController(si_device))
|
||||||
{
|
{
|
||||||
device = SConfig::GetInstance().m_SIDevice[i];
|
device = si_device;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -548,7 +550,8 @@ bool BeginRecordingInput(const ControllerTypeArray& controllers,
|
||||||
|
|
||||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_SIDevice[i] == SerialInterface::SIDEVICE_GC_TARUKONGA)
|
const SerialInterface::SIDevices si_device = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
|
if (si_device == SerialInterface::SIDEVICE_GC_TARUKONGA)
|
||||||
s_bongos |= (1 << i);
|
s_bongos |= (1 << i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1435,14 +1438,12 @@ void SetGraphicsConfig()
|
||||||
// NOTE: EmuThread / Host Thread
|
// NOTE: EmuThread / Host Thread
|
||||||
void GetSettings()
|
void GetSettings()
|
||||||
{
|
{
|
||||||
const bool slot_a_has_raw_memcard =
|
const ExpansionInterface::TEXIDevices slot_a_type = Config::Get(Config::MAIN_SLOT_A);
|
||||||
SConfig::GetInstance().m_EXIDevice[0] == ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
const ExpansionInterface::TEXIDevices slot_b_type = Config::Get(Config::MAIN_SLOT_B);
|
||||||
const bool slot_a_has_gci_folder =
|
const bool slot_a_has_raw_memcard = slot_a_type == ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
||||||
SConfig::GetInstance().m_EXIDevice[0] == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER;
|
const bool slot_a_has_gci_folder = slot_a_type == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER;
|
||||||
const bool slot_b_has_raw_memcard =
|
const bool slot_b_has_raw_memcard = slot_b_type == ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
||||||
SConfig::GetInstance().m_EXIDevice[1] == ExpansionInterface::EXIDEVICE_MEMORYCARD;
|
const bool slot_b_has_gci_folder = slot_b_type == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER;
|
||||||
const bool slot_b_has_gci_folder =
|
|
||||||
SConfig::GetInstance().m_EXIDevice[1] == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER;
|
|
||||||
|
|
||||||
s_bSaveConfig = true;
|
s_bSaveConfig = true;
|
||||||
s_bNetPlay = NetPlay::IsNetPlayRunning();
|
s_bNetPlay = NetPlay::IsNetPlayRunning();
|
||||||
|
|
|
@ -1838,11 +1838,13 @@ void NetPlayClient::UpdateDevices()
|
||||||
else if (player_id == m_local_player->pid)
|
else if (player_id == m_local_player->pid)
|
||||||
{
|
{
|
||||||
// Use local controller types for local controllers if they are compatible
|
// Use local controller types for local controllers if they are compatible
|
||||||
if (SerialInterface::SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[local_pad]))
|
const SerialInterface::SIDevices si_device =
|
||||||
|
Config::Get(Config::GetInfoForSIDevice(local_pad));
|
||||||
|
if (SerialInterface::SIDevice_IsGCController(si_device))
|
||||||
{
|
{
|
||||||
SerialInterface::ChangeDevice(SConfig::GetInstance().m_SIDevice[local_pad], pad);
|
SerialInterface::ChangeDevice(si_device, pad);
|
||||||
|
|
||||||
if (SConfig::GetInstance().m_SIDevice[local_pad] == SerialInterface::SIDEVICE_WIIU_ADAPTER)
|
if (si_device == SerialInterface::SIDEVICE_WIIU_ADAPTER)
|
||||||
{
|
{
|
||||||
GCAdapter::ResetDeviceType(local_pad);
|
GCAdapter::ResetDeviceType(local_pad);
|
||||||
}
|
}
|
||||||
|
@ -2161,7 +2163,8 @@ bool NetPlayClient::PollLocalPad(const int local_pad, sf::Packet& packet)
|
||||||
{
|
{
|
||||||
pad_status = Pad::GetGBAStatus(local_pad);
|
pad_status = Pad::GetGBAStatus(local_pad);
|
||||||
}
|
}
|
||||||
else if (SConfig::GetInstance().m_SIDevice[local_pad] == SerialInterface::SIDEVICE_WIIU_ADAPTER)
|
else if (Config::Get(Config::GetInfoForSIDevice(local_pad)) ==
|
||||||
|
SerialInterface::SIDEVICE_WIIU_ADAPTER)
|
||||||
{
|
{
|
||||||
pad_status = GCAdapter::Input(local_pad);
|
pad_status = GCAdapter::Input(local_pad);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1307,10 +1307,8 @@ bool NetPlayServer::SetupNetSettings()
|
||||||
settings.m_CopyWiiSave = Config::Get(Config::NETPLAY_LOAD_WII_SAVE);
|
settings.m_CopyWiiSave = Config::Get(Config::NETPLAY_LOAD_WII_SAVE);
|
||||||
settings.m_OCEnable = Config::Get(Config::MAIN_OVERCLOCK_ENABLE);
|
settings.m_OCEnable = Config::Get(Config::MAIN_OVERCLOCK_ENABLE);
|
||||||
settings.m_OCFactor = Config::Get(Config::MAIN_OVERCLOCK);
|
settings.m_OCFactor = Config::Get(Config::MAIN_OVERCLOCK);
|
||||||
settings.m_EXIDevice[0] =
|
settings.m_EXIDevice[0] = Config::Get(Config::MAIN_SLOT_A);
|
||||||
static_cast<ExpansionInterface::TEXIDevices>(Config::Get(Config::MAIN_SLOT_A));
|
settings.m_EXIDevice[1] = Config::Get(Config::MAIN_SLOT_B);
|
||||||
settings.m_EXIDevice[1] =
|
|
||||||
static_cast<ExpansionInterface::TEXIDevices>(Config::Get(Config::MAIN_SLOT_B));
|
|
||||||
// There's no way the BBA is going to sync, disable it
|
// There's no way the BBA is going to sync, disable it
|
||||||
settings.m_EXIDevice[2] = ExpansionInterface::EXIDEVICE_NONE;
|
settings.m_EXIDevice[2] = ExpansionInterface::EXIDEVICE_NONE;
|
||||||
|
|
||||||
|
@ -1595,11 +1593,12 @@ bool NetPlayServer::SyncSaveData()
|
||||||
|
|
||||||
u8 save_count = 0;
|
u8 save_count = 0;
|
||||||
|
|
||||||
constexpr size_t exi_device_count = 2;
|
constexpr int exi_device_count = 2;
|
||||||
for (size_t i = 0; i < exi_device_count; i++)
|
for (int i = 0; i < exi_device_count; ++i)
|
||||||
{
|
{
|
||||||
if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARD ||
|
if (m_settings.m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARD ||
|
||||||
SConfig::GetInstance().m_EXIDevice[i] == ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER)
|
Config::Get(Config::GetInfoForEXIDevice(i)) ==
|
||||||
|
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER)
|
||||||
{
|
{
|
||||||
save_count++;
|
save_count++;
|
||||||
}
|
}
|
||||||
|
@ -1654,7 +1653,7 @@ bool NetPlayServer::SyncSaveData()
|
||||||
const std::string region =
|
const std::string region =
|
||||||
SConfig::GetDirectoryForRegion(SConfig::ToGameCubeRegion(game->GetRegion()));
|
SConfig::GetDirectoryForRegion(SConfig::ToGameCubeRegion(game->GetRegion()));
|
||||||
|
|
||||||
for (size_t i = 0; i < exi_device_count; i++)
|
for (int i = 0; i < exi_device_count; ++i)
|
||||||
{
|
{
|
||||||
const bool is_slot_a = i == 0;
|
const bool is_slot_a = i == 0;
|
||||||
|
|
||||||
|
@ -1695,7 +1694,7 @@ bool NetPlayServer::SyncSaveData()
|
||||||
SendChunkedToClients(std::move(pac), 1,
|
SendChunkedToClients(std::move(pac), 1,
|
||||||
fmt::format("Memory Card {} Synchronization", is_slot_a ? 'A' : 'B'));
|
fmt::format("Memory Card {} Synchronization", is_slot_a ? 'A' : 'B'));
|
||||||
}
|
}
|
||||||
else if (SConfig::GetInstance().m_EXIDevice[i] ==
|
else if (Config::Get(Config::GetInfoForEXIDevice(i)) ==
|
||||||
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER)
|
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER)
|
||||||
{
|
{
|
||||||
const std::string path = File::GetUserPath(D_GCUSER_IDX) + region + DIR_SEP +
|
const std::string path = File::GetUserPath(D_GCUSER_IDX) + region + DIR_SEP +
|
||||||
|
|
|
@ -178,7 +178,8 @@ void GamecubeControllersWidget::LoadSettings()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_gc_groups.size(); i++)
|
for (size_t i = 0; i < m_gc_groups.size(); i++)
|
||||||
{
|
{
|
||||||
const SerialInterface::SIDevices si_device = SConfig::GetInstance().m_SIDevice[i];
|
const SerialInterface::SIDevices si_device =
|
||||||
|
Config::Get(Config::GetInfoForSIDevice(static_cast<int>(i)));
|
||||||
const std::optional<int> gc_index = ToGCMenuIndex(si_device);
|
const std::optional<int> gc_index = ToGCMenuIndex(si_device);
|
||||||
if (gc_index)
|
if (gc_index)
|
||||||
{
|
{
|
||||||
|
@ -194,7 +195,7 @@ void GamecubeControllersWidget::SaveSettings()
|
||||||
{
|
{
|
||||||
const int index = m_gc_controller_boxes[i]->currentIndex();
|
const int index = m_gc_controller_boxes[i]->currentIndex();
|
||||||
const SerialInterface::SIDevices si_device = FromGCMenuIndex(index);
|
const SerialInterface::SIDevices si_device = FromGCMenuIndex(index);
|
||||||
SConfig::GetInstance().m_SIDevice[i] = si_device;
|
Config::SetBaseOrCurrent(Config::GetInfoForSIDevice(static_cast<int>(i)), si_device);
|
||||||
|
|
||||||
if (Core::IsRunning())
|
if (Core::IsRunning())
|
||||||
SerialInterface::ChangeDevice(si_device, static_cast<s32>(i));
|
SerialInterface::ChangeDevice(si_device, static_cast<s32>(i));
|
||||||
|
|
|
@ -664,7 +664,9 @@ void GameList::OpenGCSaveFolder()
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
QUrl url;
|
QUrl url;
|
||||||
switch (SConfig::GetInstance().m_EXIDevice[i])
|
const ExpansionInterface::TEXIDevices current_exi_device =
|
||||||
|
Config::Get(Config::GetInfoForEXIDevice(i));
|
||||||
|
switch (current_exi_device)
|
||||||
{
|
{
|
||||||
case ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER:
|
case ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1728,9 +1728,10 @@ void MainWindow::OnStartRecording()
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_SIDevice[i] == SerialInterface::SIDEVICE_GC_GBA_EMULATED)
|
const SerialInterface::SIDevices si_device = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
|
if (si_device == SerialInterface::SIDEVICE_GC_GBA_EMULATED)
|
||||||
controllers[i] = Movie::ControllerType::GBA;
|
controllers[i] = Movie::ControllerType::GBA;
|
||||||
else if (SerialInterface::SIDevice_IsGCController(SConfig::GetInstance().m_SIDevice[i]))
|
else if (SerialInterface::SIDevice_IsGCController(si_device))
|
||||||
controllers[i] = Movie::ControllerType::GC;
|
controllers[i] = Movie::ControllerType::GC;
|
||||||
else
|
else
|
||||||
controllers[i] = Movie::ControllerType::None;
|
controllers[i] = Movie::ControllerType::None;
|
||||||
|
@ -1782,8 +1783,9 @@ void MainWindow::ShowTASInput()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num_gc_controllers; i++)
|
for (int i = 0; i < num_gc_controllers; i++)
|
||||||
{
|
{
|
||||||
if (SConfig::GetInstance().m_SIDevice[i] != SerialInterface::SIDEVICE_NONE &&
|
const auto si_device = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
SConfig::GetInstance().m_SIDevice[i] != SerialInterface::SIDEVICE_GC_GBA)
|
if (si_device != SerialInterface::SIDEVICE_NONE &&
|
||||||
|
si_device != SerialInterface::SIDEVICE_GC_GBA)
|
||||||
{
|
{
|
||||||
m_gc_tas_input_windows[i]->show();
|
m_gc_tas_input_windows[i]->show();
|
||||||
m_gc_tas_input_windows[i]->raise();
|
m_gc_tas_input_windows[i]->raise();
|
||||||
|
|
|
@ -458,8 +458,8 @@ void GameCubePane::LoadSettings()
|
||||||
for (int i = 0; i < SLOT_COUNT; i++)
|
for (int i = 0; i < SLOT_COUNT; i++)
|
||||||
{
|
{
|
||||||
QSignalBlocker blocker(m_slot_combos[i]);
|
QSignalBlocker blocker(m_slot_combos[i]);
|
||||||
m_slot_combos[i]->setCurrentIndex(
|
const ExpansionInterface::TEXIDevices exi_device = Config::Get(Config::GetInfoForEXIDevice(i));
|
||||||
m_slot_combos[i]->findData(SConfig::GetInstance().m_EXIDevice[i]));
|
m_slot_combos[i]->setCurrentIndex(m_slot_combos[i]->findData(exi_device));
|
||||||
UpdateButton(i);
|
UpdateButton(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,8 +486,10 @@ void GameCubePane::SaveSettings()
|
||||||
for (int i = 0; i < SLOT_COUNT; i++)
|
for (int i = 0; i < SLOT_COUNT; i++)
|
||||||
{
|
{
|
||||||
const auto dev = ExpansionInterface::TEXIDevices(m_slot_combos[i]->currentData().toInt());
|
const auto dev = ExpansionInterface::TEXIDevices(m_slot_combos[i]->currentData().toInt());
|
||||||
|
const ExpansionInterface::TEXIDevices current_exi_device =
|
||||||
|
Config::Get(Config::GetInfoForEXIDevice(i));
|
||||||
|
|
||||||
if (Core::IsRunning() && SConfig::GetInstance().m_EXIDevice[i] != dev)
|
if (Core::IsRunning() && current_exi_device != dev)
|
||||||
{
|
{
|
||||||
ExpansionInterface::ChangeDevice(
|
ExpansionInterface::ChangeDevice(
|
||||||
// SlotB is on channel 1, slotA and SP1 are on 0
|
// SlotB is on channel 1, slotA and SP1 are on 0
|
||||||
|
@ -498,19 +500,7 @@ void GameCubePane::SaveSettings()
|
||||||
(i == 2) ? 2 : 0);
|
(i == 2) ? 2 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SConfig::GetInstance().m_EXIDevice[i] = dev;
|
Config::SetBaseOrCurrent(Config::GetInfoForEXIDevice(i), dev);
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case SLOT_A_INDEX:
|
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_SLOT_A, dev);
|
|
||||||
break;
|
|
||||||
case SLOT_B_INDEX:
|
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_SLOT_B, dev);
|
|
||||||
break;
|
|
||||||
case SLOT_SP1_INDEX:
|
|
||||||
Config::SetBaseOrCurrent(Config::MAIN_SERIAL_PORT_1, dev);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_LIBMGBA
|
#ifdef HAS_LIBMGBA
|
||||||
|
|
|
@ -83,6 +83,8 @@ static u8 s_endpoint_out = 0;
|
||||||
static u64 s_last_init = 0;
|
static u64 s_last_init = 0;
|
||||||
|
|
||||||
static std::optional<size_t> s_config_callback_id = std::nullopt;
|
static std::optional<size_t> s_config_callback_id = std::nullopt;
|
||||||
|
static std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS>
|
||||||
|
s_config_si_device_type{};
|
||||||
static std::array<bool, SerialInterface::MAX_SI_CHANNELS> s_config_rumble_enabled{};
|
static std::array<bool, SerialInterface::MAX_SI_CHANNELS> s_config_rumble_enabled{};
|
||||||
|
|
||||||
static void Read()
|
static void Read()
|
||||||
|
@ -205,8 +207,11 @@ void SetAdapterCallback(std::function<void()> func)
|
||||||
static void RefreshConfig()
|
static void RefreshConfig()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
||||||
|
{
|
||||||
|
s_config_si_device_type[i] = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
s_config_rumble_enabled[i] = Config::Get(Config::GetInfoForAdapterRumble(i));
|
s_config_rumble_enabled[i] = Config::Get(Config::GetInfoForAdapterRumble(i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
|
@ -542,9 +547,8 @@ void ResetDeviceType(int chan)
|
||||||
|
|
||||||
bool UseAdapter()
|
bool UseAdapter()
|
||||||
{
|
{
|
||||||
const auto& si_devices = SConfig::GetInstance().m_SIDevice;
|
const auto& si_devices = s_config_si_device_type;
|
||||||
|
return std::any_of(si_devices.begin(), si_devices.end(), [](const auto device_type) {
|
||||||
return std::any_of(std::begin(si_devices), std::end(si_devices), [](const auto device_type) {
|
|
||||||
return device_type == SerialInterface::SIDEVICE_WIIU_ADAPTER;
|
return device_type == SerialInterface::SIDEVICE_WIIU_ADAPTER;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "Common/Flag.h"
|
#include "Common/Flag.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/Thread.h"
|
#include "Common/Thread.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "Core/HW/SI/SI.h"
|
#include "Core/HW/SI/SI.h"
|
||||||
|
@ -61,6 +61,16 @@ static Common::Flag s_adapter_detect_thread_running;
|
||||||
|
|
||||||
static u64 s_last_init = 0;
|
static u64 s_last_init = 0;
|
||||||
|
|
||||||
|
static std::optional<size_t> s_config_callback_id = std::nullopt;
|
||||||
|
static std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS>
|
||||||
|
s_config_si_device_type{};
|
||||||
|
|
||||||
|
static void RefreshConfig()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
||||||
|
s_config_si_device_type[i] = Config::Get(Config::GetInfoForSIDevice(i));
|
||||||
|
}
|
||||||
|
|
||||||
static void ScanThreadFunc()
|
static void ScanThreadFunc()
|
||||||
{
|
{
|
||||||
Common::SetCurrentThreadName("GC Adapter Scanning Thread");
|
Common::SetCurrentThreadName("GC Adapter Scanning Thread");
|
||||||
|
@ -200,6 +210,10 @@ void Init()
|
||||||
jclass adapter_class = env->FindClass("org/dolphinemu/dolphinemu/utils/Java_GCAdapter");
|
jclass adapter_class = env->FindClass("org/dolphinemu/dolphinemu/utils/Java_GCAdapter");
|
||||||
s_adapter_class = reinterpret_cast<jclass>(env->NewGlobalRef(adapter_class));
|
s_adapter_class = reinterpret_cast<jclass>(env->NewGlobalRef(adapter_class));
|
||||||
|
|
||||||
|
if (!s_config_callback_id)
|
||||||
|
s_config_callback_id = Config::AddConfigChangedCallback(RefreshConfig);
|
||||||
|
RefreshConfig();
|
||||||
|
|
||||||
if (UseAdapter())
|
if (UseAdapter())
|
||||||
StartScanThread();
|
StartScanThread();
|
||||||
}
|
}
|
||||||
|
@ -236,6 +250,12 @@ void Shutdown()
|
||||||
{
|
{
|
||||||
StopScanThread();
|
StopScanThread();
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
|
if (s_config_callback_id)
|
||||||
|
{
|
||||||
|
Config::RemoveConfigChangedCallback(*s_config_callback_id);
|
||||||
|
s_config_callback_id = std::nullopt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartScanThread()
|
void StartScanThread()
|
||||||
|
@ -376,8 +396,7 @@ void ResetDeviceType(int chan)
|
||||||
|
|
||||||
bool UseAdapter()
|
bool UseAdapter()
|
||||||
{
|
{
|
||||||
const auto& si_devices = SConfig::GetInstance().m_SIDevice;
|
const auto& si_devices = s_config_si_device_type;
|
||||||
|
|
||||||
return std::any_of(std::begin(si_devices), std::end(si_devices), [](const auto device_type) {
|
return std::any_of(std::begin(si_devices), std::end(si_devices), [](const auto device_type) {
|
||||||
return device_type == SerialInterface::SIDEVICE_WIIU_ADAPTER;
|
return device_type == SerialInterface::SIDEVICE_WIIU_ADAPTER;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue