From 906abe0fb322e3692520d741e7a721c42a0157ff Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 21 Jul 2024 18:29:39 +0300 Subject: [PATCH 1/4] Add -Wno-interference-size flag for GNUC --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fdfe8a4a..1264ce89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ if(APPLE) endif() if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-nonliteral -Wno-format-security") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-nonliteral -Wno-format-security -Wno-interference-size") endif() option(DISABLE_PANIC_DEV "Make a build with fewer and less intrusive asserts" ON) From 04d6c52784894f994da84b0c66892d0eae7629e3 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:34:31 +0000 Subject: [PATCH 2/4] NCCH: Remove unused saveData member --- include/loader/ncch.hpp | 2 -- src/core/loader/ncch.cpp | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/loader/ncch.hpp b/include/loader/ncch.hpp index 8e35643b..4aa2ede7 100644 --- a/include/loader/ncch.hpp +++ b/include/loader/ncch.hpp @@ -64,8 +64,6 @@ struct NCCH { // Contents of the .code file in the ExeFS std::vector codeFile; - // Contains of the cart's save data - std::vector saveData; // The cart region. Only the CXI's region matters to us. Necessary to get past region locking std::optional region = std::nullopt; std::vector smdh; diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 98574289..4be05549 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -155,8 +155,7 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn } } - const u64 saveDataSize = *(u64*)&exheader[0x1C0 + 0x0]; // Size of save data in bytes - saveData.resize(saveDataSize, 0xff); + [[maybe_unused]] const u64 saveDataSize = *(u64*)&exheader[0x1C0 + 0x0]; // Size of save data in bytes compressCode = (exheader[0xD] & 1) != 0; stackSize = *(u32*)&exheader[0x1C]; From 0a0f623c7c9ee44cccde032f8c99f1a6650264cf Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:46:38 +0000 Subject: [PATCH 3/4] NCCH: Fix saveDataSize (Oops) --- include/loader/ncch.hpp | 3 ++- src/core/loader/ncch.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/loader/ncch.hpp b/include/loader/ncch.hpp index 4aa2ede7..92ad5040 100644 --- a/include/loader/ncch.hpp +++ b/include/loader/ncch.hpp @@ -50,6 +50,7 @@ struct NCCH { static constexpr u64 mediaUnit = 0x200; u64 size = 0; // Size of NCCH converted to bytes + u64 saveDataSize = 0; u32 stackSize = 0; u32 bssSize = 0; u32 exheaderSize = 0; @@ -76,7 +77,7 @@ struct NCCH { bool hasExeFS() { return exeFS.size != 0; } bool hasRomFS() { return romFS.size != 0; } bool hasCode() { return codeFile.size() != 0; } - bool hasSaveData() { return saveData.size() != 0; } + bool hasSaveData() { return saveDataSize != 0; } // Parse SMDH for region info and such. Returns false on failure, true on success bool parseSMDH(const std::vector &smdh); diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 4be05549..e363213c 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -155,7 +155,7 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn } } - [[maybe_unused]] const u64 saveDataSize = *(u64*)&exheader[0x1C0 + 0x0]; // Size of save data in bytes + saveDataSize = *(u64*)&exheader[0x1C0 + 0x0]; // Size of save data in bytes compressCode = (exheader[0xD] & 1) != 0; stackSize = *(u32*)&exheader[0x1C]; From 3d9a1a8b5d7a661f03d94a63d809b2c746e63228 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:07:28 +0300 Subject: [PATCH 4/4] I should really squash this when I'm home --- src/core/loader/ncch.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index e363213c..a575d4f2 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -25,7 +25,6 @@ bool NCCH::loadFromHeader(Crypto::AESEngine &aesEngine, IOFile& file, const FSIn } codeFile.clear(); - saveData.clear(); smdh.clear(); partitionInfo = info;