leave client sync mode when host deauths. makes download play actually work.

This commit is contained in:
Arisotura 2022-08-21 00:51:28 +02:00
parent 40ceb207e9
commit 5db8499787
2 changed files with 18 additions and 2 deletions

View File

@ -1156,6 +1156,7 @@ bool CheckRX(bool local)
//if (framectl==0x0228 && zarp==0x0228) printf("[CLIENT] failed to receive ack\n");
//if (framectl==0x0218 && zarp==0x0218) printf("[CLIENT] failed to receive cmd\n");
//if (framectl==0x0218) printf("[%016llX] CLIENT: ACK RECEIVED\n", USCounter);
//if ((framectl&0xFF00)==0) printf("RECEIVED: %04X\n", framectl);
zarp = framectl;
if (local && (framectl == 0x0118 || framectl == 0x0158))
@ -1210,6 +1211,14 @@ zamf = timestamp;
RXTimestamp = 0;
StartRX();
}
else if (((framectl & 0x00FF) == 0x00C0) && timestamp && IsMPClient)
{
IsMPClient = false;
NextSync = 0;
RXTimestamp = 0;
StartRX();
}
else if (IsMPClient)
{
// if we are being a MP client, we need to delay this frame until we reach the
@ -1458,7 +1467,7 @@ void USTimer(u32 param)
SetIRQ(0);
SetStatus(1);
//printf("%016llX: finished receiving a frame, aid=%04X, client=%04X\n", USTimestamp, IOPORT(W_AIDLow), *(u16*)&RXBuffer[0xC + 26]);
//printf("%016llX: finished receiving a frame, aid=%04X, FC=%04X, client=%04X\n", USTimestamp, IOPORT(W_AIDLow), *(u16*)&RXBuffer[0xC], *(u16*)&RXBuffer[0xC + 26]);
WIFI_LOG("wifi: finished receiving packet %04X\n", *(u16*)&RXBuffer[12]);
ComStatus &= ~0x1;
@ -1733,6 +1742,13 @@ void Write(u32 addr, u16 val)
printf("wifi: force-setting IF %04X\n", val);
return;
case W_AIDLow:
IOPORT(W_AIDLow) = val & 0x000F;
return;
case W_AIDFull:
IOPORT(W_AIDFull) = val & 0x07FF;
return;
case W_PowerState:
//printf("writing power state %x %08x\n", val, NDS::ARM7->R[15]);
IOPORT(W_PowerState) |= val & 0x0002;

View File

@ -439,7 +439,7 @@ int RecvPacket(u8* packet, bool block, u64* timestamp)
{
for (;;)
{
if (!SemWait(InstanceID, block ? 500 : 0))
if (!SemWait(InstanceID, block ? 50 : 0))
{
return 0;
}