emu.h 5.1 KB

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