bktr: Implement IVFC offset shifting

Fixes base game read errors
This commit is contained in:
Zach Hilman 2018-08-28 22:37:42 -04:00
parent 9664ce255d
commit a6e75cd45b
8 changed files with 36 additions and 8 deletions

View file

@ -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

View file

@ -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;

View file

@ -37,6 +37,7 @@ public:
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
u64 ReadRomFSIVFCOffset() const override;
ResultStatus ReadProgramId(u64& out_program_id) override;
private: