From 885bfeaf38abd4f5e1bd2d875a20a910c61edcd9 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 6 Aug 2023 21:38:07 +0200 Subject: [PATCH] port: disable indefinite wait in aiIfMusicEventQueueIsEmpty for now might have to actually run audio in a different thread --- src/game/chraicommands.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/game/chraicommands.c b/src/game/chraicommands.c index 49e55c0e6..23de393bb 100644 --- a/src/game/chraicommands.c +++ b/src/game/chraicommands.c @@ -9839,11 +9839,20 @@ bool aiIfMusicEventQueueIsEmpty(void) { f32 value = (u64)osGetCount() * 64 / 3000; +#ifdef PLATFORM_N64 // will hang forever until the audio thread wakes it up if (g_MusicEventQueueLength) { +#else // HACK: will wait 1 frame and get on with it + static bool waited = false; + if (g_MusicEventQueueLength && !waited) { + waited = true; +#endif g_Vars.aioffset += 4; } else { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]); +#ifndef PLATFORM_N64 + waited = false; +#endif } return false;