diff --git a/framework/input/gamepad.hpp b/framework/input/gamepad.hpp index 875c711..e5785b8 100644 --- a/framework/input/gamepad.hpp +++ b/framework/input/gamepad.hpp @@ -38,10 +38,12 @@ namespace xna { virtual ButtonState BigButton() const = 0; }; + struct GamePadId; + struct IGamePadCapabilities { virtual GamePadCapabilitiesType GamePadType() const = 0; virtual bool IsConnected() const = 0; - virtual String Id() const = 0; + virtual GamePadId Id() const = 0; virtual Ushort Vid() const = 0; virtual Ushort Pid() const = 0; }; diff --git a/framework/platform/gamepad-dx.hpp b/framework/platform/gamepad-dx.hpp index f758d3d..422216e 100644 --- a/framework/platform/gamepad-dx.hpp +++ b/framework/platform/gamepad-dx.hpp @@ -208,13 +208,23 @@ namespace xna { ButtonState _bigButton{}; }; + struct GamePadId { +#ifdef USING_GAMEINPUT + APP_LOCAL_DEVICE_ID id; +#elif defined(USING_WINDOWS_GAMING_INPUT) + std::wstring id; +#else + uint64_t id; +#endif + }; + struct GamePadCapabilities : public IGamePadCapabilities { constexpr GamePadCapabilities() = default; constexpr GamePadCapabilities(DirectX::GamePad::Capabilities const& capabilities) { _type = static_cast(capabilities.gamepadType); _connected = capabilities.connected; - _id = capabilities.id; + _id.id = capabilities.id; _vid = capabilities.vid; _pid = capabilities.pid; } @@ -227,8 +237,8 @@ namespace xna { return _connected; } - virtual String Id() const override { - return XnaHToString(_id); + virtual GamePadId Id() const override { + return _id; } virtual constexpr Ushort Vid() const override { @@ -242,7 +252,7 @@ namespace xna { private: GamePadCapabilitiesType _type{}; bool _connected{ false }; - std::wstring _id{ 0 }; + GamePadId _id{ 0 }; Ushort _vid{ 0 }; Ushort _pid{ 0 }; };