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