diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index d8b04bb343..9a7204a59b 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -188,16 +188,23 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { } // check for original NAND style - // BUT only if we didn't check external provider (to avoid loading wrong update) - if (!checked_external && !checked_manual && update_disabled) { - if (std::find(disabled.cbegin(), disabled.cend(), "Update") == disabled.cend()) { + // Check NAND if: no external updates exist, OR all external updates are disabled + if (!checked_external && !checked_manual) { + // Check if any NAND-style update is enabled + const bool nand_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (NAND)") != disabled.cend(); + const bool sdmc_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (SDMC)") != disabled.cend(); + const bool generic_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); + + if (!nand_disabled || !sdmc_disabled || !generic_disabled) { update_disabled = false; } - if (std::find(disabled.cbegin(), disabled.cend(), "Update (NAND)") == disabled.cend()) { - update_disabled = false; - } - if (std::find(disabled.cbegin(), disabled.cend(), "Update (SDMC)") == disabled.cend()) { + } else if (update_disabled) { + const bool nand_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (NAND)") != disabled.cend(); + const bool sdmc_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (SDMC)") != disabled.cend(); + + if (!nand_disabled || !sdmc_disabled) { update_disabled = false; + enabled_version = std::nullopt; } } @@ -228,7 +235,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { } // Fallback to regular content provider - but only if we didn't check external - if (update == nullptr && !checked_external && !checked_manual) { + if (update == nullptr && !update_disabled) { update = content_provider.GetEntry(update_tid, ContentRecordType::Program); } @@ -586,15 +593,26 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs } } - if (!checked_external && !checked_manual && update_disabled) { - if (std::find(disabled.cbegin(), disabled.cend(), "Update") == disabled.cend() || - std::find(disabled.cbegin(), disabled.cend(), "Update (NAND)") == disabled.cend() || - std::find(disabled.cbegin(), disabled.cend(), "Update (SDMC)") == disabled.cend()) { + if (!checked_external && !checked_manual) { + const bool nand_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (NAND)") != disabled.cend(); + const bool sdmc_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (SDMC)") != disabled.cend(); + const bool generic_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); + + if (!nand_disabled || !sdmc_disabled || !generic_disabled) { update_disabled = false; } if (!update_disabled && update_raw == nullptr) { update_raw = content_provider.GetEntryRaw(update_tid, type); } + } else if (update_disabled) { + const bool nand_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (NAND)") != disabled.cend(); + const bool sdmc_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update (SDMC)") != disabled.cend(); + + if (!nand_disabled || !sdmc_disabled) { + update_disabled = false; + enabled_version = std::nullopt; + update_raw = content_provider.GetEntryRaw(update_tid, type); + } } if (!update_disabled && update_raw != nullptr && base_nca != nullptr) { diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp index d70c19c99e..a28e490860 100644 --- a/src/yuzu/configuration/configure_per_game_addons.cpp +++ b/src/yuzu/configuration/configure_per_game_addons.cpp @@ -169,12 +169,16 @@ void ConfigurePerGameAddons::LoadConfiguration() { first_item->setText(name); first_item->setCheckable(true); - if (patch.type == FileSys::PatchType::Update && patch.numeric_version != 0) { + const bool is_external_update = patch.type == FileSys::PatchType::Update && + patch.source == FileSys::PatchSource::External && + patch.numeric_version != 0; + + if (is_external_update) { first_item->setData(static_cast(patch.numeric_version), Qt::UserRole); } bool patch_disabled = false; - if (patch.type == FileSys::PatchType::Update && patch.numeric_version != 0) { + if (is_external_update) { std::string disabled_key = fmt::format("Update@{}", patch.numeric_version); patch_disabled = std::find(disabled.begin(), disabled.end(), disabled_key) != disabled.end(); } else {