Core: Move plugin specs to a central location

This commit is contained in:
zilmar 2022-06-27 19:32:38 +09:30
parent 3913fb5c28
commit 8b2c66cc07
60 changed files with 1015 additions and 1343 deletions

View File

@ -34,7 +34,6 @@ add_library(Project64-core STATIC
N64System/MemoryHandler/SerialInterfaceHandler.cpp N64System/MemoryHandler/SerialInterfaceHandler.cpp
N64System/MemoryHandler/SPRegistersHandler.cpp N64System/MemoryHandler/SPRegistersHandler.cpp
N64System/MemoryHandler/VideoInterfaceHandler.cpp N64System/MemoryHandler/VideoInterfaceHandler.cpp
N64System/Mips/Dma.cpp
N64System/Mips/Disk.cpp N64System/Mips/Disk.cpp
N64System/Mips/GBCart.cpp N64System/Mips/GBCart.cpp
N64System/Mips/MemoryVirtualMem.cpp N64System/Mips/MemoryVirtualMem.cpp

View File

@ -280,7 +280,7 @@ CJniBridegSettings::CJniBridegSettings()
ADD_SETTING(Debugger_TraceAppCleanup); ADD_SETTING(Debugger_TraceAppCleanup);
ADD_SETTING(Debugger_TraceN64System); ADD_SETTING(Debugger_TraceN64System);
ADD_SETTING(Debugger_TracePlugins); ADD_SETTING(Debugger_TracePlugins);
ADD_SETTING(Debugger_TraceGFXPlugin); ADD_SETTING(Debugger_TraceVideoPlugin);
ADD_SETTING(Debugger_TraceAudioPlugin); ADD_SETTING(Debugger_TraceAudioPlugin);
ADD_SETTING(Debugger_TraceControllerPlugin); ADD_SETTING(Debugger_TraceControllerPlugin);
ADD_SETTING(Debugger_TraceRSPPlugin); ADD_SETTING(Debugger_TraceRSPPlugin);

View File

@ -1,232 +0,0 @@
// Common controller plugin specification, version 1.1
#pragma once
#include <stdint.h>
enum { PLUGIN_TYPE_CONTROLLER = 4 };
// Controller plugins
enum
{
PLUGIN_NONE = 1,
PLUGIN_MEMPAK = 2,
PLUGIN_RUMBLE_PAK = 3,
PLUGIN_TANSFER_PAK = 4,
PLUGIN_RAW = 5,
};
#if defined(_WIN32)
#define EXPORT extern "C" __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT extern "C" __attribute__((visibility("default")))
#define CALL
#endif
// Structures
typedef struct
{
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 Reserved1;
int32_t Reserved2;
} PLUGIN_INFO;
typedef struct
{
int32_t Present;
int32_t RawData;
int32_t Plugin;
} CONTROL;
#pragma warning(push)
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used: nameless struct/union
typedef union
{
uint32_t Value;
struct
{
unsigned R_DPAD : 1;
unsigned L_DPAD : 1;
unsigned D_DPAD : 1;
unsigned U_DPAD : 1;
unsigned START_BUTTON : 1;
unsigned Z_TRIG : 1;
unsigned B_BUTTON : 1;
unsigned A_BUTTON : 1;
unsigned R_CBUTTON : 1;
unsigned L_CBUTTON : 1;
unsigned D_CBUTTON : 1;
unsigned U_CBUTTON : 1;
unsigned R_TRIG : 1;
unsigned L_TRIG : 1;
unsigned Reserved1 : 1;
unsigned Reserved2 : 1;
signed X_AXIS : 8;
signed Y_AXIS : 8;
};
} BUTTONS;
#pragma warning(pop)
typedef struct
{
void * hMainWindow;
void * hinst;
int32_t MemoryBswaped; // Memory in client or server-native endian
uint8_t * HEADER; // The ROM header (first 40h bytes of the ROM)
CONTROL * Controls; // Pointer to array of 4 controllers, i.e.: CONTROL Controls[4];
} 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
Purpose: To process the raw data that has just been sent to a
specific controller.
Input: Controller Number (0 to 3) and -1 signaling end of
processing the PIF RAM.
- Pointer of data to be processed.
Output: None
Note: This function is only needed if the DLL is allowing raw
data, or the plugin is set to raw
The data that is being processed looks like this:
initialize controller: 01 03 00 FF FF FF
read controller: 01 04 01 FF FF FF FF
*/
EXPORT void CALL ControllerCommand(int 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
Purpose: To get the current state of the controllers buttons.
Input: Controller Number (0 to 3)
- A pointer to a BUTTONS structure to be filled with
the controller state.
Output: None
*/
EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys);
/*
Function: InitiateControllers
Purpose: This function initializes how each of the controllers
should be handled.
Input: - The handle to the main window.
- A controller structure that needs to be filled for
the emulator to know how to handle each controller.
Output: None
*/
EXPORT void CALL InitiateControllers(CONTROL_INFO ControlInfo);
/*
Function: ReadController
Purpose: To process the raw data in the PIF RAM that is about to
be read.
Input: Controller Number (0 to 3) and -1 signaling end of
processing the PIF RAM.
- Pointer of data to be processed.
Output: None
Note: This function is only needed if the DLL is allowing raw
data.
*/
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
Purpose: To pass the WM_KeyDown message from the emulator to the
plugin.
Input: wParam and lParam of the WM_KEYDOWN message.
Output: None
*/
EXPORT void CALL WM_KeyDown(uint32_t wParam, uint32_t lParam);
/*
Function: WM_KeyUp
Purpose: To pass the WM_KEYUP message from the emulator to the
plugin.
Input: wParam and lParam of the WM_KEYDOWN message.
Output: None
*/
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);

View File

@ -1,5 +1,5 @@
#include "Controller_1.1.h"
#include "Version.h" #include "Version.h"
#include <Project64-plugin-spec/Input.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -131,9 +131,9 @@ 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)
{ {
g_control_info = ControlInfo; g_control_info = *ControlInfo;
g_control_info.Controls[0].Present = true; g_control_info.Controls[0].Present = true;
g_control_info.Controls[0].Plugin = PLUGIN_MEMPAK; g_control_info.Controls[0].Plugin = PLUGIN_MEMPAK;
} }

View File

@ -36,7 +36,6 @@
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Controller_1.1.h" />
<ClInclude Include="Version.h" /> <ClInclude Include="Version.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -15,9 +15,6 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Controller_1.1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Version.h"> <ClInclude Include="Version.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -33,7 +33,7 @@
enum enum
{ {
PLUGIN_TYPE_RSP = 1, PLUGIN_TYPE_RSP = 1,
PLUGIN_TYPE_GFX = 2, PLUGIN_TYPE_VIDEO = 2,
PLUGIN_TYPE_AUDIO = 3, PLUGIN_TYPE_AUDIO = 3,
PLUGIN_TYPE_CONTROLLER = 4, PLUGIN_TYPE_CONTROLLER = 4,
}; };

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)
@ -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

@ -1,212 +0,0 @@
// 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
#include <stdint.h>
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
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
{
uint16_t Version; // Should be set to 0x0101
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;
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre-bswap'd on a DWORD (32-bit) boundary
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
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 * DMEM;
uint8_t * IMEM;
uint32_t * MI_INTR_REG;
uint32_t * AI_DRAM_ADDR_REG;
uint32_t * AI_LEN_REG;
uint32_t * AI_CONTROL_REG;
uint32_t * AI_STATUS_REG;
uint32_t * AI_DACRATE_REG;
uint32_t * AI_BITRATE_REG;
void(CALL *CheckInterrupts)(void);
} AUDIO_INFO;
/*
Function: AiDacrateChanged
Purpose: This function is called to notify the DLL that the
AiDacrate registers value has been changed.
Input: The system type:
SYSTEM_NTSC 0
SYSTEM_PAL 1
SYSTEM_MPAL 2
Output: None
*/
EXPORT void CALL AiDacrateChanged(int32_t SystemType);
/*
Function: AiLenChanged
Purpose: This function is called to notify the DLL that the
AiLen registers value has been changed.
Input: None
Output: None
*/
EXPORT void CALL AiLenChanged(void);
/*
Function: AiReadLength
Purpose: This function is called to allow the DLL to return the
value that AI_LEN_REG should equal
Input: None
Output: The amount of bytes still left to play.
*/
EXPORT uint32_t CALL AiReadLength(void);
/*
Function: AiUpdate
Purpose: This function is called to allow the DLL to update
things on a regular basis (check how long to sound to
go, copy more stuff to the buffer, anything you like).
The function is designed to go in to the message loop
of the main window...but can be placed anywhere you
like.
Input: If wait is set to true, then this function should wait
till there is a message in its message queue.
Output: None
*/
EXPORT void CALL AiUpdate(int32_t Wait);
/*
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: 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: InitiateSound
Purpose: This function is called when the DLL is started to give
information from the emulator that the N64 audio
interface needs
Input: Audio_Info is passed to this function which is defined
above.
Output: True on success
FALSE on failure to initialize
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 int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info);
/*
Function: ProcessAList
Purpose: This function is called when there is a Alist to be
processed. The DLL will have to work out all the info
about the AList itself.
Input: None
Output: None
*/
EXPORT void CALL ProcessAList(void);
/*
Function: RomClosed
Purpose: This function is called when a ROM is closed.
Input: None
Output: None
*/
EXPORT void CALL RomClosed(void);

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

@ -61,7 +61,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="AudioMain.h" /> <ClInclude Include="AudioMain.h" />
<ClInclude Include="Audio_1.1.h" />
<ClInclude Include="AudioSettings.h" /> <ClInclude Include="AudioSettings.h" />
<ClInclude Include="ConfigUI.h" /> <ClInclude Include="ConfigUI.h" />
<ClInclude Include="Driver\DirectSound.h" /> <ClInclude Include="Driver\DirectSound.h" />

View File

@ -44,9 +44,6 @@
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Audio_1.1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Version.h"> <ClInclude Include="Version.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -59,7 +59,7 @@ void SetTraceModuleNames(void)
TraceSetModuleName(TraceAppCleanup, "App Cleanup"); TraceSetModuleName(TraceAppCleanup, "App Cleanup");
TraceSetModuleName(TraceN64System, "N64 System"); TraceSetModuleName(TraceN64System, "N64 System");
TraceSetModuleName(TracePlugins, "Plugins"); TraceSetModuleName(TracePlugins, "Plugins");
TraceSetModuleName(TraceGFXPlugin, "GFX Plugin"); TraceSetModuleName(TraceVideoPlugin, "GFX Plugin");
TraceSetModuleName(TraceAudioPlugin, "Audio Plugin"); TraceSetModuleName(TraceAudioPlugin, "Audio Plugin");
TraceSetModuleName(TraceControllerPlugin, "Controller Plugin"); TraceSetModuleName(TraceControllerPlugin, "Controller Plugin");
TraceSetModuleName(TraceRSPPlugin, "RSP Plugin"); TraceSetModuleName(TraceRSPPlugin, "RSP Plugin");
@ -85,7 +85,7 @@ void UpdateTraceLevel(void * /*NotUsed*/)
g_ModuleLogLevel[TraceAppCleanup] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAppCleanup); g_ModuleLogLevel[TraceAppCleanup] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAppCleanup);
g_ModuleLogLevel[TraceN64System] = (uint8_t)g_Settings->LoadDword(Debugger_TraceN64System); g_ModuleLogLevel[TraceN64System] = (uint8_t)g_Settings->LoadDword(Debugger_TraceN64System);
g_ModuleLogLevel[TracePlugins] = (uint8_t)g_Settings->LoadDword(Debugger_TracePlugins); g_ModuleLogLevel[TracePlugins] = (uint8_t)g_Settings->LoadDword(Debugger_TracePlugins);
g_ModuleLogLevel[TraceGFXPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceGFXPlugin); g_ModuleLogLevel[TraceVideoPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceVideoPlugin);
g_ModuleLogLevel[TraceAudioPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAudioPlugin); g_ModuleLogLevel[TraceAudioPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceAudioPlugin);
g_ModuleLogLevel[TraceControllerPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceControllerPlugin); g_ModuleLogLevel[TraceControllerPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceControllerPlugin);
g_ModuleLogLevel[TraceRSPPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceRSPPlugin); g_ModuleLogLevel[TraceRSPPlugin] = (uint8_t)g_Settings->LoadDword(Debugger_TraceRSPPlugin);
@ -113,7 +113,7 @@ void SetupTrace(void)
g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceGFXPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TraceVideoPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->RegisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
@ -145,7 +145,7 @@ void CleanupTrace(void)
g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TraceAppCleanup, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TraceN64System, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TracePlugins, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceGFXPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TraceVideoPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TraceAudioPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TraceControllerPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);
g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel); g_Settings->UnregisterChangeCB(Debugger_TraceRSPPlugin, nullptr, (CSettings::SettingChangedFunc)UpdateTraceLevel);

View File

@ -12,6 +12,7 @@
#include <Project64-core/N64System/Mips/Mempak.h> #include <Project64-core/N64System/Mips/Mempak.h>
#include <Project64-core/Logging.h> #include <Project64-core/Logging.h>
#include <Project64-core/Debugger.h> #include <Project64-core/Debugger.h>
#include <Project64-plugin-spec/Input.h>
CPifRam::CPifRam(bool SavesReadOnly) : CPifRam::CPifRam(bool SavesReadOnly) :
CEeprom(SavesReadOnly) CEeprom(SavesReadOnly)
@ -469,7 +470,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
Command[4] = 0x00; Command[4] = 0x00;
switch (Controllers[Control].Plugin) switch (Controllers[Control].Plugin)
{ {
case PLUGIN_TANSFER_PAK: case PLUGIN_TRANSFER_PAK:
case PLUGIN_RUMBLE_PAK: case PLUGIN_RUMBLE_PAK:
case PLUGIN_MEMPAK: case PLUGIN_MEMPAK:
case PLUGIN_RAW: case PLUGIN_RAW:
@ -524,7 +525,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
{ {
case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break; case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break;
case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break; case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break;
case PLUGIN_TANSFER_PAK: Transferpak::ReadFrom((uint16_t)address, data); break; case PLUGIN_TRANSFER_PAK: Transferpak::ReadFrom((uint16_t)address, data); break;
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break; case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
default: default:
memset(&Command[5], 0, 0x20); memset(&Command[5], 0, 0x20);
@ -565,7 +566,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
{ {
case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break; case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break;
case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break; case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break;
case PLUGIN_TANSFER_PAK: Transferpak::WriteTo((uint16_t)address, data); break; case PLUGIN_TRANSFER_PAK: Transferpak::WriteTo((uint16_t)address, data); break;
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break; case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
} }

View File

@ -2487,17 +2487,17 @@ void CN64System::RefreshScreen()
__except_try() __except_try()
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "UpdateScreen starting");
m_Plugins->Gfx()->UpdateScreen(); m_Plugins->Gfx()->UpdateScreen();
if (g_Debugger != nullptr && HaveDebugger()) if (g_Debugger != nullptr && HaveDebugger())
{ {
g_Debugger->FrameDrawn(); g_Debugger->FrameDrawn();
} }
WriteTrace(TraceGFXPlugin, TraceDebug, "UpdateScreen done"); WriteTrace(TraceVideoPlugin, TraceDebug, "UpdateScreen done");
} }
__except_catch() __except_catch()
{ {
WriteTrace(TraceGFXPlugin, TraceError, "Exception caught"); WriteTrace(TraceVideoPlugin, TraceError, "Exception caught");
} }
g_MMU->VideoInterface().UpdateFieldSerration((m_Reg.VI_STATUS_REG & 0x40) != 0); g_MMU->VideoInterface().UpdateFieldSerration((m_Reg.VI_STATUS_REG & 0x40) != 0);

View File

@ -6,6 +6,7 @@
#include <Project64-core/N64System/Mips/Register.h> #include <Project64-core/N64System/Mips/Register.h>
#include <Project64-core/N64System/N64System.h> #include <Project64-core/N64System/N64System.h>
#include <Project64-core/Plugins/AudioPlugin.h> #include <Project64-core/Plugins/AudioPlugin.h>
#include <Project64-plugin-spec/Audio.h>
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
#endif #endif
@ -28,7 +29,7 @@ CAudioPlugin::~CAudioPlugin()
bool CAudioPlugin::LoadFunctions(void) bool CAudioPlugin::LoadFunctions(void)
{ {
g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false); g_Settings->SaveBool(Setting_SyncViaAudioEnabled, false);
// Find entries for functions in DLL // Find entries for functions in DLL
void(CALL *InitiateAudio)(void); void(CALL *InitiateAudio)(void);
@ -55,32 +56,6 @@ bool CAudioPlugin::LoadFunctions(void)
bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window) bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
{ {
struct AUDIO_INFO
{
void * hwnd;
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
// eg. the first 8 bytes are stored like this:
// 4 3 2 1 8 7 6 5
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 * DMEM;
uint8_t * IMEM;
uint32_t * MI__INTR_REG;
uint32_t * AI__DRAM_ADDR_REG;
uint32_t * AI__LEN_REG;
uint32_t * AI__CONTROL_REG;
uint32_t * AI__STATUS_REG;
uint32_t * AI__DACRATE_REG;
uint32_t * AI__BITRATE_REG;
void(CALL *CheckInterrupts)(void);
};
// Get function from DLL // Get function from DLL
int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info); int32_t(CALL *InitiateAudio)(AUDIO_INFO Audio_Info);
LoadFunction(InitiateAudio); LoadFunction(InitiateAudio);
@ -89,13 +64,13 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
AUDIO_INFO Info = { 0 }; AUDIO_INFO Info = { 0 };
#ifdef _WIN32 #ifdef _WIN32
Info.hwnd = Window ? Window->GetWindowHandle() : nullptr; Info.hWnd = Window ? Window->GetWindowHandle() : nullptr;
Info.hinst = Window ? Window->GetModuleInstance() : nullptr; Info.hinst = Window ? Window->GetModuleInstance() : nullptr;
#else #else
Info.hwnd = nullptr; Info.hWnd = nullptr;
Info.hinst = nullptr; Info.hinst = nullptr;
#endif #endif
Info.MemoryBswaped = true; Info.Reserved = true;
Info.CheckInterrupts = DummyCheckInterrupts; Info.CheckInterrupts = DummyCheckInterrupts;
// We are initializing the plugin before any ROM is loaded so we do not have any correct // We are initializing the plugin before any ROM is loaded so we do not have any correct
@ -109,13 +84,13 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
Info.RDRAM = Buffer; Info.RDRAM = Buffer;
Info.DMEM = Buffer; Info.DMEM = Buffer;
Info.IMEM = Buffer; Info.IMEM = Buffer;
Info.MI__INTR_REG = &Value; Info.MI_INTR_REG = &Value;
Info.AI__DRAM_ADDR_REG = &Value; Info.AI_DRAM_ADDR_REG = &Value;
Info.AI__LEN_REG = &Value; Info.AI_LEN_REG = &Value;
Info.AI__CONTROL_REG = &Value; Info.AI_CONTROL_REG = &Value;
Info.AI__STATUS_REG = &Value; Info.AI_STATUS_REG = &Value;
Info.AI__DACRATE_REG = &Value; Info.AI_DACRATE_REG = &Value;
Info.AI__BITRATE_REG = &Value; Info.AI_BITRATE_REG = &Value;
} }
// Send initialization information to the DLL // Send initialization information to the DLL
else else
@ -130,15 +105,14 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
Info.RDRAM = MMU.Rdram(); Info.RDRAM = MMU.Rdram();
Info.DMEM = MMU.Dmem(); Info.DMEM = MMU.Dmem();
Info.IMEM = MMU.Imem(); Info.IMEM = MMU.Imem();
Info.MI__INTR_REG = &Reg.m_AudioIntrReg; Info.MI_INTR_REG = &Reg.m_AudioIntrReg;
Info.AI__DRAM_ADDR_REG = &Reg.AI_DRAM_ADDR_REG; Info.AI_DRAM_ADDR_REG = &Reg.AI_DRAM_ADDR_REG;
Info.AI__LEN_REG = &Reg.AI_LEN_REG; Info.AI_LEN_REG = &Reg.AI_LEN_REG;
Info.AI__CONTROL_REG = &Reg.AI_CONTROL_REG; Info.AI_CONTROL_REG = &Reg.AI_CONTROL_REG;
Info.AI__STATUS_REG = &Reg.AI_STATUS_REG; Info.AI_STATUS_REG = &Reg.AI_STATUS_REG;
Info.AI__DACRATE_REG = &Reg.AI_DACRATE_REG; Info.AI_DACRATE_REG = &Reg.AI_DACRATE_REG;
Info.AI__BITRATE_REG = &Reg.AI_BITRATE_REG; Info.AI_BITRATE_REG = &Reg.AI_BITRATE_REG;
} }
m_Initialized = InitiateAudio(Info) != 0; m_Initialized = InitiateAudio(Info) != 0;
#ifdef _WIN32 #ifdef _WIN32

View File

@ -86,12 +86,12 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
ControlInfo.HEADER = (System == nullptr ? Buffer : g_Rom->GetRomAddress()); ControlInfo.HEADER = (System == nullptr ? Buffer : g_Rom->GetRomAddress());
#ifdef _WIN32 #ifdef _WIN32
ControlInfo.hinst = Window ? Window->GetModuleInstance() : nullptr; ControlInfo.hinst = Window ? Window->GetModuleInstance() : nullptr;
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : nullptr; ControlInfo.hWnd = Window ? Window->GetWindowHandle() : nullptr;
#else #else
ControlInfo.hinst = nullptr; ControlInfo.hinst = nullptr;
ControlInfo.hMainWindow = nullptr; ControlInfo.hMainWindow = nullptr;
#endif #endif
ControlInfo.MemoryBswaped = true; ControlInfo.Reserved = true;
if (m_PluginInfo.Version == 0x0101) if (m_PluginInfo.Version == 0x0101)
{ {

View File

@ -1,71 +1,6 @@
#pragma once #pragma once
#include <Project64-core/Plugins/PluginBase.h> #include <Project64-core/Plugins/PluginBase.h>
#include <Project64-plugin-spec/Input.h>
#pragma warning(push)
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
typedef union
{
uint32_t Value;
struct
{
unsigned R_DPAD : 1;
unsigned L_DPAD : 1;
unsigned D_DPAD : 1;
unsigned U_DPAD : 1;
unsigned START_BUTTON : 1;
unsigned Z_TRIG : 1;
unsigned B_BUTTON : 1;
unsigned A_BUTTON : 1;
unsigned R_CBUTTON : 1;
unsigned L_CBUTTON : 1;
unsigned D_CBUTTON : 1;
unsigned U_CBUTTON : 1;
unsigned R_TRIG : 1;
unsigned L_TRIG : 1;
unsigned Reserved1 : 1;
unsigned Reserved2 : 1;
signed X_AXIS : 8;
signed Y_AXIS : 8;
};
} BUTTONS;
#pragma warning(pop)
typedef struct
{
int32_t Present;
int32_t RawData;
int32_t Plugin;
} CONTROL;
typedef struct
{
void * hMainWindow;
void * hinst;
int32_t MemoryBswaped; // Memory in client or server-native endian
uint8_t * HEADER; // The ROM header (first 40h bytes of the ROM)
CONTROL * Controls; // Pointer to array of 4 controllers, i.e.: CONTROL Controls[4];
} CONTROL_INFO;
enum PluginType
{
PLUGIN_NONE = 1,
PLUGIN_MEMPAK = 2,
PLUGIN_RUMBLE_PAK = 3,
PLUGIN_TANSFER_PAK = 4, // Not implemented for non-raw data
PLUGIN_RAW = 5, // The controller plugin is passed in raw data
};
enum PresentType
{
PRESENT_NONE = 0,
PRESENT_CONT = 1,
PRESENT_MOUSE = 2,
};
class CControl_Plugin; class CControl_Plugin;

View File

@ -8,32 +8,32 @@
#include "GFXPlugin.h" #include "GFXPlugin.h"
CGfxPlugin::CGfxPlugin() : CGfxPlugin::CGfxPlugin() :
CaptureScreen(nullptr), CaptureScreen(nullptr),
ChangeWindow(nullptr), ChangeWindow(nullptr),
DrawScreen(nullptr), DrawScreen(nullptr),
DrawStatus(nullptr), DrawStatus(nullptr),
MoveScreen(nullptr), MoveScreen(nullptr),
ProcessDList(nullptr), ProcessDList(nullptr),
ProcessRDPList(nullptr), ProcessRDPList(nullptr),
ShowCFB(nullptr), ShowCFB(nullptr),
UpdateScreen(nullptr), UpdateScreen(nullptr),
ViStatusChanged(nullptr), ViStatusChanged(nullptr),
ViWidthChanged(nullptr), ViWidthChanged(nullptr),
SoftReset(nullptr), SoftReset(nullptr),
GetRomBrowserMenu(nullptr), GetRomBrowserMenu(nullptr),
OnRomBrowserMenuItem(nullptr), OnRomBrowserMenuItem(nullptr),
GetDebugInfo(nullptr), GetDebugInfo(nullptr),
InitiateDebugger(nullptr) InitiateDebugger(nullptr)
{ {
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug)); memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
} }
CGfxPlugin::~CGfxPlugin() CGfxPlugin::~CGfxPlugin()
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Start"); WriteTrace(TraceVideoPlugin, TraceDebug, "Start");
Close(nullptr); Close(nullptr);
UnloadPlugin(); UnloadPlugin();
WriteTrace(TraceGFXPlugin, TraceDebug, "Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "Done");
} }
bool CGfxPlugin::LoadFunctions(void) bool CGfxPlugin::LoadFunctions(void)
@ -99,7 +99,7 @@ bool CGfxPlugin::LoadFunctions(void)
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window) bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Start"); WriteTrace(TraceVideoPlugin, TraceDebug, "Start");
if (m_Initialized) if (m_Initialized)
{ {
Close(Window); Close(Window);
@ -163,7 +163,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
_LoadFunction("InitiateGFX", InitiateGFX); _LoadFunction("InitiateGFX", InitiateGFX);
if (InitiateGFX == nullptr) if (InitiateGFX == nullptr)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Failed to find InitiateGFX"); WriteTrace(TraceVideoPlugin, TraceDebug, "Failed to find InitiateGFX");
return false; return false;
} }
@ -186,7 +186,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
// We are initializing the plugin before any ROM is loaded so we do not have any correct // We are initializing the plugin before any ROM is loaded so we do not have any correct
// parameters here, it's just needed so we can config the DLL // parameters here, it's just needed so we can config the DLL
WriteTrace(TraceGFXPlugin, TraceDebug, "System = %X", System); WriteTrace(TraceVideoPlugin, TraceDebug, "System = %X", System);
if (System == nullptr) if (System == nullptr)
{ {
static uint8_t Buffer[100]; static uint8_t Buffer[100];
@ -250,16 +250,16 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
Info.VI__Y_SCALE_REG = &Reg.VI_Y_SCALE_REG; Info.VI__Y_SCALE_REG = &Reg.VI_Y_SCALE_REG;
} }
WriteTrace(TraceGFXPlugin, TraceDebug, "Calling InitiateGFX"); WriteTrace(TraceVideoPlugin, TraceDebug, "Calling InitiateGFX");
m_Initialized = InitiateGFX(Info) != 0; m_Initialized = InitiateGFX(Info) != 0;
WriteTrace(TraceGFXPlugin, TraceDebug, "Done (res: %s)", m_Initialized ? "true" : "false"); WriteTrace(TraceVideoPlugin, TraceDebug, "Done (res: %s)", m_Initialized ? "true" : "false");
return m_Initialized; return m_Initialized;
} }
void CGfxPlugin::UnloadPluginDetails(void) void CGfxPlugin::UnloadPluginDetails(void)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Start"); WriteTrace(TraceVideoPlugin, TraceDebug, "Start");
if (m_LibHandle != nullptr) if (m_LibHandle != nullptr)
{ {
DynamicLibraryClose(m_LibHandle); DynamicLibraryClose(m_LibHandle);
@ -267,13 +267,10 @@ void CGfxPlugin::UnloadPluginDetails(void)
} }
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug)); memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
// CaptureScreen = nullptr;
ChangeWindow = nullptr; ChangeWindow = nullptr;
GetDebugInfo = nullptr; GetDebugInfo = nullptr;
DrawScreen = nullptr; DrawScreen = nullptr;
DrawStatus = nullptr; DrawStatus = nullptr;
// FrameBufferRead = nullptr;
// FrameBufferWrite = nullptr;
InitiateDebugger = nullptr; InitiateDebugger = nullptr;
MoveScreen = nullptr; MoveScreen = nullptr;
ProcessDList = nullptr; ProcessDList = nullptr;
@ -284,7 +281,7 @@ void CGfxPlugin::UnloadPluginDetails(void)
ViWidthChanged = nullptr; ViWidthChanged = nullptr;
GetRomBrowserMenu = nullptr; GetRomBrowserMenu = nullptr;
OnRomBrowserMenuItem = nullptr; OnRomBrowserMenuItem = nullptr;
WriteTrace(TraceGFXPlugin, TraceDebug, "Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "Done");
} }
void CGfxPlugin::ProcessMenuItem(int32_t id) void CGfxPlugin::ProcessMenuItem(int32_t id)
@ -299,11 +296,11 @@ void CGfxPlugin::ProcessMenuItem(int32_t id)
void CGfxPlugin::SwapBuffers(void) void CGfxPlugin::SwapBuffers(void)
{ {
RenderWindow * render = g_Plugins ? g_Plugins->MainWindow() : nullptr; RenderWindow * render = g_Plugins ? g_Plugins->MainWindow() : nullptr;
WriteTrace(TraceGFXPlugin, TraceDebug, "Start (render: %p)",render); WriteTrace(TraceVideoPlugin, TraceDebug, "Start (render: %p)",render);
if (render != nullptr) if (render != nullptr)
{ {
render->SwapWindow(); render->SwapWindow();
} }
WriteTrace(TraceGFXPlugin, TraceDebug, "Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "Done");
} }
#endif #endif

View File

@ -75,7 +75,7 @@ private:
virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; } virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; }
virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; } virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; }
PLUGIN_TYPE type() { return PLUGIN_TYPE_GFX; } PLUGIN_TYPE type() { return PLUGIN_TYPE_VIDEO; }
void UnloadPluginDetails(void); void UnloadPluginDetails(void);

View File

@ -141,7 +141,7 @@ void CPlugins::CreatePlugins(void)
{ {
WriteTrace(TracePlugins, TraceInfo, "Start"); WriteTrace(TracePlugins, TraceInfo, "Start");
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX", m_SyncPlugins); LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceVideoPlugin, "GFX", m_SyncPlugins);
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio", m_SyncPlugins); LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio", m_SyncPlugins);
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP", m_SyncPlugins); LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP", m_SyncPlugins);
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins); LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
@ -182,15 +182,15 @@ void CPlugins::DestroyGfxPlugin(void)
{ {
return; return;
} }
WriteTrace(TraceGFXPlugin, TraceDebug, "Before close"); WriteTrace(TraceVideoPlugin, TraceDebug, "Before close");
m_Gfx->Close(m_MainWindow); m_Gfx->Close(m_MainWindow);
WriteTrace(TraceGFXPlugin, TraceInfo, "Deleting"); WriteTrace(TraceVideoPlugin, TraceInfo, "Deleting");
delete m_Gfx; delete m_Gfx;
WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted"); WriteTrace(TraceVideoPlugin, TraceInfo, "m_Gfx deleted");
m_Gfx = nullptr; m_Gfx = nullptr;
// g_Settings->UnknownSetting_GFX = nullptr; // g_Settings->UnknownSetting_GFX = nullptr;
DestroyRspPlugin(); DestroyRspPlugin();
WriteTrace(TraceGFXPlugin, TraceInfo, "Done"); WriteTrace(TraceVideoPlugin, TraceInfo, "Done");
} }
void CPlugins::DestroyAudioPlugin(void) void CPlugins::DestroyAudioPlugin(void)
@ -281,9 +281,9 @@ bool CPlugins::Initiate(CN64System * System)
if (m_RSP == nullptr) { return false; } if (m_RSP == nullptr) { return false; }
if (m_Control == nullptr) { return false; } if (m_Control == nullptr) { return false; }
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "GFX initiate starting");
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; } if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate done"); WriteTrace(TraceVideoPlugin, TraceDebug, "GFX initiate done");
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate starting"); WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate starting");
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; } if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate done"); WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate done");
@ -331,9 +331,9 @@ bool CPlugins::Reset(CN64System * System)
if (m_Gfx && bGfxChange) if (m_Gfx && bGfxChange)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "GFX initiate starting");
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; } if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate done"); WriteTrace(TraceVideoPlugin, TraceDebug, "GFX initiate done");
} }
if (m_Audio && bAudioChange) if (m_Audio && bAudioChange)
{ {
@ -382,7 +382,7 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
} }
m_RSP->DllConfig(hParent); m_RSP->DllConfig(hParent);
break; break;
case PLUGIN_TYPE_GFX: case PLUGIN_TYPE_VIDEO:
if (m_Gfx == nullptr || m_Gfx->DllConfig == nullptr) { break; } if (m_Gfx == nullptr || m_Gfx->DllConfig == nullptr) { break; }
if (!m_Gfx->Initialized()) if (!m_Gfx->Initialized())
{ {

View File

@ -2,22 +2,7 @@
#include <list> #include <list>
#include <Project64-core/Settings.h> #include <Project64-core/Settings.h>
#include <Project64-core/Settings/DebugSettings.h> #include <Project64-core/Settings/DebugSettings.h>
#include <Project64-plugin-spec/Base.h>
#ifndef PLUGIN_INFO_STRUCT
#define PLUGIN_INFO_STRUCT
typedef struct _PLUGIN_INFO
{
uint16_t Version; // Should be set to 1
uint16_t Type; // Set to PLUGIN_TYPE_GFX
char Name[100]; // Name of the DLL
// If DLL supports these memory options then set them to TRUE or FALSE if it does not support it
int32_t NormalMemory; // A normal BYTE array
int32_t MemoryBswaped; // A normal BYTE array where the memory has been pre-bswap'd on a DWORD (32-bit) boundary
} PLUGIN_INFO;
#endif
// Enums // Enums
enum SETTING_DATA_TYPE enum SETTING_DATA_TYPE
@ -77,15 +62,6 @@ typedef struct
void(*BreakPoint)(const char * FileName, int32_t LineNumber); void(*BreakPoint)(const char * FileName, int32_t LineNumber);
} PLUGIN_NOTIFICATION; } PLUGIN_NOTIFICATION;
enum PLUGIN_TYPE
{
PLUGIN_TYPE_NONE = 0,
PLUGIN_TYPE_RSP = 1,
PLUGIN_TYPE_GFX = 2,
PLUGIN_TYPE_AUDIO = 3,
PLUGIN_TYPE_CONTROLLER = 4,
};
class CSettings; class CSettings;
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin; class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
class CN64System; class CN64System;

View File

@ -3,18 +3,18 @@
#include <Common/path.h> #include <Common/path.h>
CPlugin::CPlugin() : CPlugin::CPlugin() :
DllAbout(nullptr), DllAbout(nullptr),
DllConfig(nullptr), DllConfig(nullptr),
CloseDLL(nullptr), CloseDLL(nullptr),
RomOpen(nullptr), RomOpen(nullptr),
RomClosed(nullptr), RomClosed(nullptr),
PluginOpened(nullptr), PluginOpened(nullptr),
SetSettingInfo(nullptr), SetSettingInfo(nullptr),
SetSettingInfo2(nullptr), SetSettingInfo2(nullptr),
SetSettingInfo3(nullptr), SetSettingInfo3(nullptr),
m_LibHandle(nullptr), m_LibHandle(nullptr),
m_Initialized(false), m_Initialized(false),
m_RomOpen(false) m_RomOpen(false)
{ {
memset(&m_PluginInfo, 0, sizeof(m_PluginInfo)); memset(&m_PluginInfo, 0, sizeof(m_PluginInfo));
} }
@ -154,7 +154,7 @@ void CPlugin::RomOpened(RenderWindow * Render)
} }
#ifdef ANDROID #ifdef ANDROID
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX) if (m_PluginInfo.Type == PLUGIN_TYPE_VIDEO)
{ {
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render); WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
if (Render != nullptr) if (Render != nullptr)
@ -186,7 +186,7 @@ void CPlugin::RomClose(RenderWindow * Render)
} }
#ifdef ANDROID #ifdef ANDROID
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX) if (m_PluginInfo.Type == PLUGIN_TYPE_VIDEO)
{ {
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render); WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
if (Render != NULL) if (Render != NULL)
@ -258,7 +258,7 @@ const char * CPlugin::PluginType() const
switch (m_PluginInfo.Type) switch (m_PluginInfo.Type)
{ {
case PLUGIN_TYPE_RSP: return "RSP"; case PLUGIN_TYPE_RSP: return "RSP";
case PLUGIN_TYPE_GFX: return "GFX"; case PLUGIN_TYPE_VIDEO: return "Video";
case PLUGIN_TYPE_AUDIO: return "Audio"; case PLUGIN_TYPE_AUDIO: return "Audio";
case PLUGIN_TYPE_CONTROLLER: return "Control"; case PLUGIN_TYPE_CONTROLLER: return "Control";
} }
@ -270,7 +270,7 @@ TraceModuleProject64 CPlugin::PluginTraceType() const
switch (m_PluginInfo.Type) switch (m_PluginInfo.Type)
{ {
case PLUGIN_TYPE_RSP: return TraceRSPPlugin; case PLUGIN_TYPE_RSP: return TraceRSPPlugin;
case PLUGIN_TYPE_GFX: return TraceGFXPlugin; case PLUGIN_TYPE_VIDEO: return TraceVideoPlugin;
case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin; case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin;
case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin; case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin;
} }
@ -282,21 +282,18 @@ bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo)
switch (PluginInfo.Type) switch (PluginInfo.Type)
{ {
case PLUGIN_TYPE_RSP: case PLUGIN_TYPE_RSP:
if (!PluginInfo.MemoryBswaped) { return false; }
if (PluginInfo.Version == 0x0001) { return true; } if (PluginInfo.Version == 0x0001) { return true; }
if (PluginInfo.Version == 0x0100) { return true; } if (PluginInfo.Version == 0x0100) { return true; }
if (PluginInfo.Version == 0x0101) { return true; } if (PluginInfo.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; } if (PluginInfo.Version == 0x0102) { return true; }
if (PluginInfo.Version == 0x0103) { return true; } if (PluginInfo.Version == 0x0103) { return true; }
break; break;
case PLUGIN_TYPE_GFX: case PLUGIN_TYPE_VIDEO:
if (!PluginInfo.MemoryBswaped) { return false; }
if (PluginInfo.Version == 0x0102) { return true; } if (PluginInfo.Version == 0x0102) { return true; }
if (PluginInfo.Version == 0x0103) { return true; } if (PluginInfo.Version == 0x0103) { return true; }
if (PluginInfo.Version == 0x0104) { return true; } if (PluginInfo.Version == 0x0104) { return true; }
break; break;
case PLUGIN_TYPE_AUDIO: case PLUGIN_TYPE_AUDIO:
if (!PluginInfo.MemoryBswaped) { return false; }
if (PluginInfo.Version == 0x0101) { return true; } if (PluginInfo.Version == 0x0101) { return true; }
if (PluginInfo.Version == 0x0102) { return true; } if (PluginInfo.Version == 0x0102) { return true; }
break; break;

View File

@ -3,14 +3,9 @@
#include <Project64-core/Settings/DebugSettings.h> #include <Project64-core/Settings/DebugSettings.h>
#include <Project64-core/TraceModulesProject64.h> #include <Project64-core/TraceModulesProject64.h>
#include <Project64-core/Plugins/Plugin.h> #include <Project64-core/Plugins/Plugin.h>
#include <Project64-plugin-spec\Base.h>
#include <Common/DynamicLibrary.h> #include <Common/DynamicLibrary.h>
#if defined(_WIN32)
#define CALL __cdecl
#else
#define CALL
#endif
class CPlugin : class CPlugin :
private CDebugSettings private CDebugSettings
{ {
@ -43,15 +38,15 @@ protected:
virtual PLUGIN_TYPE type() = 0; virtual PLUGIN_TYPE type() = 0;
virtual bool LoadFunctions(void) = 0; virtual bool LoadFunctions(void) = 0;
void(CALL *CloseDLL) (void); void(CALL * CloseDLL) (void);
void(CALL *RomOpen) (void); void(CALL * RomOpen) (void);
void(CALL *RomClosed) (void); void(CALL * RomClosed) (void);
void(CALL *PluginOpened)(void); void(CALL * PluginOpened)(void);
void(CALL *SetSettingInfo)(PLUGIN_SETTINGS *); void(CALL * SetSettingInfo)(PLUGIN_SETTINGS *);
void(CALL *SetSettingInfo2)(PLUGIN_SETTINGS2 *); void(CALL * SetSettingInfo2)(PLUGIN_SETTINGS2 *);
void(CALL *SetSettingInfo3)(PLUGIN_SETTINGS3 *); void(CALL * SetSettingInfo3)(PLUGIN_SETTINGS3 *);
void(CALL *SetSettingNotificationInfo)(PLUGIN_SETTINGS_NOTIFICATION *); void(CALL * SetSettingNotificationInfo)(PLUGIN_SETTINGS_NOTIFICATION *);
void(CALL *SetPluginNotification)(PLUGIN_NOTIFICATION *); void(CALL * SetPluginNotification)(PLUGIN_NOTIFICATION *);
DynLibHandle m_LibHandle; DynLibHandle m_LibHandle;
bool m_Initialized, m_RomOpen; bool m_Initialized, m_RomOpen;

View File

@ -145,6 +145,11 @@
<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\Audio.h" />
<ClInclude Include="..\Project64-plugin-spec\Base.h" />
<ClInclude Include="..\Project64-plugin-spec\Input.h" />
<ClInclude Include="..\Project64-plugin-spec\Rsp.h" />
<ClInclude Include="..\Project64-plugin-spec\Video.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

@ -106,6 +106,9 @@
<Filter Include="Source Files\N64 System\SaveType"> <Filter Include="Source Files\N64 System\SaveType">
<UniqueIdentifier>{f058be82-aec4-4e3d-a163-2eec0aa64feb}</UniqueIdentifier> <UniqueIdentifier>{f058be82-aec4-4e3d-a163-2eec0aa64feb}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Header Files\Plugin Spec">
<UniqueIdentifier>{a29536c1-cda4-43b0-b3c6-12a24f42be64}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">
@ -773,6 +776,21 @@
<ClInclude Include="N64System\MemoryHandler\CartridgeDomain2Address2Handler.h"> <ClInclude Include="N64System\MemoryHandler\CartridgeDomain2Address2Handler.h">
<Filter>Header Files\N64 System\MemoryHandler</Filter> <Filter>Header Files\N64 System\MemoryHandler</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Base.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Video.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Audio.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Input.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
<ClInclude Include="..\Project64-plugin-spec\Rsp.h">
<Filter>Header Files\Plugin Spec</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Version.h.in"> <None Include="Version.h.in">

View File

@ -355,7 +355,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Debugger_TraceAppCleanup, new CSettingTypeApplication("Logging", "App Cleanup", (uint32_t)g_ModuleLogLevel[TraceAppCleanup])); AddHandler(Debugger_TraceAppCleanup, new CSettingTypeApplication("Logging", "App Cleanup", (uint32_t)g_ModuleLogLevel[TraceAppCleanup]));
AddHandler(Debugger_TraceN64System, new CSettingTypeApplication("Logging", "N64 System", (uint32_t)g_ModuleLogLevel[TraceN64System])); AddHandler(Debugger_TraceN64System, new CSettingTypeApplication("Logging", "N64 System", (uint32_t)g_ModuleLogLevel[TraceN64System]));
AddHandler(Debugger_TracePlugins, new CSettingTypeApplication("Logging", "Plugins", (uint32_t)g_ModuleLogLevel[TracePlugins])); AddHandler(Debugger_TracePlugins, new CSettingTypeApplication("Logging", "Plugins", (uint32_t)g_ModuleLogLevel[TracePlugins]));
AddHandler(Debugger_TraceGFXPlugin, new CSettingTypeApplication("Logging", "GFX Plugin", (uint32_t)g_ModuleLogLevel[TraceGFXPlugin])); AddHandler(Debugger_TraceVideoPlugin, new CSettingTypeApplication("Logging", "GFX Plugin", (uint32_t)g_ModuleLogLevel[TraceVideoPlugin]));
AddHandler(Debugger_TraceAudioPlugin, new CSettingTypeApplication("Logging", "Audio Plugin", (uint32_t)g_ModuleLogLevel[TraceAudioPlugin])); AddHandler(Debugger_TraceAudioPlugin, new CSettingTypeApplication("Logging", "Audio Plugin", (uint32_t)g_ModuleLogLevel[TraceAudioPlugin]));
AddHandler(Debugger_TraceControllerPlugin, new CSettingTypeApplication("Logging", "Controller Plugin", (uint32_t)g_ModuleLogLevel[TraceControllerPlugin])); AddHandler(Debugger_TraceControllerPlugin, new CSettingTypeApplication("Logging", "Controller Plugin", (uint32_t)g_ModuleLogLevel[TraceControllerPlugin]));
AddHandler(Debugger_TraceRSPPlugin, new CSettingTypeApplication("Logging", "RSP Plugin", (uint32_t)g_ModuleLogLevel[TraceRSPPlugin])); AddHandler(Debugger_TraceRSPPlugin, new CSettingTypeApplication("Logging", "RSP Plugin", (uint32_t)g_ModuleLogLevel[TraceRSPPlugin]));

View File

@ -273,7 +273,7 @@ enum SettingID
Debugger_TraceAppCleanup, Debugger_TraceAppCleanup,
Debugger_TraceN64System, Debugger_TraceN64System,
Debugger_TracePlugins, Debugger_TracePlugins,
Debugger_TraceGFXPlugin, Debugger_TraceVideoPlugin,
Debugger_TraceAudioPlugin, Debugger_TraceAudioPlugin,
Debugger_TraceControllerPlugin, Debugger_TraceControllerPlugin,
Debugger_TraceRSPPlugin, Debugger_TraceRSPPlugin,

View File

@ -9,7 +9,7 @@ enum TraceModuleProject64
TraceAppCleanup, TraceAppCleanup,
TraceN64System, TraceN64System,
TracePlugins, TracePlugins,
TraceGFXPlugin, TraceVideoPlugin,
TraceAudioPlugin, TraceAudioPlugin,
TraceControllerPlugin, TraceControllerPlugin,
TraceRSPPlugin, TraceRSPPlugin,

View File

@ -209,14 +209,14 @@ void CProject64Input::LockMouse()
{ {
if (IsMouseUsed() == false) return UnlockMouse(); if (IsMouseUsed() == false) return UnlockMouse();
if (m_MouseLock == true) return; if (m_MouseLock == true) return;
PostMessage((HWND)m_ControlInfo.hwnd, WM_HIDE_CUROSR, false, 0); PostMessage((HWND)m_ControlInfo.hWnd, WM_HIDE_CUROSR, false, 0);
m_MouseLock = true; m_MouseLock = true;
} }
void CProject64Input::UnlockMouse() void CProject64Input::UnlockMouse()
{ {
if (m_MouseLock == false) return; if (m_MouseLock == false) return;
PostMessage((HWND)m_ControlInfo.hwnd, WM_HIDE_CUROSR, true, 0); PostMessage((HWND)m_ControlInfo.hWnd, WM_HIDE_CUROSR, true, 0);
m_MouseLock = false; m_MouseLock = false;
} }
@ -247,6 +247,6 @@ bool CProject64Input::IsMouseUsed()
void CProject64Input::LockCursor() void CProject64Input::LockCursor()
{ {
RECT rect; RECT rect;
GetWindowRect((HWND)m_ControlInfo.hwnd, &rect); GetWindowRect((HWND)m_ControlInfo.hWnd, &rect);
SetCursorPos((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2); SetCursorPos((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
} }

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 "Shortcuts.h" #include "Shortcuts.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"
@ -98,8 +98,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

@ -3,7 +3,7 @@
#include <string> #include <string>
#include "N64Controller.h" #include "N64Controller.h"
#include "Shortcuts.h" #include "Shortcuts.h"
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec\Input.h>
class CInputSettings class CInputSettings
{ {

View File

@ -84,7 +84,7 @@ public:
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE)); CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
DWORD_PTR Pak = ControllerPak.GetItemData(ControllerPak.GetCurSel()); DWORD_PTR Pak = ControllerPak.GetItemData(ControllerPak.GetCurSel());
if (Pak != m_ControlInfo.Plugin) if (Pak != (DWORD_PTR)m_ControlInfo.Plugin)
{ {
m_ControlInfo.Plugin = (Pak & 0xFFFFFFFF); m_ControlInfo.Plugin = (Pak & 0xFFFFFFFF);
bChanged = true; bChanged = true;

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,6 +1,6 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include "ControllerSpec1.1.h" #include <Project64-plugin-spec/Input.h>
#include "Shortcuts.h" #include "Shortcuts.h"
void ConfigShortcut(SHORTCUTS & Shortcuts); void ConfigShortcut(SHORTCUTS & Shortcuts);

View File

@ -0,0 +1,158 @@
#pragma once
#include "base.h"
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct
{
void * hWnd;
void * hinst;
int32_t Reserved;
uint8_t * HEADER;
uint8_t * RDRAM;
uint8_t * DMEM;
uint8_t * IMEM;
uint32_t * MI_INTR_REG;
uint32_t * AI_DRAM_ADDR_REG;
uint32_t * AI_LEN_REG;
uint32_t * AI_CONTROL_REG;
uint32_t * AI_STATUS_REG;
uint32_t * AI_DACRATE_REG;
uint32_t * AI_BITRATE_REG;
void(CALL *CheckInterrupts)(void);
} AUDIO_INFO;
/*
Function: AiDacrateChanged
Purpose: This function is called to notify the DLL that the
AiDacrate registers value has been changed.
Input: The system type:
AUDIO_SYSTEM_NTSC 0
AUDIO_SYSTEM_PAL 1
AUDIO_SYSTEM_MPAL 2
Output: None
*/
EXPORT void CALL AiDacrateChanged(int32_t SystemType);
/*
Function: AiLenChanged
Purpose: This function is called to notify the DLL that the
AiLen registers value has been changed.
Input: None
Output: None
*/
EXPORT void CALL AiLenChanged(void);
/*
Function: AiReadLength
Purpose: This function is called to allow the DLL to return the
value that AI_LEN_REG should equal
Input: None
Output: The amount of bytes still left to play.
*/
EXPORT uint32_t CALL AiReadLength(void);
/*
Function: AiUpdate
Purpose: This function is called to allow the DLL to update
things on a regular basis (check how long to sound to
go, copy more stuff to the buffer, anything you like).
The function is designed to go in to the message loop
of the main window...but can be placed anywhere you
like.
Input: If wait is set to true, then this function should wait
till there is a message in its message queue.
Output: None
*/
EXPORT void CALL AiUpdate(int32_t Wait);
/*
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: 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: InitiateSound
Purpose: This function is called when the DLL is started to give
information from the emulator that the N64 audio
interface needs
Input: Audio_Info is passed to this function which is defined
above.
Output: True on success
FALSE on failure to initialize
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 int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info);
/*
Function: ProcessAList
Purpose: This function is called when there is a Alist to be
processed. The DLL will have to work out all the info
about the AList itself.
Input: None
Output: None
*/
EXPORT void CALL ProcessAList(void);
/*
Function: RomClosed
Purpose: This function is called when a ROM is closed.
Input: None
Output: None
*/
EXPORT void CALL RomClosed(void);
#if defined(__cplusplus)
}
#endif

View File

@ -0,0 +1,114 @@
#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: 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,23 +15,16 @@ enum
PLUGIN_RAW = 5, PLUGIN_RAW = 5,
}; };
enum enum PresentType
{ {
PRESENT_NONE = 0, PRESENT_NONE = 0,
PRESENT_CONT = 1, PRESENT_CONT = 1,
PRESENT_MOUSE = 2, PRESENT_MOUSE = 2,
}; };
// 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
{ {
@ -78,9 +59,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;
@ -88,23 +69,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
@ -119,50 +90,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.
@ -171,7 +100,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);
/* /*
@ -183,7 +111,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);
/* /*
@ -197,28 +124,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: EmulationPaused Function: EmulationPaused
Purpose: This function is called when the emulation is paused. (from the Purpose: This function is called when the emulation is paused. (from the
@ -226,7 +133,6 @@ emulation thread)
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL EmulationPaused(void); EXPORT void CALL EmulationPaused(void);
/* /*
@ -236,7 +142,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);
/* /*
@ -246,7 +151,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_KeyUp(uint32_t wParam, uint32_t lParam); EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
/* /*
@ -256,5 +160,8 @@ plugin.
Input: wParam and lParam of the WM_KILLFOCUS message. Input: wParam and lParam of the WM_KILLFOCUS message.
Output: None Output: None
*/ */
EXPORT void CALL WM_KillFocus(uint32_t wParam, uint32_t lParam); EXPORT void CALL WM_KillFocus(uint32_t wParam, uint32_t lParam);
#if defined(__cplusplus)
}
#endif

View File

@ -0,0 +1,91 @@
#pragma once
#include "Base.h"
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 {
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) (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;
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,410 @@
// Project64 - A Nintendo 64 emulator
// http://www.pj64-emu.com/
// Copyright(C) 2001-2021 Project64
// Copyright(C) 2003-2009 Sergey 'Gonetz' Lipski
// Copyright(C) 2002 Dave2001
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
#pragma once
#include <stdio.h>
#include <fstream>
#include <stdlib.h>
#include <stddef.h> // offsetof
#include <Common/MemTest.h>
#include "Config.h"
#include "Settings.h"
#include "rdp.h"
#if defined __VISUALC__
#define GLIDE64_TRY __try
#define GLIDE64_CATCH __except (EXCEPTION_EXECUTE_HANDLER)
#else
#define GLIDE64_TRY try
#define GLIDE64_CATCH catch (...)
#endif
#if defined(__cplusplus)
extern "C" {
#endif
//********
// Logging
// ********************************
// ** TAKE OUT BEFORE RELEASE!!! **
//#define LOG_UCODE
// note that some of these things are inserted/removed
// from within the code & may not be changed by this define.
// ********************************
//#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
// "The gfx plugin has caused an exception" instead.
// Usually enabled
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
extern unsigned int BMASK;
extern uint32_t update_screen_count;
extern int GfxInitDone;
extern bool g_romopen;
extern int to_fullscreen;
extern int ev_fullscreen;
extern int exception;
int InitGfx();
void ReleaseGfx();
// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
// add to it.
__inline uint32_t segoffset(uint32_t so)
{
return (rdp.segment[(so >> 24) & 0x0f] + (so&BMASK))&BMASK;
}
/* Plugin types */
#define PLUGIN_TYPE_GFX 2
#ifdef _WIN32
#define EXPORT extern "C" __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT __attribute__((visibility("default")))
#define CALL
#endif
/***** Structures *****/
typedef struct
{
uint16_t Version; /* Set to 0x0103 */
uint16_t 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 */
int NormalMemory; /* a normal uint8_t array */
int MemoryBswaped; /* a normal uint8_t array where the memory has been pre
bswap on a dword (32 bits) boundry */
} PLUGIN_INFO;
typedef struct
{
void * hWnd; /* Render window */
void * hStatusBar; /* if render window does not have a status bar then this is nullptr */
int32_t 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
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 * 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;
extern GFX_INFO gfx;
extern bool no_dlist;
/******************************************************************
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(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: 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: 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: 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: 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: 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: 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
/******************************************************************
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 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBWrite(uint32_t, uint32_t);
typedef struct
{
uint32_t addr;
uint32_t val;
uint32_t size; // 1 = uint8_t, 2 = uint16_t, 4=uint32_t
} FrameBufferModifyEntry;
/******************************************************************
Function: FrameBufferWriteList
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
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, uint32_t 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 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBRead(uint32_t addr);
/************************************************************************
Function: FBGetFrameBufferInfo
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:
= 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
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)
}
#endif

View File

@ -23,388 +23,47 @@
#define GLIDE64_CATCH catch (...) #define GLIDE64_CATCH catch (...)
#endif #endif
#if defined(__cplusplus) #include <Project64-plugin-spec/Video.h>
extern "C" {
#endif
//******** //********
// Logging // Logging
// ******************************** // ********************************
// ** TAKE OUT BEFORE RELEASE!!! ** // ** TAKE OUT BEFORE RELEASE!!! **
//#define LOG_UCODE //#define LOG_UCODE
// 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 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.
// 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?
extern unsigned int BMASK; extern unsigned int BMASK;
extern uint32_t update_screen_count; extern uint32_t update_screen_count;
extern int GfxInitDone; extern int GfxInitDone;
extern bool g_romopen; extern bool g_romopen;
extern int to_fullscreen; extern int to_fullscreen;
extern int ev_fullscreen; extern int ev_fullscreen;
extern int exception; extern int exception;
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 uint32_t segoffset(uint32_t so) __inline uint32_t segoffset(uint32_t so)
{ {
return (rdp.segment[(so >> 24) & 0x0f] + (so&BMASK))&BMASK; return (rdp.segment[(so >> 24) & 0x0f] + (so&BMASK))&BMASK;
}
/* Plugin types */
#define PLUGIN_TYPE_GFX 2
#ifdef _WIN32
#define EXPORT extern "C" __declspec(dllexport)
#define CALL __cdecl
#else
#define EXPORT __attribute__((visibility("default")))
#define CALL
#endif
/***** Structures *****/
typedef struct
{
uint16_t Version; /* Set to 0x0103 */
uint16_t 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 */
int NormalMemory; /* a normal uint8_t array */
int MemoryBswaped; /* a normal uint8_t array where the memory has been pre
bswap on a dword (32 bits) boundry */
} PLUGIN_INFO;
typedef struct
{
void * hWnd; /* Render window */
void * hStatusBar; /* if render window does not have a status bar then this is nullptr */
int32_t 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
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 * 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;
extern GFX_INFO gfx;
extern bool no_dlist;
/******************************************************************
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(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: 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: 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: 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: 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: 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: 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
/******************************************************************
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 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBWrite(uint32_t, uint32_t);
typedef struct
{
uint32_t addr;
uint32_t val;
uint32_t size; // 1 = uint8_t, 2 = uint16_t, 4=uint32_t
} FrameBufferModifyEntry;
/******************************************************************
Function: FrameBufferWriteList
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
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, uint32_t 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 = uint8_t, 2 = uint16_t, 4 = uint32_t
output: none
*******************************************************************/
EXPORT void CALL FBRead(uint32_t addr);
/************************************************************************
Function: FBGetFrameBufferInfo
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:
= 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
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)
} }
#endif
extern GFX_INFO gfx;
extern bool no_dlist;

View File

@ -608,7 +608,7 @@ 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) void CALL CaptureScreen(const char * Directory)
{ {
g_capture_screen = true; g_capture_screen = true;
g_capture_path = Directory; g_capture_path = Directory;
@ -708,7 +708,7 @@ output: none
void CALL GetDllInfo(PLUGIN_INFO * PluginInfo) void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
{ {
PluginInfo->Version = 0x0104; // Set to 0x0104 PluginInfo->Version = 0x0104; // Set to 0x0104
PluginInfo->Type = PLUGIN_TYPE_GFX; // Set to PLUGIN_TYPE_GFX PluginInfo->Type = PLUGIN_TYPE_VIDEO; // Set to PLUGIN_TYPE_GFX
#ifdef _DEBUG #ifdef _DEBUG
sprintf(PluginInfo->Name, "Project64 Video Plugin (Debug): %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "Project64 Video Plugin (Debug): %s", VER_FILE_VERSION_STR);
#else #else
@ -717,8 +717,8 @@ void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
// 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
PluginInfo->NormalMemory = FALSE; // a normal uint8_t array PluginInfo->Reserved1 = FALSE; // a normal uint8_t array
PluginInfo->MemoryBswaped = TRUE; // a normal uint8_t array where the memory has been pre PluginInfo->Reserved2 = TRUE; // a normal uint8_t array where the memory has been pre
// bswap on a dword (32 bits) boundry // bswap on a dword (32 bits) boundry
} }

View File

@ -21,6 +21,7 @@
#include "trace.h" #include "trace.h"
#include "SettingsID.h" #include "SettingsID.h"
#include <Settings/Settings.h> #include <Settings/Settings.h>
#include<Project64-plugin-spec\Video.h>
#ifdef _WIN32 #ifdef _WIN32
#include <Common/CriticalSection.h> #include <Common/CriticalSection.h>
@ -3239,19 +3240,6 @@ EXPORT void CALL FBRead(uint32_t addr)
} }
} }
/******************************************************************
Function: FrameBufferWriteList
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
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry* /*plist*/, uint32_t size)
{
WriteTrace(TraceGlide64, TraceDebug, "size: %d", size);
}
/****************************************************************** /******************************************************************
Function: FrameBufferWrite Function: FrameBufferWrite
Purpose: This function is called to notify the dll that the Purpose: This function is called to notify the dll that the

View File

@ -83,7 +83,7 @@ void CPluginList::AddPluginFromDir(CPath Dir)
} }
PLUGIN Plugin = { 0 }; PLUGIN Plugin = { 0 };
Plugin.Info.MemoryBswaped = true; Plugin.Info.Reserved2 = true;
GetDllInfo(&Plugin.Info); GetDllInfo(&Plugin.Info);
if (!CPlugin::ValidPluginVersion(Plugin.Info)) if (!CPlugin::ValidPluginVersion(Plugin.Info))
{ {

View File

@ -40,7 +40,7 @@ CMainMenu::CMainMenu(CMainGui * hMainWindow) :
m_ChangeSettingList.push_back(Debugger_TraceAppCleanup); m_ChangeSettingList.push_back(Debugger_TraceAppCleanup);
m_ChangeSettingList.push_back(Debugger_TraceN64System); m_ChangeSettingList.push_back(Debugger_TraceN64System);
m_ChangeSettingList.push_back(Debugger_TracePlugins); m_ChangeSettingList.push_back(Debugger_TracePlugins);
m_ChangeSettingList.push_back(Debugger_TraceGFXPlugin); m_ChangeSettingList.push_back(Debugger_TraceVideoPlugin);
m_ChangeSettingList.push_back(Debugger_TraceAudioPlugin); m_ChangeSettingList.push_back(Debugger_TraceAudioPlugin);
m_ChangeSettingList.push_back(Debugger_TraceControllerPlugin); m_ChangeSettingList.push_back(Debugger_TraceControllerPlugin);
m_ChangeSettingList.push_back(Debugger_TraceRSPPlugin); m_ChangeSettingList.push_back(Debugger_TraceRSPPlugin);
@ -211,9 +211,9 @@ void CMainMenu::OnEndEmulation(void)
void CMainMenu::OnScreenShot(void) void CMainMenu::OnScreenShot(void)
{ {
stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot)); stdstr Dir(g_Settings->LoadStringVal(Directory_SnapShot));
WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen(%s): Starting", Dir.c_str()); WriteTrace(TraceVideoPlugin, TraceDebug, "CaptureScreen(%s): Starting", Dir.c_str());
g_Plugins->Gfx()->CaptureScreen(Dir.c_str()); g_Plugins->Gfx()->CaptureScreen(Dir.c_str());
WriteTrace(TraceGFXPlugin, TraceDebug, "CaptureScreen: Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "CaptureScreen: Done");
} }
void CMainMenu::OnSaveAs(HWND hWnd) void CMainMenu::OnSaveAs(HWND hWnd)
@ -412,9 +412,9 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN a"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN a");
m_Gui->MakeWindowOnTop(false); m_Gui->MakeWindowOnTop(false);
Notify().SetGfxPlugin(nullptr); Notify().SetGfxPlugin(nullptr);
WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "ChangeWindow: Starting");
g_Plugins->Gfx()->ChangeWindow(); g_Plugins->Gfx()->ChangeWindow();
WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "ChangeWindow: Done");
ShowCursor(true); ShowCursor(true);
m_Gui->ShowStatusBar(g_Settings->LoadBool((SettingID)UserInterface_ShowStatusBar)); m_Gui->ShowStatusBar(g_Settings->LoadBool((SettingID)UserInterface_ShowStatusBar));
m_Gui->MakeWindowOnTop(UISettingsLoadBool(UserInterface_AlwaysOnTop)); m_Gui->MakeWindowOnTop(UISettingsLoadBool(UserInterface_AlwaysOnTop));
@ -429,9 +429,9 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 2"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_FULLSCREEN b 2");
try try
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "ChangeWindow: Starting");
g_Plugins->Gfx()->ChangeWindow(); g_Plugins->Gfx()->ChangeWindow();
WriteTrace(TraceGFXPlugin, TraceDebug, "ChangeWindow: Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "ChangeWindow: Done");
} }
catch (...) catch (...)
{ {
@ -468,7 +468,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
break; break;
case ID_OPTIONS_CONFIG_GFX: case ID_OPTIONS_CONFIG_GFX:
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_GFX"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_GFX");
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_GFX); g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_VIDEO);
break; break;
case ID_OPTIONS_CONFIG_AUDIO: case ID_OPTIONS_CONFIG_AUDIO:
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_AUDIO"); WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_AUDIO");
@ -535,7 +535,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUGGER_TRACE_APPCLEANUP: SetTraceModuleSetttings(Debugger_TraceAppCleanup); break; case ID_DEBUGGER_TRACE_APPCLEANUP: SetTraceModuleSetttings(Debugger_TraceAppCleanup); break;
case ID_DEBUGGER_TRACE_N64SYSTEM: SetTraceModuleSetttings(Debugger_TraceN64System); break; case ID_DEBUGGER_TRACE_N64SYSTEM: SetTraceModuleSetttings(Debugger_TraceN64System); break;
case ID_DEBUGGER_TRACE_PLUGINS: SetTraceModuleSetttings(Debugger_TracePlugins); break; case ID_DEBUGGER_TRACE_PLUGINS: SetTraceModuleSetttings(Debugger_TracePlugins); break;
case ID_DEBUGGER_TRACE_GFXPLUGIN: SetTraceModuleSetttings(Debugger_TraceGFXPlugin); break; case ID_DEBUGGER_TRACE_GFXPLUGIN: SetTraceModuleSetttings(Debugger_TraceVideoPlugin); break;
case ID_DEBUGGER_TRACE_AUDIOPLUGIN: SetTraceModuleSetttings(Debugger_TraceAudioPlugin); break; case ID_DEBUGGER_TRACE_AUDIOPLUGIN: SetTraceModuleSetttings(Debugger_TraceAudioPlugin); break;
case ID_DEBUGGER_TRACE_CONTROLLERPLUGIN: SetTraceModuleSetttings(Debugger_TraceControllerPlugin); break; case ID_DEBUGGER_TRACE_CONTROLLERPLUGIN: SetTraceModuleSetttings(Debugger_TraceControllerPlugin); break;
case ID_DEBUGGER_TRACE_RSPPLUGIN: SetTraceModuleSetttings(Debugger_TraceRSPPlugin); break; case ID_DEBUGGER_TRACE_RSPPLUGIN: SetTraceModuleSetttings(Debugger_TraceRSPPlugin); break;
@ -1131,7 +1131,7 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_GFXPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"GFX plugin"); Item.Reset(ID_DEBUGGER_TRACE_GFXPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"GFX plugin");
Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceGFXPlugin) == TraceVerbose); Item.SetItemTicked(g_Settings->LoadDword(Debugger_TraceVideoPlugin) == TraceVerbose);
DebugAppLoggingMenu.push_back(Item); DebugAppLoggingMenu.push_back(Item);
Item.Reset(ID_DEBUGGER_TRACE_AUDIOPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Audio plugin"); Item.Reset(ID_DEBUGGER_TRACE_AUDIOPLUGIN, EMPTY_STRING, EMPTY_STDSTR, nullptr, L"Audio plugin");

View File

@ -692,9 +692,9 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
{ {
if (g_Plugins->Gfx() && g_Plugins->Gfx()->MoveScreen) if (g_Plugins->Gfx() && g_Plugins->Gfx()->MoveScreen)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "Starting");
g_Plugins->Gfx()->MoveScreen((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam)); g_Plugins->Gfx()->MoveScreen((int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam));
WriteTrace(TraceGFXPlugin, TraceDebug, "Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "Done");
} }
} }
break; break;
@ -1110,9 +1110,9 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
{ {
if (g_Plugins->Gfx()) if (g_Plugins->Gfx())
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "Starting");
g_Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam)); g_Plugins->Gfx()->ProcessMenuItem(LOWORD(wParam));
WriteTrace(TraceGFXPlugin, TraceDebug, "Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "Done");
} }
} }
else if (LOWORD(wParam) > 5200 && LOWORD(wParam) <= 5300) else if (LOWORD(wParam) > 5200 && LOWORD(wParam) <= 5300)
@ -1127,9 +1127,9 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
Rom.SaveRomSettingID(true); Rom.SaveRomSettingID(true);
g_Notify->DisplayMessage(0, EMPTY_STRING); g_Notify->DisplayMessage(0, EMPTY_STRING);
BYTE * RomHeader = Rom.GetRomAddress(); BYTE * RomHeader = Rom.GetRomAddress();
WriteTrace(TraceGFXPlugin, TraceDebug, "OnRomBrowserMenuItem - Starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "OnRomBrowserMenuItem - Starting");
g_Plugins->Gfx()->OnRomBrowserMenuItem(LOWORD(wParam), hWnd, RomHeader); g_Plugins->Gfx()->OnRomBrowserMenuItem(LOWORD(wParam), hWnd, RomHeader);
WriteTrace(TraceGFXPlugin, TraceDebug, "OnRomBrowserMenuItem - Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "OnRomBrowserMenuItem - Done");
if (g_Rom) if (g_Rom)
{ {
g_Rom->SaveRomSettingID(false); g_Rom->SaveRomSettingID(false);

View File

@ -112,9 +112,9 @@ void CNotificationImp::DisplayMessage(int DisplayTime, const char * Message) con
{ {
if (m_gfxPlugin && m_gfxPlugin->DrawStatus) if (m_gfxPlugin && m_gfxPlugin->DrawStatus)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "DrawStatus - Starting"); WriteTrace(TraceVideoPlugin, TraceDebug, "DrawStatus - Starting");
m_gfxPlugin->DrawStatus(Message, FALSE); m_gfxPlugin->DrawStatus(Message, FALSE);
WriteTrace(TraceGFXPlugin, TraceDebug, "DrawStatus - Done"); WriteTrace(TraceVideoPlugin, TraceDebug, "DrawStatus - Done");
} }
} }
else else

View File

@ -29,7 +29,7 @@ CGamePluginPage::CGamePluginPage(HWND hParent, const RECT & rcDispay)
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
AddPlugins(GFX_LIST, Game_EditPlugin_Gfx, PLUGIN_TYPE_GFX); AddPlugins(GFX_LIST, Game_EditPlugin_Gfx, PLUGIN_TYPE_VIDEO);
AddPlugins(AUDIO_LIST, Game_EditPlugin_Audio, PLUGIN_TYPE_AUDIO); AddPlugins(AUDIO_LIST, Game_EditPlugin_Audio, PLUGIN_TYPE_AUDIO);
AddPlugins(CONT_LIST, Game_EditPlugin_Contr, PLUGIN_TYPE_CONTROLLER); AddPlugins(CONT_LIST, Game_EditPlugin_Contr, PLUGIN_TYPE_CONTROLLER);
AddPlugins(RSP_LIST, Game_EditPlugin_RSP, PLUGIN_TYPE_RSP); AddPlugins(RSP_LIST, Game_EditPlugin_RSP, PLUGIN_TYPE_RSP);

View File

@ -28,7 +28,7 @@ COptionPluginPage::COptionPluginPage(HWND hParent, const RECT & rcDispay)
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME)); m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME)); m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
AddPlugins(GFX_LIST, Plugin_GFX_Current, PLUGIN_TYPE_GFX); AddPlugins(GFX_LIST, Plugin_GFX_Current, PLUGIN_TYPE_VIDEO);
AddPlugins(AUDIO_LIST, Plugin_AUDIO_Current, PLUGIN_TYPE_AUDIO); AddPlugins(AUDIO_LIST, Plugin_AUDIO_Current, PLUGIN_TYPE_AUDIO);
AddPlugins(CONT_LIST, Plugin_CONT_Current, PLUGIN_TYPE_CONTROLLER); AddPlugins(CONT_LIST, Plugin_CONT_Current, PLUGIN_TYPE_CONTROLLER);
AddPlugins(RSP_LIST, Plugin_RSP_Current, PLUGIN_TYPE_RSP); AddPlugins(RSP_LIST, Plugin_RSP_Current, PLUGIN_TYPE_RSP);

View File

@ -167,7 +167,7 @@ DWORD RunRecompilerCPU (DWORD Cycles);
#define MI_INTR_SP 0x01 /* Bit 0: SP intr */ #define MI_INTR_SP 0x01 /* Bit 0: SP intr */
__declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) uint32_t DoRspCycles (uint32_t Cycles )
{ {
extern Boolean AudioHle, GraphicsHle; extern Boolean AudioHle, GraphicsHle;
DWORD TaskType = *(DWORD*)(RSPInfo.DMEM + 0xFC0); DWORD TaskType = *(DWORD*)(RSPInfo.DMEM + 0xFC0);

View File

@ -216,8 +216,8 @@ EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo)
#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

@ -24,7 +24,7 @@
#define X86_RECOMP_VERBOSE #define X86_RECOMP_VERBOSE
#define BUILD_BRANCHLABELS_VERBOSE #define BUILD_BRANCHLABELS_VERBOSE
DWORD CompilePC, JumpTableSize, BlockID = 0; uint32_t CompilePC, JumpTableSize, BlockID = 0;
DWORD dwBuffer = MainBuffer; DWORD dwBuffer = MainBuffer;
Boolean ChangedPC; Boolean ChangedPC;

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <Project64-plugin-spec/Rsp.h>
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
@ -7,132 +8,14 @@ extern "C" {
#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);
#define InterpreterCPU 0 #define InterpreterCPU 0
#define RecompilerCPU 1 #define RecompilerCPU 1