diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-10-06 10:35:07 +0200 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-11-16 05:33:20 +0100 |
commit | 0a966e2cac40477ffc62f747f7703afbf3bfda2a (patch) | |
tree | 545fe03a72a71aa36ec9f11c8c70039b28c7b01b /src/core/hle/service | |
parent | configure_input_player: Change "Defaults" button behavior (diff) | |
download | yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.tar yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.tar.gz yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.tar.bz2 yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.tar.lz yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.tar.xz yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.tar.zst yuzu-0a966e2cac40477ffc62f747f7703afbf3bfda2a.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 77 |
1 files changed, 50 insertions, 27 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index fd5c5a6eb..8dabae6e3 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -39,28 +39,30 @@ public: // Called when input devices should be loaded void OnLoadInputDevices() override; - struct NPadType { - union { - u32_le raw{}; - - BitField<0, 1, u32> pro_controller; - BitField<1, 1, u32> handheld; - BitField<2, 1, u32> joycon_dual; - BitField<3, 1, u32> joycon_left; - BitField<4, 1, u32> joycon_right; + enum class NPadControllerType { + None, + ProController, + Handheld, + JoyDual, + JoyLeft, + JoyRight, + Pokeball, + }; - BitField<6, 1, u32> pokeball; // TODO(ogniK): Confirm when possible - }; + enum class NpadType : u8 { + ProController = 3, + Handheld = 4, + JoyconDual = 5, + JoyconLeft = 6, + JoyconRight = 7, + Pokeball = 9, }; - static_assert(sizeof(NPadType) == 4, "NPadType is an invalid size"); - struct Vibration { - f32 amp_low; - f32 freq_low; - f32 amp_high; - f32 freq_high; + enum class DeviceIndex : u8 { + Left = 0, + Right = 1, + None = 2, }; - static_assert(sizeof(Vibration) == 0x10, "Vibration is an invalid size"); enum class GyroscopeZeroDriftMode : u32 { Loose = 0, @@ -73,7 +75,7 @@ public: Horizontal = 1, }; - enum class NPadAssignments : u32_le { + enum class NPadAssignments : u32 { Dual = 0, Single = 1, }; @@ -84,15 +86,36 @@ public: None = 2, }; - enum class NPadControllerType { - None, - ProController, - Handheld, - JoyDual, - JoyLeft, - JoyRight, - Pokeball, + struct DeviceHandle { + NpadType npad_type{}; + u8 npad_id{}; + DeviceIndex device_index{}; + INSERT_PADDING_BYTES(1); }; + static_assert(sizeof(DeviceHandle) == 4, "DeviceHandle is an invalid size"); + + struct NPadType { + union { + u32_le raw{}; + + BitField<0, 1, u32> pro_controller; + BitField<1, 1, u32> handheld; + BitField<2, 1, u32> joycon_dual; + BitField<3, 1, u32> joycon_left; + BitField<4, 1, u32> joycon_right; + + BitField<6, 1, u32> pokeball; // TODO(ogniK): Confirm when possible + }; + }; + static_assert(sizeof(NPadType) == 4, "NPadType is an invalid size"); + + struct Vibration { + f32 amp_low; + f32 freq_low; + f32 amp_high; + f32 freq_high; + }; + static_assert(sizeof(Vibration) == 0x10, "Vibration is an invalid size"); struct LedPattern { explicit LedPattern(u64 light1, u64 light2, u64 light3, u64 light4) { |