core: Add dump RomFS support

This is added to LayeredFS, then the NCCH container and then the loader interface.
This commit is contained in:
zhupengfei 2020-02-09 20:59:31 +08:00
parent db18f6c79a
commit 13e2d534e9
No known key found for this signature in database
GPG key ID: DD129E108BD09378
7 changed files with 131 additions and 7 deletions

View file

@ -186,6 +186,15 @@ public:
return ResultStatus::ErrorNotImplemented;
}
/**
* Dump the RomFS of the applciation
* @param target_path The target path to dump to
* @return ResultStatus result of function
*/
virtual ResultStatus DumpRomFS(const std::string& target_path) {
return ResultStatus::ErrorNotImplemented;
}
/**
* Get the update RomFS of the application
* Since the RomFS can be huge, we return a file reference instead of copying to a buffer
@ -196,6 +205,15 @@ public:
return ResultStatus::ErrorNotImplemented;
}
/**
* Dump the update RomFS of the applciation
* @param target_path The target path to dump to
* @return ResultStatus result of function
*/
virtual ResultStatus DumpUpdateRomFS(const std::string& target_path) {
return ResultStatus::ErrorNotImplemented;
}
/**
* Get the title of the application
* @param title Reference to store the application title into

View file

@ -254,6 +254,18 @@ ResultStatus AppLoader_NCCH::ReadUpdateRomFS(std::shared_ptr<FileSys::RomFSReade
return ResultStatus::Success;
}
ResultStatus AppLoader_NCCH::DumpRomFS(const std::string& target_path) {
return base_ncch.DumpRomFS(target_path);
}
ResultStatus AppLoader_NCCH::DumpUpdateRomFS(const std::string& target_path) {
u64 program_id;
ReadProgramId(program_id);
update_ncch.OpenFile(Service::AM::GetTitleContentPath(Service::FS::MediaType::SDMC,
program_id | UPDATE_MASK));
return update_ncch.DumpRomFS(target_path);
}
ResultStatus AppLoader_NCCH::ReadTitle(std::string& title) {
std::vector<u8> data;
Loader::SMDH smdh;

View file

@ -59,6 +59,10 @@ public:
ResultStatus ReadUpdateRomFS(std::shared_ptr<FileSys::RomFSReader>& romfs_file) override;
ResultStatus DumpRomFS(const std::string& target_path) override;
ResultStatus DumpUpdateRomFS(const std::string& target_path) override;
ResultStatus ReadTitle(std::string& title) override;
private: