Fix z64 for 64-bit builds

This commit is contained in:
Jesse Dean 2009-01-18 18:42:01 +00:00
parent 0efbb276f0
commit dcedd81bd3
3 changed files with 152 additions and 196 deletions

View file

@ -30,12 +30,12 @@ the plugin
#ifdef _WIN32
#include <windows.h>
#else // _WIN32
#include "winlnxdefs.h"
#include "../main/winlnxdefs.h"
#endif // _WIN32
#include <stdio.h>
//#ifdef _WIN32
//#endif // _WIN32
#include <stddef.h> // offsetof
#include <stddef.h> // offsetof
#include <math.h>
#ifdef _WIN32
#include <io.h>
@ -50,66 +50,66 @@ extern "C" {
#endif
/* Plugin types */
#define PLUGIN_TYPE_GFX 2
#define PLUGIN_TYPE_GFX 2
#define EXPORT __declspec(dllexport)
#define CALL _cdecl
#define EXPORT __declspec(dllexport)
#define CALL _cdecl
/***** Structures *****/
typedef struct {
WORD Version; /* Set to 0x0103 */
WORD Type; /* Set to PLUGIN_TYPE_GFX */
char Name[100]; /* Name of the DLL */
WORD Version; /* Set to 0x0103 */
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 */
/* 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 */
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
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;
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 * 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 * 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;
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 (*CheckInterrupts)( void );
void (*CheckInterrupts)( void );
} GFX_INFO;
extern GFX_INFO gfx;
@ -137,7 +137,7 @@ EXPORT void CALL CaptureScreen ( char * Directory );
Function: ChangeWindow
Purpose: to change the window between fullscreen and window
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
output: none
*******************************************************************/
@ -186,7 +186,7 @@ EXPORT void CALL ReadScreen(void **dest, long *width, long *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.
it is being used in the desktop.
input: none
output: none
*******************************************************************/
@ -206,7 +206,7 @@ EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo );
Function: InitiateGFX
Purpose: This function is called when the DLL is started to give
information from the emulator that the n64 graphics
uses. This is not called from the emulation thread.
uses. This is not called from the emulation thread.
Input: Gfx_Info is passed to this function which is defined
above.
Output: TRUE on success
@ -223,11 +223,11 @@ EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info);
Function: MoveScreen
Purpose: This function is called in response to the emulator
receiving a WM_MOVE passing the xpos and ypos passed
from that message.
from that message.
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.
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);
@ -271,7 +271,7 @@ EXPORT void CALL RomOpen (void);
Function: ShowCFB
Purpose: Useally once Dlists are started being displayed, cfb is
ignored. This function tells the dll to start displaying
them again.
them again.
input: none
output: none
*******************************************************************/
@ -281,7 +281,7 @@ EXPORT void CALL ShowCFB (void);
Function: UpdateScreen
Purpose: This function is called in response to a vsync of the
screen were the VI bit in MI_INTR_REG has already been
set
set
input: none
output: none
*******************************************************************/
@ -310,18 +310,18 @@ EXPORT void CALL ViWidthChanged (void);
Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: addr rdram address
val val
size 1 = BYTE, 2 = WORD, 4 = DWORD
input: addr rdram address
val val
size 1 = BYTE, 2 = WORD, 4 = DWORD
output: none
*******************************************************************/
EXPORT void CALL FBWrite(DWORD, DWORD);
typedef struct
{
DWORD addr;
DWORD val;
DWORD size; // 1 = BYTE, 2 = WORD, 4=DWORD
DWORD addr;
DWORD val;
DWORD size; // 1 = BYTE, 2 = WORD, 4=DWORD
} FrameBufferModifyEntry;
/******************************************************************
@ -329,7 +329,7 @@ typedef struct
Purpose: This function is called to notify the dll that the
frame buffer has been modified by CPU at the given address.
input: FrameBufferModifyEntry *plist
size = size of the plist, max = 1024
size = size of the plist, max = 1024
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, DWORD size);
@ -338,15 +338,15 @@ EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, DWORD size);
Function: FrameBufferRead
Purpose: This function is called to notify the dll that the
frame buffer memory is beening read at the given address.
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 = BYTE, 2 = WORD, 4 = DWORD
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 = BYTE, 2 = WORD, 4 = DWORD
output: none
*******************************************************************/
EXPORT void CALL FBRead(DWORD addr);
@ -359,9 +359,9 @@ to notify the video plugin about CPU depth buffer read/write
operations
size:
= 1 byte
= 2 word (16 bit) <-- this is N64 default depth buffer format
= 4 dword (32 bit)
= 1 byte
= 2 word (16 bit) <-- this is N64 default depth buffer format
= 4 dword (32 bit)
when depth buffer information is not available yet, set all values
in the FrameBufferInfo structure to 0

View file

@ -8,98 +8,98 @@ extern "C" {
#ifdef _WIN32
#include <windows.h>
#else // _WIN32
#include "winlnxdefs.h"
#include "../main/winlnxdefs.h"
#endif // _WIN32
/* Note: BOOL, BYTE, WORD, DWORD, TRUE, FALSE are defined in windows.h */
#define PLUGIN_TYPE_RSP 1
#define PLUGIN_TYPE_GFX 2
#define PLUGIN_TYPE_AUDIO 3
#define PLUGIN_TYPE_CONTROLLER 4
#define PLUGIN_TYPE_RSP 1
#define PLUGIN_TYPE_GFX 2
#define PLUGIN_TYPE_AUDIO 3
#define PLUGIN_TYPE_CONTROLLER 4
typedef struct {
WORD Version; /* Should be set to 0x0101 */
WORD Type; /* Set to PLUGIN_TYPE_RSP */
char Name[100]; /* Name of the DLL */
WORD Version; /* Should be set to 0x0101 */
WORD Type; /* Set to PLUGIN_TYPE_RSP */
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 */
/* 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 {
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;
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 * 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 * 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;
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 (*CheckInterrupts)( void );
void (*ProcessDList)( void );
void (*ProcessAList)( void );
void (*ProcessRdpList)( void );
void (*ShowCFB)( void );
void (*CheckInterrupts)( void );
void (*ProcessDList)( void );
void (*ProcessAList)( void );
void (*ProcessRdpList)( void );
void (*ShowCFB)( void );
} RSP_INFO;
#if 0
typedef struct {
/* Menu */
/* Items should have an ID between 5001 and 5100 */
HMENU hRSPMenu;
void (*ProcessMenuItem) ( int ID );
/* Menu */
/* Items should have an ID between 5001 and 5100 */
HMENU hRSPMenu;
void (*ProcessMenuItem) ( int ID );
/* Break Points */
BOOL UseBPoints;
char BPPanelName[20];
void (*Add_BPoint) ( void );
void (*CreateBPPanel) ( HWND hDlg, RECT rcBox );
void (*HideBPPanel) ( void );
void (*PaintBPPanel) ( PAINTSTRUCT ps );
void (*ShowBPPanel) ( void );
void (*RefreshBpoints) ( HWND hList );
void (*RemoveBpoint) ( HWND hList, int index );
void (*RemoveAllBpoint) ( void );
/* RSP command Window */
void (*Enter_RSP_Commands_Window) ( void );
/* Break Points */
BOOL UseBPoints;
char BPPanelName[20];
void (*Add_BPoint) ( void );
void (*CreateBPPanel) ( HWND hDlg, RECT rcBox );
void (*HideBPPanel) ( void );
void (*PaintBPPanel) ( PAINTSTRUCT ps );
void (*ShowBPPanel) ( void );
void (*RefreshBpoints) ( HWND hList );
void (*RemoveBpoint) ( HWND hList, int index );
void (*RemoveAllBpoint) ( void );
/* RSP command Window */
void (*Enter_RSP_Commands_Window) ( void );
} RSPDEBUG_INFO;
#endif
typedef struct {
void (*UpdateBreakPoints)( void );
void (*UpdateMemory)( void );
void (*UpdateR4300iRegisters)( void );
void (*Enter_BPoint_Window)( void );
void (*Enter_R4300i_Commands_Window)( void );
void (*Enter_R4300i_Register_Window)( void );
void (*Enter_RSP_Commands_Window) ( void );
void (*Enter_Memory_Window)( void );
void (*UpdateBreakPoints)( void );
void (*UpdateMemory)( void );
void (*UpdateR4300iRegisters)( void );
void (*Enter_BPoint_Window)( void );
void (*Enter_R4300i_Commands_Window)( void );
void (*Enter_R4300i_Register_Window)( void );
void (*Enter_RSP_Commands_Window) ( void );
void (*Enter_Memory_Window)( void );
} DEBUG_INFO;
/******************************************************************
@ -142,12 +142,12 @@ __declspec(dllexport) void DllTest ( HWND hParent );
Function: DoRspCycles
Purpose: This function is to allow the RSP to run in parrel with
the r4300 switching control back to the r4300 once the
function ends.
function ends.
input: The number of cylces that is meant to be executed
output: The number of cycles that was executed. This value can
be greater than the number of cycles that the RSP
should have performed.
(this value is ignored if the RSP is stoped)
should have performed.
(this value is ignored if the RSP is stoped)
*******************************************************************/
__declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles );
@ -165,7 +165,7 @@ __declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo );
Function: GetRspDebugInfo
Purpose: This function allows the emulator to gather information
about the debug capabilities of the dll by filling in
the DebugInfo structure.
the DebugInfo structure.
input: a pointer to a RSPDEBUG_INFO stucture that needs to be
filled by the function. (see def above)
output: none
@ -176,11 +176,11 @@ __declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo );
Function: InitiateRSP
Purpose: This function is called when the DLL is started to give
information from the emulator that the n64 RSP
interface needs
interface needs
input: Rsp_Info is passed to this function which is defined
above.
CycleCount is the number of cycles between switching
control between the RSP and r4300i core.
CycleCount is the number of cycles between switching
control between the RSP and r4300i core.
output: none
*******************************************************************/
__declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount);
@ -189,8 +189,8 @@ __declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount);
Function: InitiateRSPDebugger
Purpose: This function is called when the DLL is started to give
information from the emulator that the n64 RSP
interface needs to intergrate the debugger with the
rest of the emulator.
interface needs to intergrate the debugger with the
rest of the emulator.
input: DebugInfo is passed to this function which is defined
above.
output: none

View file

@ -1,44 +0,0 @@
#ifndef WINLNXDEFS_H
#define WINLNXDEFS_H
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int DWORD;
typedef int INT;
typedef long LONG;
typedef long long LONGLONG;
typedef int __int32;
typedef void* HINSTANCE;
typedef int PROPSHEETHEADER;
typedef int PROPSHEETPAGE;
typedef int HWND;
#define FALSE false
#define TRUE true
#define __stdcall
#define __declspec(dllexport)
#define _cdecl
#define WINAPI
typedef union _LARGE_INTEGER
{
struct
{
DWORD LowPart;
LONG HighPart;
} s;
struct
{
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
#define HIWORD(a) ((unsigned int)(a) >> 16)
#define LOWORD(a) ((a) & 0xFFFF)
#endif // WINLNXDEFS_H