game_list: Fix version display on non-NAND titles
This commit is contained in:
parent
cbd517d8cc
commit
c91b60a421
4 changed files with 52 additions and 30 deletions
|
@ -82,15 +82,31 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset,
|
|||
return romfs;
|
||||
}
|
||||
|
||||
std::map<PatchType, u32> PatchManager::GetPatchVersionNames() const {
|
||||
std::map<PatchType, u32> out;
|
||||
std::map<PatchType, std::string> PatchManager::GetPatchVersionNames() const {
|
||||
std::map<PatchType, std::string> out;
|
||||
const auto installed = Service::FileSystem::GetUnionContents();
|
||||
|
||||
const auto update_tid = GetUpdateTitleID(title_id);
|
||||
const auto update_version = installed->GetEntryVersion(update_tid);
|
||||
if (update_version != boost::none &&
|
||||
installed->HasEntry(update_tid, ContentRecordType::Program)) {
|
||||
out[PatchType::Update] = update_version.get();
|
||||
const auto update_control = installed->GetEntry(title_id, ContentRecordType::Control);
|
||||
if (update_control != nullptr) {
|
||||
do {
|
||||
const auto romfs =
|
||||
PatchRomFS(update_control->GetRomFS(), update_control->GetBaseIVFCOffset(),
|
||||
FileSys::ContentRecordType::Control);
|
||||
if (romfs == nullptr)
|
||||
break;
|
||||
|
||||
const auto control_dir = FileSys::ExtractRomFS(romfs);
|
||||
if (control_dir == nullptr)
|
||||
break;
|
||||
|
||||
const auto nacp_file = control_dir->GetFile("control.nacp");
|
||||
if (nacp_file == nullptr)
|
||||
break;
|
||||
|
||||
FileSys::NACP nacp(nacp_file);
|
||||
out[PatchType::Update] = nacp.GetVersionString();
|
||||
} while (false);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
// Returns a vector of pairs between patch names and patch versions.
|
||||
// i.e. Update v80 will return {Update, 80}
|
||||
std::map<PatchType, u32> GetPatchVersionNames() const;
|
||||
std::map<PatchType, std::string> GetPatchVersionNames() const;
|
||||
|
||||
private:
|
||||
u64 title_id;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "core/file_sys/card_image.h"
|
||||
#include "core/file_sys/content_archive.h"
|
||||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/file_sys/romfs.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/loader/nca.h"
|
||||
|
@ -20,10 +21,18 @@ AppLoader_XCI::AppLoader_XCI(FileSys::VirtualFile file)
|
|||
nca_loader(std::make_unique<AppLoader_NCA>(xci->GetProgramNCAFile())) {
|
||||
if (xci->GetStatus() != ResultStatus::Success)
|
||||
return;
|
||||
|
||||
const auto control_nca = xci->GetNCAByType(FileSys::NCAContentType::Control);
|
||||
|
||||
if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success)
|
||||
return;
|
||||
const auto romfs = FileSys::ExtractRomFS(control_nca->GetRomFS());
|
||||
|
||||
auto romfs_raw = control_nca->GetRomFS();
|
||||
FileSys::PatchManager patch{xci->GetNCAByType(FileSys::NCAContentType::Program)->GetTitleId()};
|
||||
romfs_raw = patch.PatchRomFS(romfs_raw, control_nca->GetBaseIVFCOffset(),
|
||||
FileSys::ContentRecordType::Control);
|
||||
|
||||
const auto romfs = FileSys::ExtractRomFS(romfs_raw);
|
||||
if (romfs == nullptr)
|
||||
return;
|
||||
for (const auto& language : FileSys::LANGUAGE_NAMES) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue