emu.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * PicoDrive
  3. * (C) notaz, 2006-2010
  4. *
  5. * This work is licensed under the terms of MAME license.
  6. * See COPYING file in the top-level directory.
  7. */
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #define array_size(x) (sizeof(x) / sizeof(x[0]))
  12. extern void *g_screen_ptr;
  13. extern int g_screen_width;
  14. extern int g_screen_height;
  15. #define EOPT_EN_SRAM (1<<0)
  16. #define EOPT_SHOW_FPS (1<<1)
  17. #define EOPT_EN_SOUND (1<<2)
  18. #define EOPT_GZIP_SAVES (1<<3)
  19. #define EOPT_NO_AUTOSVCFG (1<<5)
  20. #define EOPT_16BPP (1<<7) // depreceted for .renderer
  21. #define EOPT_EN_CD_LEDS (1<<10)
  22. #define EOPT_A_SN_GAMMA (1<<12)
  23. #define EOPT_VSYNC (1<<13)
  24. #define EOPT_GIZ_SCANLN (1<<14)
  25. #define EOPT_GIZ_DBLBUF (1<<15)
  26. #define EOPT_VSYNC_MODE (1<<16)
  27. #define EOPT_SHOW_RTC (1<<17)
  28. #define EOPT_NO_FRMLIMIT (1<<18)
  29. #define EOPT_WIZ_TEAR_FIX (1<<19)
  30. #define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc)
  31. enum {
  32. EOPT_SCALE_NONE = 0,
  33. EOPT_SCALE_SW,
  34. EOPT_SCALE_HW,
  35. };
  36. enum {
  37. EOPT_CONFIRM_NONE = 0,
  38. EOPT_CONFIRM_SAVE = 1,
  39. EOPT_CONFIRM_LOAD = 2,
  40. EOPT_CONFIRM_BOTH = 3,
  41. };
  42. typedef struct _currentConfig_t {
  43. int EmuOpt;
  44. int s_PicoOpt;
  45. int s_PsndRate;
  46. int s_PicoRegion;
  47. int s_PicoAutoRgnOrder;
  48. int s_PicoCDBuffers;
  49. int Frameskip;
  50. int input_dev0;
  51. int input_dev1;
  52. int confirm_save;
  53. int CPUclock;
  54. int volume;
  55. int gamma;
  56. int scaling; // gp2x: EOPT_SCALE_*; psp: bilinear filtering
  57. int vscaling;
  58. int rotation; // for UIQ
  59. float scale; // psp: screen scale
  60. float hscale32, hscale40; // psp: horizontal scale
  61. int gamma2; // psp: black level
  62. int turbo_rate;
  63. int renderer;
  64. int renderer32x;
  65. int filter; // pandora
  66. int analog_deadzone;
  67. int msh2_khz;
  68. int ssh2_khz;
  69. } currentConfig_t;
  70. extern currentConfig_t currentConfig, defaultConfig;
  71. extern char *PicoConfigFile;
  72. extern int state_slot;
  73. extern int config_slot, config_slot_current;
  74. extern unsigned char *movie_data;
  75. extern int reset_timing;
  76. extern int flip_after_sync;
  77. #define PICO_PEN_ADJUST_X 4
  78. #define PICO_PEN_ADJUST_Y 2
  79. extern int pico_pen_x, pico_pen_y;
  80. extern int pico_inp_mode;
  81. extern const char *rom_fname_reload; // ROM to try loading on next PGS_ReloadRom
  82. extern char rom_fname_loaded[512]; // currently loaded ROM filename
  83. // engine states
  84. extern int engineState;
  85. enum TPicoGameState {
  86. PGS_Paused = 1,
  87. PGS_Running,
  88. PGS_Quit,
  89. PGS_KeyConfig,
  90. PGS_ReloadRom,
  91. PGS_Menu,
  92. PGS_TrayMenu,
  93. PGS_RestartRun,
  94. PGS_Suspending, /* PSP */
  95. PGS_SuspendWake, /* PSP */
  96. };
  97. void emu_init(void);
  98. void emu_finish(void);
  99. void emu_loop(void);
  100. int emu_reload_rom(const char *rom_fname_in);
  101. int emu_swap_cd(const char *fname);
  102. int emu_save_load_game(int load, int sram);
  103. void emu_reset_game(void);
  104. void emu_prep_defconfig(void);
  105. void emu_set_defconfig(void);
  106. int emu_read_config(const char *rom_fname, int no_defaults);
  107. int emu_write_config(int game);
  108. char *emu_get_save_fname(int load, int is_sram, int slot);
  109. int emu_check_save_file(int slot, int *time);
  110. void emu_text_out8 (int x, int y, const char *text);
  111. void emu_text_out16(int x, int y, const char *text);
  112. void emu_text_out8_rot (int x, int y, const char *text);
  113. void emu_text_out16_rot(int x, int y, const char *text);
  114. void emu_make_path(char *buff, const char *end, int size);
  115. void emu_update_input(void);
  116. void emu_get_game_name(char *str150);
  117. void emu_set_fastforward(int set_on);
  118. void emu_status_msg(const char *format, ...);
  119. /* default sound code */
  120. void emu_sound_start(void);
  121. void emu_sound_stop(void);
  122. void emu_sound_wait(void);
  123. /* used by some (but not all) platforms */
  124. void emu_cmn_forced_frame(int no_scale, int do_emu);
  125. /* stuff to be implemented by platform code */
  126. extern const char *renderer_names[];
  127. extern const char *renderer_names32x[];
  128. void pemu_prep_defconfig(void);
  129. void pemu_validate_config(void);
  130. void pemu_loop_prep(void);
  131. void pemu_loop_end(void);
  132. void pemu_forced_frame(int no_scale, int do_emu); // ..to g_menubg_src_ptr
  133. void pemu_finalize_frame(const char *fps, const char *notice_msg);
  134. void pemu_sound_start(void);
  135. void plat_early_init(void);
  136. void plat_init(void);
  137. void plat_finish(void);
  138. /* used before things blocking for a while (these funcs redraw on return) */
  139. void plat_status_msg_busy_first(const char *msg);
  140. void plat_status_msg_busy_next(const char *msg);
  141. void plat_status_msg_clear(void);
  142. void plat_video_toggle_renderer(int change, int menu_call);
  143. void plat_video_loop_prepare(void);
  144. void plat_update_volume(int has_changed, int is_up);
  145. #ifdef __cplusplus
  146. } // extern "C"
  147. #endif