mirror of
https://github.com/Alia5/GlosSI.git
synced 2024-11-10 19:10:46 +00:00
GlosSITarget: parse new settings
This commit is contained in:
parent
a0be517950
commit
5a50ae5f8c
@ -23,7 +23,6 @@ limitations under the License.
|
|||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
|
|
||||||
inline struct Launch {
|
inline struct Launch {
|
||||||
bool launch = false;
|
bool launch = false;
|
||||||
std::wstring launchPath;
|
std::wstring launchPath;
|
||||||
@ -41,8 +40,13 @@ inline struct Window {
|
|||||||
bool windowMode = false;
|
bool windowMode = false;
|
||||||
int maxFps = 0;
|
int maxFps = 0;
|
||||||
float scale = 0.f;
|
float scale = 0.f;
|
||||||
|
bool disableOverlay = false;
|
||||||
} window;
|
} window;
|
||||||
|
|
||||||
|
inline struct Controller {
|
||||||
|
int maxControllers = 4;
|
||||||
|
} controller;
|
||||||
|
|
||||||
inline bool checkIsUwp(const std::wstring& launch_path)
|
inline bool checkIsUwp(const std::wstring& launch_path)
|
||||||
{
|
{
|
||||||
std::wsmatch m;
|
std::wsmatch m;
|
||||||
@ -60,9 +64,9 @@ inline void Parse(std::string arg1)
|
|||||||
std::filesystem::path path(arg1);
|
std::filesystem::path path(arg1);
|
||||||
if (path.has_extension() && !std::filesystem::exists(path)) {
|
if (path.has_extension() && !std::filesystem::exists(path)) {
|
||||||
path = std::filesystem::temp_directory_path()
|
path = std::filesystem::temp_directory_path()
|
||||||
.parent_path()
|
.parent_path()
|
||||||
.parent_path()
|
.parent_path()
|
||||||
.parent_path();
|
.parent_path();
|
||||||
|
|
||||||
path /= "Roaming";
|
path /= "Roaming";
|
||||||
path /= "GlosSI";
|
path /= "GlosSI";
|
||||||
@ -88,7 +92,8 @@ inline void Parse(std::string arg1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
value = object[key];
|
value = object[key];
|
||||||
} catch (const nlohmann::json::exception& e) {
|
}
|
||||||
|
catch (const nlohmann::json::exception& e) {
|
||||||
spdlog::error("Err parsing \"{}\"; {}", key, e.what());
|
spdlog::error("Err parsing \"{}\"; {}", key, e.what());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -120,6 +125,11 @@ inline void Parse(std::string arg1)
|
|||||||
safeParseValue(winconf, "windowMode", window.windowMode);
|
safeParseValue(winconf, "windowMode", window.windowMode);
|
||||||
safeParseValue(winconf, "maxFps", window.maxFps);
|
safeParseValue(winconf, "maxFps", window.maxFps);
|
||||||
safeParseValue(winconf, "scale", window.scale);
|
safeParseValue(winconf, "scale", window.scale);
|
||||||
|
safeParseValue(winconf, "disableOverlay", window.disableOverlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto controllerConf = json["controller"]; controllerConf.is_object()) {
|
||||||
|
safeParseValue(controllerConf, "maxControllers", controller.maxControllers);
|
||||||
}
|
}
|
||||||
|
|
||||||
json_file.close();
|
json_file.close();
|
||||||
@ -129,7 +139,6 @@ inline void Parse(std::string arg1)
|
|||||||
if (launch.launch) {
|
if (launch.launch) {
|
||||||
launch.isUWP = checkIsUwp(launch.launchPath);
|
launch.isUWP = checkIsUwp(launch.launchPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
Loading…
Reference in New Issue
Block a user