From dd3ed5650983180ed71640567c588bd21bb43564 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Sun, 5 May 2024 10:05:35 +0200 Subject: [PATCH] nn_save: Fix inverted condition preventing accessing other title's saves --- src/Cafe/OS/libs/nn_save/nn_save.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Cafe/OS/libs/nn_save/nn_save.cpp b/src/Cafe/OS/libs/nn_save/nn_save.cpp index 518e4195..09d4413b 100644 --- a/src/Cafe/OS/libs/nn_save/nn_save.cpp +++ b/src/Cafe/OS/libs/nn_save/nn_save.cpp @@ -118,11 +118,11 @@ namespace save return false; } - SAVEStatus GetAbsoluteFullPathOtherApplication(uint32 persistentId, uint64 titleId, const char* subDir, char* outPath) + FS_RESULT GetAbsoluteFullPathOtherApplication(uint32 persistentId, uint64 titleId, const char* subDir, char* outPath) { uint32be applicationBox; if(acp::ACPGetApplicationBox(&applicationBox, titleId) != acp::ACPStatus::SUCCESS) - return (FSStatus)FS_RESULT::NOT_FOUND; + return FS_RESULT::NOT_FOUND; sint32 written = 0; if(applicationBox == 3) @@ -151,13 +151,13 @@ namespace save cemu_assert_unimplemented(); } else - return (FSStatus)FS_RESULT::NOT_FOUND; + return FS_RESULT::NOT_FOUND; if (written < SAVE_MAX_PATH_SIZE - 1) - return (FSStatus)FS_RESULT::SUCCESS; + return FS_RESULT::SUCCESS; cemu_assert_suspicious(); - return (FSStatus)(FS_RESULT::FATAL_ERROR); + return FS_RESULT::FATAL_ERROR; } typedef struct @@ -417,7 +417,7 @@ namespace save if (GetPersistentIdEx(accountSlot, &persistentId)) { char fullPath[SAVE_MAX_PATH_SIZE]; - if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath)) + if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath) == FS_RESULT::SUCCESS) result = coreinit::FSOpenFileAsync(client, block, fullPath, (char*)mode, outFileHandle, errHandling, (FSAsyncParams*)asyncParams); } else @@ -527,7 +527,7 @@ namespace save if (GetPersistentIdEx(accountSlot, &persistentId)) { char fullPath[SAVE_MAX_PATH_SIZE]; - if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath) == (FSStatus)FS_RESULT::SUCCESS) + if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath) == FS_RESULT::SUCCESS) result = coreinit::__FSQueryInfoAsync(client, block, (uint8*)fullPath, FSA_QUERY_TYPE_STAT, stat, errHandling, (FSAsyncParams*)asyncParams); // FSGetStatAsync(...) } else @@ -811,7 +811,7 @@ namespace save if (GetPersistentIdEx(accountSlot, &persistentId)) { char fullPath[SAVE_MAX_PATH_SIZE]; - if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath)) + if (GetAbsoluteFullPathOtherApplication(persistentId, titleId, path, fullPath) == FS_RESULT::SUCCESS) result = coreinit::FSOpenDirAsync(client, block, fullPath, hDir, errHandling, (FSAsyncParams*)asyncParams); } else