diff options
| author | 2018-04-01 00:12:07 -0400 | |
|---|---|---|
| committer | 2018-04-01 00:12:07 -0400 | |
| commit | 72b90494e7e2f4926928a2c6dc81a56e49452ed7 (patch) | |
| tree | 00a54840afef170839ea5a8c362d0157f4b2a199 /src | |
| parent | Merge pull request #293 from N00byKing/drkthm (diff) | |
| download | yuzu-72b90494e7e2f4926928a2c6dc81a56e49452ed7.tar.gz yuzu-72b90494e7e2f4926928a2c6dc81a56e49452ed7.tar.xz yuzu-72b90494e7e2f4926928a2c6dc81a56e49452ed7.zip | |
hid: Write empty touch screen state.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a0b8c6243..d8a802dae 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -65,13 +65,14 @@ private: | |||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void UpdatePadCallback(u64 userdata, int cycles_late) { | 67 | void UpdatePadCallback(u64 userdata, int cycles_late) { |
| 68 | SharedMemory* mem = reinterpret_cast<SharedMemory*>(shared_mem->GetPointer()); | 68 | SharedMemory mem{}; |
| 69 | std::memcpy(&mem, shared_mem->GetPointer(), sizeof(SharedMemory)); | ||
| 69 | 70 | ||
| 70 | if (is_device_reload_pending.exchange(false)) | 71 | if (is_device_reload_pending.exchange(false)) |
| 71 | LoadInputDevices(); | 72 | LoadInputDevices(); |
| 72 | 73 | ||
| 73 | // Set up controllers as neon red+blue Joy-Con attached to console | 74 | // Set up controllers as neon red+blue Joy-Con attached to console |
| 74 | ControllerHeader& controller_header = mem->controllers[Controller_Handheld].header; | 75 | ControllerHeader& controller_header = mem.controllers[Controller_Handheld].header; |
| 75 | controller_header.type = ControllerType_Handheld | ControllerType_JoyconPair; | 76 | controller_header.type = ControllerType_Handheld | ControllerType_JoyconPair; |
| 76 | controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent; | 77 | controller_header.single_colors_descriptor = ColorDesc_ColorsNonexistent; |
| 77 | controller_header.right_color_body = JOYCON_BODY_NEON_RED; | 78 | controller_header.right_color_body = JOYCON_BODY_NEON_RED; |
| @@ -79,8 +80,8 @@ private: | |||
| 79 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; | 80 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; |
| 80 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; | 81 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; |
| 81 | 82 | ||
| 82 | for (int layoutIdx = 0; layoutIdx < HID_NUM_LAYOUTS; layoutIdx++) { | 83 | for (int index = 0; index < HID_NUM_LAYOUTS; index++) { |
| 83 | ControllerLayout& layout = mem->controllers[Controller_Handheld].layouts[layoutIdx]; | 84 | ControllerLayout& layout = mem.controllers[Controller_Handheld].layouts[index]; |
| 84 | layout.header.num_entries = HID_NUM_ENTRIES; | 85 | layout.header.num_entries = HID_NUM_ENTRIES; |
| 85 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; | 86 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; |
| 86 | 87 | ||
| @@ -136,10 +137,25 @@ private: | |||
| 136 | // layouts) | 137 | // layouts) |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | // TODO(shinyquagsire23): Update touch info | 140 | // TODO(bunnei): Properly implement the touch screen, the below will just write empty data |
| 141 | |||
| 142 | TouchScreen& touchscreen = mem.touchscreen; | ||
| 143 | const u64 last_entry = touchscreen.header.latest_entry; | ||
| 144 | const u64 curr_entry = (last_entry + 1) % touchscreen.entries.size(); | ||
| 145 | const u64 timestamp = CoreTiming::GetTicks(); | ||
| 146 | const u64 sample_counter = touchscreen.entries[last_entry].header.timestamp + 1; | ||
| 147 | touchscreen.header.timestamp_ticks = timestamp; | ||
| 148 | touchscreen.header.num_entries = touchscreen.entries.size(); | ||
| 149 | touchscreen.header.latest_entry = curr_entry; | ||
| 150 | touchscreen.header.max_entry_index = touchscreen.entries.size(); | ||
| 151 | touchscreen.header.timestamp = timestamp; | ||
| 152 | touchscreen.entries[curr_entry].header.timestamp = sample_counter; | ||
| 153 | touchscreen.entries[curr_entry].header.num_touches = 0; | ||
| 140 | 154 | ||
| 141 | // TODO(shinyquagsire23): Signal events | 155 | // TODO(shinyquagsire23): Signal events |
| 142 | 156 | ||
| 157 | std::memcpy(shared_mem->GetPointer(), &mem, sizeof(SharedMemory)); | ||
| 158 | |||
| 143 | // Reschedule recurrent event | 159 | // Reschedule recurrent event |
| 144 | CoreTiming::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event); | 160 | CoreTiming::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event); |
| 145 | } | 161 | } |