2016-02-11 21:44:13 +00:00
|
|
|
#ifdef _WIN32
|
2016-01-27 09:11:59 +00:00
|
|
|
#include <Windows.h>
|
|
|
|
#include <commctrl.h>
|
2023-08-10 04:46:57 +00:00
|
|
|
#include <memory>
|
2023-06-01 11:46:23 +00:00
|
|
|
#include <windowsx.h>
|
2017-07-30 19:14:59 +00:00
|
|
|
#endif
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1910
|
2017-07-30 09:13:39 +00:00
|
|
|
#include <intrin.h>
|
2016-02-11 21:44:13 +00:00
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
#include <stdio.h>
|
2016-02-15 20:55:07 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
#include "../Settings/Settings.h"
|
2016-02-11 21:45:04 +00:00
|
|
|
#include <Common/StdString.h>
|
2021-04-12 06:34:26 +00:00
|
|
|
#include <stdint.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2023-08-10 04:46:57 +00:00
|
|
|
#include "Debugger/RSPDebuggerUI.h"
|
2016-02-11 21:45:04 +00:00
|
|
|
#include "RSP Command.h"
|
2023-06-01 11:46:23 +00:00
|
|
|
#include "Rsp.h"
|
2016-01-27 09:11:59 +00:00
|
|
|
#include "breakpoint.h"
|
|
|
|
#include "resource.h"
|
2023-08-10 04:46:57 +00:00
|
|
|
#include <Project64-rsp-core/RSPInfo.h>
|
2023-08-16 23:29:22 +00:00
|
|
|
#include <Project64-rsp-core/Recompiler/RspProfiling.h>
|
|
|
|
#include <Project64-rsp-core/Recompiler/RspRecompilerCPU.h>
|
|
|
|
#include <Project64-rsp-core/Settings/RspSettings.h>
|
|
|
|
#include <Project64-rsp-core/Settings/RspSettingsID.h>
|
2023-08-10 00:57:11 +00:00
|
|
|
#include <Project64-rsp-core/Version.h>
|
2023-08-10 04:46:57 +00:00
|
|
|
#include <Project64-rsp-core/cpu/RSPCpu.h>
|
2023-08-10 00:57:11 +00:00
|
|
|
#include <Project64-rsp-core/cpu/RSPRegisters.h>
|
2023-08-16 23:29:22 +00:00
|
|
|
#include <Project64-rsp-core/cpu/RspLog.h>
|
|
|
|
#include <Project64-rsp-core/cpu/RspMemory.h>
|
2023-08-10 00:57:11 +00:00
|
|
|
#include <Project64-rsp-core/cpu/RspTypes.h>
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
void ClearAllx86Code(void);
|
|
|
|
void ProcessMenuItem(int ID);
|
2016-02-15 20:55:07 +00:00
|
|
|
#ifdef _WIN32
|
2023-07-27 21:27:31 +00:00
|
|
|
BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2016-02-15 20:55:07 +00:00
|
|
|
HMENU hRSPMenu = NULL;
|
|
|
|
#endif
|
2016-02-14 19:01:49 +00:00
|
|
|
|
2016-01-27 09:11:59 +00:00
|
|
|
DEBUG_INFO DebugInfo;
|
2016-02-11 22:23:50 +00:00
|
|
|
void * hinstDLL;
|
2023-08-10 04:46:57 +00:00
|
|
|
std::unique_ptr<RSPDebuggerUI> g_RSPDebuggerUI;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-15 20:55:07 +00:00
|
|
|
extern uint8_t * pLastSecondary;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-03-19 06:41:58 +00:00
|
|
|
// DLL info
|
2023-06-01 11:46:23 +00:00
|
|
|
const char * AppName(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
static stdstr_f Name("RSP %s", VER_FILE_VERSION_STR);
|
|
|
|
return Name.c_str();
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2023-06-01 11:46:23 +00:00
|
|
|
const char * AboutMsg(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
static stdstr_f Msg("RSP emulation plugin\nMade for Project64 (c)\nVersion %s\n\nby Jabo and Zilmar", VER_FILE_VERSION_STR);
|
|
|
|
return Msg.c_str();
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-03-19 06:41:58 +00:00
|
|
|
// Functions
|
|
|
|
|
2016-02-11 22:00:30 +00:00
|
|
|
uint32_t AsciiToHex(char * HexValue)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-02-11 22:00:30 +00:00
|
|
|
size_t Finish, Count;
|
|
|
|
uint32_t Value = 0;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-11 22:00:30 +00:00
|
|
|
Finish = strlen(HexValue);
|
2023-06-01 11:46:23 +00:00
|
|
|
if (Finish > 8)
|
|
|
|
{
|
|
|
|
Finish = 8;
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-11 22:00:30 +00:00
|
|
|
for (Count = 0; Count < Finish; Count++)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
|
|
|
Value = (Value << 4);
|
|
|
|
switch (HexValue[Count])
|
|
|
|
{
|
|
|
|
case '0': break;
|
|
|
|
case '1': Value += 1; break;
|
|
|
|
case '2': Value += 2; break;
|
|
|
|
case '3': Value += 3; break;
|
|
|
|
case '4': Value += 4; break;
|
|
|
|
case '5': Value += 5; break;
|
|
|
|
case '6': Value += 6; break;
|
|
|
|
case '7': Value += 7; break;
|
|
|
|
case '8': Value += 8; break;
|
|
|
|
case '9': Value += 9; break;
|
|
|
|
case 'A': Value += 10; break;
|
|
|
|
case 'a': Value += 10; break;
|
|
|
|
case 'B': Value += 11; break;
|
|
|
|
case 'b': Value += 11; break;
|
|
|
|
case 'C': Value += 12; break;
|
|
|
|
case 'c': Value += 12; break;
|
|
|
|
case 'D': Value += 13; break;
|
|
|
|
case 'd': Value += 13; break;
|
|
|
|
case 'E': Value += 14; break;
|
|
|
|
case 'e': Value += 14; break;
|
|
|
|
case 'F': Value += 15; break;
|
|
|
|
case 'f': Value += 15; break;
|
|
|
|
default:
|
|
|
|
Value = (Value >> 4);
|
|
|
|
Count = Finish;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Value;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
void DisplayError(char * Message, ...)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-02-13 19:58:42 +00:00
|
|
|
char Msg[400];
|
|
|
|
va_list ap;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
va_start(ap, Message);
|
|
|
|
vsprintf(Msg, Message, ap);
|
|
|
|
va_end(ap);
|
2016-02-13 19:58:42 +00:00
|
|
|
#ifdef _WIN32
|
2023-06-01 07:41:26 +00:00
|
|
|
MessageBoxA(NULL, Msg, "Error", MB_OK | MB_ICONERROR);
|
2016-02-13 19:58:42 +00:00
|
|
|
#else
|
|
|
|
fputs(&Msg[0], stderr);
|
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
Function: CloseDLL
|
|
|
|
Purpose: This function is called when the emulator is closing
|
|
|
|
down allowing the DLL to de-initialize.
|
|
|
|
Input: None
|
|
|
|
Output: None
|
|
|
|
*/
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
EXPORT void CloseDLL(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
FreeMemory();
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
*/
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2016-02-15 20:55:07 +00:00
|
|
|
EXPORT void DllAbout(void * hParent)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-02-15 20:55:07 +00:00
|
|
|
#ifdef _WIN32
|
2020-06-09 13:04:38 +00:00
|
|
|
MessageBoxA((HWND)hParent, AboutMsg(), "About", MB_OK | MB_ICONINFORMATION);
|
2016-02-15 20:55:07 +00:00
|
|
|
#else
|
|
|
|
puts(AboutMsg());
|
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2016-02-14 19:01:49 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-02-14 19:01:49 +00:00
|
|
|
hinstDLL = hinst;
|
2023-06-29 02:59:07 +00:00
|
|
|
return true;
|
2016-02-14 19:01:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FixMenuState(void)
|
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
EnableMenuItem(hRSPMenu, ID_RSPCOMMANDS, MF_BYCOMMAND | (DebuggingEnabled ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
|
|
|
|
EnableMenuItem(hRSPMenu, ID_RSPREGISTERS, MF_BYCOMMAND | (DebuggingEnabled ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
|
2016-02-14 19:01:49 +00:00
|
|
|
EnableMenuItem(hRSPMenu, ID_PROFILING_RESETSTATS, MF_BYCOMMAND | (DebuggingEnabled ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
|
|
|
|
EnableMenuItem(hRSPMenu, ID_PROFILING_GENERATELOG, MF_BYCOMMAND | (DebuggingEnabled ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
|
|
|
|
EnableMenuItem(hRSPMenu, ID_DUMP_RSPCODE, MF_BYCOMMAND | (DebuggingEnabled ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
|
|
|
|
EnableMenuItem(hRSPMenu, ID_DUMP_DMEM, MF_BYCOMMAND | (DebuggingEnabled ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
|
|
|
|
|
2023-08-10 04:46:57 +00:00
|
|
|
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_RECOMPILER, MF_BYCOMMAND | (g_CPUCore == RecompilerCPU ? MFS_CHECKED : MF_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_INTERPT, MF_BYCOMMAND | (g_CPUCore == InterpreterCPU ? MFS_CHECKED : MF_UNCHECKED));
|
2016-02-14 19:01:49 +00:00
|
|
|
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | (BreakOnStart ? MFS_CHECKED : MF_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | (LogRDP ? MFS_CHECKED : MF_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | (LogX86Code ? MFS_CHECKED : MF_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | (Profiling ? MFS_CHECKED : MF_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | (Profiling ? MFS_UNCHECKED : MF_CHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | (IndvidualBlock ? MFS_CHECKED : MF_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | (ShowErrors ? MFS_CHECKED : MF_UNCHECKED));
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2016-02-14 19:01:49 +00:00
|
|
|
#endif
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
*/
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
PluginInfo->Version = 0x0103;
|
|
|
|
PluginInfo->Type = PLUGIN_TYPE_RSP;
|
2016-01-27 09:11:59 +00:00
|
|
|
#ifdef _DEBUG
|
2023-06-01 11:46:23 +00:00
|
|
|
sprintf(PluginInfo->Name, "RSP debug plugin %s", VER_FILE_VERSION_STR);
|
2016-01-27 09:11:59 +00:00
|
|
|
#else
|
2023-06-01 11:46:23 +00:00
|
|
|
sprintf(PluginInfo->Name, "RSP plugin %s", VER_FILE_VERSION_STR);
|
2016-01-27 09:11:59 +00:00
|
|
|
#endif
|
2023-06-29 02:59:07 +00:00
|
|
|
PluginInfo->Reserved2 = false;
|
|
|
|
PluginInfo->Reserved1 = true;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
Function: GetRspDebugInfo
|
|
|
|
Purpose: This function allows the emulator to gather information
|
|
|
|
about the debug capabilities of the DLL by filling in
|
|
|
|
the DebugInfo structure.
|
|
|
|
Input: A pointer to a RSPDEBUG_INFO structure that needs to be
|
|
|
|
filled by the function. (see def above)
|
|
|
|
Output: None
|
|
|
|
*/
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2023-06-01 07:41:26 +00:00
|
|
|
EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * _DebugInfo)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-02-15 20:55:07 +00:00
|
|
|
#ifdef _WIN32
|
2023-06-01 11:46:23 +00:00
|
|
|
if (hRSPMenu == NULL)
|
|
|
|
{
|
|
|
|
hRSPMenu = LoadMenu((HINSTANCE)hinstDLL, MAKEINTRESOURCE(RspMenu));
|
|
|
|
FixMenuState();
|
|
|
|
}
|
2023-06-01 07:41:26 +00:00
|
|
|
_DebugInfo->hRSPMenu = hRSPMenu;
|
2016-02-15 20:55:07 +00:00
|
|
|
#endif
|
2023-06-01 07:41:26 +00:00
|
|
|
_DebugInfo->ProcessMenuItem = ProcessMenuItem;
|
|
|
|
|
2023-06-29 02:59:07 +00:00
|
|
|
_DebugInfo->UseBPoints = true;
|
2023-06-01 11:46:23 +00:00
|
|
|
sprintf(_DebugInfo->BPPanelName, " RSP ");
|
2023-06-01 07:41:26 +00:00
|
|
|
_DebugInfo->Add_BPoint = Add_BPoint;
|
|
|
|
_DebugInfo->CreateBPPanel = CreateBPPanel;
|
|
|
|
_DebugInfo->HideBPPanel = HideBPPanel;
|
|
|
|
_DebugInfo->PaintBPPanel = PaintBPPanel;
|
|
|
|
_DebugInfo->RefreshBpoints = RefreshBpoints;
|
|
|
|
_DebugInfo->RemoveAllBpoint = RemoveAllBpoint;
|
|
|
|
_DebugInfo->RemoveBpoint = RemoveBpoint;
|
|
|
|
_DebugInfo->ShowBPPanel = ShowBPPanel;
|
|
|
|
|
|
|
|
_DebugInfo->Enter_RSP_Commands_Window = Enter_RSP_Commands_Window;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
Function: InitiateRSP
|
|
|
|
Purpose: This function is called when the DLL is started to give
|
|
|
|
information from the emulator that the N64 RSP interface needs.
|
|
|
|
Input: Rsp_Info is passed to this function which is defined
|
|
|
|
above.
|
|
|
|
CycleCount is the number of cycles between switching
|
|
|
|
control between the RSP and r4300i core.
|
|
|
|
Output: None
|
|
|
|
*/
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
RSP_COMPILER Compiler;
|
|
|
|
|
|
|
|
void DetectCpuSpecs(void)
|
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
DWORD Intel_Features = 0;
|
|
|
|
DWORD AMD_Features = 0;
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
2023-06-01 11:46:23 +00:00
|
|
|
__try
|
|
|
|
{
|
2016-01-27 09:11:59 +00:00
|
|
|
#ifdef _M_IX86
|
2023-06-01 11:46:23 +00:00
|
|
|
_asm {
|
|
|
|
// Intel features
|
2016-01-27 09:11:59 +00:00
|
|
|
mov eax, 1
|
|
|
|
cpuid
|
|
|
|
mov [Intel_Features], edx
|
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
// AMD features
|
2016-01-27 09:11:59 +00:00
|
|
|
mov eax, 80000001h
|
|
|
|
cpuid
|
|
|
|
or [AMD_Features], edx
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
#else
|
2023-06-01 11:46:23 +00:00
|
|
|
int cpuInfo[4];
|
|
|
|
__cpuid(cpuInfo, 1);
|
|
|
|
Intel_Features = cpuInfo[3];
|
|
|
|
__cpuid(cpuInfo, 0x80000001);
|
|
|
|
AMD_Features = cpuInfo[3];
|
2016-01-27 09:11:59 +00:00
|
|
|
#endif
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
AMD_Features = Intel_Features = 0;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
#else
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
/*
|
2021-03-19 06:41:58 +00:00
|
|
|
TODO: With GCC, there is <cpuid.h>, but __cpuid() there is a macro and
|
|
|
|
needs five arguments, not two. Also, GCC lacks SEH.
|
|
|
|
*/
|
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
AMD_Features = Intel_Features = 0;
|
2016-01-27 09:11:59 +00:00
|
|
|
#endif
|
|
|
|
|
2023-06-01 11:46:23 +00:00
|
|
|
if (Intel_Features & 0x02000000)
|
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
Compiler.mmx2 = true;
|
|
|
|
Compiler.sse = true;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
if (Intel_Features & 0x00800000)
|
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
Compiler.mmx = true;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
if (AMD_Features & 0x40000000)
|
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
Compiler.mmx2 = true;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
if (Intel_Features & 0x00008000)
|
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
ConditionalMove = true;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
ConditionalMove = false;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2016-06-05 15:10:22 +00:00
|
|
|
EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-08-10 04:46:57 +00:00
|
|
|
g_RSPDebuggerUI.reset(new RSPDebuggerUI);
|
|
|
|
g_RSPDebugger = g_RSPDebuggerUI.get();
|
2023-06-01 11:46:23 +00:00
|
|
|
RSPInfo = Rsp_Info;
|
2023-06-29 02:59:07 +00:00
|
|
|
AudioHle = GetSystemSetting(Set_AudioHle) != 0;
|
|
|
|
GraphicsHle = GetSystemSetting(Set_GraphicsHle) != 0;
|
2023-06-01 11:46:23 +00:00
|
|
|
|
|
|
|
*CycleCount = 0;
|
|
|
|
AllocateMemory();
|
|
|
|
InitilizeRSPRegisters();
|
|
|
|
Build_RSP();
|
|
|
|
#ifdef GenerateLog
|
|
|
|
Start_Log();
|
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
Function: InitiateRSPDebugger
|
|
|
|
Purpose: This function is called when the DLL is started to give
|
|
|
|
information from the emulator that the N64 RSP
|
|
|
|
interface needs to integrate the debugger with the
|
|
|
|
rest of the emulator.
|
|
|
|
Input: DebugInfo is passed to this function which is defined
|
|
|
|
above.
|
|
|
|
Output: None
|
|
|
|
*/
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
DebugInfo = Debug_Info;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2016-02-15 20:55:07 +00:00
|
|
|
#ifdef _WIN32
|
2016-01-27 09:11:59 +00:00
|
|
|
void ProcessMenuItem(int ID)
|
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
switch (ID)
|
|
|
|
{
|
|
|
|
case ID_RSPCOMMANDS: Enter_RSP_Commands_Window(); break;
|
|
|
|
case ID_RSPREGISTERS: Enter_RSP_Register_Window(); break;
|
|
|
|
case ID_DUMP_RSPCODE: DumpRSPCode(); break;
|
|
|
|
case ID_DUMP_DMEM: DumpRSPData(); break;
|
|
|
|
case ID_PROFILING_ON:
|
|
|
|
case ID_PROFILING_OFF:
|
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
bool ProfilingOn = ID == ID_PROFILING_ON;
|
|
|
|
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | (ProfilingOn ? MFS_CHECKED : MFS_UNCHECKED));
|
|
|
|
CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | (ProfilingOn ? MFS_UNCHECKED : MFS_CHECKED));
|
|
|
|
SetSetting(Set_Profiling, ProfilingOn);
|
|
|
|
if (DebuggingEnabled)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
Profiling = ProfilingOn;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
case ID_PROFILING_RESETSTATS: ResetTimerList(); break;
|
|
|
|
case ID_PROFILING_GENERATELOG: GenerateTimerResults(); break;
|
|
|
|
case ID_PROFILING_LOGINDIVIDUALBLOCKS:
|
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
bool Checked = (GetMenuState(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND) & MFS_CHECKED) != 0;
|
|
|
|
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
|
|
|
|
SetSetting(Set_IndvidualBlock, !Checked);
|
|
|
|
if (DebuggingEnabled)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
IndvidualBlock = !Checked;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-08-16 23:29:22 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
case ID_SHOWCOMPILERERRORS:
|
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
bool Checked = (GetMenuState(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND) & MFS_CHECKED) != 0;
|
|
|
|
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
|
|
|
|
SetSetting(Set_ShowErrors, !Checked);
|
|
|
|
if (DebuggingEnabled)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
ShowErrors = !Checked;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_COMPILER:
|
|
|
|
DialogBoxA((HINSTANCE)hinstDLL, "RSPCOMPILER", HWND_DESKTOP, (DLGPROC)CompilerDlgProc);
|
|
|
|
break;
|
|
|
|
case ID_BREAKONSTARTOFTASK:
|
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
bool Checked = (GetMenuState(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND) & MFS_CHECKED) != 0;
|
|
|
|
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
|
|
|
|
SetSetting(Set_BreakOnStart, !Checked);
|
|
|
|
if (DebuggingEnabled)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
BreakOnStart = !Checked;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
break;
|
|
|
|
}
|
2023-06-01 11:46:23 +00:00
|
|
|
case ID_LOGRDPCOMMANDS:
|
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
bool Checked = (GetMenuState(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND) & MFS_CHECKED) != 0;
|
|
|
|
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
|
|
|
|
SetSetting(Set_LogRDP, !Checked);
|
|
|
|
if (DebuggingEnabled)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
LogRDP = !Checked;
|
|
|
|
if (LogRDP)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
StartRDPLog();
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
else
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
StopRDPLog();
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
case ID_SETTINGS_LOGX86CODE:
|
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
bool Checked = (GetMenuState(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND) & MFS_CHECKED) != 0;
|
|
|
|
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
|
|
|
|
SetSetting(Set_LogX86Code, !Checked);
|
|
|
|
if (DebuggingEnabled)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
LogX86Code = !Checked;
|
|
|
|
if (LogX86Code)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
StartCPULog();
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
else
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
2023-08-17 02:34:06 +00:00
|
|
|
StopCPULog();
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
}
|
2023-08-17 02:34:06 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
|
|
|
case ID_CPUMETHOD_RECOMPILER:
|
|
|
|
SetSetting(Set_CPUCore, RecompilerCPU);
|
2023-08-10 04:46:57 +00:00
|
|
|
g_CPUCore = RecompilerCPU;
|
2023-06-01 11:46:23 +00:00
|
|
|
FixMenuState();
|
|
|
|
SetCPU(RecompilerCPU);
|
2023-08-10 04:46:57 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
case ID_CPUMETHOD_INTERPT:
|
|
|
|
SetSetting(Set_CPUCore, InterpreterCPU);
|
2023-08-10 04:46:57 +00:00
|
|
|
g_CPUCore = InterpreterCPU;
|
2023-06-01 11:46:23 +00:00
|
|
|
FixMenuState();
|
|
|
|
SetCPU(InterpreterCPU);
|
2023-08-10 04:46:57 +00:00
|
|
|
break;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2016-02-15 20:55:07 +00:00
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
Function: RomOpen
|
|
|
|
Purpose: This function is called when a ROM is opened.
|
|
|
|
Input: None
|
|
|
|
Output: None
|
|
|
|
*/
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
EXPORT void RomOpen(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
ClearAllx86Code();
|
|
|
|
if (DebuggingEnabled)
|
|
|
|
{
|
|
|
|
EnableDebugging(true);
|
|
|
|
}
|
|
|
|
JumpTableSize = GetSetting(Set_JumpTableSize);
|
|
|
|
Mfc0Count = GetSetting(Set_Mfc0Count);
|
|
|
|
SemaphoreExit = GetSetting(Set_SemaphoreExit);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
/*
|
|
|
|
Function: RomClosed
|
|
|
|
Purpose: This function is called when a ROM is closed.
|
|
|
|
Input: None
|
|
|
|
Output: None
|
|
|
|
*/
|
2021-03-19 06:41:58 +00:00
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
EXPORT void RomClosed(void)
|
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
if (Profiling)
|
|
|
|
{
|
|
|
|
StopTimer();
|
|
|
|
GenerateTimerResults();
|
|
|
|
}
|
|
|
|
ClearAllx86Code();
|
|
|
|
StopRDPLog();
|
|
|
|
StopCPULog();
|
2016-01-27 09:11:59 +00:00
|
|
|
|
|
|
|
#ifdef GenerateLog
|
2023-06-01 11:46:23 +00:00
|
|
|
Stop_Log();
|
2016-01-27 09:11:59 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-02-14 19:01:49 +00:00
|
|
|
#ifdef _WIN32
|
2023-06-29 02:59:07 +00:00
|
|
|
static bool GetBooleanCheck(HWND hDlg, DWORD DialogID)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
return (IsDlgButtonChecked(hDlg, DialogID) == BST_CHECKED) ? true : false;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2023-07-27 21:27:31 +00:00
|
|
|
BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
char Buffer[256];
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bDest == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_DEST, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.mmx == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_CHECK_MMX, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.mmx2 == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_CHECK_MMX2, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.sse == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_CHECK_SSE, BST_CHECKED);
|
|
|
|
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bAlignVector == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_ALIGNVEC, BST_CHECKED);
|
|
|
|
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bSections == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_SECTIONS, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bGPRConstants == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_GPRCONSTANTS, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bReOrdering == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_REORDER, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bFlags == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_FLAGS, BST_CHECKED);
|
2023-06-29 02:59:07 +00:00
|
|
|
if (Compiler.bAccum == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
CheckDlgButton(hDlg, IDC_COMPILER_ACCUM, BST_CHECKED);
|
|
|
|
|
|
|
|
SetTimer(hDlg, 1, 250, NULL);
|
|
|
|
break;
|
|
|
|
case WM_TIMER:
|
|
|
|
sprintf(Buffer, "x86: %2.2f KB / %2.2f KB", (float)(RecompPos - RecompCode) / 1024.0F,
|
|
|
|
pLastSecondary ? (float)((pLastSecondary - RecompCodeSecondary) / 1024.0F) : 0);
|
|
|
|
|
|
|
|
SetDlgItemTextA(hDlg, IDC_COMPILER_BUFFERS, Buffer);
|
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
|
|
|
{
|
|
|
|
case IDOK:
|
|
|
|
Compiler.bDest = GetBooleanCheck(hDlg, IDC_COMPILER_DEST);
|
|
|
|
Compiler.bAccum = GetBooleanCheck(hDlg, IDC_COMPILER_ACCUM);
|
|
|
|
Compiler.mmx = GetBooleanCheck(hDlg, IDC_CHECK_MMX);
|
|
|
|
Compiler.mmx2 = GetBooleanCheck(hDlg, IDC_CHECK_MMX2);
|
|
|
|
Compiler.sse = GetBooleanCheck(hDlg, IDC_CHECK_SSE);
|
|
|
|
Compiler.bSections = GetBooleanCheck(hDlg, IDC_COMPILER_SECTIONS);
|
|
|
|
Compiler.bReOrdering = GetBooleanCheck(hDlg, IDC_COMPILER_REORDER);
|
|
|
|
Compiler.bGPRConstants = GetBooleanCheck(hDlg, IDC_COMPILER_GPRCONSTANTS);
|
|
|
|
Compiler.bFlags = GetBooleanCheck(hDlg, IDC_COMPILER_FLAGS);
|
|
|
|
Compiler.bAlignVector = GetBooleanCheck(hDlg, IDC_COMPILER_ALIGNVEC);
|
|
|
|
SetSetting(Set_CheckDest, Compiler.bDest);
|
|
|
|
SetSetting(Set_Accum, Compiler.bAccum);
|
|
|
|
SetSetting(Set_Mmx, Compiler.mmx);
|
|
|
|
SetSetting(Set_Mmx2, Compiler.mmx2);
|
|
|
|
SetSetting(Set_Sse, Compiler.sse);
|
|
|
|
SetSetting(Set_Sections, Compiler.bSections);
|
|
|
|
SetSetting(Set_ReOrdering, Compiler.bReOrdering);
|
|
|
|
SetSetting(Set_GPRConstants, Compiler.bGPRConstants);
|
|
|
|
SetSetting(Set_Flags, Compiler.bFlags);
|
|
|
|
SetSetting(Set_AlignVector, Compiler.bAlignVector);
|
|
|
|
|
|
|
|
KillTimer(hDlg, 1);
|
2023-06-29 02:59:07 +00:00
|
|
|
EndDialog(hDlg, true);
|
2023-06-01 11:46:23 +00:00
|
|
|
break;
|
|
|
|
case IDCANCEL:
|
|
|
|
KillTimer(hDlg, 1);
|
2023-06-29 02:59:07 +00:00
|
|
|
EndDialog(hDlg, true);
|
2023-06-01 11:46:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2023-06-29 02:59:07 +00:00
|
|
|
return false;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-06-29 02:59:07 +00:00
|
|
|
return true;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
|
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
HWND hWndItem;
|
|
|
|
DWORD value;
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2023-06-29 02:59:07 +00:00
|
|
|
if (AudioHle == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_AUDIOHLE, BST_CHECKED);
|
|
|
|
}
|
2023-06-29 02:59:07 +00:00
|
|
|
if (GraphicsHle == true)
|
2023-06-01 11:46:23 +00:00
|
|
|
{
|
|
|
|
CheckDlgButton(hDlg, IDC_GRAPHICSHLE, BST_CHECKED);
|
|
|
|
}
|
|
|
|
|
|
|
|
hWndItem = GetDlgItem(hDlg, IDC_COMPILER_SELECT);
|
|
|
|
ComboBox_AddString(hWndItem, "Interpreter");
|
|
|
|
ComboBox_AddString(hWndItem, "Recompiler");
|
2023-08-10 04:46:57 +00:00
|
|
|
ComboBox_SetCurSel(hWndItem, g_CPUCore);
|
2023-06-01 11:46:23 +00:00
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
|
|
|
{
|
|
|
|
case IDOK:
|
|
|
|
hWndItem = GetDlgItem(hDlg, IDC_COMPILER_SELECT);
|
|
|
|
value = ComboBox_GetCurSel(hWndItem);
|
2023-08-10 04:46:57 +00:00
|
|
|
SetCPU((RSPCpuType)value);
|
2023-06-01 11:46:23 +00:00
|
|
|
|
|
|
|
AudioHle = GetBooleanCheck(hDlg, IDC_AUDIOHLE);
|
|
|
|
GraphicsHle = GetBooleanCheck(hDlg, IDC_GRAPHICSHLE);
|
|
|
|
|
2023-06-29 02:59:07 +00:00
|
|
|
EndDialog(hDlg, true);
|
2023-06-01 11:46:23 +00:00
|
|
|
break;
|
|
|
|
case IDCANCEL:
|
2023-06-29 02:59:07 +00:00
|
|
|
EndDialog(hDlg, true);
|
2023-06-01 11:46:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2023-06-29 02:59:07 +00:00
|
|
|
return false;
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2023-06-29 02:59:07 +00:00
|
|
|
return true;
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2016-02-14 19:01:49 +00:00
|
|
|
#endif
|
2016-01-27 09:11:59 +00:00
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
/*EXPORT void DllConfig(HWND hWnd)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
|
|
|
// DialogBox(hinstDLL, "RSPCONFIG", hWnd, ConfigDlgProc);
|
|
|
|
DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc);
|
|
|
|
}*/
|
|
|
|
|
2023-06-29 02:59:07 +00:00
|
|
|
EXPORT void EnableDebugging(int Enabled)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
DebuggingEnabled = Enabled != 0;
|
2023-06-01 11:46:23 +00:00
|
|
|
if (DebuggingEnabled)
|
|
|
|
{
|
2023-06-29 02:59:07 +00:00
|
|
|
BreakOnStart = GetSetting(Set_BreakOnStart) != 0;
|
2023-08-10 04:46:57 +00:00
|
|
|
g_CPUCore = (RSPCpuType)GetSetting(Set_CPUCore);
|
2023-06-29 02:59:07 +00:00
|
|
|
LogRDP = GetSetting(Set_LogRDP) != 0;
|
|
|
|
LogX86Code = GetSetting(Set_LogX86Code) != 0;
|
|
|
|
Profiling = GetSetting(Set_Profiling) != 0;
|
|
|
|
IndvidualBlock = GetSetting(Set_IndvidualBlock) != 0;
|
|
|
|
ShowErrors = GetSetting(Set_ShowErrors) != 0;
|
|
|
|
|
|
|
|
Compiler.bDest = GetSetting(Set_CheckDest) != 0;
|
|
|
|
Compiler.bAccum = GetSetting(Set_Accum) != 0;
|
|
|
|
Compiler.mmx = GetSetting(Set_Mmx) != 0;
|
|
|
|
Compiler.mmx2 = GetSetting(Set_Mmx2) != 0;
|
|
|
|
Compiler.sse = GetSetting(Set_Sse) != 0;
|
|
|
|
Compiler.bSections = GetSetting(Set_Sections) != 0;
|
|
|
|
Compiler.bReOrdering = GetSetting(Set_ReOrdering) != 0;
|
|
|
|
Compiler.bGPRConstants = GetSetting(Set_GPRConstants) != 0;
|
|
|
|
Compiler.bFlags = GetSetting(Set_Flags) != 0;
|
|
|
|
Compiler.bAlignVector = GetSetting(Set_AlignVector) != 0;
|
2023-08-10 04:46:57 +00:00
|
|
|
SetCPU(g_CPUCore);
|
2023-06-01 11:46:23 +00:00
|
|
|
}
|
2016-02-15 20:55:07 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
FixMenuState();
|
|
|
|
#else
|
|
|
|
fputs("FixMenuState()\n", stderr);
|
|
|
|
#endif
|
2023-06-01 11:46:23 +00:00
|
|
|
if (LogRDP)
|
|
|
|
{
|
|
|
|
StartRDPLog();
|
|
|
|
}
|
|
|
|
if (LogX86Code)
|
|
|
|
{
|
|
|
|
StartCPULog();
|
|
|
|
}
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2016-02-15 20:10:49 +00:00
|
|
|
EXPORT void PluginLoaded(void)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2023-06-01 11:46:23 +00:00
|
|
|
BreakOnStart = false;
|
2019-01-14 02:01:17 +00:00
|
|
|
#ifndef _M_X64
|
2023-08-10 04:46:57 +00:00
|
|
|
g_CPUCore = RecompilerCPU;
|
2019-01-14 02:01:17 +00:00
|
|
|
#else
|
2023-08-10 04:46:57 +00:00
|
|
|
g_CPUCore = InterpreterCPU;
|
2019-01-14 02:01:17 +00:00
|
|
|
#endif
|
2023-06-29 02:59:07 +00:00
|
|
|
LogRDP = false;
|
|
|
|
LogX86Code = false;
|
|
|
|
Profiling = false;
|
|
|
|
IndvidualBlock = false;
|
|
|
|
ShowErrors = false;
|
2023-06-01 11:46:23 +00:00
|
|
|
|
|
|
|
memset(&Compiler, 0, sizeof(Compiler));
|
|
|
|
|
2023-06-29 02:59:07 +00:00
|
|
|
Compiler.bDest = true;
|
|
|
|
Compiler.bAlignVector = false;
|
|
|
|
Compiler.bFlags = true;
|
|
|
|
Compiler.bReOrdering = true;
|
|
|
|
Compiler.bSections = true;
|
|
|
|
Compiler.bAccum = true;
|
|
|
|
Compiler.bGPRConstants = true;
|
2023-06-01 11:46:23 +00:00
|
|
|
DetectCpuSpecs();
|
|
|
|
|
2023-08-16 23:29:22 +00:00
|
|
|
InitializeRspSetting();
|
2023-08-10 04:46:57 +00:00
|
|
|
SetCPU(g_CPUCore);
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
|
|
|
|
2016-02-15 20:55:07 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
void UseUnregisteredSetting(int /*SettingID*/)
|
2016-01-27 09:11:59 +00:00
|
|
|
{
|
2016-02-15 20:55:07 +00:00
|
|
|
DebugBreak();
|
2016-01-27 09:11:59 +00:00
|
|
|
}
|
2016-02-15 20:55:07 +00:00
|
|
|
#endif
|