ncch_container: support encrypted games

This commit is contained in:
wwylele
2018-07-28 18:30:54 +03:00
parent b92660435c
commit d4a808c885
17 changed files with 319 additions and 103 deletions

View File

@ -174,8 +174,7 @@ private:
std::unique_ptr<DelayGenerator> delay_generator =
std::make_unique<RomFSDelayGenerator>();
return MakeResult<std::unique_ptr<FileBackend>>(
std::make_unique<IVFCFile>(ncch_data.romfs_file, ncch_data.romfs_offset,
ncch_data.romfs_size, std::move(delay_generator)));
std::make_unique<IVFCFile>(ncch_data.romfs_file, std::move(delay_generator)));
} else {
LOG_INFO(Service_FS, "Unable to read RomFS");
return ERROR_ROMFS_NOT_FOUND;
@ -187,8 +186,7 @@ private:
std::unique_ptr<DelayGenerator> delay_generator =
std::make_unique<RomFSDelayGenerator>();
return MakeResult<std::unique_ptr<FileBackend>>(std::make_unique<IVFCFile>(
ncch_data.update_romfs_file, ncch_data.update_romfs_offset,
ncch_data.update_romfs_size, std::move(delay_generator)));
ncch_data.update_romfs_file, std::move(delay_generator)));
} else {
LOG_INFO(Service_FS, "Unable to read update RomFS");
return ERROR_ROMFS_NOT_FOUND;
@ -252,17 +250,14 @@ void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
NCCHData& data = ncch_data[program_id];
std::shared_ptr<FileUtil::IOFile> romfs_file_;
if (Loader::ResultStatus::Success ==
app_loader.ReadRomFS(romfs_file_, data.romfs_offset, data.romfs_size)) {
std::shared_ptr<RomFSReader> romfs_file_;
if (Loader::ResultStatus::Success == app_loader.ReadRomFS(romfs_file_)) {
data.romfs_file = std::move(romfs_file_);
}
std::shared_ptr<FileUtil::IOFile> update_romfs_file;
if (Loader::ResultStatus::Success == app_loader.ReadUpdateRomFS(update_romfs_file,
data.update_romfs_offset,
data.update_romfs_size)) {
std::shared_ptr<RomFSReader> update_romfs_file;
if (Loader::ResultStatus::Success == app_loader.ReadUpdateRomFS(update_romfs_file)) {
data.update_romfs_file = std::move(update_romfs_file);
}