forked from chinosk/gkms-local
27 lines
668 B
C++
27 lines
668 B
C++
#include <string>
|
|
#include "nlohmann/json.hpp"
|
|
#include "../Log.h"
|
|
|
|
namespace GakumasLocal::Config {
|
|
bool isConfigInit = false;
|
|
|
|
bool enabled = true;
|
|
bool enableFreeCamera = false;
|
|
int targetFrameRate = 0;
|
|
|
|
void LoadConfig(const std::string& configStr) {
|
|
try {
|
|
const auto config = nlohmann::json::parse(configStr);
|
|
|
|
enabled = config["enabled"];
|
|
targetFrameRate = config["targetFrameRate"];
|
|
enableFreeCamera = config["enableFreeCamera"];
|
|
|
|
}
|
|
catch (std::exception& e) {
|
|
Log::ErrorFmt("LoadConfig error: %s", e.what());
|
|
}
|
|
isConfigInit = true;
|
|
}
|
|
}
|