| 1 | #include "psp.h" |
| 2 | #include "emu.h" |
| 3 | #include "menu.h" |
| 4 | #include "../common/menu.h" |
| 5 | #include "../common/emu.h" |
| 6 | #include "../common/lprintf.h" |
| 7 | #include "version.h" |
| 8 | |
| 9 | int main() |
| 10 | { |
| 11 | lprintf("\nPicoDrive v" VERSION " " __DATE__ " " __TIME__ "\n"); |
| 12 | psp_init(); |
| 13 | |
| 14 | emu_ReadConfig(0, 0); |
| 15 | emu_Init(); |
| 16 | menu_init(); |
| 17 | |
| 18 | engineState = PGS_Menu; |
| 19 | |
| 20 | for (;;) |
| 21 | { |
| 22 | switch (engineState) |
| 23 | { |
| 24 | case PGS_Menu: |
| 25 | menu_loop(); |
| 26 | break; |
| 27 | |
| 28 | case PGS_ReloadRom: |
| 29 | if (emu_ReloadRom()) |
| 30 | engineState = PGS_Running; |
| 31 | else { |
| 32 | lprintf("PGS_ReloadRom == 0\n"); |
| 33 | engineState = PGS_Menu; |
| 34 | } |
| 35 | break; |
| 36 | |
| 37 | case PGS_RestartRun: |
| 38 | engineState = PGS_Running; |
| 39 | |
| 40 | case PGS_Running: |
| 41 | emu_Loop(); |
| 42 | break; |
| 43 | |
| 44 | case PGS_Quit: |
| 45 | goto endloop; |
| 46 | |
| 47 | default: |
| 48 | lprintf("engine got into unknown state (%i), exitting\n", engineState); |
| 49 | goto endloop; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | endloop: |
| 54 | |
| 55 | emu_Deinit(); |
| 56 | psp_finish(); |
| 57 | |
| 58 | return 0; |
| 59 | } |
| 60 | |