mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-27 08:13:34 +01:00
Add command-line argument to allow a path to be specified for configuration files and control mapping files. Also fix a possible crash when loading ini files.
This commit is contained in:
1 parent
bcf3d534b0
commit
5cdfb6c4f9
2 files changed
+38
-9
No files matched your search
+28
-1
@@ -106,9 +106,36 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
langRegion = "en_US";
|
||||
}
|
||||
|
||||
std::string configFilename;
|
||||
const char *configOption = "--config=";
|
||||
|
||||
std::string controlsConfigFilename;
|
||||
const char *controlsOption = "--controlconfig=";
|
||||
|
||||
for (int i = 1; i < __argc; ++i)
|
||||
{
|
||||
if (__argv[i][0] == '\0')
|
||||
continue;
|
||||
if (__argv[i][0] == '-')
|
||||
{
|
||||
if (!strncmp(__argv[i], controlsOption, strlen(controlsOption)) && strlen(__argv[i]) > strlen(controlsOption)) {
|
||||
configFilename = __argv[i] + strlen(controlsOption);
|
||||
}
|
||||
if (!strncmp(__argv[i], controlsOption, strlen(controlsOption)) && strlen(__argv[i]) > strlen(controlsOption)) {
|
||||
controlsConfigFilename = __argv[i] + strlen(controlsOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(configFilename.empty())
|
||||
configFilename = "ppsspp.ini";
|
||||
|
||||
if(controlsConfigFilename.empty())
|
||||
controlsConfigFilename = "controls.ini";
|
||||
|
||||
// Load config up here, because those changes below would be overwritten
|
||||
// if it's not loaded here first.
|
||||
g_Config.Load();
|
||||
g_Config.Load(configFilename, controlsConfigFilename);
|
||||
|
||||
// The rest is handled in NativeInit().
|
||||
for (int i = 1; i < __argc; ++i)
|
||||
|
||||
Reference in new issue
Block a user