improve input handling
[picodrive.git] / platform / common / emu.h
... / ...
CommitLineData
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
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define array_size(x) (sizeof(x) / sizeof(x[0]))
14
15extern void *g_screen_ptr;
16
17extern int g_screen_width;
18extern int g_screen_height;
19
20#define EOPT_EN_SRAM (1<<0)
21#define EOPT_SHOW_FPS (1<<1)
22#define EOPT_EN_SOUND (1<<2)
23#define EOPT_GZIP_SAVES (1<<3)
24#define EOPT_MMUHACK (1<<4)
25#define EOPT_NO_AUTOSVCFG (1<<5)
26#define EOPT_16BPP (1<<7) // depreceted for .renderer
27#define EOPT_RAM_TIMINGS (1<<8)
28#define EOPT_EN_CD_LEDS (1<<10)
29#define EOPT_A_SN_GAMMA (1<<12)
30#define EOPT_VSYNC (1<<13)
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)
37#define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc)
38
39enum {
40 EOPT_SCALE_NONE = 0,
41 EOPT_SCALE_SW,
42 EOPT_SCALE_HW,
43};
44
45enum {
46 EOPT_CONFIRM_NONE = 0,
47 EOPT_CONFIRM_SAVE = 1,
48 EOPT_CONFIRM_LOAD = 2,
49 EOPT_CONFIRM_BOTH = 3,
50};
51
52typedef struct _currentConfig_t {
53 int EmuOpt;
54 int s_PicoOpt;
55 int s_PsndRate;
56 int s_PicoRegion;
57 int s_PicoAutoRgnOrder;
58 int s_PicoCDBuffers;
59 int Frameskip;
60 int input_dev0;
61 int input_dev1;
62 int confirm_save;
63 int CPUclock;
64 int volume;
65 int gamma;
66 int scaling; // gp2x: EOPT_SCALE_*; psp: bilinear filtering
67 int vscaling;
68 int rotation; // for UIQ
69 float scale; // psp: screen scale
70 float hscale32, hscale40; // psp: horizontal scale
71 int gamma2; // psp: black level
72 int turbo_rate;
73 int renderer;
74 int renderer32x;
75 int filter; // pandora
76 int analog_deadzone;
77 int msh2_khz;
78 int ssh2_khz;
79} currentConfig_t;
80
81extern currentConfig_t currentConfig, defaultConfig;
82extern char *PicoConfigFile;
83extern int state_slot;
84extern int config_slot, config_slot_current;
85extern unsigned char *movie_data;
86extern int reset_timing;
87extern int flip_after_sync;
88
89#define PICO_PEN_ADJUST_X 4
90#define PICO_PEN_ADJUST_Y 2
91extern int pico_pen_x, pico_pen_y;
92extern int pico_inp_mode;
93
94extern const char *rom_fname_reload; // ROM to try loading on next PGS_ReloadRom
95extern char rom_fname_loaded[512]; // currently loaded ROM filename
96
97// engine states
98extern int engineState;
99enum TPicoGameState {
100 PGS_Paused = 1,
101 PGS_Running,
102 PGS_Quit,
103 PGS_KeyConfig,
104 PGS_ReloadRom,
105 PGS_Menu,
106 PGS_TrayMenu,
107 PGS_RestartRun,
108 PGS_Suspending, /* PSP */
109 PGS_SuspendWake, /* PSP */
110};
111
112void emu_init(void);
113void emu_finish(void);
114void emu_loop(void);
115
116int emu_reload_rom(const char *rom_fname_in);
117int emu_swap_cd(const char *fname);
118int emu_save_load_game(int load, int sram);
119void emu_reset_game(void);
120
121void emu_prep_defconfig(void);
122void emu_set_defconfig(void);
123int emu_read_config(const char *rom_fname, int no_defaults);
124int emu_write_config(int game);
125
126char *emu_get_save_fname(int load, int is_sram, int slot);
127int emu_check_save_file(int slot, int *time);
128
129void emu_text_out8 (int x, int y, const char *text);
130void emu_text_out16(int x, int y, const char *text);
131void emu_text_out8_rot (int x, int y, const char *text);
132void emu_text_out16_rot(int x, int y, const char *text);
133
134void emu_make_path(char *buff, const char *end, int size);
135void emu_update_input(void);
136void emu_get_game_name(char *str150);
137void emu_set_fastforward(int set_on);
138void emu_status_msg(const char *format, ...);
139
140/* default sound code */
141void emu_sound_start(void);
142void emu_sound_stop(void);
143void emu_sound_wait(void);
144
145/* used by some (but not all) platforms */
146void emu_cmn_forced_frame(int no_scale, int do_emu);
147
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);
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);
171void plat_video_loop_prepare(void);
172
173void plat_update_volume(int has_changed, int is_up);
174
175#ifdef __cplusplus
176} // extern "C"
177#endif
178