notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move select from evdev to upper level
[picodrive.git]
/
platform
/
gp2x
/
main.c
diff --git
a/platform/gp2x/main.c
b/platform/gp2x/main.c
index
3728685
..
d8d82af
100644
(file)
--- a/
platform/gp2x/main.c
+++ b/
platform/gp2x/main.c
@@
-4,6
+4,7
@@
// For commercial use, separate licencing terms must be obtained.
\r
\r
#include <stdio.h>
\r
// For commercial use, separate licencing terms must be obtained.
\r
\r
#include <stdio.h>
\r
+#include <stdlib.h>
\r
#include <string.h>
\r
#include <unistd.h>
\r
#include <strings.h>
\r
#include <string.h>
\r
#include <unistd.h>
\r
#include <strings.h>
\r
@@
-14,6
+15,7
@@
#include "../common/menu.h"
\r
#include "../common/emu.h"
\r
#include "../common/config.h"
\r
#include "../common/menu.h"
\r
#include "../common/emu.h"
\r
#include "../common/config.h"
\r
+#include "../common/input.h"
\r
#include "emu.h"
\r
#include "940ctl.h"
\r
#include "version.h"
\r
#include "emu.h"
\r
#include "940ctl.h"
\r
#include "version.h"
\r
@@
-25,6
+27,7
@@
extern char *ext_menu, *ext_state;
\r
extern int select_exits;
\r
extern char *PicoConfigFile;
\r
extern char *ext_menu, *ext_state;
\r
extern int select_exits;
\r
extern char *PicoConfigFile;
\r
+static int load_state_slot = -1;
\r
int mmuhack_status = 0;
\r
char **g_argv;
\r
\r
int mmuhack_status = 0;
\r
char **g_argv;
\r
\r
@@
-48,6
+51,9
@@
void parse_cmd_line(int argc, char *argv[])
else if(strcasecmp(argv[x], "-selectexit") == 0) {
\r
select_exits = 1;
\r
}
\r
else if(strcasecmp(argv[x], "-selectexit") == 0) {
\r
select_exits = 1;
\r
}
\r
+ else if(strcasecmp(argv[x], "-loadstate") == 0) {
\r
+ if(x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); }
\r
+ }
\r
else {
\r
unrecognized = 1;
\r
break;
\r
else {
\r
unrecognized = 1;
\r
break;
\r
@@
-66,14
+72,15
@@
void parse_cmd_line(int argc, char *argv[])
}
\r
\r
if (unrecognized) {
\r
}
\r
\r
if (unrecognized) {
\r
- printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-200
7
\n");
\r
+ printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-200
8
\n");
\r
printf("usage: %s [options] [romfile]\n", argv[0]);
\r
printf( "options:\n"
\r
"-menu <menu_path> launch a custom program on exit instead of default gp2xmenu\n"
\r
"-state <param> pass '-state param' to the menu program\n"
\r
"-config <file> use specified config file instead of default 'picoconfig.bin'\n"
\r
" see currentConfig_t structure in emu.h for the file format\n"
\r
printf("usage: %s [options] [romfile]\n", argv[0]);
\r
printf( "options:\n"
\r
"-menu <menu_path> launch a custom program on exit instead of default gp2xmenu\n"
\r
"-state <param> pass '-state param' to the menu program\n"
\r
"-config <file> use specified config file instead of default 'picoconfig.bin'\n"
\r
" see currentConfig_t structure in emu.h for the file format\n"
\r
- "-selectexit pressing SELECT will exit the emu and start 'menu_path'\n");
\r
+ "-selectexit pressing SELECT will exit the emu and start 'menu_path'\n"
\r
+ "-loadstate <num> if ROM is specified, try loading slot <num>\n");
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-82,9
+89,13
@@
int main(int argc, char *argv[])
{
\r
g_argv = argv;
\r
\r
{
\r
g_argv = argv;
\r
\r
+ in_init();
\r
emu_prepareDefaultConfig();
\r
emu_ReadConfig(0, 0);
\r
emu_prepareDefaultConfig();
\r
emu_ReadConfig(0, 0);
\r
+ config_readlrom(PicoConfigFile);
\r
\r
\r
+ in_probe();
\r
+ in_debug_dump();
\r
gp2x_init();
\r
if (currentConfig.EmuOpt&0x10) {
\r
int ret = mmuhack();
\r
gp2x_init();
\r
if (currentConfig.EmuOpt&0x10) {
\r
int ret = mmuhack();
\r
@@
-109,6
+120,17
@@
int main(int argc, char *argv[])
if (argc > 1)
\r
parse_cmd_line(argc, argv);
\r
\r
if (argc > 1)
\r
parse_cmd_line(argc, argv);
\r
\r
+ if (engineState == PGS_ReloadRom)
\r
+ {
\r
+ if (emu_ReloadRom(romFileName)) {
\r
+ engineState = PGS_Running;
\r
+ if (load_state_slot >= 0) {
\r
+ state_slot = load_state_slot;
\r
+ emu_SaveLoadGame(1, 0);
\r
+ }
\r
+ }
\r
+ }
\r
+
\r
for (;;)
\r
{
\r
switch (engineState)
\r
for (;;)
\r
{
\r
switch (engineState)
\r
@@
-118,7
+140,7
@@
int main(int argc, char *argv[])
break;
\r
\r
case PGS_ReloadRom:
\r
break;
\r
\r
case PGS_ReloadRom:
\r
- if (emu_ReloadRom())
\r
+ if (emu_ReloadRom(
romFileName
))
\r
engineState = PGS_Running;
\r
else {
\r
printf("PGS_ReloadRom == 0\n");
\r
engineState = PGS_Running;
\r
else {
\r
printf("PGS_ReloadRom == 0\n");
\r