1820b5a7 |
1 | #include "psp.h" |
2 | #include "emu.h" |
3 | #include "menu.h" |
4b167c12 |
4 | #include "mp3.h" |
1820b5a7 |
5 | #include "../common/menu.h" |
7d4906bf |
6 | #include "../common/emu.h" |
1820b5a7 |
7 | #include "../common/lprintf.h" |
9caf44b5 |
8 | #include "version.h" |
1820b5a7 |
9 | |
10 | int main() |
11 | { |
4b167c12 |
12 | int mp3_ret; |
13 | |
9caf44b5 |
14 | lprintf("\nPicoDrive v" VERSION " " __DATE__ " " __TIME__ "\n"); |
1820b5a7 |
15 | psp_init(); |
16 | |
7d4906bf |
17 | emu_ReadConfig(0, 0); |
1820b5a7 |
18 | emu_Init(); |
19 | menu_init(); |
4b167c12 |
20 | mp3_ret = mp3_init(); |
1820b5a7 |
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: |
4b167c12 |
33 | if (emu_ReloadRom()) { |
1820b5a7 |
34 | engineState = PGS_Running; |
4b167c12 |
35 | if (mp3_last_error != 0) |
36 | engineState = PGS_Menu; // send to menu to display mp3 error |
37 | } else { |
1820b5a7 |
38 | lprintf("PGS_ReloadRom == 0\n"); |
39 | engineState = PGS_Menu; |
40 | } |
1820b5a7 |
41 | break; |
42 | |
43 | case PGS_RestartRun: |
44 | engineState = PGS_Running; |
45 | |
46 | case PGS_Running: |
7d4906bf |
47 | emu_Loop(); |
1820b5a7 |
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 | |
4b167c12 |
61 | if (mp3_ret == 0) mp3_deinit(); |
1820b5a7 |
62 | emu_Deinit(); |
63 | psp_finish(); |
64 | |
65 | return 0; |
66 | } |
67 | |