get rid of port_config.h
[picodrive.git] / platform / common / emu.h
CommitLineData
cff531af 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 */
ea8c405f 8
ca482e5d 9#ifdef __cplusplus
10extern "C" {
11#endif
12
3e49ffd0 13#define array_size(x) (sizeof(x) / sizeof(x[0]))
14
e2de9939 15extern void *g_screen_ptr;
16
e2de9939 17extern int g_screen_width;
18extern int g_screen_height;
e2de9939 19
a47dd663 20#define EOPT_EN_SRAM (1<<0)
ca482e5d 21#define EOPT_SHOW_FPS (1<<1)
22#define EOPT_EN_SOUND (1<<2)
23#define EOPT_GZIP_SAVES (1<<3)
0d9bf4fc 24#define EOPT_MMUHACK (1<<4)
d7dd4d66 25#define EOPT_NO_AUTOSVCFG (1<<5)
5a681086 26#define EOPT_16BPP (1<<7) // depreceted for .renderer
0d9bf4fc 27#define EOPT_RAM_TIMINGS (1<<8)
d34a42f9 28#define EOPT_EN_CD_LEDS (1<<10)
ee2a3bdf 29#define EOPT_A_SN_GAMMA (1<<12)
7b436906 30#define EOPT_VSYNC (1<<13)
cc41eb4f 31#define EOPT_GIZ_SCANLN (1<<14)
32#define EOPT_GIZ_DBLBUF (1<<15)
33#define EOPT_VSYNC_MODE (1<<16)
34#define EOPT_SHOW_RTC (1<<17)
35#define EOPT_NO_FRMLIMIT (1<<18)
36#define EOPT_WIZ_TEAR_FIX (1<<19)
ae87bffa 37#define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc)
ca482e5d 38
ee2a3bdf 39enum {
40 EOPT_SCALE_NONE = 0,
f4750ee0 41 EOPT_SCALE_SW,
42 EOPT_SCALE_HW,
ee2a3bdf 43};
44
fcdefcf6 45enum {
46 EOPT_CONFIRM_NONE = 0,
47 EOPT_CONFIRM_SAVE = 1,
48 EOPT_CONFIRM_LOAD = 2,
49 EOPT_CONFIRM_BOTH = 3,
50};
51
ca482e5d 52typedef struct _currentConfig_t {
cc41eb4f 53 int EmuOpt;
54 int s_PicoOpt;
58c86d00 55 int s_PsndRate;
56 int s_PicoRegion;
ca482e5d 57 int s_PicoAutoRgnOrder;
58 int s_PicoCDBuffers;
ea8c405f 59 int Frameskip;
fcdefcf6 60 int confirm_save;
ea8c405f 61 int CPUclock;
ea8c405f 62 int volume;
63 int gamma;
f4750ee0 64 int scaling; // gp2x: EOPT_SCALE_*; psp: bilinear filtering
65 int vscaling;
ca482e5d 66 int rotation; // for UIQ
8ab3e3c1 67 float scale; // psp: screen scale
68 float hscale32, hscale40; // psp: horizontal scale
6fc57144 69 int gamma2; // psp: black level
f0f0d2df 70 int turbo_rate;
5a681086 71 int renderer;
72 int renderer32x;
c7eb229a 73 int filter; // pandora
45285368 74 int analog_deadzone;
ed4402a7 75 int msh2_khz;
76 int ssh2_khz;
ea8c405f 77} currentConfig_t;
78
58c86d00 79extern currentConfig_t currentConfig, defaultConfig;
ea8c405f 80extern char *PicoConfigFile;
ea8c405f 81extern int state_slot;
82extern int config_slot, config_slot_current;
83extern unsigned char *movie_data;
f2cf8472 84extern int reset_timing;
85
86#define PICO_PEN_ADJUST_X 4
87#define PICO_PEN_ADJUST_Y 2
88extern int pico_pen_x, pico_pen_y;
c060a9ab 89extern int pico_inp_mode;
ea8c405f 90
636d5f25 91extern const char *rom_fname_reload; // ROM to try loading on next PGS_ReloadRom
713c9224 92extern char rom_fname_loaded[512]; // currently loaded ROM filename
93
1fb0dd88 94// engine states
713c9224 95extern int engineState;
1fb0dd88 96enum TPicoGameState {
97 PGS_Paused = 1,
98 PGS_Running,
99 PGS_Quit,
100 PGS_KeyConfig,
101 PGS_ReloadRom,
102 PGS_Menu,
d687ef50 103 PGS_TrayMenu,
1fb0dd88 104 PGS_RestartRun,
105 PGS_Suspending, /* PSP */
106 PGS_SuspendWake, /* PSP */
107};
ea8c405f 108
f2cf8472 109void emu_init(void);
110void emu_finish(void);
b24e0f6c 111void emu_loop(void);
f2cf8472 112
636d5f25 113int emu_reload_rom(const char *rom_fname_in);
35e3031a 114int emu_swap_cd(const char *fname);
a47dd663 115int emu_save_load_game(int load, int sram);
f2cf8472 116void emu_reset_game(void);
d34a42f9 117
697746df 118void emu_prep_defconfig(void);
d90f5bd7 119void emu_set_defconfig(void);
fcdefcf6 120int emu_read_config(const char *rom_fname, int no_defaults);
a47dd663 121int emu_write_config(int game);
d34a42f9 122
a47dd663 123char *emu_get_save_fname(int load, int is_sram, int slot);
cca8800d 124int emu_check_save_file(int slot, int *time);
d34a42f9 125
cc41eb4f 126void emu_text_out8 (int x, int y, const char *text);
127void emu_text_out16(int x, int y, const char *text);
128void emu_text_out8_rot (int x, int y, const char *text);
129void emu_text_out16_rot(int x, int y, const char *text);
130
27701801 131void emu_make_path(char *buff, const char *end, int size);
d34a42f9 132void emu_update_input(void);
a47dd663 133void emu_get_game_name(char *str150);
134void emu_set_fastforward(int set_on);
b24e0f6c 135void emu_status_msg(const char *format, ...);
ea8c405f 136
df92fbd1 137/* default sound code */
138void emu_sound_start(void);
139void emu_sound_stop(void);
140void emu_sound_wait(void);
141
a4edca53 142/* used by some (but not all) platforms */
143void emu_cmn_forced_frame(int no_scale, int do_emu);
144
e743be20 145/* stuff to be implemented by platform code */
146extern const char *renderer_names[];
147extern const char *renderer_names32x[];
148
149void pemu_prep_defconfig(void);
150void pemu_validate_config(void);
151void pemu_loop_prep(void);
152void pemu_loop_end(void);
153void pemu_forced_frame(int no_scale, int do_emu); // ..to g_menubg_src_ptr
154void pemu_finalize_frame(const char *fps, const char *notice_msg);
155
156void pemu_sound_start(void);
e743be20 157
158void plat_early_init(void);
159void plat_init(void);
160void plat_finish(void);
161
162/* used before things blocking for a while (these funcs redraw on return) */
163void plat_status_msg_busy_first(const char *msg);
164void plat_status_msg_busy_next(const char *msg);
165void plat_status_msg_clear(void);
166
167void plat_video_toggle_renderer(int change, int menu_call);
636d5f25 168void plat_video_loop_prepare(void);
e743be20 169
170void plat_update_volume(int has_changed, int is_up);
171
ca482e5d 172#ifdef __cplusplus
173} // extern "C"
174#endif
175