RSP: Remove recompiler from x64, and remove hle tasks from x86

This commit is contained in:
zilmar 2025-03-13 17:56:17 +10:30
parent 1edb5debdf
commit 5e89701fdf
26 changed files with 126 additions and 157 deletions

View File

@ -2,6 +2,7 @@
#include <Project64-rsp-core/cpu/RSPRegisterHandlerPlugin.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspSystem.h>
#include <Settings/Settings.h>
#include <zlib/zlib.h>
CHleTask::CHleTask(CRSPSystem & System) :
@ -40,60 +41,6 @@ bool CHleTask::IsHleTask(void)
return false;
}
void CHleTask::SetupCommandList(TASK_INFO & TaskInfo)
{
uint32_t JumpTableLength = 0x7E, JumpTablePos = 0x10;
if ((HLETaskType)(TaskInfo.Type) == HLETaskType::Audio)
{
if (*((uint32_t *)&m_DMEM[0]) == 0x00000001 && *((uint32_t *)&m_DMEM[0x30]) == 0xf0000f00)
{
JumpTableLength = 0x10;
JumpTablePos = 0x10;
}
}
uint32_t JumpTableCRC = crc32(0L, m_IMEM + JumpTablePos, JumpTableLength << 1);
TaskFunctionMap::iterator itr = m_FunctionMap.find(JumpTableCRC);
if (itr != m_FunctionMap.end())
{
m_TaskFunctions = &itr->second;
return;
}
if (m_FunctionMap.size() > 0)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
m_TaskFunctions = nullptr;
memset(&m_Recompiler.m_CurrentBlock, 0, sizeof(m_Recompiler.m_CurrentBlock));
m_Recompiler.BuildBranchLabels();
TaskFunctions JumpFunctions;
for (uint32_t i = 0, n = JumpTableLength; i < n; i++)
{
uint16_t FuncAddress = *((uint16_t *)(m_DMEM + (((i << 1) + JumpTablePos) ^ 2)));
if (FuncAddress != 0x1118)
{
m_Recompiler.CompileHLETask(FuncAddress);
void * FuncPtr = *(JumpTable + ((FuncAddress & 0xFFF) >> 2));
JumpFunctions.emplace_back(TaskFunctionAddress(FuncAddress, FuncPtr));
}
else
{
JumpFunctions.emplace_back(TaskFunctionAddress(FuncAddress, nullptr));
}
}
m_Recompiler.LinkBranches(&m_Recompiler.m_CurrentBlock);
m_FunctionMap[JumpTableCRC] = JumpFunctions;
itr = m_FunctionMap.find(JumpTableCRC);
if (itr == m_FunctionMap.end())
{
g_Notify->BreakPoint(__FILE__, __LINE__);
return;
}
m_TaskFunctions = &itr->second;
}
void CHleTask::ExecuteTask_1a13a51a(TASK_INFO & TaskInfo)
{
*((uint32_t *)(m_DMEM + 0x320)) = 0;
@ -200,40 +147,6 @@ void CHleTask::ExecuteTask_1a13a51a(TASK_INFO & TaskInfo)
}
}
void CHleTask::SetupTask(TASK_INFO & TaskInfo)
{
if (TaskInfo.Flags != 0)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
if (*m_SP_DMA_FULL_REG != 0)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
m_RSPRegisterHandler->WriteReg(RSPRegister_MEM_ADDR, 0);
m_RSPRegisterHandler->WriteReg(RSPRegister_DRAM_ADDR, TaskInfo.UcodeData);
m_RSPRegisterHandler->WriteReg(RSPRegister_RD_LEN, TaskInfo.UcodeDataSize);
if (*m_SP_DMA_BUSY_REG != 0 || (*m_SP_STATUS_REG & 0x80) != 0)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
m_RSPRegisterHandler->WriteReg(RSPRegister_MEM_ADDR, 0x1080);
m_RSPRegisterHandler->WriteReg(RSPRegister_DRAM_ADDR, TaskInfo.Ucode);
m_RSPRegisterHandler->WriteReg(RSPRegister_RD_LEN, 0x0F7F);
if (*m_SP_DMA_BUSY_REG != 0 || (*m_SP_STATUS_REG & 0x80) != 0)
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
*m_SP_SEMAPHORE_REG = 0;
if (SyncCPU)
{
*m_SP_PC_REG = 0x80;
RSPSystem.SyncSystem()->ExecuteOps(200, 0x080);
RSPSystem.BasicSyncCheck();
}
SetupCommandList(TaskInfo);
}
bool CHleTask::ProcessHleTask(void)
{
TASK_INFO & TaskInfo = *((TASK_INFO *)(m_DMEM + 0xFC0));
@ -260,31 +173,7 @@ bool CHleTask::ProcessHleTask(void)
RSPInfo.ShowCFB();
}
if (CRSPSettings::CPUMethod() == RSPCpuMethod::RecompilerTasks)
{
if (SyncCPU)
{
RSPSystem.SetupSyncCPU();
}
SetupTask(TaskInfo);
uint32_t UcodeSize = TaskInfo.UcodeSize;
if (UcodeSize < 0x4 || TaskInfo.UcodeSize > 0x0F80)
{
UcodeSize = 0x0F80;
}
m_UcodeCRC = crc32(0L, m_IMEM + 0x80, UcodeSize);
if (m_UcodeCRC == 0x1a13a51a)
{
ExecuteTask_1a13a51a(TaskInfo);
}
else
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
return true;
}
if (CRSPSettings::CPUMethod() == RSPCpuMethod::HighLevelEmulation && m_hle.try_fast_audio_dispatching())
if (((HLETaskType)TaskInfo.Type) == HLETaskType::Audio && m_hle.try_fast_audio_dispatching())
{
*m_SP_STATUS_REG |= SP_STATUS_SIG2 | SP_STATUS_BROKE | SP_STATUS_HALT;
if ((*m_SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0)

View File

@ -55,9 +55,7 @@ private:
CHleTask(const CHleTask & copy);
CHleTask & operator=(const CHleTask & rhs);
void SetupCommandList(TASK_INFO & TaskInfo);
void ExecuteTask_1a13a51a(TASK_INFO & TaskInfo);
void SetupTask(TASK_INFO & TaskInfo);
void (*&CheckInterrupts)(void);
void (*&ProcessDList)(void);

View File

@ -67,7 +67,7 @@
<ClCompile Include="Recompiler\RspProfiling.cpp" />
<ClCompile Include="Recompiler\RspRecompilerAnalysis.cpp" />
<ClCompile Include="Recompiler\RspRecompilerCPU.cpp" />
<ClCompile Include="Recompiler\RspRecompilerOps.cpp" />
<ClCompile Include="Recompiler\RspRecompilerOps-x86.cpp" />
<ClCompile Include="Recompiler\RspRecompilerSections.cpp" />
<ClCompile Include="Recompiler\Sse.cpp" />
<ClCompile Include="Recompiler\X86.cpp" />
@ -98,7 +98,7 @@
<ClInclude Include="Hle\ucodes.h" />
<ClInclude Include="Recompiler\RspProfiling.h" />
<ClInclude Include="Recompiler\RspRecompilerCPU.h" />
<ClInclude Include="Recompiler\RspRecompilerOps.h" />
<ClInclude Include="Recompiler\RspRecompilerOps-x86.h" />
<ClInclude Include="Recompiler\X86.h" />
<ClInclude Include="RSPDebugger.h" />
<ClInclude Include="RSPInfo.h" />

View File

@ -69,9 +69,6 @@
<ClCompile Include="Recompiler\RspRecompilerCPU.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerOps.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerSections.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
@ -141,6 +138,9 @@
<ClCompile Include="Hle\HleTask.cpp">
<Filter>Source Files\hle</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerOps-x86.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cpu\RSPInstruction.h">
@ -176,9 +176,6 @@
<ClInclude Include="Recompiler\RspRecompilerCPU.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
<ClInclude Include="Recompiler\RspRecompilerOps.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
<ClInclude Include="cpu\RspMemory.h">
<Filter>Header Files\cpu</Filter>
</ClInclude>
@ -227,5 +224,8 @@
<ClInclude Include="Hle\HleTask.h">
<Filter>Header Files\hle</Filter>
</ClInclude>
<ClInclude Include="Recompiler\RspRecompilerOps-x86.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -18,7 +18,9 @@
RSP_INFO RSPInfo;
uint32_t RdramSize = 0;
#if defined(__i386__) || defined(_M_IX86)
void ClearAllx86Code(void);
#endif
void DetectCpuSpecs(void)
{
@ -62,6 +64,7 @@ void DetectCpuSpecs(void)
AMD_Features = Intel_Features = 0;
#endif
#if defined(__i386__) || defined(_M_IX86)
if (Intel_Features & 0x02000000)
{
Compiler.mmx2 = true;
@ -75,6 +78,7 @@ void DetectCpuSpecs(void)
{
Compiler.mmx2 = true;
}
#endif
if (Intel_Features & 0x00008000)
{
ConditionalMove = true;
@ -94,6 +98,7 @@ void RspPluginLoaded(void)
IndvidualBlock = false;
ShowErrors = false;
#if defined(__i386__) || defined(_M_IX86)
memset(&Compiler, 0, sizeof(Compiler));
Compiler.bDest = true;
@ -103,6 +108,7 @@ void RspPluginLoaded(void)
Compiler.bSections = false;
Compiler.bAccum = true;
Compiler.bGPRConstants = true;
#endif
DetectCpuSpecs();
CRSPSettings::InitializeRspSetting();
@ -126,9 +132,13 @@ void InitilizeRSP(RSP_INFO & Rsp_Info)
void RspRomOpened(void)
{
CRSPSettings::SetRomOpen(true);
#if defined(__i386__) || defined(_M_IX86)
ClearAllx86Code();
#endif
#if defined(__i386__) || defined(_M_IX86)
JumpTableSize = GetSetting(Set_JumpTableSize);
#endif
Mfc0Count = GetSetting(Set_Mfc0Count);
SemaphoreExit = GetSetting(Set_SemaphoreExit);
RdramSize = Set_AllocatedRdramSize != 0 ? GetSystemSetting(Set_AllocatedRdramSize) : 0;
@ -147,7 +157,9 @@ void RspRomClosed(void)
GenerateTimerResults();
}
RSPSystem.RomClosed();
#if defined(__i386__) || defined(_M_IX86)
ClearAllx86Code();
#endif
RDPLog.StopLog();
StopCPULog();

View File

@ -1,3 +1,5 @@
#if defined(__i386__) || defined(_M_IX86)
#include "X86.h"
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspLog.h>
@ -814,3 +816,5 @@ void MmxCompareGreaterWordRegToReg(int Dest, int Source)
PUTDST16(RecompPos, 0x650f);
PUTDST8(RecompPos, 0xC0 | x86Command);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(__i386__) || defined(_M_IX86)
#include "RspRecompilerCPU.h"
#include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h>
@ -1072,3 +1074,5 @@ bool CompareInstructions(uint32_t PC, RSPOpcode * Top, RSPOpcode * Bottom)
return false;
}
#endif

View File

@ -1,6 +1,8 @@
#if defined(__i386__) || defined(_M_IX86)
#include "RspRecompilerCPU.h"
#include "RspProfiling.h"
#include "RspRecompilerOps.h"
#include "RspRecompilerOps-x86.h"
#include "X86.h"
#include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h>
@ -1247,4 +1249,6 @@ void CRSPRecompiler::SetJumpTable(uint32_t End)
JumpTable = (void **)(JumpTables + NoOfMaps * 0x1000);
Table = NoOfMaps;
NoOfMaps += 1;
}
}
#endif

View File

@ -1,6 +1,8 @@
#if defined(__i386__) || defined(_M_IX86)
#pragma once
#include <Project64-rsp-core/Recompiler/RspRecompilerOps.h>
#include <Project64-rsp-core/Recompiler/RspRecompilerOps-x86.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/cpu/RSPOpcode.h>
#include <Project64-rsp-core/cpu/RspPipelineStage.h>
@ -115,4 +117,6 @@ extern RSP_COMPILER Compiler;
#define IsMmxEnabled (Compiler.mmx)
#define IsMmx2Enabled (Compiler.mmx2)
#define IsSseEnabled (Compiler.sse)
#define IsSseEnabled (Compiler.sse)
#endif

View File

@ -1,10 +1,12 @@
#if defined(__i386__) || defined(_M_IX86)
#include "Project64-rsp-core/Recompiler/RspRecompilerCPU.h"
#include "RspProfiling.h"
#include "RspRecompilerCPU.h"
#include "X86.h"
#include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Recompiler/RspRecompilerOps.h>
#include <Project64-rsp-core/Recompiler/RspRecompilerOps-x86.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPInterpreterOps.h>
@ -17,7 +19,7 @@
#pragma warning(disable : 4152) // Non-standard extension, function/data pointer conversion in expression
extern bool AudioHle, GraphicsHle;
UWORD32 Recp, RecpResult, SQroot, SQrootResult;
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
uint32_t ESP_RegSave = 0, EBP_RegSave = 0;
uint32_t BranchCompare = 0;
@ -168,10 +170,12 @@ void CRSPRecompilerOps::J(void)
{
CPU_Message(" %X %s", m_CompilePC, RSPInstruction(m_CompilePC, m_OpCode.Value).NameAndParam().c_str());
m_NextInstruction = RSPPIPELINE_DO_DELAY_SLOT;
#if defined(__amd64__) || defined(_M_X64)
if (CRSPSettings::CPUMethod() == RSPCpuMethod::RecompilerTasks && m_OpCode.Value == EndHleTaskOp::J_0x1118)
{
m_NextInstruction = RSPPIPELINE_DO_DELAY_SLOT_TASK_EXIT;
}
#endif
}
else if (m_NextInstruction == RSPPIPELINE_DELAY_SLOT_DONE)
{
@ -8290,3 +8294,5 @@ void CRSPRecompilerOps::UnknownOpcode(void)
Call_Direct(AddressOf(&RSPOp::UnknownOpcode), "&RSPOp::UnknownOpcode");
Ret();
}
#endif

View File

@ -1,6 +1,8 @@
#if defined(__i386__) || defined(_M_IX86)
#include "RspRecompilerCPU.h"
#include "X86.h"
#include <Project64-rsp-core/Recompiler/RspRecompilerOps.h>
#include <Project64-rsp-core/Recompiler/RspRecompilerOps-x86.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
@ -967,3 +969,5 @@ bool CRSPRecompilerOps::RSP_DoSections(void)
}
return false;
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(__i386__) || defined(_M_IX86)
#include "X86.h"
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
@ -355,3 +357,5 @@ void SseShuffleReg(int Dest, int Source, uint8_t Immed)
PUTDST8(RecompPos, 0xC0 | x86Command);
PUTDST8(RecompPos, Immed);
}
#endif

View File

@ -1,3 +1,5 @@
#if defined(__i386__) || defined(_M_IX86)
#include <stdio.h>
#include "X86.h"
@ -3366,3 +3368,5 @@ void * GetAddressOf_(int value, ...)
return Address;
}
#endif

View File

@ -1,4 +1,5 @@
#pragma once
#if defined(__i386__) || defined(_M_IX86)
#include <stdint.h>
enum x86RegValues
@ -271,3 +272,5 @@ void x86_SetBranch8b(void * Jumpuint8_t, void * Destination);
void * GetAddressOf_(int32_t value, ...);
#define AddressOf(Addr) GetAddressOf_(5, (Addr))
#endif

View File

@ -9,10 +9,8 @@ bool CRSPSettings::m_RomOpen = false;
#if defined(_M_IX86) && defined(_MSC_VER)
RSPCpuMethod CRSPSettings::m_CPUMethod = RSPCpuMethod::Recompiler;
bool HleAlistTask = false;
#else
RSPCpuMethod CRSPSettings::m_CPUMethod = RSPCpuMethod::HighLevelEmulation;
bool HleAlistTask = true;
#endif
uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0, Set_MultiThreaded = 0, Set_AllocatedRdramSize = 0, Set_DirectoryLog = 0;
@ -41,10 +39,10 @@ void CRSPSettings::InitializeRspSetting(void)
RegisterSetting(Set_Profiling, Data_DWORD_General, "Profiling", NULL, Profiling, NULL);
RegisterSetting(Set_IndvidualBlock, Data_DWORD_General, "Individual Block", NULL, IndvidualBlock, NULL);
RegisterSetting(Set_ShowErrors, Data_DWORD_General, "Show Errors", NULL, ShowErrors, NULL);
RegisterSetting(Set_HleAlistTask, Data_DWORD_General, "Hle Alist Task", NULL, HleAlistTask, NULL);
RegisterSetting(Set_SyncCPU, Data_DWORD_General, "Sync CPU", NULL, SyncCPU, NULL);
// Compiler settings
#if defined(__i386__) || defined(_M_IX86)
RegisterSetting(Set_CheckDest, Data_DWORD_General, "Check Destination Vector", NULL, Compiler.bDest, NULL);
RegisterSetting(Set_Accum, Data_DWORD_General, "Check Destination Accumulator", NULL, Compiler.bAccum, NULL);
RegisterSetting(Set_Mmx, Data_DWORD_General, "Use MMX", NULL, Compiler.mmx, NULL);
@ -55,6 +53,7 @@ void CRSPSettings::InitializeRspSetting(void)
RegisterSetting(Set_GPRConstants, Data_DWORD_General, "Detect GPR Constants", NULL, Compiler.bGPRConstants, NULL);
RegisterSetting(Set_Flags, Data_DWORD_General, "Check Flag Usage", NULL, Compiler.bFlags, NULL);
RegisterSetting(Set_AlignVector, Data_DWORD_General, "Assume Vector loads align", NULL, Compiler.bAlignVector, NULL);
#endif
RegisterSetting(Set_JumpTableSize, Data_DWORD_Game, "JumpTableSize", NULL, 0x1000, NULL);
RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL);

View File

@ -2,14 +2,18 @@
#include <stdint.h>
extern uint16_t Set_AudioHle, Set_GraphicsHle, Set_AllocatedRdramSize, Set_DirectoryLog;
extern bool GraphicsHle, AudioHle, ConditionalMove, SyncCPU, HleAlistTask, RspMultiThreaded;
extern bool GraphicsHle, AudioHle, ConditionalMove, SyncCPU, RspMultiThreaded;
extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code;
enum class RSPCpuMethod
{
Interpreter = 0,
#if defined(__i386__) || defined(_M_IX86)
Recompiler = 1,
#endif
#if defined(__amd64__) || defined(_M_X64)
RecompilerTasks = 2,
#endif
HighLevelEmulation = 3,
};

View File

@ -9,7 +9,6 @@ enum
Set_Profiling,
Set_IndvidualBlock,
Set_ShowErrors,
Set_HleAlistTask,
Set_SyncCPU,
// Compiler settings

View File

@ -16,10 +16,10 @@ uint32_t RSP_Running;
CriticalSection g_CPUCriticalSection;
uint32_t Mfc0Count, SemaphoreExit = 0;
UWORD32 Recp, RecpResult, SQroot, SQrootResult;
void Build_RSP(void)
{
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
Recp.UW = 0;
RecpResult.UW = 0;
SQroot.UW = 0;
@ -95,7 +95,7 @@ be greater than the number of cycles that the RSP should have performed.
uint32_t DoRspCycles(uint32_t Cycles)
{
if (RSPSystem.IsHleTask() && RSPSystem.ProcessHleTask())
if (CRSPSettings::CPUMethod() == RSPCpuMethod::HighLevelEmulation && RSPSystem.ProcessHleTask())
{
return Cycles;
}
@ -105,17 +105,21 @@ uint32_t DoRspCycles(uint32_t Cycles)
g_RSPDebugger->RspCyclesStart();
}
CGuard Guard(g_CPUCriticalSection);
switch (CRSPSettings::CPUMethod())
#if defined(__i386__) || defined(_M_IX86)
if (CRSPSettings::CPUMethod() == RSPCpuMethod::Recompiler)
{
case RSPCpuMethod::Recompiler:
RSPSystem.RunRecompiler();
break;
case RSPCpuMethod::Interpreter:
case RSPCpuMethod::RecompilerTasks:
case RSPCpuMethod::HighLevelEmulation:
}
#endif
#if defined(__amd64__) || defined(_M_X64)
if (CRSPSettings::CPUMethod() == RSPCpuMethod::RecompilerTasks)
{
RSPSystem.ExecuteOps((uint32_t)-1, (uint32_t)-1);
}
#endif
else
{
RSPSystem.ExecuteOps((uint32_t)-1, (uint32_t)-1);
break;
}
if (g_RSPDebugger != nullptr)
{

View File

@ -41,8 +41,12 @@ void RSPRegisterHandlerPlugin::SetHalt(void)
void RSPRegisterHandlerPlugin::DmaReadDone(uint32_t End)
{
#if defined(__i386__) || defined(_M_IX86)
if (CPUMethod() == RSPCpuMethod::Recompiler && (*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0)
{
m_System.m_Recompiler.SetJumpTable(End);
}
#else
End = End;
#endif
}

View File

@ -13,7 +13,9 @@ CRSPSystem::CRSPSystem() :
CHleTask(*this),
m_SyncSystem(nullptr),
m_BaseSystem(nullptr),
#if defined(__i386__) || defined(_M_IX86)
m_Recompiler(*this),
#endif
m_RSPRegisterHandler(nullptr),
m_Op(*this),
m_NextInstruction(RSPPIPELINE_NORMAL),
@ -137,10 +139,12 @@ void CRSPSystem::RomClosed(void)
{
}
#if defined(__i386__) || defined(_M_IX86)
void CRSPSystem::RunRecompiler(void)
{
m_Recompiler.RunCPU();
}
#endif
void CRSPSystem::ExecuteOps(uint32_t Cycles, uint32_t TargetPC)
{

View File

@ -32,7 +32,9 @@ public:
void Reset(RSP_INFO & Info);
void RomClosed(void);
#if defined(__i386__) || defined(_M_IX86)
void RunRecompiler(void);
#endif
void ExecuteOps(uint32_t Cycles, uint32_t TargetPC);
void SetupSyncCPU();
bool IsSyncSystem(void);
@ -51,7 +53,9 @@ private:
CRSPSystem * m_SyncSystem;
CRSPSystem * m_BaseSystem;
#if defined(__i386__) || defined(_M_IX86)
CRSPRecompiler m_Recompiler;
#endif
RSPRegisterHandlerPlugin * m_RSPRegisterHandler;
CRSPRegisters m_Reg;
RSPOp m_Op;

View File

@ -30,8 +30,10 @@ void RSPDebuggerUI::StartingCPU(void)
void RSPDebuggerUI::RspCyclesStart(void)
{
#if defined(__i386__) || defined(_M_IX86)
uint32_t TaskType = *(uint32_t *)(RSPInfo.DMEM + 0xFC0);
Compiler.bAudioUcode = (TaskType == 2) ? true : false;
#endif
if (Profiling && !IndvidualBlock)
{
StartTimer((uint32_t)Timer_RSP_Running);

View File

@ -36,7 +36,9 @@
void ProcessMenuItem(int32_t ID);
#ifdef _WIN32
#if defined(__i386__) || defined(_M_IX86)
BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
#endif
HMENU hRSPMenu = NULL;
#endif
@ -177,20 +179,31 @@ void FixMenuState(void)
EnableMenuItem(hRSPMenu, ID_CPUMETHOD_INTERPT, MF_BYCOMMAND | (!CRSPSettings::RomOpen() ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
EnableMenuItem(hRSPMenu, ID_CPUMETHOD_HLE, MF_BYCOMMAND | (!CRSPSettings::RomOpen() ? MF_ENABLED : (MF_GRAYED | MF_DISABLED)));
#if defined(__i386__) || defined(_M_IX86)
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_RECOMPILER, MF_BYCOMMAND | ((RSPCpuMethod)GetSetting(Set_CPUCore) == RSPCpuMethod::Recompiler ? MFS_CHECKED : MF_UNCHECKED));
#endif
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_INTERPT, MF_BYCOMMAND | ((RSPCpuMethod)GetSetting(Set_CPUCore) == RSPCpuMethod::Interpreter ? MFS_CHECKED : MF_UNCHECKED));
#if defined(__amd64__) || defined(_M_X64)
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_RECOMPILER_TASKS, MF_BYCOMMAND | ((RSPCpuMethod)GetSetting(Set_CPUCore) == RSPCpuMethod::RecompilerTasks ? MFS_CHECKED : MF_UNCHECKED));
#endif
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_HLE, MF_BYCOMMAND | ((RSPCpuMethod)GetSetting(Set_CPUCore) == RSPCpuMethod::HighLevelEmulation ? MFS_CHECKED : MF_UNCHECKED));
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_SYNCCPU, MF_BYCOMMAND | (SyncCPU ? MFS_CHECKED : MF_UNCHECKED));
CheckMenuItem(hRSPMenu, ID_SETTINGS_HLEALISTTASK, MF_BYCOMMAND | (HleAlistTask ? MFS_CHECKED : MF_UNCHECKED));
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | (LogX86Code ? MFS_CHECKED : MF_UNCHECKED));
CheckMenuItem(hRSPMenu, ID_SETTINGS_MULTITHREADED, MF_BYCOMMAND | (MultiThreadedDefault ? 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));
#if defined(__i386__) || defined(_M_IX86)
DeleteMenu(hRSPMenu, ID_CPUMETHOD_RECOMPILER_TASKS, MF_BYCOMMAND);
#endif
#if defined(__amd64__) || defined(_M_X64)
DeleteMenu(hRSPMenu, ID_CPUMETHOD_RECOMPILER, MF_BYCOMMAND);
DeleteMenu(hRSPMenu, ID_COMPILER, MF_BYCOMMAND);
#endif
}
#endif
@ -334,9 +347,11 @@ void ProcessMenuItem(int32_t ID)
break;
}
break;
#if defined(__i386__) || defined(_M_IX86)
case ID_COMPILER:
DialogBoxA((HINSTANCE)hinstDLL, "RSPCOMPILER", HWND_DESKTOP, (DLGPROC)CompilerDlgProc);
break;
#endif
case ID_BREAKONSTARTOFTASK:
{
bool Checked = (GetMenuState(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND) & MFS_CHECKED) != 0;
@ -393,13 +408,6 @@ void ProcessMenuItem(int32_t ID)
SetSetting(Set_SyncCPU, !Checked);
break;
}
case ID_SETTINGS_HLEALISTTASK:
{
bool Checked = (GetMenuState(hRSPMenu, ID_SETTINGS_HLEALISTTASK, MF_BYCOMMAND) & MFS_CHECKED) != 0;
CheckMenuItem(hRSPMenu, ID_SETTINGS_HLEALISTTASK, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
SetSetting(Set_HleAlistTask, !Checked);
break;
}
case ID_SETTINGS_MULTITHREADED:
{
bool Checked = (GetMenuState(hRSPMenu, ID_SETTINGS_MULTITHREADED, MF_BYCOMMAND) & MFS_CHECKED) != 0;
@ -411,18 +419,22 @@ void ProcessMenuItem(int32_t ID)
}
break;
}
#if defined(__i386__) || defined(_M_IX86)
case ID_CPUMETHOD_RECOMPILER:
SetSetting(Set_CPUCore, (int)RSPCpuMethod::Recompiler);
FixMenuState();
break;
#endif
case ID_CPUMETHOD_INTERPT:
SetSetting(Set_CPUCore, (int)RSPCpuMethod::Interpreter);
FixMenuState();
break;
#if defined(__amd64__) || defined(_M_X64)
case ID_CPUMETHOD_RECOMPILER_TASKS:
SetSetting(Set_CPUCore, (int)RSPCpuMethod::RecompilerTasks);
FixMenuState();
break;
#endif
case ID_CPUMETHOD_HLE:
SetSetting(Set_CPUCore, (int)RSPCpuMethod::HighLevelEmulation);
FixMenuState();
@ -466,6 +478,7 @@ static bool GetBooleanCheck(HWND hDlg, DWORD DialogID)
return (IsDlgButtonChecked(hDlg, DialogID) == BST_CHECKED) ? true : false;
}
#if defined(__i386__) || defined(_M_IX86)
BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
{
char Buffer[256];
@ -543,6 +556,7 @@ BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lPar
}
return true;
}
#endif
BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
{
@ -607,9 +621,9 @@ EXPORT void EnableDebugging(int Enabled)
Profiling = GetSetting(Set_Profiling) != 0;
IndvidualBlock = GetSetting(Set_IndvidualBlock) != 0;
ShowErrors = GetSetting(Set_ShowErrors) != 0;
HleAlistTask = GetSetting(Set_HleAlistTask) != 0;
SyncCPU = GetSetting(Set_SyncCPU) != 0;
#if defined(__i386__) || defined(_M_IX86)
Compiler.bDest = GetSetting(Set_CheckDest) != 0;
Compiler.bAccum = GetSetting(Set_Accum) != 0;
Compiler.mmx = GetSetting(Set_Mmx) != 0;
@ -620,6 +634,7 @@ EXPORT void EnableDebugging(int Enabled)
Compiler.bGPRConstants = GetSetting(Set_GPRConstants) != 0;
Compiler.bFlags = GetSetting(Set_Flags) != 0;
Compiler.bAlignVector = GetSetting(Set_AlignVector) != 0;
#endif
}
#ifdef _WIN32
FixMenuState();

View File

@ -192,7 +192,6 @@ BEGIN
END
POPUP "Settings"
BEGIN
MENUITEM "HLE alist task", ID_SETTINGS_HLEALISTTASK
MENUITEM "Show Compiler Errors", ID_SHOWCOMPILERERRORS
MENUITEM "Break on start of task", ID_BREAKONSTARTOFTASK
MENUITEM "Log RDP Commands", ID_LOGRDPCOMMANDS

View File

@ -38,7 +38,6 @@
#define ID_CPUMETHOD_INTERPT 5017
#define ID_SETTINGS_LOGX86CODE 5019
#define ID_SETTINGS_MULTITHREADED 5020
#define ID_SETTINGS_HLEALISTTASK 5021
#define ID_CPUMETHOD_HLE 5022
#define ID_CPUMETHOD_RECOMPILER_TASKS 5023
#define ID_SETTINGS_SYNCCPU 5024