[Glide64] Cleanup Gfx_1.3.h

This commit is contained in:
zilmar 2016-01-20 19:37:38 +11:00
parent 28f0dd7388
commit 6d74a71bd1
1 changed files with 392 additions and 400 deletions

View File

@ -99,24 +99,24 @@ extern "C" {
#define _ENDUSER_RELEASE_ #define _ENDUSER_RELEASE_
//******** //********
// Logging // Logging
// ******************************** // ********************************
// ** TAKE OUT BEFORE RELEASE!!! ** // ** TAKE OUT BEFORE RELEASE!!! **
//#define LOGGING // log of spec functions called //#define LOGGING // log of spec functions called
//#define LOG_KEY // says "Key!!!" in the log when space bar is pressed //#define LOG_KEY // says "Key!!!" in the log when space bar is pressed
//#define LOG_UCODE //#define LOG_UCODE
//#define ALTTAB_FIX //#define ALTTAB_FIX
//#define EXTREME_LOGGING // lots of logging //#define EXTREME_LOGGING // lots of logging
// note that some of these things are inserted/removed // note that some of these things are inserted/removed
// from within the code & may not be changed by this define. // from within the code & may not be changed by this define.
//#define TLUT_LOGGING // log every entry of the TLUT? //#define TLUT_LOGGING // log every entry of the TLUT?
// ******************************** // ********************************
#define FPS // fps counter able? (not enabled necessarily) #define FPS // fps counter able? (not enabled necessarily)
@ -125,40 +125,39 @@ extern "C" {
#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........) #define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
//#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report //#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
// "The gfx plugin has caused an exception" instead. // "The gfx plugin has caused an exception" instead.
#define FLUSH // flush the file buffer. slower logging, but makes sure #define FLUSH // flush the file buffer. slower logging, but makes sure
// the command is logged before continuing (in case of // the command is logged before continuing (in case of
// crash or exception, the log will not be cut short) // crash or exception, the log will not be cut short)
#ifndef _ENDUSER_RELEASE_ #ifndef _ENDUSER_RELEASE_
#define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option) #define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option)
// Logging functions will not be compiled if this is not present. // Logging functions will not be compiled if this is not present.
//#define RDP_ERROR_LOG //#define RDP_ERROR_LOG
#endif #endif
#define FPS_FRAMES 10 // Number of frames in which to make an FPS count #define FPS_FRAMES 10 // Number of frames in which to make an FPS count
//#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer, //#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer,
// usually used to debug clamping issues. // usually used to debug clamping issues.
// Usually enabled
// Usually enabled
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split? #define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
#ifdef ALTTAB_FIX #ifdef ALTTAB_FIX
extern HHOOK hhkLowLevelKybd; extern HHOOK hhkLowLevelKybd;
extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode, extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam); WPARAM wParam, LPARAM lParam);
#endif #endif
// Simulations // Simulations
//#define SIMULATE_VOODOO1 //#define SIMULATE_VOODOO1
//#define SIMULATE_BANSHEE //#define SIMULATE_BANSHEE
//******** //********
#ifdef EXT_LOGGING #ifdef EXT_LOGGING
extern std::ofstream extlog; extern std::ofstream extlog;
#define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close(); #define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close();
#else #else
#define EXT(x) #define EXT(x)
@ -172,40 +171,39 @@ extern std::ofstream extlog;
#define COLORED_DEBUGGER // ;) pretty colors #define COLORED_DEBUGGER // ;) pretty colors
#ifdef FPS #ifdef FPS
extern wxDateTime fps_last; extern wxDateTime fps_last;
extern wxDateTime fps_next; extern wxDateTime fps_next;
extern float fps; extern float fps;
extern wxUint32 fps_count; extern wxUint32 fps_count;
#endif #endif
// rdram mask at 0x400000 bytes (bah, not right for majora's mask) // rdram mask at 0x400000 bytes (bah, not right for majora's mask)
//#define BMASK 0x7FFFFF //#define BMASK 0x7FFFFF
extern unsigned int BMASK; extern unsigned int BMASK;
#define WMASK 0x3FFFFF #define WMASK 0x3FFFFF
#define DMASK 0x1FFFFF #define DMASK 0x1FFFFF
extern wxUint32 update_screen_count; extern wxUint32 update_screen_count;
extern wxUint32 resolutions[0x18][2]; extern wxUint32 resolutions[0x18][2];
int CheckKeyPressed(int key, int mask); int CheckKeyPressed(int key, int mask);
//#define PERFORMANCE //#define PERFORMANCE
#ifdef PERFORMANCE #ifdef PERFORMANCE
extern int64 perf_cur; extern int64 perf_cur;
extern int64 perf_next; extern int64 perf_next;
#endif #endif
#ifdef LOGGING #ifdef LOGGING
extern std::ofstream loga; extern std::ofstream loga;
#define LOG(x) loga.open("glide64_log.txt",std::ios::app); loga << x; loga.flush(); loga.close(); #define LOG(x) loga.open("glide64_log.txt",std::ios::app); loga << x; loga.flush(); loga.close();
#else #else
#define LOG(x) #define LOG(x)
#endif #endif
#ifdef RDP_LOGGING #ifdef RDP_LOGGING
extern int log_open; extern int log_open;
extern std::ofstream rdp_log; extern std::ofstream rdp_log;
#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; } #define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; }
#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { rdp_log.close (); log_open=FALSE; } #define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { rdp_log.close (); log_open=FALSE; }
@ -221,10 +219,9 @@ extern std::ofstream rdp_log;
#define LRDP(x) #define LRDP(x)
#endif #endif
#ifdef RDP_ERROR_LOG #ifdef RDP_ERROR_LOG
extern int elog_open; extern int elog_open;
extern std::ofstream rdp_err; extern std::ofstream rdp_err;
#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; } #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; }
#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { rdp_err.close (); elog_open=FALSE; } #define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { rdp_err.close (); elog_open=FALSE; }
#define RDP_E(x) if (settings.elogging) { FRDP_E (x); } #define RDP_E(x) if (settings.elogging) { FRDP_E (x); }
@ -235,69 +232,69 @@ extern std::ofstream rdp_err;
#endif #endif
#ifdef RDP_LOGGING #ifdef RDP_LOGGING
__inline void FRDP (const char *fmt, ...) __inline void FRDP(const char *fmt, ...)
{ {
if (!settings.logging || !log_open) return; if (!settings.logging || !log_open) return;
#ifdef LOGNOTKEY #ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY,0x8000)) return; if (CheckKeyPressed(LOGKEY, 0x8000)) return;
#endif #endif
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(out_buf, fmt, ap); vsprintf(out_buf, fmt, ap);
LRDP (out_buf); LRDP(out_buf);
va_end(ap); va_end(ap);
} }
#else #else
__inline void FRDP (const char * /*fmt*/, ...) {} __inline void FRDP(const char * /*fmt*/, ...) {}
#endif #endif
#ifdef RDP_ERROR_LOG #ifdef RDP_ERROR_LOG
__inline void FRDP_E (const char *fmt, ...) __inline void FRDP_E(const char *fmt, ...)
{ {
if (!settings.elogging || !elog_open) return; if (!settings.elogging || !elog_open) return;
#ifdef LOGNOTKEY #ifdef LOGNOTKEY
if (CheckKeyPressed(LOGKEY,0x8000)) return; if (CheckKeyPressed(LOGKEY, 0x8000)) return;
#endif #endif
sprintf (out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i]-8, rdp.cmd0, rdp.cmd1); sprintf(out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i] - 8, rdp.cmd0, rdp.cmd1);
rdp_err << out_buf; rdp_err << out_buf;
va_list ap2; va_list ap2;
va_start(ap2, fmt); va_start(ap2, fmt);
vsprintf(out_buf, fmt, ap2); vsprintf(out_buf, fmt, ap2);
rdp_err << out_buf; rdp_err << out_buf;
rdp_err.flush(); rdp_err.flush();
va_end(ap2); va_end(ap2);
} }
#else #else
__inline void FRDP_E (const char * /*fmt*/, ...) {} __inline void FRDP_E(const char * /*fmt*/, ...) {}
#endif #endif
extern int fullscreen; extern int fullscreen;
extern int romopen; extern int romopen;
extern int to_fullscreen; extern int to_fullscreen;
extern int debugging; extern int debugging;
extern int evoodoo; extern int evoodoo;
extern int ev_fullscreen; extern int ev_fullscreen;
extern int exception; extern int exception;
extern wxMutex *mutexProcessDList; extern wxMutex *mutexProcessDList;
int InitGfx (); int InitGfx();
void ReleaseGfx (); void ReleaseGfx();
// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to // The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
// add to it. // add to it.
__inline wxUint32 segoffset (wxUint32 so) __inline wxUint32 segoffset(wxUint32 so)
{ {
return (rdp.segment[(so>>24)&0x0f] + (so&BMASK))&BMASK; return (rdp.segment[(so >> 24) & 0x0f] + (so&BMASK))&BMASK;
} }
/* Plugin types */ /* Plugin types */
#define PLUGIN_TYPE_GFX 2 #define PLUGIN_TYPE_GFX 2
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -308,104 +305,101 @@ __inline wxUint32 segoffset (wxUint32 so)
#define CALL #define CALL
#endif #endif
/***** Structures *****/ /***** Structures *****/
typedef struct { typedef struct {
wxUint16 Version; /* Set to 0x0103 */ wxUint16 Version; /* Set to 0x0103 */
wxUint16 Type; /* Set to PLUGIN_TYPE_GFX */ wxUint16 Type; /* Set to PLUGIN_TYPE_GFX */
char Name[100]; /* Name of the DLL */ char Name[100]; /* Name of the DLL */
/* If DLL supports memory these memory options then set them to TRUE or FALSE /* If DLL supports memory these memory options then set them to TRUE or FALSE
if it does not support it */ if it does not support it */
int NormalMemory; /* a normal wxUint8 array */ int NormalMemory; /* a normal wxUint8 array */
int MemoryBswaped; /* a normal wxUint8 array where the memory has been pre int MemoryBswaped; /* a normal wxUint8 array where the memory has been pre
bswap on a dword (32 bits) boundry */ bswap on a dword (32 bits) boundry */
} PLUGIN_INFO; } PLUGIN_INFO;
typedef struct { typedef struct {
HWND hWnd; /* Render window */ HWND hWnd; /* Render window */
HWND hStatusBar; /* if render window does not have a status bar then this is NULL */ HWND hStatusBar; /* if render window does not have a status bar then this is NULL */
int MemoryBswaped; // If this is set to TRUE, then the memory has been pre int MemoryBswaped; // If this is set to TRUE, then the memory has been pre
// bswap on a dword (32 bits) boundry // bswap on a dword (32 bits) boundry
// eg. the first 8 bytes are stored like this: // eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5 // 4 3 2 1 8 7 6 5
wxUint8 * HEADER; // This is the rom header (first 40h bytes of the rom wxUint8 * 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. // This will be in the same memory format as the rest of the memory.
wxUint8 * RDRAM; wxUint8 * RDRAM;
wxUint8 * DMEM; wxUint8 * DMEM;
wxUint8 * IMEM; wxUint8 * IMEM;
wxUint32 * MI_INTR_REG; wxUint32 * MI_INTR_REG;
wxUint32 * DPC_START_REG; wxUint32 * DPC_START_REG;
wxUint32 * DPC_END_REG; wxUint32 * DPC_END_REG;
wxUint32 * DPC_CURRENT_REG; wxUint32 * DPC_CURRENT_REG;
wxUint32 * DPC_STATUS_REG; wxUint32 * DPC_STATUS_REG;
wxUint32 * DPC_CLOCK_REG; wxUint32 * DPC_CLOCK_REG;
wxUint32 * DPC_BUFBUSY_REG; wxUint32 * DPC_BUFBUSY_REG;
wxUint32 * DPC_PIPEBUSY_REG; wxUint32 * DPC_PIPEBUSY_REG;
wxUint32 * DPC_TMEM_REG; wxUint32 * DPC_TMEM_REG;
wxUint32 * VI_STATUS_REG; wxUint32 * VI_STATUS_REG;
wxUint32 * VI_ORIGIN_REG; wxUint32 * VI_ORIGIN_REG;
wxUint32 * VI_WIDTH_REG; wxUint32 * VI_WIDTH_REG;
wxUint32 * VI_INTR_REG; wxUint32 * VI_INTR_REG;
wxUint32 * VI_V_CURRENT_LINE_REG; wxUint32 * VI_V_CURRENT_LINE_REG;
wxUint32 * VI_TIMING_REG; wxUint32 * VI_TIMING_REG;
wxUint32 * VI_V_SYNC_REG; wxUint32 * VI_V_SYNC_REG;
wxUint32 * VI_H_SYNC_REG; wxUint32 * VI_H_SYNC_REG;
wxUint32 * VI_LEAP_REG; wxUint32 * VI_LEAP_REG;
wxUint32 * VI_H_START_REG; wxUint32 * VI_H_START_REG;
wxUint32 * VI_V_START_REG; wxUint32 * VI_V_START_REG;
wxUint32 * VI_V_BURST_REG; wxUint32 * VI_V_BURST_REG;
wxUint32 * VI_X_SCALE_REG; wxUint32 * VI_X_SCALE_REG;
wxUint32 * VI_Y_SCALE_REG; wxUint32 * VI_Y_SCALE_REG;
void (*CheckInterrupts)( void ); void(*CheckInterrupts)(void);
} GFX_INFO; } GFX_INFO;
extern GFX_INFO gfx; extern GFX_INFO gfx;
extern wxWindow * GFXWindow; extern wxWindow * GFXWindow;
extern bool no_dlist; extern bool no_dlist;
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
GrCombineMode_t a_mode,
GrCCUColor_t b,
GrCombineMode_t b_mode,
GrCCUColor_t c,
FxBool c_invert,
GrCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu,
GrTCCUColor_t a,
GrCombineMode_t a_mode,
GrTCCUColor_t b,
GrCombineMode_t b_mode,
GrTCCUColor_t c,
FxBool c_invert,
GrTCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a, typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
GrCombineMode_t a_mode, (GrChipID_t tmu,
GrCCUColor_t b, GrColor_t value);
GrCombineMode_t b_mode,
GrCCUColor_t c,
FxBool c_invert,
GrCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert) ;
typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu, typedef void (FX_CALL *GRSTIPPLE)(FxI32 mode);
GrTCCUColor_t a,
GrCombineMode_t a_mode,
GrTCCUColor_t b,
GrCombineMode_t b_mode,
GrTCCUColor_t c,
FxBool c_invert,
GrTCCUColor_t d,
FxBool d_invert,
FxU32 shift,
FxBool invert);
typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT) typedef int(*GETTEXADDR)(int tmu, int texsize);
(GrChipID_t tmu,
GrColor_t value);
typedef void (FX_CALL *GRSTIPPLE)( FxI32 mode) ; extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
typedef int (*GETTEXADDR)(int tmu, int texsize);
extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
#ifndef GR_STIPPLE_DISABLE #ifndef GR_STIPPLE_DISABLE
#define GR_STIPPLE_DISABLE 0x0 #define GR_STIPPLE_DISABLE 0x0
@ -413,259 +407,257 @@ extern GETTEXADDR GetTexAddr;
#define GR_STIPPLE_ROTATE 0x2 #define GR_STIPPLE_ROTATE 0x2
#endif #endif
void ReadSettings (); void ReadSettings();
void ReadSpecialSettings (const char * name); void ReadSpecialSettings(const char * name);
void WriteSettings (bool saveEmulationSettings = false); void WriteSettings(bool saveEmulationSettings = false);
/****************************************************************** /******************************************************************
Function: CaptureScreen Function: CaptureScreen
Purpose: This function dumps the current frame to a file Purpose: This function dumps the current frame to a file
input: pointer to the directory to save the file to input: pointer to the directory to save the file to
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL CaptureScreen ( char * Directory ); EXPORT void CALL CaptureScreen(char * Directory);
/****************************************************************** /******************************************************************
Function: ChangeWindow Function: ChangeWindow
Purpose: to change the window between fullscreen and window Purpose: to change the window between fullscreen and window
mode. If the window was in fullscreen this should mode. If the window was in fullscreen this should
change the screen to window mode and vice vesa. change the screen to window mode and vice vesa.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ChangeWindow (void); EXPORT void CALL ChangeWindow(void);
/****************************************************************** /******************************************************************
Function: CloseDLL Function: CloseDLL
Purpose: This function is called when the emulator is closing Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise. down allowing the dll to de-initialise.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL CloseDLL (void); EXPORT void CALL CloseDLL(void);
/****************************************************************** /******************************************************************
Function: DllAbout Function: DllAbout
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to give further information about the DLL. to give further information about the DLL.
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllAbout ( HWND hParent ); EXPORT void CALL DllAbout(HWND hParent);
/****************************************************************** /******************************************************************
Function: DllConfig Function: DllConfig
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to configure the dll to allow the user to configure the dll
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllConfig ( HWND hParent ); EXPORT void CALL DllConfig(HWND hParent);
/****************************************************************** /******************************************************************
Function: DllTest Function: DllTest
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to test the dll to allow the user to test the dll
input: a handle to the window that calls this function input: a handle to the window that calls this function
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DllTest ( HWND hParent ); EXPORT void CALL DllTest(HWND hParent);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height);
EXPORT void CALL ReadScreen(void **dest, int *width, int *height); /******************************************************************
Function: DrawScreen
Purpose: This function is called when the emulator receives a
WM_PAINT message. This allows the gfx to fit in when
it is being used in the desktop.
input: none
output: none
*******************************************************************/
EXPORT void CALL DrawScreen(void);
/****************************************************************** /******************************************************************
Function: DrawScreen Function: GetDllInfo
Purpose: This function is called when the emulator receives a Purpose: This function allows the emulator to gather information
WM_PAINT message. This allows the gfx to fit in when about the dll by filling in the PluginInfo structure.
it is being used in the desktop. input: a pointer to a PLUGIN_INFO stucture that needs to be
input: none filled by the function. (see def above)
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL DrawScreen (void); EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/****************************************************************** /******************************************************************
Function: GetDllInfo Function: InitiateGFX
Purpose: This function allows the emulator to gather information Purpose: This function is called when the DLL is started to give
about the dll by filling in the PluginInfo structure. information from the emulator that the n64 graphics
input: a pointer to a PLUGIN_INFO stucture that needs to be uses. This is not called from the emulation thread.
filled by the function. (see def above) Input: Gfx_Info is passed to this function which is defined
output: none above.
*******************************************************************/ Output: TRUE on success
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ); FALSE on failure to initialise
/****************************************************************** ** note on interrupts **:
Function: InitiateGFX To generate an interrupt set the appropriate bit in MI_INTR_REG
Purpose: This function is called when the DLL is started to give and then call the function CheckInterrupts to tell the emulator
information from the emulator that the n64 graphics that there is a waiting interrupt.
uses. This is not called from the emulation thread. *******************************************************************/
Input: Gfx_Info is passed to this function which is defined EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info);
above.
Output: TRUE on success
FALSE on failure to initialise
** note on interrupts **: /******************************************************************
To generate an interrupt set the appropriate bit in MI_INTR_REG Function: MoveScreen
and then call the function CheckInterrupts to tell the emulator Purpose: This function is called in response to the emulator
that there is a waiting interrupt. receiving a WM_MOVE passing the xpos and ypos passed
*******************************************************************/ from that message.
EXPORT int CALL InitiateGFX (GFX_INFO Gfx_Info); input: xpos - the x-coordinate of the upper-left corner of the
client area of the window.
ypos - y-coordinate of the upper-left corner of the
client area of the window.
output: none
*******************************************************************/
EXPORT void CALL MoveScreen(int xpos, int ypos);
/****************************************************************** /******************************************************************
Function: MoveScreen Function: ProcessDList
Purpose: This function is called in response to the emulator Purpose: This function is called when there is a Dlist to be
receiving a WM_MOVE passing the xpos and ypos passed processed. (High level GFX list)
from that message. input: none
input: xpos - the x-coordinate of the upper-left corner of the output: none
client area of the window. *******************************************************************/
ypos - y-coordinate of the upper-left corner of the EXPORT void CALL ProcessDList(void);
client area of the window.
output: none
*******************************************************************/
EXPORT void CALL MoveScreen (int xpos, int ypos);
/****************************************************************** /******************************************************************
Function: ProcessDList Function: ProcessRDPList
Purpose: This function is called when there is a Dlist to be Purpose: This function is called when there is a Dlist to be
processed. (High level GFX list) processed. (Low level GFX list)
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ProcessDList(void); EXPORT void CALL ProcessRDPList(void);
/****************************************************************** /******************************************************************
Function: ProcessRDPList Function: RomClosed
Purpose: This function is called when there is a Dlist to be Purpose: This function is called when a rom is closed.
processed. (Low level GFX list) input: none
input: none output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL RomClosed(void);
EXPORT void CALL ProcessRDPList(void);
/****************************************************************** /******************************************************************
Function: RomClosed Function: RomOpen
Purpose: This function is called when a rom is closed. Purpose: This function is called when a rom is open. (from the
input: none emulation thread)
output: none input: none
*******************************************************************/ output: none
EXPORT void CALL RomClosed (void); *******************************************************************/
EXPORT void CALL RomOpen(void);
/****************************************************************** /******************************************************************
Function: RomOpen Function: ShowCFB
Purpose: This function is called when a rom is open. (from the Purpose: Useally once Dlists are started being displayed, cfb is
emulation thread) ignored. This function tells the dll to start displaying
input: none them again.
output: none input: none
*******************************************************************/ output: none
EXPORT void CALL RomOpen (void); *******************************************************************/
EXPORT void CALL ShowCFB(void);
/****************************************************************** /******************************************************************
Function: ShowCFB Function: UpdateScreen
Purpose: Useally once Dlists are started being displayed, cfb is Purpose: This function is called in response to a vsync of the
ignored. This function tells the dll to start displaying screen were the VI bit in MI_INTR_REG has already been
them again. set
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ShowCFB (void); EXPORT void CALL UpdateScreen(void);
/****************************************************************** /******************************************************************
Function: UpdateScreen Function: ViStatusChanged
Purpose: This function is called in response to a vsync of the Purpose: This function is called to notify the dll that the
screen were the VI bit in MI_INTR_REG has already been ViStatus registers value has been changed.
set input: none
input: none output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL ViStatusChanged(void);
EXPORT void CALL UpdateScreen (void);
/****************************************************************** /******************************************************************
Function: ViStatusChanged Function: ViWidthChanged
Purpose: This function is called to notify the dll that the Purpose: This function is called to notify the dll that the
ViStatus registers value has been changed. ViWidth registers value has been changed.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
EXPORT void CALL ViStatusChanged (void); EXPORT void CALL ViWidthChanged(void);
/****************************************************************** /******************************************************************
Function: ViWidthChanged Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the Purpose: This function is called to notify the dll that the
ViWidth registers value has been changed. frame buffer has been modified by CPU at the given address.
input: none input: addr rdram address
output: none val val
*******************************************************************/ size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
EXPORT void CALL ViWidthChanged (void); output: none
*******************************************************************/
EXPORT void CALL FBWrite(wxUint32, wxUint32);
typedef struct
{
wxUint32 addr;
wxUint32 val;
wxUint32 size; // 1 = wxUint8, 2 = wxUint16, 4=wxUint32
} FrameBufferModifyEntry;
/****************************************************************** /******************************************************************
Function: FrameBufferWrite Function: FrameBufferWriteList
Purpose: This function is called to notify the dll that the Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address. frame buffer has been modified by CPU at the given address.
input: addr rdram address input: FrameBufferModifyEntry *plist
val val size = size of the plist, max = 1024
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32 output: none
output: none *******************************************************************/
*******************************************************************/ EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size);
EXPORT void CALL FBWrite(wxUint32, wxUint32);
typedef struct /******************************************************************
{ Function: FrameBufferRead
wxUint32 addr; Purpose: This function is called to notify the dll that the
wxUint32 val; frame buffer memory is beening read at the given address.
wxUint32 size; // 1 = wxUint8, 2 = wxUint16, 4=wxUint32 DLL should copy content from its render buffer to the frame buffer
} FrameBufferModifyEntry; in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
output: none
*******************************************************************/
EXPORT void CALL FBRead(wxUint32 addr);
/****************************************************************** /************************************************************************
Function: FrameBufferWriteList Function: FBGetFrameBufferInfo
Purpose: This function is called to notify the dll that the Purpose: This function is called by the emulator core to retrieve depth
frame buffer has been modified by CPU at the given address. buffer information from the video plugin in order to be able
input: FrameBufferModifyEntry *plist to notify the video plugin about CPU depth buffer read/write
size = size of the plist, max = 1024 operations
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size);
/****************************************************************** size:
Function: FrameBufferRead = 1 byte
Purpose: This function is called to notify the dll that the = 2 word (16 bit) <-- this is N64 default depth buffer format
frame buffer memory is beening read at the given address. = 4 dword (32 bit)
DLL should copy content from its render buffer to the frame buffer
in N64 RDRAM
DLL is responsible to maintain its own frame buffer memory addr list
DLL should copy 4KB block content back to RDRAM frame buffer.
Emulator should not call this function again if other memory
is read within the same 4KB range
input: addr rdram address
val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
output: none
*******************************************************************/
EXPORT void CALL FBRead(wxUint32 addr);
/************************************************************************ when depth buffer information is not available yet, set all values
Function: FBGetFrameBufferInfo in the FrameBufferInfo structure to 0
Purpose: This function is called by the emulator core to retrieve depth
buffer information from the video plugin in order to be able
to notify the video plugin about CPU depth buffer read/write
operations
size: input: FrameBufferInfo *pinfo
= 1 byte pinfo is pointed to a FrameBufferInfo structure which to be
= 2 word (16 bit) <-- this is N64 default depth buffer format filled in by this function
= 4 dword (32 bit) output: Values are return in the FrameBufferInfo structure
************************************************************************/
EXPORT void CALL FBGetFrameBufferInfo(void *pinfo);
when depth buffer information is not available yet, set all values EXPORT void CALL PluginLoaded(void);
in the FrameBufferInfo structure to 0
input: FrameBufferInfo *pinfo
pinfo is pointed to a FrameBufferInfo structure which to be
filled in by this function
output: Values are return in the FrameBufferInfo structure
************************************************************************/
EXPORT void CALL FBGetFrameBufferInfo(void *pinfo);
EXPORT void CALL PluginLoaded (void);
#if defined(__cplusplus) #if defined(__cplusplus)
} }