mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-27 01:24:16 +01:00
check if NpadId is valid when update
This commit is contained in:
parent
a409f30e91
commit
baa6b5d5ea
@ -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)};
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user