Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix a few bugs in app-android.cpp
  • Loading branch information
hrydgard committed Feb 26, 2026
commit 68a59e42cdc1105b2e52993de10865ea142f3ba6
14 changes: 10 additions & 4 deletions android/jni/app-android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init
INFO_LOG(Log::System, "Failed to initialize Vulkan, switching to OpenGL");
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
SetGPUBackend(GPUBackend::OPENGL);
delete ctx;
goto retry;
} else {
graphicsContext = ctx;
Expand Down Expand Up @@ -1693,6 +1694,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_PpssppActivity_requestExitVulkanR
}

// TODO: Merge with the Win32 EmuThread and so on, and the Java EmuThread?
// This function must release the window reference.
static void VulkanEmuThread(ANativeWindow *wnd) {
SetCurrentThreadName("EmuThread");

Expand All @@ -1703,13 +1705,15 @@ static void VulkanEmuThread(ANativeWindow *wnd) {
ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context.");
renderLoopRunning = false;
exitRenderLoop = false;
ANativeWindow_release(wnd);
return;
}

if (exitRenderLoop) {
WARN_LOG(Log::G3D, "runVulkanRenderLoop: ExitRenderLoop requested at start, skipping the whole thing.");
renderLoopRunning = false;
exitRenderLoop = false;
ANativeWindow_release(wnd);
return;
}

Expand All @@ -1729,6 +1733,7 @@ static void VulkanEmuThread(ANativeWindow *wnd) {
delete graphicsContext;
graphicsContext = nullptr;
renderLoopRunning = false;
ANativeWindow_release(wnd);
return;
}

Expand Down Expand Up @@ -1764,6 +1769,7 @@ static void VulkanEmuThread(ANativeWindow *wnd) {
graphicsContext->ShutdownFromRenderThread();
renderLoopRunning = false;
exitRenderLoop = false;
ANativeWindow_release(wnd);

WARN_LOG(Log::G3D, "Render loop function exited.");
}
Expand Down Expand Up @@ -1798,15 +1804,15 @@ Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameInfo(JNIEnv * env, jclass, jobj
if (info) {
INFO_LOG(Log::System, "GetInfo successful, waiting");

// Wait for both name and icon
int attempts = 1000;
// Wait for both name and icon for a second.
int attempts = 100;
while ((!info->Ready(GameInfoFlags::PARAM_SFO) || !info->Ready(GameInfoFlags::ICON)) && attempts > 0) {
sleep_ms(1, "info-icon-poll");
sleep_ms(10, "info-icon-poll");
attempts--;
}
INFO_LOG(Log::System, "Done waiting");

if (info->fileType != IdentifiedFileType::UNKNOWN) {
if (attempts > 0 && info->fileType != IdentifiedFileType::UNKNOWN) {
// Get the game title
gameName = info->GetTitle();
if (gameName.length() > strlen("The ") && startsWithNoCase(gameName, "The ")) {
Expand Down
Loading