Misc: Pass SettingsInterface by const reference
This commit is contained in:
parent
60f6ee3055
commit
0d3501d435
|
@ -894,7 +894,7 @@ const Controller::ControllerInfo AnalogController::INFO = {ControllerType::Analo
|
||||||
s_settings,
|
s_settings,
|
||||||
Controller::VibrationCapabilities::LargeSmallMotors};
|
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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
m_force_analog_on_reset = si.GetBoolValue(section, "ForceAnalogOnReset", true);
|
m_force_analog_on_reset = si.GetBoolValue(section, "ForceAnalogOnReset", true);
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
void ResetTransferState() override;
|
void ResetTransferState() override;
|
||||||
bool Transfer(const u8 data_in, u8* data_out) 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:
|
private:
|
||||||
using MotorState = std::array<u8, NUM_MOTORS>;
|
using MotorState = std::array<u8, NUM_MOTORS>;
|
||||||
|
|
|
@ -414,7 +414,7 @@ const Controller::ControllerInfo AnalogJoystick::INFO = {ControllerType::AnalogJ
|
||||||
s_settings,
|
s_settings,
|
||||||
Controller::VibrationCapabilities::NoVibration};
|
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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
m_analog_deadzone = std::clamp(si.GetFloatValue(section, "AnalogDeadzone", DEFAULT_STICK_DEADZONE), 0.0f, 1.0f);
|
m_analog_deadzone = std::clamp(si.GetFloatValue(section, "AnalogDeadzone", DEFAULT_STICK_DEADZONE), 0.0f, 1.0f);
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
void ResetTransferState() override;
|
void ResetTransferState() override;
|
||||||
bool Transfer(const u8 data_in, u8* data_out) 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:
|
private:
|
||||||
enum class TransferState : u8
|
enum class TransferState : u8
|
||||||
|
|
|
@ -106,7 +106,7 @@ u32 Controller::GetInputOverlayIconColor() const
|
||||||
return 0xFFFFFFFFu;
|
return 0xFFFFFFFFu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::LoadSettings(SettingsInterface& si, const char* section, bool initial)
|
void Controller::LoadSettings(const SettingsInterface& si, const char* section, bool initial)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
virtual u32 GetInputOverlayIconColor() const;
|
virtual u32 GetInputOverlayIconColor() const;
|
||||||
|
|
||||||
/// Loads/refreshes any per-controller settings.
|
/// 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.
|
/// Creates a new controller of the specified type.
|
||||||
static std::unique_ptr<Controller> Create(ControllerType type, u32 index);
|
static std::unique_ptr<Controller> Create(ControllerType type, u32 index);
|
||||||
|
|
|
@ -307,7 +307,7 @@ const Controller::ControllerInfo GunCon::INFO = {
|
||||||
ControllerType::GunCon, "GunCon", TRANSLATE_NOOP("ControllerType", "GunCon"), ICON_PF_LIGHT_GUN,
|
ControllerType::GunCon, "GunCon", TRANSLATE_NOOP("ControllerType", "GunCon"), ICON_PF_LIGHT_GUN,
|
||||||
s_binding_info, s_settings, Controller::VibrationCapabilities::NoVibration};
|
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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
bool DoState(StateWrapper& sw, bool apply_input_state) 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;
|
float GetBindState(u32 index) const override;
|
||||||
void SetBindState(u32 index, float value) override;
|
void SetBindState(u32 index, float value) override;
|
||||||
|
|
|
@ -396,7 +396,7 @@ const Controller::ControllerInfo Justifier::INFO = {ControllerType::Justifier,
|
||||||
s_settings,
|
s_settings,
|
||||||
Controller::VibrationCapabilities::NoVibration};
|
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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
bool DoState(StateWrapper& sw, bool apply_input_state) 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;
|
float GetBindState(u32 index) const override;
|
||||||
void SetBindState(u32 index, float value) override;
|
void SetBindState(u32 index, float value) override;
|
||||||
|
|
|
@ -345,7 +345,7 @@ const Controller::ControllerInfo NeGcon::INFO = {
|
||||||
ControllerType::NeGcon, "NeGcon", TRANSLATE_NOOP("ControllerType", "NeGcon"), ICON_PF_GAMEPAD,
|
ControllerType::NeGcon, "NeGcon", TRANSLATE_NOOP("ControllerType", "NeGcon"), ICON_PF_GAMEPAD,
|
||||||
s_binding_info, s_settings, Controller::VibrationCapabilities::NoVibration};
|
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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
m_steering_modifier = {
|
m_steering_modifier = {
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
u32 GetButtonStateBits() const override;
|
u32 GetButtonStateBits() const override;
|
||||||
std::optional<u32> GetAnalogInputBytes() const override;
|
std::optional<u32> 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:
|
private:
|
||||||
enum class TransferState : u8
|
enum class TransferState : u8
|
||||||
|
|
|
@ -777,7 +777,7 @@ const Controller::ControllerInfo NeGconRumble::INFO = {ControllerType::NeGconRum
|
||||||
s_settings,
|
s_settings,
|
||||||
Controller::VibrationCapabilities::LargeSmallMotors};
|
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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
m_steering_deadzone = si.GetFloatValue(section, "SteeringDeadzone", 0.10f);
|
m_steering_deadzone = si.GetFloatValue(section, "SteeringDeadzone", 0.10f);
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
u32 GetButtonStateBits() const override;
|
u32 GetButtonStateBits() const override;
|
||||||
std::optional<u32> GetAnalogInputBytes() const override;
|
std::optional<u32> 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:
|
private:
|
||||||
using MotorState = std::array<u8, NUM_MOTORS>;
|
using MotorState = std::array<u8, NUM_MOTORS>;
|
||||||
|
|
|
@ -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);
|
Controller::LoadSettings(si, section, initial);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
void ResetTransferState() override;
|
void ResetTransferState() override;
|
||||||
bool Transfer(const u8 data_in, u8* data_out) 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:
|
private:
|
||||||
enum class TransferState : u8
|
enum class TransferState : u8
|
||||||
|
|
|
@ -146,7 +146,7 @@ void Settings::UpdateOverclockActive()
|
||||||
cpu_overclock_active = (cpu_overclock_enable && (cpu_overclock_numerator != 1 || cpu_overclock_denominator != 1));
|
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 =
|
region =
|
||||||
ParseConsoleRegionName(
|
ParseConsoleRegionName(
|
||||||
|
|
|
@ -368,7 +368,7 @@ struct Settings
|
||||||
DEFAULT_GPU_MAX_RUN_AHEAD = 128,
|
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;
|
void Save(SettingsInterface& si, bool ignore_base) const;
|
||||||
static void Clear(SettingsInterface& si);
|
static void Clear(SettingsInterface& si);
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,7 @@ void IdlePollUpdate();
|
||||||
|
|
||||||
namespace Host {
|
namespace Host {
|
||||||
/// Called with the settings lock held, when system settings are being loaded (should load input sources, etc).
|
/// Called with the settings lock held, when system settings are being loaded (should load input sources, etc).
|
||||||
void LoadSettings(SettingsInterface& si, std::unique_lock<std::mutex>& lock);
|
void LoadSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& lock);
|
||||||
|
|
||||||
/// Called after settings are updated.
|
/// Called after settings are updated.
|
||||||
void CheckForSettingsChanges(const Settings& old_settings);
|
void CheckForSettingsChanges(const Settings& old_settings);
|
||||||
|
|
|
@ -615,14 +615,8 @@ bool QtHost::SetDataDirectory()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::LoadSettings(SettingsInterface& si, std::unique_lock<std::mutex>& lock)
|
void Host::LoadSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& lock)
|
||||||
{
|
{
|
||||||
g_emu_thread->loadSettings(si);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuThread::loadSettings(SettingsInterface& si)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::checkForSettingsChanges(const Settings& old_settings)
|
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));
|
emit g_emu_thread->debuggerMessageReported(QString::fromUtf8(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::AddFixedInputBindings(SettingsInterface& si)
|
void Host::AddFixedInputBindings(const SettingsInterface& si)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ public:
|
||||||
void wakeThread();
|
void wakeThread();
|
||||||
|
|
||||||
bool shouldRenderToMain() const;
|
bool shouldRenderToMain() const;
|
||||||
void loadSettings(SettingsInterface& si);
|
|
||||||
void checkForSettingsChanges(const Settings& old_settings);
|
void checkForSettingsChanges(const Settings& old_settings);
|
||||||
|
|
||||||
void bootOrLoadState(std::string path);
|
void bootOrLoadState(std::string path);
|
||||||
|
|
|
@ -204,7 +204,7 @@ SmallString Host::TranslatePluralToSmallString(const char* context, const char*
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::LoadSettings(SettingsInterface& si, std::unique_lock<std::mutex>& lock)
|
void Host::LoadSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& lock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::AddFixedInputBindings(SettingsInterface& si)
|
void Host::AddFixedInputBindings(const SettingsInterface& si)
|
||||||
{
|
{
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ AudioStream::DeviceInfo::DeviceInfo(std::string name_, std::string display_name_
|
||||||
|
|
||||||
AudioStream::DeviceInfo::~DeviceInfo() = default;
|
AudioStream::DeviceInfo::~DeviceInfo() = default;
|
||||||
|
|
||||||
void AudioStreamParameters::Load(SettingsInterface& si, const char* section)
|
void AudioStreamParameters::Load(const SettingsInterface& si, const char* section)
|
||||||
{
|
{
|
||||||
stretch_mode =
|
stretch_mode =
|
||||||
AudioStream::ParseStretchMode(
|
AudioStream::ParseStretchMode(
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct AudioStreamParameters
|
||||||
static constexpr bool DEFAULT_STRETCH_USE_QUICKSEEK = false;
|
static constexpr bool DEFAULT_STRETCH_USE_QUICKSEEK = false;
|
||||||
static constexpr bool DEFAULT_STRETCH_USE_AA_FILTER = 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 Save(SettingsInterface& si, const char* section) const;
|
||||||
void Clear(SettingsInterface& si, const char* section);
|
void Clear(SettingsInterface& si, const char* section);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ std::string DInputSource::GetDeviceIdentifier(u32 index)
|
||||||
static constexpr std::array<const char*, DInputSource::NUM_HAT_DIRECTIONS> s_hat_directions = {
|
static constexpr std::array<const char*, DInputSource::NUM_HAT_DIRECTIONS> s_hat_directions = {
|
||||||
{"Up", "Down", "Left", "Right"}};
|
{"Up", "Down", "Left", "Right"}};
|
||||||
|
|
||||||
bool DInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
bool DInputSource::Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
m_dinput_module = LoadLibraryW(L"dinput8");
|
m_dinput_module = LoadLibraryW(L"dinput8");
|
||||||
if (!m_dinput_module)
|
if (!m_dinput_module)
|
||||||
|
@ -103,7 +103,7 @@ bool DInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
void DInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ public:
|
||||||
DInputSource();
|
DInputSource();
|
||||||
~DInputSource() override;
|
~DInputSource() override;
|
||||||
|
|
||||||
bool Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
bool Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
void UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
void UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
bool ReloadDevices() override;
|
bool ReloadDevices() override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,8 @@ static void UpdatePointerCount();
|
||||||
static bool IsAxisHandler(const InputEventHandler& handler);
|
static bool IsAxisHandler(const InputEventHandler& handler);
|
||||||
static float ApplySingleBindingScale(float sensitivity, float deadzone, float value);
|
static float ApplySingleBindingScale(float sensitivity, float deadzone, float value);
|
||||||
|
|
||||||
static void AddHotkeyBindings(SettingsInterface& si);
|
static void AddHotkeyBindings(const SettingsInterface& si);
|
||||||
static void AddPadBindings(SettingsInterface& si, const std::string& section, u32 pad,
|
static void AddPadBindings(const SettingsInterface& si, const std::string& section, u32 pad,
|
||||||
const Controller::ControllerInfo* cinfo);
|
const Controller::ControllerInfo* cinfo);
|
||||||
static void UpdateContinuedVibration();
|
static void UpdateContinuedVibration();
|
||||||
static void GenerateRelativeMouseEvents();
|
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 PreprocessEvent(InputBindingKey key, float value, GenericInputBinding generic_key);
|
||||||
static bool ProcessEvent(InputBindingKey key, float value, bool skip_button_handlers);
|
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);
|
const Controller::ControllerInfo* cinfo);
|
||||||
static void ApplyMacroButton(u32 pad, const MacroButton& mb);
|
static void ApplyMacroButton(u32 pad, const MacroButton& mb);
|
||||||
static void UpdateMacroButtons();
|
static void UpdateMacroButtons();
|
||||||
|
|
||||||
static void UpdateInputSourceState(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
|
static void UpdateInputSourceState(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
|
||||||
InputSourceType type, std::unique_ptr<InputSource> (*factory_function)());
|
InputSourceType type, std::unique_ptr<InputSource> (*factory_function)());
|
||||||
} // namespace InputManager
|
} // namespace InputManager
|
||||||
|
|
||||||
|
@ -809,7 +809,7 @@ std::vector<const HotkeyInfo*> InputManager::GetHotkeyList()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::AddHotkeyBindings(SettingsInterface& si)
|
void InputManager::AddHotkeyBindings(const SettingsInterface& si)
|
||||||
{
|
{
|
||||||
for (const HotkeyInfo* hotkey_list : s_hotkey_list)
|
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)
|
const Controller::ControllerInfo* cinfo)
|
||||||
{
|
{
|
||||||
for (const Controller::ControllerBindingInfo& bi : cinfo->bindings)
|
for (const Controller::ControllerBindingInfo& bi : cinfo->bindings)
|
||||||
|
@ -1669,7 +1669,7 @@ void InputManager::UpdateContinuedVibration()
|
||||||
// Macros
|
// 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)
|
const Controller::ControllerInfo* cinfo)
|
||||||
{
|
{
|
||||||
s_macro_buttons[pad] = {};
|
s_macro_buttons[pad] = {};
|
||||||
|
@ -1816,7 +1816,7 @@ bool InputManager::DoEventHook(InputBindingKey key, float value)
|
||||||
// Binding Updater
|
// 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();
|
PauseVibration();
|
||||||
|
|
||||||
|
@ -2002,7 +2002,7 @@ GenericInputBindingMapping InputManager::GetGenericBindingMapping(std::string_vi
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputManager::IsInputSourceEnabled(SettingsInterface& si, InputSourceType type)
|
bool InputManager::IsInputSourceEnabled(const SettingsInterface& si, InputSourceType type)
|
||||||
{
|
{
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
// Force Android source to always be enabled so nobody accidentally breaks it via ini.
|
// 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));
|
return si.GetBoolValue("InputSources", InputManager::InputSourceToString(type), GetInputSourceDefaultEnabled(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::UpdateInputSourceState(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
|
void InputManager::UpdateInputSourceState(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
|
||||||
InputSourceType type, std::unique_ptr<InputSource> (*factory_function)())
|
InputSourceType type, std::unique_ptr<InputSource> (*factory_function)())
|
||||||
{
|
{
|
||||||
const bool enabled = IsInputSourceEnabled(si, type);
|
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<std::mutex>& settings_lock)
|
void InputManager::ReloadSources(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
UpdateInputSourceState(si, settings_lock, InputSourceType::DInput, &InputSource::CreateDInputSource);
|
UpdateInputSourceState(si, settings_lock, InputSourceType::DInput, &InputSource::CreateDInputSource);
|
||||||
|
|
|
@ -251,13 +251,13 @@ std::vector<InputBindingKey> EnumerateMotors();
|
||||||
GenericInputBindingMapping GetGenericBindingMapping(std::string_view device);
|
GenericInputBindingMapping GetGenericBindingMapping(std::string_view device);
|
||||||
|
|
||||||
/// Returns true if the specified input source is enabled.
|
/// 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.
|
/// 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.
|
/// Re-parses the sources part of the config and initializes any backends.
|
||||||
void ReloadSources(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock);
|
void ReloadSources(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock);
|
||||||
|
|
||||||
/// Called when a device change is triggered by the system (DBT_DEVNODES_CHANGED on Windows).
|
/// Called when a device change is triggered by the system (DBT_DEVNODES_CHANGED on Windows).
|
||||||
/// Returns true if any device changes are detected.
|
/// Returns true if any device changes are detected.
|
||||||
|
@ -364,7 +364,7 @@ void OnInputDeviceDisconnected(InputBindingKey key, std::string_view identifier)
|
||||||
|
|
||||||
namespace Host {
|
namespace Host {
|
||||||
/// Adds any fixed bindings from the 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.
|
/// Called when a new input device is connected.
|
||||||
void OnInputDeviceConnected(std::string_view identifier, std::string_view device_name);
|
void OnInputDeviceConnected(std::string_view identifier, std::string_view device_name);
|
||||||
|
|
|
@ -22,8 +22,8 @@ public:
|
||||||
InputSource();
|
InputSource();
|
||||||
virtual ~InputSource();
|
virtual ~InputSource();
|
||||||
|
|
||||||
virtual bool Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) = 0;
|
virtual bool Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) = 0;
|
||||||
virtual void UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) = 0;
|
virtual void UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) = 0;
|
||||||
virtual bool ReloadDevices() = 0;
|
virtual bool ReloadDevices() = 0;
|
||||||
virtual void Shutdown() = 0;
|
virtual void Shutdown() = 0;
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ SDLInputSource::~SDLInputSource()
|
||||||
Assert(m_controllers.empty());
|
Assert(m_controllers.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDLInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
bool SDLInputSource::Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
LoadSettings(si);
|
LoadSettings(si);
|
||||||
settings_lock.unlock();
|
settings_lock.unlock();
|
||||||
|
@ -171,7 +171,7 @@ bool SDLInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mut
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
void SDLInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
const bool old_controller_enhanced_mode = m_controller_enhanced_mode;
|
const bool old_controller_enhanced_mode = m_controller_enhanced_mode;
|
||||||
const bool old_controller_ps5_player_led = m_controller_ps5_player_led;
|
const bool old_controller_ps5_player_led = m_controller_ps5_player_led;
|
||||||
|
@ -213,7 +213,7 @@ void SDLInputSource::Shutdown()
|
||||||
ShutdownSubsystem();
|
ShutdownSubsystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLInputSource::LoadSettings(SettingsInterface& si)
|
void SDLInputSource::LoadSettings(const SettingsInterface& si)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < MAX_LED_COLORS; i++)
|
for (u32 i = 0; i < MAX_LED_COLORS; i++)
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,7 @@ void SDLInputSource::LoadSettings(SettingsInterface& si)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 SDLInputSource::GetRGBForPlayerId(SettingsInterface& si, u32 player_id)
|
u32 SDLInputSource::GetRGBForPlayerId(const SettingsInterface& si, u32 player_id)
|
||||||
{
|
{
|
||||||
return ParseRGBForPlayerId(
|
return ParseRGBForPlayerId(
|
||||||
si.GetStringValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str(), s_sdl_default_led_colors[player_id]),
|
si.GetStringValue("SDLExtra", fmt::format("Player{}LED", player_id).c_str(), s_sdl_default_led_colors[player_id]),
|
||||||
|
|
|
@ -21,8 +21,8 @@ public:
|
||||||
SDLInputSource();
|
SDLInputSource();
|
||||||
~SDLInputSource();
|
~SDLInputSource();
|
||||||
|
|
||||||
bool Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
bool Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
void UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
void UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
bool ReloadDevices() override;
|
bool ReloadDevices() override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
SDL_Joystick* GetJoystickForDevice(std::string_view device);
|
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 u32 ParseRGBForPlayerId(std::string_view str, u32 player_id);
|
||||||
|
|
||||||
static bool IsHandledInputEvent(const SDL_Event* ev);
|
static bool IsHandledInputEvent(const SDL_Event* ev);
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
|
|
||||||
bool InitializeSubsystem();
|
bool InitializeSubsystem();
|
||||||
void ShutdownSubsystem();
|
void ShutdownSubsystem();
|
||||||
void LoadSettings(SettingsInterface& si);
|
void LoadSettings(const SettingsInterface& si);
|
||||||
void SetHints();
|
void SetHints();
|
||||||
|
|
||||||
ControllerDataVector::iterator GetControllerDataForJoystickId(int id);
|
ControllerDataVector::iterator GetControllerDataForJoystickId(int id);
|
||||||
|
|
|
@ -29,7 +29,7 @@ Win32RawInputSource::Win32RawInputSource() = default;
|
||||||
|
|
||||||
Win32RawInputSource::~Win32RawInputSource() = default;
|
Win32RawInputSource::~Win32RawInputSource() = default;
|
||||||
|
|
||||||
bool Win32RawInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
bool Win32RawInputSource::Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
if (!RegisterDummyClass())
|
if (!RegisterDummyClass())
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ bool Win32RawInputSource::Initialize(SettingsInterface& si, std::unique_lock<std
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win32RawInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
void Win32RawInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ public:
|
||||||
Win32RawInputSource();
|
Win32RawInputSource();
|
||||||
~Win32RawInputSource();
|
~Win32RawInputSource();
|
||||||
|
|
||||||
bool Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
bool Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
void UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
void UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
bool ReloadDevices() override;
|
bool ReloadDevices() override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ XInputSource::XInputSource() = default;
|
||||||
|
|
||||||
XInputSource::~XInputSource() = default;
|
XInputSource::~XInputSource() = default;
|
||||||
|
|
||||||
bool XInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
bool XInputSource::Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
// xinput1_3.dll is flawed and obsolete, but it's also commonly used by wrappers.
|
// 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.
|
// 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<std::mutex
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
void XInputSource::UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ public:
|
||||||
XInputSource();
|
XInputSource();
|
||||||
~XInputSource();
|
~XInputSource();
|
||||||
|
|
||||||
bool Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
bool Initialize(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
void UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
void UpdateSettings(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
|
||||||
bool ReloadDevices() override;
|
bool ReloadDevices() override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue