|
|
|
@ -10,6 +10,7 @@ |
|
|
|
#include <cstring>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "common/hex_util.h"
|
|
|
|
@ -554,13 +555,16 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs |
|
|
|
LOG_DEBUG(Loader, "{}", log_string); |
|
|
|
} |
|
|
|
|
|
|
|
auto romfs = base_romfs; |
|
|
|
auto romfs = std::move(base_romfs); |
|
|
|
|
|
|
|
// Game Updates
|
|
|
|
LOG_DEBUG(Loader, "ChooseUpdateVariant"); |
|
|
|
std::optional<u64> selected_update_tid = ChooseUpdateVariant(content_provider, title_id, type, fs_controller); |
|
|
|
if (!selected_update_tid.has_value()) { |
|
|
|
LOG_DEBUG(Loader, "GetUpdateTitleID"); |
|
|
|
selected_update_tid = GetUpdateTitleID(title_id); |
|
|
|
} |
|
|
|
LOG_DEBUG(Loader, "GetEntryRaw"); |
|
|
|
const auto update_raw = content_provider.GetEntryRaw(*selected_update_tid, type); |
|
|
|
|
|
|
|
const auto& disabled = Settings::values.disabled_addons[title_id]; |
|
|
|
@ -576,6 +580,7 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs |
|
|
|
romfs = new_nca->GetRomFS(); |
|
|
|
} |
|
|
|
} else if (!update_disabled && base_nca != nullptr) { |
|
|
|
LOG_DEBUG(Loader, "Got update blabla, applying"); |
|
|
|
ContentRecordType alt_type = type; |
|
|
|
|
|
|
|
if (type == ContentRecordType::Program) { |
|
|
|
@ -585,6 +590,7 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs |
|
|
|
} |
|
|
|
|
|
|
|
if (alt_type != type) { |
|
|
|
LOG_DEBUG(Loader, "GetEntryRaw"); |
|
|
|
const auto alt_update_raw = |
|
|
|
content_provider.GetEntryRaw(*selected_update_tid, alt_type); |
|
|
|
if (alt_update_raw != nullptr) { |
|
|
|
@ -610,6 +616,7 @@ VirtualFile PatchManager::PatchRomFS(const NCA* base_nca, VirtualFile base_romfs |
|
|
|
|
|
|
|
// LayeredFS
|
|
|
|
if (apply_layeredfs) { |
|
|
|
LOG_DEBUG(Loader, "ApplyLayeredFS"); |
|
|
|
ApplyLayeredFS(romfs, title_id, type, fs_controller); |
|
|
|
} |
|
|
|
|
|
|
|
@ -825,20 +832,24 @@ std::optional<u32> PatchManager::GetGameVersion() const { |
|
|
|
} |
|
|
|
|
|
|
|
PatchManager::Metadata PatchManager::GetControlMetadata() const { |
|
|
|
LOG_ERROR(Core, "GetEntry"); |
|
|
|
const auto base_control_nca = content_provider.GetEntry(title_id, ContentRecordType::Control); |
|
|
|
if (base_control_nca == nullptr) { |
|
|
|
return {}; |
|
|
|
} |
|
|
|
|
|
|
|
LOG_ERROR(Core, "ParseControlNCA"); |
|
|
|
return ParseControlNCA(*base_control_nca); |
|
|
|
} |
|
|
|
|
|
|
|
PatchManager::Metadata PatchManager::ParseControlNCA(const NCA& nca) const { |
|
|
|
LOG_ERROR(Core, "GetRomFS"); |
|
|
|
const auto base_romfs = nca.GetRomFS(); |
|
|
|
if (base_romfs == nullptr) { |
|
|
|
return {}; |
|
|
|
} |
|
|
|
|
|
|
|
LOG_ERROR(Core, "PatchRomFS"); |
|
|
|
const auto romfs = PatchRomFS(&nca, base_romfs, ContentRecordType::Control); |
|
|
|
if (romfs == nullptr) { |
|
|
|
return {}; |
|
|
|
|