main.c 1.2 KB

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