From c1f2d4629a16e791446576c5ca41c1208ac2387e Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 2 Sep 2010 06:51:31 +0000 Subject: [PATCH] fix handling of --load-slot=0 (same as --load-slot=10) --- desmume/src/commandline.cpp | 8 ++++---- desmume/src/gtk/main.cpp | 5 ++++- desmume/src/windows/main.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/desmume/src/commandline.cpp b/desmume/src/commandline.cpp index d305cebf6..fe17b4297 100644 --- a/desmume/src/commandline.cpp +++ b/desmume/src/commandline.cpp @@ -53,7 +53,7 @@ CommandLine::CommandLine() , _advanced_timing(-1) , _slot1(NULL) { - load_slot = 0; + load_slot = -1; arm9_gdb_port = arm7_gdb_port = 0; start_paused = FALSE; #ifndef _MSC_VER @@ -152,8 +152,8 @@ bool CommandLine::validate() } } - if (load_slot < 0 || load_slot > 10) { - g_printerr("I only know how to load from slots 1-10, 0 means 'do not load savegame' and is default\n"); + if (load_slot < -1 || load_slot > 10) { + g_printerr("I only know how to load from slots 0-10; -1 means 'do not load savegame' and is default\n"); return false; } @@ -162,7 +162,7 @@ bool CommandLine::validate() return false; } - if(record_movie_file != "" && load_slot != 0) { + if(record_movie_file != "" && load_slot != -1) { g_printerr("Cannot both record a movie and load a savestate.\n"); return false; } diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index 90a82447b..bfef4d79d 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -2268,7 +2268,10 @@ common_gtk_main( class configured_features *my_config) if(Open( my_config->nds_file.c_str()) >= 0) { my_config->process_movieCommands(); - if(my_config->load_slot){ + if(my_config->load_slot != -1){ + int todo = my_config->load_slot; + if(todo == 10) + todo = 0; loadstate_slot(my_config->load_slot); } diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 9c62b1066..bb47b8922 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -2918,9 +2918,11 @@ int _main() cmdline.process_movieCommands(); - if(cmdline.load_slot != 0) + if(cmdline.load_slot != -1) { - HK_StateLoadSlot(cmdline.load_slot, true); + int load = cmdline.load_slot; + if(load==10) load=0; + HK_StateLoadSlot(load, true); } MainWindow->Show(SW_NORMAL);