Android hang fix when switching backends, buildfix

This commit is contained in:
Henrik Rydgård committed 2026-08-05 00:59:33 +02:00
1 parent 0324c7a912
commit 905650921e
3 files changed
+18 -1

No files matched your search

-1
View File
@@ -999,7 +999,6 @@ ifeq ($(HEADLESS),1)
LOCAL_MODULE := ppsspp_headless
LOCAL_SRC_FILES := \
$(SRC)/headless/Headless.cpp \
$(SRC)/headless/HeadlessHost.cpp \
$(SRC)/headless/Compare.cpp
include $(BUILD_EXECUTABLE)
+4
View File
@@ -902,6 +902,10 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) {
if (renderer_inited && graphicsContext && graphicsContext->NeedsSeparateEmuThread()) {
// Only used in Java EGL path.
INFO_LOG(Log::System, "Joining emuthread.");
EmuThread_RequestExit();
// Eat up any remaining frames.
while (graphicsContext->ThreadFrame()) {}
EmuThread_Join(graphicsContext, g_emuThread);
INFO_LOG(Log::System, "EmuThread joined.");
+14
View File
@@ -259,6 +259,11 @@ static GraphicsContext *CreateGraphicsContext(GPUCore gpuCore, std::string **dev
// never actually needs to create a graphics context at runtime.
*deviceSetting = nullptr;
return nullptr;
#elif PPSSPP_PLATFORM(ANDROID)
// The Android headless build is compile-tested only and never actually needs to create a graphics context at runtime.
// However, it would still be nice if hardware rendering worked - it can be executed over adb.
*deviceSetting = nullptr;
return nullptr;
#else
#error The Headless build is not supported on this platform. Please use SDL (Mac/Linux) or Windows (non-UWP).
#endif
@@ -704,6 +709,10 @@ int main(int argc, const char* argv[]) {
// We don't bother with a window.
graphicsContext = new NullGraphicsContext();
} else {
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_ARCH(LOONGARCH64)
fprintf(stderr, "Headless graphics context creation is not supported on this platform.\n");
return 1;
#else
// TODO: Will we need a larger window for higher resolutions? Well, not if we use buffered rendering.
windowDesc = CreateHiddenWindow(480, 272, cmdLineOptions.gpuBackend.value());
if (!windowDesc.Valid()) {
@@ -716,6 +725,7 @@ int main(int argc, const char* argv[]) {
fprintf(stderr, "Failed to create a graphics context for GPU core");
return 1;
}
#endif
}
// TODO: This whole function should be refactored to set up CoreParameter in one place,
@@ -826,9 +836,13 @@ int main(int argc, const char* argv[]) {
ShutdownWebServer();
}
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_ARCH(LOONGARCH64)
// ... see above
#else
if (windowDesc.Valid()) {
DestroyHiddenWindow(windowDesc);
}
#endif
g_VFS.Clear();
g_logManager.Shutdown();