diff --git a/Android/jni/Project64-core/CMakeLists.txt b/Android/jni/Project64-core/CMakeLists.txt index 0c8e773f8..4acfa4075 100644 --- a/Android/jni/Project64-core/CMakeLists.txt +++ b/Android/jni/Project64-core/CMakeLists.txt @@ -49,12 +49,12 @@ add_library(Project64-core STATIC N64System/Mips/TLB.cpp N64System/Recompiler/CodeBlock.cpp N64System/Recompiler/CodeSection.cpp - N64System/Recompiler/SectionInfo.cpp + N64System/Recompiler/ExitInfo.cpp N64System/Recompiler/FunctionInfo.cpp N64System/Recompiler/FunctionMap.cpp + N64System/Recompiler/JumpInfo.cpp N64System/Recompiler/LoopAnalysis.cpp N64System/Recompiler/Recompiler.cpp - N64System/Recompiler/RecompilerCodeLog.cpp N64System/Recompiler/RecompilerMemory.cpp N64System/Recompiler/RegBase.cpp N64System/Recompiler/Aarch64/Aarch64RegInfo.cpp diff --git a/Source/Project64-core/N64System/N64System.cpp b/Source/Project64-core/N64System/N64System.cpp index 538a7c497..ddc27b2c0 100644 --- a/Source/Project64-core/N64System/N64System.cpp +++ b/Source/Project64-core/N64System/N64System.cpp @@ -1446,7 +1446,7 @@ void CN64System::SyncCPU(CN64System * const SecondCPU) if (bFastSP() && m_Recomp) { -#if defined(__aarch64__) || defined(__amd64__) +#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) g_Notify->BreakPoint(__FILE__,__LINE__); #else if (m_Recomp->MemoryStackPos() != (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))) @@ -1616,7 +1616,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU) } if (bFastSP() && m_Recomp) { -#if defined(__aarch64__) || defined(__amd64__) +#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) g_Notify->BreakPoint(__FILE__,__LINE__); #else if (m_Recomp->MemoryStackPos() != (uint32_t)(m_MMU_VM.Rdram() + (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF))) diff --git a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp index 2068559fb..673e4aa39 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeBlock.cpp @@ -33,6 +33,8 @@ CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter, uint8_t * Compi m_RecompilerOps = new CX86RecompilerOps(MMU, *this); #elif defined(__arm__) || defined(_M_ARM) m_RecompilerOps = new CArmRecompilerOps(MMU); +#else + g_Notify->BreakPoint(__FILE__, __LINE__); #endif if (m_RecompilerOps == nullptr) { @@ -88,6 +90,8 @@ CCodeBlock::~CCodeBlock() { #if defined(__i386__) || defined(_M_IX86) delete (CX86RecompilerOps *)m_RecompilerOps; +#else + g_Notify->BreakPoint(__FILE__, __LINE__); #endif m_RecompilerOps = nullptr; } diff --git a/Source/Project64-core/N64System/Recompiler/ExitInfo.h b/Source/Project64-core/N64System/Recompiler/ExitInfo.h index d93070a8d..d1100bbed 100644 --- a/Source/Project64-core/N64System/Recompiler/ExitInfo.h +++ b/Source/Project64-core/N64System/Recompiler/ExitInfo.h @@ -3,6 +3,8 @@ #include #include +class CCodeBlock; + struct CExitInfo { CExitInfo(CCodeBlock & CodeBlock); diff --git a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp index 0673e1b32..89fa77cfb 100644 --- a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp +++ b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp @@ -394,7 +394,7 @@ CCompiledFunc * CRecompiler::CompileCode() ret.first->second->SetNext(Func); } -#if defined(__aarch64__) || defined(__amd64__) +#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) g_Notify->BreakPoint(__FILE__,__LINE__); #else if (g_ModuleLogLevel[TraceRecompiler] >= TraceDebug) @@ -518,7 +518,7 @@ void CRecompiler::ResetLog() void CRecompiler::ResetMemoryStackPos() { -#if defined(__aarch64__) || defined(__amd64__) +#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) g_Notify->BreakPoint(__FILE__,__LINE__); #else if (m_Registers.m_GPR[29].UW[0] == 0) @@ -542,7 +542,7 @@ void CRecompiler::ResetMemoryStackPos() void CRecompiler::DumpFunctionTimes() { -#if defined(__aarch64__) || defined(__amd64__) +#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) g_Notify->BreakPoint(__FILE__,__LINE__); #else CPath LogFileName(g_Settings->LoadStringVal(Directory_Log).c_str(), "FunctionTimes.csv"); diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/RecompilerOps.h index 2aade0e98..4b4809d40 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/RecompilerOps.h @@ -40,4 +40,12 @@ enum RecompilerTrapCompare typedef CX86RecompilerOps CRecompilerOps; +#elif defined(__amd64__) || defined(_M_X64) +#include + +#elif defined(__arm__) || defined(_M_ARM) +#include + +typedef CX86RecompilerOps CArmRecompilerOps; + #endif diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp new file mode 100644 index 000000000..d70ee8aa9 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.cpp @@ -0,0 +1,890 @@ +#include "stdafx.h" +#include + +CX64RecompilerOps::CX64RecompilerOps(CMipsMemoryVM & /*MMU*/, CCodeBlock & CodeBlock) : + m_Assembler(CodeBlock), + m_RegWorkingSet(CodeBlock, m_Assembler) +{ +} + +CX64RecompilerOps::~CX64RecompilerOps() +{ +} + +void CX64RecompilerOps::Compile_TrapCompare(RecompilerTrapCompare /*CompareType*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::Compile_BranchCompare(RecompilerBranchCompare /*CompareType*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::Compile_Branch(RecompilerBranchCompare /*CompareType*/, bool /*Link*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::Compile_BranchLikely(RecompilerBranchCompare /*CompareType*/, bool /*Link*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::BNE_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::BEQ_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::BGTZ_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::BLEZ_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::BLTZ_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::BGEZ_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_BCF_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_BCT_Compare() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::J() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::JAL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::ADDI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::ADDIU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SLTI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SLTIU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::ANDI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::ORI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::XORI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LUI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::DADDI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::DADDIU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LDL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LDR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LB() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LH() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LWL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LW() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LBU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LHU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LWR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LWU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SB() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SH() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SWL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SW() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SWR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SDL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SDR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CACHE() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LWC1() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LDC1() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::LD() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SC() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SWC1() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SDC1() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SD() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SLL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SRL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SRA() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SLLV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SRLV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SRAV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_JR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_JALR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SYSCALL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_MFLO() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_MTLO() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_MFHI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_MTHI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSLLV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSRLV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSRAV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_MULT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_MULTU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DIV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DIVU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DMULT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DMULTU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DDIV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DDIVU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_ADD() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_ADDU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SUB() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SUBU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_AND() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_OR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_XOR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_NOR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SLT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_SLTU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DADD() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DADDU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSUB() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSUBU() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSLL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSRL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSRA() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSLL32() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSRL32() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SPECIAL_DSRA32() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_MF() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_MT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_CO_TLBR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_CO_TLBWI() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_CO_TLBWR() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_CO_TLBP() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP0_CO_ERET() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_MF() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_DMF() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_CF() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_MT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_DMT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_CT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_ADD() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_SUB() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_MUL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_DIV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_ABS() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_NEG() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_SQRT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_MOV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_ROUND_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_TRUNC_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_CEIL_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_FLOOR_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_ROUND_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_TRUNC_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_CEIL_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_FLOOR_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_CVT_D() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_CVT_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_CVT_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_S_CMP() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_ADD() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_SUB() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_MUL() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_DIV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_ABS() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_NEG() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_SQRT() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_MOV() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_ROUND_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_TRUNC_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_CEIL_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_FLOOR_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_ROUND_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_TRUNC_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_CEIL_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_FLOOR_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_CVT_S() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_CVT_W() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_CVT_L() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_D_CMP() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_W_CVT_S() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_W_CVT_D() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_L_CVT_S() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::COP1_L_CVT_D() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::UnknownOpcode() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::EnterCodeBlock() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CompileExitCode() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CompileInPermLoop(CRegInfo & /*RegSet*/, uint32_t /*ProgramCounter*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SyncRegState(const CRegInfo & /*SyncTo*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +CRegInfo & CX64RecompilerOps::GetRegWorkingSet(void) +{ + return m_RegWorkingSet; +} + +void CX64RecompilerOps::SetRegWorkingSet(const CRegInfo & /*RegInfo*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +bool CX64RecompilerOps::InheritParentInfo() +{ + g_Notify->BreakPoint(__FILE__, __LINE__); + return false; +} + +void CX64RecompilerOps::LinkJump(CJumpInfo & /*JumpInfo*/, uint32_t /*SectionID*/, uint32_t /*FromSectionID*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::JumpToSection(CCodeSection * /*Section*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::JumpToUnknown(CJumpInfo * /*JumpInfo*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SetCurrentPC(uint32_t /*ProgramCounter*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +uint32_t CX64RecompilerOps::GetCurrentPC(void) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); + return 0; +} + +void CX64RecompilerOps::SetCurrentSection(CCodeSection * /*section*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::SetNextStepType(PIPELINE_STAGE /*StepType*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +PIPELINE_STAGE CX64RecompilerOps::GetNextStepType(void) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); + return PIPELINE_STAGE_NORMAL; +} + +const R4300iOpcode & CX64RecompilerOps::GetOpcode(void) const +{ + return m_Opcode; +} + +void CX64RecompilerOps::PreCompileOpcode(void) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::PostCompileOpcode(void) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CompileExit(uint32_t /*JumpPC*/, uint32_t /*TargetPC*/, CRegInfo & /*ExitRegSet*/, CExitInfo::EXIT_REASON /*reason*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::UpdateCounters(CRegInfo & /*RegSet*/, bool /*CheckTimer*/, bool /*ClearValues*/, bool /*UpdateTimer*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CompileSystemCheck(uint32_t /*TargetPC*/, const CRegInfo & /*RegSet*/) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CompileExecuteBP(void) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +void CX64RecompilerOps::CompileExecuteDelaySlotBP(void) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h new file mode 100644 index 000000000..1d544ba03 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RecompilerOps.h @@ -0,0 +1,236 @@ +#pragma once +#if defined(__amd64__) || defined(_M_X64) + +#include +#include +#include +#include +#include + +class CMipsMemoryVM; +class CCodeBlock; +class CCodeSection; +class CX64Ops; +struct CJumpInfo; + +class CX64RecompilerOps +{ +public: + CX64RecompilerOps(CMipsMemoryVM & MMU, CCodeBlock & CodeBlock); + ~CX64RecompilerOps(); + + // Trap functions + void Compile_TrapCompare(RecompilerTrapCompare CompareType); + + // Branch functions + void Compile_BranchCompare(RecompilerBranchCompare CompareType); + void Compile_Branch(RecompilerBranchCompare CompareType, bool Link); + void Compile_BranchLikely(RecompilerBranchCompare CompareType, bool Link); + void BNE_Compare(); + void BEQ_Compare(); + void BGTZ_Compare(); + void BLEZ_Compare(); + void BLTZ_Compare(); + void BGEZ_Compare(); + void COP1_BCF_Compare(); + void COP1_BCT_Compare(); + + // Opcode functions + void J(); + void JAL(); + void ADDI(); + void ADDIU(); + void SLTI(); + void SLTIU(); + void ANDI(); + void ORI(); + void XORI(); + void LUI(); + void DADDI(); + void DADDIU(); + void LDL(); + void LDR(); + void LB(); + void LH(); + void LWL(); + void LW(); + void LBU(); + void LHU(); + void LWR(); + void LWU(); + void SB(); + void SH(); + void SWL(); + void SW(); + void SWR(); + void SDL(); + void SDR(); + void CACHE(); + void LL(); + void LWC1(); + void LDC1(); + void LD(); + void SC(); + void SWC1(); + void SDC1(); + void SD(); + + // R4300i opcodes: Special + void SPECIAL_SLL(); + void SPECIAL_SRL(); + void SPECIAL_SRA(); + void SPECIAL_SLLV(); + void SPECIAL_SRLV(); + void SPECIAL_SRAV(); + void SPECIAL_JR(); + void SPECIAL_JALR(); + void SPECIAL_SYSCALL(); + void SPECIAL_MFLO(); + void SPECIAL_MTLO(); + void SPECIAL_MFHI(); + void SPECIAL_MTHI(); + void SPECIAL_DSLLV(); + void SPECIAL_DSRLV(); + void SPECIAL_DSRAV(); + void SPECIAL_MULT(); + void SPECIAL_MULTU(); + void SPECIAL_DIV(); + void SPECIAL_DIVU(); + void SPECIAL_DMULT(); + void SPECIAL_DMULTU(); + void SPECIAL_DDIV(); + void SPECIAL_DDIVU(); + void SPECIAL_ADD(); + void SPECIAL_ADDU(); + void SPECIAL_SUB(); + void SPECIAL_SUBU(); + void SPECIAL_AND(); + void SPECIAL_OR(); + void SPECIAL_XOR(); + void SPECIAL_NOR(); + void SPECIAL_SLT(); + void SPECIAL_SLTU(); + void SPECIAL_DADD(); + void SPECIAL_DADDU(); + void SPECIAL_DSUB(); + void SPECIAL_DSUBU(); + void SPECIAL_DSLL(); + void SPECIAL_DSRL(); + void SPECIAL_DSRA(); + void SPECIAL_DSLL32(); + void SPECIAL_DSRL32(); + void SPECIAL_DSRA32(); + + // COP0 functions + void COP0_MF(); + void COP0_MT(); + + // COP0 CO functions + void COP0_CO_TLBR(); + void COP0_CO_TLBWI(); + void COP0_CO_TLBWR(); + void COP0_CO_TLBP(); + void COP0_CO_ERET(); + + // COP1 functions + void COP1_MF(); + void COP1_DMF(); + void COP1_CF(); + void COP1_MT(); + void COP1_DMT(); + void COP1_CT(); + + // COP1: S functions + void COP1_S_ADD(); + void COP1_S_SUB(); + void COP1_S_MUL(); + void COP1_S_DIV(); + void COP1_S_ABS(); + void COP1_S_NEG(); + void COP1_S_SQRT(); + void COP1_S_MOV(); + void COP1_S_ROUND_L(); + void COP1_S_TRUNC_L(); + void COP1_S_CEIL_L(); + void COP1_S_FLOOR_L(); + void COP1_S_ROUND_W(); + void COP1_S_TRUNC_W(); + void COP1_S_CEIL_W(); + void COP1_S_FLOOR_W(); + void COP1_S_CVT_D(); + void COP1_S_CVT_W(); + void COP1_S_CVT_L(); + void COP1_S_CMP(); + + // COP1: D functions + void COP1_D_ADD(); + void COP1_D_SUB(); + void COP1_D_MUL(); + void COP1_D_DIV(); + void COP1_D_ABS(); + void COP1_D_NEG(); + void COP1_D_SQRT(); + void COP1_D_MOV(); + void COP1_D_ROUND_L(); + void COP1_D_TRUNC_L(); + void COP1_D_CEIL_L(); + void COP1_D_FLOOR_L(); + void COP1_D_ROUND_W(); + void COP1_D_TRUNC_W(); + void COP1_D_CEIL_W(); + void COP1_D_FLOOR_W(); + void COP1_D_CVT_S(); + void COP1_D_CVT_W(); + void COP1_D_CVT_L(); + void COP1_D_CMP(); + + // COP1: W functions + void COP1_W_CVT_S(); + void COP1_W_CVT_D(); + + // COP1: L functions + void COP1_L_CVT_S(); + void COP1_L_CVT_D(); + + // Other functions + void UnknownOpcode(); + + void EnterCodeBlock(); + void CompileExitCode(); + void CompileInPermLoop(CRegInfo & RegSet, uint32_t ProgramCounter); + void SyncRegState(const CRegInfo & SyncTo); + CRegInfo & GetRegWorkingSet(void); + void SetRegWorkingSet(const CRegInfo & RegInfo); + bool InheritParentInfo(); + void LinkJump(CJumpInfo & JumpInfo, uint32_t SectionID = -1, uint32_t FromSectionID = -1); + void JumpToSection(CCodeSection * Section); + void JumpToUnknown(CJumpInfo * JumpInfo); + void SetCurrentPC(uint32_t ProgramCounter); + uint32_t GetCurrentPC(void); + void SetCurrentSection(CCodeSection * section); + void SetNextStepType(PIPELINE_STAGE StepType); + PIPELINE_STAGE GetNextStepType(void); + const R4300iOpcode & GetOpcode(void) const; + void PreCompileOpcode(void); + void PostCompileOpcode(void); + void CompileExit(uint32_t JumpPC, uint32_t TargetPC, CRegInfo &ExitRegSet, CExitInfo::EXIT_REASON reason); + + void UpdateCounters(CRegInfo & RegSet, bool CheckTimer, bool ClearValues = false, bool UpdateTimer = true); + void CompileSystemCheck(uint32_t TargetPC, const CRegInfo & RegSet); + void CompileExecuteBP(void); + void CompileExecuteDelaySlotBP(void); + + CX64Ops & Assembler() { return m_Assembler; } + +private: + CX64RecompilerOps(const CX64RecompilerOps&); + CX64RecompilerOps& operator=(const CX64RecompilerOps&); + + CX64RegInfo m_RegWorkingSet; + CX64Ops m_Assembler; + R4300iOpcode m_Opcode; +}; + +typedef CX64RecompilerOps CRecompilerOps; + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h b/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h index 8ed032675..d3005dae7 100644 --- a/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64RegInfo.h @@ -3,11 +3,21 @@ #if defined(__amd64__) || defined(_M_X64) #include +class CCodeBlock; +class CX64Ops; + class CX64RegInfo : public CRegBase { public: + CX64RegInfo(CCodeBlock & CodeBlock, CX64Ops & Assembler); + CX64RegInfo(const CX64RegInfo&); + ~CX64RegInfo(); + + CX64RegInfo& operator=(const CX64RegInfo&); + bool operator==(const CX64RegInfo& right) const; + bool operator!=(const CX64RegInfo& right) const; }; #endif diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp new file mode 100644 index 000000000..474b30c4b --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.cpp @@ -0,0 +1,9 @@ +#include "stdafx.h" +#include + +CX64Ops::CX64Ops(CCodeBlock & CodeBlock) : + m_CodeBlock(CodeBlock) +{ +} + + diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h new file mode 100644 index 000000000..88fbd588f --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x64ops.h @@ -0,0 +1,19 @@ +#pragma once +#if defined(__amd64__) || defined(_M_X64) + +class CCodeBlock; + +class CX64Ops +{ +public: + CX64Ops(CCodeBlock & CodeBlock); + +private: + CX64Ops(void); + CX64Ops(const CX64Ops&); + CX64Ops& operator=(const CX64Ops&); + + CCodeBlock & m_CodeBlock; +}; + +#endif diff --git a/Source/Project64-core/N64System/Recompiler/x64-86/x86RegInfo.cpp b/Source/Project64-core/N64System/Recompiler/x64-86/x86RegInfo.cpp new file mode 100644 index 000000000..02a2c4459 --- /dev/null +++ b/Source/Project64-core/N64System/Recompiler/x64-86/x86RegInfo.cpp @@ -0,0 +1,34 @@ +#include "stdafx.h" +#include + +CX64RegInfo::CX64RegInfo(CCodeBlock & /*CodeBlock*/, CX64Ops & /*Assembler*/) +{ +} + +CX64RegInfo::CX64RegInfo(const CX64RegInfo&) +{ + g_Notify->BreakPoint(__FILE__, __LINE__); +} + +CX64RegInfo::~CX64RegInfo() +{ +} + +CX64RegInfo& CX64RegInfo::operator=(const CX64RegInfo & right) +{ + CRegBase::operator=(right); + g_Notify->BreakPoint(__FILE__, __LINE__); + return *this; +} + +bool CX64RegInfo::operator==(const CX64RegInfo & /*right*/) const +{ + g_Notify->BreakPoint(__FILE__, __LINE__); + return false; +} + +bool CX64RegInfo::operator!=(const CX64RegInfo & /*right*/) const +{ + g_Notify->BreakPoint(__FILE__, __LINE__); + return false; +} \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h index 95228358c..832f16f2b 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RegInfo.h @@ -47,7 +47,6 @@ public: FPU_Double = 4, }; -public: CX86RegInfo(CCodeBlock & CodeBlock, CX86Ops & Assembler); CX86RegInfo(const CX86RegInfo&); ~CX86RegInfo(); diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h index e47c73dc8..b07eb6741 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86ops.h +++ b/Source/Project64-core/N64System/Recompiler/x86/x86ops.h @@ -50,7 +50,6 @@ public: static const char * x86_HalfName(x86Reg Reg); static const char * fpu_Name(x86FpuValues Reg); -public: CX86Ops(CCodeBlock & CodeBlock); // Logging functions diff --git a/Source/Project64-core/Project64-core.vcxproj b/Source/Project64-core/Project64-core.vcxproj index 75f9ccd7d..ed6e2d425 100644 --- a/Source/Project64-core/Project64-core.vcxproj +++ b/Source/Project64-core/Project64-core.vcxproj @@ -101,6 +101,9 @@ + + + @@ -209,6 +212,7 @@ + @@ -226,6 +230,8 @@ + + diff --git a/Source/Project64-core/Project64-core.vcxproj.filters b/Source/Project64-core/Project64-core.vcxproj.filters index d3cf7cfcb..a9e491069 100644 --- a/Source/Project64-core/Project64-core.vcxproj.filters +++ b/Source/Project64-core/Project64-core.vcxproj.filters @@ -109,6 +109,15 @@ {a29536c1-cda4-43b0-b3c6-12a24f42be64} + + {ec8602cf-3980-4a8e-8cac-25f9ad4f7a42} + + + {ae9f1045-e15e-4a27-8891-937c7608ee06} + + + {56644680-2b82-4343-8619-660b68685cba} + @@ -408,6 +417,15 @@ Source Files\N64 System\Recompiler + + Source Files\N64 System\Recompiler\x64-86 + + + Source Files\N64 System\Recompiler\x64-86 + + + Source Files\N64 System\Recompiler\x64-86 + @@ -686,9 +704,6 @@ Header Files - - Header Files\N64 System\Recompiler - Header Files @@ -794,6 +809,18 @@ Header Files\N64 System\MemoryHandler + + Header Files\N64 System\Recompiler\x64-86 + + + Header Files\N64 System\Recompiler\Aarch64 + + + Header Files\N64 System\Recompiler\x64-86 + + + Header Files\N64 System\Recompiler\x64-86 + diff --git a/Source/Project64/UserInterface/WelcomeScreen.cpp b/Source/Project64/UserInterface/WelcomeScreen.cpp index 9a6afce50..87ad2d724 100644 --- a/Source/Project64/UserInterface/WelcomeScreen.cpp +++ b/Source/Project64/UserInterface/WelcomeScreen.cpp @@ -20,7 +20,7 @@ void WelcomeScreen::SelectGameDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/) bi.lpszTitle = wTitle.c_str(); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = (BFFCALLBACK)SelectDirCallBack; - bi.lParam = (DWORD)InitialDir.c_str(); + bi.lParam = (LPARAM)InitialDir.c_str(); if ((pidl = SHBrowseForFolder(&bi)) != nullptr) { if (SHGetPathFromIDList(pidl, Directory))