aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys/patch_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/file_sys/patch_manager.cpp')
-rw-r--r--src/core/file_sys/patch_manager.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index 82944ceceb..e9c3bb75c2 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -117,6 +117,12 @@ void AppendCommaIfNotEmpty(std::string& to, std::string_view with) {
bool IsDirValidAndNonEmpty(const VirtualDir& dir) {
return dir != nullptr && (!dir->GetFiles().empty() || !dir->GetSubdirectories().empty());
}
+
+bool IsVersionedExternalUpdateDisabled(const std::vector<std::string>& disabled, u32 version) {
+ const std::string disabled_key = fmt::format("Update@{}", version);
+ return std::find(disabled.cbegin(), disabled.cend(), disabled_key) != disabled.cend() ||
+ std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
+}
} // Anonymous namespace
PatchManager::PatchManager(u64 title_id_,
@@ -155,8 +161,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
if (!update_versions.empty()) {
checked_external = true;
for (const auto& update_entry : update_versions) {
- std::string disabled_key = fmt::format("Update@{}", update_entry.version);
- if (std::find(disabled.cbegin(), disabled.cend(), disabled_key) == disabled.cend()) {
+ if (!IsVersionedExternalUpdateDisabled(disabled, update_entry.version)) {
update_disabled = false;
enabled_version = update_entry.version;
break;
@@ -175,8 +180,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
if (!manual_update_versions.empty()) {
checked_manual = true;
for (const auto& update_entry : manual_update_versions) {
- std::string disabled_key = fmt::format("Update@{}", update_entry.version);
- if (std::find(disabled.cbegin(), disabled.cend(), disabled_key) == disabled.cend()) {
+ if (!IsVersionedExternalUpdateDisabled(disabled, update_entry.version)) {
update_disabled = false;
enabled_version = update_entry.version;
break;
@@ -580,8 +584,7 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs
if (!update_versions.empty()) {
checked_external = true;
for (const auto& update_entry : update_versions) {
- std::string disabled_key = fmt::format("Update@{}", update_entry.version);
- if (std::find(disabled.cbegin(), disabled.cend(), disabled_key) == disabled.cend()) {
+ if (!IsVersionedExternalUpdateDisabled(disabled, update_entry.version)) {
update_disabled = false;
enabled_version = update_entry.version;
update_raw = external_provider->GetEntryForVersion(update_tid, type, update_entry.version);
@@ -600,8 +603,7 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs
if (!manual_update_versions.empty()) {
checked_manual = true;
for (const auto& update_entry : manual_update_versions) {
- std::string disabled_key = fmt::format("Update@{}", update_entry.version);
- if (std::find(disabled.cbegin(), disabled.cend(), disabled_key) == disabled.cend()) {
+ if (!IsVersionedExternalUpdateDisabled(disabled, update_entry.version)) {
update_disabled = false;
enabled_version = update_entry.version;
update_raw = manual_provider->GetEntryForVersion(update_tid, type, update_entry.version);
@@ -704,9 +706,8 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
version_str = FormatTitleVersion(update_entry.version);
}
- std::string disabled_key = fmt::format("Update@{}", update_entry.version);
const auto update_disabled =
- std::find(disabled.cbegin(), disabled.cend(), disabled_key) != disabled.cend();
+ IsVersionedExternalUpdateDisabled(disabled, update_entry.version);
Patch update_patch = {.enabled = !update_disabled,
.name = "Update",
@@ -732,9 +733,8 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
version_str = FormatTitleVersion(update_entry.version);
}
- std::string disabled_key = fmt::format("Update@{}", update_entry.version);
const auto update_disabled =
- std::find(disabled.cbegin(), disabled.cend(), disabled_key) != disabled.cend();
+ IsVersionedExternalUpdateDisabled(disabled, update_entry.version);
Patch update_patch = {.enabled = !update_disabled,
@@ -771,7 +771,8 @@ std::vector<Patch> PatchManager::GetPatches(VirtualFile update_raw) const {
std::nullopt, std::nullopt, ContentRecordType::Program, update_tid);
for (const auto& [slot, entry] : all_updates) {
- if (slot == ContentProviderUnionSlot::External) {
+ if (slot == ContentProviderUnionSlot::External ||
+ slot == ContentProviderUnionSlot::FrontendManual) {
continue;
}