X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fpandora%2Fmain.c;h=5fecb4a6ec51067fa2c26b5358d56a03c164c037;hb=ca482e5de8bacb70db55f43afe02f93fe6fe3f16;hp=55ece53f94c1d6d4819ef7e363fdda315aff549a;hpb=e55f0cbba1c4eef80e488e2bd8c090acb1acf057;p=picodrive.git diff --git a/platform/pandora/main.c b/platform/pandora/main.c index 55ece53..5fecb4a 100644 --- a/platform/pandora/main.c +++ b/platform/pandora/main.c @@ -4,6 +4,7 @@ // For commercial use, separate licencing terms must be obtained. #include +#include #include #include #include @@ -20,6 +21,7 @@ extern int select_exits; extern char *PicoConfigFile; +static int load_state_slot = -1; int mmuhack_status = 0; // TODO rm char **g_argv; @@ -37,6 +39,9 @@ void parse_cmd_line(int argc, char *argv[]) else if(strcasecmp(argv[x], "-selectexit") == 0) { select_exits = 1; } + else if(strcasecmp(argv[x], "-loadstate") == 0) { + if(x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); } + } else { unrecognized = 1; break; @@ -62,7 +67,8 @@ void parse_cmd_line(int argc, char *argv[]) "-state pass '-state param' to the menu program\n" "-config use specified config file instead of default 'picoconfig.bin'\n" " see currentConfig_t structure in emu.h for the file format\n" - "-selectexit pressing SELECT will exit the emu and start 'menu_path'\n"); + "-selectexit pressing SELECT will exit the emu and start 'menu_path'\n" + "-loadstate if ROM is specified, try loading slot \n"); } } @@ -84,6 +90,17 @@ int main(int argc, char *argv[]) if (argc > 1) parse_cmd_line(argc, argv); + if (engineState == PGS_ReloadRom) + { + if (emu_ReloadRom(romFileName)) { + engineState = PGS_Running; + if (load_state_slot >= 0) { + state_slot = load_state_slot; + emu_SaveLoadGame(1, 0); + } + } + } + for (;;) { switch (engineState) @@ -93,7 +110,7 @@ int main(int argc, char *argv[]) break; case PGS_ReloadRom: - if (emu_ReloadRom()) + if (emu_ReloadRom(romFileName)) engineState = PGS_Running; else { printf("PGS_ReloadRom == 0\n");