mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 15:22:45 +01:00
Move loop condition to free function
This commit is contained in:
parent
50153a1cb2
commit
a353322b58
1 changed files with 9 additions and 4 deletions
|
@ -16,6 +16,14 @@
|
||||||
|
|
||||||
namespace Service::HID {
|
namespace Service::HID {
|
||||||
|
|
||||||
|
int GetNumberLayoutsForController(size_t controller_id) {
|
||||||
|
if (controller_id == Controller_Handheld) {
|
||||||
|
return HID_NUM_LAYOUTS_HANDHELD;
|
||||||
|
} else {
|
||||||
|
return HID_NUM_LAYOUTS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Updating period for each HID device.
|
// Updating period for each HID device.
|
||||||
// TODO(shinyquagsire23): These need better values.
|
// TODO(shinyquagsire23): These need better values.
|
||||||
constexpr u64 pad_update_ticks = CoreTiming::BASE_CLOCK_RATE / 10000;
|
constexpr u64 pad_update_ticks = CoreTiming::BASE_CLOCK_RATE / 10000;
|
||||||
|
@ -83,10 +91,7 @@ private:
|
||||||
controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE;
|
controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE;
|
||||||
|
|
||||||
for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
|
for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
|
||||||
for (int index = 0;
|
for (int index = 0; index < GetNumberLayoutsForController(controller); index++) {
|
||||||
index <
|
|
||||||
(controller != Controller_Handheld ? HID_NUM_LAYOUTS : HID_NUM_LAYOUTS_HANDHELD);
|
|
||||||
index++) {
|
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue