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 |
10 | extern "C" { |
11 | #endif |
12 | |
3e49ffd0 |
13 | #define array_size(x) (sizeof(x) / sizeof(x[0])) |
14 | |
e2de9939 |
15 | extern void *g_screen_ptr; |
16 | |
e2de9939 |
17 | extern int g_screen_width; |
18 | extern int g_screen_height; |
9cdfc191 |
19 | extern int g_screen_ppitch; // pitch in pixels |
e2de9939 |
20 | |
a47dd663 |
21 | #define EOPT_EN_SRAM (1<<0) |
ca482e5d |
22 | #define EOPT_SHOW_FPS (1<<1) |
23 | #define EOPT_EN_SOUND (1<<2) |
24 | #define EOPT_GZIP_SAVES (1<<3) |
d7dd4d66 |
25 | #define EOPT_NO_AUTOSVCFG (1<<5) |
5a681086 |
26 | #define EOPT_16BPP (1<<7) // depreceted for .renderer |
d34a42f9 |
27 | #define EOPT_EN_CD_LEDS (1<<10) |
ee2a3bdf |
28 | #define EOPT_A_SN_GAMMA (1<<12) |
7b436906 |
29 | #define EOPT_VSYNC (1<<13) |
cc41eb4f |
30 | #define EOPT_GIZ_SCANLN (1<<14) |
31 | #define EOPT_GIZ_DBLBUF (1<<15) |
32 | #define EOPT_VSYNC_MODE (1<<16) |
33 | #define EOPT_SHOW_RTC (1<<17) |
34 | #define EOPT_NO_FRMLIMIT (1<<18) |
35 | #define EOPT_WIZ_TEAR_FIX (1<<19) |
ae87bffa |
36 | #define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc) |
dca20eff |
37 | #define EOPT_PICO_PEN (1<<21) |
ca482e5d |
38 | |
ee2a3bdf |
39 | enum { |
40 | EOPT_SCALE_NONE = 0, |
d5d17782 |
41 | // linux, GP2X: |
42 | EOPT_SCALE_SW = 1, |
f4750ee0 |
43 | EOPT_SCALE_HW, |
0924243a |
44 | // PSP horiz: |
fc07fe2b |
45 | EOPT_SCALE_43 = 1, // 4:3 screen |
46 | EOPT_SCALE_STRETCH, // stretched to between _43 and _WIDE |
47 | EOPT_SCALE_WIDE, // stretched to match display width |
0924243a |
48 | // PSP vert: |
fc07fe2b |
49 | EOPT_VSCALE_FULL = 1, // TV height scaled to screen height |
50 | EOPT_VSCALE_NOBORDER, // VDP area scaled to screen height |
ee2a3bdf |
51 | }; |
52 | |
d5d17782 |
53 | enum { |
54 | EOPT_FILTER_NONE = 0, |
0924243a |
55 | // PSP texture filtering |
56 | EOPT_FILTER_BILINEAR = 1, |
d5d17782 |
57 | // software scalers |
58 | EOPT_FILTER_SMOOTHER = 1, |
59 | EOPT_FILTER_BILINEAR1, |
60 | EOPT_FILTER_BILINEAR2, |
61 | }; |
62 | |
fcdefcf6 |
63 | enum { |
64 | EOPT_CONFIRM_NONE = 0, |
65 | EOPT_CONFIRM_SAVE = 1, |
66 | EOPT_CONFIRM_LOAD = 2, |
67 | EOPT_CONFIRM_BOTH = 3, |
68 | }; |
69 | |
ca482e5d |
70 | typedef struct _currentConfig_t { |
cc41eb4f |
71 | int EmuOpt; |
72 | int s_PicoOpt; |
58c86d00 |
73 | int s_PsndRate; |
74 | int s_PicoRegion; |
ca482e5d |
75 | int s_PicoAutoRgnOrder; |
280bfc3c |
76 | int s_hwSelect; |
ca482e5d |
77 | int s_PicoCDBuffers; |
37631374 |
78 | int s_PicoSndFilterAlpha; |
ea8c405f |
79 | int Frameskip; |
531a8f38 |
80 | int input_dev0; |
81 | int input_dev1; |
fcdefcf6 |
82 | int confirm_save; |
ea8c405f |
83 | int CPUclock; |
ea8c405f |
84 | int volume; |
85 | int gamma; |
d5d17782 |
86 | int scaling; // EOPT_SCALE_* |
f4750ee0 |
87 | int vscaling; |
ca482e5d |
88 | int rotation; // for UIQ |
6fc57144 |
89 | int gamma2; // psp: black level |
f0f0d2df |
90 | int turbo_rate; |
5a681086 |
91 | int renderer; |
92 | int renderer32x; |
d5d17782 |
93 | int filter; // EOPT_FILTER_* video filter |
f55ce7bf |
94 | int ghosting; |
45285368 |
95 | int analog_deadzone; |
bac44b18 |
96 | int keyboard; |
ed4402a7 |
97 | int msh2_khz; |
98 | int ssh2_khz; |
35f2b65e |
99 | int overclock_68k; |
e7ee7bc0 |
100 | int max_skip; |
ea8c405f |
101 | } currentConfig_t; |
102 | |
58c86d00 |
103 | extern currentConfig_t currentConfig, defaultConfig; |
b59172e3 |
104 | extern const char *PicoConfigFile; |
ea8c405f |
105 | extern int state_slot; |
106 | extern int config_slot, config_slot_current; |
107 | extern unsigned char *movie_data; |
f2cf8472 |
108 | extern int reset_timing; |
b7d64dbd |
109 | extern int flip_after_sync; |
bac44b18 |
110 | extern int kbd_mode; |
111 | extern struct vkbd *vkbd; |
f2cf8472 |
112 | |
c87e36d7 |
113 | #define PICO_PEN_ADJUST_X 1 |
114 | #define PICO_PEN_ADJUST_Y 1 |
f2cf8472 |
115 | extern int pico_pen_x, pico_pen_y; |
c060a9ab |
116 | extern int pico_inp_mode; |
ea8c405f |
117 | |
636d5f25 |
118 | extern const char *rom_fname_reload; // ROM to try loading on next PGS_ReloadRom |
713c9224 |
119 | extern char rom_fname_loaded[512]; // currently loaded ROM filename |
120 | |
1fb0dd88 |
121 | // engine states |
713c9224 |
122 | extern int engineState; |
1fb0dd88 |
123 | enum TPicoGameState { |
124 | PGS_Paused = 1, |
125 | PGS_Running, |
126 | PGS_Quit, |
127 | PGS_KeyConfig, |
128 | PGS_ReloadRom, |
129 | PGS_Menu, |
d687ef50 |
130 | PGS_TrayMenu, |
1fb0dd88 |
131 | PGS_RestartRun, |
132 | PGS_Suspending, /* PSP */ |
133 | PGS_SuspendWake, /* PSP */ |
134 | }; |
ea8c405f |
135 | |
f2cf8472 |
136 | void emu_init(void); |
137 | void emu_finish(void); |
b24e0f6c |
138 | void emu_loop(void); |
f2cf8472 |
139 | |
636d5f25 |
140 | int emu_reload_rom(const char *rom_fname_in); |
35e3031a |
141 | int emu_swap_cd(const char *fname); |
92064e2f |
142 | int emu_play_tape(const char *fname); |
59f8f7d1 |
143 | int emu_record_tape(const char *ext); |
a47dd663 |
144 | int emu_save_load_game(int load, int sram); |
f2cf8472 |
145 | void emu_reset_game(void); |
d34a42f9 |
146 | |
697746df |
147 | void emu_prep_defconfig(void); |
d90f5bd7 |
148 | void emu_set_defconfig(void); |
fcdefcf6 |
149 | int emu_read_config(const char *rom_fname, int no_defaults); |
a47dd663 |
150 | int emu_write_config(int game); |
d34a42f9 |
151 | |
c7074ddb |
152 | char *emu_get_save_fname(int load, int is_sram, int slot, int *time); |
cca8800d |
153 | int emu_check_save_file(int slot, int *time); |
d34a42f9 |
154 | |
cc41eb4f |
155 | void emu_text_out8 (int x, int y, const char *text); |
156 | void emu_text_out16(int x, int y, const char *text); |
157 | void emu_text_out8_rot (int x, int y, const char *text); |
158 | void emu_text_out16_rot(int x, int y, const char *text); |
159 | |
f7e40c9b |
160 | void emu_osd_text16(int x, int y, const char *text); |
161 | |
27701801 |
162 | void emu_make_path(char *buff, const char *end, int size); |
d34a42f9 |
163 | void emu_update_input(void); |
a47dd663 |
164 | void emu_get_game_name(char *str150); |
165 | void emu_set_fastforward(int set_on); |
b24e0f6c |
166 | void emu_status_msg(const char *format, ...); |
ea8c405f |
167 | |
15cc45c0 |
168 | void emu_pico_overlay(unsigned short *pd, int w, int h, int pitch); |
169 | |
df92fbd1 |
170 | /* default sound code */ |
171 | void emu_sound_start(void); |
172 | void emu_sound_stop(void); |
173 | void emu_sound_wait(void); |
174 | |
a4edca53 |
175 | /* used by some (but not all) platforms */ |
832faed3 |
176 | void emu_cmn_forced_frame(int no_scale, int do_emu, void *buf); |
a4edca53 |
177 | |
e743be20 |
178 | /* stuff to be implemented by platform code */ |
179 | extern const char *renderer_names[]; |
180 | extern const char *renderer_names32x[]; |
181 | |
182 | void pemu_prep_defconfig(void); |
183 | void pemu_validate_config(void); |
184 | void pemu_loop_prep(void); |
185 | void pemu_loop_end(void); |
186 | void pemu_forced_frame(int no_scale, int do_emu); // ..to g_menubg_src_ptr |
187 | void pemu_finalize_frame(const char *fps, const char *notice_msg); |
188 | |
189 | void pemu_sound_start(void); |
e743be20 |
190 | |
58fc34b1 |
191 | int plat_parse_arg(int argc, char *argv[], int *x); |
e743be20 |
192 | void plat_early_init(void); |
193 | void plat_init(void); |
194 | void plat_finish(void); |
195 | |
037f58e1 |
196 | void plat_show_cursor(int on); |
1777b86d |
197 | int plat_grab_cursor(int on); |
198 | int plat_has_wm(void); |
037f58e1 |
199 | |
e743be20 |
200 | /* used before things blocking for a while (these funcs redraw on return) */ |
201 | void plat_status_msg_busy_first(const char *msg); |
202 | void plat_status_msg_busy_next(const char *msg); |
95b08943 |
203 | void plat_status_msg_busy_done(void); |
e743be20 |
204 | void plat_status_msg_clear(void); |
205 | |
206 | void plat_video_toggle_renderer(int change, int menu_call); |
636d5f25 |
207 | void plat_video_loop_prepare(void); |
758abbeb |
208 | void plat_video_set_buffer(void *); |
e743be20 |
209 | |
210 | void plat_update_volume(int has_changed, int is_up); |
211 | |
69b7b264 |
212 | /* should be in libpicofe/plat.h */ |
213 | void plat_video_clear_status(void); |
214 | void plat_video_clear_buffers(void); |
d5d17782 |
215 | void plat_video_set_size(int w, int h); |
39194ef1 |
216 | void plat_video_set_shadow(int w, int h); |
69b7b264 |
217 | |
ca482e5d |
218 | #ifdef __cplusplus |
219 | } // extern "C" |
220 | #endif |
221 | |