main.c 1.3 KB

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