Fix New Game fade presentation

This commit is contained in:
gamer147
2026-07-27 12:16:53 -04:00
parent ecf7289c7d
commit 8bc60d89ad
2 changed files with 20 additions and 3 deletions

View File

@@ -1539,8 +1539,20 @@ public sealed class GodotAdvHost : IHost
_main.CallDeferred("FadeBgm", targetPercent, realSeconds);
long deadline = _clock.NowMs + ms;
IsSleeping = true;
while (_clock.NowMs < deadline && !_stopping) _frameSignal.WaitOne(50);
IsSleeping = false;
bool scriptSuspended = SuspendScriptForPresentation();
try
{
// Native parks the interpreter in its audio service while the main render loop continues.
// Publish scene changes accumulated before the fade (notably GAMESTART -> SC0000's black
// frame), then leave presentation ownership with the compositor for the timed wait.
RequestSynchronizedPresentation();
while (_clock.NowMs < deadline && !_stopping) _frameSignal.WaitOne(50);
}
finally
{
ResumeScriptAfterPresentation(scriptSuspended);
IsSleeping = false;
}
_timeline?.State("running", new() { ["bgm_fade_complete"] = true });
}
}