mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
[android,ui] fix nand update getting external update version instead
This commit is contained in:
parent
f1463a8e41
commit
725ee482ec
1 changed files with 42 additions and 12 deletions
|
|
@ -123,6 +123,39 @@ bool IsVersionedExternalUpdateDisabled(const std::vector<std::string>& disabled,
|
||||||
return std::find(disabled.cbegin(), disabled.cend(), disabled_key) != disabled.cend() ||
|
return std::find(disabled.cbegin(), disabled.cend(), disabled_key) != disabled.cend() ||
|
||||||
std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
|
std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetUpdateVersionStringFromSlot(const ContentProvider* provider, u64 update_tid) {
|
||||||
|
if (provider == nullptr) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto control_nca = provider->GetEntry(update_tid, ContentRecordType::Control);
|
||||||
|
if (control_nca == nullptr ||
|
||||||
|
control_nca->GetStatus() != Loader::ResultStatus::Success) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto romfs = control_nca->GetRomFS();
|
||||||
|
if (romfs == nullptr) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto extracted = ExtractRomFS(romfs);
|
||||||
|
if (extracted == nullptr) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto nacp_file = extracted->GetFile("control.nacp");
|
||||||
|
if (nacp_file == nullptr) {
|
||||||
|
nacp_file = extracted->GetFile("Control.nacp");
|
||||||
|
}
|
||||||
|
if (nacp_file == nullptr) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
NACP nacp{nacp_file};
|
||||||
|
return nacp.GetVersionString();
|
||||||
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
PatchManager::PatchManager(u64 title_id_,
|
PatchManager::PatchManager(u64 title_id_,
|
||||||
|
|
@ -796,19 +829,16 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
|
||||||
|
|
||||||
std::string version_str;
|
std::string version_str;
|
||||||
u32 numeric_ver = 0;
|
u32 numeric_ver = 0;
|
||||||
PatchManager update{update_tid, fs_controller, content_provider};
|
const auto* slot_provider = content_union->GetSlotProvider(slot);
|
||||||
const auto metadata = update.GetControlMetadata();
|
version_str = GetUpdateVersionStringFromSlot(slot_provider, update_tid);
|
||||||
const auto& nacp = metadata.first;
|
|
||||||
|
|
||||||
if (nacp != nullptr) {
|
if (slot_provider != nullptr) {
|
||||||
version_str = nacp->GetVersionString();
|
const auto slot_ver = slot_provider->GetEntryVersion(update_tid);
|
||||||
}
|
if (slot_ver.has_value()) {
|
||||||
|
numeric_ver = *slot_ver;
|
||||||
const auto meta_ver = content_provider.GetEntryVersion(update_tid);
|
if (version_str.empty() && numeric_ver != 0) {
|
||||||
if (meta_ver.has_value()) {
|
version_str = FormatTitleVersion(numeric_ver);
|
||||||
numeric_ver = *meta_ver;
|
}
|
||||||
if (version_str.empty() && numeric_ver != 0) {
|
|
||||||
version_str = FormatTitleVersion(numeric_ver);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue