summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-03-09 02:21:25 +0100
committerbunnei <bunneidev@gmail.com>2015-03-10 23:05:19 +0100
commite9b9f1842be5afa794f03e2a0fa29d49cfca2601 (patch)
tree6bec080a8cda579e28d32c77ad0d089aed8944ee
parentQt: Implemented EmuWindow touchpad support. (diff)
downloadyuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.tar
yuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.tar.gz
yuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.tar.bz2
yuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.tar.lz
yuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.tar.xz
yuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.tar.zst
yuzu-e9b9f1842be5afa794f03e2a0fa29d49cfca2601.zip
-rw-r--r--src/core/hle/service/hid/hid.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index f2affb5c5..e4665a43c 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -89,7 +89,7 @@ struct TouchDataEntry {
* Structure of data stored in HID shared memory
*/
struct SharedMem {
- // Offset 0x0 : "PAD" data, this is used for buttons and the circle pad
+ // "Pad data, this is used for buttons and the circle pad
struct {
s64 index_reset_ticks;
s64 index_reset_ticks_previous;
@@ -105,7 +105,7 @@ struct SharedMem {
std::array<PadDataEntry, 8> entries; // Pad state history
} pad;
- // Offset 0xA8 : Touchpad data, this is used for touchpad input
+ // Touchpad data, this is used for touchpad input
struct {
s64 index_reset_ticks;
s64 index_reset_ticks_previous;
@@ -117,6 +117,20 @@ struct SharedMem {
} touch;
};
+// TODO: MSVC does not support using offsetof() on non-static data members even though this
+// is technically allowed since C++11. This macro should be enabled once MSVC adds
+// support for that.
+#ifndef _MSC_VER
+#define ASSERT_REG_POSITION(field_name, position) \
+ static_assert(offsetof(SharedMem, field_name) == position * 4, \
+ "Field "#field_name" has invalid position")
+
+ASSERT_REG_POSITION(pad.index_reset_ticks, 0x0);
+ASSERT_REG_POSITION(touch.index_reset_ticks, 0x2A);
+
+#undef ASSERT_REG_POSITION
+#endif // !defined(_MSC_VER)
+
// Pre-defined PadStates for single button presses
const PadState PAD_NONE = {{0}};
const PadState PAD_A = {{1u << 0}};