static ConfigSetting StringList(const char *option, char sep, Setter<const vector<string>&> setter, Getter<vector<string>> getter, const char *description = nullptr) { auto getterAdapter = [=] { string result; for (auto &str : getter()) { if (!result.empty()) { result += sep; } result += str; } return result; }; auto setterAdapter = [=](string x) { vector<string> result; stringstream ss(x); string token; while (getline(ss, token, sep)) { if (!token.empty()) { result.push_back(token); } } setter(result); }; return ConfigSetting(option, setterAdapter, getterAdapter, description); }
static ConfigSetting Double(const char *option, Setter<double> setter, Getter<double> getter, const char *description = nullptr) { auto getterAdapter = [=] { return to_string(getter()); }; auto setterAdapter = [=](string x) { setter(stod(x)); }; return ConfigSetting(option, setterAdapter, getterAdapter, description); }
static ConfigSetting Bool(const char *option, Setter<bool> setter, Getter<bool> getter, const char *description = nullptr) { auto getterAdapter = [=] { return getter() ? "true" : "false"; }; auto setterAdapter = [=] (string x) { setter(x == "true" || x == "1"); }; return ConfigSetting(option, setterAdapter, getterAdapter, description); }
static ConfigSetting WString(const char *option, Setter<wstring> setter, Getter<wstring> getter, const char *description = nullptr) { auto getterAdapter = [=] { return ucs2_to_utf8(getter()); }; auto setterAdapter = [=](string value) { setter(utf8_to_ucs2(value)); }; return ConfigSetting(option, setterAdapter, getterAdapter, description); }
#ifdef IOS return iosCanUseJit; #elif defined(ARM) || defined(ARM64) || defined(_M_IX86) || defined(_M_X64) return true; #else return false; #endif } struct ConfigSectionSettings { const char *section; ConfigSetting *settings; }; static ConfigSetting generalSettings[] = { ConfigSetting("FirstRun", &g_Config.bFirstRun, true), ConfigSetting("RunCount", &g_Config.iRunCount, 0), ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true), ConfigSetting("AutoRun", &g_Config.bAutoRun, true), ConfigSetting("Browse", &g_Config.bBrowse, false), ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true, true), ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""), ConfigSetting("ShowDebuggerOnLoad", &g_Config.bShowDebuggerOnLoad, false), ConfigSetting("CheckForNewVersion", &g_Config.bCheckForNewVersion, true), ConfigSetting("Language", &g_Config.sLanguageIni, &DefaultLangRegion), ConfigSetting("ForceLagSync", &g_Config.bForceLagSync, false, true, true), ReportedConfigSetting("NumWorkerThreads", &g_Config.iNumWorkerThreads, &DefaultNumWorkers, true, true), ConfigSetting("EnableAutoLoad", &g_Config.bEnableAutoLoad, false, true, true), ReportedConfigSetting("EnableCheats", &g_Config.bEnableCheats, false, true, true), ConfigSetting("CwCheatRefreshRate", &g_Config.iCwCheatRefreshRate, 77, true, true),
static ConfigSetting String(const char *option, Setter<string> setter, Getter<string> getter, const char *description = nullptr) { return ConfigSetting(option, setter, getter, description); }
static bool DefaultJit() { #ifdef IOS return iosCanUseJit; #else return true; #endif } struct ConfigSectionSettings { const char *section; ConfigSetting *settings; }; static ConfigSetting generalSettings[] = { ConfigSetting("FirstRun", &g_Config.bFirstRun, true), ConfigSetting("RunCount", &g_Config.iRunCount, 0), ConfigSetting("Enable Logging", &g_Config.bEnableLogging, true), ConfigSetting("AutoRun", &g_Config.bAutoRun, true), ConfigSetting("Browse", &g_Config.bBrowse, false), ConfigSetting("IgnoreBadMemAccess", &g_Config.bIgnoreBadMemAccess, true), ConfigSetting("CurrentDirectory", &g_Config.currentDirectory, ""), ConfigSetting("ShowDebuggerOnLoad", &g_Config.bShowDebuggerOnLoad, false), ConfigSetting("HomebrewStore", &g_Config.bHomebrewStore, false, false), ConfigSetting("CheckForNewVersion", &g_Config.bCheckForNewVersion, true), ConfigSetting("Language", &g_Config.sLanguageIni, &DefaultLangRegion), ReportedConfigSetting("NumWorkerThreads", &g_Config.iNumWorkerThreads, &DefaultNumWorkers), ConfigSetting("EnableAutoLoad", &g_Config.bEnableAutoLoad, false), ReportedConfigSetting("EnableCheats", &g_Config.bEnableCheats, false), ConfigSetting("ScreenshotsAsPNG", &g_Config.bScreenshotsAsPNG, false),