release r2, update credits
[fceu.git] / driver.h
CommitLineData
c62d2810 1#include "types.h"
2#include "git.h"
3
4/* Prototypes for platform interface functions follow: */
5
937bf65b 6void FCEUD_Update(uint8 *buf, int16 *Buffer, int Count);
c62d2810 7
8/* Video interface */
9void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b);
10void FCEUD_GetPalette(uint8 i,uint8 *r, unsigned char *g, unsigned char *b);
11
12/* Sound interface */
13void FCEUD_WriteSoundData(int32 *Buffer, int Count);
14
15/* Displays an error. Can block or not. */
16void FCEUD_PrintError(char *s);
17
18#ifdef NETWORK
19/* Network interface */
20
21int FCEUD_NetworkConnect(void);
22int FCEUD_NetworkRecvData(uint8 *data, uint32 len, int block);
23int FCEUD_NetworkSendData(uint8 *data, uint32 len);
24void FCEUD_NetworkClose(void);
25
26#endif
27
28#define DES_NTSCCOL 2
29
30#define DES_RESET 0x10
31#define DES_POWER 0x11
32
33#define DES_GETNTSCHUE 0x20
34#define DES_GETNTSCTINT 0x21
35#define DES_SETNTSCHUE 0x22
36#define DES_SETNTSCTINT 0x23
37
38#define DES_NSFINC 0x50
39#define DES_NSFDEC 0x51
40#define DES_NSFRES 0x52
41
42#define DES_VSUNIDIPSET 0x70
43#define DES_VSUNITOGGLEDIPVIEW 0x71
44#define DES_VSUNICOIN 0x72
45#define DES_FDSINSERT 0x80
46#define DES_FDSEJECT 0x81
47#define DES_FDSSELECT 0x82
48
49#define DES_NTSCSELHUE 0x90
50#define DES_NTSCSELTINT 0x91
51#define DES_NTSCDEC 0x92
52#define DES_NTSCINC 0x93
53
54void DriverInterface(int w, void *d);
55
56void FCEUI_SetInput(int port, int type, void *ptr, int attrib);
57void FCEUI_SetInputFC(int type, void *ptr, int attrib);
58void FCEUI_DisableFourScore(int s);
59
92764e62 60void FCEUI_GetNTSCTH(int *tint, int *hue);
61void FCEUI_SetNTSCTH(int n, int tint, int hue);
62
c62d2810 63#include "version.h"
64
386f5371 65#define SI_UNSET -1
d97315ac 66#define SI_NONE 0
67#define SI_GAMEPAD 1
68#define SI_ZAPPER 2
69#define SI_POWERPADA 3
70#define SI_POWERPADB 4
71#define SI_ARKANOID 5
386f5371 72#define SI_MOUSE 6
d97315ac 73
386f5371 74#define SIFC_UNSET -1
d97315ac 75#define SIFC_NONE 0
76#define SIFC_ARKANOID 1
77#define SIFC_SHADOW 2
c62d2810 78#define SIFC_4PLAYER 3
d97315ac 79#define SIFC_FKB 4
80#define SIFC_SUBORKB 5
81#define SIFC_HYPERSHOT 6
82#define SIFC_MAHJONG 7
83#define SIFC_QUIZKING 8
84#define SIFC_FTRAINERA 9
85#define SIFC_FTRAINERB 10
86#define SIFC_OEKAKIDS 11
87#define SIFC_BWORLD 12
88#define SIFC_TOPRIDER 13
89
90#define SIS_NONE 0
91#define SIS_DATACH 1
92#define SIS_NWC 2
93#define SIS_VSUNISYSTEM 3
94#define SIS_NSF 4
95
c62d2810 96
97/* New interface functions */
98
99/* 0 to order screen snapshots numerically(0.png), 1 to order them file base-numerically(smb3-0.png). */
100void FCEUI_SetSnapName(int a);
101
102/* 0 to keep 8-sprites limitation, 1 to remove it */
103void FCEUI_DisableSpriteLimitation(int a);
104
105/* 0 to save extra game data(*.sav) in same dir as game, 1 to save under base dir */
106void FCEUI_SaveExtraDataUnderBase(int a);
107
108/* name=path and file to load. returns 0 on failure, 1 on success */
109FCEUGI *FCEUI_LoadGame(char *name);
989672f4 110extern int LoadGameLastError;
c62d2810 111
112/* allocates memory. 0 on failure, 1 on success. */
113int FCEUI_Initialize(void);
114
6244011f 115void FCEUI_Kill(void);
116void FCEUI_SetEmuMode(int is_new);
117
c62d2810 118/* begins emulation. Returns after FCEUI_CloseGame() is called */
6244011f 119extern void (*FCEUI_Emulate)(void);
c62d2810 120
121/* Closes currently loaded game, causes FCEUI_Emulate to return */
122void FCEUI_CloseGame(void);
123
124/* Enable/Disable game genie. a=0 disable, a=1 enable */
125void FCEUI_SetGameGenie(int a);
126
127/* Set video system a=0 NTSC, a=1 PAL */
128void FCEUI_SetVidSystem(int a);
129
130/* Convenience function; returns currently emulated video system(0=NTSC, 1=PAL). */
131int FCEUI_GetCurrentVidSystem(int *slstart, int *slend);
132
133#ifdef FRAMESKIP
134/* Should be called from FCEUD_BlitScreen(). Specifies how many frames
135 to skip until FCEUD_BlitScreen() is called. FCEUD_BlitScreenDummy()
136 will be called instead of FCEUD_BlitScreen() when when a frame is skipped.
137*/
138void FCEUI_FrameSkip(int x);
139#endif
140
141/* First and last scanlines to render, for ntsc and pal emulation. */
142void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall);
143
144/* Sets the base directory(save states, snapshots, etc. are saved in directories
145 below this directory. */
146void FCEUI_SetBaseDirectory(char *dir);
147
148/* Tells FCE Ultra to copy the palette data pointed to by pal and use it.
149 Data pointed to by pal needs to be 64*3 bytes in length.
150*/
151void FCEUI_SetPaletteArray(uint8 *pal);
152
153/* Sets up sound code to render sound at the specified rate, in samples
154 per second. The sample rate should be as close to 44100 hz as possible.
155 Sample rates from 8192 through 65535 are ok, though if the sample rate
156 is too low, some sound channels(noise) won't sound right.
157 If "Rate" equals 0, sound is disabled.
158*/
159void FCEUI_Sound(int Rate);
160void FCEUI_SetSoundVolume(uint32 volume);
161
162#ifdef NETWORK
163/* Set network play stuff. type=1 for server, type=2 for client.
164 skip is only used for server */
165void FCEUI_SetNetworkPlay(int type);
166#endif
167
168void FCEUI_SelectState(int w);
169void FCEUI_SaveState(void);
170void FCEUI_LoadState(void);
171int32 FCEUI_GetDesiredFPS(void);
172void FCEUI_SaveSnapshot(void);
173void FCEU_DispMessage(char *format, ...);
0bb3fe12 174void FCEU_CancelDispMessage(void);
c62d2810 175#define FCEUI_DispMessage FCEU_DispMessage
176
92764e62 177int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int type);
c62d2810 178int FCEUI_DelCheat(uint32 which);
179
180int32 FCEUI_CheatSearchGetCount(void);
181void FCEUI_CheatSearchGetRange(uint32 first, uint32 last, int (*callb)(uint32 a, uint8 last, uint8 current));
92764e62 182void FCEUI_CheatSearchGet(int (*callb)(uint32 a, uint8 last, uint8 current, void *data),void *data);
c62d2810 183void FCEUI_CheatSearchBegin(void);
184void FCEUI_CheatSearchEnd(int type, uint8 v1, uint8 v2);
92764e62 185void FCEUI_ListCheats(int (*callb)(char *name, uint32 a, uint8 v, int compare, int s, int type, void *data), void *data);
c62d2810 186
92764e62 187int FCEUI_GetCheat(uint32 which, char **name, uint32 *a, uint8 *v, int *compare, int *s, int *type);
188int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare,int s, int type);
c62d2810 189void FCEUI_CheatSearchShowExcluded(void);
190void FCEUI_CheatSearchSetCurrentAsOriginal(void);
191
92764e62 192int FCEUI_DecodePAR(const char *code, uint16 *a, uint8 *v, int *c, int *type);
193int FCEUI_DecodeGG(const char *str, uint16 *a, uint8 *v, int *c);
194int FCEUI_ToggleCheat(uint32 which);
195
c62d2810 196#define FCEUIOD_STATE 0
197#define FCEUIOD_SNAPS 1
198#define FCEUIOD_NV 2
199#define FCEUIOD_CHEATS 3
200#define FCEUIOD_MISC 4
201
202#define FCEUIOD__COUNT 5
203
204void FCEUI_SetDirOverride(int which, char *n);
205