From 2194b7ecf45654648316aa683834e48788279b71 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Wed, 18 Mar 2026 12:06:46 -0400 Subject: [PATCH 1/2] Update m_Do window viewport immediately on Aurora window resize The framebuffer size flows into Aurora as follows: Into JUTVideo: AURORA_WINDOW_RESIZED handler -> mDoGph_gInf_c::setWindowSize -> JUTVideo::setWindowSize From JUTVideo -> dComIfG_play_c: fpcCt_Handler -> phase_4 -> dComIfGp_setWindow From dComIfGp_play_c -> Aurora: mDoGph_Painter -> drawDepth2 -> GXSetTexCopySrc -> GXCopyTex -> aurora::gfx::resolve_pass (called by GXCopyTex) The trouble is that 1) phase_4 is only called when creating a new scene/room, and 2) even when it is called, mDoGph_Painter is executed before fpcCt_Handler in the main loop so the new size isn't visible to aurora::gfx::resolve_pass until one frame after it's set. This causes a crash due to the original size being passed to CopyTextureToTexture despite the destination framebuffer now being smaller. As a workaround, we just cut out the whole middleman section and call dComIfGp_setWindow immediately when we receive a resize event. This way the new size is immediately visible to Aurora. --- src/m_Do/m_Do_graphic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 58345ef864..481bf8efff 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -680,6 +680,7 @@ void mDoGph_gInf_c::setWideZoomLightProjection(Mtx& m) { #if TARGET_PC void mDoGph_gInf_c::setWindowSize(AuroraWindowSize const& size) { JUTVideo::getManager()->setWindowSize(size); + dComIfGp_setWindow(0, 0.0f, 0.0f, getWidth(), getHeight(), 0.0f, 1.0f, 0, 2); mFader->mBox.set(0, 0, getWidth(), getHeight()); } #endif From 49080f61195419ce936764b3aee4a3de34560be5 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Tue, 17 Mar 2026 01:29:59 -0400 Subject: [PATCH 2/2] Move aurora_begin_frame/aurora_end_frame calls to main loop This fixes an issue when using SDL's X11 backend due to Dusk attempting to render ImGui menus without an active frame. --- libs/JSystem/src/JFramework/JFWDisplay.cpp | 8 -------- src/m_Do/m_Do_main.cpp | 12 +++++++++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libs/JSystem/src/JFramework/JFWDisplay.cpp b/libs/JSystem/src/JFramework/JFWDisplay.cpp index 6812a81880..b55649a1bc 100644 --- a/libs/JSystem/src/JFramework/JFWDisplay.cpp +++ b/libs/JSystem/src/JFramework/JFWDisplay.cpp @@ -227,10 +227,6 @@ void JFWDisplay::endGX() { } void JFWDisplay::beginRender() { -#if TARGET_PC - aurora_begin_frame(); -#endif - if (field_0x40) { JUTProcBar::getManager()->wholeLoopEnd(); } @@ -342,10 +338,6 @@ void JFWDisplay::endFrame() { JUTProcBar::getManager()->setCostFrame(retrace_cnt - prevFrame); prevFrame = retrace_cnt; } - -#if TARGET_PC - aurora_end_frame(); -#endif } void JFWDisplay::waitBlanking(int param_0) { diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 98cd35ef01..20fc2a8aee 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -172,18 +172,24 @@ void main01(void) { VIWaitForRetrace(); +#if TARGET_PC + if (!aurora_begin_frame()) { + DuskLog.debug("aurora_begin_frame returned false, skipping draw this frame"); + continue; + } +#endif + // EXECUTE GAME LOGIC & RENDER // This calls mDoGph_Painter -> JFWDisplay -> GX Functions fapGm_Execute(); mDoAud_Execute(); + aurora_end_frame(); + #if TARGET_PC frameLimiter.Sleep(DUSK_FRAME_PERIOD); #endif - - //aurora_end_frame(); - } while (true); exit:;