summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-20 01:12:15 +0200
committerGitHub <noreply@github.com>2018-07-20 01:12:15 +0200
commitf43d8ea523cb749631f130f13ec14ff56e84eb7e (patch)
tree4707f46447c09ff2455c43631472ab297958d494 /src/core/hle
parentMerge pull request #721 from lioncash/svc (diff)
parenthid: Use a ranged-for loops in UpdatePadCallback (diff)
downloadyuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.tar
yuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.tar.gz
yuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.tar.bz2
yuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.tar.lz
yuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.tar.xz
yuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.tar.zst
yuzu-f43d8ea523cb749631f130f13ec14ff56e84eb7e.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/hid/hid.cpp10
-rw-r--r--src/core/hle/service/hid/hid.h2
2 files changed, 4 insertions, 8 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:
controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE;
for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
- for (int index = 0; index < HID_NUM_LAYOUTS; index++) {
- ControllerLayout& layout = mem.controllers[controller].layouts[index];
+ for (auto& layout : mem.controllers[controller].layouts) {
layout.header.num_entries = HID_NUM_ENTRIES;
layout.header.max_entry_index = HID_NUM_ENTRIES - 1;
@@ -213,8 +212,7 @@ private:
keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter;
// TODO(shinyquagsire23): Figure out what any of these are
- for (size_t i = 0; i < mem.unk_input_1.size(); i++) {
- UnkInput1& input = mem.unk_input_1[i];
+ for (auto& input : mem.unk_input_1) {
const u64 last_input_entry = input.header.latest_entry;
const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size();
const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1;
@@ -228,9 +226,7 @@ private:
input.entries[curr_input_entry].timestamp_2 = input_sample_counter;
}
- for (size_t i = 0; i < mem.unk_input_2.size(); i++) {
- UnkInput2& input = mem.unk_input_2[i];
-
+ for (auto& input : mem.unk_input_2) {
input.header.timestamp_ticks = timestamp;
input.header.num_entries = 17;
input.header.latest_entry = 0;
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index b499308d6..e298f23a6 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -380,7 +380,7 @@ static_assert(sizeof(ControllerLayout) == 0x350,
struct Controller {
ControllerHeader header;
- std::array<ControllerLayout, 7> layouts;
+ std::array<ControllerLayout, HID_NUM_LAYOUTS> layouts;
std::array<u8, 0x2a70> unk_1;
ControllerMAC mac_left;
ControllerMAC mac_right;