diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index f52e160404..9cc81b0ce5 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -8,6 +8,7 @@ #include "Common/IniFile.h" #include "Core/ConfigManager.h" #include "Core/HW/SI.h" +#include "Core/PowerPC/PowerPC.h" #include "DiscIO/NANDContentLoader.h" SConfig* SConfig::m_Instance; @@ -542,13 +543,13 @@ void SConfig::LoadCoreSettings(IniFile& ini) core->Get("HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); #ifdef _M_X86 - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JIT64); + core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_JIT64); #elif _M_ARM_32 - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JITARM); + core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_JITARM); #elif _M_ARM_64 - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JITARM64); + core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_JITARM64); #else - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_INTERPRETER); + core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, PowerPC::CORE_INTERPRETER); #endif core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true); core->Get("DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true); diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 30d64b6d38..e61d1b6ab9 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -395,7 +395,7 @@ void EmuThread() CBoot::BootUp(); // Setup our core, but can't use dynarec if we are compare server - if (core_parameter.iCPUCore != SCoreStartupParameter::CORE_INTERPRETER + if (core_parameter.iCPUCore != PowerPC::CORE_INTERPRETER && (!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient)) { PowerPC::SetMode(PowerPC::MODE_JIT); diff --git a/Source/Core/Core/CoreParameter.cpp b/Source/Core/Core/CoreParameter.cpp index a93cdd0205..aef85f9976 100644 --- a/Source/Core/Core/CoreParameter.cpp +++ b/Source/Core/Core/CoreParameter.cpp @@ -17,6 +17,7 @@ #include "Core/Boot/Boot.h" #include "Core/Boot/Boot_DOL.h" #include "Core/FifoPlayer/FifoDataFile.h" +#include "Core/PowerPC/PowerPC.h" #include "DiscIO/NANDContentLoader.h" #include "DiscIO/VolumeCreator.h" @@ -66,7 +67,7 @@ void SCoreStartupParameter::LoadDefaults() iGDBPort = -1; #endif - iCPUCore = CORE_JIT64; + iCPUCore = PowerPC::CORE_JIT64; bCPUThread = false; bSkipIdle = false; bSyncGPUOnSkipIdleHack = true; diff --git a/Source/Core/Core/CoreParameter.h b/Source/Core/Core/CoreParameter.h index 49dbe7b80a..189eca524e 100644 --- a/Source/Core/Core/CoreParameter.h +++ b/Source/Core/Core/CoreParameter.h @@ -136,14 +136,6 @@ struct SCoreStartupParameter bool bAutomaticStart; bool bBootToPause; - enum - { - CORE_INTERPRETER, - CORE_JIT64, - CORE_JITIL64, - CORE_JITARM, - CORE_JITARM64 - }; int iCPUCore; // JIT (shared between JIT and JITIL) diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 977907052a..876812e0bb 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -15,6 +15,7 @@ #include "Core/ConfigManager.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/JitInterface.h" +#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/Profiler.h" #include "Core/PowerPC/JitCommon/JitBase.h" @@ -54,38 +55,28 @@ namespace JitInterface CPUCoreBase *ptr = nullptr; switch (core) { - #if _M_X86 - case 1: - { - ptr = new Jit64(); - break; - } - case 2: - { - ptr = new JitIL(); - break; - } - #endif - #if _M_ARM_32 - case 3: - { - ptr = new JitArm(); - break; - } - #endif - #if _M_ARM_64 - case 4: - { - ptr = new JitArm64(); - break; - } - #endif - default: - { - PanicAlert("Unrecognizable cpu_core: %d", core); - jit = nullptr; - return nullptr; - } + #if _M_X86 + case PowerPC::CORE_JIT64: + ptr = new Jit64(); + break; + case PowerPC::CORE_JITIL64: + ptr = new JitIL(); + break; + #endif + #if _M_ARM_32 + case PowerPC::CORE_JITARM: + ptr = new JitArm(); + break; + #endif + #if _M_ARM_64 + case PowerPC::CORE_JITARM64: + ptr = new JitArm64(); + break; + #endif + default: + PanicAlert("Unrecognizable cpu_core: %d", core); + jit = nullptr; + return nullptr; } jit = static_cast(ptr); jit->Init(); @@ -95,37 +86,27 @@ namespace JitInterface { switch (core) { - #if _M_X86 - case 1: - { - Jit64Tables::InitTables(); - break; - } - case 2: - { - JitILTables::InitTables(); - break; - } - #endif - #if _M_ARM_32 - case 3: - { - JitArmTables::InitTables(); - break; - } - #endif - #if _M_ARM_64 - case 4: - { - JitArm64Tables::InitTables(); - break; - } - #endif - default: - { - PanicAlert("Unrecognizable cpu_core: %d", core); - break; - } + #if _M_X86 + case PowerPC::CORE_JIT64: + Jit64Tables::InitTables(); + break; + case PowerPC::CORE_JITIL64: + JitILTables::InitTables(); + break; + #endif + #if _M_ARM_32 + case PowerPC::CORE_JITARM: + JitArmTables::InitTables(); + break; + #endif + #if _M_ARM_64 + case PowerPC::CORE_JITARM64: + JitArm64Tables::InitTables(); + break; + #endif + default: + PanicAlert("Unrecognizable cpu_core: %d", core); + break; } } CPUCoreBase *GetCore() diff --git a/Source/Core/Core/PowerPC/PPCTables.cpp b/Source/Core/Core/PowerPC/PPCTables.cpp index ab413a5343..684d681908 100644 --- a/Source/Core/Core/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/PowerPC/PPCTables.cpp @@ -11,6 +11,7 @@ #include "Common/StringUtil.h" #include "Core/PowerPC/JitInterface.h" +#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PPCTables.h" #include "Core/PowerPC/Interpreter/Interpreter.h" #include "Core/PowerPC/Interpreter/Interpreter_Tables.h" @@ -93,68 +94,20 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst) namespace PPCTables { -bool UsesFPU(UGeckoInstruction _inst) +bool UsesFPU(UGeckoInstruction inst) { - switch (_inst.OPCD) - { - case 04: // PS - return _inst.SUBOP10 != 1014; + GekkoOPInfo* const info = GetOpInfo(inst); - case 48: // lfs - case 49: // lfsu - case 50: // lfd - case 51: // lfdu - case 52: // stfs - case 53: // stfsu - case 54: // stfd - case 55: // stfdu - case 56: // psq_l - case 57: // psq_lu - - case 59: // FPU-sgl - case 60: // psq_st - case 61: // psq_stu - case 63: // FPU-dbl - return true; - - case 31: - switch (_inst.SUBOP10) - { - case 535: - case 567: - case 599: - case 631: - case 663: - case 695: - case 727: - case 759: - case 983: - return true; - default: - return false; - } - default: - return false; - } + return (info->flags & FL_USE_FPU) != 0; } void InitTables(int cpu_core) { // Interpreter ALWAYS needs to be initialized InterpreterTables::InitTables(); - switch (cpu_core) - { - case 0: - { - // Interpreter - break; - } - default: - { - JitInterface::InitTables(cpu_core); - break; - } - } + + if (cpu_core != PowerPC::CORE_INTERPRETER) + JitInterface::InitTables(cpu_core); } #define OPLOG diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index 1023b82a2f..ce69bd7d01 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -143,18 +143,17 @@ void Init(int cpu_core) switch (cpu_core) { - case 0: + case PowerPC::CORE_INTERPRETER: + cpu_core_base = interpreter; + break; + + default: + cpu_core_base = JitInterface::InitJitCore(cpu_core); + if (!cpu_core_base) // Handle Situations where JIT core isn't available { + WARN_LOG(POWERPC, "Jit core %d not available. Defaulting to interpreter.", cpu_core); cpu_core_base = interpreter; - break; } - default: - cpu_core_base = JitInterface::InitJitCore(cpu_core); - if (!cpu_core_base) // Handle Situations where JIT core isn't available - { - WARN_LOG(POWERPC, "Jit core %d not available. Defaulting to interpreter.", cpu_core); - cpu_core_base = interpreter; - } break; } diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index a536b60ca5..ba613941a6 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -21,6 +21,15 @@ extern CPUCoreBase *cpu_core_base; namespace PowerPC { +enum +{ + CORE_INTERPRETER, + CORE_JIT64, + CORE_JITIL64, + CORE_JITARM, + CORE_JITARM64 +}; + enum CoreMode { MODE_INTERPRETER, diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index 8ad31e0675..c307a1fcd4 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -41,6 +41,7 @@ #include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPLLE/DSPLLE.h" #include "Core/IPC_HLE/WII_IPC_HLE.h" +#include "Core/PowerPC/PowerPC.h" #include "DiscIO/NANDContentLoader.h" @@ -884,7 +885,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) startup_params.iCPUCore = CPUCores[CPUEngine->GetSelection()].CPUid; if (main_frame->g_pCodeWindow) { - bool using_interp = (startup_params.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER); + bool using_interp = (startup_params.iCPUCore == PowerPC::CORE_INTERPRETER); main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp); } break; diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index fcf42756ca..aa7e65c3b6 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -436,7 +436,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& core_startup_parameter " and stepping to work as explained in the Developer Documentation. But it can be very" " slow, perhaps slower than 1 fps."), wxITEM_CHECK); - interpreter->Check(core_startup_parameter.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER); + interpreter->Check(core_startup_parameter.iCPUCore == PowerPC::CORE_INTERPRETER); pCoreMenu->AppendSeparator(); pCoreMenu->Append(IDM_JIT_NO_BLOCK_LINKING, _("&JIT Block Linking off"),