Core: Use an enum for indicating CPU cores

This commit is contained in:
Lioncash 2014-09-27 15:54:07 -04:00
parent 81e2cf7490
commit 9f2b48ab07
6 changed files with 40 additions and 28 deletions

View File

@ -499,11 +499,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", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JIT64);
#elif _M_ARM_32
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3);
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JITARM);
#else
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 0);
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_INTERPRETER);
#endif
core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true);
core->Get("DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false);

View File

@ -326,14 +326,14 @@ static void FifoPlayerThread()
// See the BootManager.cpp file description for a complete call schedule.
void EmuThread()
{
const SCoreStartupParameter& _CoreParameter =
const SCoreStartupParameter& core_parameter =
SConfig::GetInstance().m_LocalCoreStartupParameter;
Common::SetCurrentThreadName("Emuthread - Starting");
DisplayMessage(cpu_info.brand_string, 8000);
DisplayMessage(cpu_info.Summarize(), 8000);
DisplayMessage(_CoreParameter.m_strFilename, 3000);
DisplayMessage(core_parameter.m_strFilename, 3000);
Movie::Init();
@ -348,7 +348,7 @@ void EmuThread()
OSD::AddMessage("Dolphin " + g_video_backend->GetName() + " Video Backend.", 5000);
if (!DSP::GetDSPEmulator()->Initialize(_CoreParameter.bWii, _CoreParameter.bDSPThread))
if (!DSP::GetDSPEmulator()->Initialize(core_parameter.bWii, core_parameter.bDSPThread))
{
HW::Shutdown();
g_video_backend->Shutdown();
@ -359,7 +359,7 @@ void EmuThread()
Pad::Initialize(s_window_handle);
// Load and Init Wiimotes - only if we are booting in wii mode
if (_CoreParameter.bWii)
if (core_parameter.bWii)
{
Wiimote::Initialize(s_window_handle, !s_state_filename.empty());
@ -376,7 +376,7 @@ void EmuThread()
s_hardware_initialized = true;
// Boot to pause or not
Core::SetState(_CoreParameter.bBootToPause ? Core::CORE_PAUSE : Core::CORE_RUN);
Core::SetState(core_parameter.bBootToPause ? Core::CORE_PAUSE : Core::CORE_RUN);
// Load GCM/DOL/ELF whatever ... we boot with the interpreter core
PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
@ -384,11 +384,15 @@ 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 (core_parameter.iCPUCore != SCoreStartupParameter::CORE_INTERPRETER
&& (!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient))
{
PowerPC::SetMode(PowerPC::MODE_JIT);
}
else
{
PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
}
// Update the window again because all stuff is initialized
Host_UpdateDisasmDialog();
@ -396,13 +400,13 @@ void EmuThread()
// Determine the cpu thread function
void (*cpuThreadFunc)(void);
if (_CoreParameter.m_BootType == SCoreStartupParameter::BOOT_DFF)
if (core_parameter.m_BootType == SCoreStartupParameter::BOOT_DFF)
cpuThreadFunc = FifoPlayerThread;
else
cpuThreadFunc = CpuThread;
// ENTER THE VIDEO THREAD LOOP
if (_CoreParameter.bCPUThread)
if (core_parameter.bCPUThread)
{
// This thread, after creating the EmuWindow, spawns a CPU
// thread, and then takes over and becomes the video thread
@ -453,7 +457,7 @@ void EmuThread()
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
if (_CoreParameter.bCPUThread)
if (core_parameter.bCPUThread)
g_video_backend->Video_Cleanup();
VolumeHandler::EjectVolume();
@ -479,7 +483,7 @@ void EmuThread()
g_video_backend->Video_ClearMessages();
// Reload sysconf file in order to see changes committed during emulation
if (_CoreParameter.bWii)
if (core_parameter.bWii)
SConfig::GetInstance().m_SYSCONF->Reload();
INFO_LOG(CONSOLE, "Stop [Video Thread]\t\t---- Shutdown complete ----");

View File

@ -65,7 +65,7 @@ void SCoreStartupParameter::LoadDefaults()
iGDBPort = -1;
#endif
iCPUCore = 1;
iCPUCore = CORE_JIT64;
bCPUThread = false;
bSkipIdle = false;
bRunCompareServer = false;

View File

@ -116,10 +116,14 @@ struct SCoreStartupParameter
bool bAutomaticStart;
bool bBootToPause;
// 0 = Interpreter
// 1 = Jit
// 2 = JitIL
// 3 = JIT ARM
enum
{
CORE_INTERPRETER,
CORE_JIT64,
CORE_JITIL64,
CORE_JITARM,
CORE_JITARM64
};
int iCPUCore;
// JIT (shared between JIT and JITIL)

View File

@ -878,32 +878,36 @@ void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event))
// Core settings
void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
{
SCoreStartupParameter& startup_params = SConfig::GetInstance().m_LocalCoreStartupParameter;
switch (event.GetId())
{
// Core - Basic
case ID_CPUTHREAD:
if (Core::IsRunning())
return;
SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked();
startup_params.bCPUThread = CPUThread->IsChecked();
break;
case ID_IDLESKIP:
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked();
startup_params.bSkipIdle = SkipIdle->IsChecked();
break;
case ID_ENABLECHEATS:
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
startup_params.bEnableCheats = EnableCheats->IsChecked();
break;
case ID_FRAMELIMIT:
SConfig::GetInstance().m_Framelimit = Framelimit->GetSelection();
break;
// Core - Advanced
case ID_CPUENGINE:
SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = CPUCores[CPUEngine->GetSelection()].CPUid;
startup_params.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);
{
bool using_interp = (startup_params.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER);
main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, using_interp);
}
break;
case ID_NTSCJ:
SConfig::GetInstance().m_LocalCoreStartupParameter.bForceNTSCJ = _NTSCJ->IsChecked();
startup_params.bForceNTSCJ = _NTSCJ->IsChecked();
break;
}
}

View File

@ -384,7 +384,7 @@ void CCodeWindow::UpdateCallstack()
}
// Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar)
void CCodeWindow::CreateMenu(const SCoreStartupParameter& core_startup_parameter, wxMenuBar *pMenuBar)
{
// CPU Mode
wxMenu* pCoreMenu = new wxMenu;
@ -394,7 +394,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(core_startup_parameter.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER);
pCoreMenu->AppendSeparator();
pCoreMenu->Append(IDM_JITNOBLOCKLINKING, _("&JIT Block Linking off"),