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