3c392aec |
1 | // (c) Copyright 2007 notaz, All rights reserved.\r |
e5f426aa |
2 | // Free for non-commercial use.\r |
3 | \r |
4 | // For commercial use, separate licencing terms must be obtained.\r |
5 | \r |
6 | #include <windows.h>\r |
7 | \r |
8 | #include "giz.h"\r |
9 | #include "menu.h"\r |
e5f426aa |
10 | #include "emu.h"\r |
ea8c405f |
11 | #include "../common/menu.h"\r |
12 | #include "../common/emu.h"\r |
e5f426aa |
13 | #include "version.h"\r |
14 | \r |
15 | \r |
16 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)\r |
17 | {\r |
18 | emu_ReadConfig(0, 0);\r |
19 | giz_init(hInstance, hPrevInstance);\r |
20 | emu_Init();\r |
21 | menu_init();\r |
22 | \r |
23 | engineState = PGS_Menu;\r |
24 | \r |
25 | for (;;)\r |
26 | {\r |
27 | switch (engineState)\r |
28 | {\r |
29 | case PGS_Menu:\r |
30 | menu_loop();\r |
31 | break;\r |
32 | \r |
33 | case PGS_ReloadRom:\r |
34 | if (emu_ReloadRom())\r |
35 | engineState = PGS_Running;\r |
36 | else {\r |
37 | lprintf("PGS_ReloadRom == 0\n");\r |
38 | engineState = PGS_Menu;\r |
39 | }\r |
40 | break;\r |
41 | \r |
42 | case PGS_RestartRun:\r |
43 | engineState = PGS_Running;\r |
44 | \r |
45 | case PGS_Running:\r |
46 | emu_Loop();\r |
47 | break;\r |
48 | \r |
49 | case PGS_Quit:\r |
50 | goto endloop;\r |
51 | \r |
52 | default:\r |
53 | lprintf("engine got into unknown state (%i), exitting\n", engineState);\r |
54 | goto endloop;\r |
55 | }\r |
56 | }\r |
57 | \r |
58 | endloop:\r |
59 | \r |
60 | emu_Deinit();\r |
61 | giz_deinit();\r |
62 | \r |
63 | return 0;\r |
64 | }\r |