[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
64typedef unsigned long (CALLBACK* PSEgetLibType)(void);\r
65typedef unsigned long (CALLBACK* PSEgetLibVersion)(void);\r
66typedef char *(CALLBACK* PSEgetLibName)(void);\r
68// GPU Functions\r
69typedef long (CALLBACK* GPUinit)(void);\r
70typedef long (CALLBACK* GPUshutdown)(void);\r
71typedef long (CALLBACK* GPUclose)(void);\r
72typedef void (CALLBACK* GPUwriteStatus)(uint32_t);\r
73typedef void (CALLBACK* GPUwriteData)(uint32_t);\r
74typedef void (CALLBACK* GPUwriteDataMem)(uint32_t *, int);\r
75typedef uint32_t (CALLBACK* GPUreadStatus)(void);\r
76typedef uint32_t (CALLBACK* GPUreadData)(void);\r
77typedef void (CALLBACK* GPUreadDataMem)(uint32_t *, int);\r
78typedef long (CALLBACK* GPUdmaChain)(uint32_t *,uint32_t);\r
79typedef void (CALLBACK* GPUupdateLace)(void);\r
80typedef long (CALLBACK* GPUconfigure)(void);\r
81typedef long (CALLBACK* GPUtest)(void);\r
82typedef void (CALLBACK* GPUabout)(void);\r
83typedef void (CALLBACK* GPUmakeSnapshot)(void);\r
84typedef void (CALLBACK* GPUkeypressed)(int);\r
85typedef void (CALLBACK* GPUdisplayText)(char *);\r
86typedef struct {\r
87 uint32_t ulFreezeVersion;\r
88 uint32_t ulStatus;\r
89 uint32_t ulControl[256];\r
90 unsigned char psxVRam[1024*512*2];\r
91} GPUFreeze_t;\r
92typedef long (CALLBACK* GPUfreeze)(uint32_t, GPUFreeze_t *);\r
93typedef long (CALLBACK* GPUgetScreenPic)(unsigned char *);\r
94typedef long (CALLBACK* GPUshowScreenPic)(unsigned char *);\r
95typedef void (CALLBACK* GPUclearDynarec)(void (CALLBACK *callback)(void));\r
96typedef void (CALLBACK* GPUvBlank)(int);\r
98// GPU function pointers\r
99extern GPUupdateLace GPU_updateLace;\r
100extern GPUinit GPU_init;\r
101extern GPUshutdown GPU_shutdown; \r
102extern GPUconfigure GPU_configure;\r
103extern GPUtest GPU_test;\r
104extern GPUabout GPU_about;\r
105extern GPUopen GPU_open;\r
106extern GPUclose GPU_close;\r
107extern GPUreadStatus GPU_readStatus;\r
108extern GPUreadData GPU_readData;\r
109extern GPUreadDataMem GPU_readDataMem;\r
110extern GPUwriteStatus GPU_writeStatus; \r
111extern GPUwriteData GPU_writeData;\r
112extern GPUwriteDataMem GPU_writeDataMem;\r
113extern GPUdmaChain GPU_dmaChain;\r
114extern GPUkeypressed GPU_keypressed;\r
115extern GPUdisplayText GPU_displayText;\r
116extern GPUmakeSnapshot GPU_makeSnapshot;\r
117extern GPUfreeze GPU_freeze;\r
118extern GPUgetScreenPic GPU_getScreenPic;\r
119extern GPUshowScreenPic GPU_showScreenPic;\r
120extern GPUclearDynarec GPU_clearDynarec;\r
121extern GPUvBlank GPU_vBlank;\r
123// CD-ROM Functions\r
124typedef long (CALLBACK* CDRinit)(void);\r
125typedef long (CALLBACK* CDRshutdown)(void);\r
126typedef long (CALLBACK* CDRopen)(void);\r
127typedef long (CALLBACK* CDRclose)(void);\r
128typedef long (CALLBACK* CDRgetTN)(unsigned char *);\r
129typedef long (CALLBACK* CDRgetTD)(unsigned char, unsigned char *);\r
130typedef long (CALLBACK* CDRreadTrack)(unsigned char *);\r
131typedef unsigned char* (CALLBACK* CDRgetBuffer)(void);\r
132typedef unsigned char* (CALLBACK* CDRgetBufferSub)(void);\r
133typedef long (CALLBACK* CDRconfigure)(void);\r
134typedef long (CALLBACK* CDRtest)(void);\r
135typedef void (CALLBACK* CDRabout)(void);\r
136typedef long (CALLBACK* CDRplay)(unsigned char *);\r
137typedef long (CALLBACK* CDRstop)(void);\r
138typedef long (CALLBACK* CDRsetfilename)(char *);\r
139struct CdrStat {\r
140 uint32_t Type;\r
141 uint32_t Status;\r
142 unsigned char Time[3];\r
144typedef long (CALLBACK* CDRgetStatus)(struct CdrStat *);\r
145typedef char* (CALLBACK* CDRgetDriveLetter)(void);\r
146struct SubQ {\r
147 char res0[12];\r
148 unsigned char ControlAndADR;\r
149 unsigned char TrackNumber;\r
150 unsigned char IndexNumber;\r
151 unsigned char TrackRelativeAddress[3];\r
152 unsigned char Filler;\r
153 unsigned char AbsoluteAddress[3];
154 unsigned char CRC[2];\r
155 char res1[72];\r
157typedef long (CALLBACK* CDRreadCDDA)(unsigned char, unsigned char, unsigned char, unsigned char *);\r
158typedef long (CALLBACK* CDRgetTE)(unsigned char, unsigned char *, unsigned char *, unsigned char *);\r
160// CD-ROM function pointers\r
161extern CDRinit CDR_init;\r
162extern CDRshutdown CDR_shutdown;\r
163extern CDRopen CDR_open;\r
164extern CDRclose CDR_close; \r
165extern CDRtest CDR_test;\r
166extern CDRgetTN CDR_getTN;\r
167extern CDRgetTD CDR_getTD;\r
168extern CDRreadTrack CDR_readTrack;\r
169extern CDRgetBuffer CDR_getBuffer;\r
170extern CDRgetBufferSub CDR_getBufferSub;\r
171extern CDRplay CDR_play;\r
172extern CDRstop CDR_stop;\r
173extern CDRgetStatus CDR_getStatus;\r
174extern CDRgetDriveLetter CDR_getDriveLetter;\r
175extern CDRconfigure CDR_configure;\r
176extern CDRabout CDR_about;\r
177extern CDRsetfilename CDR_setfilename;\r
178extern CDRreadCDDA CDR_readCDDA;\r
179extern CDRgetTE CDR_getTE;\r
181// SPU Functions\r
182typedef long (CALLBACK* SPUinit)(void); \r
183typedef long (CALLBACK* SPUshutdown)(void); \r
184typedef long (CALLBACK* SPUclose)(void); \r
185typedef void (CALLBACK* SPUplaySample)(unsigned char); \r
186typedef void (CALLBACK* SPUwriteRegister)(unsigned long, unsigned short);\r
187typedef unsigned short (CALLBACK* SPUreadRegister)(unsigned long);\r
188typedef void (CALLBACK* SPUwriteDMA)(unsigned short);\r
189typedef unsigned short (CALLBACK* SPUreadDMA)(void);\r
190typedef void (CALLBACK* SPUwriteDMAMem)(unsigned short *, int);\r
191typedef void (CALLBACK* SPUreadDMAMem)(unsigned short *, int);\r
192typedef void (CALLBACK* SPUplayADPCMchannel)(xa_decode_t *);\r
193typedef void (CALLBACK* SPUregisterCallback)(void (CALLBACK *callback)(void));\r
194typedef long (CALLBACK* SPUconfigure)(void);\r
195typedef long (CALLBACK* SPUtest)(void);\r
196typedef void (CALLBACK* SPUabout)(void);\r
197typedef struct {\r
198 unsigned char PluginName[8];\r
199 uint32_t PluginVersion;\r
200 uint32_t Size;\r
201 unsigned char SPUPorts[0x200];\r
202 unsigned char SPURam[0x80000];\r
203 xa_decode_t xa;\r
204 unsigned char *SPUInfo;\r
205} SPUFreeze_t;\r
206typedef long (CALLBACK* SPUfreeze)(uint32_t, SPUFreeze_t *);\r
207typedef void (CALLBACK* SPUasync)(uint32_t);\r
208typedef void (CALLBACK* SPUplayCDDAchannel)(short *, int);\r
210// SPU function pointers\r
211extern SPUconfigure SPU_configure;\r
212extern SPUabout SPU_about;\r
213extern SPUinit SPU_init;\r
214extern SPUshutdown SPU_shutdown;\r
215extern SPUtest SPU_test;\r
216extern SPUopen SPU_open;\r
217extern SPUclose SPU_close;\r
218extern SPUplaySample SPU_playSample;\r
219extern SPUwriteRegister SPU_writeRegister;\r
220extern SPUreadRegister SPU_readRegister;\r
221extern SPUwriteDMA SPU_writeDMA;\r
222extern SPUreadDMA SPU_readDMA;\r
223extern SPUwriteDMAMem SPU_writeDMAMem;\r
224extern SPUreadDMAMem SPU_readDMAMem;\r
225extern SPUplayADPCMchannel SPU_playADPCMchannel;\r
226extern SPUfreeze SPU_freeze;\r
227extern SPUregisterCallback SPU_registerCallback;\r
228extern SPUasync SPU_async;\r
229extern SPUplayCDDAchannel SPU_playCDDAchannel;\r
231// PAD Functions\r
232typedef long (CALLBACK* PADconfigure)(void);\r
233typedef void (CALLBACK* PADabout)(void);\r
234typedef long (CALLBACK* PADinit)(long);\r
235typedef long (CALLBACK* PADshutdown)(void); \r
236typedef long (CALLBACK* PADtest)(void); \r
237typedef long (CALLBACK* PADclose)(void);\r
238typedef long (CALLBACK* PADquery)(void);\r
239typedef long (CALLBACK* PADreadPort1)(PadDataS*);\r
240typedef long (CALLBACK* PADreadPort2)(PadDataS*);\r
241typedef long (CALLBACK* PADkeypressed)(void);\r
242typedef unsigned char (CALLBACK* PADstartPoll)(int);\r
243typedef unsigned char (CALLBACK* PADpoll)(unsigned char);\r
244typedef void (CALLBACK* PADsetSensitive)(int);\r
246// PAD function pointers\r
247extern PADconfigure PAD1_configure;\r
248extern PADabout PAD1_about;\r
249extern PADinit PAD1_init;\r
250extern PADshutdown PAD1_shutdown;\r
251extern PADtest PAD1_test;\r
252extern PADopen PAD1_open;\r
253extern PADclose PAD1_close;\r
254extern PADquery PAD1_query;\r
255extern PADreadPort1 PAD1_readPort1;\r
256extern PADkeypressed PAD1_keypressed;\r
257extern PADstartPoll PAD1_startPoll;\r
258extern PADpoll PAD1_poll;\r
259extern PADsetSensitive PAD1_setSensitive;\r
261extern PADconfigure PAD2_configure;\r
262extern PADabout PAD2_about;\r
263extern PADinit PAD2_init;\r
264extern PADshutdown PAD2_shutdown;\r
265extern PADtest PAD2_test;\r
266extern PADopen PAD2_open;\r
267extern PADclose PAD2_close;\r
268extern PADquery PAD2_query;\r
269extern PADreadPort2 PAD2_readPort2;\r
270extern PADkeypressed PAD2_keypressed;\r
271extern PADstartPoll PAD2_startPoll;\r
272extern PADpoll PAD2_poll;\r
273extern PADsetSensitive PAD2_setSensitive;\r
275// NET Functions\r
276typedef long (CALLBACK* NETinit)(void);\r
277typedef long (CALLBACK* NETshutdown)(void);\r
278typedef long (CALLBACK* NETclose)(void);\r
279typedef long (CALLBACK* NETconfigure)(void);\r
280typedef long (CALLBACK* NETtest)(void);\r
281typedef void (CALLBACK* NETabout)(void);\r
282typedef void (CALLBACK* NETpause)(void);\r
283typedef void (CALLBACK* NETresume)(void);\r
284typedef long (CALLBACK* NETqueryPlayer)(void);\r
285typedef long (CALLBACK* NETsendData)(void *, int, int);\r
286typedef long (CALLBACK* NETrecvData)(void *, int, int);\r
287typedef long (CALLBACK* NETsendPadData)(void *, int);\r
288typedef long (CALLBACK* NETrecvPadData)(void *, int);\r
290typedef struct {\r
291 char EmuName[32];\r
292 char CdromID[9]; // ie. 'SCPH12345', no \0 trailing character\r
293 char CdromLabel[11];\r
294 void *psxMem;\r
295 GPUshowScreenPic GPU_showScreenPic;\r
296 GPUdisplayText GPU_displayText;\r
297 PADsetSensitive PAD_setSensitive;\r
298 char GPUpath[256]; // paths must be absolute\r
299 char SPUpath[256];\r
300 char CDRpath[256];\r
301 char MCD1path[256];\r
302 char MCD2path[256];\r
303 char BIOSpath[256]; // 'HLE' for internal bios\r
304 char Unused[1024];\r
305} netInfo;\r
307typedef long (CALLBACK* NETsetInfo)(netInfo *);\r
308typedef long (CALLBACK* NETkeypressed)(int);\r
310// NET function pointers \r
311extern NETinit NET_init;\r
312extern NETshutdown NET_shutdown;\r
313extern NETopen NET_open;\r
314extern NETclose NET_close; \r
315extern NETtest NET_test;\r
316extern NETconfigure NET_configure;\r
317extern NETabout NET_about;\r
318extern NETpause NET_pause;\r
319extern NETresume NET_resume;\r
320extern NETqueryPlayer NET_queryPlayer;\r
321extern NETsendData NET_sendData;\r
322extern NETrecvData NET_recvData;\r
323extern NETsendPadData NET_sendPadData;\r
324extern NETrecvPadData NET_recvPadData;\r
325extern NETsetInfo NET_setInfo;\r
326extern NETkeypressed NET_keypressed;\r
328#ifdef ENABLE_SIO1API\r
330// SIO1 Functions (link cable)\r
331typedef long (CALLBACK* SIO1init)(void);\r
332typedef long (CALLBACK* SIO1shutdown)(void);\r
333typedef long (CALLBACK* SIO1close)(void);\r
334typedef long (CALLBACK* SIO1configure)(void);\r
335typedef long (CALLBACK* SIO1test)(void);\r
336typedef void (CALLBACK* SIO1about)(void);\r
337typedef void (CALLBACK* SIO1pause)(void);\r
338typedef void (CALLBACK* SIO1resume)(void);\r
339typedef long (CALLBACK* SIO1keypressed)(int);\r
340typedef void (CALLBACK* SIO1writeData8)(unsigned char);\r
341typedef void (CALLBACK* SIO1writeData16)(unsigned short);\r
342typedef void (CALLBACK* SIO1writeData32)(unsigned long);\r
343typedef void (CALLBACK* SIO1writeStat16)(unsigned short);\r
344typedef void (CALLBACK* SIO1writeStat32)(unsigned long);\r
345typedef void (CALLBACK* SIO1writeMode16)(unsigned short);\r
346typedef void (CALLBACK* SIO1writeMode32)(unsigned long);\r
347typedef void (CALLBACK* SIO1writeCtrl16)(unsigned short);\r
348typedef void (CALLBACK* SIO1writeCtrl32)(unsigned long);\r
349typedef void (CALLBACK* SIO1writeBaud16)(unsigned short);\r
350typedef void (CALLBACK* SIO1writeBaud32)(unsigned long);\r
351typedef unsigned char (CALLBACK* SIO1readData8)(void);\r
352typedef unsigned short (CALLBACK* SIO1readData16)(void);\r
353typedef unsigned long (CALLBACK* SIO1readData32)(void);\r
354typedef unsigned short (CALLBACK* SIO1readStat16)(void);\r
355typedef unsigned long (CALLBACK* SIO1readStat32)(void);\r
356typedef unsigned short (CALLBACK* SIO1readMode16)(void);\r
357typedef unsigned long (CALLBACK* SIO1readMode32)(void);\r
358typedef unsigned short (CALLBACK* SIO1readCtrl16)(void);\r
359typedef unsigned long (CALLBACK* SIO1readCtrl32)(void);\r
360typedef unsigned short (CALLBACK* SIO1readBaud16)(void);\r
361typedef unsigned long (CALLBACK* SIO1readBaud32)(void);\r
362typedef void (CALLBACK* SIO1registerCallback)(void (CALLBACK *callback)(void));\r
364// SIO1 function pointers \r
365extern SIO1init SIO1_init;\r
366extern SIO1shutdown SIO1_shutdown;\r
367extern SIO1open SIO1_open;\r
368extern SIO1close SIO1_close; \r
369extern SIO1test SIO1_test;\r
370extern SIO1configure SIO1_configure;\r
371extern SIO1about SIO1_about;\r
372extern SIO1pause SIO1_pause;\r
373extern SIO1resume SIO1_resume;\r
374extern SIO1keypressed SIO1_keypressed;\r
375extern SIO1writeData8 SIO1_writeData8;\r
376extern SIO1writeData16 SIO1_writeData16;\r
377extern SIO1writeData32 SIO1_writeData32;\r
378extern SIO1writeStat16 SIO1_writeStat16;\r
379extern SIO1writeStat32 SIO1_writeStat32;\r
380extern SIO1writeMode16 SIO1_writeMode16;\r
381extern SIO1writeMode32 SIO1_writeMode32;\r
382extern SIO1writeCtrl16 SIO1_writeCtrl16;\r
383extern SIO1writeCtrl32 SIO1_writeCtrl32;\r
384extern SIO1writeBaud16 SIO1_writeBaud16;\r
385extern SIO1writeBaud32 SIO1_writeBaud32;\r
386extern SIO1readData8 SIO1_readData8;\r
387extern SIO1readData16 SIO1_readData16;\r
388extern SIO1readData32 SIO1_readData32;\r
389extern SIO1readStat16 SIO1_readStat16;\r
390extern SIO1readStat32 SIO1_readStat32;\r
391extern SIO1readMode16 SIO1_readMode16;\r
392extern SIO1readMode32 SIO1_readMode32;\r
393extern SIO1readCtrl16 SIO1_readCtrl16;\r
394extern SIO1readCtrl32 SIO1_readCtrl32;\r
395extern SIO1readBaud16 SIO1_readBaud16;\r
396extern SIO1readBaud32 SIO1_readBaud32;\r
397extern SIO1registerCallback SIO1_registerCallback;\r
401void CALLBACK clearDynarec(void);\r
403void SetIsoFile(const char *filename);\r
404const char *GetIsoFile(void);\r
405boolean UsingIso(void);\r
406void SetCdOpenCaseTime(s64 time);\r
408#ifdef __cplusplus\r