diff --git a/src/input/input_handler.cpp b/src/input/input_handler.cpp index 00523ce0b..eea3d2169 100644 --- a/src/input/input_handler.cpp +++ b/src/input/input_handler.cpp @@ -412,7 +412,7 @@ void ParseInputConfig(const std::string game_id = "") { u32 GetMouseWheelEvent(const SDL_Event& event) { if (event.type != SDL_EVENT_MOUSE_WHEEL && event.type != SDL_EVENT_MOUSE_WHEEL_OFF) { LOG_WARNING(Input, "Something went wrong with wheel input parsing!"); - return SDL_INVALID_ID; + return SDL_UNMAPPED; } if (event.wheel.y > 0) { return SDL_MOUSE_WHEEL_UP; @@ -423,7 +423,7 @@ u32 GetMouseWheelEvent(const SDL_Event& event) { } else if (event.wheel.x < 0) { return SDL_MOUSE_WHEEL_LEFT; } - return SDL_INVALID_ID; + return SDL_UNMAPPED; } InputEvent InputBinding::GetInputEventFromSDLEvent(const SDL_Event& e) { @@ -574,7 +574,7 @@ void ControllerOutput::FinalizeUpdate() { bool UpdatePressedKeys(InputEvent event) { // Skip invalid inputs InputID input = event.input; - if (input.sdl_id == SDL_INVALID_ID) { + if (input.sdl_id == SDL_UNMAPPED) { return false; } if (input.type == InputType::Axis) { diff --git a/src/input/input_handler.h b/src/input/input_handler.h index 313aafd1c..156918635 100644 --- a/src/input/input_handler.h +++ b/src/input/input_handler.h @@ -32,7 +32,7 @@ #define KEY_TOGGLE 0x00200000 -#define SDL_INVALID_ID UINT32_MAX +#define SDL_UNMAPPED UINT32_MAX - 1 namespace Input { using Input::Axis; @@ -51,7 +51,7 @@ class InputID { public: InputType type; u32 sdl_id; - InputID(InputType d = InputType::Count, u32 i = SDL_INVALID_ID) : type(d), sdl_id(i) {} + InputID(InputType d = InputType::Count, u32 i = SDL_UNMAPPED) : type(d), sdl_id(i) {} bool operator==(const InputID& o) const { return type == o.type && sdl_id == o.sdl_id; } @@ -259,6 +259,7 @@ const std::map string_to_keyboard_key_map = { {"mousewheeldown", SDL_MOUSE_WHEEL_DOWN}, {"mousewheelleft", SDL_MOUSE_WHEEL_LEFT}, {"mousewheelright", SDL_MOUSE_WHEEL_RIGHT}, + {"unmapped", SDL_UNMAPPED}, }; void ParseInputConfig(const std::string game_id);