Update SIOCNT when the link driver is disconnected

Some software (like the EU version of Digimon Racing) relies on the
SIOCNT register being properly updated when no cable is connected.
Otherwise, they risk getting stuck in a loop waiting for an update on
the SIOCNT register.
This commit is contained in:
Fabrice de Gans 2023-03-19 12:11:43 -07:00 committed by Rafael Kitover
parent 9889ef4fa8
commit 1ab46f704f
1 changed files with 14 additions and 0 deletions

View File

@ -669,6 +669,20 @@ ConnectionState InitLink(LinkMode mode)
void StartLink(uint16_t siocnt)
{
if (!linkDriver || !linkDriver->start) {
// We still need to update the SIOCNT register for consistency. Some
// games (e.g. Digimon Racing EUR) will be stuck in an infinite loop
// waiting git the SIOCNT register to be updated otherwise.
// This mimicks the NO_LINK behavior.
if (siocnt & 0x80) {
siocnt &= 0xff7f;
if (siocnt & 1 && (siocnt & 0x4000)) {
UPDATE_REG(COMM_SIOCNT, 0xFF);
IF |= 0x80;
UPDATE_REG(0x202, IF);
siocnt &= 0x7f7f;
}
}
UPDATE_REG(COMM_SIOCNT, siocnt);
return;
}