various bugfixes
[libpicofe.git] / psp / main.c
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
8 int main()
9 {
10         psp_init();
11
12         emu_ReadConfig(0, 0);
13         emu_Init();
14         menu_init();
15
16         engineState = PGS_Menu;
17
18         for (;;)
19         {
20                 switch (engineState)
21                 {
22                         case PGS_Menu:
23                                 menu_loop();
24                                 break;
25
26                         case PGS_ReloadRom:
27                                 if (emu_ReloadRom())
28                                         engineState = PGS_Running;
29                                 else {
30                                         lprintf("PGS_ReloadRom == 0\n");
31                                         engineState = PGS_Menu;
32                                 }
33                                 break;
34
35                         case PGS_RestartRun:
36                                 engineState = PGS_Running;
37
38                         case PGS_Running:
39                                 emu_Loop();
40                                 break;
41
42                         case PGS_Quit:
43                                 goto endloop;
44
45                         default:
46                                 lprintf("engine got into unknown state (%i), exitting\n", engineState);
47                                 goto endloop;
48                 }
49         }
50
51         endloop:
52
53         emu_Deinit();
54         psp_finish();
55
56         return 0;
57 }
58