frontend: eliminate osd_text dupes
[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)
d7dd4d66 24#define EOPT_NO_AUTOSVCFG (1<<5)
5a681086 25#define EOPT_16BPP (1<<7) // depreceted for .renderer
d34a42f9 26#define EOPT_EN_CD_LEDS (1<<10)
ee2a3bdf 27#define EOPT_A_SN_GAMMA (1<<12)
7b436906 28#define EOPT_VSYNC (1<<13)
cc41eb4f 29#define EOPT_GIZ_SCANLN (1<<14)
30#define EOPT_GIZ_DBLBUF (1<<15)
31#define EOPT_VSYNC_MODE (1<<16)
32#define EOPT_SHOW_RTC (1<<17)
33#define EOPT_NO_FRMLIMIT (1<<18)
34#define EOPT_WIZ_TEAR_FIX (1<<19)
ae87bffa 35#define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc)
ca482e5d 36
ee2a3bdf 37enum {
38 EOPT_SCALE_NONE = 0,
f4750ee0 39 EOPT_SCALE_SW,
40 EOPT_SCALE_HW,
ee2a3bdf 41};
42
fcdefcf6 43enum {
44 EOPT_CONFIRM_NONE = 0,
45 EOPT_CONFIRM_SAVE = 1,
46 EOPT_CONFIRM_LOAD = 2,
47 EOPT_CONFIRM_BOTH = 3,
48};
49
ca482e5d 50typedef struct _currentConfig_t {
cc41eb4f 51 int EmuOpt;
52 int s_PicoOpt;
58c86d00 53 int s_PsndRate;
54 int s_PicoRegion;
ca482e5d 55 int s_PicoAutoRgnOrder;
56 int s_PicoCDBuffers;
ea8c405f 57 int Frameskip;
531a8f38 58 int input_dev0;
59 int input_dev1;
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;
b59172e3 80extern const char *PicoConfigFile;
ea8c405f 81extern int state_slot;
82extern int config_slot, config_slot_current;
83extern unsigned char *movie_data;
f2cf8472 84extern int reset_timing;
b7d64dbd 85extern int flip_after_sync;
f2cf8472 86
87#define PICO_PEN_ADJUST_X 4
88#define PICO_PEN_ADJUST_Y 2
89extern int pico_pen_x, pico_pen_y;
c060a9ab 90extern int pico_inp_mode;
ea8c405f 91
636d5f25 92extern const char *rom_fname_reload; // ROM to try loading on next PGS_ReloadRom
713c9224 93extern char rom_fname_loaded[512]; // currently loaded ROM filename
94
1fb0dd88 95// engine states
713c9224 96extern int engineState;
1fb0dd88 97enum TPicoGameState {
98 PGS_Paused = 1,
99 PGS_Running,
100 PGS_Quit,
101 PGS_KeyConfig,
102 PGS_ReloadRom,
103 PGS_Menu,
d687ef50 104 PGS_TrayMenu,
1fb0dd88 105 PGS_RestartRun,
106 PGS_Suspending, /* PSP */
107 PGS_SuspendWake, /* PSP */
108};
ea8c405f 109
f2cf8472 110void emu_init(void);
111void emu_finish(void);
b24e0f6c 112void emu_loop(void);
f2cf8472 113
636d5f25 114int emu_reload_rom(const char *rom_fname_in);
35e3031a 115int emu_swap_cd(const char *fname);
a47dd663 116int emu_save_load_game(int load, int sram);
f2cf8472 117void emu_reset_game(void);
d34a42f9 118
697746df 119void emu_prep_defconfig(void);
d90f5bd7 120void emu_set_defconfig(void);
fcdefcf6 121int emu_read_config(const char *rom_fname, int no_defaults);
a47dd663 122int emu_write_config(int game);
d34a42f9 123
c7074ddb 124char *emu_get_save_fname(int load, int is_sram, int slot, int *time);
cca8800d 125int emu_check_save_file(int slot, int *time);
d34a42f9 126
cc41eb4f 127void emu_text_out8 (int x, int y, const char *text);
128void emu_text_out16(int x, int y, const char *text);
129void emu_text_out8_rot (int x, int y, const char *text);
130void emu_text_out16_rot(int x, int y, const char *text);
131
f7e40c9b 132void emu_osd_text16(int x, int y, const char *text);
133
27701801 134void emu_make_path(char *buff, const char *end, int size);
d34a42f9 135void emu_update_input(void);
a47dd663 136void emu_get_game_name(char *str150);
137void emu_set_fastforward(int set_on);
b24e0f6c 138void emu_status_msg(const char *format, ...);
ea8c405f 139
df92fbd1 140/* default sound code */
141void emu_sound_start(void);
142void emu_sound_stop(void);
143void emu_sound_wait(void);
144
a4edca53 145/* used by some (but not all) platforms */
146void emu_cmn_forced_frame(int no_scale, int do_emu);
147
e743be20 148/* stuff to be implemented by platform code */
149extern const char *renderer_names[];
150extern const char *renderer_names32x[];
151
152void pemu_prep_defconfig(void);
153void pemu_validate_config(void);
154void pemu_loop_prep(void);
155void pemu_loop_end(void);
156void pemu_forced_frame(int no_scale, int do_emu); // ..to g_menubg_src_ptr
157void pemu_finalize_frame(const char *fps, const char *notice_msg);
158
159void pemu_sound_start(void);
e743be20 160
161void plat_early_init(void);
162void plat_init(void);
163void plat_finish(void);
164
165/* used before things blocking for a while (these funcs redraw on return) */
166void plat_status_msg_busy_first(const char *msg);
167void plat_status_msg_busy_next(const char *msg);
168void plat_status_msg_clear(void);
169
170void plat_video_toggle_renderer(int change, int menu_call);
636d5f25 171void plat_video_loop_prepare(void);
e743be20 172
173void plat_update_volume(int has_changed, int is_up);
174
ca482e5d 175#ifdef __cplusplus
176} // extern "C"
177#endif
178