Port Wiimote source settings to the new config system
This lets us finally get rid of BootManager's ConfigCache!
This commit is contained in:
parent
5e59561637
commit
aff45c91fc
|
@ -496,7 +496,6 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimo
|
|||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadWiimoteConfig(JNIEnv*,
|
||||
jclass)
|
||||
{
|
||||
WiimoteReal::LoadSettings();
|
||||
Wiimote::LoadConfig();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,58 +53,6 @@
|
|||
|
||||
namespace BootManager
|
||||
{
|
||||
// TODO this is an ugly hack which allows us to restore values trampled by per-game settings
|
||||
// Apply fire liberally
|
||||
struct ConfigCache
|
||||
{
|
||||
public:
|
||||
// fill the cache with values from the configuration
|
||||
void SaveConfig(const SConfig& config);
|
||||
// restore values to the configuration from the cache
|
||||
void RestoreConfig(SConfig* config);
|
||||
|
||||
// These store if the relevant setting should be reset back later (true) or if it should be left
|
||||
// alone on restore (false)
|
||||
bool bSetVolume = false;
|
||||
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
|
||||
|
||||
private:
|
||||
bool valid = false;
|
||||
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
|
||||
};
|
||||
|
||||
void ConfigCache::SaveConfig(const SConfig& config)
|
||||
{
|
||||
valid = true;
|
||||
|
||||
for (int i = 0; i != MAX_BBMOTES; ++i)
|
||||
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
|
||||
|
||||
bSetVolume = false;
|
||||
bSetWiimoteSource.fill(false);
|
||||
}
|
||||
|
||||
void ConfigCache::RestoreConfig(SConfig* config)
|
||||
{
|
||||
if (!valid)
|
||||
return;
|
||||
|
||||
valid = false;
|
||||
|
||||
// Only change these back if they were actually set by game ini, since they can be changed while a
|
||||
// game is running.
|
||||
if (config->bWii)
|
||||
{
|
||||
for (unsigned int i = 0; i < MAX_BBMOTES; ++i)
|
||||
{
|
||||
if (bSetWiimoteSource[i])
|
||||
WiimoteCommon::SetSource(i, iWiimoteSource[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ConfigCache config_cache;
|
||||
|
||||
// Boot the ISO or file
|
||||
bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
||||
{
|
||||
|
@ -113,46 +61,9 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
|||
|
||||
SConfig& StartUp = SConfig::GetInstance();
|
||||
|
||||
config_cache.SaveConfig(StartUp);
|
||||
|
||||
if (!StartUp.SetPathsAndGameMetadata(*boot))
|
||||
return false;
|
||||
|
||||
// Load game specific settings
|
||||
if (!std::holds_alternative<BootParameters::IPL>(boot->parameters))
|
||||
{
|
||||
IniFile game_ini = StartUp.LoadGameIni();
|
||||
|
||||
// General settings
|
||||
IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls");
|
||||
|
||||
// Wii settings
|
||||
if (StartUp.bWii)
|
||||
{
|
||||
int source;
|
||||
for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
{
|
||||
controls_section->Get(fmt::format("WiimoteSource{}", i), &source, -1);
|
||||
if (source != -1 && WiimoteCommon::GetSource(i) != WiimoteSource(source) &&
|
||||
WiimoteSource(source) >= WiimoteSource::None &&
|
||||
WiimoteSource(source) <= WiimoteSource::Real)
|
||||
{
|
||||
config_cache.bSetWiimoteSource[i] = true;
|
||||
WiimoteCommon::SetSource(i, WiimoteSource(source));
|
||||
}
|
||||
}
|
||||
controls_section->Get("WiimoteSourceBB", &source, -1);
|
||||
if (source != -1 &&
|
||||
WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD) != WiimoteSource(source) &&
|
||||
(WiimoteSource(source) == WiimoteSource::None ||
|
||||
WiimoteSource(source) == WiimoteSource::Real))
|
||||
{
|
||||
config_cache.bSetWiimoteSource[WIIMOTE_BALANCE_BOARD] = true;
|
||||
WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, WiimoteSource(source));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Movie settings
|
||||
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
|
||||
{
|
||||
|
@ -313,7 +224,6 @@ void RestoreConfig()
|
|||
Config::RemoveLayer(Config::LayerType::GlobalGame);
|
||||
Config::RemoveLayer(Config::LayerType::LocalGame);
|
||||
SConfig::GetInstance().ResetRunningGameMetadata();
|
||||
config_cache.RestoreConfig(&SConfig::GetInstance());
|
||||
}
|
||||
|
||||
} // namespace BootManager
|
||||
|
|
|
@ -36,6 +36,8 @@ add_library(core
|
|||
Config/SYSCONFSettings.h
|
||||
Config/UISettings.cpp
|
||||
Config/UISettings.h
|
||||
Config/WiimoteSettings.cpp
|
||||
Config/WiimoteSettings.h
|
||||
ConfigLoaders/BaseConfigLoader.cpp
|
||||
ConfigLoaders/BaseConfigLoader.h
|
||||
ConfigLoaders/GameConfigLoader.cpp
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
|
||||
#include "Core/HW/Wiimote.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
const Info<WiimoteSource> WIIMOTE_1_SOURCE{{System::WiiPad, "Wiimote1", "Source"},
|
||||
WiimoteSource::Emulated};
|
||||
const Info<WiimoteSource> WIIMOTE_2_SOURCE{{System::WiiPad, "Wiimote2", "Source"},
|
||||
WiimoteSource::None};
|
||||
const Info<WiimoteSource> WIIMOTE_3_SOURCE{{System::WiiPad, "Wiimote3", "Source"},
|
||||
WiimoteSource::None};
|
||||
const Info<WiimoteSource> WIIMOTE_4_SOURCE{{System::WiiPad, "Wiimote4", "Source"},
|
||||
WiimoteSource::None};
|
||||
const Info<WiimoteSource> WIIMOTE_BB_SOURCE{{System::WiiPad, "BalanceBoard", "Source"},
|
||||
WiimoteSource::None};
|
||||
|
||||
const Info<WiimoteSource>& GetInfoForWiimoteSource(int index)
|
||||
{
|
||||
static const std::array<const Info<WiimoteSource>*, 5> infos{
|
||||
&WIIMOTE_1_SOURCE, &WIIMOTE_2_SOURCE, &WIIMOTE_3_SOURCE,
|
||||
&WIIMOTE_4_SOURCE, &WIIMOTE_BB_SOURCE,
|
||||
};
|
||||
return *infos[index];
|
||||
}
|
||||
|
||||
} // namespace Config
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
enum class WiimoteSource;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
extern const Info<WiimoteSource> WIIMOTE_1_SOURCE;
|
||||
extern const Info<WiimoteSource> WIIMOTE_2_SOURCE;
|
||||
extern const Info<WiimoteSource> WIIMOTE_3_SOURCE;
|
||||
extern const Info<WiimoteSource> WIIMOTE_4_SOURCE;
|
||||
extern const Info<WiimoteSource> WIIMOTE_BB_SOURCE;
|
||||
|
||||
const Info<WiimoteSource>& GetInfoForWiimoteSource(int index);
|
||||
|
||||
} // namespace Config
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigLoaders/IsSettingSaveable.h"
|
||||
|
||||
namespace ConfigLoaders
|
||||
|
@ -79,6 +80,11 @@ static const INIToLocationMap& GetINIToLocationMap()
|
|||
{{"Controls", "PadType1"}, {Config::GetInfoForSIDevice(1).GetLocation()}},
|
||||
{{"Controls", "PadType2"}, {Config::GetInfoForSIDevice(2).GetLocation()}},
|
||||
{{"Controls", "PadType3"}, {Config::GetInfoForSIDevice(3).GetLocation()}},
|
||||
{{"Controls", "WiimoteSource0"}, {Config::WIIMOTE_1_SOURCE.GetLocation()}},
|
||||
{{"Controls", "WiimoteSource1"}, {Config::WIIMOTE_2_SOURCE.GetLocation()}},
|
||||
{{"Controls", "WiimoteSource2"}, {Config::WIIMOTE_3_SOURCE.GetLocation()}},
|
||||
{{"Controls", "WiimoteSource3"}, {Config::WIIMOTE_4_SOURCE.GetLocation()}},
|
||||
{{"Controls", "WiimoteSourceBB"}, {Config::WIIMOTE_BB_SOURCE.GetLocation()}},
|
||||
};
|
||||
return ini_to_location;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/UISettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
|
||||
namespace ConfigLoaders
|
||||
{
|
||||
|
@ -129,6 +130,14 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
|||
// UI.General
|
||||
|
||||
&Config::MAIN_USE_DISCORD_PRESENCE.GetLocation(),
|
||||
|
||||
// Wiimote
|
||||
|
||||
&Config::WIIMOTE_1_SOURCE.GetLocation(),
|
||||
&Config::WIIMOTE_2_SOURCE.GetLocation(),
|
||||
&Config::WIIMOTE_3_SOURCE.GetLocation(),
|
||||
&Config::WIIMOTE_4_SOURCE.GetLocation(),
|
||||
&Config::WIIMOTE_BB_SOURCE.GetLocation(),
|
||||
};
|
||||
|
||||
return std::any_of(begin(s_setting_saveable), end(s_setting_saveable),
|
||||
|
|
|
@ -3,9 +3,13 @@
|
|||
|
||||
#include "Core/HW/Wiimote.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
@ -23,16 +27,17 @@
|
|||
// Limit the amount of wiimote connect requests, when a button is pressed in disconnected state
|
||||
static std::array<u8, MAX_BBMOTES> s_last_connect_request_counter;
|
||||
|
||||
namespace WiimoteCommon
|
||||
namespace
|
||||
{
|
||||
static std::array<std::atomic<WiimoteSource>, MAX_BBMOTES> s_wiimote_sources;
|
||||
static std::optional<size_t> s_config_callback_id = std::nullopt;
|
||||
|
||||
WiimoteSource GetSource(unsigned int index)
|
||||
{
|
||||
return s_wiimote_sources[index];
|
||||
}
|
||||
|
||||
void SetSource(unsigned int index, WiimoteSource source)
|
||||
void OnSourceChanged(unsigned int index, WiimoteSource source)
|
||||
{
|
||||
const WiimoteSource previous_source = s_wiimote_sources[index].exchange(source);
|
||||
|
||||
|
@ -44,9 +49,19 @@ void SetSource(unsigned int index, WiimoteSource source)
|
|||
|
||||
WiimoteReal::HandleWiimoteSourceChange(index);
|
||||
|
||||
Core::RunAsCPUThread([index] { UpdateSource(index); });
|
||||
Core::RunAsCPUThread([index] { WiimoteCommon::UpdateSource(index); });
|
||||
}
|
||||
|
||||
void RefreshConfig()
|
||||
{
|
||||
for (int i = 0; i < MAX_BBMOTES; ++i)
|
||||
OnSourceChanged(i, Config::Get(Config::GetInfoForWiimoteSource(i)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace WiimoteCommon
|
||||
{
|
||||
void UpdateSource(unsigned int index)
|
||||
{
|
||||
const auto bluetooth = WiiUtils::GetBluetoothEmuDevice();
|
||||
|
@ -144,6 +159,12 @@ void Shutdown()
|
|||
s_config.ClearControllers();
|
||||
|
||||
WiimoteReal::Stop();
|
||||
|
||||
if (s_config_callback_id)
|
||||
{
|
||||
Config::RemoveConfigChangedCallback(*s_config_callback_id);
|
||||
s_config_callback_id = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
void Initialize(InitializeMode init_mode)
|
||||
|
@ -158,6 +179,10 @@ void Initialize(InitializeMode init_mode)
|
|||
|
||||
LoadConfig();
|
||||
|
||||
if (!s_config_callback_id)
|
||||
s_config_callback_id = Config::AddConfigChangedCallback(RefreshConfig);
|
||||
RefreshConfig();
|
||||
|
||||
WiimoteReal::Initialize(init_mode);
|
||||
|
||||
// Reload Wiimotes with our settings
|
||||
|
@ -191,7 +216,7 @@ void DoState(PointerWrap& p)
|
|||
{
|
||||
for (int i = 0; i < MAX_BBMOTES; ++i)
|
||||
{
|
||||
const WiimoteSource source = WiimoteCommon::GetSource(i);
|
||||
const WiimoteSource source = GetSource(i);
|
||||
auto state_wiimote_source = u8(source);
|
||||
p.Do(state_wiimote_source);
|
||||
|
||||
|
|
|
@ -54,9 +54,6 @@ namespace WiimoteCommon
|
|||
{
|
||||
class HIDWiimote;
|
||||
|
||||
WiimoteSource GetSource(unsigned int index);
|
||||
void SetSource(unsigned int index, WiimoteSource source);
|
||||
|
||||
// Used to reconnect WiimoteDevice instance to HID source.
|
||||
// Must be run from CPU thread.
|
||||
void UpdateSource(unsigned int index);
|
||||
|
@ -108,6 +105,4 @@ void Resume();
|
|||
void Pause();
|
||||
void Refresh();
|
||||
|
||||
void LoadSettings();
|
||||
|
||||
} // namespace WiimoteReal
|
||||
|
|
|
@ -11,11 +11,14 @@
|
|||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Common/Thread.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
|
@ -25,6 +28,7 @@
|
|||
#include "Core/HW/WiimoteReal/IOLinux.h"
|
||||
#include "Core/HW/WiimoteReal/IOWin.h"
|
||||
#include "Core/HW/WiimoteReal/IOhidapi.h"
|
||||
|
||||
#include "InputCommon/ControllerInterface/Wiimote/WiimoteController.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
|
@ -78,8 +82,11 @@ static void TryToFillWiimoteSlot(u32 index)
|
|||
{
|
||||
std::lock_guard lk(g_wiimotes_mutex);
|
||||
|
||||
if (g_wiimotes[index] || WiimoteCommon::GetSource(index) != WiimoteSource::Real)
|
||||
if (g_wiimotes[index] ||
|
||||
Config::Get(Config::GetInfoForWiimoteSource(index)) != WiimoteSource::Real)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If the pool is empty, attempt to steal from ControllerInterface.
|
||||
if (s_wiimote_pool.empty())
|
||||
|
@ -531,9 +538,11 @@ static unsigned int CalculateWantedWiimotes()
|
|||
std::lock_guard lk(g_wiimotes_mutex);
|
||||
// Figure out how many real Wiimotes are required
|
||||
unsigned int wanted_wiimotes = 0;
|
||||
for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
if (WiimoteCommon::GetSource(i) == WiimoteSource::Real && !g_wiimotes[i])
|
||||
for (int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
{
|
||||
if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Real && !g_wiimotes[i])
|
||||
++wanted_wiimotes;
|
||||
}
|
||||
return wanted_wiimotes;
|
||||
}
|
||||
|
||||
|
@ -541,9 +550,11 @@ static unsigned int CalculateWantedBB()
|
|||
{
|
||||
std::lock_guard lk(g_wiimotes_mutex);
|
||||
unsigned int wanted_bb = 0;
|
||||
if (WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD) == WiimoteSource::Real &&
|
||||
if (Config::Get(Config::WIIMOTE_BB_SOURCE) == WiimoteSource::Real &&
|
||||
!g_wiimotes[WIIMOTE_BALANCE_BOARD])
|
||||
{
|
||||
++wanted_bb;
|
||||
}
|
||||
return wanted_bb;
|
||||
}
|
||||
|
||||
|
@ -823,32 +834,6 @@ int Wiimote::GetIndex() const
|
|||
return m_index;
|
||||
}
|
||||
|
||||
void LoadSettings()
|
||||
{
|
||||
std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini";
|
||||
|
||||
IniFile inifile;
|
||||
inifile.Load(ini_filename);
|
||||
|
||||
for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
{
|
||||
std::string secname("Wiimote");
|
||||
secname += static_cast<char>('1' + i);
|
||||
IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
|
||||
|
||||
unsigned int source = 0;
|
||||
sec.Get("Source", &source, i ? int(WiimoteSource::None) : int(WiimoteSource::Emulated));
|
||||
WiimoteCommon::SetSource(i, WiimoteSource(source));
|
||||
}
|
||||
|
||||
std::string secname("BalanceBoard");
|
||||
IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
|
||||
|
||||
unsigned int bb_source = 0;
|
||||
sec.Get("Source", &bb_source, int(WiimoteSource::None));
|
||||
WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, WiimoteSource(bb_source));
|
||||
}
|
||||
|
||||
// config dialog calls this when some settings change
|
||||
void Initialize(::Wiimote::InitializeMode init_mode)
|
||||
{
|
||||
|
@ -924,7 +909,7 @@ void Pause()
|
|||
// Called from the Wiimote scanner thread (or UI thread on source change)
|
||||
static bool TryToConnectWiimoteToSlot(std::unique_ptr<Wiimote>& wm, unsigned int i)
|
||||
{
|
||||
if (WiimoteCommon::GetSource(i) != WiimoteSource::Real || g_wiimotes[i])
|
||||
if (Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::Real || g_wiimotes[i])
|
||||
return false;
|
||||
|
||||
if (!wm->Connect(i))
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigLoaders/MovieConfigLoader.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
@ -169,7 +170,7 @@ std::string GetInputDisplay()
|
|||
s_controllers[i] = ControllerType::GC;
|
||||
else
|
||||
s_controllers[i] = ControllerType::None;
|
||||
s_wiimotes[i] = WiimoteCommon::GetSource(i) != WiimoteSource::None;
|
||||
s_wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,7 +507,7 @@ void ChangeWiiPads(bool instantly)
|
|||
|
||||
for (int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
{
|
||||
wiimotes[i] = WiimoteCommon::GetSource(i) != WiimoteSource::None;
|
||||
wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None;
|
||||
}
|
||||
|
||||
// This is important for Wiimotes, because they can desync easily if they get re-activated
|
||||
|
@ -518,7 +519,8 @@ void ChangeWiiPads(bool instantly)
|
|||
{
|
||||
const bool is_using_wiimote = IsUsingWiimote(i);
|
||||
|
||||
WiimoteCommon::SetSource(i, is_using_wiimote ? WiimoteSource::Emulated : WiimoteSource::None);
|
||||
Config::SetCurrent(Config::GetInfoForWiimoteSource(i),
|
||||
is_using_wiimote ? WiimoteSource::Emulated : WiimoteSource::None);
|
||||
if (bt != nullptr)
|
||||
bt->AccessWiimoteByIndex(i)->Activate(is_using_wiimote);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
#include "Core/Config/SessionSettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/GeckoCode.h"
|
||||
#include "Core/HW/EXI/EXI.h"
|
||||
|
@ -1741,7 +1742,7 @@ bool NetPlayClient::StartGame(const std::string& path)
|
|||
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
{
|
||||
WiimoteCommon::SetSource(i,
|
||||
Config::SetCurrent(Config::GetInfoForWiimoteSource(i),
|
||||
m_wiimote_map[i] > 0 ? WiimoteSource::Emulated : WiimoteSource::None);
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@
|
|||
<ClInclude Include="Core\Config\SessionSettings.h" />
|
||||
<ClInclude Include="Core\Config\SYSCONFSettings.h" />
|
||||
<ClInclude Include="Core\Config\UISettings.h" />
|
||||
<ClInclude Include="Core\Config\WiimoteSettings.h" />
|
||||
<ClInclude Include="Core\ConfigLoaders\BaseConfigLoader.h" />
|
||||
<ClInclude Include="Core\ConfigLoaders\GameConfigLoader.h" />
|
||||
<ClInclude Include="Core\ConfigLoaders\IsSettingSaveable.h" />
|
||||
|
@ -763,6 +764,7 @@
|
|||
<ClCompile Include="Core\Config\SessionSettings.cpp" />
|
||||
<ClCompile Include="Core\Config\SYSCONFSettings.cpp" />
|
||||
<ClCompile Include="Core\Config\UISettings.cpp" />
|
||||
<ClCompile Include="Core\Config\WiimoteSettings.cpp" />
|
||||
<ClCompile Include="Core\ConfigLoaders\BaseConfigLoader.cpp" />
|
||||
<ClCompile Include="Core\ConfigLoaders\GameConfigLoader.cpp" />
|
||||
<ClCompile Include="Core\ConfigLoaders\IsSettingSaveable.cpp" />
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
#include <map>
|
||||
#include <optional>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
|
@ -301,9 +304,9 @@ void WiimoteControllersWidget::LoadSettings()
|
|||
{
|
||||
for (size_t i = 0; i < m_wiimote_groups.size(); i++)
|
||||
{
|
||||
m_wiimote_boxes[i]->setCurrentIndex(int(WiimoteCommon::GetSource(u32(i))));
|
||||
m_wiimote_boxes[i]->setCurrentIndex(int(Config::Get(Config::GetInfoForWiimoteSource(int(i)))));
|
||||
}
|
||||
m_wiimote_real_balance_board->setChecked(WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD) ==
|
||||
m_wiimote_real_balance_board->setChecked(Config::Get(Config::WIIMOTE_BB_SOURCE) ==
|
||||
WiimoteSource::Real);
|
||||
m_wiimote_speaker_data->setChecked(Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER));
|
||||
m_wiimote_ciface->setChecked(Config::Get(Config::MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE));
|
||||
|
@ -328,17 +331,15 @@ void WiimoteControllersWidget::SaveSettings()
|
|||
Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED,
|
||||
m_wiimote_passthrough->isChecked());
|
||||
|
||||
WiimoteCommon::SetSource(WIIMOTE_BALANCE_BOARD, m_wiimote_real_balance_board->isChecked() ?
|
||||
WiimoteSource::Real :
|
||||
WiimoteSource::None);
|
||||
const WiimoteSource bb_source =
|
||||
m_wiimote_real_balance_board->isChecked() ? WiimoteSource::Real : WiimoteSource::None;
|
||||
Config::SetBaseOrCurrent(Config::WIIMOTE_BB_SOURCE, bb_source);
|
||||
|
||||
for (size_t i = 0; i < m_wiimote_groups.size(); i++)
|
||||
{
|
||||
const int index = m_wiimote_boxes[i]->currentIndex();
|
||||
WiimoteCommon::SetSource(u32(i), WiimoteSource(index));
|
||||
Config::SetBaseOrCurrent(Config::GetInfoForWiimoteSource(int(i)), WiimoteSource(index));
|
||||
}
|
||||
|
||||
UICommon::SaveWiimoteSources();
|
||||
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "Core/CommonTitles.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
#include "Core/Config/WiimoteSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/FreeLookManager.h"
|
||||
|
@ -1735,7 +1736,7 @@ void MainWindow::OnStartRecording()
|
|||
controllers[i] = Movie::ControllerType::GC;
|
||||
else
|
||||
controllers[i] = Movie::ControllerType::None;
|
||||
wiimotes[i] = WiimoteCommon::GetSource(i) != WiimoteSource::None;
|
||||
wiimotes[i] = Config::Get(Config::GetInfoForWiimoteSource(i)) != WiimoteSource::None;
|
||||
}
|
||||
|
||||
if (Movie::BeginRecordingInput(controllers, wiimotes))
|
||||
|
@ -1795,7 +1796,7 @@ void MainWindow::ShowTASInput()
|
|||
|
||||
for (int i = 0; i < num_wii_controllers; i++)
|
||||
{
|
||||
if (WiimoteCommon::GetSource(i) == WiimoteSource::Emulated &&
|
||||
if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated &&
|
||||
(!Core::IsRunning() || SConfig::GetInstance().bWii))
|
||||
{
|
||||
m_wii_tas_input_windows[i]->show();
|
||||
|
|
|
@ -106,7 +106,6 @@ void Init()
|
|||
SConfig::Init();
|
||||
Discord::Init();
|
||||
Common::Log::LogManager::Init();
|
||||
WiimoteReal::LoadSettings();
|
||||
GCAdapter::Init();
|
||||
VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
|
||||
|
||||
|
@ -356,29 +355,6 @@ void SetUserDirectory(std::string custom_path)
|
|||
File::SetUserPath(D_USER_IDX, std::move(user_path));
|
||||
}
|
||||
|
||||
void SaveWiimoteSources()
|
||||
{
|
||||
std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini";
|
||||
|
||||
IniFile inifile;
|
||||
inifile.Load(ini_filename);
|
||||
|
||||
for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
|
||||
{
|
||||
std::string secname("Wiimote");
|
||||
secname += (char)('1' + i);
|
||||
IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
|
||||
|
||||
sec.Set("Source", int(WiimoteCommon::GetSource(i)));
|
||||
}
|
||||
|
||||
std::string secname("BalanceBoard");
|
||||
IniFile::Section& sec = *inifile.GetOrCreateSection(secname);
|
||||
sec.Set("Source", int(WiimoteCommon::GetSource(WIIMOTE_BALANCE_BOARD)));
|
||||
|
||||
inifile.Save(ini_filename);
|
||||
}
|
||||
|
||||
bool TriggerSTMPowerEvent()
|
||||
{
|
||||
const auto ios = IOS::HLE::GetIOS();
|
||||
|
|
|
@ -27,8 +27,6 @@ void SetUserDirectory(std::string custom_path);
|
|||
|
||||
bool TriggerSTMPowerEvent();
|
||||
|
||||
void SaveWiimoteSources();
|
||||
|
||||
// Return a pretty file size string from byte count.
|
||||
// e.g. 1134278 -> "1.08 MiB"
|
||||
std::string FormatSize(u64 bytes, int decimals = 2);
|
||||
|
|
Loading…
Reference in New Issue