AnalogController: Reset state on analog->digital switch

But only when the game does not support analog mode.

Tomb Raider's game selector menu puts the controller into
configuration mode, and we're supposed to respond with a
0x00 header byte if the user switches the pad to digital
mode.

Problem is, the game itself doesn't understand this mode
switch nor configuration mode. So the status byte gets
stuck at 0x00 if the user toggles analog mode, and the
game thinks no pad is connected.

Work around this by resetting the whole state if the game
does not support analog mode.
This commit is contained in:
Stenzek 2024-11-05 16:07:29 +10:00
parent 57ca5dd2c2
commit 7b7dd2bef1
No known key found for this signature in database
1 changed files with 18 additions and 1 deletions

View File

@ -331,9 +331,26 @@ void AnalogController::ProcessAnalogModeToggle()
SetAnalogMode(!m_analog_mode, true); SetAnalogMode(!m_analog_mode, true);
ResetRumbleConfig(); ResetRumbleConfig();
// Set status byte to 0 if we were previously in configuration mode, so that the game knows about the mode change.
if (m_dualshock_enabled) if (m_dualshock_enabled)
{
// However, the problem with doing this unconditionally is that games like Tomb Raider have the loader menu
// put the pad into configuration mode, but not analog mode. So if the user toggles analog mode, the status
// byte ends up stuck at 0x00. As a workaround, clear out config/dualshock mode when the game isn't flagged
// as supporting the dualshock.
if (!m_analog_mode && !CanStartInAnalogMode(ControllerType::AnalogController))
{
WARNING_LOG("Resetting pad on digital->analog switch.");
m_configuration_mode = false;
m_dualshock_enabled = false;
m_status_byte = 0x5A;
}
else
{
m_status_byte = 0x00; m_status_byte = 0x00;
} }
}
}
} }
void AnalogController::SetMotorState(u32 motor, u8 value) void AnalogController::SetMotorState(u32 motor, u8 value)