diff --git a/src/core/analog_controller.cpp b/src/core/analog_controller.cpp index 7ab401652..5f28482be 100644 --- a/src/core/analog_controller.cpp +++ b/src/core/analog_controller.cpp @@ -894,7 +894,7 @@ const Controller::ControllerInfo AnalogController::INFO = {ControllerType::Analo s_settings, Controller::VibrationCapabilities::LargeSmallMotors}; -void AnalogController::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void AnalogController::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); m_force_analog_on_reset = si.GetBoolValue(section, "ForceAnalogOnReset", true); diff --git a/src/core/analog_controller.h b/src/core/analog_controller.h index eb6ceaea3..b1a9a117d 100644 --- a/src/core/analog_controller.h +++ b/src/core/analog_controller.h @@ -80,7 +80,7 @@ public: void ResetTransferState() override; bool Transfer(const u8 data_in, u8* data_out) override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; private: using MotorState = std::array; diff --git a/src/core/analog_joystick.cpp b/src/core/analog_joystick.cpp index 4334a2b1e..4b545180b 100644 --- a/src/core/analog_joystick.cpp +++ b/src/core/analog_joystick.cpp @@ -414,7 +414,7 @@ const Controller::ControllerInfo AnalogJoystick::INFO = {ControllerType::AnalogJ s_settings, Controller::VibrationCapabilities::NoVibration}; -void AnalogJoystick::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void AnalogJoystick::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); m_analog_deadzone = std::clamp(si.GetFloatValue(section, "AnalogDeadzone", DEFAULT_STICK_DEADZONE), 0.0f, 1.0f); diff --git a/src/core/analog_joystick.h b/src/core/analog_joystick.h index a7953a5b2..e9472d4c2 100644 --- a/src/core/analog_joystick.h +++ b/src/core/analog_joystick.h @@ -77,7 +77,7 @@ public: void ResetTransferState() override; bool Transfer(const u8 data_in, u8* data_out) override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; private: enum class TransferState : u8 diff --git a/src/core/controller.cpp b/src/core/controller.cpp index d10b102c4..1fdfbc47a 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -106,7 +106,7 @@ u32 Controller::GetInputOverlayIconColor() const return 0xFFFFFFFFu; } -void Controller::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void Controller::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { } diff --git a/src/core/controller.h b/src/core/controller.h index 91b9a7ea5..bf2bc766d 100644 --- a/src/core/controller.h +++ b/src/core/controller.h @@ -97,7 +97,7 @@ public: virtual u32 GetInputOverlayIconColor() const; /// Loads/refreshes any per-controller settings. - virtual void LoadSettings(SettingsInterface& si, const char* section, bool initial); + virtual void LoadSettings(const SettingsInterface& si, const char* section, bool initial); /// Creates a new controller of the specified type. static std::unique_ptr Create(ControllerType type, u32 index); diff --git a/src/core/guncon.cpp b/src/core/guncon.cpp index e2f0c8fc7..a6da13dd5 100644 --- a/src/core/guncon.cpp +++ b/src/core/guncon.cpp @@ -307,7 +307,7 @@ const Controller::ControllerInfo GunCon::INFO = { ControllerType::GunCon, "GunCon", TRANSLATE_NOOP("ControllerType", "GunCon"), ICON_PF_LIGHT_GUN, s_binding_info, s_settings, Controller::VibrationCapabilities::NoVibration}; -void GunCon::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void GunCon::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); diff --git a/src/core/guncon.h b/src/core/guncon.h index 1b5292acf..1e3ec0b36 100644 --- a/src/core/guncon.h +++ b/src/core/guncon.h @@ -37,7 +37,7 @@ public: void Reset() override; bool DoState(StateWrapper& sw, bool apply_input_state) override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; float GetBindState(u32 index) const override; void SetBindState(u32 index, float value) override; diff --git a/src/core/justifier.cpp b/src/core/justifier.cpp index 4d0c66070..c0e5e0d69 100644 --- a/src/core/justifier.cpp +++ b/src/core/justifier.cpp @@ -396,7 +396,7 @@ const Controller::ControllerInfo Justifier::INFO = {ControllerType::Justifier, s_settings, Controller::VibrationCapabilities::NoVibration}; -void Justifier::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void Justifier::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); diff --git a/src/core/justifier.h b/src/core/justifier.h index b82eff6a1..27de367d8 100644 --- a/src/core/justifier.h +++ b/src/core/justifier.h @@ -40,7 +40,7 @@ public: void Reset() override; bool DoState(StateWrapper& sw, bool apply_input_state) override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; float GetBindState(u32 index) const override; void SetBindState(u32 index, float value) override; diff --git a/src/core/negcon.cpp b/src/core/negcon.cpp index 59c8b5030..f4f89dcee 100644 --- a/src/core/negcon.cpp +++ b/src/core/negcon.cpp @@ -345,7 +345,7 @@ const Controller::ControllerInfo NeGcon::INFO = { ControllerType::NeGcon, "NeGcon", TRANSLATE_NOOP("ControllerType", "NeGcon"), ICON_PF_GAMEPAD, s_binding_info, s_settings, Controller::VibrationCapabilities::NoVibration}; -void NeGcon::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void NeGcon::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); m_steering_modifier = { diff --git a/src/core/negcon.h b/src/core/negcon.h index fa3bdeb75..a2393ce8d 100644 --- a/src/core/negcon.h +++ b/src/core/negcon.h @@ -100,7 +100,7 @@ public: u32 GetButtonStateBits() const override; std::optional GetAnalogInputBytes() const override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; private: enum class TransferState : u8 diff --git a/src/core/negcon_rumble.cpp b/src/core/negcon_rumble.cpp index 53020556a..01c732c7a 100644 --- a/src/core/negcon_rumble.cpp +++ b/src/core/negcon_rumble.cpp @@ -777,7 +777,7 @@ const Controller::ControllerInfo NeGconRumble::INFO = {ControllerType::NeGconRum s_settings, Controller::VibrationCapabilities::LargeSmallMotors}; -void NeGconRumble::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void NeGconRumble::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); m_steering_deadzone = si.GetFloatValue(section, "SteeringDeadzone", 0.10f); diff --git a/src/core/negcon_rumble.h b/src/core/negcon_rumble.h index 43141fea9..59c1a5fc4 100644 --- a/src/core/negcon_rumble.h +++ b/src/core/negcon_rumble.h @@ -69,7 +69,7 @@ public: u32 GetButtonStateBits() const override; std::optional GetAnalogInputBytes() const override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; private: using MotorState = std::array; diff --git a/src/core/playstation_mouse.cpp b/src/core/playstation_mouse.cpp index d6b1f3a87..d748fe3ee 100644 --- a/src/core/playstation_mouse.cpp +++ b/src/core/playstation_mouse.cpp @@ -182,7 +182,7 @@ bool PlayStationMouse::Transfer(const u8 data_in, u8* data_out) } } -void PlayStationMouse::LoadSettings(SettingsInterface& si, const char* section, bool initial) +void PlayStationMouse::LoadSettings(const SettingsInterface& si, const char* section, bool initial) { Controller::LoadSettings(si, section, initial); diff --git a/src/core/playstation_mouse.h b/src/core/playstation_mouse.h index 38c33cd95..3a412cef6 100644 --- a/src/core/playstation_mouse.h +++ b/src/core/playstation_mouse.h @@ -39,7 +39,7 @@ public: void ResetTransferState() override; bool Transfer(const u8 data_in, u8* data_out) override; - void LoadSettings(SettingsInterface& si, const char* section, bool initial) override; + void LoadSettings(const SettingsInterface& si, const char* section, bool initial) override; private: enum class TransferState : u8 diff --git a/src/core/settings.cpp b/src/core/settings.cpp index afd58d2b7..d2d69a9d7 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -146,7 +146,7 @@ void Settings::UpdateOverclockActive() cpu_overclock_active = (cpu_overclock_enable && (cpu_overclock_numerator != 1 || cpu_overclock_denominator != 1)); } -void Settings::Load(SettingsInterface& si, SettingsInterface& controller_si) +void Settings::Load(const SettingsInterface& si, const SettingsInterface& controller_si) { region = ParseConsoleRegionName( diff --git a/src/core/settings.h b/src/core/settings.h index d5a134778..f99113e74 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -368,7 +368,7 @@ struct Settings DEFAULT_GPU_MAX_RUN_AHEAD = 128, }; - void Load(SettingsInterface& si, SettingsInterface& controller_si); + void Load(const SettingsInterface& si, const SettingsInterface& controller_si); void Save(SettingsInterface& si, bool ignore_base) const; static void Clear(SettingsInterface& si); diff --git a/src/core/system.h b/src/core/system.h index 29f6eff0f..598dd0167 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -473,7 +473,7 @@ void IdlePollUpdate(); namespace Host { /// Called with the settings lock held, when system settings are being loaded (should load input sources, etc). -void LoadSettings(SettingsInterface& si, std::unique_lock& lock); +void LoadSettings(const SettingsInterface& si, std::unique_lock& lock); /// Called after settings are updated. void CheckForSettingsChanges(const Settings& old_settings); diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index d99242f9c..7a4783736 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -615,14 +615,8 @@ bool QtHost::SetDataDirectory() return true; } -void Host::LoadSettings(SettingsInterface& si, std::unique_lock& lock) +void Host::LoadSettings(const SettingsInterface& si, std::unique_lock& lock) { - g_emu_thread->loadSettings(si); -} - -void EmuThread::loadSettings(SettingsInterface& si) -{ - // } void EmuThread::checkForSettingsChanges(const Settings& old_settings) @@ -1972,7 +1966,7 @@ void Host::ReportDebuggerMessage(std::string_view message) emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message)); } -void Host::AddFixedInputBindings(SettingsInterface& si) +void Host::AddFixedInputBindings(const SettingsInterface& si) { } diff --git a/src/duckstation-qt/qthost.h b/src/duckstation-qt/qthost.h index 6fa2d6609..8fccd971d 100644 --- a/src/duckstation-qt/qthost.h +++ b/src/duckstation-qt/qthost.h @@ -105,7 +105,6 @@ public: void wakeThread(); bool shouldRenderToMain() const; - void loadSettings(SettingsInterface& si); void checkForSettingsChanges(const Settings& old_settings); void bootOrLoadState(std::string path); diff --git a/src/duckstation-regtest/regtest_host.cpp b/src/duckstation-regtest/regtest_host.cpp index 9464d0e75..ef2581233 100644 --- a/src/duckstation-regtest/regtest_host.cpp +++ b/src/duckstation-regtest/regtest_host.cpp @@ -204,7 +204,7 @@ SmallString Host::TranslatePluralToSmallString(const char* context, const char* return ret; } -void Host::LoadSettings(SettingsInterface& si, std::unique_lock& lock) +void Host::LoadSettings(const SettingsInterface& si, std::unique_lock& lock) { } @@ -450,7 +450,7 @@ const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code) return nullptr; } -void Host::AddFixedInputBindings(SettingsInterface& si) +void Host::AddFixedInputBindings(const SettingsInterface& si) { // noop } diff --git a/src/util/audio_stream.cpp b/src/util/audio_stream.cpp index 3f8b83443..31ce20236 100644 --- a/src/util/audio_stream.cpp +++ b/src/util/audio_stream.cpp @@ -31,7 +31,7 @@ AudioStream::DeviceInfo::DeviceInfo(std::string name_, std::string display_name_ AudioStream::DeviceInfo::~DeviceInfo() = default; -void AudioStreamParameters::Load(SettingsInterface& si, const char* section) +void AudioStreamParameters::Load(const SettingsInterface& si, const char* section) { stretch_mode = AudioStream::ParseStretchMode( diff --git a/src/util/audio_stream.h b/src/util/audio_stream.h index 127e9ec7c..45c2ba10e 100644 --- a/src/util/audio_stream.h +++ b/src/util/audio_stream.h @@ -71,7 +71,7 @@ struct AudioStreamParameters static constexpr bool DEFAULT_STRETCH_USE_QUICKSEEK = false; static constexpr bool DEFAULT_STRETCH_USE_AA_FILTER = false; - void Load(SettingsInterface& si, const char* section); + void Load(const SettingsInterface& si, const char* section); void Save(SettingsInterface& si, const char* section) const; void Clear(SettingsInterface& si, const char* section); diff --git a/src/util/dinput_source.cpp b/src/util/dinput_source.cpp index a8dbf3d11..97e89b51f 100644 --- a/src/util/dinput_source.cpp +++ b/src/util/dinput_source.cpp @@ -59,7 +59,7 @@ std::string DInputSource::GetDeviceIdentifier(u32 index) static constexpr std::array s_hat_directions = { {"Up", "Down", "Left", "Right"}}; -bool DInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +bool DInputSource::Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) { m_dinput_module = LoadLibraryW(L"dinput8"); if (!m_dinput_module) @@ -103,7 +103,7 @@ bool DInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +void DInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) { // noop } diff --git a/src/util/dinput_source.h b/src/util/dinput_source.h index 10d3da355..f22dd8c73 100644 --- a/src/util/dinput_source.h +++ b/src/util/dinput_source.h @@ -33,8 +33,8 @@ public: DInputSource(); ~DInputSource() override; - bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) override; - void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) override; + bool Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) override; + void UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) override; bool ReloadDevices() override; void Shutdown() override; diff --git a/src/util/input_manager.cpp b/src/util/input_manager.cpp index 0fca23857..40383baa9 100644 --- a/src/util/input_manager.cpp +++ b/src/util/input_manager.cpp @@ -113,8 +113,8 @@ static void UpdatePointerCount(); static bool IsAxisHandler(const InputEventHandler& handler); static float ApplySingleBindingScale(float sensitivity, float deadzone, float value); -static void AddHotkeyBindings(SettingsInterface& si); -static void AddPadBindings(SettingsInterface& si, const std::string& section, u32 pad, +static void AddHotkeyBindings(const SettingsInterface& si); +static void AddPadBindings(const SettingsInterface& si, const std::string& section, u32 pad, const Controller::ControllerInfo* cinfo); static void UpdateContinuedVibration(); static void GenerateRelativeMouseEvents(); @@ -123,12 +123,12 @@ static bool DoEventHook(InputBindingKey key, float value); static bool PreprocessEvent(InputBindingKey key, float value, GenericInputBinding generic_key); static bool ProcessEvent(InputBindingKey key, float value, bool skip_button_handlers); -static void LoadMacroButtonConfig(SettingsInterface& si, const std::string& section, u32 pad, +static void LoadMacroButtonConfig(const SettingsInterface& si, const std::string& section, u32 pad, const Controller::ControllerInfo* cinfo); static void ApplyMacroButton(u32 pad, const MacroButton& mb); static void UpdateMacroButtons(); -static void UpdateInputSourceState(SettingsInterface& si, std::unique_lock& settings_lock, +static void UpdateInputSourceState(const SettingsInterface& si, std::unique_lock& settings_lock, InputSourceType type, std::unique_ptr (*factory_function)()); } // namespace InputManager @@ -809,7 +809,7 @@ std::vector InputManager::GetHotkeyList() return ret; } -void InputManager::AddHotkeyBindings(SettingsInterface& si) +void InputManager::AddHotkeyBindings(const SettingsInterface& si) { for (const HotkeyInfo* hotkey_list : s_hotkey_list) { @@ -824,7 +824,7 @@ void InputManager::AddHotkeyBindings(SettingsInterface& si) } } -void InputManager::AddPadBindings(SettingsInterface& si, const std::string& section, u32 pad_index, +void InputManager::AddPadBindings(const SettingsInterface& si, const std::string& section, u32 pad_index, const Controller::ControllerInfo* cinfo) { for (const Controller::ControllerBindingInfo& bi : cinfo->bindings) @@ -1669,7 +1669,7 @@ void InputManager::UpdateContinuedVibration() // Macros // ------------------------------------------------------------------------ -void InputManager::LoadMacroButtonConfig(SettingsInterface& si, const std::string& section, u32 pad, +void InputManager::LoadMacroButtonConfig(const SettingsInterface& si, const std::string& section, u32 pad, const Controller::ControllerInfo* cinfo) { s_macro_buttons[pad] = {}; @@ -1816,7 +1816,7 @@ bool InputManager::DoEventHook(InputBindingKey key, float value) // Binding Updater // ------------------------------------------------------------------------ -void InputManager::ReloadBindings(SettingsInterface& binding_si, SettingsInterface& hotkey_binding_si) +void InputManager::ReloadBindings(const SettingsInterface& binding_si, const SettingsInterface& hotkey_binding_si) { PauseVibration(); @@ -2002,7 +2002,7 @@ GenericInputBindingMapping InputManager::GetGenericBindingMapping(std::string_vi return mapping; } -bool InputManager::IsInputSourceEnabled(SettingsInterface& si, InputSourceType type) +bool InputManager::IsInputSourceEnabled(const SettingsInterface& si, InputSourceType type) { #ifdef __ANDROID__ // Force Android source to always be enabled so nobody accidentally breaks it via ini. @@ -2013,7 +2013,7 @@ bool InputManager::IsInputSourceEnabled(SettingsInterface& si, InputSourceType t return si.GetBoolValue("InputSources", InputManager::InputSourceToString(type), GetInputSourceDefaultEnabled(type)); } -void InputManager::UpdateInputSourceState(SettingsInterface& si, std::unique_lock& settings_lock, +void InputManager::UpdateInputSourceState(const SettingsInterface& si, std::unique_lock& settings_lock, InputSourceType type, std::unique_ptr (*factory_function)()) { const bool enabled = IsInputSourceEnabled(si, type); @@ -2045,7 +2045,7 @@ void InputManager::UpdateInputSourceState(SettingsInterface& si, std::unique_loc } } -void InputManager::ReloadSources(SettingsInterface& si, std::unique_lock& settings_lock) +void InputManager::ReloadSources(const SettingsInterface& si, std::unique_lock& settings_lock) { #ifdef _WIN32 UpdateInputSourceState(si, settings_lock, InputSourceType::DInput, &InputSource::CreateDInputSource); diff --git a/src/util/input_manager.h b/src/util/input_manager.h index 70185a698..dc835bb0f 100644 --- a/src/util/input_manager.h +++ b/src/util/input_manager.h @@ -251,13 +251,13 @@ std::vector EnumerateMotors(); GenericInputBindingMapping GetGenericBindingMapping(std::string_view device); /// Returns true if the specified input source is enabled. -bool IsInputSourceEnabled(SettingsInterface& si, InputSourceType type); +bool IsInputSourceEnabled(const SettingsInterface& si, InputSourceType type); /// Re-parses the config and registers all hotkey and pad bindings. -void ReloadBindings(SettingsInterface& si, SettingsInterface& hotkey_binding_si); +void ReloadBindings(const SettingsInterface& si, const SettingsInterface& hotkey_binding_si); /// Re-parses the sources part of the config and initializes any backends. -void ReloadSources(SettingsInterface& si, std::unique_lock& settings_lock); +void ReloadSources(const SettingsInterface& si, std::unique_lock& settings_lock); /// Called when a device change is triggered by the system (DBT_DEVNODES_CHANGED on Windows). /// Returns true if any device changes are detected. @@ -364,7 +364,7 @@ void OnInputDeviceDisconnected(InputBindingKey key, std::string_view identifier) namespace Host { /// Adds any fixed bindings from the host. -void AddFixedInputBindings(SettingsInterface& si); +void AddFixedInputBindings(const SettingsInterface& si); /// Called when a new input device is connected. void OnInputDeviceConnected(std::string_view identifier, std::string_view device_name); diff --git a/src/util/input_source.h b/src/util/input_source.h index 9d185028b..29fcf3689 100644 --- a/src/util/input_source.h +++ b/src/util/input_source.h @@ -22,8 +22,8 @@ public: InputSource(); virtual ~InputSource(); - virtual bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) = 0; - virtual void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) = 0; + virtual bool Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) = 0; + virtual void UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) = 0; virtual bool ReloadDevices() = 0; virtual void Shutdown() = 0; diff --git a/src/util/sdl_input_source.cpp b/src/util/sdl_input_source.cpp index 269e815e1..bba9f0bf1 100644 --- a/src/util/sdl_input_source.cpp +++ b/src/util/sdl_input_source.cpp @@ -161,7 +161,7 @@ SDLInputSource::~SDLInputSource() Assert(m_controllers.empty()); } -bool SDLInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +bool SDLInputSource::Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) { LoadSettings(si); settings_lock.unlock(); @@ -171,7 +171,7 @@ bool SDLInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +void SDLInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) { const bool old_controller_enhanced_mode = m_controller_enhanced_mode; const bool old_controller_ps5_player_led = m_controller_ps5_player_led; @@ -213,7 +213,7 @@ void SDLInputSource::Shutdown() ShutdownSubsystem(); } -void SDLInputSource::LoadSettings(SettingsInterface& si) +void SDLInputSource::LoadSettings(const SettingsInterface& si) { for (u32 i = 0; i < MAX_LED_COLORS; i++) { @@ -240,7 +240,7 @@ void SDLInputSource::LoadSettings(SettingsInterface& si) #endif } -u32 SDLInputSource::GetRGBForPlayerId(SettingsInterface& si, u32 player_id) +u32 SDLInputSource::GetRGBForPlayerId(const SettingsInterface& si, u32 player_id) { return ParseRGBForPlayerId( si.GetStringValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str(), s_sdl_default_led_colors[player_id]), diff --git a/src/util/sdl_input_source.h b/src/util/sdl_input_source.h index 34682f793..6f0940b90 100644 --- a/src/util/sdl_input_source.h +++ b/src/util/sdl_input_source.h @@ -21,8 +21,8 @@ public: SDLInputSource(); ~SDLInputSource(); - bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) override; - void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) override; + bool Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) override; + void UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) override; bool ReloadDevices() override; void Shutdown() override; @@ -42,7 +42,7 @@ public: SDL_Joystick* GetJoystickForDevice(std::string_view device); - static u32 GetRGBForPlayerId(SettingsInterface& si, u32 player_id); + static u32 GetRGBForPlayerId(const SettingsInterface& si, u32 player_id); static u32 ParseRGBForPlayerId(std::string_view str, u32 player_id); static bool IsHandledInputEvent(const SDL_Event* ev); @@ -73,7 +73,7 @@ private: bool InitializeSubsystem(); void ShutdownSubsystem(); - void LoadSettings(SettingsInterface& si); + void LoadSettings(const SettingsInterface& si); void SetHints(); ControllerDataVector::iterator GetControllerDataForJoystickId(int id); diff --git a/src/util/win32_raw_input_source.cpp b/src/util/win32_raw_input_source.cpp index 116b0b364..20338e871 100644 --- a/src/util/win32_raw_input_source.cpp +++ b/src/util/win32_raw_input_source.cpp @@ -29,7 +29,7 @@ Win32RawInputSource::Win32RawInputSource() = default; Win32RawInputSource::~Win32RawInputSource() = default; -bool Win32RawInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +bool Win32RawInputSource::Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) { if (!RegisterDummyClass()) { @@ -52,7 +52,7 @@ bool Win32RawInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +void Win32RawInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) { } diff --git a/src/util/win32_raw_input_source.h b/src/util/win32_raw_input_source.h index de8fc5436..bac1574f1 100644 --- a/src/util/win32_raw_input_source.h +++ b/src/util/win32_raw_input_source.h @@ -17,8 +17,8 @@ public: Win32RawInputSource(); ~Win32RawInputSource(); - bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) override; - void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) override; + bool Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) override; + void UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) override; bool ReloadDevices() override; void Shutdown() override; diff --git a/src/util/xinput_source.cpp b/src/util/xinput_source.cpp index 6627af0e1..3e95d1692 100644 --- a/src/util/xinput_source.cpp +++ b/src/util/xinput_source.cpp @@ -113,7 +113,7 @@ XInputSource::XInputSource() = default; XInputSource::~XInputSource() = default; -bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +bool XInputSource::Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) { // xinput1_3.dll is flawed and obsolete, but it's also commonly used by wrappers. // For this reason, try to load it *only* from the application directory, and not system32. @@ -155,7 +155,7 @@ bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock& settings_lock) +void XInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) { } diff --git a/src/util/xinput_source.h b/src/util/xinput_source.h index cc9d9310a..dd087d56e 100644 --- a/src/util/xinput_source.h +++ b/src/util/xinput_source.h @@ -35,8 +35,8 @@ public: XInputSource(); ~XInputSource(); - bool Initialize(SettingsInterface& si, std::unique_lock& settings_lock) override; - void UpdateSettings(SettingsInterface& si, std::unique_lock& settings_lock) override; + bool Initialize(const SettingsInterface& si, std::unique_lock& settings_lock) override; + void UpdateSettings(const SettingsInterface& si, std::unique_lock& settings_lock) override; bool ReloadDevices() override; void Shutdown() override;