32x: drc: enable and fix static reg alloc, carry flag tweaks
[picodrive.git] / platform / common / emu.h
... / ...
CommitLineData
1// (c) Copyright 2006-2007 notaz, All rights reserved.
2// Free for non-commercial use.
3
4// For commercial use, separate licencing terms must be obtained.
5
6#include "port_config.h"
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define array_size(x) (sizeof(x) / sizeof(x[0]))
13
14extern void *g_screen_ptr;
15
16#if SCREEN_SIZE_FIXED
17#define g_screen_width SCREEN_WIDTH
18#define g_screen_height SCREEN_HEIGHT
19#else
20extern int g_screen_width;
21extern int g_screen_height;
22#endif
23
24
25#define EOPT_EN_SRAM (1<<0)
26#define EOPT_SHOW_FPS (1<<1)
27#define EOPT_EN_SOUND (1<<2)
28#define EOPT_GZIP_SAVES (1<<3)
29#define EOPT_MMUHACK (1<<4)
30#define EOPT_NO_AUTOSVCFG (1<<5)
31#define EOPT_16BPP (1<<7)
32#define EOPT_RAM_TIMINGS (1<<8)
33#define EOPT_CONFIRM_SAVE (1<<9)
34#define EOPT_EN_CD_LEDS (1<<10)
35#define EOPT_CONFIRM_LOAD (1<<11)
36#define EOPT_A_SN_GAMMA (1<<12)
37#define EOPT_VSYNC (1<<13)
38#define EOPT_GIZ_SCANLN (1<<14)
39#define EOPT_GIZ_DBLBUF (1<<15)
40#define EOPT_VSYNC_MODE (1<<16)
41#define EOPT_SHOW_RTC (1<<17)
42#define EOPT_NO_FRMLIMIT (1<<18)
43#define EOPT_WIZ_TEAR_FIX (1<<19)
44#define EOPT_EXT_FRMLIMIT (1<<20) // no internal frame limiter (limited by snd, etc)
45
46enum {
47 EOPT_SCALE_NONE = 0,
48 EOPT_SCALE_SW_H,
49 EOPT_SCALE_HW_H,
50 EOPT_SCALE_HW_HV,
51};
52
53typedef struct _currentConfig_t {
54 int EmuOpt;
55 int s_PicoOpt;
56 int s_PsndRate;
57 int s_PicoRegion;
58 int s_PicoAutoRgnOrder;
59 int s_PicoCDBuffers;
60 int Frameskip;
61 int CPUclock;
62 int volume;
63 int gamma;
64 int scaling; // gp2x: 0=center, 1=hscale, 2=hvscale, 3=hsoftscale; psp: bilinear filtering
65 int rotation; // for UIQ
66 float scale; // psp: screen scale
67 float hscale32, hscale40; // psp: horizontal scale
68 int gamma2; // psp: black level
69 int turbo_rate;
70} currentConfig_t;
71
72extern currentConfig_t currentConfig, defaultConfig;
73extern char *PicoConfigFile;
74extern int rom_loaded;
75extern int state_slot;
76extern int config_slot, config_slot_current;
77extern unsigned char *movie_data;
78extern int reset_timing;
79
80#define PICO_PEN_ADJUST_X 4
81#define PICO_PEN_ADJUST_Y 2
82extern int pico_pen_x, pico_pen_y;
83extern int pico_inp_mode;
84
85extern char rom_fname_reload[512]; // ROM to try loading on next PGS_ReloadRom
86extern char rom_fname_loaded[512]; // currently loaded ROM filename
87
88// engine states
89extern int engineState;
90enum TPicoGameState {
91 PGS_Paused = 1,
92 PGS_Running,
93 PGS_Quit,
94 PGS_KeyConfig,
95 PGS_ReloadRom,
96 PGS_Menu,
97 PGS_TrayMenu,
98 PGS_RestartRun,
99 PGS_Suspending, /* PSP */
100 PGS_SuspendWake, /* PSP */
101};
102
103// media types
104enum {
105 PM_BAD = 0,
106 PM_MD_CART, /* also 32x */
107 PM_MARK3,
108 PM_CD,
109};
110
111void emu_init(void);
112void emu_finish(void);
113void emu_loop(void);
114
115int emu_reload_rom(char *rom_fname);
116int emu_swap_cd(const char *fname);
117int emu_save_load_game(int load, int sram);
118void emu_reset_game(void);
119
120void emu_set_defconfig(void);
121int emu_read_config(int game, int no_defaults);
122int emu_write_config(int game);
123
124char *emu_get_save_fname(int load, int is_sram, int slot);
125int emu_check_save_file(int slot);
126
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
132void emu_make_path(char *buff, const char *end, int size);
133void emu_update_input(void);
134void emu_get_game_name(char *str150);
135void emu_set_fastforward(int set_on);
136void emu_status_msg(const char *format, ...);
137
138#ifdef __cplusplus
139} // extern "C"
140#endif
141