mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 01:59:52 -06:00
Core: Convert State enum into an enum class
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user