Merge pull request #4828 from lioncash/state
Core: Convert State enum into an enum class
This commit is contained in:
commit
d022913fb3
|
@ -471,13 +471,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmula
|
|||
jobject obj)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_host_identity_lock);
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_host_identity_lock);
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv* env,
|
||||
|
@ -695,10 +695,10 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling
|
|||
jboolean enable)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(s_host_identity_lock);
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
JitInterface::ClearCache();
|
||||
Profiler::g_ProfileBlocks = enable;
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env,
|
||||
|
|
|
@ -188,7 +188,7 @@ void DisplayMessage(const std::string& message, int time_in_ms)
|
|||
|
||||
bool IsRunning()
|
||||
{
|
||||
return (GetState() != CORE_UNINITIALIZED || s_hardware_initialized) && !s_is_stopping;
|
||||
return (GetState() != State::Uninitialized || s_hardware_initialized) && !s_is_stopping;
|
||||
}
|
||||
|
||||
bool IsRunningAndStarted()
|
||||
|
@ -263,7 +263,7 @@ bool Init()
|
|||
// Called from GUI thread
|
||||
void Stop() // - Hammertime!
|
||||
{
|
||||
if (GetState() == CORE_STOPPING)
|
||||
if (GetState() == State::Stopping)
|
||||
return;
|
||||
|
||||
const SConfig& _CoreParameter = SConfig::GetInstance();
|
||||
|
@ -327,7 +327,7 @@ void UndeclareAsCPUThread()
|
|||
static void CPUSetInitialExecutionState()
|
||||
{
|
||||
QueueHostJob([] {
|
||||
SetState(SConfig::GetInstance().bBootToPause ? CORE_PAUSE : CORE_RUN);
|
||||
SetState(SConfig::GetInstance().bBootToPause ? State::Paused : State::Running);
|
||||
Host_UpdateMainFrame();
|
||||
});
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ static void CpuThread()
|
|||
QueueHostJob([] {
|
||||
// Recheck in case Movie cleared it since.
|
||||
if (!s_state_filename.empty())
|
||||
State::LoadAs(s_state_filename);
|
||||
::State::LoadAs(s_state_filename);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -678,7 +678,7 @@ void EmuThread()
|
|||
|
||||
// Set or get the running state
|
||||
|
||||
void SetState(EState state)
|
||||
void SetState(State state)
|
||||
{
|
||||
// State cannot be controlled until the CPU Thread is operational
|
||||
if (!IsRunningAndStarted())
|
||||
|
@ -686,8 +686,8 @@ void SetState(EState state)
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case CORE_PAUSE:
|
||||
// NOTE: GetState() will return CORE_PAUSE immediately, even before anything has
|
||||
case State::Paused:
|
||||
// NOTE: GetState() will return State::Paused immediately, even before anything has
|
||||
// stopped (including the CPU).
|
||||
CPU::EnableStepping(true); // Break
|
||||
Wiimote::Pause();
|
||||
|
@ -695,7 +695,7 @@ void SetState(EState state)
|
|||
GCAdapter::ResetRumble();
|
||||
#endif
|
||||
break;
|
||||
case CORE_RUN:
|
||||
case State::Running:
|
||||
CPU::EnableStepping(false);
|
||||
Wiimote::Resume();
|
||||
break;
|
||||
|
@ -705,20 +705,20 @@ void SetState(EState state)
|
|||
}
|
||||
}
|
||||
|
||||
EState GetState()
|
||||
State GetState()
|
||||
{
|
||||
if (s_is_stopping)
|
||||
return CORE_STOPPING;
|
||||
return State::Stopping;
|
||||
|
||||
if (s_hardware_initialized)
|
||||
{
|
||||
if (CPU::IsStepping())
|
||||
return CORE_PAUSE;
|
||||
return State::Paused;
|
||||
|
||||
return CORE_RUN;
|
||||
return State::Running;
|
||||
}
|
||||
|
||||
return CORE_UNINITIALIZED;
|
||||
return State::Uninitialized;
|
||||
}
|
||||
|
||||
static std::string GenerateScreenshotFolderPath()
|
||||
|
@ -753,28 +753,28 @@ static std::string GenerateScreenshotName()
|
|||
|
||||
void SaveScreenShot()
|
||||
{
|
||||
const bool bPaused = (GetState() == CORE_PAUSE);
|
||||
const bool bPaused = GetState() == State::Paused;
|
||||
|
||||
SetState(CORE_PAUSE);
|
||||
SetState(State::Paused);
|
||||
|
||||
Renderer::SetScreenshot(GenerateScreenshotName());
|
||||
|
||||
if (!bPaused)
|
||||
SetState(CORE_RUN);
|
||||
SetState(State::Running);
|
||||
}
|
||||
|
||||
void SaveScreenShot(const std::string& name)
|
||||
{
|
||||
const bool bPaused = (GetState() == CORE_PAUSE);
|
||||
const bool bPaused = GetState() == State::Paused;
|
||||
|
||||
SetState(CORE_PAUSE);
|
||||
SetState(State::Paused);
|
||||
|
||||
std::string filePath = GenerateScreenshotFolderPath() + name + ".png";
|
||||
|
||||
Renderer::SetScreenshot(filePath);
|
||||
|
||||
if (!bPaused)
|
||||
SetState(CORE_RUN);
|
||||
SetState(State::Running);
|
||||
}
|
||||
|
||||
void RequestRefreshInfo()
|
||||
|
@ -1015,7 +1015,7 @@ void HostDispatchJobs()
|
|||
|
||||
// NOTE: Memory ordering is important. The booting flag needs to be
|
||||
// checked first because the state transition is:
|
||||
// CORE_UNINITIALIZED: s_is_booting -> s_hardware_initialized
|
||||
// Core::State::Uninitialized: s_is_booting -> s_hardware_initialized
|
||||
// We need to check variables in the same order as the state
|
||||
// transition, otherwise we race and get transient failures.
|
||||
if (!job.run_after_stop && !s_is_booting.IsSet() && !IsRunning())
|
||||
|
|
|
@ -28,12 +28,12 @@ void SetIsThrottlerTempDisabled(bool disable);
|
|||
|
||||
void Callback_VideoCopiedToXFB(bool video_update);
|
||||
|
||||
enum EState
|
||||
enum State
|
||||
{
|
||||
CORE_UNINITIALIZED,
|
||||
CORE_PAUSE,
|
||||
CORE_RUN,
|
||||
CORE_STOPPING
|
||||
Uninitialized,
|
||||
Paused,
|
||||
Running,
|
||||
Stopping
|
||||
};
|
||||
|
||||
bool Init();
|
||||
|
@ -52,8 +52,8 @@ bool IsCPUThread(); // this tells us whether we are the CPU thread
|
|||
bool IsGPUThread();
|
||||
|
||||
// [NOT THREADSAFE] For use by Host only
|
||||
void SetState(EState state);
|
||||
EState GetState();
|
||||
void SetState(State state);
|
||||
State GetState();
|
||||
|
||||
void SaveScreenShot();
|
||||
void SaveScreenShot(const std::string& name);
|
||||
|
|
|
@ -21,7 +21,7 @@ std::string PPCDebugInterface::Disassemble(unsigned int address)
|
|||
if (!IsAlive())
|
||||
return "";
|
||||
|
||||
if (Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
{
|
||||
if (!PowerPC::HostIsRAMAddress(address))
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ unsigned int DSPDebugInterface::ReadInstruction(unsigned int address)
|
|||
|
||||
bool DSPDebugInterface::IsAlive()
|
||||
{
|
||||
return true; // Core::GetState() != Core::CORE_UNINITIALIZED;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DSPDebugInterface::IsBreakpoint(unsigned int address)
|
||||
|
|
|
@ -281,17 +281,17 @@ void SetPolledDevice()
|
|||
// NOTE: Host Thread
|
||||
void DoFrameStep()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
{
|
||||
// if already paused, frame advance for 1 frame
|
||||
s_bFrameStep = true;
|
||||
Core::RequestRefreshInfo();
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
else if (!s_bFrameStep)
|
||||
{
|
||||
// if not paused yet, pause immediately instead
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ void JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock*
|
|||
{
|
||||
if (em_address == 0)
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
WARN_LOG(DYNA_REC, "ERROR: Compiling at 0. LR=%08x CTR=%08x", LR, CTR);
|
||||
}
|
||||
|
||||
|
|
|
@ -135,9 +135,9 @@ void GetProfileResults(ProfileStats* prof_stats)
|
|||
prof_stats->timecost_sum = 0;
|
||||
prof_stats->block_stats.clear();
|
||||
|
||||
Core::EState old_state = Core::GetState();
|
||||
if (old_state == Core::CORE_RUN)
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::State old_state = Core::GetState();
|
||||
if (old_state == Core::State::Running)
|
||||
Core::SetState(Core::State::Paused);
|
||||
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*)&prof_stats->countsPerSec);
|
||||
g_jit->GetBlockCache()->RunOnBlocks([&prof_stats](const JitBlock& block) {
|
||||
|
@ -153,8 +153,8 @@ void GetProfileResults(ProfileStats* prof_stats)
|
|||
});
|
||||
|
||||
sort(prof_stats->block_stats.begin(), prof_stats->block_stats.end());
|
||||
if (old_state == Core::CORE_RUN)
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
if (old_state == Core::State::Running)
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
|
||||
int GetHostCode(u32* address, const u8** code, u32* code_size)
|
||||
|
|
|
@ -140,7 +140,7 @@ void DoState(PointerWrap& p);
|
|||
void ScheduleInvalidateCacheThreadSafe(u32 address);
|
||||
|
||||
CoreMode GetMode();
|
||||
// [NOT THREADSAFE] CPU Thread or CPU::PauseAndLock or CORE_UNINITIALIZED
|
||||
// [NOT THREADSAFE] CPU Thread or CPU::PauseAndLock or Core::State::Uninitialized
|
||||
void SetMode(CoreMode _coreType);
|
||||
const char* GetCPUName();
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void CheckFile(const std::string& file, u64 size)
|
|||
void FindFilename(u64 offset)
|
||||
{
|
||||
// Don't do anything if a game is not running
|
||||
if (Core::GetState() != Core::CORE_RUN)
|
||||
if (Core::GetState() != Core::State::Running)
|
||||
return;
|
||||
|
||||
// Or if the log is unselected
|
||||
|
|
|
@ -150,9 +150,9 @@ void MainWindow::Play()
|
|||
// Otherwise, play the default game.
|
||||
// Otherwise, play the last played game, if there is one.
|
||||
// Otherwise, prompt for a new game.
|
||||
if (Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
{
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
emit EmulationStarted();
|
||||
}
|
||||
else
|
||||
|
@ -183,7 +183,7 @@ void MainWindow::Play()
|
|||
|
||||
void MainWindow::Pause()
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
emit EmulationPaused();
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ void MainWindow::ScreenShot()
|
|||
void MainWindow::StartGame(const QString& path)
|
||||
{
|
||||
// If we're running, only start a new game once we've stopped the last.
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
if (!Stop())
|
||||
return;
|
||||
|
|
|
@ -234,7 +234,7 @@ void CheatSearchTab::OnListViewItemSelected(wxListEvent&)
|
|||
|
||||
void CheatSearchTab::OnTimerUpdate(wxTimerEvent&)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_RUN)
|
||||
if (Core::GetState() != Core::State::Running)
|
||||
return;
|
||||
|
||||
// Only update the currently visible list rows.
|
||||
|
|
|
@ -88,7 +88,7 @@ void ControllerConfigDiag::UpdateUI()
|
|||
m_wiimote_sources[i]->Select(g_wiimote_sources[i]);
|
||||
|
||||
const bool wii_game_started =
|
||||
SConfig::GetInstance().bWii || Core::GetState() == Core::CORE_UNINITIALIZED;
|
||||
SConfig::GetInstance().bWii || Core::GetState() == Core::State::Uninitialized;
|
||||
if (Core::g_want_determinism || !wii_game_started)
|
||||
m_wiimote_sources[i]->Disable();
|
||||
if (!wii_game_started ||
|
||||
|
|
|
@ -457,7 +457,7 @@ void CCodeWindow::UpdateLists()
|
|||
|
||||
void CCodeWindow::UpdateCallstack()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_STOPPING)
|
||||
if (Core::GetState() == Core::State::Stopping)
|
||||
return;
|
||||
|
||||
callstack->Clear();
|
||||
|
|
|
@ -123,17 +123,17 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
|||
switch (event.GetId())
|
||||
{
|
||||
case IDM_PROFILE_BLOCKS:
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
if (g_jit != nullptr)
|
||||
g_jit->ClearCache();
|
||||
Profiler::g_ProfileBlocks = GetParentMenuBar()->IsChecked(IDM_PROFILE_BLOCKS);
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
break;
|
||||
case IDM_WRITE_PROFILE:
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
Core::SetState(Core::State::Paused);
|
||||
|
||||
if (Core::GetState() == Core::CORE_PAUSE && PowerPC::GetMode() == PowerPC::CoreMode::JIT)
|
||||
if (Core::GetState() == Core::State::Paused && PowerPC::GetMode() == PowerPC::CoreMode::JIT)
|
||||
{
|
||||
if (g_jit != nullptr)
|
||||
{
|
||||
|
|
|
@ -164,7 +164,7 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
|
|||
{
|
||||
case SC_SCREENSAVE:
|
||||
case SC_MONITORPOWER:
|
||||
if (Core::GetState() == Core::CORE_RUN && SConfig::GetInstance().bDisableScreenSaver)
|
||||
if (Core::GetState() == Core::State::Running && SConfig::GetInstance().bDisableScreenSaver)
|
||||
break;
|
||||
default:
|
||||
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
||||
|
@ -180,7 +180,7 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
|
|||
|
||||
case WM_USER_SETCURSOR:
|
||||
if (SConfig::GetInstance().bHideCursor && main_frame->RendererHasFocus() &&
|
||||
Core::GetState() == Core::CORE_RUN)
|
||||
Core::GetState() == Core::State::Running)
|
||||
SetCursor(wxCURSOR_BLANK);
|
||||
else
|
||||
SetCursor(wxNullCursor);
|
||||
|
@ -501,7 +501,7 @@ bool CFrame::RendererIsFullscreen()
|
|||
{
|
||||
bool fullscreen = false;
|
||||
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Running || Core::GetState() == Core::State::Paused)
|
||||
{
|
||||
fullscreen = m_RenderFrame->IsFullScreen();
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||
void CFrame::OnActive(wxActivateEvent& event)
|
||||
{
|
||||
m_bRendererHasFocus = (event.GetActive() && event.GetEventObject() == m_RenderFrame);
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Running || Core::GetState() == Core::State::Paused)
|
||||
{
|
||||
if (m_bRendererHasFocus)
|
||||
{
|
||||
|
@ -528,15 +528,15 @@ void CFrame::OnActive(wxActivateEvent& event)
|
|||
else if (RendererIsFullscreen() && g_ActiveConfig.ExclusiveFullscreenEnabled())
|
||||
DoExclusiveFullscreen(true); // Regain exclusive mode
|
||||
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::CORE_PAUSE)
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Paused)
|
||||
DoPause();
|
||||
|
||||
if (SConfig::GetInstance().bHideCursor && Core::GetState() == Core::CORE_RUN)
|
||||
if (SConfig::GetInstance().bHideCursor && Core::GetState() == Core::State::Running)
|
||||
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::CORE_RUN)
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Running)
|
||||
DoPause();
|
||||
|
||||
if (SConfig::GetInstance().bHideCursor)
|
||||
|
@ -550,7 +550,7 @@ void CFrame::OnClose(wxCloseEvent& event)
|
|||
{
|
||||
// Before closing the window we need to shut down the emulation core.
|
||||
// We'll try to close this window again once that is done.
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
DoStop();
|
||||
if (event.CanVeto())
|
||||
|
@ -618,7 +618,7 @@ void CFrame::OnResize(wxSizeEvent& event)
|
|||
|
||||
if (!IsMaximized() && !IsIconized() &&
|
||||
!(SConfig::GetInstance().bRenderToMain && RendererIsFullscreen()) &&
|
||||
!(Core::GetState() != Core::CORE_UNINITIALIZED && SConfig::GetInstance().bRenderToMain &&
|
||||
!(Core::GetState() != Core::State::Uninitialized && SConfig::GetInstance().bRenderToMain &&
|
||||
SConfig::GetInstance().bRenderWindowAutoSize))
|
||||
{
|
||||
SConfig::GetInstance().iWidth = GetSize().GetWidth();
|
||||
|
@ -678,7 +678,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
|||
switch (event.GetId())
|
||||
{
|
||||
case IDM_UPDATE_DISASM_DIALOG: // For breakpoints causing pausing
|
||||
if (!g_pCodeWindow || Core::GetState() != Core::CORE_PAUSE)
|
||||
if (!g_pCodeWindow || Core::GetState() != Core::State::Paused)
|
||||
return;
|
||||
// fallthrough
|
||||
|
||||
|
@ -1202,10 +1202,10 @@ void CFrame::PollHotkeys(wxTimerEvent& event)
|
|||
if (!HotkeyManagerEmu::IsEnabled())
|
||||
return;
|
||||
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED || Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Uninitialized || Core::GetState() == Core::State::Paused)
|
||||
g_controller_interface.UpdateInput();
|
||||
|
||||
if (Core::GetState() != Core::CORE_STOPPING)
|
||||
if (Core::GetState() != Core::State::Stopping)
|
||||
{
|
||||
HotkeyManagerEmu::GetStatus();
|
||||
ParseHotkeys();
|
||||
|
|
|
@ -275,7 +275,7 @@ void CFrame::BootGame(const std::string& filename)
|
|||
std::string bootfile = filename;
|
||||
SConfig& StartUp = SConfig::GetInstance();
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
return;
|
||||
|
||||
// Start filename if non empty.
|
||||
|
@ -322,7 +322,7 @@ void CFrame::BootGame(const std::string& filename)
|
|||
// Open file to boot
|
||||
void CFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() == Core::State::Uninitialized)
|
||||
DoOpen(true);
|
||||
}
|
||||
|
||||
|
@ -431,11 +431,11 @@ void CFrame::OnShowRTCDisplay(wxCommandEvent& WXUNUSED(event))
|
|||
|
||||
void CFrame::OnFrameStep(wxCommandEvent& event)
|
||||
{
|
||||
bool wasPaused = (Core::GetState() == Core::CORE_PAUSE);
|
||||
bool wasPaused = Core::GetState() == Core::State::Paused;
|
||||
|
||||
Movie::DoFrameStep();
|
||||
|
||||
bool isPaused = (Core::GetState() == Core::CORE_PAUSE);
|
||||
bool isPaused = Core::GetState() == Core::State::Paused;
|
||||
if (isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when
|
||||
// pausing next frame
|
||||
UpdateGUI();
|
||||
|
@ -534,7 +534,7 @@ void CFrame::OnRenderParentClose(wxCloseEvent& event)
|
|||
{
|
||||
// Before closing the window we need to shut down the emulation core.
|
||||
// We'll try to close this window again once that is done.
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
DoStop();
|
||||
if (event.CanVeto())
|
||||
|
@ -549,7 +549,7 @@ void CFrame::OnRenderParentClose(wxCloseEvent& event)
|
|||
|
||||
void CFrame::OnRenderParentMove(wxMoveEvent& event)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED && !RendererIsFullscreen() &&
|
||||
if (Core::GetState() != Core::State::Uninitialized && !RendererIsFullscreen() &&
|
||||
!m_RenderFrame->IsMaximized() && !m_RenderFrame->IsIconized())
|
||||
{
|
||||
SConfig::GetInstance().iRenderWindowXPos = m_RenderFrame->GetPosition().x;
|
||||
|
@ -560,7 +560,7 @@ void CFrame::OnRenderParentMove(wxMoveEvent& event)
|
|||
|
||||
void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
int width, height;
|
||||
if (!SConfig::GetInstance().bRenderToMain && !RendererIsFullscreen() &&
|
||||
|
@ -751,16 +751,16 @@ void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED(event))
|
|||
// Pause the emulation
|
||||
void CFrame::DoPause()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
if (SConfig::GetInstance().bHideCursor)
|
||||
m_RenderParent->SetCursor(wxNullCursor);
|
||||
Core::UpdateTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
if (SConfig::GetInstance().bHideCursor && RendererHasFocus())
|
||||
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ void CFrame::DoStop()
|
|||
m_confirmStop = true;
|
||||
|
||||
m_bGameLoading = false;
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED || m_RenderParent != nullptr)
|
||||
if (Core::GetState() != Core::State::Uninitialized || m_RenderParent != nullptr)
|
||||
{
|
||||
#if defined __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
|
@ -793,7 +793,7 @@ void CFrame::DoStop()
|
|||
DoFullscreen(false);
|
||||
|
||||
// Pause the state during confirmation and restore it afterwards
|
||||
Core::EState state = Core::GetState();
|
||||
Core::State state = Core::GetState();
|
||||
|
||||
// Do not pause if netplay is running as CPU thread might be blocked
|
||||
// waiting on inputs
|
||||
|
@ -801,7 +801,7 @@ void CFrame::DoStop()
|
|||
|
||||
if (should_pause)
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
}
|
||||
|
||||
wxMessageDialog m_StopDlg(
|
||||
|
@ -866,7 +866,7 @@ bool CFrame::TriggerSTMPowerEvent()
|
|||
|
||||
Core::DisplayMessage("Shutting down", 30000);
|
||||
// Unpause because gracefully shutting down needs the game to actually request a shutdown
|
||||
if (Core::GetState() == Core::CORE_PAUSE)
|
||||
if (Core::GetState() == Core::State::Paused)
|
||||
DoPause();
|
||||
ProcessorInterface::PowerButton_Tap();
|
||||
m_confirmStop = false;
|
||||
|
@ -943,7 +943,7 @@ void CFrame::OnStopped()
|
|||
|
||||
void CFrame::DoRecordingSave()
|
||||
{
|
||||
bool paused = (Core::GetState() == Core::CORE_PAUSE);
|
||||
bool paused = Core::GetState() == Core::State::Paused;
|
||||
|
||||
if (!paused)
|
||||
DoPause();
|
||||
|
@ -1007,9 +1007,9 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event))
|
|||
|
||||
// check if game is running
|
||||
bool game_running = false;
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
{
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
game_running = true;
|
||||
}
|
||||
|
||||
|
@ -1029,7 +1029,7 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event))
|
|||
// if game isn't running
|
||||
if (game_running)
|
||||
{
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
|
||||
// Update the GUI in case menu accelerators were changed
|
||||
|
@ -1383,9 +1383,9 @@ void CFrame::UpdateGUI()
|
|||
{
|
||||
// Save status
|
||||
bool Initialized = Core::IsRunning();
|
||||
bool Running = Core::GetState() == Core::CORE_RUN;
|
||||
bool Paused = Core::GetState() == Core::CORE_PAUSE;
|
||||
bool Stopping = Core::GetState() == Core::CORE_STOPPING;
|
||||
bool Running = Core::GetState() == Core::State::Running;
|
||||
bool Paused = Core::GetState() == Core::State::Paused;
|
||||
bool Stopping = Core::GetState() == Core::State::Stopping;
|
||||
|
||||
GetToolBar()->Refresh(false);
|
||||
GetMenuBar()->Refresh(false);
|
||||
|
|
|
@ -291,7 +291,7 @@ void CGameListCtrl::ReloadList()
|
|||
{
|
||||
int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
|
||||
// Don't let the user refresh it while a game is running
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
return;
|
||||
|
||||
ScanForISOs();
|
||||
|
|
|
@ -512,7 +512,7 @@ void MainMenuBar::RefreshPlayMenuLabel() const
|
|||
{
|
||||
auto* const item = FindItem(IDM_PLAY);
|
||||
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
item->SetItemLabel(_("&Pause"));
|
||||
else
|
||||
item->SetItemLabel(_("&Play"));
|
||||
|
|
|
@ -261,17 +261,17 @@ class PlatformX11 : public Platform
|
|||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if (key == XK_Escape)
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
{
|
||||
if (SConfig::GetInstance().bHideCursor)
|
||||
XUndefineCursor(dpy, win);
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
Core::SetState(Core::State::Paused);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SConfig::GetInstance().bHideCursor)
|
||||
XDefineCursor(dpy, win, blankCursor);
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
Core::SetState(Core::State::Running);
|
||||
}
|
||||
}
|
||||
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
|
||||
|
@ -304,7 +304,7 @@ class PlatformX11 : public Platform
|
|||
break;
|
||||
case FocusIn:
|
||||
rendererHasFocus = true;
|
||||
if (SConfig::GetInstance().bHideCursor && Core::GetState() != Core::CORE_PAUSE)
|
||||
if (SConfig::GetInstance().bHideCursor && Core::GetState() != Core::State::Paused)
|
||||
XDefineCursor(dpy, win, blankCursor);
|
||||
break;
|
||||
case FocusOut:
|
||||
|
|
|
@ -223,7 +223,7 @@ void MainToolBar::RefreshPlayButton()
|
|||
ToolBarBitmapID bitmap_id;
|
||||
wxString label;
|
||||
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
{
|
||||
bitmap_id = TOOLBAR_PAUSE;
|
||||
label = _("Pause");
|
||||
|
|
|
@ -74,7 +74,7 @@ SoftwareVideoConfigDialog::SoftwareVideoConfigDialog(wxWindow* parent, const std
|
|||
szr_rendering->Add(label_backend, 0, wxALIGN_CENTER_VERTICAL);
|
||||
szr_rendering->Add(choice_backend, 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
label_backend->Disable();
|
||||
choice_backend->Disable();
|
||||
|
|
|
@ -13,12 +13,12 @@ namespace WxEventUtils
|
|||
{
|
||||
void OnEnableIfCoreInitialized(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(Core::GetState() != Core::CORE_UNINITIALIZED);
|
||||
event.Enable(Core::GetState() != Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void OnEnableIfCoreUninitialized(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(Core::GetState() == Core::CORE_UNINITIALIZED);
|
||||
event.Enable(Core::GetState() == Core::State::Uninitialized);
|
||||
}
|
||||
|
||||
void OnEnableIfCoreRunning(wxUpdateUIEvent& event)
|
||||
|
@ -33,14 +33,14 @@ void OnEnableIfCoreNotRunning(wxUpdateUIEvent& event)
|
|||
|
||||
void OnEnableIfCorePaused(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(Core::GetState() == Core::CORE_PAUSE);
|
||||
event.Enable(Core::GetState() == Core::State::Paused);
|
||||
}
|
||||
|
||||
void OnEnableIfCoreRunningOrPaused(wxUpdateUIEvent& event)
|
||||
{
|
||||
const auto state = Core::GetState();
|
||||
|
||||
event.Enable(state == Core::CORE_RUN || state == Core::CORE_PAUSE);
|
||||
event.Enable(state == Core::State::Running || state == Core::State::Paused);
|
||||
}
|
||||
|
||||
void OnEnableIfCPUCanStep(wxUpdateUIEvent& event)
|
||||
|
|
|
@ -158,7 +158,7 @@ void Init()
|
|||
if (s_handle != nullptr)
|
||||
return;
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
if ((CoreTiming::GetTicks() - s_last_init) < SystemTimers::GetTicksPerSecond())
|
||||
return;
|
||||
|
|
|
@ -194,7 +194,7 @@ void Init()
|
|||
if (s_fd)
|
||||
return;
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() != Core::State::Uninitialized)
|
||||
{
|
||||
if ((CoreTiming::GetTicks() - s_last_init) < SystemTimers::GetTicksPerSecond())
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue