mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 17:49:29 +01:00
Settings: Don't keep the draw and UI contexts in page callbacks
Android replaces both when it loses the surface (a recreate, which
changing the display resolution does, or switching away), but the
settings screen and its views live on. The external display setting's
enabled check, which runs on every draw, then called into the deleted
DrawContext ("Pure virtual function called!"). The UI scale and
"Reload UI atlas" handlers had the same problem with the UIContext.
Look them up through the screen manager when needed instead.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
aa9dfa85f6
commit
ac8440e35d
3 files changed
+10
-8
No files matched your search
@@ -403,9 +403,9 @@ static void BuildUIPage(SettingsPage *page) {
|
||||
using namespace UI;
|
||||
SettingsPageHost *host = page->Host();
|
||||
|
||||
UIContext *uiContext = host->PageScreenManager()->getUIContext();
|
||||
page->Choice("Reload UI atlas").OnClick([uiContext](UI::EventParams &) {
|
||||
uiContext->InvalidateAtlas();
|
||||
// Looked up when clicked, the UI context is recreated along with the graphics.
|
||||
page->Choice("Reload UI atlas").OnClick([host](UI::EventParams &) {
|
||||
host->PageScreenManager()->getUIContext()->InvalidateAtlas();
|
||||
});
|
||||
|
||||
// TODO: Move most of these strings out of the SysInfo category.
|
||||
|
||||
@@ -154,11 +154,11 @@ static void BuildUISettingsPage(SettingsPage *page) {
|
||||
using namespace UI;
|
||||
SettingsPageHost *host = page->Host();
|
||||
|
||||
UIContext *ctx = host->PageScreenManager()->getUIContext();
|
||||
page->Setting(&g_Config.iUIScaleFactor).OnChange([ctx](UI::EventParams &e) {
|
||||
// The UI context is looked up when used, since it's recreated along with the graphics.
|
||||
page->Setting(&g_Config.iUIScaleFactor).OnChange([host](UI::EventParams &e) {
|
||||
const float dpiMul = UIScaleFactorToMultiplier(g_Config.iUIScaleFactor);
|
||||
g_display.Recalculate(-1, -1, -1, -1, dpiMul);
|
||||
ctx->InvalidateAtlas();
|
||||
host->PageScreenManager()->getUIContext()->InvalidateAtlas();
|
||||
NativeResized();
|
||||
});
|
||||
|
||||
|
||||
@@ -175,8 +175,10 @@ void BuildGraphicsSettings(SettingsPage *page) {
|
||||
|
||||
#if (PPSSPP_PLATFORM(IOS) && !PPSSPP_PLATFORM(TVOS)) || PPSSPP_PLATFORM(ANDROID)
|
||||
// Showing the game there needs a second swapchain. Otherwise the system mirrors the screen.
|
||||
page->Setting(&g_Config.iExternalDisplay).EnabledFunc([draw] {
|
||||
return draw->GetDeviceCaps().multipleSwapchains;
|
||||
// Looked up each time: the draw context is replaced when Android loses the surface, and this page isn't rebuilt.
|
||||
page->Setting(&g_Config.iExternalDisplay).EnabledFunc([host] {
|
||||
Draw::DrawContext *draw = host->PageScreenManager()->getDrawContext();
|
||||
return draw && draw->GetDeviceCaps().multipleSwapchains;
|
||||
}).OnChange([previous = g_Config.iExternalDisplay](UI::EventParams &e) mutable {
|
||||
// Picking the current value again would rebuild the TV's output for nothing (iOS starts over on a change).
|
||||
if (g_Config.iExternalDisplay == previous) {
|
||||
|
||||
Reference in new issue
Block a user