CInputGenerator: Toggle rumble if a controller is connected and it's a GC controller

This commit is contained in:
Phillip Stephens 2022-03-19 17:45:04 -07:00
parent a84bc64358
commit 3800322735
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,14 @@ void CInputGenerator::controllerAdded(uint32_t which) noexcept {
aurora::set_controller_player_index(which, 0); aurora::set_controller_player_index(which, 0);
} }
if (m_state[player].m_hasRumble && m_state[player].m_isGamecube) {
/* The GameCube controller can get stuck in a state where it's always rumbling if the game crashes
* (this can actually happen on hardware in certain cases)
* so lets toggle the motors to ensure they're off, this happens so quickly the player doesn't notice
*/
aurora::controller_rumble(which, 1, 1);
aurora::controller_rumble(which, 0, 0);
}
m_state[player] = m_state[player] =
SAuroraControllerState(which, aurora::is_controller_gamecube(which), aurora::controller_has_rumble(which)); SAuroraControllerState(which, aurora::is_controller_gamecube(which), aurora::controller_has_rumble(which));
} }