cff531af |
1 | /*\r |
2 | * PicoDrive\r |
3 | * (C) notaz, 2006-2008\r |
4 | *\r |
5 | * This work is licensed under the terms of MAME license.\r |
6 | * See COPYING file in the top-level directory.\r |
7 | */\r |
e5f426aa |
8 | \r |
9 | #include <windows.h>\r |
10 | \r |
11 | #include "giz.h"\r |
12 | #include "menu.h"\r |
e5f426aa |
13 | #include "emu.h"\r |
ea8c405f |
14 | #include "../common/menu.h"\r |
15 | #include "../common/emu.h"\r |
84100c0f |
16 | #include "../common/config.h"\r |
e5f426aa |
17 | #include "version.h"\r |
18 | \r |
19 | \r |
20 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)\r |
21 | {\r |
84100c0f |
22 | emu_prepareDefaultConfig();\r |
e5f426aa |
23 | emu_ReadConfig(0, 0);\r |
84100c0f |
24 | config_readlrom(PicoConfigFile);\r |
e5f426aa |
25 | giz_init(hInstance, hPrevInstance);\r |
26 | emu_Init();\r |
27 | menu_init();\r |
28 | \r |
29 | engineState = PGS_Menu;\r |
30 | \r |
31 | for (;;)\r |
32 | {\r |
33 | switch (engineState)\r |
34 | {\r |
35 | case PGS_Menu:\r |
36 | menu_loop();\r |
37 | break;\r |
38 | \r |
39 | case PGS_ReloadRom:\r |
a47dd663 |
40 | if (emu_reload_rom(romFileName))\r |
e5f426aa |
41 | engineState = PGS_Running;\r |
42 | else {\r |
43 | lprintf("PGS_ReloadRom == 0\n");\r |
44 | engineState = PGS_Menu;\r |
45 | }\r |
46 | break;\r |
47 | \r |
48 | case PGS_RestartRun:\r |
49 | engineState = PGS_Running;\r |
50 | \r |
51 | case PGS_Running:\r |
f2cf8472 |
52 | pemu_loop();\r |
e5f426aa |
53 | break;\r |
54 | \r |
55 | case PGS_Quit:\r |
56 | goto endloop;\r |
57 | \r |
58 | default:\r |
59 | lprintf("engine got into unknown state (%i), exitting\n", engineState);\r |
60 | goto endloop;\r |
61 | }\r |
62 | }\r |
63 | \r |
64 | endloop:\r |
65 | \r |
66 | emu_Deinit();\r |
67 | giz_deinit();\r |
68 | \r |
69 | return 0;\r |
70 | }\r |