diff options
Diffstat (limited to '')
-rw-r--r-- | src/input_common/drivers/gc_adapter.cpp | 2 | ||||
-rw-r--r-- | src/input_common/drivers/keyboard.cpp | 6 | ||||
-rw-r--r-- | src/input_common/drivers/mouse.cpp | 2 | ||||
-rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 28 | ||||
-rw-r--r-- | src/input_common/drivers/touch_screen.cpp | 2 | ||||
-rw-r--r-- | src/input_common/drivers/udp_client.cpp | 33 | ||||
-rw-r--r-- | src/input_common/drivers/udp_client.h | 8 | ||||
-rw-r--r-- | src/input_common/helpers/stick_from_buttons.cpp | 30 | ||||
-rw-r--r-- | src/input_common/helpers/touch_from_buttons.cpp | 1 | ||||
-rw-r--r-- | src/input_common/input_engine.cpp | 18 | ||||
-rw-r--r-- | src/input_common/input_engine.h | 22 | ||||
-rw-r--r-- | src/input_common/input_mapping.cpp | 6 | ||||
-rw-r--r-- | src/input_common/input_poller.cpp | 4 |
13 files changed, 94 insertions, 68 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index 7ab4540a8..155caae42 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp @@ -248,7 +248,7 @@ bool GCAdapter::Setup() { std::size_t port = 0; for (GCController& pad : pads) { pad.identifier = { - .guid = Common::UUID{Common::INVALID_UUID}, + .guid = Common::UUID{}, .port = port++, .pad = 0, }; diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp index 4c1e5bbec..59e3d9cc0 100644 --- a/src/input_common/drivers/keyboard.cpp +++ b/src/input_common/drivers/keyboard.cpp @@ -9,17 +9,17 @@ namespace InputCommon { constexpr PadIdentifier key_identifier = { - .guid = Common::UUID{Common::INVALID_UUID}, + .guid = Common::UUID{}, .port = 0, .pad = 0, }; constexpr PadIdentifier keyboard_key_identifier = { - .guid = Common::UUID{Common::INVALID_UUID}, + .guid = Common::UUID{}, .port = 1, .pad = 0, }; constexpr PadIdentifier keyboard_modifier_identifier = { - .guid = Common::UUID{Common::INVALID_UUID}, + .guid = Common::UUID{}, .port = 1, .pad = 1, }; diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index d8ae7f0c1..3c9a4e747 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -20,7 +20,7 @@ constexpr int motion_wheel_y = 4; constexpr int touch_axis_x = 10; constexpr int touch_axis_y = 11; constexpr PadIdentifier identifier = { - .guid = Common::UUID{Common::INVALID_UUID}, + .guid = Common::UUID{}, .port = 0, .pad = 0, }; diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 577bf5c31..c17ea305e 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -175,23 +175,23 @@ public: return false; } - BatteryLevel GetBatteryLevel() { + Common::Input::BatteryLevel GetBatteryLevel() { const auto level = SDL_JoystickCurrentPowerLevel(sdl_joystick.get()); switch (level) { case SDL_JOYSTICK_POWER_EMPTY: - return BatteryLevel::Empty; + return Common::Input::BatteryLevel::Empty; case SDL_JOYSTICK_POWER_LOW: - return BatteryLevel::Critical; + return Common::Input::BatteryLevel::Low; case SDL_JOYSTICK_POWER_MEDIUM: - return BatteryLevel::Low; + return Common::Input::BatteryLevel::Medium; case SDL_JOYSTICK_POWER_FULL: - return BatteryLevel::Medium; case SDL_JOYSTICK_POWER_MAX: - return BatteryLevel::Full; - case SDL_JOYSTICK_POWER_UNKNOWN: + return Common::Input::BatteryLevel::Full; case SDL_JOYSTICK_POWER_WIRED: + return Common::Input::BatteryLevel::Charging; + case SDL_JOYSTICK_POWER_UNKNOWN: default: - return BatteryLevel::Charging; + return Common::Input::BatteryLevel::None; } } @@ -352,6 +352,8 @@ void SDLDriver::HandleGameControllerEvent(const SDL_Event& event) { if (const auto joystick = GetSDLJoystickBySDLID(event.jbutton.which)) { const PadIdentifier identifier = joystick->GetPadIdentifier(); SetButton(identifier, event.jbutton.button, true); + // Battery doesn't trigger an event so just update every button press + SetBattery(identifier, joystick->GetBatteryLevel()); } break; } @@ -503,7 +505,7 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const { Common::Input::VibrationError SDLDriver::SetRumble( const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) { const auto joystick = - GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port)); + GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port)); const auto process_amplitude_exp = [](f32 amplitude, f32 factor) { return (amplitude + std::pow(amplitude, factor)) * 0.5f * 0xFFFF; }; @@ -600,7 +602,7 @@ Common::ParamPackage SDLDriver::BuildParamPackageForAnalog(PadIdentifier identif Common::ParamPackage params; params.Set("engine", GetEngineName()); params.Set("port", static_cast<int>(identifier.port)); - params.Set("guid", identifier.guid.Format()); + params.Set("guid", identifier.guid.RawString()); params.Set("axis_x", axis_x); params.Set("axis_y", axis_y); params.Set("offset_x", offset_x); @@ -812,7 +814,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p PreSetAxis(identifier, binding_left_x.value.axis); PreSetAxis(identifier, binding_left_y.value.axis); const auto left_offset_x = -GetAxis(identifier, binding_left_x.value.axis); - const auto left_offset_y = -GetAxis(identifier, binding_left_y.value.axis); + const auto left_offset_y = GetAxis(identifier, binding_left_y.value.axis); mapping.insert_or_assign(Settings::NativeAnalog::LStick, BuildParamPackageForAnalog(identifier, binding_left_x.value.axis, binding_left_y.value.axis, @@ -823,7 +825,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p PreSetAxis(identifier, binding_left_x.value.axis); PreSetAxis(identifier, binding_left_y.value.axis); const auto left_offset_x = -GetAxis(identifier, binding_left_x.value.axis); - const auto left_offset_y = -GetAxis(identifier, binding_left_y.value.axis); + const auto left_offset_y = GetAxis(identifier, binding_left_y.value.axis); mapping.insert_or_assign(Settings::NativeAnalog::LStick, BuildParamPackageForAnalog(identifier, binding_left_x.value.axis, binding_left_y.value.axis, @@ -838,7 +840,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p PreSetAxis(identifier, binding_right_x.value.axis); PreSetAxis(identifier, binding_right_y.value.axis); const auto right_offset_x = -GetAxis(identifier, binding_right_x.value.axis); - const auto right_offset_y = -GetAxis(identifier, binding_right_y.value.axis); + const auto right_offset_y = GetAxis(identifier, binding_right_y.value.axis); mapping.insert_or_assign(Settings::NativeAnalog::RStick, BuildParamPackageForAnalog(identifier, binding_right_x.value.axis, binding_right_y.value.axis, right_offset_x, diff --git a/src/input_common/drivers/touch_screen.cpp b/src/input_common/drivers/touch_screen.cpp index 880781825..30c727df4 100644 --- a/src/input_common/drivers/touch_screen.cpp +++ b/src/input_common/drivers/touch_screen.cpp @@ -8,7 +8,7 @@ namespace InputCommon { constexpr PadIdentifier identifier = { - .guid = Common::UUID{Common::INVALID_UUID}, + .guid = Common::UUID{}, .port = 0, .pad = 0, }; diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index d1cdb1ab2..9780ead10 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp @@ -192,22 +192,22 @@ std::size_t UDPClient::GetClientNumber(std::string_view host, u16 port) const { return MAX_UDP_CLIENTS; } -BatteryLevel UDPClient::GetBatteryLevel(Response::Battery battery) const { +Common::Input::BatteryLevel UDPClient::GetBatteryLevel(Response::Battery battery) const { switch (battery) { case Response::Battery::Dying: - return BatteryLevel::Empty; + return Common::Input::BatteryLevel::Empty; case Response::Battery::Low: - return BatteryLevel::Critical; + return Common::Input::BatteryLevel::Critical; case Response::Battery::Medium: - return BatteryLevel::Low; + return Common::Input::BatteryLevel::Low; case Response::Battery::High: - return BatteryLevel::Medium; + return Common::Input::BatteryLevel::Medium; case Response::Battery::Full: case Response::Battery::Charged: - return BatteryLevel::Full; + return Common::Input::BatteryLevel::Full; case Response::Battery::Charging: default: - return BatteryLevel::Charging; + return Common::Input::BatteryLevel::Charging; } } @@ -271,7 +271,7 @@ void UDPClient::OnPadData(Response::PadData data, std::size_t client) { const auto touch_axis_y_id = static_cast<int>(id == 0 ? PadAxes::Touch1Y : PadAxes::Touch2Y); const auto touch_button_id = - static_cast<int>(id == 0 ? PadButton::Touch1 : PadButton::touch2); + static_cast<int>(id == 0 ? PadButton::Touch1 : PadButton::Touch2); // TODO: Use custom calibration per device const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue()); @@ -319,6 +319,9 @@ void UDPClient::OnPadData(Response::PadData data, std::size_t client) { SetButton(identifier, button, button_status); } + SetButton(identifier, static_cast<int>(PadButton::Home), data.home != 0); + SetButton(identifier, static_cast<int>(PadButton::TouchHardPress), data.touch_hard_press != 0); + SetBattery(identifier, GetBatteryLevel(data.info.battery)); } @@ -350,7 +353,7 @@ PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const { Common::UUID UDPClient::GetHostUUID(const std::string& host) const { const auto ip = boost::asio::ip::make_address_v4(host); - const auto hex_host = fmt::format("{:06x}", ip.to_uint()); + const auto hex_host = fmt::format("00000000-0000-0000-0000-0000{:06x}", ip.to_uint()); return Common::UUID{hex_host}; } @@ -382,7 +385,7 @@ std::vector<Common::ParamPackage> UDPClient::GetInputDevices() const { Common::ParamPackage identifier{}; identifier.Set("engine", GetEngineName()); identifier.Set("display", fmt::format("UDP Controller {}", pad_identifier.pad)); - identifier.Set("guid", pad_identifier.guid.Format()); + identifier.Set("guid", pad_identifier.guid.RawString()); identifier.Set("port", static_cast<int>(pad_identifier.port)); identifier.Set("pad", static_cast<int>(pad_identifier.pad)); devices.emplace_back(identifier); @@ -393,7 +396,7 @@ std::vector<Common::ParamPackage> UDPClient::GetInputDevices() const { ButtonMapping UDPClient::GetButtonMappingForDevice(const Common::ParamPackage& params) { // This list excludes any button that can't be really mapped - static constexpr std::array<std::pair<Settings::NativeButton::Values, PadButton>, 18> + static constexpr std::array<std::pair<Settings::NativeButton::Values, PadButton>, 20> switch_to_dsu_button = { std::pair{Settings::NativeButton::A, PadButton::Circle}, {Settings::NativeButton::B, PadButton::Cross}, @@ -413,6 +416,8 @@ ButtonMapping UDPClient::GetButtonMappingForDevice(const Common::ParamPackage& p {Settings::NativeButton::SR, PadButton::R2}, {Settings::NativeButton::LStick, PadButton::L3}, {Settings::NativeButton::RStick, PadButton::R3}, + {Settings::NativeButton::Home, PadButton::Home}, + {Settings::NativeButton::Screenshot, PadButton::TouchHardPress}, }; if (!params.Has("guid") || !params.Has("port") || !params.Has("pad")) { return {}; @@ -517,6 +522,12 @@ Common::Input::ButtonNames UDPClient::GetUIButtonName(const Common::ParamPackage return Common::Input::ButtonNames::Share; case PadButton::Options: return Common::Input::ButtonNames::Options; + case PadButton::Home: + return Common::Input::ButtonNames::Home; + case PadButton::Touch1: + case PadButton::Touch2: + case PadButton::TouchHardPress: + return Common::Input::ButtonNames::Touch; default: return Common::Input::ButtonNames::Undefined; } diff --git a/src/input_common/drivers/udp_client.h b/src/input_common/drivers/udp_client.h index 30d7c2682..c7cc7d846 100644 --- a/src/input_common/drivers/udp_client.h +++ b/src/input_common/drivers/udp_client.h @@ -84,7 +84,9 @@ private: Cross = 0x4000, Square = 0x8000, Touch1 = 0x10000, - touch2 = 0x20000, + Touch2 = 0x20000, + Home = 0x40000, + TouchHardPress = 0x80000, }; enum class PadAxes : u8 { @@ -124,7 +126,7 @@ private: struct ClientConnection { ClientConnection(); ~ClientConnection(); - Common::UUID uuid{"7F000001"}; + Common::UUID uuid{"00000000-0000-0000-0000-00007F000001"}; std::string host{"127.0.0.1"}; u16 port{26760}; s8 active{-1}; @@ -139,7 +141,7 @@ private: std::size_t GetClientNumber(std::string_view host, u16 port) const; // Translates UDP battery level to input engine battery level - BatteryLevel GetBatteryLevel(Response::Battery battery) const; + Common::Input::BatteryLevel GetBatteryLevel(Response::Battery battery) const; void OnVersion(Response::Version); void OnPortInfo(Response::PortInfo); diff --git a/src/input_common/helpers/stick_from_buttons.cpp b/src/input_common/helpers/stick_from_buttons.cpp index e23394f5f..31e6f62ab 100644 --- a/src/input_common/helpers/stick_from_buttons.cpp +++ b/src/input_common/helpers/stick_from_buttons.cpp @@ -167,12 +167,34 @@ public: } void UpdateModButtonStatus(const Common::Input::CallbackStatus& button_callback) { - modifier_status = button_callback.button_status.value; + const auto& new_status = button_callback.button_status; + const bool new_button_value = new_status.inverted ? !new_status.value : new_status.value; + modifier_status.toggle = new_status.toggle; + + // Update button status with current + if (!modifier_status.toggle) { + modifier_status.locked = false; + if (modifier_status.value != new_button_value) { + modifier_status.value = new_button_value; + } + } else { + // Toggle button and lock status + if (new_button_value && !modifier_status.locked) { + modifier_status.locked = true; + modifier_status.value = !modifier_status.value; + } + + // Unlock button ready for next press + if (!new_button_value && modifier_status.locked) { + modifier_status.locked = false; + } + } + UpdateStatus(); } void UpdateStatus() { - const float coef = modifier_status ? modifier_scale : 1.0f; + const float coef = modifier_status.value ? modifier_scale : 1.0f; bool r = right_status; bool l = left_status; @@ -266,7 +288,7 @@ public: if (down_status) { --y; } - const float coef = modifier_status ? modifier_scale : 1.0f; + const float coef = modifier_status.value ? modifier_scale : 1.0f; status.x.raw_value = static_cast<float>(x) * coef * (y == 0 ? 1.0f : SQRT_HALF); status.y.raw_value = static_cast<float>(y) * coef * (x == 0 ? 1.0f : SQRT_HALF); return status; @@ -287,9 +309,9 @@ private: bool down_status{}; bool left_status{}; bool right_status{}; - bool modifier_status{}; float last_x_axis_value{}; float last_y_axis_value{}; + Common::Input::ButtonStatus modifier_status{}; const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false}; std::chrono::time_point<std::chrono::steady_clock> last_update; }; diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp index ece1e3b32..f1b57d03a 100644 --- a/src/input_common/helpers/touch_from_buttons.cpp +++ b/src/input_common/helpers/touch_from_buttons.cpp @@ -4,7 +4,6 @@ #include <algorithm> #include "common/settings.h" -#include "core/frontend/framebuffer_layout.h" #include "input_common/helpers/touch_from_buttons.h" namespace InputCommon { diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index 0508b408d..7adf7e3d7 100644 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp @@ -70,7 +70,7 @@ void InputEngine::SetAxis(const PadIdentifier& identifier, int axis, f32 value) TriggerOnAxisChange(identifier, axis, value); } -void InputEngine::SetBattery(const PadIdentifier& identifier, BatteryLevel value) { +void InputEngine::SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value) { { std::lock_guard lock{mutex}; ControllerData& controller = controller_list.at(identifier); @@ -96,7 +96,7 @@ bool InputEngine::GetButton(const PadIdentifier& identifier, int button) const { std::lock_guard lock{mutex}; const auto controller_iter = controller_list.find(identifier); if (controller_iter == controller_list.cend()) { - LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.Format(), + LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), identifier.pad, identifier.port); return false; } @@ -113,7 +113,7 @@ bool InputEngine::GetHatButton(const PadIdentifier& identifier, int button, u8 d std::lock_guard lock{mutex}; const auto controller_iter = controller_list.find(identifier); if (controller_iter == controller_list.cend()) { - LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.Format(), + LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), identifier.pad, identifier.port); return false; } @@ -130,7 +130,7 @@ f32 InputEngine::GetAxis(const PadIdentifier& identifier, int axis) const { std::lock_guard lock{mutex}; const auto controller_iter = controller_list.find(identifier); if (controller_iter == controller_list.cend()) { - LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.Format(), + LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), identifier.pad, identifier.port); return 0.0f; } @@ -143,13 +143,13 @@ f32 InputEngine::GetAxis(const PadIdentifier& identifier, int axis) const { return axis_iter->second; } -BatteryLevel InputEngine::GetBattery(const PadIdentifier& identifier) const { +Common::Input::BatteryLevel InputEngine::GetBattery(const PadIdentifier& identifier) const { std::lock_guard lock{mutex}; const auto controller_iter = controller_list.find(identifier); if (controller_iter == controller_list.cend()) { - LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.Format(), + LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), identifier.pad, identifier.port); - return BatteryLevel::Charging; + return Common::Input::BatteryLevel::Charging; } const ControllerData& controller = controller_iter->second; return controller.battery; @@ -159,7 +159,7 @@ BasicMotion InputEngine::GetMotion(const PadIdentifier& identifier, int motion) std::lock_guard lock{mutex}; const auto controller_iter = controller_list.find(identifier); if (controller_iter == controller_list.cend()) { - LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.Format(), + LOG_ERROR(Input, "Invalid identifier guid={}, pad={}, port={}", identifier.guid.RawString(), identifier.pad, identifier.port); return {}; } @@ -270,7 +270,7 @@ void InputEngine::TriggerOnAxisChange(const PadIdentifier& identifier, int axis, } void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier, - [[maybe_unused]] BatteryLevel value) { + [[maybe_unused]] Common::Input::BatteryLevel value) { std::lock_guard lock{mutex_callback}; for (const auto& poller_pair : callback_list) { const InputIdentifier& poller = poller_pair.second; diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index fe2faee5a..f44e0799b 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h @@ -16,7 +16,7 @@ // Pad Identifier of data source struct PadIdentifier { - Common::UUID guid{Common::INVALID_UUID}; + Common::UUID guid{}; std::size_t port{}; std::size_t pad{}; @@ -34,16 +34,6 @@ struct BasicMotion { u64 delta_timestamp{}; }; -// Stages of a battery charge -enum class BatteryLevel { - Empty, - Critical, - Low, - Medium, - Full, - Charging, -}; - // Types of input that are stored in the engine enum class EngineInputType { None, @@ -59,7 +49,7 @@ namespace std { template <> struct hash<PadIdentifier> { size_t operator()(const PadIdentifier& pad_id) const noexcept { - u64 hash_value = pad_id.guid.uuid[1] ^ pad_id.guid.uuid[0]; + u64 hash_value = pad_id.guid.Hash(); hash_value ^= (static_cast<u64>(pad_id.port) << 32); hash_value ^= static_cast<u64>(pad_id.pad); return static_cast<size_t>(hash_value); @@ -178,7 +168,7 @@ public: bool GetButton(const PadIdentifier& identifier, int button) const; bool GetHatButton(const PadIdentifier& identifier, int button, u8 direction) const; f32 GetAxis(const PadIdentifier& identifier, int axis) const; - BatteryLevel GetBattery(const PadIdentifier& identifier) const; + Common::Input::BatteryLevel GetBattery(const PadIdentifier& identifier) const; BasicMotion GetMotion(const PadIdentifier& identifier, int motion) const; int SetCallback(InputIdentifier input_identifier); @@ -189,7 +179,7 @@ protected: void SetButton(const PadIdentifier& identifier, int button, bool value); void SetHatButton(const PadIdentifier& identifier, int button, u8 value); void SetAxis(const PadIdentifier& identifier, int axis, f32 value); - void SetBattery(const PadIdentifier& identifier, BatteryLevel value); + void SetBattery(const PadIdentifier& identifier, Common::Input::BatteryLevel value); void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value); virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const { @@ -202,13 +192,13 @@ private: std::unordered_map<int, u8> hat_buttons; std::unordered_map<int, float> axes; std::unordered_map<int, BasicMotion> motions; - BatteryLevel battery{}; + Common::Input::BatteryLevel battery{}; }; void TriggerOnButtonChange(const PadIdentifier& identifier, int button, bool value); void TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value); void TriggerOnAxisChange(const PadIdentifier& identifier, int axis, f32 value); - void TriggerOnBatteryChange(const PadIdentifier& identifier, BatteryLevel value); + void TriggerOnBatteryChange(const PadIdentifier& identifier, Common::Input::BatteryLevel value); void TriggerOnMotionChange(const PadIdentifier& identifier, int motion, const BasicMotion& value); diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp index a7a6ad8c2..fb78093b8 100644 --- a/src/input_common/input_mapping.cpp +++ b/src/input_common/input_mapping.cpp @@ -57,7 +57,7 @@ void MappingFactory::RegisterButton(const MappingData& data) { Common::ParamPackage new_input; new_input.Set("engine", data.engine); if (data.pad.guid.IsValid()) { - new_input.Set("guid", data.pad.guid.Format()); + new_input.Set("guid", data.pad.guid.RawString()); } new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("pad", static_cast<int>(data.pad.pad)); @@ -93,7 +93,7 @@ void MappingFactory::RegisterStick(const MappingData& data) { Common::ParamPackage new_input; new_input.Set("engine", data.engine); if (data.pad.guid.IsValid()) { - new_input.Set("guid", data.pad.guid.Format()); + new_input.Set("guid", data.pad.guid.RawString()); } new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("pad", static_cast<int>(data.pad.pad)); @@ -138,7 +138,7 @@ void MappingFactory::RegisterMotion(const MappingData& data) { Common::ParamPackage new_input; new_input.Set("engine", data.engine); if (data.pad.guid.IsValid()) { - new_input.Set("guid", data.pad.guid.Format()); + new_input.Set("guid", data.pad.guid.RawString()); } new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("pad", static_cast<int>(data.pad.pad)); diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 2f3c0735a..82b585ff2 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp @@ -181,7 +181,7 @@ public: .raw_value = input_engine->GetAxis(identifier, axis_y), .properties = properties_y, }; - // This is a workaround too keep compatibility with old yuzu versions. Vertical axis is + // This is a workaround to keep compatibility with old yuzu versions. Vertical axis is // inverted on SDL compared to Nintendo if (invert_axis_y) { status.y.raw_value = -status.y.raw_value; @@ -470,7 +470,7 @@ public: } Common::Input::BatteryStatus GetStatus() const { - return static_cast<Common::Input::BatteryLevel>(input_engine->GetBattery(identifier)); + return input_engine->GetBattery(identifier); } void ForceUpdate() override { |