/[pcsx2_0.9.7]/trunk/common/include/PS2Edefs.h
ViewVC logotype

Annotation of /trunk/common/include/PS2Edefs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 27451 byte(s)
committing r3113 initial commit again...
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16     #ifndef __PS2EDEFS_H__
17     #define __PS2EDEFS_H__
18    
19     // Global enable/disable flag, disables all the parts if off
20     //#define ENABLE_NEW_IOPDMA
21    
22     // Parts of the dmac, each one can be turned on independently
23     #ifdef ENABLE_NEW_IOPDMA
24     //#define ENABLE_NEW_IOPDMA_SPU2 /* working */
25     //#define ENABLE_NEW_IOPDMA_SIO /* working */
26     //#define ENABLE_NEW_IOPDMA_CDVD /* NOT IMPLEMENTED */
27     //#define ENABLE_NEW_IOPDMA_SIF /* NOT IMPLEMENTED */
28     //#define ENABLE_NEW_IOPDMA_DEV9 /* untested (no plugins) */
29     #endif
30    
31     /*
32     * PS2E Definitions v0.6.2 (beta)
33     *
34     * Author: linuzappz@hotmail.com
35     * shadowpcsx2@yahoo.gr
36     * florinsasu@hotmail.com
37     */
38    
39     /*
40     Notes:
41     * Since this is still beta things may change.
42    
43     * OSflags:
44     __LINUX__ (linux OS)
45     _WIN32 (win32 OS)
46    
47     * common return values (for ie. GSinit):
48     0 - success
49     -1 - error
50    
51     * reserved keys:
52     F1 to F10 are reserved for the emulator
53    
54     * plugins should NOT change the current
55     working directory.
56     (on win32, add flag OFN_NOCHANGEDIR for
57     GetOpenFileName)
58    
59     */
60    
61     #include "Pcsx2Defs.h"
62    
63     ///////////////////////////////////////////////////////////////////////
64    
65     // freeze modes:
66     #define FREEZE_LOAD 0
67     #define FREEZE_SAVE 1
68     #define FREEZE_SIZE 2
69    
70     // event values:
71     #define KEYPRESS 1
72     #define KEYRELEASE 2
73    
74     typedef struct {
75     int size;
76     s8 *data;
77     } freezeData;
78    
79     typedef struct _keyEvent {
80     u32 key;
81     u32 evt;
82     } keyEvent;
83    
84     ///////////////////////////////////////////////////////////////////////
85    
86     #if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \
87     defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \
88     defined(USBdefs) || defined(FWdefs)
89     #define COMMONdefs
90     #endif
91    
92     // PS2EgetLibType returns (may be OR'd)
93     #define PS2E_LT_GS 0x01
94     #define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=-
95     #define PS2E_LT_SPU2 0x04
96     #define PS2E_LT_CDVD 0x08
97     #define PS2E_LT_DEV9 0x10
98     #define PS2E_LT_USB 0x20
99     #define PS2E_LT_FW 0x40
100     #define PS2E_LT_SIO 0x80
101    
102     // PS2EgetLibVersion2 (high 16 bits)
103     #define PS2E_GS_VERSION 0x0006
104     #define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=-
105     #ifdef ENABLE_NEW_IOPDMA_SPU2
106     # define PS2E_SPU2_VERSION 0x0006
107     #else
108     # define PS2E_SPU2_VERSION 0x0005
109     #endif
110     #define PS2E_CDVD_VERSION 0x0005
111     #ifdef ENABLE_NEW_IOPDMA_DEV9
112     # define PS2E_DEV9_VERSION 0x0004
113     #else
114     # define PS2E_DEV9_VERSION 0x0003
115     #endif
116     #define PS2E_USB_VERSION 0x0003
117     #define PS2E_FW_VERSION 0x0002
118     #define PS2E_SIO_VERSION 0x0001
119     #ifdef COMMONdefs
120    
121     #ifdef __cplusplus
122     extern "C" {
123     #endif
124    
125     u32 CALLBACK PS2EgetLibType(void);
126     u32 CALLBACK PS2EgetLibVersion2(u32 type);
127     char* CALLBACK PS2EgetLibName(void);
128    
129     #ifdef __cplusplus
130     }
131     #endif
132    
133     #endif
134    
135     // key values:
136     /* key values must be OS dependant:
137     win32: the VK_XXX will be used (WinUser)
138     linux: the XK_XXX will be used (XFree86)
139     */
140    
141     // for 64bit compilers
142     typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1];
143    
144     // plugin types
145     #define SIO_TYPE_PAD 0x00000001
146     #define SIO_TYPE_MTAP 0x00000004
147     #define SIO_TYPE_RM 0x00000040
148     #define SIO_TYPE_MC 0x00000100
149    
150     typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
151    
152     typedef struct _cdvdSubQ {
153     u8 ctrl:4; // control and mode bits
154     u8 mode:4; // control and mode bits
155     u8 trackNum; // current track number (1 to 99)
156     u8 trackIndex; // current index within track (0 to 99)
157     u8 trackM; // current minute location on the disc (BCD encoded)
158     u8 trackS; // current sector location on the disc (BCD encoded)
159     u8 trackF; // current frame location on the disc (BCD encoded)
160     u8 pad; // unused
161     u8 discM; // current minute offset from first track (BCD encoded)
162     u8 discS; // current sector offset from first track (BCD encoded)
163     u8 discF; // current frame offset from first track (BCD encoded)
164     } cdvdSubQ;
165    
166     typedef struct _cdvdTD { // NOT bcd coded
167     u32 lsn;
168     u8 type;
169     } cdvdTD;
170    
171     typedef struct _cdvdTN {
172     u8 strack; //number of the first track (usually 1)
173     u8 etrack; //number of the last track
174     } cdvdTN;
175    
176     // CDVDreadTrack mode values:
177     #define CDVD_MODE_2352 0 // full 2352 bytes
178     #define CDVD_MODE_2340 1 // skip sync (12) bytes
179     #define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes
180     #define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes
181     #define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq
182    
183     // CDVDgetDiskType returns:
184     #define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc
185     #define CDVD_TYPE_DVDV 0xfe // DVD Video
186     #define CDVD_TYPE_CDDA 0xfd // Audio CD
187     #define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD
188     #define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio)
189     #define CDVD_TYPE_PS2CD 0x12 // PS2 CD
190     #define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio)
191     #define CDVD_TYPE_PSCD 0x10 // PS CD
192     #define CDVD_TYPE_UNKNOWN 0x05 // Unknown
193     #define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided
194     #define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided
195     #define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd
196     #define CDVD_TYPE_DETCT 0x01 // Detecting
197     #define CDVD_TYPE_NODISC 0x00 // No Disc
198    
199     // CDVDgetTrayStatus returns:
200     #define CDVD_TRAY_CLOSE 0x00
201     #define CDVD_TRAY_OPEN 0x01
202    
203     // cdvdTD.type (track types for cds)
204     #define CDVD_AUDIO_TRACK 0x01
205     #define CDVD_MODE1_TRACK 0x41
206     #define CDVD_MODE2_TRACK 0x61
207    
208     #define CDVD_AUDIO_MASK 0x00
209     #define CDVD_DATA_MASK 0x40
210     // CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel)
211    
212     typedef void (*DEV9callback)(int cycles);
213     typedef int (*DEV9handler)(void);
214    
215     typedef void (*USBcallback)(int cycles);
216     typedef int (*USBhandler)(void);
217    
218     typedef struct _GSdriverInfo {
219     char name[8];
220     void *common;
221     } GSdriverInfo;
222    
223     #ifdef _WINDOWS_
224     typedef struct _winInfo { // unsupported values must be set to zero
225     HWND hWnd;
226     HMENU hMenu;
227     HWND hStatusWnd;
228     } winInfo;
229     #endif
230    
231     #ifdef __cplusplus
232     extern "C" {
233     #endif
234    
235     /* GS plugin API */
236    
237     // if this file is included with this define
238     // the next api will not be skipped by the compiler
239     #ifdef GSdefs
240    
241     // basic funcs
242    
243     s32 CALLBACK GSinit();
244     s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread);
245     void CALLBACK GSclose();
246     void CALLBACK GSshutdown();
247     void CALLBACK GSsetSettingsDir( const char* dir );
248     void CALLBACK GSsetLogDir( const char* dir );
249    
250     void CALLBACK GSvsync(int field);
251     void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr);
252     void CALLBACK GSgifTransfer2(u32 *pMem, u32 size);
253     void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
254     void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits)
255     void CALLBACK GSgifSoftReset(u32 mask);
256     void CALLBACK GSreadFIFO(u64 *mem);
257     void CALLBACK GSreadFIFO2(u64 *mem, int qwc);
258    
259     // extended funcs
260    
261     // GSkeyEvent gets called when there is a keyEvent from the PAD plugin
262     void CALLBACK GSkeyEvent(keyEvent *ev);
263     void CALLBACK GSchangeSaveState(int, const char* filename);
264     void CALLBACK GSmakeSnapshot(char *path);
265     void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg);
266     void CALLBACK GSirqCallback(void (*callback)());
267     void CALLBACK GSprintf(int timeout, char *fmt, ...);
268     void CALLBACK GSsetBaseMem(void*);
269     void CALLBACK GSsetGameCRC(int crc, int gameoptions);
270    
271     // controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
272     void CALLBACK GSsetFrameSkip(int frameskip);
273    
274     // if start is 1, starts recording spu2 data, else stops
275     // returns a non zero value if successful
276     // for now, pData is not used
277     int CALLBACK GSsetupRecording(int start, void* pData);
278    
279     void CALLBACK GSreset();
280     void CALLBACK GSgetTitleInfo( char dest[128] );
281     void CALLBACK GSwriteCSR(u32 value);
282     s32 CALLBACK GSfreeze(int mode, freezeData *data);
283     void CALLBACK GSconfigure();
284     void CALLBACK GSabout();
285     s32 CALLBACK GStest();
286    
287     #endif
288    
289     /* PAD plugin API -=[ OBSOLETE ]=- */
290    
291     // if this file is included with this define
292     // the next api will not be skipped by the compiler
293     #ifdef PADdefs
294    
295     // basic funcs
296    
297     s32 CALLBACK PADinit(u32 flags);
298     s32 CALLBACK PADopen(void *pDsp);
299     void CALLBACK PADclose();
300     void CALLBACK PADshutdown();
301     void CALLBACK PADsetSettingsDir( const char* dir );
302     void CALLBACK PADsetLogDir( const char* dir );
303    
304     // PADkeyEvent is called every vsync (return NULL if no event)
305     keyEvent* CALLBACK PADkeyEvent();
306     u8 CALLBACK PADstartPoll(int pad);
307     u8 CALLBACK PADpoll(u8 value);
308     // returns: 1 if supported pad1
309     // 2 if supported pad2
310     // 3 if both are supported
311     u32 CALLBACK PADquery();
312    
313     // call to give a hint to the PAD plugin to query for the keyboard state. A
314     // good plugin will query the OS for keyboard state ONLY in this function.
315     // This function is necessary when multithreading because otherwise
316     // the PAD plugin can get into deadlocks with the thread that really owns
317     // the window (and input). Note that PADupdate can be called from a different
318     // thread than the other functions, so mutex or other multithreading primitives
319     // have to be added to maintain data integrity.
320     void CALLBACK PADupdate(int pad);
321    
322     // extended funcs
323    
324     void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
325     void CALLBACK PADconfigure();
326     void CALLBACK PADabout();
327     s32 CALLBACK PADtest();
328    
329     #endif
330    
331     /* SPU2 plugin API */
332    
333     // if this file is included with this define
334     // the next api will not be skipped by the compiler
335     #ifdef SPU2defs
336    
337     // basic funcs
338    
339     s32 CALLBACK SPU2init();
340     s32 CALLBACK SPU2open(void *pDsp);
341     void CALLBACK SPU2close();
342     void CALLBACK SPU2shutdown();
343     void CALLBACK SPU2setSettingsDir( const char* dir );
344     void CALLBACK SPU2setLogDir( const char* dir );
345    
346     void CALLBACK SPU2write(u32 mem, u16 value);
347     u16 CALLBACK SPU2read(u32 mem);
348    
349     #ifdef ENABLE_NEW_IOPDMA_SPU2
350     s32 CALLBACK SPU2dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
351     s32 CALLBACK SPU2dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
352     void CALLBACK SPU2dmaInterrupt(s32 channel);
353    
354     // dma irq callbacks not needed anymore, they are handled by the dmac
355     void CALLBACK SPU2irqCallback(void (*SPU2callback)());
356     #else
357     void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size);
358     void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size);
359     void CALLBACK SPU2interruptDMA4();
360     void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
361     void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
362    
363     // all addresses passed by dma will be pointers to the array starting at baseaddr
364     // This function is necessary to successfully save and reload the spu2 state
365     void CALLBACK SPU2setDMABaseAddr(uptr baseaddr);
366    
367     void CALLBACK SPU2interruptDMA7();
368    
369     u32 CALLBACK SPU2ReadMemAddr(int core);
370     void CALLBACK SPU2WriteMemAddr(int core,u32 value);
371    
372     void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
373     #endif
374    
375     // extended funcs
376     // if start is 1, starts recording spu2 data, else stops
377     // returns a non zero value if successful
378     // for now, pData is not used
379     int CALLBACK SPU2setupRecording(int start, void* pData);
380    
381     void CALLBACK SPU2setClockPtr(u32* ptr);
382     void CALLBACK SPU2setTimeStretcher(short int enable);
383    
384     void CALLBACK SPU2async(u32 cycles);
385     s32 CALLBACK SPU2freeze(int mode, freezeData *data);
386     void CALLBACK SPU2configure();
387     void CALLBACK SPU2about();
388     s32 CALLBACK SPU2test();
389    
390     #endif
391    
392     /* CDVD plugin API */
393    
394     // if this file is included with this define
395     // the next api will not be skipped by the compiler
396     #ifdef CDVDdefs
397    
398     // basic funcs
399    
400     s32 CALLBACK CDVDinit();
401     s32 CALLBACK CDVDopen(const char* pTitleFilename);
402     void CALLBACK CDVDclose();
403     void CALLBACK CDVDshutdown();
404     void CALLBACK CDVDsetSettingsDir( const char* dir );
405     void CALLBACK CDVDsetLogDir( const char* dir );
406    
407     s32 CALLBACK CDVDreadTrack(u32 lsn, int mode);
408    
409     // return can be NULL (for async modes)
410     u8* CALLBACK CDVDgetBuffer();
411    
412     s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data)
413     s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information
414     s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type
415     s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc
416     s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx
417     s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
418     s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray
419     s32 CALLBACK CDVDctrlTrayClose(); //close disc tray
420    
421     // extended funcs
422    
423     void CALLBACK CDVDconfigure();
424     void CALLBACK CDVDabout();
425     s32 CALLBACK CDVDtest();
426     void CALLBACK CDVDnewDiskCB(void (*callback)());
427    
428     // new funcs
429    
430     // read a track directly
431     s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode);
432    
433     // improved getBuffer
434     s32 CALLBACK CDVDgetBuffer2(u8* buffer);
435    
436     // tool function
437     s32 CALLBACK CDVDgetDualInfo(s32* dualType, u32* _layer1start);
438    
439     #endif
440    
441     /* DEV9 plugin API */
442    
443     // if this file is included with this define
444     // the next api will not be skipped by the compiler
445     #ifdef DEV9defs
446    
447     // basic funcs
448    
449     // NOTE: The read/write functions CANNOT use XMM/MMX regs
450     // If you want to use them, need to save and restore current ones
451     s32 CALLBACK DEV9init();
452     s32 CALLBACK DEV9open(void *pDsp);
453     void CALLBACK DEV9close();
454     void CALLBACK DEV9shutdown();
455     void CALLBACK DEV9setSettingsDir( const char* dir );
456     void CALLBACK DEV9setLogDir( const char* dir );
457    
458     u8 CALLBACK DEV9read8(u32 addr);
459     u16 CALLBACK DEV9read16(u32 addr);
460     u32 CALLBACK DEV9read32(u32 addr);
461     void CALLBACK DEV9write8(u32 addr, u8 value);
462     void CALLBACK DEV9write16(u32 addr, u16 value);
463     void CALLBACK DEV9write32(u32 addr, u32 value);
464     #ifdef ENABLE_NEW_IOPDMA_DEV9
465     s32 CALLBACK DEV9dmaRead(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
466     s32 CALLBACK DEV9dmaWrite(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
467     void CALLBACK DEV9dmaInterrupt(s32 channel);
468     #else
469     void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size);
470     void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size);
471     #endif
472     // cycles = IOP cycles before calling callback,
473     // if callback returns 1 the irq is triggered, else not
474     void CALLBACK DEV9irqCallback(DEV9callback callback);
475     DEV9handler CALLBACK DEV9irqHandler(void);
476    
477     // extended funcs
478    
479     s32 CALLBACK DEV9freeze(int mode, freezeData *data);
480     void CALLBACK DEV9configure();
481     void CALLBACK DEV9about();
482     s32 CALLBACK DEV9test();
483    
484     #endif
485    
486     /* USB plugin API */
487    
488     // if this file is included with this define
489     // the next api will not be skipped by the compiler
490     #ifdef USBdefs
491    
492     // basic funcs
493    
494     s32 CALLBACK USBinit();
495     s32 CALLBACK USBopen(void *pDsp);
496     void CALLBACK USBclose();
497     void CALLBACK USBshutdown();
498     void CALLBACK USBsetSettingsDir( const char* dir );
499     void CALLBACK USBsetLogDir( const char* dir );
500    
501     u8 CALLBACK USBread8(u32 addr);
502     u16 CALLBACK USBread16(u32 addr);
503     u32 CALLBACK USBread32(u32 addr);
504     void CALLBACK USBwrite8(u32 addr, u8 value);
505     void CALLBACK USBwrite16(u32 addr, u16 value);
506     void CALLBACK USBwrite32(u32 addr, u32 value);
507     void CALLBACK USBasync(u32 cycles);
508    
509     // cycles = IOP cycles before calling callback,
510     // if callback returns 1 the irq is triggered, else not
511     void CALLBACK USBirqCallback(USBcallback callback);
512     USBhandler CALLBACK USBirqHandler(void);
513     void CALLBACK USBsetRAM(void *mem);
514    
515     // extended funcs
516    
517     s32 CALLBACK USBfreeze(int mode, freezeData *data);
518     void CALLBACK USBconfigure();
519     void CALLBACK USBabout();
520     s32 CALLBACK USBtest();
521    
522     #endif
523    
524     /* FW plugin API */
525    
526     // if this file is included with this define
527     // the next api will not be skipped by the compiler
528     #ifdef FWdefs
529     // basic funcs
530    
531     // NOTE: The read/write functions CANNOT use XMM/MMX regs
532     // If you want to use them, need to save and restore current ones
533     s32 CALLBACK FWinit();
534     s32 CALLBACK FWopen(void *pDsp);
535     void CALLBACK FWclose();
536     void CALLBACK FWshutdown();
537     void CALLBACK FWsetSettingsDir( const char* dir );
538     void CALLBACK FWsetLogDir( const char* dir );
539    
540     u32 CALLBACK FWread32(u32 addr);
541     void CALLBACK FWwrite32(u32 addr, u32 value);
542     void CALLBACK FWirqCallback(void (*callback)());
543    
544     // extended funcs
545    
546     s32 CALLBACK FWfreeze(int mode, freezeData *data);
547     void CALLBACK FWconfigure();
548     void CALLBACK FWabout();
549     s32 CALLBACK FWtest();
550     #endif
551    
552     // might be useful for emulators
553     #ifdef PLUGINtypedefs
554    
555     typedef u32 (CALLBACK* _PS2EgetLibType)(void);
556     typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
557     typedef char*(CALLBACK* _PS2EgetLibName)(void);
558    
559     typedef void (CALLBACK* _PS2EsetEmuVersion)(const char* emuId, u32 version); // HACK to let some plugins know it's 0.9.7 PCSX2 --air
560    
561     // GS
562     // NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
563     // If you want to use them, need to save and restore current ones
564     typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
565     typedef s32 (CALLBACK* _GSopen2)( void *pDsp, u32 flags );
566     typedef void (CALLBACK* _GSvsync)(int field);
567     typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr);
568     typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size);
569     typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
570     typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
571     typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
572     typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
573    
574     typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
575     typedef void (CALLBACK* _GSgetTitleInfo)(char dest[128]);
576     typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
577     typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
578     typedef void (CALLBACK* _GSsetBaseMem)(void*);
579     typedef void (CALLBACK* _GSsetGameCRC)(int, int);
580     typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
581     typedef void (CALLBACK* _GSsetFrameLimit)(int limit);
582     typedef void (CALLBACK* _GSsetVsync)(int enabled);
583     typedef void (CALLBACK* _GSsetExclusive)(int isExclusive);
584     typedef int (CALLBACK* _GSsetupRecording)(int, void*);
585     typedef void (CALLBACK* _GSreset)();
586     typedef void (CALLBACK* _GSwriteCSR)(u32 value);
587     typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
588     typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
589    
590     // Worthless crap function that returns GS plugin specific data via some
591     // undocumented void* to a struct. If any pad plugin actually relies on
592     // this info, it deserves to fail new newer pcsx2s. -- air
593     //typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
594    
595     // PAD
596     typedef s32 (CALLBACK* _PADinit)(u32 flags);
597     typedef s32 (CALLBACK* _PADopen)(void *pDsp);
598     typedef u8 (CALLBACK* _PADstartPoll)(int pad);
599     typedef u8 (CALLBACK* _PADpoll)(u8 value);
600     typedef u32 (CALLBACK* _PADquery)(int pad);
601     typedef void (CALLBACK* _PADupdate)(int pad);
602     typedef keyEvent* (CALLBACK* _PADkeyEvent)();
603     typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
604     typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
605     typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
606    
607     // SPU2
608     // NOTE: The read/write functions CANNOT use XMM/MMX regs
609     // If you want to use them, need to save and restore current ones
610     typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
611     typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
612     typedef u16 (CALLBACK* _SPU2read)(u32 mem);
613    
614     #ifdef ENABLE_NEW_IOPDMA_SPU2
615     typedef s32 (CALLBACK* _SPU2dmaRead)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
616     typedef s32 (CALLBACK* _SPU2dmaWrite)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
617     typedef void (CALLBACK* _SPU2dmaInterrupt)(s32 channel);
618    
619     // dma irq callbacks not needed anymore, they are handled by the dmac
620     typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)());
621     #else
622     typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size);
623     typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
624     typedef void (CALLBACK* _SPU2interruptDMA4)();
625     typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
626     typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
627     typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr);
628     typedef void (CALLBACK* _SPU2interruptDMA7)();
629     typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
630     typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
631     typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
632     #endif
633    
634     typedef int (CALLBACK* _SPU2setupRecording)(int, void*);
635    
636     typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr);
637     typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable);
638    
639     typedef void (CALLBACK* _SPU2async)(u32 cycles);
640    
641    
642     // CDVD
643     // NOTE: The read/write functions CANNOT use XMM/MMX regs
644     // If you want to use them, need to save and restore current ones
645     typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename);
646    
647     // Initiates an asynchronous track read operation.
648     // Returns -1 on error (invalid track)
649     // Returns 0 on success.
650     typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
651    
652     // *OBSOLETE* returns a pointer to the buffer, or NULL if data hasn't finished
653     // loading yet.
654     typedef u8* (CALLBACK* _CDVDgetBuffer)();
655    
656     // Copies loaded data to the target buffer.
657     // Returns -2 if the asynchronous read is still pending.
658     // Returns -1 if the asyncronous read failed.
659     // Returns 0 on success.
660     typedef s32 (CALLBACK* _CDVDgetBuffer2)(u8* buffer);
661    
662     typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
663     typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
664     typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
665     typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc);
666     typedef s32 (CALLBACK* _CDVDgetDiskType)();
667     typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
668     typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
669     typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
670     typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode);
671     typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start);
672    
673     typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
674    
675    
676     // DEV9
677     // NOTE: The read/write functions CANNOT use XMM/MMX regs
678     // If you want to use them, need to save and restore current ones
679     typedef s32 (CALLBACK* _DEV9open)(void *pDsp);
680     typedef u8 (CALLBACK* _DEV9read8)(u32 mem);
681     typedef u16 (CALLBACK* _DEV9read16)(u32 mem);
682     typedef u32 (CALLBACK* _DEV9read32)(u32 mem);
683     typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value);
684     typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value);
685     typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value);
686     #ifdef ENABLE_NEW_IOPDMA_DEV9
687     typedef s32 (CALLBACK* _DEV9dmaRead)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
688     typedef s32 (CALLBACK* _DEV9dmaWrite)(s32 channel, u32* data, u32 bytesLeft, u32* bytesProcessed);
689     typedef void (CALLBACK* _DEV9dmaInterrupt)(s32 channel);
690     #else
691     typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size);
692     typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
693     #endif
694     typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
695     typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
696    
697     // USB
698     // NOTE: The read/write functions CANNOT use XMM/MMX regs
699     // If you want to use them, need to save and restore current ones
700     typedef s32 (CALLBACK* _USBopen)(void *pDsp);
701     typedef u8 (CALLBACK* _USBread8)(u32 mem);
702     typedef u16 (CALLBACK* _USBread16)(u32 mem);
703     typedef u32 (CALLBACK* _USBread32)(u32 mem);
704     typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
705     typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
706     typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
707     typedef void (CALLBACK* _USBasync)(u32 cycles);
708    
709     typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
710     typedef USBhandler (CALLBACK* _USBirqHandler)(void);
711     typedef void (CALLBACK* _USBsetRAM)(void *mem);
712    
713     //FW
714     typedef s32 (CALLBACK* _FWopen)(void *pDsp);
715     typedef u32 (CALLBACK* _FWread32)(u32 mem);
716     typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value);
717     typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
718     #endif
719    
720     #ifdef PLUGINfuncs
721    
722     // GS
723     extern _GSopen GSopen;
724     extern _GSopen2 GSopen2;
725     extern _GSvsync GSvsync;
726     extern _GSgifTransfer1 GSgifTransfer1;
727     extern _GSgifTransfer2 GSgifTransfer2;
728     extern _GSgifTransfer3 GSgifTransfer3;
729     extern _GSgifSoftReset GSgifSoftReset;
730     extern _GSreadFIFO GSreadFIFO;
731     extern _GSreadFIFO2 GSreadFIFO2;
732    
733     extern _GSchangeSaveState GSchangeSaveState;
734     extern _GSgetTitleInfo GSgetTitleInfo;
735     extern _GSmakeSnapshot GSmakeSnapshot;
736     extern _GSmakeSnapshot2 GSmakeSnapshot2;
737     extern _GSirqCallback GSirqCallback;
738     extern _GSprintf GSprintf;
739     extern _GSsetBaseMem GSsetBaseMem;
740     extern _GSsetGameCRC GSsetGameCRC;
741     extern _GSsetFrameSkip GSsetFrameSkip;
742     extern _GSsetFrameLimit GSsetFrameLimit;
743     extern _GSsetVsync GSsetVsync;
744     extern _GSsetupRecording GSsetupRecording;
745     extern _GSreset GSreset;
746     extern _GSwriteCSR GSwriteCSR;
747    
748     // PAD
749     extern _PADopen PADopen;
750     extern _PADstartPoll PADstartPoll;
751     extern _PADpoll PADpoll;
752     extern _PADquery PADquery;
753     extern _PADupdate PADupdate;
754     extern _PADkeyEvent PADkeyEvent;
755     extern _PADgsDriverInfo PADgsDriverInfo;
756     extern _PADsetSlot PADsetSlot;
757     extern _PADqueryMtap PADqueryMtap;
758    
759     // SPU2
760     extern _SPU2open SPU2open;
761     extern _SPU2write SPU2write;
762     extern _SPU2read SPU2read;
763    
764     #ifdef ENABLE_NEW_IOPDMA_SPU2
765     extern _SPU2dmaRead SPU2dmaRead;
766     extern _SPU2dmaWrite SPU2dmaWrite;
767     extern _SPU2dmaInterrupt SPU2dmaInterrupt;
768     #else
769     extern _SPU2readDMA4Mem SPU2readDMA4Mem;
770     extern _SPU2writeDMA4Mem SPU2writeDMA4Mem;
771     extern _SPU2interruptDMA4 SPU2interruptDMA4;
772     extern _SPU2readDMA7Mem SPU2readDMA7Mem;
773     extern _SPU2writeDMA7Mem SPU2writeDMA7Mem;
774     extern _SPU2setDMABaseAddr SPU2setDMABaseAddr;
775     extern _SPU2interruptDMA7 SPU2interruptDMA7;
776     extern _SPU2ReadMemAddr SPU2ReadMemAddr;
777     extern _SPU2setupRecording SPU2setupRecording;
778     extern _SPU2WriteMemAddr SPU2WriteMemAddr;
779     extern _SPU2irqCallback SPU2irqCallback;
780     #endif
781    
782     extern _SPU2irqCallback SPU2irqCallback;
783    
784     extern _SPU2setupRecording SPU2setupRecording;
785    
786     extern _SPU2setClockPtr SPU2setClockPtr;
787     extern _SPU2setTimeStretcher SPU2setTimeStretcher;
788    
789     extern _SPU2async SPU2async;
790    
791     // DEV9
792     extern _DEV9open DEV9open;
793     extern _DEV9read8 DEV9read8;
794     extern _DEV9read16 DEV9read16;
795     extern _DEV9read32 DEV9read32;
796     extern _DEV9write8 DEV9write8;
797     extern _DEV9write16 DEV9write16;
798     extern _DEV9write32 DEV9write32;
799     #ifdef ENABLE_NEW_IOPDMA_DEV9
800     extern _DEV9dmaRead DEV9dmaRead;
801     extern _DEV9dmaWrite DEV9dmaWrite;
802     extern _DEV9dmaInterrupt DEV9dmaInterrupt;
803     #else
804     extern _DEV9readDMA8Mem DEV9readDMA8Mem;
805     extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
806     #endif
807     extern _DEV9irqCallback DEV9irqCallback;
808     extern _DEV9irqHandler DEV9irqHandler;
809    
810     // USB
811     extern _USBopen USBopen;
812     extern _USBread8 USBread8;
813     extern _USBread16 USBread16;
814     extern _USBread32 USBread32;
815     extern _USBwrite8 USBwrite8;
816     extern _USBwrite16 USBwrite16;
817     extern _USBwrite32 USBwrite32;
818     extern _USBasync USBasync;
819    
820     extern _USBirqCallback USBirqCallback;
821     extern _USBirqHandler USBirqHandler;
822     extern _USBsetRAM USBsetRAM;
823    
824     // FW
825     extern _FWopen FWopen;
826     extern _FWread32 FWread32;
827     extern _FWwrite32 FWwrite32;
828     extern _FWirqCallback FWirqCallback;
829    
830     #endif
831    
832     #ifdef __cplusplus
833     } // End extern "C"
834     #endif
835    
836     #endif /* __PS2EDEFS_H__ */

  ViewVC Help
Powered by ViewVC 1.1.22