From e93427c433bd750ab97c3064e94098eb10d0669f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 31 Oct 2024 23:56:36 +0100 Subject: [PATCH] CPU_Init: Bail out earlier if we fail to identify a file. --- Common/File/AndroidStorage.cpp | 8 ++++++++ Core/System.cpp | 4 ++-- android/src/org/ppsspp/ppsspp/PpssppActivity.java | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Common/File/AndroidStorage.cpp b/Common/File/AndroidStorage.cpp index 2ec63fb47c..2325657c79 100644 --- a/Common/File/AndroidStorage.cpp +++ b/Common/File/AndroidStorage.cpp @@ -6,6 +6,7 @@ #include "Common/TimeUtil.h" #include "android/jni/app-android.h" +#include "Common/Thread/ThreadUtil.h" #if PPSSPP_PLATFORM(ANDROID) && !defined(__LIBRETRO__) @@ -70,6 +71,13 @@ int Android_OpenContentUriFd(std::string_view filename, Android_OpenContentUriMo return -1; } + /* + // Should breakpoint here to try to find and move as many of these off the EmuThread as possible + if (!strcmp(GetCurrentThreadName(), "EmuThread")) { + WARN_LOG(Log::IO, "Content URI opened on EmuThread: %.*s", (int)filename.size(), filename.data()); + } + */ + std::string fname(filename); // PPSSPP adds an ending slash to directories before looking them up. // TODO: Fix that in the caller (or don't call this for directories). diff --git a/Core/System.cpp b/Core/System.cpp index 6764e6901c..2cf51d96c4 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -289,8 +289,8 @@ bool CPU_Init(std::string *errorString, FileLoader *loadedFile) { break; default: // Can we even get here? - WARN_LOG(Log::Loader, "CPU_Init didn't recognize file. %s", errorString->c_str()); - break; + ERROR_LOG(Log::Loader, "CPU_Init didn't recognize file. %s", errorString->c_str()); + return false; } // Here we have read the PARAM.SFO, let's see if we need any compatibility overrides. diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index af45a2d75d..e6a3ac3aa2 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -237,8 +237,7 @@ public class PpssppActivity extends NativeActivity { public long computeRecursiveDirectorySize(String uriString) { try { Uri uri = Uri.parse(uriString); - long totalSize = directorySizeRecursion(uri); - return totalSize; + return directorySizeRecursion(uri); } catch (Exception e) { Log.e(TAG, "computeRecursiveSize exception: " + e);