summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-06-13 19:44:46 +0200
committerZach Hilman <zachhilman@gmail.com>2018-06-13 19:44:46 +0200
commita353322b58afa439eabce0694f457381fd80a7fe (patch)
tree5bb987b214c4f2a2cd05457dc92200aafd3117d4 /src/core
parentAvoid initializing single-joycon layouts with handheld controller (diff)
downloadyuzu-a353322b58afa439eabce0694f457381fd80a7fe.tar
yuzu-a353322b58afa439eabce0694f457381fd80a7fe.tar.gz
yuzu-a353322b58afa439eabce0694f457381fd80a7fe.tar.bz2
yuzu-a353322b58afa439eabce0694f457381fd80a7fe.tar.lz
yuzu-a353322b58afa439eabce0694f457381fd80a7fe.tar.xz
yuzu-a353322b58afa439eabce0694f457381fd80a7fe.tar.zst
yuzu-a353322b58afa439eabce0694f457381fd80a7fe.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/hid/hid.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index d84c0a0b2..d4f741505 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -16,6 +16,14 @@
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.
// TODO(shinyquagsire23): These need better values.
constexpr u64 pad_update_ticks = CoreTiming::BASE_CLOCK_RATE / 10000;
@@ -83,10 +91,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 <
- (controller != Controller_Handheld ? HID_NUM_LAYOUTS : HID_NUM_LAYOUTS_HANDHELD);
- index++) {
+ for (int index = 0; index < GetNumberLayoutsForController(controller); index++) {
ControllerLayout& layout = mem.controllers[controller].layouts[index];
layout.header.num_entries = HID_NUM_ENTRIES;
layout.header.max_entry_index = HID_NUM_ENTRIES - 1;