Move plugin specs in to its own folder

This commit is contained in:
zilmar 2025-05-15 11:33:38 +09:30
parent 7e0ae07c50
commit 1362ca0bf3
21 changed files with 482 additions and 320 deletions

View File

@ -14,7 +14,7 @@
#else #else
#include <Project64-audio/Driver/OpenSLES.h> #include <Project64-audio/Driver/OpenSLES.h>
#endif #endif
#include "audio_1.1.h" #include <Project64-plugin-spec/Audio.h>
#include "Version.h" #include "Version.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -44,6 +44,13 @@ DirectSoundDriver * g_SoundDriver = nullptr;
OpenSLESDriver * g_SoundDriver = nullptr; OpenSLESDriver * g_SoundDriver = nullptr;
#endif #endif
enum SYSTEM_TYPE
{
SYSTEM_NTSC = 0,
SYSTEM_PAL = 1,
SYSTEM_MPAL = 2,
};
void PluginInit(void) void PluginInit(void)
{ {
if (g_PluginInit) if (g_PluginInit)
@ -115,7 +122,7 @@ EXPORT void CALL AiDacrateChanged(int SystemType)
BufferSize = (Frequency / divider) + 3 & ~0x3; BufferSize = (Frequency / divider) + 3 & ~0x3;
if (hack == 'BH' && SystemType != SYSTEM_PAL) BufferSize -= 16; if (hack == 0x4248 /*BH*/ && SystemType != SYSTEM_PAL) BufferSize -= 16;
g_SoundDriver->AI_SetFrequency(Frequency, BufferSize); g_SoundDriver->AI_SetFrequency(Frequency, BufferSize);
} }
@ -205,8 +212,8 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
#else #else
sprintf(PluginInfo->Name, "Project64 audio plugin: %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "Project64 audio plugin: %s", VER_FILE_VERSION_STR);
#endif #endif
PluginInfo->MemoryBswaped = true; PluginInfo->Reserved1 = false;
PluginInfo->NormalMemory = false; PluginInfo->Reserved2 = true;
} }
EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info) EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info)

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "audio_1.1.h" #include <Project64-plugin-spec/Audio.h>
extern AUDIO_INFO g_AudioInfo; extern AUDIO_INFO g_AudioInfo;

View File

@ -42,7 +42,7 @@ bool DirectSoundDriver::Initialize()
return false; return false;
} }
hr = lpds->SetCooperativeLevel((HWND)g_AudioInfo.hwnd, DSSCL_PRIORITY); hr = lpds->SetCooperativeLevel((HWND)g_AudioInfo.hWnd, DSSCL_PRIORITY);
if (FAILED(hr)) if (FAILED(hr))
{ {
WriteTrace(TraceAudioDriver, TraceWarning, "Failed to SetCooperativeLevel (hr: 0x%08X)", hr); WriteTrace(TraceAudioDriver, TraceWarning, "Failed to SetCooperativeLevel (hr: 0x%08X)", hr);

View File

@ -360,7 +360,7 @@ void queueCallback(SLAndroidSimpleBufferQueueItf caller, void *context)
} }
#endif #endif
void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t BufferSize) void OpenSLESDriver::AI_SetFrequency(uint32_t freq, uint32_t /*BufferSize*/)
{ {
WriteTrace(TraceAudioInitShutdown, TraceDebug, "Start (freq: %d)", freq); WriteTrace(TraceAudioInitShutdown, TraceDebug, "Start (freq: %d)", freq);
if (freq < 4000) if (freq < 4000)

View File

@ -10,7 +10,7 @@
#pragma once #pragma once
#include <Common/SyncEvent.h> #include <Common/SyncEvent.h>
#include <Project64-audio/Audio_1.1.h> #include <Project64-plugin-spec/Audio.h>
#include "SoundBase.h" #include "SoundBase.h"
class OpenSLESDriver : class OpenSLESDriver :

View File

@ -8,6 +8,16 @@
#include <Common/SyncEvent.h> #include <Common/SyncEvent.h>
#include <Common/CriticalSection.h> #include <Common/CriticalSection.h>
enum
{
AI_STATUS_FIFO_FULL = 0x80000000, // Bit 31: full
AI_STATUS_DMA_BUSY = 0x40000000, // Bit 30: busy
MI_INTR_AI = 0x04, // Bit 2: AI INTR
AI_CONTROL_DMA_ON = 0x01,
AI_CONTROL_DMA_OFF = 0x00,
};
class SoundDriverBase class SoundDriverBase
{ {
public: public:

View File

@ -132,6 +132,8 @@
<ClInclude Include="..\3rdParty\zlib\contrib\minizip\zip.h" /> <ClInclude Include="..\3rdParty\zlib\contrib\minizip\zip.h" />
<ClInclude Include="..\3rdParty\zlib\zconf.h" /> <ClInclude Include="..\3rdParty\zlib\zconf.h" />
<ClInclude Include="..\3rdParty\zlib\zlib.h" /> <ClInclude Include="..\3rdParty\zlib\zlib.h" />
<ClInclude Include="..\Project64-plugin-spec\Base.h" />
<ClInclude Include="..\Project64-plugin-spec\Input.h" />
<ClInclude Include="3rdParty\7zip.h" /> <ClInclude Include="3rdParty\7zip.h" />
<ClInclude Include="3rdParty\zip.h" /> <ClInclude Include="3rdParty\zip.h" />
<ClInclude Include="AppInit.h" /> <ClInclude Include="AppInit.h" />

View File

@ -94,6 +94,9 @@
<Filter Include="Header Files\N64 System\Enhancement"> <Filter Include="Header Files\N64 System\Enhancement">
<UniqueIdentifier>{ec73ae9e-54e8-4cbe-93fb-1d98d6755619}</UniqueIdentifier> <UniqueIdentifier>{ec73ae9e-54e8-4cbe-93fb-1d98d6755619}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\Plugin Spec">
<UniqueIdentifier>{65f0fadd-3c4e-4491-b941-797478303ce8}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
@ -668,6 +671,12 @@
<ClInclude Include="N64System\Enhancement\EnhancementList.h"> <ClInclude Include="N64System\Enhancement\EnhancementList.h">
<Filter>Header Files\N64 System\Enhancement</Filter> <Filter>Header Files\N64 System\Enhancement</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Base.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Input.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Version.h.in"> <None Include="Version.h.in">

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec/Input.h>
#include "DirectInput.h" #include "DirectInput.h"
#include "N64Controller.h" #include "N64Controller.h"
#include <Common/CriticalSection.h> #include <Common/CriticalSection.h>

View File

@ -48,7 +48,7 @@ CDirectInput::~CDirectInput()
void CDirectInput::Initiate(CONTROL_INFO * ControlInfo) void CDirectInput::Initiate(CONTROL_INFO * ControlInfo)
{ {
m_hWnd = (HWND)ControlInfo->hwnd; m_hWnd = (HWND)ControlInfo->hWnd;
} }
void CDirectInput::MapControllerDevice(N64CONTROLLER & Controller) void CDirectInput::MapControllerDevice(N64CONTROLLER & Controller)

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec/Input.h>
#include "Button.h" #include "Button.h"
#include "DeviceNotification.h" #include "DeviceNotification.h"
#include "N64Controller.h" #include "N64Controller.h"

View File

@ -1,4 +1,4 @@
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec/Input.h>
#include "InputConfigUI.h" #include "InputConfigUI.h"
#include "Version.h" #include "Version.h"
#include "CProject64Input.h" #include "CProject64Input.h"
@ -94,8 +94,8 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
#else #else
sprintf(PluginInfo->Name, "Project64 input plugin: %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "Project64 input plugin: %s", VER_FILE_VERSION_STR);
#endif #endif
PluginInfo->MemoryBswaped = true; PluginInfo->Reserved2 = true;
PluginInfo->NormalMemory = false; PluginInfo->Reserved1 = false;
} }
/* /*

View File

@ -2,7 +2,7 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include "N64Controller.h" #include "N64Controller.h"
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec/Input.h>
class CInputSettings class CInputSettings
{ {

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec/Input.h>
#include "N64Controller.h" #include "N64Controller.h"
void ConfigOption(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller); void ConfigOption(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller);

View File

@ -1,64 +1,18 @@
// Common audio plugin spec, version 1.1
/*
Notes:
Setting the appropriate bits in the MI_INTR_REG and calling CheckInterrupts which
are both passed to the DLL in InitiateAudio will generate an Interrupt from with in
the plugin.
*/
#pragma once #pragma once
#include "Base.h"
#include <stdint.h> #if defined(__cplusplus)
extern "C" {
enum { PLUGIN_TYPE_AUDIO = 3 };
#if defined(_WIN32)
#define EXPORT extern "C" __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT extern "C" __attribute__((visibility("default")))
#define CALL
#endif #endif
enum
{
SYSTEM_NTSC = 0,
SYSTEM_PAL = 1,
SYSTEM_MPAL = 2,
};
enum
{
AI_STATUS_FIFO_FULL = 0x80000000, // Bit 31: full
AI_STATUS_DMA_BUSY = 0x40000000, // Bit 30: busy
MI_INTR_AI = 0x04, // Bit 2: AI INTR
AI_CONTROL_DMA_ON = 0x01,
AI_CONTROL_DMA_OFF = 0x00,
};
// Structures
typedef struct typedef struct
{ {
uint16_t Version; // Should be set to 0x0101 void * hWnd;
uint16_t Type; // Set to PLUGIN_TYPE_AUDIO
char Name[100]; // Name of the DLL
int32_t NormalMemory;
int32_t MemoryBswaped;
} PLUGIN_INFO;
typedef struct
{
void * hwnd;
void * hinst; void * hinst;
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre-bswap'd on a DWORD (32-bit) boundary int32_t Reserved;
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5 uint8_t * HEADER;
uint8_t * 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.
uint8_t * RDRAM; uint8_t * RDRAM;
uint8_t * DMEM; uint8_t * DMEM;
uint8_t * IMEM; uint8_t * IMEM;
@ -80,12 +34,11 @@ Function: AiDacrateChanged
Purpose: This function is called to notify the DLL that the Purpose: This function is called to notify the DLL that the
AiDacrate registers value has been changed. AiDacrate registers value has been changed.
Input: The system type: Input: The system type:
SYSTEM_NTSC 0 AUDIO_SYSTEM_NTSC 0
SYSTEM_PAL 1 AUDIO_SYSTEM_PAL 1
SYSTEM_MPAL 2 AUDIO_SYSTEM_MPAL 2
Output: None Output: None
*/ */
EXPORT void CALL AiDacrateChanged(int32_t SystemType); EXPORT void CALL AiDacrateChanged(int32_t SystemType);
/* /*
@ -95,7 +48,6 @@ AiLen registers value has been changed.
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL AiLenChanged(void); EXPORT void CALL AiLenChanged(void);
/* /*
@ -105,7 +57,6 @@ value that AI_LEN_REG should equal
Input: None Input: None
Output: The amount of bytes still left to play. Output: The amount of bytes still left to play.
*/ */
EXPORT uint32_t CALL AiReadLength(void); EXPORT uint32_t CALL AiReadLength(void);
/* /*
@ -120,7 +71,6 @@ Input: If wait is set to true, then this function should wait
till there is a message in its message queue. till there is a message in its message queue.
Output: None Output: None
*/ */
EXPORT void CALL AiUpdate(int32_t Wait); EXPORT void CALL AiUpdate(int32_t Wait);
/* /*
@ -130,7 +80,6 @@ down allowing the DLL to de-initialize.
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL CloseDLL(void); EXPORT void CALL CloseDLL(void);
/* /*
@ -140,7 +89,6 @@ 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(void * hParent); EXPORT void CALL DllAbout(void * hParent);
/* /*
@ -150,7 +98,6 @@ 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(void * hParent); EXPORT void CALL DllConfig(void * hParent);
/* /*
@ -160,7 +107,6 @@ 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(void * hParent); EXPORT void CALL DllTest(void * hParent);
/* /*
@ -171,7 +117,6 @@ Input: A pointer to a PLUGIN_INFO structure that needs to be
filled by the function. (see def above) filled by the function. (see def above)
Output: None Output: None
*/ */
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo); EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/* /*
@ -188,7 +133,6 @@ To generate an interrupt set the appropriate bit in MI_INTR_REG
and then call the function CheckInterrupts to tell the emulator and then call the function CheckInterrupts to tell the emulator
that there is a waiting interrupt. that there is a waiting interrupt.
*/ */
EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info); EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info);
/* /*
@ -199,7 +143,6 @@ about the AList itself.
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL ProcessAList(void); EXPORT void CALL ProcessAList(void);
/* /*
@ -208,5 +151,8 @@ Purpose: This function is called when a ROM is closed.
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL RomClosed(void); EXPORT void CALL RomClosed(void);
#if defined(__cplusplus)
}
#endif

View File

@ -0,0 +1,124 @@
#pragma once
#include <stdint.h>
#if defined(__cplusplus)
extern "C" {
#endif
#ifndef EXPORT
#if defined(__cplusplus)
#if defined(_WIN32)
#define EXPORT extern "C" __declspec(dllexport)
#else
#define EXPORT extern "C" __attribute__((visibility("default")))
#endif
#else
#if defined(_WIN32)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __attribute__((visibility("default")))
#endif
#endif
#endif
#ifndef CALL
#if defined(_WIN32)
#define CALL __cdecl
#else
#define CALL
#endif
#endif
enum PLUGIN_TYPE
{
PLUGIN_TYPE_NONE = 0,
PLUGIN_TYPE_RSP = 1,
PLUGIN_TYPE_VIDEO = 2,
PLUGIN_TYPE_AUDIO = 3,
PLUGIN_TYPE_CONTROLLER = 4,
};
typedef struct
{
uint16_t Version; // Should be set plugin spec version eg VIDEO_SPECS_VERSION
uint16_t Type; // Set to the plugin type, eg PLUGIN_TYPE_VIDEO
char Name[100]; // Name of the DLL
int32_t Reserved1;
int32_t Reserved2;
} PLUGIN_INFO;
/*
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(void * 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(void * hParent);
/*
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the DLL.
Input: A handle to the window that calls this function.
Output: None
*/
EXPORT void CALL DllTest(void * hParent);
/*
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 stucture that needs to be
filled by the function. (see def above)
Output: none
*/
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/*
Function: RomClosed
Purpose: This function is called when a rom is closed.
Input: none
Output: none
*/
EXPORT void CALL RomClosed(void);
/*
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
emulation thread)
Input: none
Output: none
*/
EXPORT void CALL RomOpen(void);
/*
Function: PluginLoaded
Purpose: This function is called when the plugin is loaded
Input: none
Output: none
*/
EXPORT void CALL PluginLoaded(void);
#if defined(__cplusplus)
}
#endif

View File

@ -1,24 +1,12 @@
// Project64 controller plugin spec, version 1.1
#pragma once #pragma once
#include <stdint.h> #include "Base.h"
enum { PLUGIN_TYPE_CONTROLLER = 4 };
#if defined(_WIN32)
#define EXPORT extern "C" __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT extern "C" __attribute__((visibility("default")))
#define CALL
#endif
enum enum
{ {
CONTROLLER_SPECS_VERSION = 0x0102 CONTROLLER_SPECS_VERSION = 0x0102
}; };
enum enum PluginType
{ {
PLUGIN_NONE = 1, PLUGIN_NONE = 1,
PLUGIN_MEMPAK = 2, PLUGIN_MEMPAK = 2,
@ -27,16 +15,9 @@ enum
PLUGIN_RAW = 5, PLUGIN_RAW = 5,
}; };
// Structures #if defined(__cplusplus)
extern "C" {
typedef struct #endif
{
uint16_t Version; // Should be set to 0x0101
uint16_t Type; // Set to PLUGIN_TYPE_CONTROLLER
char Name[100]; // Name of the DLL
int32_t NormalMemory;
int32_t MemoryBswaped;
} PLUGIN_INFO;
typedef struct typedef struct
{ {
@ -71,9 +52,9 @@ typedef union
unsigned Reserved1 : 1; unsigned Reserved1 : 1;
unsigned Reserved2 : 1; unsigned Reserved2 : 1;
signed X_AXIS : 8; signed X_AXIS : 8;
signed Y_AXIS : 8; signed Y_AXIS : 8;
}; };
} BUTTONS; } BUTTONS;
@ -81,23 +62,13 @@ typedef union
typedef struct typedef struct
{ {
void * hwnd; void * hWnd;
void * hinst; void * hinst;
int32_t MemoryBswaped; // Set this to true int32_t Reserved;
uint8_t * HEADER; // This is the ROM header (first 40h bytes of the ROM) uint8_t * HEADER; // This is the ROM header (first 40h bytes of the ROM)
CONTROL * Controls; // A pointer to an array of 4 controllers CONTROL * Controls; // A pointer to an array of 4 controllers
} CONTROL_INFO; } CONTROL_INFO;
/*
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the DLL to de-initialize.
Input: None
Output: None
*/
EXPORT void CALL CloseDLL(void);
/* /*
Function: ControllerCommand Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a Purpose: To process the raw data that has just been sent to a
@ -112,50 +83,8 @@ The data that is being processed looks like this:
Initialize controller: 01 03 00 FF FF FF Initialize controller: 01 03 00 FF FF FF
Read controller: 01 04 01 FF FF FF FF Read controller: 01 04 01 FF FF FF FF
*/ */
EXPORT void CALL ControllerCommand(int32_t Control, uint8_t * Command); EXPORT void CALL ControllerCommand(int32_t Control, uint8_t * Command);
/*
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(void * 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(void * hParent);
/*
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the DLL.
Input: A handle to the window that calls this function.
Output: None
*/
EXPORT void CALL DllTest(void * hParent);
/*
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: GetKeys Function: GetKeys
Purpose: To get the current state of the controllers buttons. Purpose: To get the current state of the controllers buttons.
@ -164,7 +93,6 @@ Input: Controller number (0 to 3)
the controller state. the controller state.
Output: None Output: None
*/ */
EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys); EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys);
/* /*
@ -176,7 +104,6 @@ Input: The handle to the main window.
the emulator to know how to handle each controller. the emulator to know how to handle each controller.
Output: None Output: None
*/ */
EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo); EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo);
/* /*
@ -190,28 +117,8 @@ Output: None
Note: This function is only needed if the DLL is allowing raw Note: This function is only needed if the DLL is allowing raw
data. data.
*/ */
EXPORT void CALL ReadController(int Control, uint8_t * Command); EXPORT void CALL ReadController(int Control, uint8_t * Command);
/*
Function: RomClosed
Purpose: This function is called when a ROM is closed.
Input: None
Output: None
*/
EXPORT void CALL RomClosed(void);
/*
Function: RomOpen
Purpose: This function is called when a ROM is open. (from the
emulation thread)
Input: None
Output: None
*/
EXPORT void CALL RomOpen(void);
/* /*
Function: WM_KeyDown Function: WM_KeyDown
Purpose: To pass the WM_KeyDown message from the emulator to the Purpose: To pass the WM_KeyDown message from the emulator to the
@ -219,7 +126,6 @@ plugin.
Input: wParam and lParam of the WM_KEYDOWN message. Input: wParam and lParam of the WM_KEYDOWN message.
Output: None Output: None
*/ */
EXPORT void CALL WM_KeyDown(uint32_t wParam, uint32_t lParam); EXPORT void CALL WM_KeyDown(uint32_t wParam, uint32_t lParam);
/* /*
@ -229,5 +135,8 @@ plugin.
Input: wParam and lParam of the WM_KEYDOWN message. Input: wParam and lParam of the WM_KEYDOWN message.
Output: None Output: None
*/ */
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam); EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
#if defined(__cplusplus)
}
#endif

View File

@ -0,0 +1,93 @@
#pragma once
#include "Base.h"
typedef struct _RSP_INFO
{
void * hInst;
int MemoryBswaped; // If this is set to TRUE, then the memory has been pre-bswap'd on a DWORD (32-bit) boundary
uint8_t * HEADER;
uint8_t * RDRAM;
uint8_t * DMEM;
uint8_t * IMEM;
uint32_t * MI_INTR_REG;
uint32_t * SP_MEM_ADDR_REG;
uint32_t * SP_DRAM_ADDR_REG;
uint32_t * SP_RD_LEN_REG;
uint32_t * SP_WR_LEN_REG;
uint32_t * SP_STATUS_REG;
uint32_t * SP_DMA_FULL_REG;
uint32_t * SP_DMA_BUSY_REG;
uint32_t * SP_PC_REG;
uint32_t * SP_SEMAPHORE_REG;
uint32_t * DPC_START_REG;
uint32_t * DPC_END_REG;
uint32_t * DPC_CURRENT_REG;
uint32_t * DPC_STATUS_REG;
uint32_t * DPC_CLOCK_REG;
uint32_t * DPC_BUFBUSY_REG;
uint32_t * DPC_PIPEBUSY_REG;
uint32_t * DPC_TMEM_REG;
void(*CheckInterrupts)(void);
void(*ProcessDList)(void);
void(*ProcessAList)(void);
void(*ProcessRdpList)(void);
void(*ShowCFB)(void);
} RSP_INFO;
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);
} DEBUG_INFO;
typedef struct {
long left, top, right, bottom;
} rectangle; // <windows.h> equivalent: RECT
typedef struct
{
void * hdc;
int32_t fErase;
rectangle rcPaint;
int32_t fRestore;
int32_t fIncUpdate;
uint8_t rgbReserved[32];
} window_paint; // <windows.h> equivalent: PAINTSTRUCT
typedef struct
{
// Menu
// Items should have an ID between 5001 and 5100
void * hRSPMenu;
void(*ProcessMenuItem) (int32_t ID);
// Breakpoints
int UseBPoints;
char BPPanelName[20];
void(*Add_BPoint)(void);
void(*CreateBPPanel)(void * hDlg, rectangle rcBox);
void(*HideBPPanel)(void);
void(*PaintBPPanel)(window_paint ps);
void(*ShowBPPanel)(void);
void(*RefreshBpoints)(void * hList);
void(*RemoveBpoint)(void * hList, int index);
void(*RemoveAllBpoint)(void);
// RSP command window
void(*Enter_RSP_Commands_Window) (void);
} RSPDEBUG_INFO;
EXPORT uint32_t DoRspCycles(uint32_t Cycles);
EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * DebugInfo);
EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount);
EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info);
EXPORT void EnableDebugging(int Enabled);

View File

@ -0,0 +1,186 @@
#pragma once
#include "Base.h"
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct
{
void * hWnd;
void * hStatusBar;
int32_t Reserved;
uint8_t * HEADER;
uint8_t * RDRAM;
uint8_t * DMEM;
uint8_t * IMEM;
uint32_t * MI_INTR_REG;
uint32_t * DPC_START_REG;
uint32_t * DPC_END_REG;
uint32_t * DPC_CURRENT_REG;
uint32_t * DPC_STATUS_REG;
uint32_t * DPC_CLOCK_REG;
uint32_t * DPC_BUFBUSY_REG;
uint32_t * DPC_PIPEBUSY_REG;
uint32_t * DPC_TMEM_REG;
uint32_t * VI_STATUS_REG;
uint32_t * VI_ORIGIN_REG;
uint32_t * VI_WIDTH_REG;
uint32_t * VI_INTR_REG;
uint32_t * VI_V_CURRENT_LINE_REG;
uint32_t * VI_TIMING_REG;
uint32_t * VI_V_SYNC_REG;
uint32_t * VI_H_SYNC_REG;
uint32_t * VI_LEAP_REG;
uint32_t * VI_H_START_REG;
uint32_t * VI_V_START_REG;
uint32_t * VI_V_BURST_REG;
uint32_t * VI_X_SCALE_REG;
uint32_t * VI_Y_SCALE_REG;
void(*CheckInterrupts)(void);
#ifdef ANDROID
void(CALL *SwapBuffers)(void);
#endif
} GFX_INFO;
/*
Function: CaptureScreen
Purpose: This function dumps the current frame to a file
Input: pointer to the directory to save the file to
Output: none
*/
EXPORT void CALL CaptureScreen(const 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.
Input: none
Output: none
*/
EXPORT void CALL ChangeWindow(void);
/*
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: 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.
Input: Gfx_Info is passed to this function which is defined
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
and then call the function CheckInterrupts to tell the emulator
that there is a waiting interrupt.
*/
EXPORT int 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.
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: ProcessDList
Purpose: This function is called when there is a Dlist to be
processed. (High level GFX list)
Input: none
Output: none
*/
EXPORT void CALL ProcessDList(void);
/*
Function: ProcessRDPList
Purpose: This function is called when there is a Dlist to be
processed. (Low level GFX list)
Input: none
Output: none
*/
EXPORT void CALL ProcessRDPList(void);
/*
Function: ShowCFB
Purpose: Useally once Dlists are started being displayed, cfb is
ignored. This function tells the dll to start displaying
them again.
Input: none
Output: none
*/
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
Input: none
Output: none
*/
EXPORT void CALL UpdateScreen(void);
/*
Function: ViStatusChanged
Purpose: This function is called to notify the dll that the
ViStatus registers value has been changed.
Input: none
Output: none
*/
EXPORT void CALL ViStatusChanged(void);
/*
Function: ViWidthChanged
Purpose: This function is called to notify the dll that the
ViWidth registers value has been changed.
Input: none
Output: none
*/
EXPORT void CALL ViWidthChanged(void);
#ifdef ANDROID
/*
Function: SurfaceCreated
Purpose: this function is called when the surface is created.
Input: none
Output: none
*/
EXPORT void CALL SurfaceCreated(void);
/*
Function: SurfaceChanged
Purpose: this function is called when the surface is has changed.
Input: none
Output: none
*/
EXPORT void CALL SurfaceChanged(int width, int height);
#endif
#if defined(__cplusplus)
}
#endif

View File

@ -209,15 +209,15 @@ Output: None
EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo) EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo)
{ {
PluginInfo->Version = 0x0103; PluginInfo->Version = 0x0103;
PluginInfo->Type = PLUGIN_TYPE_RSP; PluginInfo->Type = PLUGIN_TYPE_RSP;
#ifdef _DEBUG #ifdef _DEBUG
sprintf(PluginInfo->Name, "RSP debug plugin %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "RSP debug plugin %s", VER_FILE_VERSION_STR);
#else #else
sprintf(PluginInfo->Name, "RSP plugin %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "RSP plugin %s", VER_FILE_VERSION_STR);
#endif #endif
PluginInfo->NormalMemory = FALSE; PluginInfo->Reserved2 = false;
PluginInfo->MemoryBswaped = TRUE; PluginInfo->Reserved1 = true;
} }
/* /*

View File

@ -1,135 +1,15 @@
#pragma once #pragma once
#include <Project64-plugin-spec/Rsp.h>
#if defined(__cplusplus)
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include "Types.h" #include "Types.h"
#if defined(_WIN32)
#define EXPORT __declspec(dllexport)
#define CALL _cdecl
#else
#define EXPORT __attribute__((visibility("default")))
#define CALL
#endif
// Profiling // Profiling
#define Default_ProfilingOn FALSE #define Default_ProfilingOn FALSE
#define Default_IndvidualBlock FALSE #define Default_IndvidualBlock FALSE
#define Default_ShowErrors FALSE #define Default_ShowErrors FALSE
#define Default_AudioHle FALSE #define Default_AudioHle FALSE
#define PLUGIN_TYPE_RSP 1
#define PLUGIN_TYPE_GFX 2
#define PLUGIN_TYPE_AUDIO 3
#define PLUGIN_TYPE_CONTROLLER 4
typedef struct {
uint16_t Version; // Should be set to 0x0101
uint16_t 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
int NormalMemory; // A normal BYTE array
int MemoryBswaped; // A normal BYTE array where the memory has been pre-bswap'd on a DWORD (32-bit) boundary
} PLUGIN_INFO;
typedef struct {
void * hInst;
int MemoryBswaped; // If this is set to TRUE, then the memory has been pre-bswap'd on a DWORD (32-bit) boundary
uint8_t * HEADER;
uint8_t * RDRAM;
uint8_t * DMEM;
uint8_t * IMEM;
uint32_t * MI_INTR_REG;
uint32_t * SP_MEM_ADDR_REG;
uint32_t * SP_DRAM_ADDR_REG;
uint32_t * SP_RD_LEN_REG;
uint32_t * SP_WR_LEN_REG;
uint32_t * SP_STATUS_REG;
uint32_t * SP_DMA_FULL_REG;
uint32_t * SP_DMA_BUSY_REG;
uint32_t * SP_PC_REG;
uint32_t * SP_SEMAPHORE_REG;
uint32_t * DPC_START_REG;
uint32_t * DPC_END_REG;
uint32_t * DPC_CURRENT_REG;
uint32_t * DPC_STATUS_REG;
uint32_t * DPC_CLOCK_REG;
uint32_t * DPC_BUFBUSY_REG;
uint32_t * DPC_PIPEBUSY_REG;
uint32_t * DPC_TMEM_REG;
void (*CheckInterrupts)( void );
void (*ProcessDList)( void );
void (*ProcessAList)( void );
void (*ProcessRdpList)( void );
void (*ShowCFB)( void );
} RSP_INFO;
typedef struct {
long left, top, right, bottom;
} rectangle; // <windows.h> equivalent: RECT
typedef struct {
void * hdc;
Boolean fErase;
rectangle rcPaint;
Boolean fRestore;
Boolean fIncUpdate;
uint8_t rgbReserved[32];
} window_paint; // <windows.h> equivalent: PAINTSTRUCT
typedef struct {
// Menu
// Items should have an ID between 5001 and 5100
void * hRSPMenu;
void (*ProcessMenuItem) ( int ID );
// Breakpoints
int UseBPoints;
char BPPanelName[20];
void (*Add_BPoint) ( void );
void (*CreateBPPanel) (void * hDlg, rectangle rcBox);
void (*HideBPPanel) ( void );
void (*PaintBPPanel) (window_paint ps);
void (*ShowBPPanel) ( void );
void (*RefreshBpoints)(void * hList);
void (*RemoveBpoint) (void * hList, int index);
void (*RemoveAllBpoint) ( void );
// RSP command window
void (*Enter_RSP_Commands_Window) ( void );
} RSPDEBUG_INFO;
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 );
} DEBUG_INFO;
EXPORT void CloseDLL(void);
EXPORT void DllAbout(void * hParent);
EXPORT uint32_t DoRspCycles(uint32_t Cycles);
EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo);
EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * DebugInfo);
EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount);
EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info);
EXPORT void RomOpen(void);
EXPORT void RomClosed(void);
EXPORT void DllConfig(void * hWnd);
EXPORT void EnableDebugging(int Enabled);
EXPORT void PluginLoaded(void);
uint32_t AsciiToHex(char * HexValue); uint32_t AsciiToHex(char * HexValue);
void DisplayError(char * Message, ...); void DisplayError(char * Message, ...);
int GetStoredWinPos(char * WinName, uint32_t * X, uint32_t * Y); int GetStoredWinPos(char * WinName, uint32_t * X, uint32_t * Y);
@ -142,7 +22,3 @@ extern uint32_t CPUCore;
extern DEBUG_INFO DebugInfo; extern DEBUG_INFO DebugInfo;
extern RSP_INFO RSPInfo; extern RSP_INFO RSPInfo;
extern void * hinstDLL; extern void * hinstDLL;
#if defined(__cplusplus)
}
#endif