X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=platform%2Fcommon%2Fmain.c;h=526766762f0ca8c163f60a6b8bc0863ed7b195f6;hb=refs%2Fremotes%2Fgithub%2Fmaster;hp=968da0d340a2cdd5beec8acebc2f11c9950d4df7;hpb=636d5f257c3e5bafba99ddbdc385a289e12c9deb;p=picodrive.git diff --git a/platform/common/main.c b/platform/common/main.c index 968da0d3..8e6987e4 100644 --- a/platform/common/main.c +++ b/platform/common/main.c @@ -10,17 +10,17 @@ #include #include #include +#ifdef USE_SDL +#include +#endif #include "../libpicofe/input.h" #include "../libpicofe/plat.h" #include "menu_pico.h" #include "emu.h" -#include "config.h" +#include "version.h" #include -#include - -extern char *PicoConfigFile; static int load_state_slot = -1; char **g_argv; @@ -28,14 +28,16 @@ void parse_cmd_line(int argc, char *argv[]) { int x, unrecognized = 0; - for (x = 1; x < argc; x++) + for (x = 1; x < argc && !unrecognized; x++) { if (argv[x][0] == '-') { if (strcasecmp(argv[x], "-config") == 0) { if (x+1 < argc) { ++x; PicoConfigFile = argv[x]; } } - else if (strcasecmp(argv[x], "-loadstate") == 0) { + else if (strcasecmp(argv[x], "-loadstate") == 0 + || strcasecmp(argv[x], "-load") == 0) + { if (x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); } } else if (strcasecmp(argv[x], "-pdb") == 0) { @@ -45,15 +47,13 @@ void parse_cmd_line(int argc, char *argv[]) if (x+2 < argc) { pdb_net_connect(argv[x+1], argv[x+2]); x += 2; } } else { - unrecognized = 1; - break; + unrecognized = plat_parse_arg(argc, argv, &x); } } else { FILE *f = fopen(argv[x], "rb"); if (f) { fclose(f); rom_fname_reload = argv[x]; - engineState = PGS_ReloadRom; } else unrecognized = 1; @@ -82,21 +82,23 @@ int main(int argc, char *argv[]) //in_probe(); plat_target_init(); + if (argc > 1) + parse_cmd_line(argc, argv); + plat_init(); + menu_init(); emu_prep_defconfig(); // depends on input emu_read_config(NULL, 0); emu_init(); - menu_init(); - - engineState = PGS_Menu; - if (argc > 1) - parse_cmd_line(argc, argv); + engineState = rom_fname_reload ? PGS_ReloadRom : PGS_Menu; + plat_video_menu_enter(0); if (engineState == PGS_ReloadRom) { + plat_video_menu_begin(); if (emu_reload_rom(rom_fname_reload)) { engineState = PGS_Running; if (load_state_slot >= 0) { @@ -104,7 +106,9 @@ int main(int argc, char *argv[]) emu_save_load_game(1, 0); } } + plat_video_menu_end(); } + plat_video_menu_leave(); for (;;) { @@ -132,7 +136,13 @@ int main(int argc, char *argv[]) /* vvv fallthrough */ case PGS_Running: +#ifdef GPERF + ProfilerStart("gperf.out"); +#endif emu_loop(); +#ifdef GPERF + ProfilerStop(); +#endif break; case PGS_Quit: