| 1 | // (c) Copyright 2007 notaz, All rights reserved.\r |
| 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 |
| 10 | #include "emu.h"\r |
| 11 | #include "../common/menu.h"\r |
| 12 | #include "../common/emu.h"\r |
| 13 | #include "../common/config.h"\r |
| 14 | #include "version.h"\r |
| 15 | \r |
| 16 | \r |
| 17 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)\r |
| 18 | {\r |
| 19 | emu_prepareDefaultConfig();\r |
| 20 | emu_ReadConfig(0, 0);\r |
| 21 | config_readlrom(PicoConfigFile);\r |
| 22 | giz_init(hInstance, hPrevInstance);\r |
| 23 | emu_Init();\r |
| 24 | menu_init();\r |
| 25 | \r |
| 26 | engineState = PGS_Menu;\r |
| 27 | \r |
| 28 | for (;;)\r |
| 29 | {\r |
| 30 | switch (engineState)\r |
| 31 | {\r |
| 32 | case PGS_Menu:\r |
| 33 | menu_loop();\r |
| 34 | break;\r |
| 35 | \r |
| 36 | case PGS_ReloadRom:\r |
| 37 | if (emu_reload_rom(romFileName))\r |
| 38 | engineState = PGS_Running;\r |
| 39 | else {\r |
| 40 | lprintf("PGS_ReloadRom == 0\n");\r |
| 41 | engineState = PGS_Menu;\r |
| 42 | }\r |
| 43 | break;\r |
| 44 | \r |
| 45 | case PGS_RestartRun:\r |
| 46 | engineState = PGS_Running;\r |
| 47 | \r |
| 48 | case PGS_Running:\r |
| 49 | pemu_loop();\r |
| 50 | break;\r |
| 51 | \r |
| 52 | case PGS_Quit:\r |
| 53 | goto endloop;\r |
| 54 | \r |
| 55 | default:\r |
| 56 | lprintf("engine got into unknown state (%i), exitting\n", engineState);\r |
| 57 | goto endloop;\r |
| 58 | }\r |
| 59 | }\r |
| 60 | \r |
| 61 | endloop:\r |
| 62 | \r |
| 63 | emu_Deinit();\r |
| 64 | giz_deinit();\r |
| 65 | \r |
| 66 | return 0;\r |
| 67 | }\r |