enable Wall warnings by default
[pcsx_rearmed.git] / libpcsxcore / plugins.h
2 * Copyright (C) 2007 Ryan Schultz, PCSX-df Team, PCSX team *\r
3 * *\r
4 * This program is free software; you can redistribute it and/or modify *\r
5 * it under the terms of the GNU General Public License as published by *\r
6 * the Free Software Foundation; either version 2 of the License, or *\r
7 * (at your option) any later version. *\r
8 * *\r
9 * This program is distributed in the hope that it will be useful, *\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
12 * GNU General Public License for more details. *\r
13 * *\r
14 * You should have received a copy of the GNU General Public License *\r
15 * along with this program; if not, write to the *\r
16 * Free Software Foundation, Inc., *\r
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *\r
18 ***************************************************************************/\r
20#ifndef __PLUGINS_H__\r
21#define __PLUGINS_H__\r
23#ifdef __cplusplus\r
24extern "C" {\r
27#include "psxcommon.h"\r
29//#define ENABLE_SIO1API 1\r
31#ifndef _WIN32\r
33typedef void* HWND;\r
34#define CALLBACK\r
36typedef long (*GPUopen)(unsigned long *, char *, char *);\r
37typedef long (*SPUopen)(void);\r
38typedef long (*PADopen)(unsigned long *);\r
39typedef long (*NETopen)(unsigned long *);\r
40typedef long (*SIO1open)(unsigned long *);\r
44#include <windows.h>\r
46typedef long (CALLBACK* GPUopen)(HWND);\r
47typedef long (CALLBACK* SPUopen)(HWND);\r
48typedef long (CALLBACK* PADopen)(HWND);\r
49typedef long (CALLBACK* NETopen)(HWND);\r
50typedef long (CALLBACK* SIO1open)(HWND);\r
54#include "spu.h"\r
56#include "psemu_plugin_defs.h"\r
57#include "decode_xa.h"\r
59int LoadPlugins();\r
60void ReleasePlugins();\r
61int OpenPlugins();\r
62void ClosePlugins();\r
1df403c5 63int ReloadCdromPlugin();\r
65typedef unsigned long (CALLBACK* PSEgetLibType)(void);\r
66typedef unsigned long (CALLBACK* PSEgetLibVersion)(void);\r
67typedef char *(CALLBACK* PSEgetLibName)(void);\r
69// GPU Functions\r
70typedef long (CALLBACK* GPUinit)(void);\r
71typedef long (CALLBACK* GPUshutdown)(void);\r
72typedef long (CALLBACK* GPUclose)(void);\r
73typedef void (CALLBACK* GPUwriteStatus)(uint32_t);\r
74typedef void (CALLBACK* GPUwriteData)(uint32_t);\r
75typedef void (CALLBACK* GPUwriteDataMem)(uint32_t *, int);\r
76typedef uint32_t (CALLBACK* GPUreadStatus)(void);\r
77typedef uint32_t (CALLBACK* GPUreadData)(void);\r
78typedef void (CALLBACK* GPUreadDataMem)(uint32_t *, int);\r
79typedef long (CALLBACK* GPUdmaChain)(uint32_t *,uint32_t);\r
80typedef void (CALLBACK* GPUupdateLace)(void);\r
81typedef long (CALLBACK* GPUconfigure)(void);\r
82typedef long (CALLBACK* GPUtest)(void);\r
83typedef void (CALLBACK* GPUabout)(void);\r
84typedef void (CALLBACK* GPUmakeSnapshot)(void);\r
85typedef void (CALLBACK* GPUkeypressed)(int);\r
86typedef void (CALLBACK* GPUdisplayText)(char *);\r
87typedef struct {\r
88 uint32_t ulFreezeVersion;\r
89 uint32_t ulStatus;\r
90 uint32_t ulControl[256];\r
91 unsigned char psxVRam[1024*512*2];\r
92} GPUFreeze_t;\r
93typedef long (CALLBACK* GPUfreeze)(uint32_t, GPUFreeze_t *);\r
94typedef long (CALLBACK* GPUgetScreenPic)(unsigned char *);\r
95typedef long (CALLBACK* GPUshowScreenPic)(unsigned char *);\r
96typedef void (CALLBACK* GPUclearDynarec)(void (CALLBACK *callback)(void));\r
6c9a982a 97typedef void (CALLBACK* GPUvBlank)(int, uint32_t *);\r
99// GPU function pointers\r
100extern GPUupdateLace GPU_updateLace;\r
101extern GPUinit GPU_init;\r
102extern GPUshutdown GPU_shutdown; \r
103extern GPUconfigure GPU_configure;\r
104extern GPUtest GPU_test;\r
105extern GPUabout GPU_about;\r
106extern GPUopen GPU_open;\r
107extern GPUclose GPU_close;\r
108extern GPUreadStatus GPU_readStatus;\r
109extern GPUreadData GPU_readData;\r
110extern GPUreadDataMem GPU_readDataMem;\r
111extern GPUwriteStatus GPU_writeStatus; \r
112extern GPUwriteData GPU_writeData;\r
113extern GPUwriteDataMem GPU_writeDataMem;\r
114extern GPUdmaChain GPU_dmaChain;\r
115extern GPUkeypressed GPU_keypressed;\r
116extern GPUdisplayText GPU_displayText;\r
117extern GPUmakeSnapshot GPU_makeSnapshot;\r
118extern GPUfreeze GPU_freeze;\r
119extern GPUgetScreenPic GPU_getScreenPic;\r
120extern GPUshowScreenPic GPU_showScreenPic;\r
121extern GPUclearDynarec GPU_clearDynarec;\r
122extern GPUvBlank GPU_vBlank;\r
124// CD-ROM Functions\r
125typedef long (CALLBACK* CDRinit)(void);\r
126typedef long (CALLBACK* CDRshutdown)(void);\r
127typedef long (CALLBACK* CDRopen)(void);\r
128typedef long (CALLBACK* CDRclose)(void);\r
129typedef long (CALLBACK* CDRgetTN)(unsigned char *);\r
130typedef long (CALLBACK* CDRgetTD)(unsigned char, unsigned char *);\r
131typedef long (CALLBACK* CDRreadTrack)(unsigned char *);\r
132typedef unsigned char* (CALLBACK* CDRgetBuffer)(void);\r
133typedef unsigned char* (CALLBACK* CDRgetBufferSub)(void);\r
134typedef long (CALLBACK* CDRconfigure)(void);\r
135typedef long (CALLBACK* CDRtest)(void);\r
136typedef void (CALLBACK* CDRabout)(void);\r
137typedef long (CALLBACK* CDRplay)(unsigned char *);\r
138typedef long (CALLBACK* CDRstop)(void);\r
139typedef long (CALLBACK* CDRsetfilename)(char *);\r
140struct CdrStat {\r
141 uint32_t Type;\r
142 uint32_t Status;\r
143 unsigned char Time[3];\r
145typedef long (CALLBACK* CDRgetStatus)(struct CdrStat *);\r
146typedef char* (CALLBACK* CDRgetDriveLetter)(void);\r
147struct SubQ {\r
148 char res0[12];\r
149 unsigned char ControlAndADR;\r
150 unsigned char TrackNumber;\r
151 unsigned char IndexNumber;\r
152 unsigned char TrackRelativeAddress[3];\r
153 unsigned char Filler;\r
1df403c5 154 unsigned char AbsoluteAddress[3];\r
155 unsigned char CRC[2];\r
156 char res1[72];\r
158typedef long (CALLBACK* CDRreadCDDA)(unsigned char, unsigned char, unsigned char, unsigned char *);\r
159typedef long (CALLBACK* CDRgetTE)(unsigned char, unsigned char *, unsigned char *, unsigned char *);\r
161// CD-ROM function pointers\r
162extern CDRinit CDR_init;\r
163extern CDRshutdown CDR_shutdown;\r
164extern CDRopen CDR_open;\r
165extern CDRclose CDR_close; \r
166extern CDRtest CDR_test;\r
167extern CDRgetTN CDR_getTN;\r
168extern CDRgetTD CDR_getTD;\r
169extern CDRreadTrack CDR_readTrack;\r
170extern CDRgetBuffer CDR_getBuffer;\r
171extern CDRgetBufferSub CDR_getBufferSub;\r
172extern CDRplay CDR_play;\r
173extern CDRstop CDR_stop;\r
174extern CDRgetStatus CDR_getStatus;\r
175extern CDRgetDriveLetter CDR_getDriveLetter;\r
176extern CDRconfigure CDR_configure;\r
177extern CDRabout CDR_about;\r
178extern CDRsetfilename CDR_setfilename;\r
179extern CDRreadCDDA CDR_readCDDA;\r
180extern CDRgetTE CDR_getTE;\r
182// SPU Functions\r
183typedef long (CALLBACK* SPUinit)(void); \r
184typedef long (CALLBACK* SPUshutdown)(void); \r
185typedef long (CALLBACK* SPUclose)(void); \r
186typedef void (CALLBACK* SPUplaySample)(unsigned char); \r
187typedef void (CALLBACK* SPUwriteRegister)(unsigned long, unsigned short);\r
188typedef unsigned short (CALLBACK* SPUreadRegister)(unsigned long);\r
189typedef void (CALLBACK* SPUwriteDMA)(unsigned short);\r
190typedef unsigned short (CALLBACK* SPUreadDMA)(void);\r
191typedef void (CALLBACK* SPUwriteDMAMem)(unsigned short *, int);\r
192typedef void (CALLBACK* SPUreadDMAMem)(unsigned short *, int);\r
193typedef void (CALLBACK* SPUplayADPCMchannel)(xa_decode_t *);\r
194typedef void (CALLBACK* SPUregisterCallback)(void (CALLBACK *callback)(void));\r
195typedef long (CALLBACK* SPUconfigure)(void);\r
196typedef long (CALLBACK* SPUtest)(void);\r
197typedef void (CALLBACK* SPUabout)(void);\r
198typedef struct {\r
199 unsigned char PluginName[8];\r
200 uint32_t PluginVersion;\r
201 uint32_t Size;\r
202 unsigned char SPUPorts[0x200];\r
203 unsigned char SPURam[0x80000];\r
204 xa_decode_t xa;\r
205 unsigned char *SPUInfo;\r
206} SPUFreeze_t;\r
207typedef long (CALLBACK* SPUfreeze)(uint32_t, SPUFreeze_t *);\r
208typedef void (CALLBACK* SPUasync)(uint32_t);\r
209typedef void (CALLBACK* SPUplayCDDAchannel)(short *, int);\r
211// SPU function pointers\r
212extern SPUconfigure SPU_configure;\r
213extern SPUabout SPU_about;\r
214extern SPUinit SPU_init;\r
215extern SPUshutdown SPU_shutdown;\r
216extern SPUtest SPU_test;\r
217extern SPUopen SPU_open;\r
218extern SPUclose SPU_close;\r
219extern SPUplaySample SPU_playSample;\r
220extern SPUwriteRegister SPU_writeRegister;\r
221extern SPUreadRegister SPU_readRegister;\r
222extern SPUwriteDMA SPU_writeDMA;\r
223extern SPUreadDMA SPU_readDMA;\r
224extern SPUwriteDMAMem SPU_writeDMAMem;\r
225extern SPUreadDMAMem SPU_readDMAMem;\r
226extern SPUplayADPCMchannel SPU_playADPCMchannel;\r
227extern SPUfreeze SPU_freeze;\r
228extern SPUregisterCallback SPU_registerCallback;\r
229extern SPUasync SPU_async;\r
230extern SPUplayCDDAchannel SPU_playCDDAchannel;\r
232// PAD Functions\r
233typedef long (CALLBACK* PADconfigure)(void);\r
234typedef void (CALLBACK* PADabout)(void);\r
235typedef long (CALLBACK* PADinit)(long);\r
236typedef long (CALLBACK* PADshutdown)(void); \r
237typedef long (CALLBACK* PADtest)(void); \r
238typedef long (CALLBACK* PADclose)(void);\r
239typedef long (CALLBACK* PADquery)(void);\r
240typedef long (CALLBACK* PADreadPort1)(PadDataS*);\r
241typedef long (CALLBACK* PADreadPort2)(PadDataS*);\r
242typedef long (CALLBACK* PADkeypressed)(void);\r
243typedef unsigned char (CALLBACK* PADstartPoll)(int);\r
244typedef unsigned char (CALLBACK* PADpoll)(unsigned char);\r
245typedef void (CALLBACK* PADsetSensitive)(int);\r
247// PAD function pointers\r
248extern PADconfigure PAD1_configure;\r
249extern PADabout PAD1_about;\r
250extern PADinit PAD1_init;\r
251extern PADshutdown PAD1_shutdown;\r
252extern PADtest PAD1_test;\r
253extern PADopen PAD1_open;\r
254extern PADclose PAD1_close;\r
255extern PADquery PAD1_query;\r
256extern PADreadPort1 PAD1_readPort1;\r
257extern PADkeypressed PAD1_keypressed;\r
258extern PADstartPoll PAD1_startPoll;\r
259extern PADpoll PAD1_poll;\r
260extern PADsetSensitive PAD1_setSensitive;\r
262extern PADconfigure PAD2_configure;\r
263extern PADabout PAD2_about;\r
264extern PADinit PAD2_init;\r
265extern PADshutdown PAD2_shutdown;\r
266extern PADtest PAD2_test;\r
267extern PADopen PAD2_open;\r
268extern PADclose PAD2_close;\r
269extern PADquery PAD2_query;\r
270extern PADreadPort2 PAD2_readPort2;\r
271extern PADkeypressed PAD2_keypressed;\r
272extern PADstartPoll PAD2_startPoll;\r
273extern PADpoll PAD2_poll;\r
274extern PADsetSensitive PAD2_setSensitive;\r
276// NET Functions\r
277typedef long (CALLBACK* NETinit)(void);\r
278typedef long (CALLBACK* NETshutdown)(void);\r
279typedef long (CALLBACK* NETclose)(void);\r
280typedef long (CALLBACK* NETconfigure)(void);\r
281typedef long (CALLBACK* NETtest)(void);\r
282typedef void (CALLBACK* NETabout)(void);\r
283typedef void (CALLBACK* NETpause)(void);\r
284typedef void (CALLBACK* NETresume)(void);\r
285typedef long (CALLBACK* NETqueryPlayer)(void);\r
286typedef long (CALLBACK* NETsendData)(void *, int, int);\r
287typedef long (CALLBACK* NETrecvData)(void *, int, int);\r
288typedef long (CALLBACK* NETsendPadData)(void *, int);\r
289typedef long (CALLBACK* NETrecvPadData)(void *, int);\r
291typedef struct {\r
292 char EmuName[32];\r
293 char CdromID[9]; // ie. 'SCPH12345', no \0 trailing character\r
294 char CdromLabel[11];\r
295 void *psxMem;\r
296 GPUshowScreenPic GPU_showScreenPic;\r
297 GPUdisplayText GPU_displayText;\r
298 PADsetSensitive PAD_setSensitive;\r
299 char GPUpath[256]; // paths must be absolute\r
300 char SPUpath[256];\r
301 char CDRpath[256];\r
302 char MCD1path[256];\r
303 char MCD2path[256];\r
304 char BIOSpath[256]; // 'HLE' for internal bios\r
305 char Unused[1024];\r
306} netInfo;\r
308typedef long (CALLBACK* NETsetInfo)(netInfo *);\r
309typedef long (CALLBACK* NETkeypressed)(int);\r
311// NET function pointers \r
312extern NETinit NET_init;\r
313extern NETshutdown NET_shutdown;\r
314extern NETopen NET_open;\r
315extern NETclose NET_close; \r
316extern NETtest NET_test;\r
317extern NETconfigure NET_configure;\r
318extern NETabout NET_about;\r
319extern NETpause NET_pause;\r
320extern NETresume NET_resume;\r
321extern NETqueryPlayer NET_queryPlayer;\r
322extern NETsendData NET_sendData;\r
323extern NETrecvData NET_recvData;\r
324extern NETsendPadData NET_sendPadData;\r
325extern NETrecvPadData NET_recvPadData;\r
326extern NETsetInfo NET_setInfo;\r
327extern NETkeypressed NET_keypressed;\r
329#ifdef ENABLE_SIO1API\r
331// SIO1 Functions (link cable)\r
332typedef long (CALLBACK* SIO1init)(void);\r
333typedef long (CALLBACK* SIO1shutdown)(void);\r
334typedef long (CALLBACK* SIO1close)(void);\r
335typedef long (CALLBACK* SIO1configure)(void);\r
336typedef long (CALLBACK* SIO1test)(void);\r
337typedef void (CALLBACK* SIO1about)(void);\r
338typedef void (CALLBACK* SIO1pause)(void);\r
339typedef void (CALLBACK* SIO1resume)(void);\r
340typedef long (CALLBACK* SIO1keypressed)(int);\r
341typedef void (CALLBACK* SIO1writeData8)(unsigned char);\r
342typedef void (CALLBACK* SIO1writeData16)(unsigned short);\r
343typedef void (CALLBACK* SIO1writeData32)(unsigned long);\r
344typedef void (CALLBACK* SIO1writeStat16)(unsigned short);\r
345typedef void (CALLBACK* SIO1writeStat32)(unsigned long);\r
346typedef void (CALLBACK* SIO1writeMode16)(unsigned short);\r
347typedef void (CALLBACK* SIO1writeMode32)(unsigned long);\r
348typedef void (CALLBACK* SIO1writeCtrl16)(unsigned short);\r
349typedef void (CALLBACK* SIO1writeCtrl32)(unsigned long);\r
350typedef void (CALLBACK* SIO1writeBaud16)(unsigned short);\r
351typedef void (CALLBACK* SIO1writeBaud32)(unsigned long);\r
352typedef unsigned char (CALLBACK* SIO1readData8)(void);\r
353typedef unsigned short (CALLBACK* SIO1readData16)(void);\r
354typedef unsigned long (CALLBACK* SIO1readData32)(void);\r
355typedef unsigned short (CALLBACK* SIO1readStat16)(void);\r
356typedef unsigned long (CALLBACK* SIO1readStat32)(void);\r
357typedef unsigned short (CALLBACK* SIO1readMode16)(void);\r
358typedef unsigned long (CALLBACK* SIO1readMode32)(void);\r
359typedef unsigned short (CALLBACK* SIO1readCtrl16)(void);\r
360typedef unsigned long (CALLBACK* SIO1readCtrl32)(void);\r
361typedef unsigned short (CALLBACK* SIO1readBaud16)(void);\r
362typedef unsigned long (CALLBACK* SIO1readBaud32)(void);\r
363typedef void (CALLBACK* SIO1registerCallback)(void (CALLBACK *callback)(void));\r
365// SIO1 function pointers \r
366extern SIO1init SIO1_init;\r
367extern SIO1shutdown SIO1_shutdown;\r
368extern SIO1open SIO1_open;\r
369extern SIO1close SIO1_close; \r
370extern SIO1test SIO1_test;\r
371extern SIO1configure SIO1_configure;\r
372extern SIO1about SIO1_about;\r
373extern SIO1pause SIO1_pause;\r
374extern SIO1resume SIO1_resume;\r
375extern SIO1keypressed SIO1_keypressed;\r
376extern SIO1writeData8 SIO1_writeData8;\r
377extern SIO1writeData16 SIO1_writeData16;\r
378extern SIO1writeData32 SIO1_writeData32;\r
379extern SIO1writeStat16 SIO1_writeStat16;\r
380extern SIO1writeStat32 SIO1_writeStat32;\r
381extern SIO1writeMode16 SIO1_writeMode16;\r
382extern SIO1writeMode32 SIO1_writeMode32;\r
383extern SIO1writeCtrl16 SIO1_writeCtrl16;\r
384extern SIO1writeCtrl32 SIO1_writeCtrl32;\r
385extern SIO1writeBaud16 SIO1_writeBaud16;\r
386extern SIO1writeBaud32 SIO1_writeBaud32;\r
387extern SIO1readData8 SIO1_readData8;\r
388extern SIO1readData16 SIO1_readData16;\r
389extern SIO1readData32 SIO1_readData32;\r
390extern SIO1readStat16 SIO1_readStat16;\r
391extern SIO1readStat32 SIO1_readStat32;\r
392extern SIO1readMode16 SIO1_readMode16;\r
393extern SIO1readMode32 SIO1_readMode32;\r
394extern SIO1readCtrl16 SIO1_readCtrl16;\r
395extern SIO1readCtrl32 SIO1_readCtrl32;\r
396extern SIO1readBaud16 SIO1_readBaud16;\r
397extern SIO1readBaud32 SIO1_readBaud32;\r
398extern SIO1registerCallback SIO1_registerCallback;\r
402void CALLBACK clearDynarec(void);\r
404void SetIsoFile(const char *filename);\r
405const char *GetIsoFile(void);\r
406boolean UsingIso(void);\r
407void SetCdOpenCaseTime(s64 time);\r
409#ifdef __cplusplus\r