Merge pull request #1169 from lioncash/cpu-core

Core: Use an enum for indicating CPU cores
This commit is contained in:
skidau 2014-10-14 12:36:02 +11:00
commit ce35cd301b
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); core->Get("HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
#ifdef _M_X86 #ifdef _M_X86
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JIT64);
#elif _M_ARM_32 #elif _M_ARM_32
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_JITARM);
#else #else
core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 0); core->Get("CPUCore", &m_LocalCoreStartupParameter.iCPUCore, SCoreStartupParameter::CORE_INTERPRETER);
#endif #endif
core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true); core->Get("Fastmem", &m_LocalCoreStartupParameter.bFastmem, true);
core->Get("DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false); 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. // See the BootManager.cpp file description for a complete call schedule.
void EmuThread() void EmuThread()
{ {
const SCoreStartupParameter& _CoreParameter = const SCoreStartupParameter& core_parameter =
SConfig::GetInstance().m_LocalCoreStartupParameter; SConfig::GetInstance().m_LocalCoreStartupParameter;
Common::SetCurrentThreadName("Emuthread - Starting"); Common::SetCurrentThreadName("Emuthread - Starting");
DisplayMessage(cpu_info.brand_string, 8000); DisplayMessage(cpu_info.brand_string, 8000);
DisplayMessage(cpu_info.Summarize(), 8000); DisplayMessage(cpu_info.Summarize(), 8000);
DisplayMessage(_CoreParameter.m_strFilename, 3000); DisplayMessage(core_parameter.m_strFilename, 3000);
Movie::Init(); Movie::Init();
@ -348,7 +348,7 @@ void EmuThread()
OSD::AddMessage("Dolphin " + g_video_backend->GetName() + " Video Backend.", 5000); 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(); HW::Shutdown();
g_video_backend->Shutdown(); g_video_backend->Shutdown();
@ -359,7 +359,7 @@ void EmuThread()
Pad::Initialize(s_window_handle); Pad::Initialize(s_window_handle);
// Load and Init Wiimotes - only if we are booting in wii mode // 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()); Wiimote::Initialize(s_window_handle, !s_state_filename.empty());
@ -376,7 +376,7 @@ void EmuThread()
s_hardware_initialized = true; s_hardware_initialized = true;
// Boot to pause or not // 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 // Load GCM/DOL/ELF whatever ... we boot with the interpreter core
PowerPC::SetMode(PowerPC::MODE_INTERPRETER); PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
@ -384,11 +384,15 @@ void EmuThread()
CBoot::BootUp(); CBoot::BootUp();
// Setup our core, but can't use dynarec if we are compare server // Setup our core, but can't use dynarec if we are compare server
if (_CoreParameter.iCPUCore && (!_CoreParameter.bRunCompareServer || if (core_parameter.iCPUCore != SCoreStartupParameter::CORE_INTERPRETER
_CoreParameter.bRunCompareClient)) && (!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient))
{
PowerPC::SetMode(PowerPC::MODE_JIT); PowerPC::SetMode(PowerPC::MODE_JIT);
}
else else
{
PowerPC::SetMode(PowerPC::MODE_INTERPRETER); PowerPC::SetMode(PowerPC::MODE_INTERPRETER);
}
// Update the window again because all stuff is initialized // Update the window again because all stuff is initialized
Host_UpdateDisasmDialog(); Host_UpdateDisasmDialog();
@ -396,13 +400,13 @@ void EmuThread()
// Determine the cpu thread function // Determine the cpu thread function
void (*cpuThreadFunc)(void); void (*cpuThreadFunc)(void);
if (_CoreParameter.m_BootType == SCoreStartupParameter::BOOT_DFF) if (core_parameter.m_BootType == SCoreStartupParameter::BOOT_DFF)
cpuThreadFunc = FifoPlayerThread; cpuThreadFunc = FifoPlayerThread;
else else
cpuThreadFunc = CpuThread; cpuThreadFunc = CpuThread;
// ENTER THE VIDEO THREAD LOOP // ENTER THE VIDEO THREAD LOOP
if (_CoreParameter.bCPUThread) if (core_parameter.bCPUThread)
{ {
// This thread, after creating the EmuWindow, spawns a CPU // This thread, after creating the EmuWindow, spawns a CPU
// thread, and then takes over and becomes the video thread // 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()); INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
if (_CoreParameter.bCPUThread) if (core_parameter.bCPUThread)
g_video_backend->Video_Cleanup(); g_video_backend->Video_Cleanup();
VolumeHandler::EjectVolume(); VolumeHandler::EjectVolume();
@ -479,7 +483,7 @@ void EmuThread()
g_video_backend->Video_ClearMessages(); g_video_backend->Video_ClearMessages();
// Reload sysconf file in order to see changes committed during emulation // Reload sysconf file in order to see changes committed during emulation
if (_CoreParameter.bWii) if (core_parameter.bWii)
SConfig::GetInstance().m_SYSCONF->Reload(); SConfig::GetInstance().m_SYSCONF->Reload();
INFO_LOG(CONSOLE, "Stop [Video Thread]\t\t---- Shutdown complete ----"); INFO_LOG(CONSOLE, "Stop [Video Thread]\t\t---- Shutdown complete ----");

View File

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

View File

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

View File

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

View File

@ -384,7 +384,7 @@ void CCodeWindow::UpdateCallstack()
} }
// Create CPU Mode menus // Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar) void CCodeWindow::CreateMenu(const SCoreStartupParameter& core_startup_parameter, wxMenuBar *pMenuBar)
{ {
// CPU Mode // CPU Mode
wxMenu* pCoreMenu = new wxMenu; 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" " and stepping to work as explained in the Developer Documentation. But it can be very"
" slow, perhaps slower than 1 fps."), " slow, perhaps slower than 1 fps."),
wxITEM_CHECK); wxITEM_CHECK);
interpreter->Check(_LocalCoreStartupParameter.iCPUCore == 0); interpreter->Check(core_startup_parameter.iCPUCore == SCoreStartupParameter::CORE_INTERPRETER);
pCoreMenu->AppendSeparator(); pCoreMenu->AppendSeparator();
pCoreMenu->Append(IDM_JITNOBLOCKLINKING, _("&JIT Block Linking off"), pCoreMenu->Append(IDM_JITNOBLOCKLINKING, _("&JIT Block Linking off"),