Do same in dmnt and reboot_to_payload

This commit is contained in:
leo60228 2019-05-12 10:43:49 -04:00
parent 56d7473451
commit eab2d05680
2 changed files with 12 additions and 4 deletions

View file

@ -26,7 +26,11 @@ Result HidManagement::GetKeysDown(u64 *keys) {
std::scoped_lock<HosMutex> lk(g_hid_keys_down_lock); std::scoped_lock<HosMutex> lk(g_hid_keys_down_lock);
hidScanInput(); hidScanInput();
*keys = hidKeysHeld(CONTROLLER_P1_AUTO); *keys = 0;
for (int controller = 0; controller < 10; controller++) {
*keys |= hidKeysHeld((HidControllerID) controller);
}
return ResultSuccess; return ResultSuccess;
} }

View file

@ -79,8 +79,12 @@ int main(int argc, char **argv)
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hidScanInput(); hidScanInput();
//hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame) u64 kDown = 0;
u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);
for (int controller = 0; controller < 10; controller++) {
// hidKeysDown returns information about which buttons have been just pressed (and they weren't in the previous frame)
kDown |= hidKeysDown((HidControllerID) controller);
}
if (can_reboot && kDown & KEY_MINUS) { if (can_reboot && kDown & KEY_MINUS) {
reboot_to_payload(); reboot_to_payload();