diff options
| author | 2018-11-28 14:00:01 -0500 | |
|---|---|---|
| committer | 2018-12-03 17:20:34 -0500 | |
| commit | c381f46428268a57f0aef1d99918c8f1bb6beec7 (patch) | |
| tree | f5aa5e646596d5d57d394a56f659668911c4ac27 /src | |
| parent | settings: Store list of disabled add-ons per title ID (diff) | |
| download | yuzu-c381f46428268a57f0aef1d99918c8f1bb6beec7.tar.gz yuzu-c381f46428268a57f0aef1d99918c8f1bb6beec7.tar.xz yuzu-c381f46428268a57f0aef1d99918c8f1bb6beec7.zip | |
config: Store and load disabled add-ons list
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 30 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 18 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 7 |
3 files changed, 55 insertions, 0 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 83ebbd1fe..4d4bd2a46 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -444,6 +444,21 @@ void Config::ReadValues() { | |||
| 444 | Settings::values.yuzu_token = qt_config->value("yuzu_token").toString().toStdString(); | 444 | Settings::values.yuzu_token = qt_config->value("yuzu_token").toString().toStdString(); |
| 445 | qt_config->endGroup(); | 445 | qt_config->endGroup(); |
| 446 | 446 | ||
| 447 | const auto size = qt_config->beginReadArray("DisabledAddOns"); | ||
| 448 | for (int i = 0; i < size; ++i) { | ||
| 449 | qt_config->setArrayIndex(i); | ||
| 450 | const auto title_id = qt_config->value("title_id", 0).toULongLong(); | ||
| 451 | std::vector<std::string> out; | ||
| 452 | const auto d_size = qt_config->beginReadArray("disabled"); | ||
| 453 | for (int j = 0; j < d_size; ++j) { | ||
| 454 | qt_config->setArrayIndex(j); | ||
| 455 | out.push_back(qt_config->value("d", "").toString().toStdString()); | ||
| 456 | } | ||
| 457 | qt_config->endArray(); | ||
| 458 | Settings::values.disabled_addons.insert_or_assign(title_id, out); | ||
| 459 | } | ||
| 460 | qt_config->endArray(); | ||
| 461 | |||
| 447 | qt_config->beginGroup("UI"); | 462 | qt_config->beginGroup("UI"); |
| 448 | UISettings::values.theme = qt_config->value("theme", UISettings::themes[0].second).toString(); | 463 | UISettings::values.theme = qt_config->value("theme", UISettings::themes[0].second).toString(); |
| 449 | UISettings::values.enable_discord_presence = | 464 | UISettings::values.enable_discord_presence = |
| @@ -650,6 +665,21 @@ void Config::SaveValues() { | |||
| 650 | qt_config->setValue("yuzu_token", QString::fromStdString(Settings::values.yuzu_token)); | 665 | qt_config->setValue("yuzu_token", QString::fromStdString(Settings::values.yuzu_token)); |
| 651 | qt_config->endGroup(); | 666 | qt_config->endGroup(); |
| 652 | 667 | ||
| 668 | qt_config->beginWriteArray("DisabledAddOns"); | ||
| 669 | int i = 0; | ||
| 670 | for (const auto& elem : Settings::values.disabled_addons) { | ||
| 671 | qt_config->setArrayIndex(i); | ||
| 672 | qt_config->setValue("title_id", elem.first); | ||
| 673 | qt_config->beginWriteArray("disabled"); | ||
| 674 | for (std::size_t j = 0; j < elem.second.size(); ++j) { | ||
| 675 | qt_config->setArrayIndex(j); | ||
| 676 | qt_config->setValue("d", QString::fromStdString(elem.second[j])); | ||
| 677 | } | ||
| 678 | qt_config->endArray(); | ||
| 679 | ++i; | ||
| 680 | } | ||
| 681 | qt_config->endArray(); | ||
| 682 | |||
| 653 | qt_config->beginGroup("UI"); | 683 | qt_config->beginGroup("UI"); |
| 654 | qt_config->setValue("theme", UISettings::values.theme); | 684 | qt_config->setValue("theme", UISettings::values.theme); |
| 655 | qt_config->setValue("enable_discord_presence", UISettings::values.enable_discord_presence); | 685 | qt_config->setValue("enable_discord_presence", UISettings::values.enable_discord_presence); |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 097c1fbe3..fe0d1eebf 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <sstream> | ||
| 6 | #include <SDL.h> | 7 | #include <SDL.h> |
| 7 | #include <inih/cpp/INIReader.h> | 8 | #include <inih/cpp/INIReader.h> |
| 8 | #include "common/file_util.h" | 9 | #include "common/file_util.h" |
| @@ -369,6 +370,23 @@ void Config::ReadValues() { | |||
| 369 | Settings::values.dump_exefs = sdl2_config->GetBoolean("Debugging", "dump_exefs", false); | 370 | Settings::values.dump_exefs = sdl2_config->GetBoolean("Debugging", "dump_exefs", false); |
| 370 | Settings::values.dump_nso = sdl2_config->GetBoolean("Debugging", "dump_nso", false); | 371 | Settings::values.dump_nso = sdl2_config->GetBoolean("Debugging", "dump_nso", false); |
| 371 | 372 | ||
| 373 | const auto title_list = sdl2_config->Get("AddOns", "title_ids", ""); | ||
| 374 | std::stringstream ss(title_list); | ||
| 375 | std::string line; | ||
| 376 | while (std::getline(ss, line, '|')) { | ||
| 377 | const auto title_id = std::stoul(line, nullptr, 16); | ||
| 378 | const auto disabled_list = sdl2_config->Get("AddOns", "disabled_" + line, ""); | ||
| 379 | |||
| 380 | std::stringstream inner_ss(disabled_list); | ||
| 381 | std::string inner_line; | ||
| 382 | std::vector<std::string> out; | ||
| 383 | while (std::getline(inner_ss, inner_line, '|')) { | ||
| 384 | out.push_back(inner_line); | ||
| 385 | } | ||
| 386 | |||
| 387 | Settings::values.disabled_addons.insert_or_assign(title_id, out); | ||
| 388 | } | ||
| 389 | |||
| 372 | // Web Service | 390 | // Web Service |
| 373 | Settings::values.enable_telemetry = | 391 | Settings::values.enable_telemetry = |
| 374 | sdl2_config->GetBoolean("WebService", "enable_telemetry", true); | 392 | sdl2_config->GetBoolean("WebService", "enable_telemetry", true); |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index d73669f36..25236d05d 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -221,5 +221,12 @@ web_api_url = https://api.yuzu-emu.org | |||
| 221 | # See https://profile.yuzu-emu.org/ for more info | 221 | # See https://profile.yuzu-emu.org/ for more info |
| 222 | yuzu_username = | 222 | yuzu_username = |
| 223 | yuzu_token = | 223 | yuzu_token = |
| 224 | |||
| 225 | [AddOns] | ||
| 226 | # Used to disable add-ons | ||
| 227 | # List of title IDs of games that will have add-ons disabled (separated by '|'): | ||
| 228 | title_ids = | ||
| 229 | # For each title ID, have a key/value pair called `disabled_<title_id>` equal to the names of the add-ons to disable (sep. by '|') | ||
| 230 | # e.x. disabled_0100000000010000 = Update|DLC <- disables Updates and DLC on Super Mario Odyssey | ||
| 224 | )"; | 231 | )"; |
| 225 | } | 232 | } |