mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 08:52:36 +00:00
Make the code less const incorrect
This commit is contained in:
parent
9c1326f003
commit
d621eb7222
@ -94,7 +94,7 @@ auto output_array = std::array{
|
||||
};
|
||||
|
||||
// parsing related functions
|
||||
u32 GetAxisInputId(AxisMapping a) {
|
||||
u32 GetAxisInputId(const AxisMapping a) {
|
||||
// LOG_INFO(Input, "Parsing an axis...");
|
||||
if (a.axis == Axis::AxisMax || a.value != 0) {
|
||||
LOG_ERROR(Input, "Invalid axis given!");
|
||||
@ -104,7 +104,7 @@ u32 GetAxisInputId(AxisMapping a) {
|
||||
return value;
|
||||
}
|
||||
|
||||
u32 GetOrbisToSdlButtonKeycode(OrbisPadButtonDataOffset cbutton) {
|
||||
u32 GetOrbisToSdlButtonKeycode(const OrbisPadButtonDataOffset cbutton) {
|
||||
switch (cbutton) {
|
||||
case OrbisPadButtonDataOffset::Circle:
|
||||
return SDL_GAMEPAD_BUTTON_EAST;
|
||||
@ -139,7 +139,7 @@ u32 GetOrbisToSdlButtonKeycode(OrbisPadButtonDataOffset cbutton) {
|
||||
return ((u32)-1) - 0x10000000;
|
||||
}
|
||||
}
|
||||
u32 GetControllerButtonInputId(u32 cbutton) {
|
||||
u32 GetControllerButtonInputId(const u32 cbutton) {
|
||||
if ((cbutton & ((u32)OrbisPadButtonDataOffset::TouchPad | LEFTJOYSTICK_HALFMODE |
|
||||
RIGHTJOYSTICK_HALFMODE)) != 0) {
|
||||
return (u32)-1;
|
||||
@ -148,7 +148,7 @@ u32 GetControllerButtonInputId(u32 cbutton) {
|
||||
}
|
||||
|
||||
// syntax: 'name, name,name' or 'name,name' or 'name'
|
||||
InputBinding GetBindingFromString(std::string& line) {
|
||||
InputBinding GetBindingFromString(const std::string& line) {
|
||||
std::array<InputID, 3> keys = {InputID(), InputID(), InputID()};
|
||||
|
||||
// Check and process tokens
|
||||
@ -367,7 +367,7 @@ void ControllerOutput::SetControllerOutputController(GameController* c) {
|
||||
ControllerOutput::controller = c;
|
||||
}
|
||||
|
||||
void ToggleKeyInList(InputID input) {
|
||||
void ToggleKeyInList(const InputID input) {
|
||||
if (input.type == InputType::Axis) {
|
||||
LOG_ERROR(Input, "Toggling analog inputs is not supported!");
|
||||
return;
|
||||
@ -387,7 +387,7 @@ void ControllerOutput::ResetUpdate() {
|
||||
new_button_state = false;
|
||||
new_param = 0;
|
||||
}
|
||||
void ControllerOutput::AddUpdate(InputEvent event) {
|
||||
void ControllerOutput::AddUpdate(const InputEvent event) {
|
||||
state_changed = true;
|
||||
if ((u32)button == KEY_TOGGLE) {
|
||||
if (event.active) {
|
||||
@ -475,7 +475,7 @@ void ControllerOutput::FinalizeUpdate() {
|
||||
|
||||
// Updates the list of pressed keys with the given input.
|
||||
// Returns whether the list was updated or not.
|
||||
bool UpdatePressedKeys(InputEvent event) {
|
||||
bool UpdatePressedKeys(const InputEvent event) {
|
||||
// Skip invalid inputs
|
||||
InputID input = event.input;
|
||||
if (input.sdl_id == (u32)-1) {
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
bool IsValid() const {
|
||||
return *this != InputID();
|
||||
}
|
||||
std::string ToString() {
|
||||
std::string ToString() const {
|
||||
return fmt::format("({}: {:x})", (u8)type, sdl_id);
|
||||
}
|
||||
};
|
||||
@ -297,10 +297,10 @@ public:
|
||||
bool operator<(const InputBinding& other) const {
|
||||
return KeyCount() > other.KeyCount();
|
||||
}
|
||||
inline bool IsEmpty() {
|
||||
inline bool IsEmpty() const {
|
||||
return !(keys[0].IsValid() || keys[1].IsValid() || keys[2].IsValid());
|
||||
}
|
||||
std::string ToString() { // todo add device type
|
||||
std::string ToString() const { // todo add device type
|
||||
return fmt::format("({:X}, {:X}, {:X})", keys[0].sdl_id, keys[1].sdl_id, keys[2].sdl_id);
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,11 @@ void ToggleMouseEnabled() {
|
||||
mouse_enabled = !mouse_enabled;
|
||||
}
|
||||
|
||||
void SetMouseToJoystick(int joystick) {
|
||||
void SetMouseToJoystick(const int joystick) {
|
||||
mouse_joystick_binding = joystick;
|
||||
}
|
||||
|
||||
void SetMouseParams(float mdo, float ms, float mso) {
|
||||
void SetMouseParams(const float mdo, const float ms, const float mso) {
|
||||
mouse_deadzone_offset = mdo;
|
||||
mouse_speed = ms;
|
||||
mouse_speed_offset = mso;
|
||||
|
@ -9,8 +9,8 @@
|
||||
namespace Input {
|
||||
|
||||
void ToggleMouseEnabled();
|
||||
void SetMouseToJoystick(int joystick);
|
||||
void SetMouseParams(float mouse_deadzone_offset, float mouse_speed, float mouse_speed_offset);
|
||||
void SetMouseToJoystick(const int joystick);
|
||||
void SetMouseParams(const float mouse_deadzone_offset, const float mouse_speed, const float mouse_speed_offset);
|
||||
|
||||
// Polls the mouse for changes, and simulates joystick movement from it.
|
||||
Uint32 MousePolling(void* param, Uint32 id, Uint32 interval);
|
||||
|
Loading…
Reference in New Issue
Block a user