diff options
| author | 2018-07-19 15:09:31 -0400 | |
|---|---|---|
| committer | 2018-07-19 15:11:08 -0400 | |
| commit | a37a47448dff6b19f1828f83f96cc8efce129d64 (patch) | |
| tree | 08e96429d3d34211a359b2e14bf38fc8ddf714d6 /src | |
| parent | hid: Use HID_NUM_LAYOUTS constant for indicating size of the layouts array (diff) | |
| download | yuzu-a37a47448dff6b19f1828f83f96cc8efce129d64.tar.gz yuzu-a37a47448dff6b19f1828f83f96cc8efce129d64.tar.xz yuzu-a37a47448dff6b19f1828f83f96cc8efce129d64.zip | |
hid: Use a ranged-for loops in UpdatePadCallback
Modernizes the loops themselves while also getting rid of a signed/unsigned
comparison in a loop condition.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 4f18c0fd3..475a0a5cf 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -85,8 +85,7 @@ private: | |||
| 85 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; | 85 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; |
| 86 | 86 | ||
| 87 | for (size_t controller = 0; controller < mem.controllers.size(); controller++) { | 87 | for (size_t controller = 0; controller < mem.controllers.size(); controller++) { |
| 88 | for (int index = 0; index < HID_NUM_LAYOUTS; index++) { | 88 | for (auto& layout : mem.controllers[controller].layouts) { |
| 89 | ControllerLayout& layout = mem.controllers[controller].layouts[index]; | ||
| 90 | layout.header.num_entries = HID_NUM_ENTRIES; | 89 | layout.header.num_entries = HID_NUM_ENTRIES; |
| 91 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; | 90 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; |
| 92 | 91 | ||
| @@ -213,8 +212,7 @@ private: | |||
| 213 | keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter; | 212 | keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter; |
| 214 | 213 | ||
| 215 | // TODO(shinyquagsire23): Figure out what any of these are | 214 | // TODO(shinyquagsire23): Figure out what any of these are |
| 216 | for (size_t i = 0; i < mem.unk_input_1.size(); i++) { | 215 | for (auto& input : mem.unk_input_1) { |
| 217 | UnkInput1& input = mem.unk_input_1[i]; | ||
| 218 | const u64 last_input_entry = input.header.latest_entry; | 216 | const u64 last_input_entry = input.header.latest_entry; |
| 219 | const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size(); | 217 | const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size(); |
| 220 | const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1; | 218 | const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1; |
| @@ -228,9 +226,7 @@ private: | |||
| 228 | input.entries[curr_input_entry].timestamp_2 = input_sample_counter; | 226 | input.entries[curr_input_entry].timestamp_2 = input_sample_counter; |
| 229 | } | 227 | } |
| 230 | 228 | ||
| 231 | for (size_t i = 0; i < mem.unk_input_2.size(); i++) { | 229 | for (auto& input : mem.unk_input_2) { |
| 232 | UnkInput2& input = mem.unk_input_2[i]; | ||
| 233 | |||
| 234 | input.header.timestamp_ticks = timestamp; | 230 | input.header.timestamp_ticks = timestamp; |
| 235 | input.header.num_entries = 17; | 231 | input.header.num_entries = 17; |
| 236 | input.header.latest_entry = 0; | 232 | input.header.latest_entry = 0; |