-
Notifications
You must be signed in to change notification settings - Fork 10
/
Plugin.h
382 lines (333 loc) · 12.3 KB
/
Plugin.h
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
/*
* Project 64 - A Nintendo 64 emulator.
*
* (c) Copyright 2001 zilmar (zilmar@emulation64.com) and
* Jabo (jabo@emulation64.com).
*
* pj64 homepage: www.pj64.net
*
* Permission to use, copy, modify and distribute Project64 in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Project64 is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Project64 or software derived from Project64.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so if they want them.
*
*/
#define DefaultGFXDll "Jabo_Direct3D8.dll"
#define DefaultRSPDll "RSP.dll"
#define DefaultAudioDll "Jabo_Dsound.dll"
#define DefaultControllerDll "Jabo_DInput.dll"
#define PLUGIN_TYPE_RSP 1
#define PLUGIN_TYPE_GFX 2
#define PLUGIN_TYPE_AUDIO 3
#define PLUGIN_TYPE_CONTROLLER 4
#define SYSTEM_NTSC 0
#define SYSTEM_PAL 1
#define SYSTEM_MPAL 2
typedef struct {
WORD Version; /* Should be set to 1 */
WORD Type; /* Set to PLUGIN_TYPE_GFX */
char Name[100]; /* Name of the DLL */
/* If DLL supports memory these memory options then set them to TRUE or FALSE
if it does not support it */
BOOL NormalMemory; /* a normal BYTE array */
BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre
bswap on a dword (32 bits) boundry */
} PLUGIN_INFO;
typedef struct {
HWND hWnd; /* Render window */
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom
// This will be in the same memory format as the rest of the memory.
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * DPC__START_REG;
DWORD * DPC__END_REG;
DWORD * DPC__CURRENT_REG;
DWORD * DPC__STATUS_REG;
DWORD * DPC__CLOCK_REG;
DWORD * DPC__BUFBUSY_REG;
DWORD * DPC__PIPEBUSY_REG;
DWORD * DPC__TMEM_REG;
DWORD * VI__STATUS_REG;
DWORD * VI__ORIGIN_REG;
DWORD * VI__WIDTH_REG;
DWORD * VI__INTR_REG;
DWORD * VI__V_CURRENT_LINE_REG;
DWORD * VI__TIMING_REG;
DWORD * VI__V_SYNC_REG;
DWORD * VI__H_SYNC_REG;
DWORD * VI__LEAP_REG;
DWORD * VI__H_START_REG;
DWORD * VI__V_START_REG;
DWORD * VI__V_BURST_REG;
DWORD * VI__X_SCALE_REG;
DWORD * VI__Y_SCALE_REG;
void (__cdecl *CheckInterrupts)( void );
} GFX_INFO;
typedef struct {
HINSTANCE hInst;
BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
bswap on a dword (32 bits) boundry */
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * SP__MEM_ADDR_REG;
DWORD * SP__DRAM_ADDR_REG;
DWORD * SP__RD_LEN_REG;
DWORD * SP__WR_LEN_REG;
DWORD * SP__STATUS_REG;
DWORD * SP__DMA_FULL_REG;
DWORD * SP__DMA_BUSY_REG;
DWORD * SP__PC_REG;
DWORD * SP__SEMAPHORE_REG;
DWORD * DPC__START_REG;
DWORD * DPC__END_REG;
DWORD * DPC__CURRENT_REG;
DWORD * DPC__STATUS_REG;
DWORD * DPC__CLOCK_REG;
DWORD * DPC__BUFBUSY_REG;
DWORD * DPC__PIPEBUSY_REG;
DWORD * DPC__TMEM_REG;
void ( __cdecl *CheckInterrupts)( void );
void (__cdecl *ProcessDlist)( void );
void (__cdecl *ProcessAlist)( void );
void (__cdecl *ProcessRdpList)( void );
} RSP_INFO_1_0;
typedef struct {
BOOL Present;
BOOL RawData;
int Plugin;
} CONTROL;
typedef struct {
HWND hMainWindow;
HINSTANCE hinst;
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry, only effects header.
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom)
CONTROL *Controls; // A pointer to an array of 4 controllers .. eg:
// CONTROL Controls[4];
} CONTROL_INFO;
typedef struct {
HINSTANCE hInst;
BOOL MemoryBswaped; /* If this is set to TRUE, then the memory has been pre
bswap on a dword (32 bits) boundry */
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * SP__MEM_ADDR_REG;
DWORD * SP__DRAM_ADDR_REG;
DWORD * SP__RD_LEN_REG;
DWORD * SP__WR_LEN_REG;
DWORD * SP__STATUS_REG;
DWORD * SP__DMA_FULL_REG;
DWORD * SP__DMA_BUSY_REG;
DWORD * SP__PC_REG;
DWORD * SP__SEMAPHORE_REG;
DWORD * DPC__START_REG;
DWORD * DPC__END_REG;
DWORD * DPC__CURRENT_REG;
DWORD * DPC__STATUS_REG;
DWORD * DPC__CLOCK_REG;
DWORD * DPC__BUFBUSY_REG;
DWORD * DPC__PIPEBUSY_REG;
DWORD * DPC__TMEM_REG;
void ( __cdecl *CheckInterrupts)( void );
void (__cdecl *ProcessDlist)( void );
void (__cdecl *ProcessAlist)( void );
void (__cdecl *ProcessRdpList)( void );
void (__cdecl *ShowCFB)( void );
} RSP_INFO_1_1;
typedef struct {
/* Menu */
/* Items should have an ID between 5001 and 5100 */
HMENU hRSPMenu;
void (__cdecl *ProcessMenuItem) ( int ID );
/* Break Points */
BOOL UseBPoints;
char BPPanelName[20];
void (__cdecl *Add_BPoint) ( void );
void (__cdecl *CreateBPPanel) ( HWND hDlg, RECT rcBox );
void (__cdecl *HideBPPanel) ( void );
void (__cdecl *PaintBPPanel) ( PAINTSTRUCT ps );
void (__cdecl *ShowBPPanel) ( void );
void (__cdecl *RefreshBpoints) ( HWND hList );
void (__cdecl *RemoveBpoint) ( HWND hList, int index );
void (__cdecl *RemoveAllBpoint) ( void );
/* RSP command Window */
void (__cdecl *Enter_RSP_Commands_Window) ( void );
} RSPDEBUG_INFO;
typedef struct {
/* Menu */
/* Items should have an ID between 5101 and 5200 */
HMENU hGFXMenu;
void (__cdecl *ProcessMenuItem) ( int ID );
/* Break Points */
BOOL UseBPoints;
char BPPanelName[20];
void (__cdecl *Add_BPoint) ( void );
void (__cdecl *CreateBPPanel) ( HWND hDlg, RECT rcBox );
void (__cdecl *HideBPPanel) ( void );
void (__cdecl *PaintBPPanel) ( PAINTSTRUCT ps );
void (__cdecl *ShowBPPanel) ( void );
void (__cdecl *RefreshBpoints) ( HWND hList );
void (__cdecl *RemoveBpoint) ( HWND hList, int index );
void (__cdecl *RemoveAllBpoint) ( void );
/* GFX command Window */
void (__cdecl *Enter_GFX_Commands_Window) ( void );
} GFXDEBUG_INFO;
typedef struct {
void (__cdecl *UpdateBreakPoints)( void );
void (__cdecl *UpdateMemory)( void );
void (__cdecl *UpdateR4300iRegisters)( void );
void (__cdecl *Enter_BPoint_Window)( void );
void (__cdecl *Enter_R4300i_Commands_Window)( void );
void (__cdecl *Enter_R4300i_Register_Window)( void );
void (__cdecl *Enter_RSP_Commands_Window) ( void );
void (__cdecl *Enter_Memory_Window)( void );
} DEBUG_INFO;
typedef struct {
HWND hwnd;
HINSTANCE hinst;
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom
// This will be in the same memory format as the rest of the memory.
BYTE * RDRAM;
BYTE * DMEM;
BYTE * IMEM;
DWORD * MI__INTR_REG;
DWORD * AI__DRAM_ADDR_REG;
DWORD * AI__LEN_REG;
DWORD * AI__CONTROL_REG;
DWORD * AI__STATUS_REG;
DWORD * AI__DACRATE_REG;
DWORD * AI__BITRATE_REG;
void (__cdecl *CheckInterrupts)( void );
} AUDIO_INFO;
typedef union {
DWORD Value;
struct {
unsigned R_DPAD : 1;
unsigned L_DPAD : 1;
unsigned D_DPAD : 1;
unsigned U_DPAD : 1;
unsigned START_BUTTON : 1;
unsigned Z_TRIG : 1;
unsigned B_BUTTON : 1;
unsigned A_BUTTON : 1;
unsigned R_CBUTTON : 1;
unsigned L_CBUTTON : 1;
unsigned D_CBUTTON : 1;
unsigned U_CBUTTON : 1;
unsigned R_TRIG : 1;
unsigned L_TRIG : 1;
unsigned Reserved1 : 1;
unsigned Reserved2 : 1;
signed Y_AXIS : 8;
signed X_AXIS : 8;
};
} BUTTONS;
/*** Conteroller plugin's ****/
#define PLUGIN_NONE 1
#define PLUGIN_MEMPAK 2
#define PLUGIN_RUMBLE_PAK 3
#define PLUGIN_TANSFER_PAK 4 // not implemeted for non raw data
#define PLUGIN_RAW 5 // the controller plugin is passed in raw data
/******** All DLLs have this function **************/
void (__cdecl *GetDllInfo) ( PLUGIN_INFO * PluginInfo );
/********** RSP DLL: Functions *********************/
void (__cdecl *GetRspDebugInfo) ( RSPDEBUG_INFO * DebugInfo );
void (__cdecl *RSPCloseDLL) ( void );
void (__cdecl *RSPDllAbout) ( HWND hWnd );
void (__cdecl *RSPDllConfig) ( HWND hWnd );
void (__cdecl *RSPRomClosed) ( void );
DWORD (__cdecl *DoRspCycles) ( DWORD );
void (__cdecl *InitiateRSP_1_0) ( RSP_INFO_1_0 Rsp_Info, DWORD * Cycles);
void (__cdecl *InitiateRSP_1_1) ( RSP_INFO_1_1 Rsp_Info, DWORD * Cycles);
void (__cdecl *InitiateRSPDebugger)( DEBUG_INFO DebugInfo);
/********** GFX DLL: Functions *********************/
void (__cdecl *CaptureScreen) ( char * );
void (__cdecl *ChangeWindow) ( void );
void (__cdecl *GetGfxDebugInfo) ( GFXDEBUG_INFO * GFXDebugInfo );
void (__cdecl *GFXCloseDLL) ( void );
void (__cdecl *GFXDllAbout) ( HWND hParent );
void (__cdecl *GFXDllConfig) ( HWND hParent );
void (__cdecl *GfxRomClosed) ( void );
void (__cdecl *GfxRomOpen) ( void );
void (__cdecl *DrawScreen) ( void );
void (__cdecl *FrameBufferRead) ( DWORD addr );
void (__cdecl *FrameBufferWrite) ( DWORD addr, DWORD Bytes );
BOOL (__cdecl *InitiateGFX) ( GFX_INFO Gfx_Info );
void (__cdecl *InitiateGFXDebugger)( DEBUG_INFO DebugInfo);
void (__cdecl *MoveScreen) ( int xpos, int ypos );
void (__cdecl *ProcessDList) ( void );
void (__cdecl *ProcessRDPList) ( void );
void (__cdecl *ShowCFB) ( void );
void (__cdecl *UpdateScreen) ( void );
void (__cdecl *ViStatusChanged) ( void );
void (__cdecl *ViWidthChanged) ( void );
/************ Audio DLL: Functions *****************/
void (__cdecl *AiCloseDLL) ( void );
void (__cdecl *AiDacrateChanged) ( int SystemType );
void (__cdecl *AiLenChanged) ( void );
void (__cdecl *AiDllAbout) ( HWND hParent );
void (__cdecl *AiDllConfig) ( HWND hParent );
void (__cdecl *AiDllTest) ( HWND hParent );
DWORD (__cdecl *AiReadLength) ( void );
void (__cdecl *AiRomClosed) ( void );
void (__cdecl *AiUpdate) ( BOOL Wait );
BOOL (__cdecl *InitiateAudio) ( AUDIO_INFO Audio_Info );
void (__cdecl *ProcessAList) ( void );
/********** Controller DLL: Functions **************/
void (__cdecl *ContCloseDLL) ( void );
void (__cdecl *ControllerCommand)( int Control, BYTE * Command );
void (__cdecl *ContDllAbout) ( HWND hParent );
void (__cdecl *ContConfig) ( HWND hParent );
void (__cdecl *InitiateControllers_1_0)( HWND hMainWindow, CONTROL Controls[4] );
void (__cdecl *InitiateControllers_1_1)( CONTROL_INFO ControlInfo );
void (__cdecl *GetKeys) ( int Control, BUTTONS * Keys );
void (__cdecl *ReadController) ( int Control, BYTE * Command );
void (__cdecl *ContRomOpen) ( void );
void (__cdecl *ContRomClosed) ( void );
void (__cdecl *WM_KeyDown) ( WPARAM wParam, LPARAM lParam );
void (__cdecl *WM_KeyUp) ( WPARAM wParam, LPARAM lParam );
void (__cdecl *RumbleCommand) ( int Control, BOOL bRumble );
/********** Plugin: Functions *********************/
void GetPluginDir ( char * Directory );
void GetSnapShotDir ( char * Directory );
void PluginConfiguration ( HWND hWnd );
void SetupPlugins ( HWND hWnd );
void SetupPluginScreen ( HWND hDlg );
void ShutdownPlugins ( void );
/********** External Global Variables ***************/
#define MaxDlls 100
extern char RspDLL[100], GfxDLL[100], AudioDLL[100],ControllerDLL[100], * PluginNames[MaxDlls];
extern DWORD PluginCount, RspTaskValue, AudioIntrReg;
extern GFXDEBUG_INFO GFXDebug;
extern RSPDEBUG_INFO RspDebug;
extern CONTROL Controllers[4];
extern WORD RSPVersion;
extern BOOL PluginsInitilized;