X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fcommon%2Fmain.c;h=5a0287edf516bbcc963001dd26ea42127bfe6ee3;hb=cff531af94bd9c9c89ae162e80f48ddc26a4e504;hp=00cbac715692900bc66d7d09017b8e4f496642b0;hpb=bcd94522e8afb8d4b266f241adfd2e9aea111904;p=picodrive.git diff --git a/platform/common/main.c b/platform/common/main.c index 00cbac7..5a0287e 100644 --- a/platform/common/main.c +++ b/platform/common/main.c @@ -1,18 +1,22 @@ -// (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 #include #include -#include "menu.h" +#include "../libpicofe/input.h" +#include "../libpicofe/plat.h" +#include "menu_pico.h" #include "emu.h" #include "config.h" -#include "input.h" -#include "plat.h" +#include #include @@ -34,6 +38,12 @@ void parse_cmd_line(int argc, char *argv[]) else if (strcasecmp(argv[x], "-loadstate") == 0) { if (x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); } } + else if (strcasecmp(argv[x], "-pdb") == 0) { + if (x+1 < argc) { ++x; pdb_command(argv[x]); } + } + else if (strcasecmp(argv[x], "-pdb_connect") == 0) { + if (x+2 < argc) { pdb_net_connect(argv[x+1], argv[x+2]); x += 2; } + } else { unrecognized = 1; break; @@ -65,19 +75,17 @@ int main(int argc, char *argv[]) { g_argv = argv; - plat_early_init(); + //plat_early_init(); - /* in_init() must go before config, config accesses in_ fwk */ in_init(); - emu_prepareDefaultConfig(); - emu_ReadConfig(0, 0); - config_readlrom(PicoConfigFile); - - plat_init(); in_probe(); - in_debug_dump(); - emu_Init(); + plat_target_init(); + + emu_prep_defconfig(); // depends on input + emu_read_config(NULL, 0); + + emu_init(); menu_init(); engineState = PGS_Menu; @@ -87,11 +95,11 @@ int main(int argc, char *argv[]) if (engineState == PGS_ReloadRom) { - if (emu_ReloadRom(rom_fname_reload)) { + if (emu_reload_rom(rom_fname_reload)) { engineState = PGS_Running; if (load_state_slot >= 0) { state_slot = load_state_slot; - emu_SaveLoadGame(1, 0); + emu_save_load_game(1, 0); } } } @@ -104,8 +112,12 @@ int main(int argc, char *argv[]) menu_loop(); break; + case PGS_TrayMenu: + menu_loop_tray(); + break; + case PGS_ReloadRom: - if (emu_ReloadRom(rom_fname_reload)) + if (emu_reload_rom(rom_fname_reload)) engineState = PGS_Running; else { printf("PGS_ReloadRom == 0\n"); @@ -115,9 +127,10 @@ int main(int argc, char *argv[]) case PGS_RestartRun: engineState = PGS_Running; + /* vvv fallthrough */ case PGS_Running: - emu_Loop(); + emu_loop(); break; case PGS_Quit: @@ -131,8 +144,8 @@ int main(int argc, char *argv[]) endloop: - emu_Deinit(); - plat_finish(); + emu_finish(); + plat_target_finish(); return 0; }