mirror of
https://git.chinosk6.cn/chinosk/gkms-local.git
synced 2026-06-19 15:56:02 +07:00
fixed crash
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "../Log.h"
|
||||
#include <thread>
|
||||
#include <fstream>
|
||||
|
||||
namespace GakumasLocal::Config {
|
||||
bool isConfigInit = false;
|
||||
@@ -107,4 +108,66 @@ namespace GakumasLocal::Config {
|
||||
}
|
||||
isConfigInit = true;
|
||||
}
|
||||
|
||||
void SaveConfig(const std::string& configPath) {
|
||||
try {
|
||||
nlohmann::json config;
|
||||
|
||||
#define SetConfigItem(name) config[#name] = name
|
||||
|
||||
SetConfigItem(dbgMode);
|
||||
SetConfigItem(enabled);
|
||||
SetConfigItem(lazyInit);
|
||||
SetConfigItem(replaceFont);
|
||||
SetConfigItem(forceExportResource);
|
||||
SetConfigItem(gameOrientation);
|
||||
SetConfigItem(textTest);
|
||||
SetConfigItem(useMasterTrans);
|
||||
SetConfigItem(dumpText);
|
||||
SetConfigItem(targetFrameRate);
|
||||
SetConfigItem(enableFreeCamera);
|
||||
SetConfigItem(unlockAllLive);
|
||||
SetConfigItem(unlockAllLiveCostume);
|
||||
SetConfigItem(enableLiveCustomeDress);
|
||||
SetConfigItem(liveCustomeHeadId);
|
||||
SetConfigItem(liveCustomeCostumeId);
|
||||
SetConfigItem(loginAsIOS);
|
||||
SetConfigItem(useCustomeGraphicSettings);
|
||||
SetConfigItem(renderScale);
|
||||
SetConfigItem(qualitySettingsLevel);
|
||||
SetConfigItem(volumeIndex);
|
||||
SetConfigItem(maxBufferPixel);
|
||||
SetConfigItem(reflectionQualityLevel);
|
||||
SetConfigItem(lodQualityLevel);
|
||||
SetConfigItem(enableBreastParam);
|
||||
SetConfigItem(bDamping);
|
||||
SetConfigItem(bStiffness);
|
||||
SetConfigItem(bSpring);
|
||||
SetConfigItem(bPendulum);
|
||||
SetConfigItem(bPendulumRange);
|
||||
SetConfigItem(bAverage);
|
||||
SetConfigItem(bRootWeight);
|
||||
SetConfigItem(bUseArmCorrection);
|
||||
SetConfigItem(bUseScale);
|
||||
SetConfigItem(bScale);
|
||||
SetConfigItem(bUseLimit);
|
||||
SetConfigItem(bLimitXx);
|
||||
SetConfigItem(bLimitXy);
|
||||
SetConfigItem(bLimitYx);
|
||||
SetConfigItem(bLimitYy);
|
||||
SetConfigItem(bLimitZx);
|
||||
SetConfigItem(bLimitZy);
|
||||
|
||||
std::ofstream out(configPath);
|
||||
if (!out) {
|
||||
Log::ErrorFmt("SaveConfig error: Cannot open file: %s", configPath.c_str());
|
||||
return;
|
||||
}
|
||||
out << config.dump(4);
|
||||
Log::Info("SaveConfig success");
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
Log::ErrorFmt("SaveConfig error: %s", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,5 @@ namespace GakumasLocal::Config {
|
||||
extern float bLimitZy;
|
||||
|
||||
void LoadConfig(const std::string& configStr);
|
||||
void SaveConfig(const std::string& configPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user