~ubuntu-branches/ubuntu/precise/mupen64plus/precise

« back to all changes in this revision

Viewing changes to rice_video/Graphics_1.3.h

  • Committer: Bazaar Package Importer
  • Author(s): Sven Eckelmann
  • Date: 2009-09-08 22:17:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090908221700-yela0ckgc1xwiqtn
Tags: upstream-1.5+dfsg1
ImportĀ upstreamĀ versionĀ 1.5+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
2
 *   Mupen64plus - Graphics_1.3.h                                          *
 
3
 *   Mupen64Plus homepage: http://code.google.com/p/mupen64plus/           *
 
4
 *   Copyright (C) 2002 Zilmar                                             *
 
5
 *                                                                         *
 
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.                                   *
 
10
 *                                                                         *
 
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.                          *
 
15
 *                                                                         *
 
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
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
21
 
 
22
/***********************************************************************************
 
23
 
 
24
Notes:
 
25
------
 
26
 
 
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 
 
29
the plugin.
 
30
 
 
31
The Setting of the RSP flags and generating an SP interrupt  should not be done in
 
32
the plugin
 
33
 
 
34
**********************************************************************************/
 
35
#ifndef _GFX_H_INCLUDED__
 
36
#define _GFX_H_INCLUDED__
 
37
 
 
38
#if defined(__cplusplus)
 
39
extern "C" {
 
40
#endif
 
41
 
 
42
/* Plugin types */
 
43
#define PLUGIN_TYPE_GFX             2
 
44
 
 
45
#define EXPORT                      __declspec(dllexport)
 
46
#define CALL                        _cdecl
 
47
 
 
48
#ifndef __PLUGIN_INFO__
 
49
#define __PLUGIN_INFO__
 
50
/***** Structures *****/
 
51
typedef struct {
 
52
    WORD Version;        /* Set to 0x0103 */
 
53
    WORD Type;           /* Set to PLUGIN_TYPE_GFX */
 
54
    char Name[100];      /* Name of the DLL */
 
55
 
 
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 */
 
61
} PLUGIN_INFO;
 
62
#endif //__PLUGIN_INFO
 
63
 
 
64
typedef struct {
 
65
    HWND hWnd;          /* Render window */
 
66
    HWND hStatusBar;    /* if render window does not have a status bar then this is NULL */
 
67
 
 
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:
 
71
                           //        4 3 2 1   8 7 6 5
 
72
 
 
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.
 
75
    BYTE * RDRAM;
 
76
    BYTE * DMEM;
 
77
    BYTE * IMEM;
 
78
 
 
79
    DWORD * MI_INTR_REG;
 
80
 
 
81
    DWORD * DPC_START_REG;
 
82
    DWORD * DPC_END_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;
 
88
    DWORD * DPC_TMEM_REG;
 
89
 
 
90
    DWORD * VI_STATUS_REG;
 
91
    DWORD * VI_ORIGIN_REG;
 
92
    DWORD * VI_WIDTH_REG;
 
93
    DWORD * VI_INTR_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;
 
98
    DWORD * VI_LEAP_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;
 
104
 
 
105
    void (*CheckInterrupts)( void );
 
106
} GFX_INFO;
 
107
 
 
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
 
112
  output:   none
 
113
*******************************************************************/ 
 
114
EXPORT void CALL CaptureScreen ( char * Directory );
 
115
 
 
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.
 
121
  input:    none
 
122
  output:   none
 
123
*******************************************************************/ 
 
124
EXPORT void CALL ChangeWindow (void);
 
125
 
 
126
/******************************************************************
 
127
  Function: CloseDLL
 
128
  Purpose:  This function is called when the emulator is closing
 
129
            down allowing the dll to de-initialise.
 
130
  input:    none
 
131
  output:   none
 
132
*******************************************************************/ 
 
133
EXPORT void CALL CloseDLL (void);
 
134
 
 
135
/******************************************************************
 
136
  Function: DllAbout
 
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
 
140
  output:   none
 
141
*******************************************************************/ 
 
142
EXPORT void CALL DllAbout ( HWND hParent );
 
143
 
 
144
/******************************************************************
 
145
  Function: DllConfig
 
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
 
149
  output:   none
 
150
*******************************************************************/ 
 
151
EXPORT void CALL DllConfig ( HWND hParent );
 
152
 
 
153
/******************************************************************
 
154
  Function: DllTest
 
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
 
158
  output:   none
 
159
*******************************************************************/ 
 
160
EXPORT void CALL DllTest ( HWND hParent );
 
161
 
 
162
/******************************************************************
 
163
  Function: DrawScreen
 
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.
 
167
  input:    none
 
168
  output:   none
 
169
*******************************************************************/ 
 
170
EXPORT void CALL DrawScreen (void);
 
171
 
 
172
/******************************************************************
 
173
  Function: GetDllInfo
 
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)
 
178
  output:   none
 
179
*******************************************************************/ 
 
180
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
 
181
 
 
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
 
188
            above.
 
189
  Output:   TRUE on success
 
190
            FALSE on failure to initialise
 
191
             
 
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);
 
198
 
 
199
/******************************************************************
 
200
  Function: MoveScreen
 
201
  Purpose:  This function is called in response to the emulator
 
202
            receiving a WM_MOVE passing the xpos and ypos passed
 
203
            from that message.
 
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. 
 
208
  output:   none
 
209
*******************************************************************/ 
 
210
EXPORT void CALL MoveScreen (int xpos, int ypos);
 
211
 
 
212
/******************************************************************
 
213
  Function: ProcessDList
 
214
  Purpose:  This function is called when there is a Dlist to be
 
215
            processed. (High level GFX list)
 
216
  input:    none
 
217
  output:   none
 
218
*******************************************************************/ 
 
219
EXPORT void CALL ProcessDList(void);
 
220
 
 
221
/******************************************************************
 
222
  Function: ProcessRDPList
 
223
  Purpose:  This function is called when there is a Dlist to be
 
224
            processed. (Low level GFX list)
 
225
  input:    none
 
226
  output:   none
 
227
*******************************************************************/ 
 
228
EXPORT void CALL ProcessRDPList(void);
 
229
 
 
230
/******************************************************************
 
231
  Function: RomClosed
 
232
  Purpose:  This function is called when a rom is closed.
 
233
  input:    none
 
234
  output:   none
 
235
*******************************************************************/ 
 
236
EXPORT void CALL RomClosed (void);
 
237
 
 
238
/******************************************************************
 
239
  Function: RomOpen
 
240
  Purpose:  This function is called when a rom is open. (from the 
 
241
            emulation thread)
 
242
  input:    none
 
243
  output:   none
 
244
*******************************************************************/ 
 
245
EXPORT void CALL RomOpen (void);
 
246
 
 
247
/******************************************************************
 
248
  Function: ShowCFB
 
249
  Purpose:  Useally once Dlists are started being displayed, cfb is
 
250
            ignored. This function tells the dll to start displaying
 
251
            them again.
 
252
  input:    none
 
253
  output:   none
 
254
*******************************************************************/ 
 
255
EXPORT void CALL ShowCFB (void);
 
256
 
 
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
 
261
            set
 
262
  input:    none
 
263
  output:   none
 
264
*******************************************************************/ 
 
265
EXPORT void CALL UpdateScreen (void);
 
266
 
 
267
/******************************************************************
 
268
  Function: ViStatusChanged
 
269
  Purpose:  This function is called to notify the dll that the
 
270
            ViStatus registers value has been changed.
 
271
  input:    none
 
272
  output:   none
 
273
*******************************************************************/ 
 
274
EXPORT void CALL ViStatusChanged (void);
 
275
 
 
276
/******************************************************************
 
277
  Function: ViWidthChanged
 
278
  Purpose:  This function is called to notify the dll that the
 
279
            ViWidth registers value has been changed.
 
280
  input:    none
 
281
  output:   none
 
282
*******************************************************************/ 
 
283
EXPORT void CALL ViWidthChanged (void);
 
284
 
 
285
/******************************************************************
 
286
  Function: ReadScreen
 
287
  Purpose:  Capture the current screen
 
288
  Input:    none
 
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);
 
294
 
 
295
/******************************************************************
 
296
   NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
 
297
         ORIGINAL SPEC
 
298
  Function: SetConfigDir
 
299
  Purpose:  To pass the location where config files should be read/
 
300
            written to.
 
301
  input:    path to config directory
 
302
  output:   none
 
303
*******************************************************************/
 
304
EXPORT void CALL SetConfigDir( char *configDir );
 
305
 
 
306
/******************************************************************
 
307
   NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
 
308
         ORIGINAL SPEC
 
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.
 
317
  output:   none
 
318
*******************************************************************/
 
319
EXPORT void CALL SetRenderingCallback(void (*callback)());
 
320
 
 
321
#if defined(__cplusplus)
 
322
}
 
323
#endif
 
324
#endif
 
325