From 21ed70c007b62f58866b927bededd6ae1cd2687b Mon Sep 17 00:00:00 2001 From: AtariDreams <83477269+AtariDreams@users.noreply.github.com> Date: Tue, 19 Mar 2024 07:29:47 -0400 Subject: [PATCH] Do not do VBlankIntrWait if using the wireless adapter (#3730) * Do not do VBlankIntrWait if using the wireless adapter Desynchronization can occur otherwise. * Fix formatting Co-authored-by: LOuroboros --------- Co-authored-by: LOuroboros --- src/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 32e103b6e8..0d508104ed 100644 --- a/src/main.c +++ b/src/main.c @@ -455,7 +455,18 @@ static void IntrDummy(void) static void WaitForVBlank(void) { gMain.intrCheck &= ~INTR_FLAG_VBLANK; - VBlankIntrWait(); + + if (gWirelessCommType != 0) + { + // Desynchronization may occur if wireless adapter is connected + // and we call VBlankIntrWait(); + while (!(gMain.intrCheck & INTR_FLAG_VBLANK)) + ; + } + else + { + VBlankIntrWait(); + } } void SetTrainerHillVBlankCounter(u32 *counter)