Merge pull request #352 from libertyernie/allow-two-arguments

Allow loader to pass 2 arguments instead of 3 for autoload
This commit is contained in:
dborth 2018-07-30 12:08:39 -06:00 committed by GitHub
commit e588477fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -402,7 +402,7 @@ int main(int argc, char *argv[])
InitGUIThreads(); InitGUIThreads();
bool autoboot = false; bool autoboot = false;
if(argc > 3 && argv[1] != NULL && argv[2] != NULL && argv[3] != NULL) if(argc > 2 && argv[1] != NULL && argv[2] != NULL)
{ {
autoboot = true; autoboot = true;
ResetBrowser(); ResetBrowser();
@ -425,7 +425,7 @@ int main(int argc, char *argv[])
strncpy(arg_filename, argv[2], sizeof(arg_filename)); strncpy(arg_filename, argv[2], sizeof(arg_filename));
strncpy(GCSettings.LoadFolder, dir.c_str(), sizeof(GCSettings.LoadFolder)); strncpy(GCSettings.LoadFolder, dir.c_str(), sizeof(GCSettings.LoadFolder));
OpenGameList(); OpenGameList();
strncpy(GCSettings.Exit_Dol_File, argv[3], sizeof(GCSettings.Exit_Dol_File)); strncpy(GCSettings.Exit_Dol_File, argc > 3 && argv[3] != NULL ? argv[3] : "", sizeof(GCSettings.Exit_Dol_File));
if(argc > 5 && argv[4] != NULL && argv[5] != NULL) if(argc > 5 && argv[4] != NULL && argv[5] != NULL)
{ {
sscanf(argv[4], "%08x", &GCSettings.Exit_Channel[0]); sscanf(argv[4], "%08x", &GCSettings.Exit_Channel[0]);