2016-04-28 07:09:44 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "Rsp.h"
|
|
|
|
|
|
|
|
CHle * g_hle = NULL;
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
void * g_hinstDLL;
|
|
|
|
|
|
|
|
BOOL WINAPI DllMain(void * hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/)
|
|
|
|
{
|
|
|
|
g_hinstDLL = hinst;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
|
|
|
Function: CloseDLL
|
|
|
|
Purpose: This function is called when the emulator is closing
|
|
|
|
down allowing the DLL to de-initialize.
|
2021-05-18 11:51:36 +00:00
|
|
|
Input: None
|
|
|
|
Output: None
|
2021-03-16 05:38:30 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
void CloseDLL(void)
|
|
|
|
{
|
|
|
|
if (g_hle)
|
|
|
|
{
|
|
|
|
delete g_hle;
|
|
|
|
g_hle = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
|
|
|
Function: DllAbout
|
|
|
|
Purpose: This function is optional function that is provided
|
|
|
|
to give further information about the DLL.
|
2021-05-18 11:51:36 +00:00
|
|
|
Input: A handle to the window that calls this function
|
|
|
|
Output: None
|
2021-03-16 05:38:30 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
void DllAbout(void * hParent)
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
2020-06-09 13:04:38 +00:00
|
|
|
MessageBox((HWND)hParent, L"need to do", L"About", MB_OK | MB_ICONINFORMATION);
|
2016-04-28 07:09:44 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
2016-04-28 07:09:44 +00:00
|
|
|
Function: DoRspCycles
|
2021-03-16 05:38:30 +00:00
|
|
|
Purpose: This function is to allow the RSP to run in parallel with
|
2016-04-28 07:09:44 +00:00
|
|
|
the r4300 switching control back to the r4300 once the
|
|
|
|
function ends.
|
2021-05-18 11:51:36 +00:00
|
|
|
Input: The number of cycles that is meant to be executed
|
|
|
|
Output: The number of cycles that was executed. This value can
|
2016-04-28 07:09:44 +00:00
|
|
|
be greater than the number of cycles that the RSP
|
|
|
|
should have performed.
|
2021-03-16 05:38:30 +00:00
|
|
|
(this value is ignored if the RSP is stopped)
|
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
uint32_t DoRspCycles(uint32_t Cycles)
|
|
|
|
{
|
|
|
|
if (g_hle)
|
|
|
|
{
|
|
|
|
g_hle->hle_execute();
|
|
|
|
}
|
|
|
|
return Cycles;
|
|
|
|
}
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
|
|
|
Function: GetDllInfo
|
|
|
|
Purpose: This function allows the emulator to gather information
|
|
|
|
about the DLL by filling in the PluginInfo structure.
|
2021-05-18 11:51:36 +00:00
|
|
|
Input: A pointer to a PLUGIN_INFO structure that needs to be
|
2021-03-16 05:38:30 +00:00
|
|
|
filled by the function. (see def above)
|
2021-05-18 11:51:36 +00:00
|
|
|
Output: None
|
2021-03-16 05:38:30 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
void GetDllInfo(PLUGIN_INFO * PluginInfo)
|
|
|
|
{
|
|
|
|
PluginInfo->Version = 0x0102;
|
|
|
|
PluginInfo->Type = PLUGIN_TYPE_RSP;
|
|
|
|
#ifdef _DEBUG
|
2021-03-16 05:38:30 +00:00
|
|
|
sprintf(PluginInfo->Name, "RSP HLE debug plugin %s", VER_FILE_VERSION_STR);
|
2016-04-28 07:09:44 +00:00
|
|
|
#else
|
2021-03-16 05:38:30 +00:00
|
|
|
sprintf(PluginInfo->Name, "RSP HLE plugin %s", VER_FILE_VERSION_STR);
|
2016-04-28 07:09:44 +00:00
|
|
|
#endif
|
|
|
|
PluginInfo->NormalMemory = false;
|
|
|
|
PluginInfo->MemoryBswaped = true;
|
|
|
|
}
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
2016-04-28 07:09:44 +00:00
|
|
|
Function: InitiateRSP
|
|
|
|
Purpose: This function is called when the DLL is started to give
|
2021-03-16 05:38:30 +00:00
|
|
|
information from the emulator that the N64 RSP
|
2016-04-28 07:09:44 +00:00
|
|
|
interface needs
|
2021-05-18 11:51:36 +00:00
|
|
|
Input: Rsp_Info is passed to this function which is defined
|
2016-04-28 07:09:44 +00:00
|
|
|
above.
|
|
|
|
CycleCount is the number of cycles between switching
|
2021-03-16 05:38:30 +00:00
|
|
|
control between the RSP and r4300i core.
|
2021-05-18 11:51:36 +00:00
|
|
|
Output: None
|
2021-03-16 05:38:30 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * /*CycleCount*/)
|
|
|
|
{
|
|
|
|
if (g_hle)
|
|
|
|
{
|
|
|
|
delete g_hle;
|
|
|
|
g_hle = NULL;
|
|
|
|
}
|
|
|
|
g_hle = new CHle(Rsp_Info);
|
|
|
|
}
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
2016-04-28 07:09:44 +00:00
|
|
|
Function: RomOpen
|
2021-05-18 11:51:36 +00:00
|
|
|
Purpose: This function is called when a ROM is opened
|
|
|
|
Input: None
|
|
|
|
Output: None
|
2021-03-16 05:38:30 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
void RomOpen(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-03-16 05:38:30 +00:00
|
|
|
/*
|
2016-04-28 07:09:44 +00:00
|
|
|
Function: RomClosed
|
2021-05-18 11:51:36 +00:00
|
|
|
Purpose: This function is called when a ROM is closed
|
|
|
|
Input: None
|
|
|
|
Output: None
|
2021-03-16 05:38:30 +00:00
|
|
|
*/
|
|
|
|
|
2016-04-28 07:09:44 +00:00
|
|
|
void RomClosed(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginLoaded(void)
|
|
|
|
{
|
2021-03-16 05:38:30 +00:00
|
|
|
}
|