X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pandora%2Fmain.c;h=37a69feb7aaa51d0ffe338fb065825c0259e3478;hb=5a31ef07776f196cbf25748eee78da65b2b89928;hp=4690f067f68a53643aa16876325f31af797c5526;hpb=fce20e73e7094060b29f1668b8f0032f75eb152e;p=libpicofe.git diff --git a/pandora/main.c b/pandora/main.c index 4690f06..37a69fe 100644 --- a/pandora/main.c +++ b/pandora/main.c @@ -10,20 +10,17 @@ #include #include -#include "../gp2x/gp2x.h" -#include "../gp2x/menu.h" +#include "../gp2x/emu.h" // TODO rm #include "../common/menu.h" #include "../common/emu.h" #include "../common/config.h" #include "../common/input.h" -#include "../gp2x/emu.h" #include "../gp2x/version.h" +#include "pandora.h" -extern int select_exits; extern char *PicoConfigFile; static int load_state_slot = -1; -int mmuhack_status = 0; // TODO rm char **g_argv; void parse_cmd_line(int argc, char *argv[]) @@ -37,9 +34,6 @@ void parse_cmd_line(int argc, char *argv[]) if(strcasecmp(argv[x], "-config") == 0) { if(x+1 < argc) { ++x; PicoConfigFile = argv[x]; } } - 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]); } } @@ -50,9 +44,9 @@ void parse_cmd_line(int argc, char *argv[]) } else { /* External Frontend: ROM Name */ FILE *f; - strncpy(romFileName, argv[x], PATH_MAX); - romFileName[PATH_MAX-1] = 0; - f = fopen(romFileName, "rb"); + strncpy(rom_fname_reload, argv[x], sizeof(rom_fname_reload)); + rom_fname_reload[sizeof(rom_fname_reload) - 1] = 0; + f = fopen(rom_fname_reload, "rb"); if (f) fclose(f); else unrecognized = 1; engineState = PGS_ReloadRom; @@ -61,14 +55,11 @@ void parse_cmd_line(int argc, char *argv[]) } if (unrecognized) { - printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2008\n"); + printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n"); printf("usage: %s [options] [romfile]\n", argv[0]); printf( "options:\n" - "-menu launch a custom program on exit instead of default gp2xmenu\n" - "-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" "-loadstate if ROM is specified, try loading slot \n"); } } @@ -85,7 +76,7 @@ int main(int argc, char *argv[]) in_probe(); in_debug_dump(); - gp2x_init(); + pnd_init(); emu_Init(); menu_init(); @@ -96,7 +87,7 @@ int main(int argc, char *argv[]) if (engineState == PGS_ReloadRom) { - if (emu_ReloadRom(romFileName)) { + if (emu_ReloadRom(rom_fname_reload)) { engineState = PGS_Running; if (load_state_slot >= 0) { state_slot = load_state_slot; @@ -114,7 +105,7 @@ int main(int argc, char *argv[]) break; case PGS_ReloadRom: - if (emu_ReloadRom(romFileName)) + if (emu_ReloadRom(rom_fname_reload)) engineState = PGS_Running; else { printf("PGS_ReloadRom == 0\n"); @@ -141,6 +132,7 @@ int main(int argc, char *argv[]) endloop: emu_Deinit(); + pnd_exit(); return 0; }