From 20a16beabd751583dbb8491c20b4c3f0d0d1359c Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Fri, 13 Jun 2014 20:27:05 +0200 Subject: [PATCH 1/3] enum CPUState: rename CPU_* to STATE_* --- Source/Core/AudioCommon/Mixer.cpp | 4 ++-- Source/Core/Core/Core.cpp | 4 ++-- Source/Core/Core/Debugger/PPCDebugInterface.cpp | 3 ++- Source/Core/Core/FifoPlayer/FifoPlayer.cpp | 4 ++-- Source/Core/Core/HW/CPU.cpp | 14 +++++++------- Source/Core/Core/Movie.cpp | 4 ++-- Source/Core/Core/PowerPC/Jit64/Jit.cpp | 4 ++-- Source/Core/Core/PowerPC/Jit64/JitAsm.cpp | 2 +- Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp | 4 ++-- Source/Core/Core/PowerPC/PowerPC.cpp | 14 +++++++------- Source/Core/Core/PowerPC/PowerPC.h | 6 +++--- Source/Core/DolphinWX/MainAndroid.cpp | 2 +- Source/Core/DolphinWX/MainNoGUI.cpp | 2 +- 13 files changed, 34 insertions(+), 33 deletions(-) diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 388eb56b0d..6b11d31722 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -113,7 +113,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int num_samples, bool consider memset(samples, 0, num_samples * 2 * sizeof(short)); - if (PowerPC::GetState() != PowerPC::CPU_RUNNING) + if (PowerPC::GetState() != PowerPC::STATE_RUNNING) { // Silence return num_samples; @@ -138,7 +138,7 @@ void CMixer::MixerFifo::PushSamples(const short *samples, unsigned int num_sampl // The auto throttle function. This loop will put a ceiling on the CPU MHz. while (num_samples * 2 + ((indexW - Common::AtomicLoad(m_indexR)) & INDEX_MASK) >= MAX_SAMPLES * 2) { - if (*PowerPC::GetStatePtr() != PowerPC::CPU_RUNNING || soundStream->IsMuted()) + if (*PowerPC::GetStatePtr() != PowerPC::STATE_RUNNING || soundStream->IsMuted()) break; // Shortcut key for Throttle Skipping if (Core::GetIsFramelimiterTempDisabled()) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 3fffedb7fb..9e3c1ec808 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -226,7 +226,7 @@ bool Init() // Called from GUI thread void Stop() // - Hammertime! { - if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) + if (PowerPC::GetState() == PowerPC::STATE_POWERDOWN) { if (g_EmuThread.joinable()) g_EmuThread.join(); @@ -471,7 +471,7 @@ void EmuThread() // Spawn the CPU+GPU thread g_cpu_thread = std::thread(cpuThreadFunc); - while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) + while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN) { g_video_backend->PeekMessages(); Common::SleepCurrentThread(20); diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Debugger/PPCDebugInterface.cpp index d07d49c097..f605d618e4 100644 --- a/Source/Core/Core/Debugger/PPCDebugInterface.cpp +++ b/Source/Core/Core/Debugger/PPCDebugInterface.cpp @@ -18,7 +18,8 @@ void PPCDebugInterface::Disassemble(unsigned int address, char *dest, int max_size) { // Memory::ReadUnchecked_U32 seemed to crash on shutdown - if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return; + if (PowerPC::GetState() == PowerPC::STATE_POWERDOWN) + return; if (Core::GetState() != Core::CORE_UNINITIALIZED) { diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index 96fada80b0..1397a0217b 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -64,9 +64,9 @@ bool FifoPlayer::Play() LoadMemory(); // This loop replaces the CPU loop that occurs when a game is run - while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) + while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN) { - if (PowerPC::GetState() == PowerPC::CPU_RUNNING) + if (PowerPC::GetState() == PowerPC::STATE_RUNNING) { if (m_CurrentFrame >= m_FrameRangeEnd) { diff --git a/Source/Core/Core/HW/CPU.cpp b/Source/Core/Core/HW/CPU.cpp index 820617eb33..4e45ab4a00 100644 --- a/Source/Core/Core/HW/CPU.cpp +++ b/Source/Core/Core/HW/CPU.cpp @@ -47,21 +47,21 @@ void CCPU::Run() reswitch: switch (PowerPC::GetState()) { - case PowerPC::CPU_RUNNING: + case PowerPC::STATE_RUNNING: //1: enter a fast runloop PowerPC::RunLoop(); break; - case PowerPC::CPU_STEPPING: + case PowerPC::STATE_STEPPING: m_csCpuOccupied.unlock(); //1: wait for step command.. m_StepEvent.Wait(); m_csCpuOccupied.lock(); - if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) + if (PowerPC::GetState() == PowerPC::STATE_POWERDOWN) return; - if (PowerPC::GetState() != PowerPC::CPU_STEPPING) + if (PowerPC::GetState() != PowerPC::STATE_STEPPING) goto reswitch; //3: do a step @@ -76,7 +76,7 @@ reswitch: Host_UpdateDisasmDialog(); break; - case PowerPC::CPU_POWERDOWN: + case PowerPC::STATE_POWERDOWN: //1: Exit loop!! return; } @@ -91,7 +91,7 @@ void CCPU::Stop() bool CCPU::IsStepping() { - return PowerPC::GetState() == PowerPC::CPU_STEPPING; + return PowerPC::GetState() == PowerPC::STATE_STEPPING; } void CCPU::Reset() @@ -102,7 +102,7 @@ void CCPU::Reset() void CCPU::StepOpcode(Common::Event *event) { m_StepEvent.Set(); - if (PowerPC::GetState() == PowerPC::CPU_STEPPING) + if (PowerPC::GetState() == PowerPC::STATE_STEPPING) { m_SyncEvent = event; } diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index bc960ef832..98d8c41e9f 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -143,9 +143,9 @@ void FrameUpdate() } // ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily. - // after that we set it back to CPU_RUNNING and continue as normal. + // after that we set it back to STATE_RUNNING and continue as normal. if (g_bFrameStop) - *PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING; + *PowerPC::GetStatePtr() = PowerPC::STATE_STEPPING; if (g_framesToSkip) FrameSkipping(); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 7dac00d435..d7d6ecacc4 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -409,7 +409,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc // Comment out the following to disable breakpoints (speed-up) if (!Profiler::g_ProfileBlocks) { - if (GetState() == CPU_STEPPING) + if (GetState() == STATE_STEPPING) blockSize = 1; Trace(); } @@ -583,7 +583,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc SetJumpTarget(clearInt); } - if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING) + if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != STATE_STEPPING) { gpr.Flush(); fpr.Flush(); diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp index 742837527a..384505acce 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp @@ -54,7 +54,7 @@ void Jit64AsmRoutineManager::Generate() if (Core::g_CoreStartupParameter.bEnableDebugging) { - TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(PowerPC::CPU_STEPPING)); + TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(PowerPC::STATE_STEPPING)); FixupBranch notStepping = J_CC(CC_Z); ABI_CallFunction(reinterpret_cast(&PowerPC::CheckBreakPoints)); TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF)); diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index 8c58ae6418..8627b12630 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -508,7 +508,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc // Comment out the following to disable breakpoints (speed-up) if (!Profiler::g_ProfileBlocks) { - if (GetState() == CPU_STEPPING) + if (GetState() == STATE_STEPPING) blockSize = 1; Trace(); } @@ -642,7 +642,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc ibuild.EmitExtExceptionCheck(ibuild.EmitIntConst(ops[i].address)); } - if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING) + if (Core::g_CoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != STATE_STEPPING) { ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address)); } diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index db4e755de4..22182104aa 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -30,7 +30,7 @@ namespace PowerPC // STATE_TO_SAVE PowerPCState GC_ALIGNED16(ppcState); -volatile CPUState state = CPU_STEPPING; +volatile CPUState state = STATE_STEPPING; Interpreter * const interpreter = Interpreter::getInstance(); CoreMode mode; @@ -158,7 +158,7 @@ void Init(int cpu_core) { mode = MODE_INTERPRETER; } - state = CPU_STEPPING; + state = STATE_STEPPING; ppcState.iCache.Init(); } @@ -168,7 +168,7 @@ void Shutdown() JitInterface::Shutdown(); interpreter->Shutdown(); cpu_core_base = nullptr; - state = CPU_POWERDOWN; + state = STATE_POWERDOWN; } CoreMode GetMode() @@ -205,7 +205,7 @@ void SingleStep() void RunLoop() { - state = CPU_RUNNING; + state = STATE_RUNNING; cpu_core_base->Run(); Host_UpdateDisasmDialog(); } @@ -222,19 +222,19 @@ volatile CPUState *GetStatePtr() void Start() { - state = CPU_RUNNING; + state = STATE_RUNNING; Host_UpdateDisasmDialog(); } void Pause() { - state = CPU_STEPPING; + state = STATE_STEPPING; Host_UpdateDisasmDialog(); } void Stop() { - state = CPU_POWERDOWN; + state = STATE_POWERDOWN; Host_UpdateDisasmDialog(); } diff --git a/Source/Core/Core/PowerPC/PowerPC.h b/Source/Core/Core/PowerPC/PowerPC.h index 107c63da95..c3b5a265b5 100644 --- a/Source/Core/Core/PowerPC/PowerPC.h +++ b/Source/Core/Core/PowerPC/PowerPC.h @@ -75,9 +75,9 @@ struct GC_ALIGNED64(PowerPCState) enum CPUState { - CPU_RUNNING = 0, - CPU_STEPPING = 2, - CPU_POWERDOWN = 3, + STATE_RUNNING = 0, + STATE_STEPPING = 2, + STATE_POWERDOWN = 3, }; extern PowerPCState ppcState; diff --git a/Source/Core/DolphinWX/MainAndroid.cpp b/Source/Core/DolphinWX/MainAndroid.cpp index a5cde56e91..31bf4fd824 100644 --- a/Source/Core/DolphinWX/MainAndroid.cpp +++ b/Source/Core/DolphinWX/MainAndroid.cpp @@ -370,7 +370,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv * // No use running the loop when booting fails if ( BootManager::BootCore( g_filename.c_str() ) ) - while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) + while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN) updateMainFrameEvent.Wait(); WiimoteReal::Shutdown(); diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index d4b75d83cb..1955dbf6f2 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -380,7 +380,7 @@ int main(int argc, char* argv[]) [event release]; [pool release]; #else - while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) + while (PowerPC::GetState() != PowerPC::STATE_POWERDOWN) updateMainFrameEvent.Wait(); #endif } From 311e9e655a6816aa7f51e29f5a89e68d10096252 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 28 Apr 2014 21:00:35 +0200 Subject: [PATCH 2/3] CoreParameter: add enum CPUBackend --- Source/Core/Core/BootManager.cpp | 5 +++-- Source/Core/Core/ConfigManager.cpp | 6 +++--- Source/Core/Core/Core.cpp | 9 +++++++-- Source/Core/Core/CoreParameter.cpp | 2 +- Source/Core/Core/CoreParameter.h | 15 ++++++++++----- Source/Core/Core/Movie.cpp | 4 ++-- Source/Core/Core/Movie.h | 6 +++--- Source/Core/Core/NetPlayClient.cpp | 2 +- Source/Core/Core/NetPlayProto.h | 6 +++--- Source/Core/Core/NetPlayServer.cpp | 2 +- Source/Core/Core/PowerPC/PowerPC.cpp | 2 +- Source/Core/DolphinWX/ConfigMain.cpp | 15 ++++++++------- Source/Core/DolphinWX/Debugger/CodeWindow.cpp | 2 +- 13 files changed, 44 insertions(+), 32 deletions(-) diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 7bf601afbf..ee78f0b17f 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -49,7 +49,8 @@ struct ConfigCache { bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread, bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bTLBHack, bProgressive; - int iCPUCore, Volume; + CPUBackend iCPUCore; + int Volume; int iWiimoteSource[MAX_BBMOTES]; SIDevices Pads[MAX_SI_CHANNELS]; unsigned int framelimit, frameSkip; @@ -154,7 +155,7 @@ bool BootCore(const std::string& _rFilename) core_section->Get("DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE); core_section->Get("DSPThread", &StartUp.bDSPThread, StartUp.bDSPThread); core_section->Get("GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend); - core_section->Get("CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore); + core_section->Get("CPUCore", (int*)&StartUp.iCPUCore, StartUp.iCPUCore); core_section->Get("HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2); core_section->Get("ProgressiveScan", &StartUp.bProgressive, StartUp.bProgressive); if (core_section->Get("FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit)) diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 727b1b1f91..03ae5c1079 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -479,11 +479,11 @@ void SConfig::LoadCoreSettings(IniFile& ini) core->Get("HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); #ifdef _M_X86 - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1); + core->Get("CPUCore", (int*)&m_LocalCoreStartupParameter.iCPUCore, CPU_JIT_X64); #elif _M_ARM_32 - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3); + core->Get("CPUCore", (int*)&m_LocalCoreStartupParameter.iCPUCore, CPU_JIT_ARM); #else - core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 0); + core->Get("CPUCore", (int*)&m_LocalCoreStartupParameter.iCPUCore, CPU_INTERPRETER); #endif core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true); core->Get("DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false); diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 9e3c1ec808..71291312a6 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -424,11 +424,16 @@ void EmuThread() CBoot::BootUp(); // Setup our core, but can't use dynarec if we are compare server - if (_CoreParameter.iCPUCore && (!_CoreParameter.bRunCompareServer || - _CoreParameter.bRunCompareClient)) + if (_CoreParameter.iCPUCore != CPU_INTERPRETER && + (!_CoreParameter.bRunCompareServer || + _CoreParameter.bRunCompareClient)) + { PowerPC::SetMode(PowerPC::MODE_JIT); + } else + { PowerPC::SetMode(PowerPC::MODE_INTERPRETER); + } // Update the window again because all stuff is initialized Host_UpdateDisasmDialog(); diff --git a/Source/Core/Core/CoreParameter.cpp b/Source/Core/Core/CoreParameter.cpp index 5a213b5e92..10839f5e26 100644 --- a/Source/Core/Core/CoreParameter.cpp +++ b/Source/Core/Core/CoreParameter.cpp @@ -65,7 +65,7 @@ void SCoreStartupParameter::LoadDefaults() iGDBPort = -1; #endif - iCPUCore = 1; + iCPUCore = CPU_JIT_X64; bCPUThread = false; bSkipIdle = false; bRunCompareServer = false; diff --git a/Source/Core/Core/CoreParameter.h b/Source/Core/Core/CoreParameter.h index 46ec3976fe..adca9de5bc 100644 --- a/Source/Core/Core/CoreParameter.h +++ b/Source/Core/Core/CoreParameter.h @@ -83,6 +83,15 @@ enum Hotkey NUM_HOTKEYS, }; +enum CPUBackend : u8 +{ + CPU_INTERPRETER = 0, + CPU_JIT_X64 = 1, + CPU_JIT_IL_X64 = 2, + CPU_JIT_ARM = 3, + CPU_JIT_IL_ARM = 4, +}; + struct SCoreStartupParameter { void* hInstance; // HINSTANCE but we don't want to include @@ -95,11 +104,7 @@ struct SCoreStartupParameter bool bAutomaticStart; bool bBootToPause; - // 0 = Interpreter - // 1 = Jit - // 2 = JitIL - // 3 = JIT ARM - int iCPUCore; + CPUBackend iCPUCore; // JIT (shared between JIT and JITIL) bool bJITNoBlockCache, bJITBlockLinking; diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 98d8c41e9f..9eb6258d44 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -61,7 +61,7 @@ u64 g_recordingStartTime; // seconds since 1970 that recording started bool bSaveConfig = false, bSkipIdle = false, bDualCore = false, bProgressive = false, bDSPHLE = false, bFastDiscSpeed = false; bool g_bClearSave = false, bSyncGPU = false, bNetPlay = false; std::string videoBackend = "unknown"; -int iCPUCore = 1; +CPUBackend iCPUCore = CPU_JIT_X64; bool g_bDiscChange = false; std::string g_discChange = ""; std::string author = ""; @@ -356,7 +356,7 @@ bool IsFastDiscSpeed() return bFastDiscSpeed; } -int GetCPUMode() +CPUBackend GetCPUMode() { return iCPUCore; } diff --git a/Source/Core/Core/Movie.h b/Source/Core/Core/Movie.h index c2177e4afa..62dc9bdfff 100644 --- a/Source/Core/Core/Movie.h +++ b/Source/Core/Core/Movie.h @@ -8,7 +8,7 @@ #include "Common/ChunkFile.h" #include "Common/Common.h" - +#include "Core/CoreParameter.h" #include "InputCommon/GCPadStatus.h" namespace WiimoteEmu @@ -99,7 +99,7 @@ struct DTMHeader bool bProgressive; bool bDSPHLE; bool bFastDiscSpeed; - u8 CPUCore; // 0 = interpreter, 1 = JIT, 2 = JITIL + CPUBackend CPUCore; bool bEFBAccessEnable; bool bEFBCopyEnable; bool bCopyEFBToTexture; @@ -144,7 +144,7 @@ bool IsProgressive(); bool IsSkipIdle(); bool IsDSPHLE(); bool IsFastDiscSpeed(); -int GetCPUMode(); +CPUBackend GetCPUMode(); bool IsStartingFromClearSave(); bool IsUsingMemcard(int memcard); bool IsSyncGPU(); diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index f15837116d..83f9adb08a 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -266,7 +266,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet) std::lock_guard lkg(m_crit.game); packet >> m_current_game; packet >> g_NetPlaySettings.m_CPUthread; - packet >> g_NetPlaySettings.m_CPUcore; + packet >> (u8&)g_NetPlaySettings.m_CPUcore; packet >> g_NetPlaySettings.m_DSPEnableJIT; packet >> g_NetPlaySettings.m_DSPHLE; packet >> g_NetPlaySettings.m_WriteToMemcard; diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index 14eb998f68..3a9982b6ec 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -6,13 +6,13 @@ #include "Common/Common.h" #include "Common/CommonTypes.h" - +#include "Core/CoreParameter.h" #include "Core/HW/EXI_Device.h" struct NetSettings { bool m_CPUthread; - int m_CPUcore; + CPUBackend m_CPUcore; bool m_DSPHLE; bool m_DSPEnableJIT; bool m_WriteToMemcard; @@ -28,7 +28,7 @@ struct Rpt : public std::vector typedef std::vector NetWiimote; -#define NETPLAY_VERSION "Dolphin NetPlay 2014-01-08" +#define NETPLAY_VERSION "Dolphin NetPlay 2014-06-13" const int NETPLAY_INITIAL_GCTIME = 1272737767; diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 7d153a1a00..8658f9714a 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -548,7 +548,7 @@ bool NetPlayServer::StartGame(const std::string &path) spac << (MessageId)NP_MSG_START_GAME; spac << m_current_game; spac << m_settings.m_CPUthread; - spac << m_settings.m_CPUcore; + spac << (u8)m_settings.m_CPUcore; spac << m_settings.m_DSPEnableJIT; spac << m_settings.m_DSPHLE; spac << m_settings.m_WriteToMemcard; diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index 22182104aa..6b03f4bd04 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -135,7 +135,7 @@ void Init(int cpu_core) switch (cpu_core) { - case 0: + case CPU_INTERPRETER: { cpu_core_base = interpreter; break; diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index c74400a73f..47beeb8d0a 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -32,6 +32,7 @@ #include "Core/ConfigManager.h" #include "Core/Core.h" +#include "Core/CoreParameter.h" #include "Core/Movie.h" #include "Core/NetPlayProto.h" #include "Core/HW/EXI.h" @@ -57,17 +58,17 @@ struct CPUCore { - int CPUid; + CPUBackend CPUid; const char *name; }; const CPUCore CPUCores[] = { - {0, wxTRANSLATE("Interpreter (VERY slow)")}, + {CPU_INTERPRETER, wxTRANSLATE("Interpreter (VERY slow)")}, #ifdef _M_ARM - {3, wxTRANSLATE("Arm JIT (experimental)")}, - {4, wxTRANSLATE("Arm JITIL (experimental)")}, + {CPU_JIT_ARM, wxTRANSLATE("Arm JIT (experimental)")}, + {CPU_JIT_IL_ARM, wxTRANSLATE("Arm JITIL (experimental)")}, #else - {1, wxTRANSLATE("JIT Recompiler (recommended)")}, - {2, wxTRANSLATE("JITIL Recompiler (slower, experimental)")}, + {CPU_JIT_X64, wxTRANSLATE("JIT Recompiler (recommended)")}, + {CPU_JIT_IL_X64, wxTRANSLATE("JITIL Recompiler (slower, experimental)")}, #endif }; @@ -907,7 +908,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = CPUCores[CPUEngine->GetSelection()].CPUid; if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, - SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore?false:true); + SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore == CPU_INTERPRETER); break; case ID_NTSCJ: SConfig::GetInstance().m_LocalCoreStartupParameter.bForceNTSCJ = _NTSCJ->IsChecked(); diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp index b8185a85cc..234f798aa5 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp @@ -369,7 +369,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam " 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(_LocalCoreStartupParameter.iCPUCore == 0); + interpreter->Check(_LocalCoreStartupParameter.iCPUCore == CPU_INTERPRETER); pCoreMenu->AppendSeparator(); pCoreMenu->Append(IDM_JITBLOCKLINKING, _("&JIT Block Linking off"), From ad2aaedd8b32f1d7f869ac530268bd59c9da87c6 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Thu, 19 Jun 2014 16:40:08 +0200 Subject: [PATCH 3/3] Don't install segfault handler in interpreter mode --- Source/Core/Core/Core.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 71291312a6..a37618c9ec 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -299,7 +299,8 @@ void CpuThread() } #if _M_X86_64 || _M_ARM_32 - if (_CoreParameter.bFastmem) + // No need to install the segfault handler when using the interpreter backend. + if (_CoreParameter.bFastmem && _CoreParameter.iCPUCore != CPU_INTERPRETER) EMM::InstallExceptionHandler(); // Let's run under memory watch #endif