mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 15:19:53 -06:00
avoid spamming host-RX checks every 8us if the host isn't responding
This commit is contained in:
@ -112,6 +112,7 @@ bool IsMP;
|
|||||||
bool IsMPClient;
|
bool IsMPClient;
|
||||||
u64 NextSync; // for clients: timestamp for next sync point
|
u64 NextSync; // for clients: timestamp for next sync point
|
||||||
u64 RXTimestamp;
|
u64 RXTimestamp;
|
||||||
|
u64 LastHostRXCheck;
|
||||||
|
|
||||||
// multiplayer host TX sequence:
|
// multiplayer host TX sequence:
|
||||||
// 1. preamble
|
// 1. preamble
|
||||||
@ -264,6 +265,7 @@ void Reset()
|
|||||||
IsMPClient = false;
|
IsMPClient = false;
|
||||||
NextSync = 0;
|
NextSync = 0;
|
||||||
RXTimestamp = 0;
|
RXTimestamp = 0;
|
||||||
|
LastHostRXCheck = 0;
|
||||||
|
|
||||||
WifiAP::Reset();
|
WifiAP::Reset();
|
||||||
}
|
}
|
||||||
@ -340,6 +342,7 @@ void DoSavestate(Savestate* file)
|
|||||||
file->Bool32(&IsMPClient);
|
file->Bool32(&IsMPClient);
|
||||||
file->Var64(&NextSync);
|
file->Var64(&NextSync);
|
||||||
file->Var64(&RXTimestamp);
|
file->Var64(&RXTimestamp);
|
||||||
|
file->Var64(&LastHostRXCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1658,8 +1661,12 @@ void USTimer(u32 param)
|
|||||||
|
|
||||||
if (USTimestamp >= NextSync)
|
if (USTimestamp >= NextSync)
|
||||||
{
|
{
|
||||||
// TODO: not do this every tick if it fails to receive a frame!
|
u64 delay = USTimestamp - LastHostRXCheck;
|
||||||
|
if (delay >= 512)
|
||||||
|
{
|
||||||
CheckRX(2);
|
CheckRX(2);
|
||||||
|
LastHostRXCheck = USTimestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user