From a6e75cd45b75a202eed1a68692e33e7732789dd2 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 28 Aug 2018 22:37:42 -0400 Subject: bktr: Implement IVFC offset shifting Fixes base game read errors --- src/core/loader/loader.h | 9 +++++++++ src/core/loader/nca.cpp | 6 ++++++ src/core/loader/nca.h | 1 + 3 files changed, 16 insertions(+) (limited to 'src/core/loader') diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 225c05127..843c4bb91 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -214,6 +214,15 @@ public: return true; } + /** + * Gets the difference between the start of the IVFC header and the start of level 6 (RomFS) + * data. Needed for bktr patching. + * @return IVFC offset for romfs. + */ + virtual u64 ReadRomFSIVFCOffset() const { + return 0; + } + /** * Get the title of the application * @param title Reference to store the application title into diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index 6b1c27b47..6aaffae59 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp @@ -71,6 +71,12 @@ ResultStatus AppLoader_NCA::ReadRomFS(FileSys::VirtualFile& dir) { return ResultStatus::Success; } +u64 AppLoader_NCA::ReadRomFSIVFCOffset() const { + if (nca == nullptr) + return 0; + return nca->GetBaseIVFCOffset(); +} + ResultStatus AppLoader_NCA::ReadProgramId(u64& out_program_id) { if (nca == nullptr || nca->GetStatus() != ResultStatus::Success) return ResultStatus::ErrorNotInitialized; diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h index 326f84857..10be197c4 100644 --- a/src/core/loader/nca.h +++ b/src/core/loader/nca.h @@ -37,6 +37,7 @@ public: ResultStatus Load(Kernel::SharedPtr& process) override; ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; + u64 ReadRomFSIVFCOffset() const override; ResultStatus ReadProgramId(u64& out_program_id) override; private: -- cgit v1.2.3