1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
* Mupen64plus - Graphics_1.3.h *
3
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4
* Copyright (C) 2002 Zilmar *
6
* This program is free software; you can redistribute it and/or modify *
7
* it under the terms of the GNU General Public License as published by *
8
* the Free Software Foundation; either version 2 of the License, or *
9
* (at your option) any later version. *
11
* This program is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU General Public License for more details. *
16
* You should have received a copy of the GNU General Public License *
17
* along with this program; if not, write to the *
18
* Free Software Foundation, Inc., *
19
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22
/***********************************************************************************
27
Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which
28
are both passed to the DLL in InitiateGFX will generate an Interrupt from with in
31
The Setting of the RSP flags and generating an SP interrupt should not be done in
34
**********************************************************************************/
35
#ifndef _GFX_H_INCLUDED__
36
#define _GFX_H_INCLUDED__
38
#if defined(__cplusplus)
43
#define PLUGIN_TYPE_GFX 2
45
#define EXPORT __declspec(dllexport)
48
#ifndef __PLUGIN_INFO__
49
#define __PLUGIN_INFO__
50
/***** Structures *****/
52
WORD Version; /* Set to 0x0103 */
53
WORD Type; /* Set to PLUGIN_TYPE_GFX */
54
char Name[100]; /* Name of the DLL */
56
/* If DLL supports memory these memory options then set them to TRUE or FALSE
57
if it does not support it */
58
BOOL NormalMemory; /* a normal BYTE array */
59
BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre
60
bswap on a dword (32 bits) boundry */
62
#endif //__PLUGIN_INFO
65
HWND hWnd; /* Render window */
66
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
68
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
69
// bswap on a dword (32 bits) boundry
70
// eg. the first 8 bytes are stored like this:
73
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom
74
// This will be in the same memory format as the rest of the memory.
81
DWORD * DPC_START_REG;
83
DWORD * DPC_CURRENT_REG;
84
DWORD * DPC_STATUS_REG;
85
DWORD * DPC_CLOCK_REG;
86
DWORD * DPC_BUFBUSY_REG;
87
DWORD * DPC_PIPEBUSY_REG;
90
DWORD * VI_STATUS_REG;
91
DWORD * VI_ORIGIN_REG;
94
DWORD * VI_V_CURRENT_LINE_REG;
95
DWORD * VI_TIMING_REG;
96
DWORD * VI_V_SYNC_REG;
97
DWORD * VI_H_SYNC_REG;
99
DWORD * VI_H_START_REG;
100
DWORD * VI_V_START_REG;
101
DWORD * VI_V_BURST_REG;
102
DWORD * VI_X_SCALE_REG;
103
DWORD * VI_Y_SCALE_REG;
105
void (*CheckInterrupts)( void );
108
/******************************************************************
109
Function: CaptureScreen
110
Purpose: This function dumps the current frame to a file
111
input: pointer to the directory to save the file to
113
*******************************************************************/
114
EXPORT void CALL CaptureScreen ( char * Directory );
116
/******************************************************************
117
Function: ChangeWindow
118
Purpose: to change the window between fullscreen and window
119
mode. If the window was in fullscreen this should
120
change the screen to window mode and vice vesa.
123
*******************************************************************/
124
EXPORT void CALL ChangeWindow (void);
126
/******************************************************************
128
Purpose: This function is called when the emulator is closing
129
down allowing the dll to de-initialise.
132
*******************************************************************/
133
EXPORT void CALL CloseDLL (void);
135
/******************************************************************
137
Purpose: This function is optional function that is provided
138
to give further information about the DLL.
139
input: a handle to the window that calls this function
141
*******************************************************************/
142
EXPORT void CALL DllAbout ( HWND hParent );
144
/******************************************************************
146
Purpose: This function is optional function that is provided
147
to allow the user to configure the dll
148
input: a handle to the window that calls this function
150
*******************************************************************/
151
EXPORT void CALL DllConfig ( HWND hParent );
153
/******************************************************************
155
Purpose: This function is optional function that is provided
156
to allow the user to test the dll
157
input: a handle to the window that calls this function
159
*******************************************************************/
160
EXPORT void CALL DllTest ( HWND hParent );
162
/******************************************************************
164
Purpose: This function is called when the emulator receives a
165
WM_PAINT message. This allows the gfx to fit in when
166
it is being used in the desktop.
169
*******************************************************************/
170
EXPORT void CALL DrawScreen (void);
172
/******************************************************************
174
Purpose: This function allows the emulator to gather information
175
about the dll by filling in the PluginInfo structure.
176
input: a pointer to a PLUGIN_INFO stucture that needs to be
177
filled by the function. (see def above)
179
*******************************************************************/
180
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
182
/******************************************************************
183
Function: InitiateGFX
184
Purpose: This function is called when the DLL is started to give
185
information from the emulator that the n64 graphics
186
uses. This is not called from the emulation thread.
187
Input: Gfx_Info is passed to this function which is defined
189
Output: TRUE on success
190
FALSE on failure to initialise
192
** note on interrupts **:
193
To generate an interrupt set the appropriate bit in MI_INTR_REG
194
and then call the function CheckInterrupts to tell the emulator
195
that there is a waiting interrupt.
196
*******************************************************************/
197
EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info);
199
/******************************************************************
201
Purpose: This function is called in response to the emulator
202
receiving a WM_MOVE passing the xpos and ypos passed
204
input: xpos - the x-coordinate of the upper-left corner of the
205
client area of the window.
206
ypos - y-coordinate of the upper-left corner of the
207
client area of the window.
209
*******************************************************************/
210
EXPORT void CALL MoveScreen (int xpos, int ypos);
212
/******************************************************************
213
Function: ProcessDList
214
Purpose: This function is called when there is a Dlist to be
215
processed. (High level GFX list)
218
*******************************************************************/
219
EXPORT void CALL ProcessDList(void);
221
/******************************************************************
222
Function: ProcessRDPList
223
Purpose: This function is called when there is a Dlist to be
224
processed. (Low level GFX list)
227
*******************************************************************/
228
EXPORT void CALL ProcessRDPList(void);
230
/******************************************************************
232
Purpose: This function is called when a rom is closed.
235
*******************************************************************/
236
EXPORT void CALL RomClosed (void);
238
/******************************************************************
240
Purpose: This function is called when a rom is open. (from the
244
*******************************************************************/
245
EXPORT void CALL RomOpen (void);
247
/******************************************************************
249
Purpose: Useally once Dlists are started being displayed, cfb is
250
ignored. This function tells the dll to start displaying
254
*******************************************************************/
255
EXPORT void CALL ShowCFB (void);
257
/******************************************************************
258
Function: UpdateScreen
259
Purpose: This function is called in response to a vsync of the
260
screen were the VI bit in MI_INTR_REG has already been
264
*******************************************************************/
265
EXPORT void CALL UpdateScreen (void);
267
/******************************************************************
268
Function: ViStatusChanged
269
Purpose: This function is called to notify the dll that the
270
ViStatus registers value has been changed.
273
*******************************************************************/
274
EXPORT void CALL ViStatusChanged (void);
276
/******************************************************************
277
Function: ViWidthChanged
278
Purpose: This function is called to notify the dll that the
279
ViWidth registers value has been changed.
282
*******************************************************************/
283
EXPORT void CALL ViWidthChanged (void);
285
/******************************************************************
287
Purpose: Capture the current screen
289
Output: dest - 24-bit RGB data
290
width - width of image
291
height - height of image
292
******************************************************************/
293
EXPORT void CALL ReadScreen (void **dest, int *width, int *height);
295
/******************************************************************
296
NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
298
Function: SetConfigDir
299
Purpose: To pass the location where config files should be read/
301
input: path to config directory
303
*******************************************************************/
304
EXPORT void CALL SetConfigDir( char *configDir );
306
/******************************************************************
307
NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
309
Function: SetRenderingCallback
310
Purpose: Allows emulator to register a callback function that will
311
be called by the graphics plugin just before the the
312
frame buffers are swapped.
313
This was added as a way for the emulator to draw emulator-
314
specific things to the screen, e.g. On-screen display.
315
input: pointer to callback function. The function expects
316
to receive the current window width and height.
318
*******************************************************************/
319
EXPORT void CALL SetRenderingCallback(void (*callback)());
321
#if defined(__cplusplus)