Initial megacommit.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-07-12 17:40:22 +00:00
parent a3be5d89ae
commit 775dc8a9c0
1920 changed files with 734652 additions and 0 deletions

View File

@ -0,0 +1,73 @@
//__________________________________________________________________________________________________
// Common plugin spec, version #1.0 maintained by F|RES
//
#ifndef _PLUGINS_H_INCLUDED__
#define _PLUGINS_H_INCLUDED__
#ifdef _WIN32
#include <windows.h>
#else
#define EXPORT
#define CALL
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#define __cdecl
// simulate something that looks like win32
// long term, kill these
// glxew defines BOOL and BYTE. evil.
#ifdef BOOL
#undef BOOL
#undef BYTE
#endif
#define BOOL unsigned int
#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned int
#define HWND void*
#define HINSTANCE void*
#define INT int
#define CHAR char
#define TCHAR char
#endif
#if defined(__cplusplus)
extern "C" {
#endif
// plugin types
#define PLUGIN_TYPE_VIDEO 1
#define PLUGIN_TYPE_DVD 2
#define PLUGIN_TYPE_PAD 3
#define PLUGIN_TYPE_AUDIO 4
#define PLUGIN_TYPE_COMPILER 5
#define PLUGIN_TYPE_DSP 6
typedef struct
{
WORD Version; // Set to 0x0100
WORD Type; // Set to PLUGIN_TYPE_DVD
char Name[100]; // Name of the DLL
} PLUGIN_INFO;
typedef struct
{
HWND mainWindow;
HWND displayWindow;
HINSTANCE hInstance;
} OSData;
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,105 @@
//__________________________________________________________________________________________________
// Common compiler plugin spec, version #1.0 maintained by F|RES
//
#ifndef _COMPILER_H_INCLUDED__
#define _COMPILER_H_INCLUDED__
#include "PluginSpecs.h"
#if defined(__cplusplus)
extern "C" {
#endif
#define EXPORT __declspec(dllexport)
#define CALL _cdecl
typedef void (*TWriteBigEData)(const unsigned __int8* _pData, const unsigned __int32 _iAddress, const unsigned __int32 _iSize);
typedef void (*TPatchFunction)(DWORD _uAddress, unsigned char* _pMachineCode);
typedef void (*TLog)(char* _pMessage);
typedef struct
{
HWND hWnd;
TPatchFunction pPatchFunction;
TLog pLog;
} SCompilerInitialize;
// __________________________________________________________________________________________________
// Function: GetDllInfo
// Purpose: This function allows the emulator to gather information
// about the DLL by filling in the PluginInfo structure.
// input: a pointer to a PLUGIN_INFO structure that needs to be
// filled by the function. (see def above)
// output: none
//
EXPORT void CALL GetDllInfo(PLUGIN_INFO* _PluginInfo);
// __________________________________________________________________________________________________
// Function: CloseDLL
// Purpose: This function is called when the emulator is closing
// down allowing the DLL to de-initialise.
// input: none
// output: none
//
EXPORT void CALL CloseDLL(void);
// __________________________________________________________________________________________________
// Function: DllAbout
// Purpose: This function is optional function that is provided
// to give further information about the DLL.
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllAbout(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the dll
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllConfig(HWND _hParent);
// __________________________________________________________________________________________________
// Function:
// Purpose:
// input: SCompilerInitialize
// output: none
//
EXPORT void CALL CompilerInitialize(SCompilerInitialize _CompilerInitialize);
// __________________________________________________________________________________________________
// Function: SetupHeader
// Purpose:
// input:
// output:
//
EXPORT void CALL SetupHeader(char* _szSourceCode);
// __________________________________________________________________________________________________
// Function: CompileSourceCode
// Purpose: This function will compile a NULL-terminated string of C
// source code..
// input: pDest: Pointer to address for the new machine code
// strSourceCode: The NULL-terminated C Source Code string
// output: Size of the Compiled Source, 0 == ERROR
//
EXPORT DWORD CALL CompileSourceCode(char* _szSourceCode, BYTE* _pMachineCode, DWORD _dwMaxSize);
// __________________________________________________________________________________________________
// Function: InsertEventString
// Purpose: This optional function will insert the code in
// EventString[] immediately before every block of compiled code
// returns. Used to check for Interrupts and cyclic tasks.
// input: The Event's C code
// output: TRUE/FALSE for pass or fail
//
EXPORT DWORD CALL InsertEventString(char* _szEventSourceCode);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,170 @@
//__________________________________________________________________________________________________
// Common dsp plugin spec, version #1.0 maintained by F|RES
//
#ifndef _DSP_H_INCLUDED__
#define _DSP_H_INCLUDED__
#include "PluginSpecs.h"
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT
#define CALL
#endif
typedef unsigned char (*TARAM_Read_U8)(const unsigned int _uAddress);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _uAddress);
typedef unsigned char* (*TGetARAMPointer)(void);
typedef void (*TLog)(const char* _szMessage);
typedef void (*TDebuggerBreak)(void);
typedef void (*TGenerateDSPInt)(void);
typedef unsigned int(*TAudioGetStreaming)(short* _pDestBuffer, unsigned int _numSamples);
typedef struct
{
void* hWnd;
TARAM_Read_U8 pARAM_Read_U8;
TGetMemoryPointer pGetMemoryPointer;
TGetARAMPointer pGetARAMPointer;
TLog pLog;
TDebuggerBreak pDebuggerBreak;
TGenerateDSPInt pGenerateDSPInterrupt;
TAudioGetStreaming pGetAudioStreaming;
} DSPInitialize;
// __________________________________________________________________________________________________
// Function: GetDllInfo
// Purpose: This function allows the emulator to gather information
// about the DLL by filling in the PluginInfo structure.
// input: a pointer to a PLUGIN_INFO structure that needs to be
// filled by the function. (see def above)
// output: none
//
EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo);
// __________________________________________________________________________________________________
// Function: DllAbout
// Purpose: This function is optional function that is provided
// to give further information about the DLL.
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllAbout(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the DLL
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllConfig(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the DLL
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllConfig(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DllDebugger
// Purpose: Open the debugger
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllDebugger(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DSP_Initialize
// Purpose:
// input: DSPInitialize
// output: none
//
EXPORT void CALL DSP_Initialize(DSPInitialize _dspInitialize);
// __________________________________________________________________________________________________
// Function: DSP_Shutdown
// Purpose: This function is called when the emulator is shutting down
// a game allowing the dll to de-initialise.
// input: none
// output: none
//
EXPORT void CALL DSP_Shutdown(void);
// __________________________________________________________________________________________________
// Function: DSP_ReadMailboxHigh
// Purpose: Send mail to high DSP Mailbox
// input: none
// output: none
//
EXPORT unsigned short CALL DSP_ReadMailboxHigh(bool _CPUMailbox);
// __________________________________________________________________________________________________
// Function: DSP_ReadMailboxLow
// Purpose: Send mail to low DSP Mailbox
// input: none
// output: none
//
EXPORT unsigned short CALL DSP_ReadMailboxLow(bool _CPUMailbox);
// __________________________________________________________________________________________________
// Function: DSP_WriteMailboxHigh
// Purpose: Send mail to high CPU Mailbox
// input: none
// output: none
//
EXPORT void CALL DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _uHighMail);
// __________________________________________________________________________________________________
// Function: DSP_WriteMailboxLow
// Purpose: Send mail to low CPU Mailbox
// input: none
// output: none
//
EXPORT void CALL DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _uLowMail);
// __________________________________________________________________________________________________
// Function: DSP_WriteControlRegister
// Purpose: This function is called if the core reads from the DSP control register
// input: Value to be written
// output: value of the control register
//
EXPORT unsigned short CALL DSP_WriteControlRegister(unsigned short _Value);
// __________________________________________________________________________________________________
// Function: DSP_ReadControlRegister
// Purpose: This function is called if the core reads from the DSP control register
// output: value of the control register
//
EXPORT unsigned short CALL DSP_ReadControlRegister(void);
// __________________________________________________________________________________________________
// Function: DSP_Update
// Purpose: This function is called from time to time from the core.
// input: flag (DSP_FLAG_RESET, DSP_FLAG_ASSERT_INT, ...)
// output: TRUE if the flag is set, else FALSE
//
EXPORT void CALL DSP_Update(void);
// __________________________________________________________________________________________________
// Function: DSP_SendAIBuffer
// Purpose: This function sends the current AI Buffer to the DSP plugin
// input: _Address : Memory-Address
// input: _Size : Size of the Buffer
//
EXPORT void CALL DSP_SendAIBuffer(unsigned int _Address, unsigned int _Size);
#undef CALL
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,141 @@
//__________________________________________________________________________________________________
// Common pad plugin spec, version #1.0 maintained by F|RES
//
#ifndef _PAD_H_INCLUDED__
#define _PAD_H_INCLUDED__
#include "PluginSpecs.h"
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#define CALL __cdecl
#else
#define CALL
#define EXPORT
#endif
#define PAD_ERR_NONE 0
#define PAD_ERR_NO_CONTROLLER -1
#define PAD_ERR_NOT_READY -2
#define PAD_ERR_TRANSFER -3
#define PAD_USE_ORIGIN 0x0080
#define PAD_BUTTON_LEFT 0x0001
#define PAD_BUTTON_RIGHT 0x0002
#define PAD_BUTTON_DOWN 0x0004
#define PAD_BUTTON_UP 0x0008
#define PAD_TRIGGER_Z 0x0010
#define PAD_TRIGGER_R 0x0020
#define PAD_TRIGGER_L 0x0040
#define PAD_BUTTON_A 0x0100
#define PAD_BUTTON_B 0x0200
#define PAD_BUTTON_X 0x0400
#define PAD_BUTTON_Y 0x0800
#define PAD_BUTTON_START 0x1000
typedef void (*TLog)(const char* _pMessage);
typedef struct
{
HWND hWnd;
TLog pLog;
} SPADInitialize;
typedef struct
{
unsigned short button; // Or-ed PAD_BUTTON_* bits
unsigned char stickX; // 0 <= stickX <= 255
unsigned char stickY; // 0 <= stickY <= 255
unsigned char substickX; // 0 <= substickX <= 255
unsigned char substickY; // 0 <= substickY <= 255
unsigned char triggerLeft; // 0 <= triggerLeft <= 255
unsigned char triggerRight; // 0 <= triggerRight <= 255
unsigned char analogA; // 0 <= analogA <= 255
unsigned char analogB; // 0 <= analogB <= 255
signed char err; // one of PAD_ERR_* number
} SPADStatus;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I N T E R F A C E ////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// __________________________________________________________________________________________________
// Function: GetDllInfo
// Purpose: This function allows the emulator to gather information
// about the DLL by filling in the PluginInfo structure.
// input: a pointer to a PLUGIN_INFO structure that needs to be
// filled by the function. (see def above)
// output: none
//
EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo);
// __________________________________________________________________________________________________
// Function: DllAbout
// Purpose: This function is optional function that is provided
// to give further information about the DLL.
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllAbout(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the DLL
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllConfig(HWND _hParent);
// __________________________________________________________________________________________________
// Function:
// Purpose:
// input: SPADInitialize
// output: none
//
EXPORT void CALL PAD_Initialize(SPADInitialize _PADInitialize);
// __________________________________________________________________________________________________
// Function: PAD_Shutdown
// Purpose: This function is called when the emulator is closing
// down allowing the DLL to de-initialise.
// input: none
// output: none
//
EXPORT void CALL PAD_Shutdown();
// __________________________________________________________________________________________________
// Function:
// Purpose:
// input:
// output:
//
EXPORT void CALL PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus);
// __________________________________________________________________________________________________
// Function: PAD_Rumble
// Purpose: Pad rumble!
// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble
// output: none
//
EXPORT void CALL PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength);
// __________________________________________________________________________________________________
// Function: SaveLoadState
// Purpose: Saves/load state
// input: pointer to a 32k scratchpad/saved state
// output: writes or reads to the scratchpad, returning size of data
// TODO: save format should be standardized so that save
// states don't become plugin dependent which would suck
//
EXPORT unsigned int CALL SaveLoadState(char *ptr, BOOL save);
#undef CALL
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,177 @@
//__________________________________________________________________________________________________
// Common video plugin spec, version #1.0 maintained by F|RES
//
#ifndef _VIDEO_H_INCLUDED__
#define _VIDEO_H_INCLUDED__
#include "PluginSpecs.h"
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT
#define CALL
#endif
typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenAcknowledge);
typedef void (*TSetPEFinish)(void);
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress);
typedef void (*TVideoLog)(const char* _pMessage, BOOL _bBreak);
typedef void (*TRequestWindowSize)(int _iWidth, int _iHeight, BOOL _bFullscreen);
typedef void (*TCopiedToXFB)(void);
typedef BOOL (*TPeekMessages)(void);
typedef void (*TUpdateInterrupts)(void);
typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title
typedef struct
{
// fifo registers
volatile DWORD CPBase;
volatile DWORD CPEnd;
DWORD CPHiWatermark;
DWORD CPLoWatermark;
volatile INT CPReadWriteDistance;
volatile DWORD CPWritePointer;
volatile DWORD CPReadPointer;
volatile DWORD CPBreakpoint;
volatile bool bFF_GPReadEnable;
volatile bool bFF_BPEnable;
volatile bool bFF_GPLinkEnable;
volatile bool bFF_Breakpoint;
volatile bool bPauseRead;
#ifdef _WIN32
CRITICAL_SECTION sync;
#endif
} SCPFifoStruct;
typedef struct
{
void *pWindowHandle;
TSetPEToken pSetPEToken;
TSetPEFinish pSetPEFinish;
TGetMemoryPointer pGetMemoryPointer;
TVideoLog pLog;
TRequestWindowSize pRequestWindowSize;
TCopiedToXFB pCopiedToXFB;
TPeekMessages pPeekMessages;
TUpdateInterrupts pUpdateInterrupts;
TUpdateFPSDisplay pUpdateFPSDisplay;
SCPFifoStruct *pCPFifo;
unsigned char *pVIRegs;
void *pMemoryBase;
} SVideoInitialize;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// I N T E R F A C E ////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
// __________________________________________________________________________________________________
// Function: GetDllInfo
// Purpose: This function allows the emulator to gather information
// about the DLL by filling in the PluginInfo structure.
// input: a pointer to a PLUGIN_INFO structure that needs to be
// filled by the function. (see def above)
// output: none
//
//
#ifndef _WIN32
#define _CDECLCALL
#endif
EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo);
// __________________________________________________________________________________________________
// Function: DllAbout
// Purpose: This function is optional function that is provided
// to give further information about the DLL.
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllAbout(HWND _hParent);
// __________________________________________________________________________________________________
// Function: DllConfig
// Purpose: This function is optional function that is provided
// to allow the user to configure the DLL
// input: a handle to the window that calls this function
// output: none
//
EXPORT void CALL DllConfig(HWND _hParent);
// __________________________________________________________________________________________________
// Function: Video_Initialize
// Purpose:
// input: SVideoInitialize* - pointer because window data will be passed back
// output: none
//
EXPORT void CALL Video_Initialize(SVideoInitialize* _pvideoInitialize);
// __________________________________________________________________________________________________
// Function: Video_Prepare
// Purpose: This function is called from the EmuThread before the
// emulation has started. It is just for threadsensitive
// APIs like OpenGL.
// input: none
// output: none
//
EXPORT void CALL Video_Prepare(void);
// __________________________________________________________________________________________________
// Function: Video_Shutdown
// Purpose: This function is called when the emulator is shutting down
// a game allowing the dll to de-initialise.
// input: none
// output: none
//
EXPORT void CALL Video_Shutdown(void);
// __________________________________________________________________________________________________
// Function: Video_ExecuteFifoBuffer
// Purpose: This function is called if data is inside the fifo-buffer
// input: a data-byte (i know we have to optimize this ;-))
// output: none
//
EXPORT void CALL Video_SendFifoData(BYTE *_uData);
// __________________________________________________________________________________________________
// Function: Video_UpdateXFB
// Purpose: This fucntion is called when you have to flip the yuv2
// video-buffer. You should ignore this function after you
// got the first EFB to XFB copy.
// input: pointer to the XFB, width and height of the XFB
// output: none
//
EXPORT void CALL Video_UpdateXFB(BYTE* _pXFB, DWORD _dwWidth, DWORD _dwHeight);
// __________________________________________________________________________________________________
// Function: Video_Screenshot
// Purpose: This fucntion is called when you want to do a screenshot
// input: Filename
// output: TRUE if all was okay
//
EXPORT BOOL CALL Video_Screenshot(TCHAR* _szFilename);
// __________________________________________________________________________________________________
// Function: Video_Screenshot
// Purpose: This fucntion is called when you want to do a screenshot
// input: Filename
// output: TRUE if all was okay
//
EXPORT void CALL Video_EnterLoop(void);
#undef CALL
#if defined(__cplusplus)
}
#endif
#endif