fix handling of --load-slot=0 (same as --load-slot=10)

This commit is contained in:
zeromus 2010-09-02 06:51:31 +00:00
parent 8a55bc6219
commit c1f2d4629a
3 changed files with 12 additions and 7 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);