From 83a66dd701789761c118c7e105327a1b6166ed13 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 8 Mar 2015 00:12:47 -0500 Subject: HID: Refactored shared memory decoding for touchpad support. --- src/core/hle/service/hid/hid.h | 46 +++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'src/core/hle/service/hid/hid.h') diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 9c6e86f7..6318d1d5 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -65,7 +65,7 @@ struct PadState { }; /** - * Structure of a single entry in the PadData's Pad state history array. + * Structure of a single entry of Pad state history within HID shared memory */ struct PadDataEntry { PadState current_state; @@ -77,22 +77,44 @@ struct PadDataEntry { }; /** - * Structure of all data related to the 3DS Pad. + * Structure of a single entry of touch state history within HID shared memory */ -struct PadData { - s64 index_reset_ticks; - s64 index_reset_ticks_previous; - u32 index; // the index of the last updated Pad state history element +struct TouchDataEntry { + u16 x; + u16 y; + u32 data_valid; +}; + +/** + * Structure of data stored in HID shared memory + */ +struct SharedMem { + // Offset 0x0 : "PAD" data, this is used for buttons and the circle pad + struct { + s64 index_reset_ticks; + s64 index_reset_ticks_previous; + u32 index; // Index of the last updated pad state history element + + INSERT_PADDING_BYTES(0x8); + + PadState current_state; // Same as entries[index].current_state + u32 raw_circle_pad_data; + + INSERT_PADDING_BYTES(0x4); - u32 pad1; - u32 pad2; + std::array entries; // Pad state history + } pad; - PadState current_state; // same as entries[index].current_state - u32 raw_circle_pad_data; + // Offset 0xA8 : Touchpad data, this is used for touchpad input + struct { + s64 index_reset_ticks; + s64 index_reset_ticks_previous; + u32 index; // Index of the last updated touch state history element - u32 pad3; + INSERT_PADDING_BYTES(0xC); - std::array entries; // Pad state history + std::array entries; + } touch; }; // Pre-defined PadStates for single button presses -- cgit v1.2.3