diff --git a/Source/Project64-rsp-core/Hle/HleTask.cpp b/Source/Project64-rsp-core/Hle/HleTask.cpp index 8ae6c5f40..297fb1895 100644 --- a/Source/Project64-rsp-core/Hle/HleTask.cpp +++ b/Source/Project64-rsp-core/Hle/HleTask.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include 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) diff --git a/Source/Project64-rsp-core/Hle/HleTask.h b/Source/Project64-rsp-core/Hle/HleTask.h index 79c594768..8db495ffd 100644 --- a/Source/Project64-rsp-core/Hle/HleTask.h +++ b/Source/Project64-rsp-core/Hle/HleTask.h @@ -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); diff --git a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj index ef25c577c..f52253f6b 100644 --- a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj +++ b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj @@ -67,7 +67,7 @@ - + @@ -98,7 +98,7 @@ - + diff --git a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters index e125883a8..74489c752 100644 --- a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters +++ b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters @@ -69,9 +69,6 @@ Source Files\Recompiler - - Source Files\Recompiler - Source Files\Recompiler @@ -141,6 +138,9 @@ Source Files\hle + + Source Files\Recompiler + @@ -176,9 +176,6 @@ Header Files\Recompiler - - Header Files\Recompiler - Header Files\cpu @@ -227,5 +224,8 @@ Header Files\hle + + Header Files\Recompiler + \ No newline at end of file diff --git a/Source/Project64-rsp-core/RSPInfo.cpp b/Source/Project64-rsp-core/RSPInfo.cpp index 3b66e9617..7d4fc0447 100644 --- a/Source/Project64-rsp-core/RSPInfo.cpp +++ b/Source/Project64-rsp-core/RSPInfo.cpp @@ -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(); diff --git a/Source/Project64-rsp-core/Recompiler/Mmx.cpp b/Source/Project64-rsp-core/Recompiler/Mmx.cpp index 688c2e424..8b412c8de 100644 --- a/Source/Project64-rsp-core/Recompiler/Mmx.cpp +++ b/Source/Project64-rsp-core/Recompiler/Mmx.cpp @@ -1,3 +1,5 @@ +#if defined(__i386__) || defined(_M_IX86) + #include "X86.h" #include #include @@ -814,3 +816,5 @@ void MmxCompareGreaterWordRegToReg(int Dest, int Source) PUTDST16(RecompPos, 0x650f); PUTDST8(RecompPos, 0xC0 | x86Command); } + +#endif diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerAnalysis.cpp b/Source/Project64-rsp-core/Recompiler/RspRecompilerAnalysis.cpp index d32f87a1d..b6b55796f 100644 --- a/Source/Project64-rsp-core/Recompiler/RspRecompilerAnalysis.cpp +++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerAnalysis.cpp @@ -1,3 +1,5 @@ +#if defined(__i386__) || defined(_M_IX86) + #include "RspRecompilerCPU.h" #include #include @@ -1072,3 +1074,5 @@ bool CompareInstructions(uint32_t PC, RSPOpcode * Top, RSPOpcode * Bottom) return false; } + +#endif \ No newline at end of file diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp b/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp index 30ab3be11..54abf04c0 100644 --- a/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp +++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp @@ -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 #include @@ -1247,4 +1249,6 @@ void CRSPRecompiler::SetJumpTable(uint32_t End) JumpTable = (void **)(JumpTables + NoOfMaps * 0x1000); Table = NoOfMaps; NoOfMaps += 1; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.h b/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.h index ce0641dad..888b7a3c4 100644 --- a/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.h +++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.h @@ -1,6 +1,8 @@ +#if defined(__i386__) || defined(_M_IX86) + #pragma once -#include +#include #include #include #include @@ -115,4 +117,6 @@ extern RSP_COMPILER Compiler; #define IsMmxEnabled (Compiler.mmx) #define IsMmx2Enabled (Compiler.mmx2) -#define IsSseEnabled (Compiler.sse) \ No newline at end of file +#define IsSseEnabled (Compiler.sse) + +#endif \ No newline at end of file diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps-x86.cpp similarity index 99% rename from Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp rename to Source/Project64-rsp-core/Recompiler/RspRecompilerOps-x86.cpp index d1d1c6907..2d121b948 100644 --- a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp +++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps-x86.cpp @@ -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 #include -#include +#include #include #include #include @@ -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 \ No newline at end of file diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.h b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps-x86.h similarity index 100% rename from Source/Project64-rsp-core/Recompiler/RspRecompilerOps.h rename to Source/Project64-rsp-core/Recompiler/RspRecompilerOps-x86.h diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerSections.cpp b/Source/Project64-rsp-core/Recompiler/RspRecompilerSections.cpp index 7dd531d2f..9ca313853 100644 --- a/Source/Project64-rsp-core/Recompiler/RspRecompilerSections.cpp +++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerSections.cpp @@ -1,6 +1,8 @@ +#if defined(__i386__) || defined(_M_IX86) + #include "RspRecompilerCPU.h" #include "X86.h" -#include +#include #include #include #include @@ -967,3 +969,5 @@ bool CRSPRecompilerOps::RSP_DoSections(void) } return false; } + +#endif \ No newline at end of file diff --git a/Source/Project64-rsp-core/Recompiler/Sse.cpp b/Source/Project64-rsp-core/Recompiler/Sse.cpp index 95b76eb7e..868a15154 100644 --- a/Source/Project64-rsp-core/Recompiler/Sse.cpp +++ b/Source/Project64-rsp-core/Recompiler/Sse.cpp @@ -1,3 +1,5 @@ +#if defined(__i386__) || defined(_M_IX86) + #include "X86.h" #include #include @@ -355,3 +357,5 @@ void SseShuffleReg(int Dest, int Source, uint8_t Immed) PUTDST8(RecompPos, 0xC0 | x86Command); PUTDST8(RecompPos, Immed); } + +#endif diff --git a/Source/Project64-rsp-core/Recompiler/X86.cpp b/Source/Project64-rsp-core/Recompiler/X86.cpp index cb8a0ad1e..70267372a 100644 --- a/Source/Project64-rsp-core/Recompiler/X86.cpp +++ b/Source/Project64-rsp-core/Recompiler/X86.cpp @@ -1,3 +1,5 @@ +#if defined(__i386__) || defined(_M_IX86) + #include #include "X86.h" @@ -3366,3 +3368,5 @@ void * GetAddressOf_(int value, ...) return Address; } + +#endif diff --git a/Source/Project64-rsp-core/Recompiler/X86.h b/Source/Project64-rsp-core/Recompiler/X86.h index ac2fcef6e..557829010 100644 --- a/Source/Project64-rsp-core/Recompiler/X86.h +++ b/Source/Project64-rsp-core/Recompiler/X86.h @@ -1,4 +1,5 @@ #pragma once +#if defined(__i386__) || defined(_M_IX86) #include 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 diff --git a/Source/Project64-rsp-core/Settings/RspSettings.cpp b/Source/Project64-rsp-core/Settings/RspSettings.cpp index 07f60014e..6b295e5f8 100644 --- a/Source/Project64-rsp-core/Settings/RspSettings.cpp +++ b/Source/Project64-rsp-core/Settings/RspSettings.cpp @@ -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); diff --git a/Source/Project64-rsp-core/Settings/RspSettings.h b/Source/Project64-rsp-core/Settings/RspSettings.h index e25c3217b..ce4cbcf66 100644 --- a/Source/Project64-rsp-core/Settings/RspSettings.h +++ b/Source/Project64-rsp-core/Settings/RspSettings.h @@ -2,14 +2,18 @@ #include 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, }; diff --git a/Source/Project64-rsp-core/Settings/RspSettingsID.h b/Source/Project64-rsp-core/Settings/RspSettingsID.h index 073fe6d38..4704cb674 100644 --- a/Source/Project64-rsp-core/Settings/RspSettingsID.h +++ b/Source/Project64-rsp-core/Settings/RspSettingsID.h @@ -9,7 +9,6 @@ enum Set_Profiling, Set_IndvidualBlock, Set_ShowErrors, - Set_HleAlistTask, Set_SyncCPU, // Compiler settings diff --git a/Source/Project64-rsp-core/cpu/RSPCpu.cpp b/Source/Project64-rsp-core/cpu/RSPCpu.cpp index f0e25b982..f7c51ad38 100644 --- a/Source/Project64-rsp-core/cpu/RSPCpu.cpp +++ b/Source/Project64-rsp-core/cpu/RSPCpu.cpp @@ -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) { diff --git a/Source/Project64-rsp-core/cpu/RSPRegisterHandlerPlugin.cpp b/Source/Project64-rsp-core/cpu/RSPRegisterHandlerPlugin.cpp index 1d0aba5da..6fed7a89d 100644 --- a/Source/Project64-rsp-core/cpu/RSPRegisterHandlerPlugin.cpp +++ b/Source/Project64-rsp-core/cpu/RSPRegisterHandlerPlugin.cpp @@ -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 } diff --git a/Source/Project64-rsp-core/cpu/RspSystem.cpp b/Source/Project64-rsp-core/cpu/RspSystem.cpp index a5a38be78..b7f244dac 100644 --- a/Source/Project64-rsp-core/cpu/RspSystem.cpp +++ b/Source/Project64-rsp-core/cpu/RspSystem.cpp @@ -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) { diff --git a/Source/Project64-rsp-core/cpu/RspSystem.h b/Source/Project64-rsp-core/cpu/RspSystem.h index f6afcd063..76e0f7d86 100644 --- a/Source/Project64-rsp-core/cpu/RspSystem.h +++ b/Source/Project64-rsp-core/cpu/RspSystem.h @@ -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; diff --git a/Source/Project64-rsp/Debugger/RSPDebuggerUI.cpp b/Source/Project64-rsp/Debugger/RSPDebuggerUI.cpp index be888328d..c137e5da0 100644 --- a/Source/Project64-rsp/Debugger/RSPDebuggerUI.cpp +++ b/Source/Project64-rsp/Debugger/RSPDebuggerUI.cpp @@ -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); diff --git a/Source/Project64-rsp/Main.cpp b/Source/Project64-rsp/Main.cpp index c6a6e8929..e85dd98c0 100644 --- a/Source/Project64-rsp/Main.cpp +++ b/Source/Project64-rsp/Main.cpp @@ -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(); diff --git a/Source/Project64-rsp/Project64-rsp.rc b/Source/Project64-rsp/Project64-rsp.rc index 556959f81..32e4bba8c 100644 --- a/Source/Project64-rsp/Project64-rsp.rc +++ b/Source/Project64-rsp/Project64-rsp.rc @@ -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 diff --git a/Source/Project64-rsp/resource.h b/Source/Project64-rsp/resource.h index 729366a00..583633861 100644 --- a/Source/Project64-rsp/resource.h +++ b/Source/Project64-rsp/resource.h @@ -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