Fix netboard resets and detection of simulated netboard linking to itself

This commit is contained in:
Matthew Daniels 2021-04-19 22:15:50 +00:00
parent 5a570ce7fe
commit a20366d338
2 changed files with 14 additions and 5 deletions

View file

@ -1504,6 +1504,8 @@ void CModel3::Write8(UINT32 addr, UINT8 data)
}
//printf("W8 ioreg @%x<-%x\n", (addr & 0x1FF), data);
if (((addr & 0x1FF) == 0x180) && (data == 0x00))
NetBoard->Reset();
*(UINT8 *)&netBuffer[0x10000 + ((addr & 0x1FF) / 2)] = data;
break;
@ -1515,8 +1517,6 @@ void CModel3::Write8(UINT32 addr, UINT8 data)
}
//printf("W8 netram @%x<-%x\n", (addr & 0x1FFFF), data);
if (((addr & 0x1FFFF) == 0x180) && (data == 0x00))
NetBoard->Reset();
*(UINT8 *)&netRAM[(addr & 0x1FFFF)/2] = data;
break;
/*case 3:
@ -1842,6 +1842,8 @@ void CModel3::Write32(UINT32 addr, UINT32 data)
}
//printf("W32 ioreg @%x<-%04x\n", (addr /*& 0x1FF*/), data>>16);
if (((addr & 0x1FF) == 0x180) && ((data >> 16) == 0x0000))
NetBoard->Reset();
*(UINT16 *)&netBuffer[0x10000 + ((addr & 0x1FF) / 2)] = FLIPENDIAN16(data >> 16);
break;
@ -1853,8 +1855,6 @@ void CModel3::Write32(UINT32 addr, UINT32 data)
}
//printf("W32 netram @%x<-%x\n", (addr & 0x1FFFF), data);
if (((addr & 0x1FFFF) == 0x180) && ((data >> 16) == 0x0000))
NetBoard->Reset();
*(UINT16 *)&netRAM[((addr & 0x1FFFF) / 2)] = FLIPENDIAN16(data >> 16);
break;
/*case 3:

View file

@ -229,6 +229,15 @@ void CSimNetBoard::RunFrame(void)
nets->Send(&numMachines, sizeof(numMachines));
}
// if there are no other linked machines, only continue if Supermodel is linked to itself
// there might be more than one machine set to master which would cause glitches
if ((numMachines == 0) && ((port_in != port_out) || (addr_out.compare("127.0.0.1") != 0)))
{
ErrorLog("no slave machines detected. Make sure only one machine is set to master!");
m_state = State::error;
break;
}
m_numMachines = numMachines + 1;
ioreg16[0x88] = 0; // supposed to cycle between 0 and 1 (also 2 for Daytona 2); doesn't seem to matter
@ -408,7 +417,7 @@ void CSimNetBoard::RunFrame(void)
// if there are no other linked machines, only continue if Supermodel is linked to itself
// there might be more than one machine set to master which would cause glitches
if ((numMachines.total == 0) && ((port_in != port_out) || !addr_out.compare("127.0.0.1")))
if ((numMachines.total == 0) && ((port_in != port_out) || (addr_out.compare("127.0.0.1") != 0)))
{
ErrorLog("no slave machines detected. Make sure only one machine is set to master!");
if (IsGame("dirtdvls"))