configuration: correct add-ons config and swap settings when apropriate
Any add-ons interaction happens directly through the global values struct. Swapping bewteen structs now also includes copying the necessary global configs that cannot be changed nor saved in per-game settings. General and System config menus now update based on whether it is viewing the global or per-game settings.
This commit is contained in:
@@ -92,7 +92,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
||||
|
||||
const auto& installed = Core::System::GetInstance().GetContentProvider();
|
||||
|
||||
const auto& disabled = Settings::values->disabled_addons[title_id];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[title_id];
|
||||
const auto update_disabled =
|
||||
std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
|
||||
|
||||
@@ -140,7 +140,7 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
|
||||
|
||||
std::vector<VirtualFile> PatchManager::CollectPatches(const std::vector<VirtualDir>& patch_dirs,
|
||||
const std::string& build_id) const {
|
||||
const auto& disabled = Settings::values->disabled_addons[title_id];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[title_id];
|
||||
|
||||
std::vector<VirtualFile> out;
|
||||
out.reserve(patch_dirs.size());
|
||||
@@ -302,7 +302,7 @@ std::vector<Core::Memory::CheatEntry> PatchManager::CreateCheatList(
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto& disabled = Settings::values->disabled_addons[title_id];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[title_id];
|
||||
auto patch_dirs = load_dir->GetSubdirectories();
|
||||
std::sort(patch_dirs.begin(), patch_dirs.end(),
|
||||
[](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); });
|
||||
@@ -344,7 +344,7 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& disabled = Settings::values->disabled_addons[title_id];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[title_id];
|
||||
auto patch_dirs = load_dir->GetSubdirectories();
|
||||
std::sort(patch_dirs.begin(), patch_dirs.end(),
|
||||
[](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); });
|
||||
@@ -409,7 +409,7 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, Content
|
||||
const auto update_tid = GetUpdateTitleID(title_id);
|
||||
const auto update = installed.GetEntryRaw(update_tid, type);
|
||||
|
||||
const auto& disabled = Settings::values->disabled_addons[title_id];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[title_id];
|
||||
const auto update_disabled =
|
||||
std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
|
||||
|
||||
@@ -453,7 +453,7 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
|
||||
return {};
|
||||
std::map<std::string, std::string, std::less<>> out;
|
||||
const auto& installed = Core::System::GetInstance().GetContentProvider();
|
||||
const auto& disabled = Settings::values->disabled_addons[title_id];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[title_id];
|
||||
|
||||
// Game Updates
|
||||
const auto update_tid = GetUpdateTitleID(title_id);
|
||||
|
||||
@@ -91,7 +91,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
const auto current = system.CurrentProcess()->GetTitleID();
|
||||
|
||||
const auto& disabled = Settings::values->disabled_addons[current];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[current];
|
||||
if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
|
||||
rb.Push<u32>(0);
|
||||
return;
|
||||
@@ -119,7 +119,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
|
||||
const auto current = system.CurrentProcess()->GetTitleID();
|
||||
|
||||
std::vector<u32> out;
|
||||
const auto& disabled = Settings::values->disabled_addons[current];
|
||||
const auto& disabled = Settings::global_values.disabled_addons[current];
|
||||
if (std::find(disabled.begin(), disabled.end(), "DLC") == disabled.end()) {
|
||||
for (u64 content_id : add_on_content) {
|
||||
if ((content_id & DLC_BASE_TITLE_ID_MASK) != current) {
|
||||
|
||||
@@ -67,12 +67,50 @@ Values global_values;
|
||||
Values game_values;
|
||||
Values *values = &global_values;
|
||||
|
||||
void SwapValues(bool global) {
|
||||
if (global) {
|
||||
void CopyValues(Values& dst, const Values& src) {
|
||||
dst.udp_input_address = src.udp_input_address;
|
||||
dst.udp_input_port = src.udp_input_port;
|
||||
dst.udp_pad_index = src.udp_pad_index;
|
||||
|
||||
dst.use_virtual_sd = src.use_virtual_sd;
|
||||
dst.gamecard_inserted = src.gamecard_inserted;
|
||||
dst.gamecard_current_game = src.gamecard_current_game;
|
||||
dst.gamecard_path = src.gamecard_path;
|
||||
dst.nand_total_size = src.nand_total_size;
|
||||
dst.nand_system_size = src.nand_system_size;
|
||||
dst.nand_user_size = src.nand_user_size;
|
||||
dst.sdmc_size = src.sdmc_size;
|
||||
|
||||
dst.log_filter = src.log_filter;
|
||||
|
||||
dst.use_dev_keys = src.use_dev_keys;
|
||||
|
||||
dst.record_frame_times = src.record_frame_times;
|
||||
dst.use_gdbstub = src.use_gdbstub;
|
||||
dst.gdbstub_port = src.gdbstub_port;
|
||||
dst.program_args = src.program_args;
|
||||
dst.dump_exefs = src.dump_exefs;
|
||||
dst.dump_nso = src.dump_nso;
|
||||
dst.reporting_services = src.reporting_services;
|
||||
dst.quest_flag = src.quest_flag;
|
||||
dst.disable_cpu_opt = src.disable_cpu_opt;
|
||||
dst.disable_macro_jit = src.disable_macro_jit;
|
||||
|
||||
dst.bcat_backend = src.bcat_backend;
|
||||
dst.bcat_boxcat_local = src.bcat_boxcat_local;
|
||||
|
||||
dst.enable_telemetry = src.enable_telemetry;
|
||||
dst.web_api_url = src.web_api_url;
|
||||
dst.yuzu_username = src.yuzu_username;
|
||||
dst.yuzu_token = src.yuzu_token;
|
||||
}
|
||||
|
||||
void SwapValues(ValuesSwapTarget target) {
|
||||
if (target == ValuesSwapTarget::ToGlobal) {
|
||||
values = &global_values;
|
||||
}
|
||||
else {
|
||||
std::memcpy(&game_values, &global_values, sizeof(global_values));
|
||||
CopyValues(game_values, global_values);
|
||||
values = &game_values;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,7 +499,14 @@ extern Values game_values;
|
||||
extern Values *values;
|
||||
|
||||
float Volume();
|
||||
void SwapValues(bool global);
|
||||
void CopyValues(Values& dst, const Values& src);
|
||||
|
||||
enum class ValuesSwapTarget {
|
||||
ToGlobal,
|
||||
ToGame,
|
||||
};
|
||||
|
||||
void SwapValues(ValuesSwapTarget target);
|
||||
|
||||
bool IsGPULevelExtreme();
|
||||
bool IsGPULevelHigh();
|
||||
|
||||
Reference in New Issue
Block a user