mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 17:49:29 +01:00
ImGui: Keep the context and debugger state when Android switches away
NativeShutdownGraphics, which Android runs whenever the app loses its surface, destroyed the imgui context and the ImDebugger along with the device objects, so window layout and debugger state reset on return. Now only the device objects go there (the backend already recreates them), and the context and debugger are torn down in NativeShutdown. Both configs are still saved on device loss, in case the app is killed in the background. imgui.ini is now read and written through our File API rather than imgui's fopen, which can't reach a memstick behind a content URI. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c37498808c
commit
70988aa50c
5 files changed
+49
-14
No files matched your search
+19
-11
@@ -436,6 +436,7 @@ void runImDebugger(Draw::DrawContext *draw) {
|
||||
|
||||
// Convert to drawlists.
|
||||
ImGui::Render();
|
||||
ImGui_ImplPlatform_SaveIni(false);
|
||||
wantTextInput = io.WantTextInput;
|
||||
} else {
|
||||
uiContext->SetOverrideScreenFrame(nullptr);
|
||||
@@ -1128,19 +1129,13 @@ void NativeShutdownGraphics(GraphicsContext *graphicsContext) {
|
||||
gpu->DeviceLost();
|
||||
}
|
||||
|
||||
// The imgui context and the debugger outlive the graphics, so that their state survives Android
|
||||
// switching away from the app. Save now anyway, since the app may be killed in the background.
|
||||
if (imguiInited_) {
|
||||
if (imDebugger_) {
|
||||
imDebugger_->DeviceLost();
|
||||
}
|
||||
imDebugger_->DeviceLost();
|
||||
imDebugger_->SaveConfig();
|
||||
ImGui_ImplPlatform_SaveIni(true);
|
||||
ImGui_ImplThin3d_DestroyDeviceObjects();
|
||||
ImGui_ImplThin3d_Shutdown();
|
||||
// Destroy the debugger here, while the things it refers to are still alive. If left to
|
||||
// static destruction, ~ImDisasmView runs after Core's globals are gone and its
|
||||
// g_disassemblyManager.clear() walks a destroyed map (and locks a destroyed mutex).
|
||||
imDebugger_.reset();
|
||||
ImGui::DestroyContext(ctx_);
|
||||
ctx_ = nullptr;
|
||||
imguiInited_ = false;
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
|
||||
@@ -1979,6 +1974,19 @@ void NativeShutdown() {
|
||||
g_screenManager = nullptr;
|
||||
}
|
||||
|
||||
if (imguiInited_) {
|
||||
ImGui_ImplPlatform_SaveIni(true);
|
||||
// The device objects went with NativeShutdownGraphics.
|
||||
ImGui_ImplThin3d_Shutdown();
|
||||
// Destroy the debugger here, while the things it refers to are still alive. If left to
|
||||
// static destruction, ~ImDisasmView runs after Core's globals are gone and its
|
||||
// g_disassemblyManager.clear() walks a destroyed map (and locks a destroyed mutex).
|
||||
imDebugger_.reset();
|
||||
ImGui::DestroyContext(ctx_);
|
||||
ctx_ = nullptr;
|
||||
imguiInited_ = false;
|
||||
}
|
||||
|
||||
System_Notify(SystemNotification::BEFORE_CONFIG_SAVE_ON_EXIT);
|
||||
|
||||
g_Config.Save("NativeShutdown");
|
||||
|
||||
Reference in new issue
Block a user