mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
load state ability from command line
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@564 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
0022091ebe
commit
f7c40368a7
3 changed files with 62 additions and 18 deletions
19
gp2x/main.c
19
gp2x/main.c
|
@ -4,6 +4,7 @@
|
|||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
|
@ -25,6 +26,7 @@
|
|||
extern char *ext_menu, *ext_state;
|
||||
extern int select_exits;
|
||||
extern char *PicoConfigFile;
|
||||
static int load_state_slot = -1;
|
||||
int mmuhack_status = 0;
|
||||
char **g_argv;
|
||||
|
||||
|
@ -48,6 +50,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;
|
||||
|
@ -73,7 +78,8 @@ void parse_cmd_line(int argc, char *argv[])
|
|||
"-state <param> pass '-state param' to the menu program\n"
|
||||
"-config <file> 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 <num> if ROM is specified, try loading slot <num>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,6 +116,17 @@ int main(int argc, char *argv[])
|
|||
if (argc > 1)
|
||||
parse_cmd_line(argc, argv);
|
||||
|
||||
if (engineState == PGS_ReloadRom)
|
||||
{
|
||||
if (emu_ReloadRom()) {
|
||||
engineState = PGS_Running;
|
||||
if (load_state_slot >= 0) {
|
||||
state_slot = load_state_slot;
|
||||
emu_SaveLoadGame(1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
switch (engineState)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue