aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/hid/hid.h
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-03-08 00:12:47 -0500
committerGravatar bunnei <bunneidev@gmail.com>2015-03-10 18:05:16 -0400
commit83a66dd701789761c118c7e105327a1b6166ed13 (patch)
tree48c3feab4d36116b25990c4dc18429cfb674fd29 /src/core/hle/service/hid/hid.h
parent6c37a90d3f7361cdd46ff91f7fdfc13b098389cc (diff)
HID: Refactored shared memory decoding for touchpad support.
Diffstat (limited to 'src/core/hle/service/hid/hid.h')
-rw-r--r--src/core/hle/service/hid/hid.h46
1 files changed, 34 insertions, 12 deletions
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<PadDataEntry, 8> 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<PadDataEntry, 8> entries; // Pad state history
+ std::array<TouchDataEntry, 8> entries;
+ } touch;
};
// Pre-defined PadStates for single button presses