X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Fmain.c;h=526766762f0ca8c163f60a6b8bc0863ed7b195f6;hb=868cc0cc8f2fc6cfd278b15e8dbd042188de53ca;hp=5f31b0607ecd76ca6f0fdcef9f787b9e1ed85699;hpb=e743be2070a13d14cae39a55b815b62b0edb6776;p=picodrive.git diff --git a/platform/common/main.c b/platform/common/main.c index 5f31b06..5267667 100644 --- a/platform/common/main.c +++ b/platform/common/main.c @@ -1,7 +1,10 @@ -// (c) Copyright 2006-2009 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. +/* + * PicoDrive + * (C) notaz, 2006-2010 + * + * This work is licensed under the terms of MAME license. + * See COPYING file in the top-level directory. + */ #include #include @@ -12,12 +15,10 @@ #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; @@ -32,7 +33,9 @@ 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], "-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) { @@ -46,24 +49,25 @@ void parse_cmd_line(int argc, char *argv[]) break; } } else { - /* External Frontend: ROM Name */ - FILE *f; - 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; + FILE *f = fopen(argv[x], "rb"); + if (f) { + fclose(f); + rom_fname_reload = argv[x]; + engineState = PGS_ReloadRom; + } + else + unrecognized = 1; break; } } if (unrecognized) { - printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n"); + printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009,2013\n"); printf("usage: %s [options] [romfile]\n", argv[0]); printf("options:\n" " -config use specified config file instead of default 'config.cfg'\n" - " -loadstate if ROM is specified, try loading slot \n"); + " -loadstate if ROM is specified, try loading savestate slot \n"); + exit(1); } } @@ -72,12 +76,13 @@ int main(int argc, char *argv[]) { g_argv = argv; - //plat_early_init(); + plat_early_init(); in_init(); - in_probe(); + //in_probe(); plat_target_init(); + plat_init(); emu_prep_defconfig(); // depends on input emu_read_config(NULL, 0); @@ -142,6 +147,7 @@ int main(int argc, char *argv[]) endloop: emu_finish(); + plat_finish(); plat_target_finish(); return 0;