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