summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-10 22:53:39 -0400
committerGravatar bunnei2018-07-10 22:55:13 -0400
commit12a69962621edb5df1760a6e09c0afa48154cf24 (patch)
tree530c71fc5c16130696ff01e32c2dcdc58965d5f7
parentMerge pull request #644 from ogniK5377/getconfig-err (diff)
downloadyuzu-12a69962621edb5df1760a6e09c0afa48154cf24.tar.gz
yuzu-12a69962621edb5df1760a6e09c0afa48154cf24.tar.xz
yuzu-12a69962621edb5df1760a6e09c0afa48154cf24.zip
hid: Fix timestamps and controller type.
- This fixes user input in SMO.
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/hid/hid.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index ebb8d13e6..b0f4a384e 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -75,7 +75,7 @@ private:
75 75
76 // Set up controllers as neon red+blue Joy-Con attached to console 76 // Set up controllers as neon red+blue Joy-Con attached to console
77 ControllerHeader& controller_header = mem.controllers[Controller_Handheld].header; 77 ControllerHeader& controller_header = mem.controllers[Controller_Handheld].header;
78 controller_header.type = ControllerType_Handheld | ControllerType_JoyconPair; 78 controller_header.type = ControllerType_Handheld;
79 controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent; 79 controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent;
80 controller_header.right_color_body = JOYCON_BODY_NEON_RED; 80 controller_header.right_color_body = JOYCON_BODY_NEON_RED;
81 controller_header.right_color_buttons = JOYCON_BUTTONS_NEON_RED; 81 controller_header.right_color_buttons = JOYCON_BUTTONS_NEON_RED;
@@ -84,23 +84,21 @@ private:
84 84
85 for (size_t controller = 0; controller < mem.controllers.size(); controller++) { 85 for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
86 for (int index = 0; index < HID_NUM_LAYOUTS; index++) { 86 for (int index = 0; index < HID_NUM_LAYOUTS; index++) {
87 // TODO(DarkLordZach): Is this layout/controller config actually invalid?
88 if (controller == Controller_Handheld && index == Layout_Single)
89 continue;
90
91 ControllerLayout& layout = mem.controllers[controller].layouts[index]; 87 ControllerLayout& layout = mem.controllers[controller].layouts[index];
92 layout.header.num_entries = HID_NUM_ENTRIES; 88 layout.header.num_entries = HID_NUM_ENTRIES;
93 layout.header.max_entry_index = HID_NUM_ENTRIES - 1; 89 layout.header.max_entry_index = HID_NUM_ENTRIES - 1;
94 90
95 // HID shared memory stores the state of the past 17 samples in a circlular buffer, 91 // HID shared memory stores the state of the past 17 samples in a circlular buffer,
96 // each with a timestamp in number of samples since boot. 92 // each with a timestamp in number of samples since boot.
93 const ControllerInputEntry& last_entry = layout.entries[layout.header.latest_entry];
94
97 layout.header.timestamp_ticks = CoreTiming::GetTicks(); 95 layout.header.timestamp_ticks = CoreTiming::GetTicks();
98 layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES; 96 layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES;
99 97
100 ControllerInputEntry& entry = layout.entries[layout.header.latest_entry]; 98 ControllerInputEntry& entry = layout.entries[layout.header.latest_entry];
101 entry.timestamp++; 99 entry.timestamp = last_entry.timestamp + 1;
102 // TODO(shinyquagsire23): Is this always identical to timestamp? 100 // TODO(shinyquagsire23): Is this always identical to timestamp?
103 entry.timestamp_2++; 101 entry.timestamp_2 = entry.timestamp;
104 102
105 // TODO(shinyquagsire23): More than just handheld input 103 // TODO(shinyquagsire23): More than just handheld input
106 if (controller != Controller_Handheld) 104 if (controller != Controller_Handheld)