From 14d3e453790bfdd742d740e8557b58dc369b1ae5 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Mon, 10 Oct 2022 20:52:36 +0200 Subject: [PATCH] GlosSSITarget: Settings: parse missing but unused common values (icon/name/version) --- GlosSITarget/Settings.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/GlosSITarget/Settings.h b/GlosSITarget/Settings.h index 0625073..dfe0eb6 100644 --- a/GlosSITarget/Settings.h +++ b/GlosSITarget/Settings.h @@ -62,8 +62,10 @@ inline struct Controller { inline struct Common { bool no_uwp_overlay = false; bool disable_watchdog = false; - bool extendedLogging = false; + std::wstring name; + std::wstring icon; + int version; } common; inline std::filesystem::path settings_path_ = ""; @@ -119,7 +121,6 @@ inline void checkWinVer() } #endif - inline void Parse(const nlohmann::basic_json<>& json) { auto safeParseValue = [](const auto& object, const auto& key, auto& value) { @@ -189,8 +190,10 @@ inline void Parse(const nlohmann::basic_json<>& json) spdlog::warn("Err parsing config: {}", e.what()); } - safeParseValue(json, "extendedLogging", extendedLogging); - + safeParseValue(json, "extendedLogging", common.extendedLogging); + safeWStringParse(json, "name", common.name); + safeWStringParse(json, "icon", common.icon); + safeParseValue(json, "version", common.version); if (launch.launch) { launch.isUWP = checkIsUwp(launch.launchPath); @@ -205,10 +208,10 @@ inline void Parse(const std::vector& args) continue; } if (arg == L"-disableuwpoverlay") { - cli.no_uwp_overlay = true; + common.no_uwp_overlay = true; } else if (arg == L"-disablewatchdog") { - cli.disable_watchdog = true; + common.disable_watchdog = true; } else { configName += L" " + std::wstring(arg.begin(), arg.end()); @@ -252,12 +255,11 @@ inline void Parse(const std::vector& args) settings_path_ = path; const auto& json = nlohmann::json::parse(json_file); Parse(json); - + spdlog::debug("Read config file \"{}\"; config: {}", path.string(), json.dump()); json_file.close(); } - inline nlohmann::json toJson() { nlohmann::json json; @@ -277,7 +279,10 @@ inline nlohmann::json toJson() json["controller"]["allowDesktopConfig"] = controller.allowDesktopConfig; json["controller"]["emulateDS4"] = controller.emulateDS4; - json["extendedLogging"] = extendedLogging; + json["extendedLogging"] = common.extendedLogging; + json["name"] = std::wstring_convert>().to_bytes(common.name); + json["icon"] = std::wstring_convert>().to_bytes(common.icon); + json["version"] = common.version; return json; }