Persist ImGui panel layout to disk; quiet audio set_audio_ring log spam

Layout persistence: re-enable io.IniFilename (was nullptr "for the spike"),
anchored to a coop_layout.ini next to the exe so window positions/sizes survive
restarts even when Steam launches us under the donor appid (CWD is unreliable).
Path is UTF-8 for ImGui's file IO. When a saved layout is restored at startup,
suppress the computed-default force so it does not clobber the user's positions;
Reset layout (and a fresh install with no .ini) still applies the default.

Log spam: the worker thread re-attaches every audio ring every tick (idempotent),
and set_audio_ring logged unconditionally, flooding the log. Only log when the
ring pointer actually changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 11:24:23 +02:00
parent 86905a1f35
commit 22b0dff918
5 changed files with 62 additions and 5 deletions

View File

@@ -17,6 +17,9 @@ bool g_layout_reset = false;
// WorkSize isn't trustworthy on frame 0, and FirstUseEver would otherwise lock in
// those wrong positions (overlapping) until the user pressed Reset layout.
int g_startup_force = 4;
// True when ImGui loaded a saved layout (.ini) at startup; then the startup force is
// suppressed so the restored window positions survive (Reset layout still re-applies).
bool g_had_persisted_layout = false;
} // namespace
void request_layout_reset()
@@ -24,6 +27,11 @@ void request_layout_reset()
g_layout_reset = true;
}
void set_layout_persisted(bool had_persisted_layout)
{
g_had_persisted_layout = had_persisted_layout;
}
void apply_layout_end_frame()
{
g_layout_reset = false;
@@ -87,7 +95,11 @@ void apply_panel_layout(Panel panel)
break;
}
const ImGuiCond cond = (g_layout_reset || g_startup_force > 0) ? ImGuiCond_Always : ImGuiCond_FirstUseEver;
// Force the computed layout only when the user asks (Reset layout) or on a fresh
// install with no saved layout to restore. Otherwise FirstUseEver lets ImGui's
// restored .ini positions stand (and still seeds any brand-new panel).
const bool force = g_layout_reset || (!g_had_persisted_layout && g_startup_force > 0);
const ImGuiCond cond = force ? ImGuiCond_Always : ImGuiCond_FirstUseEver;
ImGui::SetNextWindowPos(pos, cond);
ImGui::SetNextWindowSize(size, cond);
}