From 0ef46cf8b0ab6f3caedfc5b0ef281fbdcab5d4d3 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 20 Aug 2023 13:31:02 +0300 Subject: [PATCH] SDMC archive always has read perms --- src/core/fs/archive_sdmc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/fs/archive_sdmc.cpp b/src/core/fs/archive_sdmc.cpp index 428354d1..c8e4ebb3 100644 --- a/src/core/fs/archive_sdmc.cpp +++ b/src/core/fs/archive_sdmc.cpp @@ -19,7 +19,11 @@ FileDescriptor SDMCArchive::openFile(const FSPath& path, const FilePerms& perms) Helpers::panic("Unsafe path in SaveData::OpenFile"); } - if (perms.raw == 0 || (perms.create() && !perms.write())) { + FilePerms realPerms = perms; + // SD card always has read permission + realPerms.raw |= (1 << 0); + + if ((realPerms.create() && !realPerms.write())) { Helpers::panic("[SaveData] Unsupported flags for OpenFile"); } @@ -33,7 +37,7 @@ FileDescriptor SDMCArchive::openFile(const FSPath& path, const FilePerms& perms) return file.isOpen() ? file.getHandle() : FileError; } else { // If the file is not found, create it if the create flag is on - if (perms.create()) { + if (realPerms.create()) { IOFile file(p.string().c_str(), "wb"); // Create file file.close(); // Close it