Improved hid handling.

This commit is contained in:
yellows8 2019-12-08 14:46:42 -05:00
parent a747d92826
commit 233b765300
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43

View File

@ -193,15 +193,25 @@ int main(int argc, char **argv)
return 0; return 0;
} }
u64 menuGetKeysDown(void) {
u64 down = 0;
if (hidGetHandheldMode())
down |= hidKeysDown(CONTROLLER_HANDHELD);
else {
for (u32 controller=0; controller<8; controller++) {
if (hidIsControllerConnected(controller)) down |= hidKeysDown(controller);
}
}
return down;
}
//This is implemented here due to the hid code. //This is implemented here due to the hid code.
bool menuUpdate(void) { bool menuUpdate(void) {
bool exitflag = 0; bool exitflag = 0;
menu_s* menu = menuGetCurrent(); menu_s* menu = menuGetCurrent();
u64 down = 0; u64 down = menuGetKeysDown();
for (int controller = 0; controller < 10; controller++) {
down |= hidKeysDown((HidControllerID) controller);
}
handleTouch(menu); handleTouch(menu);
@ -248,11 +258,7 @@ bool menuUpdate(void) {
bool menuUpdateErrorScreen(void) { bool menuUpdateErrorScreen(void) {
bool exitflag = 0; bool exitflag = 0;
u64 down = 0; u64 down = menuGetKeysDown();
for (int controller = 0; controller < 10; controller++) {
down |= hidKeysDown((HidControllerID) controller);
}
if (down & KEY_PLUS) if (down & KEY_PLUS)
{ {