Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-video-glide64/src/Gfx1.3.h
2 views
1
/*
2
* Glide64 - Glide video plugin for Nintendo 64 emulators.
3
* Copyright (c) 2002 Dave2001
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public
16
* Licence along with this program; if not, write to the Free
17
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA
19
*/
20
21
//****************************************************************
22
//
23
// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
24
// Project started on December 29th, 2001
25
//
26
// To modify Glide64:
27
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
28
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
29
//
30
// Official Glide64 development channel: #Glide64 on EFnet
31
//
32
// Original author: Dave2001 ([email protected])
33
// Other authors: Gonetz, Gugaman
34
//
35
//****************************************************************
36
37
// ** NOTE: this file has been modified from it's original version, which can be
38
// downloaded along with Project64 **
39
40
/**********************************************************************************
41
Common gfx plugin spec, version #1.3 maintained by zilmar ([email protected])
42
43
All questions or suggestions should go through the mailing list.
44
http://www.egroups.com/group/Plugin64-Dev
45
***********************************************************************************
46
47
Notes:
48
------
49
50
Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which
51
are both passed to the DLL in InitiateGFX will generate an Interrupt from with in
52
the plugin.
53
54
The Setting of the RSP flags and generating an SP interrupt should not be done in
55
the plugin
56
57
**********************************************************************************/
58
59
// THIS FILE IS A PRECOMPILED HEADER TO DECREASE BUILD TIME. INCLUDE ALL STANDARD
60
// .H FILES HERE
61
62
#ifndef _GFX_H_INCLUDED__
63
#define _GFX_H_INCLUDED__
64
#include "m64p.h"
65
66
#if defined(WIN32) && defined(GCC)
67
// ZIGGY ARRRRGG what a pain in the #$@$
68
//# include "Gfx #1.3-mangling.h"
69
#ifdef GCC
70
#include <stdio.h>
71
//#define printf(...)
72
#endif
73
#endif
74
75
#define _WIN32_WINNT 0x0400
76
77
#ifdef _WIN32
78
#include <windows.h>
79
#else // _WIN32
80
#include "winlnxdefs.h"
81
#endif // _WIN32
82
#include <stdio.h>
83
84
#include <ostream>
85
#include <fstream>
86
87
#include <cstddef> // offsetof
88
#ifndef _WIN32
89
#include <cmath>
90
#endif
91
#ifdef _WIN32
92
#include <io.h>
93
#include <direct.h>
94
#include <mmsystem.h>
95
#include <commctrl.h>
96
#endif // _WIN32
97
#include <time.h>
98
#include <glide.h>
99
#include <g3ext.h>
100
#include "rdp.h"
101
102
#if defined(__cplusplus)
103
extern "C" {
104
#endif
105
106
// tooltips have an error on debug mode, this can be overcome by clicking ignore,
107
// but I'd rather just disable tooltips altogether since nobody else should
108
// have the debug version anyway.
109
#ifndef _DEBUG
110
//#ifndef __INTEL_COMPILER // tooltips don't work with intel compiler
111
#define USE_TOOLTIPS
112
//#endif
113
#endif
114
115
#ifndef VPDEBUG
116
# define _FINAL_RELEASE_
117
#endif
118
// #ifdef WIN32
119
// # define _FINAL_RELEASE_
120
// #else
121
// //# define _FINAL_RELEASE_
122
// #endif
123
124
//********
125
// Logging
126
127
// ********************************
128
// ** TAKE OUT BEFORE RELEASE!!! **
129
//#define LOGGING // log of spec functions called
130
//#define LOG_KEY // says "Key!!!" in the log when space bar is pressed
131
132
//#define LOG_UCODE
133
134
//#define ALTTAB_FIX
135
136
//#define EXTREME_LOGGING // lots of logging
137
// note that some of these things are inserted/removed
138
// from within the code & may not be changed by this define.
139
140
//#define TLUT_LOGGING // log every entry of the TLUT?
141
// ********************************
142
143
#define FPS // fps counter able? (not enabled necessarily)
144
145
#define LOGNOTKEY // Log if not pressing:
146
#ifdef WIN32
147
#define LOGKEY VK_LCONTROL // this key
148
#else
149
#include <SDL.h>
150
#define LOGKEY KMOD_LCTRL
151
inline int GetAsyncKeyState(int key) {
152
return (SDL_GetModState() & key) != 0;
153
}
154
#endif
155
156
#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
157
158
#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
159
// "The gfx plugin has caused an exception" instead.
160
161
#define FLUSH // flush the file buffer. slower logging, but makes sure
162
// the command is logged before continuing (in case of
163
// crash or exception, the log will not be cut short)
164
#ifndef _FINAL_RELEASE_
165
#define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option)
166
// Logging functions will not be compiled if this is not present.
167
//#define RDP_ERROR_LOG
168
#endif
169
170
#define FPS_FRAMES 10 // Number of frames in which to make an FPS count
171
172
//#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer,
173
// usually used to debug clamping issues.
174
175
176
// Usually enabled
177
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
178
179
#ifdef ALTTAB_FIX
180
extern HHOOK hhkLowLevelKybd;
181
extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
182
WPARAM wParam, LPARAM lParam);
183
#endif
184
185
// Simulations
186
//#define SIMULATE_VOODOO1
187
//#define SIMULATE_BANSHEE
188
//********
189
190
#ifdef EXT_LOGGING
191
extern std::ofstream extlog;
192
#define EXT(x) extlog.open("ext.txt",ios::app); extlog << x; extlog.close();
193
#else
194
#define EXT(x)
195
#endif
196
197
#ifndef _FINAL_RELEASE_
198
#define UNIMP_LOG // Keep enabled, option in dialog
199
#define BRIGHT_RED // Keep enabled, option in dialog
200
#endif
201
202
#define COLORED_DEBUGGER // ;) pretty colors
203
204
#ifdef FPS
205
extern LARGE_INTEGER perf_freq;
206
extern LARGE_INTEGER fps_last;
207
extern LARGE_INTEGER fps_next;
208
extern float fps;
209
extern DWORD fps_count;
210
#endif
211
212
// rdram mask at 0x400000 bytes (bah, not right for majora's mask)
213
//#define BMASK 0x7FFFFF
214
extern unsigned long BMASK;
215
#define WMASK 0x3FFFFF
216
#define DMASK 0x1FFFFF
217
218
extern int num_tmu;
219
extern int max_tex_size;
220
extern long sup_mirroring;
221
extern BOOL sup_32bit_tex;
222
extern DWORD update_screen_count;
223
224
extern DWORD resolutions[0x18][2];
225
226
//#define PERFORMANCE
227
#ifdef PERFORMANCE
228
extern __int64 perf_cur;
229
extern __int64 perf_next;
230
#endif
231
232
#ifdef LOGGING
233
extern std::ofstream loga;
234
#define LOG(x) loga.open("log.txt",ios::app); loga << x; loga.flush(); loga.close();
235
#else
236
#define LOG(x) WriteLog(M64MSG_VERBOSE, "%s", x);
237
#endif
238
239
240
#ifdef RDP_LOGGING
241
extern int dumping;
242
extern BOOL log_open;
243
extern std::ofstream rdp_log;
244
//#define rdp_log std::cerr;
245
#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { /*rdp_log.open ("rdp.txt");*/ log_open=TRUE; }
246
#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { /*rdp_log.close ();*/ log_open=FALSE; }
247
248
#ifdef LOGNOTKEY
249
#define RDP(x) EXT("RDP (...)\n"); if (dumping && settings.logging && log_open) { if (!(GetAsyncKeyState(LOGKEY)&0x8000)) { fprintf(stderr, x);/*rdp_log << x; rdp_log.flush();*/ } }
250
#else
251
#define RDP(x) EXT("RDP (...)\n"); if (dumping && settings.logging && log_open) { fprintf(stderr, x);/*rdp_log << x; rdp_log.flush();*/ }
252
#endif
253
254
#else
255
#define OPEN_RDP_LOG()
256
#define CLOSE_RDP_LOG()
257
#define RDP(x)
258
#endif
259
260
261
#ifdef RDP_ERROR_LOG
262
extern BOOL elog_open;
263
extern std::ofstream rdp_err;
264
//#define rdp_err std::cerr
265
#define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (settings.elogging && !elog_open) { /*rdp_err.open ("rdp_e.txt");*/ elog_open=TRUE; }
266
#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { /*rdp_err.close (); */elog_open=FALSE; }
267
#define RDP_E(x) if (dumping && settings.elogging) { FRDP_E (x); }
268
#else
269
#define OPEN_RDP_E_LOG()
270
#define CLOSE_RDP_E_LOG()
271
#define RDP_E(x)
272
#endif
273
274
275
#ifdef RDP_LOGGING
276
__inline void FRDP (const char *fmt, ...)
277
{
278
#ifdef RDP_LOGGING
279
if (!dumping || !settings.logging || !log_open) return;
280
281
#ifdef LOGNOTKEY
282
if (GetAsyncKeyState(LOGKEY)&0x8000) return;
283
#endif
284
285
va_list ap;
286
va_start(ap, fmt);
287
vsprintf(out_buf, fmt, ap);
288
RDP (out_buf);
289
va_end(ap);
290
#endif
291
}
292
__inline void FRDP_E (const char *fmt, ...)
293
{
294
#ifdef RDP_ERROR_LOG
295
if (!dumping || !settings.elogging || !elog_open) return;
296
297
#ifdef LOGNOTKEY
298
if (GetAsyncKeyState(LOGKEY)&0x8000) return;
299
#endif
300
301
sprintf (out_buf, "%08x: (%08x, %08x) ", rdp.pc[rdp.pc_i]-8, rdp.cmd0, rdp.cmd1);
302
rdp_err << out_buf;
303
304
va_list ap2;
305
va_start(ap2, fmt);
306
vsprintf(out_buf, fmt, ap2);
307
// rdp_err << out_buf;
308
// rdp_err.flush();
309
fprintf(stderr, out_buf);
310
va_end(ap2);
311
#endif
312
}
313
314
#else
315
#ifndef GCC
316
#define FRDP(...)
317
#define FRDP_E(...)
318
#else // _WIN32
319
inline void FRDP (const char *fmt, ...) {}
320
inline void FRDP_E (const char *fmt, ...) {}
321
#endif // _WIN32
322
#endif
323
324
325
extern BOOL fullscreen;
326
extern BOOL romopen;
327
extern BOOL to_fullscreen;
328
extern BOOL debugging;
329
extern HINSTANCE hInstance;
330
331
extern BOOL evoodoo;
332
extern BOOL ev_fullscreen;
333
334
extern BOOL exception;
335
336
extern PROPSHEETHEADER m_PropSheet;
337
extern PROPSHEETPAGE m_psp[3];
338
339
340
BOOL InitGfx (BOOL);
341
void ReleaseGfx ();
342
void DrawFrameBuffer ();
343
344
// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
345
// add to it.
346
__inline DWORD segoffset (DWORD so)
347
{
348
return (rdp.segment[(so>>24)&0x0f] + (so&BMASK))&BMASK;
349
}
350
351
/* Plugin types */
352
#define PLUGIN_TYPE_GFX 2
353
354
//TODO: remove
355
//#define EXPORT __declspec(dllexport)
356
//#define CALL _cdecl
357
358
/***** Structures *****/
359
typedef struct {
360
WORD Version; /* Set to 0x0103 */
361
WORD Type; /* Set to PLUGIN_TYPE_GFX */
362
char Name[100]; /* Name of the DLL */
363
364
/* If DLL supports memory these memory options then set them to TRUE or FALSE
365
if it does not support it */
366
BOOL NormalMemory; /* a normal BYTE array */
367
BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre
368
bswap on a dword (32 bits) boundry */
369
} PLUGIN_INFO;
370
371
#if 0
372
//TODO: remove
373
374
typedef struct {
375
HWND hWnd; /* Render window */
376
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
377
378
BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre
379
// bswap on a dword (32 bits) boundry
380
// eg. the first 8 bytes are stored like this:
381
// 4 3 2 1 8 7 6 5
382
383
BYTE * HEADER; // This is the rom header (first 40h bytes of the rom
384
// This will be in the same memory format as the rest of the memory.
385
BYTE * RDRAM;
386
BYTE * DMEM;
387
BYTE * IMEM;
388
389
DWORD * MI_INTR_REG;
390
391
DWORD * DPC_START_REG;
392
DWORD * DPC_END_REG;
393
DWORD * DPC_CURRENT_REG;
394
DWORD * DPC_STATUS_REG;
395
DWORD * DPC_CLOCK_REG;
396
DWORD * DPC_BUFBUSY_REG;
397
DWORD * DPC_PIPEBUSY_REG;
398
DWORD * DPC_TMEM_REG;
399
400
DWORD * VI_STATUS_REG;
401
DWORD * VI_ORIGIN_REG;
402
DWORD * VI_WIDTH_REG;
403
DWORD * VI_INTR_REG;
404
DWORD * VI_V_CURRENT_LINE_REG;
405
DWORD * VI_TIMING_REG;
406
DWORD * VI_V_SYNC_REG;
407
DWORD * VI_H_SYNC_REG;
408
DWORD * VI_LEAP_REG;
409
DWORD * VI_H_START_REG;
410
DWORD * VI_V_START_REG;
411
DWORD * VI_V_BURST_REG;
412
DWORD * VI_X_SCALE_REG;
413
DWORD * VI_Y_SCALE_REG;
414
415
void (*CheckInterrupts)( void );
416
} GFX_INFO;
417
#endif
418
419
extern GFX_INFO gfx;
420
extern BOOL no_dlist;
421
422
typedef GrContext_t (FX_CALL *GRWINOPENEXT)( FxU32 hWnd,
423
GrScreenResolution_t resolution,
424
GrScreenRefresh_t refresh,
425
GrColorFormat_t format,
426
GrOriginLocation_t origin,
427
GrPixelFormat_t pixelformat,
428
int nColBuffers,
429
int nAuxBuffers) ;
430
431
typedef void (FX_CALL *GRTEXBUFFEREXT)( GrChipID_t tmu,
432
FxU32 startAddress,
433
GrLOD_t lodmin,
434
GrLOD_t lodmax,
435
GrAspectRatio_t aspect,
436
GrTextureFormat_t fmt,
437
FxU32 evenOdd) ;
438
439
typedef void (FX_CALL *GRAUXBUFFEREXT)( GrBuffer_t buffer ) ;
440
441
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
442
GrCombineMode_t a_mode,
443
GrCCUColor_t b,
444
GrCombineMode_t b_mode,
445
GrCCUColor_t c,
446
FxBool c_invert,
447
GrCCUColor_t d,
448
FxBool d_invert,
449
FxU32 shift,
450
FxBool invert) ;
451
452
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu,
453
GrTCCUColor_t a,
454
GrCombineMode_t a_mode,
455
GrTCCUColor_t b,
456
GrCombineMode_t b_mode,
457
GrTCCUColor_t c,
458
FxBool c_invert,
459
GrTCCUColor_t d,
460
FxBool d_invert,
461
FxU32 shift,
462
FxBool invert);
463
464
typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
465
(GrChipID_t tmu,
466
GrColor_t value);
467
468
typedef void (FX_CALL *GRSTIPPLE)( FxI32 mode) ;
469
470
typedef void (FX_CALL *GRCONFIGWRAPPEREXT)(HINSTANCE instance, HWND hwnd);
471
472
typedef GrScreenResolution_t (FX_CALL *GRWRAPPERFULLSCREENRESOLUTIONEXT)();
473
474
// ZIGGY framebuffer copy extension
475
// allow to copy the depth or color buffer from back/front to front/back
476
// (GL has separate back and front depth buffer, unlike glide, so this extension
477
// makes sense only in a wrapper)
478
#define GR_FBCOPY_MODE_DEPTH 0
479
#define GR_FBCOPY_MODE_COLOR 1
480
#define GR_FBCOPY_BUFFER_BACK 0
481
#define GR_FBCOPY_BUFFER_FRONT 1
482
typedef void (FX_CALL *GRFRAMEBUFFERCOPYEXT)(int x, int y, int w, int h,
483
int buffer_from, int buffer_to, int mode);
484
485
extern GRFRAMEBUFFERCOPYEXT grFramebufferCopyExt;
486
487
extern GRTEXBUFFEREXT grTextureBufferExt;
488
extern GRTEXBUFFEREXT grTextureAuxBufferExt;
489
extern GRAUXBUFFEREXT grAuxBufferExt;
490
extern GRSTIPPLE grStippleModeExt;
491
extern GRSTIPPLE grStipplePatternExt;
492
493
#ifndef GR_STIPPLE_DISABLE
494
#define GR_STIPPLE_DISABLE 0x0
495
#define GR_STIPPLE_PATTERN 0x1
496
#define GR_STIPPLE_ROTATE 0x2
497
#endif
498
499
void ReadSettings ();
500
void ReadSpecialSettings (const char name[21]);
501
void WriteSettings ();
502
503
#if 0
504
//TODO: remove
505
/******************************************************************
506
Function: CaptureScreen
507
Purpose: This function dumps the current frame to a file
508
input: pointer to the directory to save the file to
509
output: none
510
*******************************************************************/
511
EXPORT void CALL CaptureScreen ( char * Directory );
512
513
/******************************************************************
514
Function: ChangeWindow
515
Purpose: to change the window between fullscreen and window
516
mode. If the window was in fullscreen this should
517
change the screen to window mode and vice vesa.
518
input: none
519
output: none
520
*******************************************************************/
521
EXPORT void CALL ChangeWindow (void);
522
523
/******************************************************************
524
Function: CloseDLL
525
Purpose: This function is called when the emulator is closing
526
down allowing the dll to de-initialise.
527
input: none
528
output: none
529
*******************************************************************/
530
EXPORT void CALL CloseDLL (void);
531
532
/******************************************************************
533
Function: DllAbout
534
Purpose: This function is optional function that is provided
535
to give further information about the DLL.
536
input: a handle to the window that calls this function
537
output: none
538
*******************************************************************/
539
EXPORT void CALL DllAbout ( HWND hParent );
540
541
/******************************************************************
542
Function: DllConfig
543
Purpose: This function is optional function that is provided
544
to allow the user to configure the dll
545
input: a handle to the window that calls this function
546
output: none
547
*******************************************************************/
548
EXPORT void CALL DllConfig ( HWND hParent );
549
550
/******************************************************************
551
Function: DllTest
552
Purpose: This function is optional function that is provided
553
to allow the user to test the dll
554
input: a handle to the window that calls this function
555
output: none
556
*******************************************************************/
557
EXPORT void CALL DllTest ( HWND hParent );
558
559
560
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
561
562
/******************************************************************
563
Function: DrawScreen
564
Purpose: This function is called when the emulator receives a
565
WM_PAINT message. This allows the gfx to fit in when
566
it is being used in the desktop.
567
input: none
568
output: none
569
*******************************************************************/
570
EXPORT void CALL DrawScreen (void);
571
572
/******************************************************************
573
Function: GetDllInfo
574
Purpose: This function allows the emulator to gather information
575
about the dll by filling in the PluginInfo structure.
576
input: a pointer to a PLUGIN_INFO stucture that needs to be
577
filled by the function. (see def above)
578
output: none
579
*******************************************************************/
580
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
581
582
/******************************************************************
583
Function: InitiateGFX
584
Purpose: This function is called when the DLL is started to give
585
information from the emulator that the n64 graphics
586
uses. This is not called from the emulation thread.
587
Input: Gfx_Info is passed to this function which is defined
588
above.
589
Output: TRUE on success
590
FALSE on failure to initialise
591
592
** note on interrupts **:
593
To generate an interrupt set the appropriate bit in MI_INTR_REG
594
and then call the function CheckInterrupts to tell the emulator
595
that there is a waiting interrupt.
596
*******************************************************************/
597
EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info);
598
599
/******************************************************************
600
Function: MoveScreen
601
Purpose: This function is called in response to the emulator
602
receiving a WM_MOVE passing the xpos and ypos passed
603
from that message.
604
input: xpos - the x-coordinate of the upper-left corner of the
605
client area of the window.
606
ypos - y-coordinate of the upper-left corner of the
607
client area of the window.
608
output: none
609
*******************************************************************/
610
EXPORT void CALL MoveScreen (int xpos, int ypos);
611
612
/******************************************************************
613
Function: ProcessDList
614
Purpose: This function is called when there is a Dlist to be
615
processed. (High level GFX list)
616
input: none
617
output: none
618
*******************************************************************/
619
EXPORT void CALL ProcessDList(void);
620
621
/******************************************************************
622
Function: ProcessRDPList
623
Purpose: This function is called when there is a Dlist to be
624
processed. (Low level GFX list)
625
input: none
626
output: none
627
*******************************************************************/
628
EXPORT void CALL ProcessRDPList(void);
629
630
/******************************************************************
631
Function: RomClosed
632
Purpose: This function is called when a rom is closed.
633
input: none
634
output: none
635
*******************************************************************/
636
EXPORT void CALL RomClosed (void);
637
638
/******************************************************************
639
Function: RomOpen
640
Purpose: This function is called when a rom is open. (from the
641
emulation thread)
642
input: none
643
output: none
644
*******************************************************************/
645
EXPORT void CALL RomOpen (void);
646
647
/******************************************************************
648
Function: ShowCFB
649
Purpose: Useally once Dlists are started being displayed, cfb is
650
ignored. This function tells the dll to start displaying
651
them again.
652
input: none
653
output: none
654
*******************************************************************/
655
EXPORT void CALL ShowCFB (void);
656
657
/******************************************************************
658
Function: UpdateScreen
659
Purpose: This function is called in response to a vsync of the
660
screen were the VI bit in MI_INTR_REG has already been
661
set
662
input: none
663
output: none
664
*******************************************************************/
665
EXPORT void CALL UpdateScreen (void);
666
667
/******************************************************************
668
Function: ViStatusChanged
669
Purpose: This function is called to notify the dll that the
670
ViStatus registers value has been changed.
671
input: none
672
output: none
673
*******************************************************************/
674
EXPORT void CALL ViStatusChanged (void);
675
676
/******************************************************************
677
Function: ViWidthChanged
678
Purpose: This function is called to notify the dll that the
679
ViWidth registers value has been changed.
680
input: none
681
output: none
682
*******************************************************************/
683
EXPORT void CALL ViWidthChanged (void);
684
685
686
/******************************************************************
687
Function: FrameBufferWrite
688
Purpose: This function is called to notify the dll that the
689
frame buffer has been modified by CPU at the given address.
690
input: addr rdram address
691
val val
692
size 1 = BYTE, 2 = WORD, 4 = DWORD
693
output: none
694
*******************************************************************/
695
EXPORT void CALL FBWrite(DWORD, DWORD);
696
697
typedef struct
698
{
699
DWORD addr;
700
DWORD val;
701
DWORD size; // 1 = BYTE, 2 = WORD, 4=DWORD
702
} FrameBufferModifyEntry;
703
704
/******************************************************************
705
Function: FrameBufferWriteList
706
Purpose: This function is called to notify the dll that the
707
frame buffer has been modified by CPU at the given address.
708
input: FrameBufferModifyEntry *plist
709
size = size of the plist, max = 1024
710
output: none
711
*******************************************************************/
712
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, DWORD size);
713
714
/******************************************************************
715
Function: FrameBufferRead
716
Purpose: This function is called to notify the dll that the
717
frame buffer memory is beening read at the given address.
718
DLL should copy content from its render buffer to the frame buffer
719
in N64 RDRAM
720
DLL is responsible to maintain its own frame buffer memory addr list
721
DLL should copy 4KB block content back to RDRAM frame buffer.
722
Emulator should not call this function again if other memory
723
is read within the same 4KB range
724
input: addr rdram address
725
val val
726
size 1 = BYTE, 2 = WORD, 4 = DWORD
727
output: none
728
*******************************************************************/
729
EXPORT void CALL FBRead(DWORD addr);
730
731
/************************************************************************
732
Function: FBGetFrameBufferInfo
733
Purpose: This function is called by the emulator core to retrieve depth
734
buffer information from the video plugin in order to be able
735
to notify the video plugin about CPU depth buffer read/write
736
operations
737
738
size:
739
= 1 byte
740
= 2 word (16 bit) <-- this is N64 default depth buffer format
741
= 4 dword (32 bit)
742
743
when depth buffer information is not available yet, set all values
744
in the FrameBufferInfo structure to 0
745
746
input: FrameBufferInfo *pinfo
747
pinfo is pointed to a FrameBufferInfo structure which to be
748
filled in by this function
749
output: Values are return in the FrameBufferInfo structure
750
************************************************************************/
751
EXPORT void CALL FBGetFrameBufferInfo(void *pinfo);
752
753
/******************************************************************
754
NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
755
ORIGINAL SPEC
756
Function: SetConfigDir
757
Purpose: To pass the location where config files should be read/
758
written to.
759
input: path to config directory
760
output: none
761
*******************************************************************/
762
EXPORT void CALL SetConfigDir( char *configDir );
763
764
/******************************************************************
765
NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
766
ORIGINAL SPEC
767
Function: SetRenderingCallback
768
Purpose: Allows emulator to register a callback function that will
769
be called by the graphics plugin just before the the
770
frame buffers are swapped.
771
This was added as a way for the emulator to draw emulator-
772
specific things to the screen, e.g. On-screen display.
773
input: pointer to callback function. The function expects
774
to receive the current window width and height.
775
output: none
776
*******************************************************************/
777
EXPORT void CALL SetRenderingCallback(void (*callback)());
778
#endif
779
#if defined(__cplusplus)
780
}
781
#endif
782
#endif //_GFX_H_INCLUDED__
783
784
785