diff --git a/app/src/main/cpp/skyline/input/npad.cpp b/app/src/main/cpp/skyline/input/npad.cpp index e1bfadbc..adcaf3ed 100644 --- a/app/src/main/cpp/skyline/input/npad.cpp +++ b/app/src/main/cpp/skyline/input/npad.cpp @@ -23,7 +23,7 @@ namespace skyline::input { controller.device = nullptr; for (auto &id : supportedIds) { - if (id == NpadId::Unknown) + if (id == NpadId::Unknown || !IsNpadIdValid(id)) continue; auto &device{at(id)}; diff --git a/app/src/main/cpp/skyline/input/npad.h b/app/src/main/cpp/skyline/input/npad.h index 4fbbc085..35391061 100644 --- a/app/src/main/cpp/skyline/input/npad.h +++ b/app/src/main/cpp/skyline/input/npad.h @@ -80,6 +80,27 @@ namespace skyline::input { })); } + /** + * @brief Checks if the NpadId is valid + */ + bool IsNpadIdValid(NpadId id) { + switch (id) { + case NpadId::Player1: + case NpadId::Player2: + case NpadId::Player3: + case NpadId::Player4: + case NpadId::Player5: + case NpadId::Player6: + case NpadId::Player7: + case NpadId::Player8: + case NpadId::Unknown: + case NpadId::Handheld: + return true; + default: + return false; + } + } + /** * @brief Deduces all the mappings from guest controllers -> players based on the configuration supplied by HID services and available controllers * @note If any class members were edited, the mutex shouldn't be released till this is called