mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-14 09:04:57 +00:00
hid: Fix timestamps and controller type.
- This fixes user input in SMO.
This commit is contained in:
parent
379a935016
commit
12a6996262
1 changed files with 5 additions and 7 deletions
|
@ -75,7 +75,7 @@ private:
|
||||||
|
|
||||||
// Set up controllers as neon red+blue Joy-Con attached to console
|
// Set up controllers as neon red+blue Joy-Con attached to console
|
||||||
ControllerHeader& controller_header = mem.controllers[Controller_Handheld].header;
|
ControllerHeader& controller_header = mem.controllers[Controller_Handheld].header;
|
||||||
controller_header.type = ControllerType_Handheld | ControllerType_JoyconPair;
|
controller_header.type = ControllerType_Handheld;
|
||||||
controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent;
|
controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent;
|
||||||
controller_header.right_color_body = JOYCON_BODY_NEON_RED;
|
controller_header.right_color_body = JOYCON_BODY_NEON_RED;
|
||||||
controller_header.right_color_buttons = JOYCON_BUTTONS_NEON_RED;
|
controller_header.right_color_buttons = JOYCON_BUTTONS_NEON_RED;
|
||||||
|
@ -84,23 +84,21 @@ private:
|
||||||
|
|
||||||
for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
|
for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
|
||||||
for (int index = 0; index < HID_NUM_LAYOUTS; index++) {
|
for (int index = 0; index < HID_NUM_LAYOUTS; index++) {
|
||||||
// TODO(DarkLordZach): Is this layout/controller config actually invalid?
|
|
||||||
if (controller == Controller_Handheld && index == Layout_Single)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ControllerLayout& layout = mem.controllers[controller].layouts[index];
|
ControllerLayout& layout = mem.controllers[controller].layouts[index];
|
||||||
layout.header.num_entries = HID_NUM_ENTRIES;
|
layout.header.num_entries = HID_NUM_ENTRIES;
|
||||||
layout.header.max_entry_index = HID_NUM_ENTRIES - 1;
|
layout.header.max_entry_index = HID_NUM_ENTRIES - 1;
|
||||||
|
|
||||||
// HID shared memory stores the state of the past 17 samples in a circlular buffer,
|
// HID shared memory stores the state of the past 17 samples in a circlular buffer,
|
||||||
// each with a timestamp in number of samples since boot.
|
// each with a timestamp in number of samples since boot.
|
||||||
|
const ControllerInputEntry& last_entry = layout.entries[layout.header.latest_entry];
|
||||||
|
|
||||||
layout.header.timestamp_ticks = CoreTiming::GetTicks();
|
layout.header.timestamp_ticks = CoreTiming::GetTicks();
|
||||||
layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES;
|
layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES;
|
||||||
|
|
||||||
ControllerInputEntry& entry = layout.entries[layout.header.latest_entry];
|
ControllerInputEntry& entry = layout.entries[layout.header.latest_entry];
|
||||||
entry.timestamp++;
|
entry.timestamp = last_entry.timestamp + 1;
|
||||||
// TODO(shinyquagsire23): Is this always identical to timestamp?
|
// TODO(shinyquagsire23): Is this always identical to timestamp?
|
||||||
entry.timestamp_2++;
|
entry.timestamp_2 = entry.timestamp;
|
||||||
|
|
||||||
// TODO(shinyquagsire23): More than just handheld input
|
// TODO(shinyquagsire23): More than just handheld input
|
||||||
if (controller != Controller_Handheld)
|
if (controller != Controller_Handheld)
|
||||||
|
|
Loading…
Reference in a new issue