refactoring z80 if code for sms preparation
[libpicofe.git] / common / emu.h
CommitLineData
f013066e 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
36f6fd5a 6#include "port_config.h"
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
e31266dd 12extern void *g_screen_ptr;
13
14#if SCREEN_SIZE_FIXED
15#define g_screen_width SCREEN_WIDTH
16#define g_screen_height SCREEN_HEIGHT
17#else
18extern int g_screen_width;
19extern int g_screen_height;
20#endif
21
22
ee0f881e 23#define EOPT_EN_SRAM (1<<0)
36f6fd5a 24#define EOPT_SHOW_FPS (1<<1)
25#define EOPT_EN_SOUND (1<<2)
26#define EOPT_GZIP_SAVES (1<<3)
fa5e045b 27#define EOPT_MMUHACK (1<<4)
7f3b59cf 28#define EOPT_NO_AUTOSVCFG (1<<5)
388947f3 29#define EOPT_16BPP (1<<7)
fa5e045b 30#define EOPT_RAM_TIMINGS (1<<8)
388947f3 31#define EOPT_CONFIRM_SAVE (1<<9)
32#define EOPT_EN_CD_LEDS (1<<10)
33#define EOPT_CONFIRM_LOAD (1<<11)
fa8d1331 34#define EOPT_A_SN_GAMMA (1<<12)
f71361b5 35#define EOPT_VSYNC (1<<13)
b7911801 36#define EOPT_GIZ_SCANLN (1<<14)
37#define EOPT_GIZ_DBLBUF (1<<15)
38#define EOPT_VSYNC_MODE (1<<16)
39#define EOPT_SHOW_RTC (1<<17)
40#define EOPT_NO_FRMLIMIT (1<<18)
41#define EOPT_WIZ_TEAR_FIX (1<<19)
36f6fd5a 42
fa8d1331 43enum {
44 EOPT_SCALE_NONE = 0,
45 EOPT_SCALE_SW_H,
46 EOPT_SCALE_HW_H,
47 EOPT_SCALE_HW_HV,
48};
49
36f6fd5a 50typedef struct _currentConfig_t {
b7911801 51 int EmuOpt;
52 int s_PicoOpt;
0ae25549 53 int s_PsndRate;
54 int s_PicoRegion;
36f6fd5a 55 int s_PicoAutoRgnOrder;
56 int s_PicoCDBuffers;
f013066e 57 int Frameskip;
58 int CPUclock;
f013066e 59 int volume;
60 int gamma;
36f6fd5a 61 int scaling; // gp2x: 0=center, 1=hscale, 2=hvscale, 3=hsoftscale; psp: bilinear filtering
62 int rotation; // for UIQ
6f748c47 63 float scale; // psp: screen scale
64 float hscale32, hscale40; // psp: horizontal scale
960a8e27 65 int gamma2; // psp: black level
6589c840 66 int turbo_rate;
f013066e 67} currentConfig_t;
68
0ae25549 69extern currentConfig_t currentConfig, defaultConfig;
f013066e 70extern char *PicoConfigFile;
144a28a0 71extern int rom_loaded;
f013066e 72extern int state_slot;
73extern int config_slot, config_slot_current;
74extern unsigned char *movie_data;
93c18cb4 75extern int reset_timing;
76
77#define PICO_PEN_ADJUST_X 4
78#define PICO_PEN_ADJUST_Y 2
79extern int pico_pen_x, pico_pen_y;
8a091e48 80extern int pico_inp_mode;
f013066e 81
049a6b3e 82extern char rom_fname_reload[512]; // ROM to try loading on next PGS_ReloadRom
83extern char rom_fname_loaded[512]; // currently loaded ROM filename
84
24b24674 85// engine states
049a6b3e 86extern int engineState;
24b24674 87enum TPicoGameState {
88 PGS_Paused = 1,
89 PGS_Running,
90 PGS_Quit,
91 PGS_KeyConfig,
92 PGS_ReloadRom,
93 PGS_Menu,
0f4090a9 94 PGS_TrayMenu,
24b24674 95 PGS_RestartRun,
96 PGS_Suspending, /* PSP */
97 PGS_SuspendWake, /* PSP */
98};
99
f013066e 100
93c18cb4 101void emu_init(void);
102void emu_finish(void);
b5bfb864 103void emu_loop(void);
93c18cb4 104
ee0f881e 105int emu_reload_rom(char *rom_fname);
6b8796e2 106int emu_swap_cd(const char *fname);
ee0f881e 107int emu_save_load_game(int load, int sram);
93c18cb4 108void emu_reset_game(void);
388947f3 109
9ecdd73a 110void emu_set_defconfig(void);
ee0f881e 111int emu_read_config(int game, int no_defaults);
112int emu_write_config(int game);
388947f3 113
ee0f881e 114char *emu_get_save_fname(int load, int is_sram, int slot);
115int emu_check_save_file(int slot);
388947f3 116
b7911801 117void emu_text_out8 (int x, int y, const char *text);
118void emu_text_out16(int x, int y, const char *text);
119void emu_text_out8_rot (int x, int y, const char *text);
120void emu_text_out16_rot(int x, int y, const char *text);
121
45deb409 122void emu_make_path(char *buff, const char *end, int size);
388947f3 123void emu_update_input(void);
ee0f881e 124void emu_get_game_name(char *str150);
125void emu_set_fastforward(int set_on);
b5bfb864 126void emu_status_msg(const char *format, ...);
f013066e 127
36f6fd5a 128#ifdef __cplusplus
129} // extern "C"
130#endif
131