X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fmain.c;h=ed2191c8cfb715b5980b60ce30f0cf4cd94391fc;hb=3f2aaff20c940e90e970c008e56f5253d494a92c;hp=f21ebd78f3d8f1af96d6ed5c89fcfad989bc0622;hpb=720ee7f6244cb51cc123a7fd16832161db9a3b4d;p=libpicofe.git diff --git a/gp2x/main.c b/gp2x/main.c index f21ebd7..ed2191c 100644 --- a/gp2x/main.c +++ b/gp2x/main.c @@ -11,7 +11,11 @@ #include "gp2x.h" #include "menu.h" +#include "../common/menu.h" +#include "../common/emu.h" +#include "../common/config.h" #include "emu.h" +#include "940ctl.h" #include "version.h" #include "squidgehack.h" @@ -62,7 +66,7 @@ void parse_cmd_line(int argc, char *argv[]) } if (unrecognized) { - printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006\n"); + printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2008\n"); printf("usage: %s [options] [romfile]\n", argv[0]); printf( "options:\n" "-menu launch a custom program on exit instead of default gp2xmenu\n" @@ -78,7 +82,10 @@ int main(int argc, char *argv[]) { g_argv = argv; - emu_ReadConfig(0); + emu_prepareDefaultConfig(); + emu_ReadConfig(0, 0); + config_readlrom(PicoConfigFile); + gp2x_init(); if (currentConfig.EmuOpt&0x10) { int ret = mmuhack(); @@ -86,15 +93,17 @@ int main(int argc, char *argv[]) mmuhack_status = ret; } cpuctrl_init(); - Reset940(1); - Pause940(1); + // Reset940(1); + // Pause940(1); if (currentConfig.EmuOpt&0x100) { printf("setting RAM timings.. "); fflush(stdout); // craigix: --trc 6 --tras 4 --twr 1 --tmrd 1 --trfc 1 --trp 2 --trcd 2 set_RAM_Timings(6, 4, 1, 1, 1, 2, 2); printf("done.\n"); fflush(stdout); } + sharedmem_init(); emu_Init(); + menu_init(); engineState = PGS_Menu; @@ -118,13 +127,16 @@ int main(int argc, char *argv[]) } break; + case PGS_RestartRun: + engineState = PGS_Running; + case PGS_Running: emu_Loop(); break; case PGS_Quit: goto endloop; - + default: printf("engine got into unknown state (%i), exitting\n", engineState); goto endloop; @@ -134,6 +146,7 @@ int main(int argc, char *argv[]) endloop: emu_Deinit(); + sharedmem_deinit(); cpuctrl_deinit(); gp2x_deinit(); if(mmuhack_status)