Skip to content

Commit

Permalink
Merge pull request #18718 from hrydgard/fix-running-prx-on-scoped-sto…
Browse files Browse the repository at this point in the history
…rage

Android: Fix running plain PRXs on scoped storage. Minor cleanup.
  • Loading branch information
hrydgard committed Jan 18, 2024
2 parents 554a89b + d1fb213 commit 7627de4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 3 additions & 5 deletions Core/FileSystems/DirectoryFileSystem.cpp
Expand Up @@ -262,16 +262,14 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File
return false;
}
fullName = GetLocalPath(basePath, fileName);
const char *fullNameC = fullName.c_str();

DEBUG_LOG(FILESYS, "Case may have been incorrect, second try opening %s (%s)", fullNameC, fileName.c_str());
DEBUG_LOG(FILESYS, "Case may have been incorrect, second try opening %s (%s)", fullName.c_str(), fileName.c_str());

// And try again with the correct case this time
#ifdef _WIN32
hFile = CreateFile(fullNameC, desired, sharemode, 0, openmode, 0, 0);
hFile = CreateFile(fullName.c_str(), desired, sharemode, 0, openmode, 0, 0);
success = hFile != INVALID_HANDLE_VALUE;
#else
hFile = open(fullNameC, flags, 0666);
hFile = open(fullName.c_str(), flags, 0666);
success = hFile != -1;
#endif
}
Expand Down
5 changes: 4 additions & 1 deletion Core/PSPLoaders.cpp
Expand Up @@ -395,6 +395,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
ms_path = "umd0:/";
}

Path dir;
if (!PSP_CoreParameter().mountRoot.empty()) {
// We don't want to worry about .. and cwd and such.
const Path rootNorm = NormalizePath(PSP_CoreParameter().mountRoot);
Expand Down Expand Up @@ -423,11 +424,13 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) {
file = filepath + "/" + file;
path = rootNorm.ToString();
pspFileSystem.SetStartingDirectory(filepath);
dir = Path(path);
} else {
pspFileSystem.SetStartingDirectory(ms_path);
dir = full_path.NavigateUp();
}

std::shared_ptr<IFileSystem> fs = std::shared_ptr<IFileSystem>(new DirectoryFileSystem(&pspFileSystem, Path(path), FileSystemFlags::SIMULATE_FAT32 | FileSystemFlags::CARD));
std::shared_ptr<IFileSystem> fs = std::shared_ptr<IFileSystem>(new DirectoryFileSystem(&pspFileSystem, dir, FileSystemFlags::SIMULATE_FAT32 | FileSystemFlags::CARD));
pspFileSystem.Mount("umd0:", fs);

std::string finalName = ms_path + file;
Expand Down
6 changes: 5 additions & 1 deletion android/src/org/ppsspp/ppsspp/NativeActivity.java
Expand Up @@ -1348,7 +1348,11 @@ public void onDismiss(DialogInterface d) {
AlertDialog dlg = builder.create();

dlg.setCancelable(true);
dlg.show();
try {
dlg.show();
} catch (Exception e) {
NativeApp.reportException(e, "AlertDialog");
}
}

public boolean processCommand(String command, String params) {
Expand Down

0 comments on commit 7627de4

Please sign in to comment.