mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
Fix Emulator::IsPaused()
This commit is contained in:
parent
66df38957b
commit
aad5283786
@ -741,7 +741,7 @@ bool gdb_thread::cmd_vcont(gdb_cmd& cmd)
|
||||
}
|
||||
ppu->state -= cpu_flag::dbg_pause;
|
||||
//special case if app didn't start yet (only loaded)
|
||||
if (!Emu.IsPaused() && !Emu.IsRunning()) {
|
||||
if (Emu.IsReady()) {
|
||||
Emu.Run(true);
|
||||
}
|
||||
if (Emu.IsPaused()) {
|
||||
|
@ -1651,7 +1651,9 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
return game_boot_result::invalid_file_or_folder;
|
||||
}
|
||||
|
||||
if ((m_force_boot || g_cfg.misc.autostart) && IsReady())
|
||||
ensure(IsReady());
|
||||
|
||||
if (m_force_boot || g_cfg.misc.autostart)
|
||||
{
|
||||
if (ppu_exec == elf_error::ok)
|
||||
{
|
||||
@ -1684,38 +1686,14 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||
|
||||
m_force_boot = false;
|
||||
}
|
||||
else if (IsPaused())
|
||||
{
|
||||
m_state = system_state::ready;
|
||||
GetCallbacks().on_ready();
|
||||
}
|
||||
|
||||
return game_boot_result::no_errors;
|
||||
}
|
||||
}
|
||||
|
||||
void Emulator::Run(bool start_playtime)
|
||||
{
|
||||
if (!IsReady())
|
||||
{
|
||||
// Reload with prior configuration.
|
||||
Load(m_title_id, false, m_force_global_config);
|
||||
|
||||
if (!IsReady())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsRunning())
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
if (IsPaused())
|
||||
{
|
||||
Resume();
|
||||
return;
|
||||
}
|
||||
ensure(IsReady());
|
||||
|
||||
GetCallbacks().on_run(start_playtime);
|
||||
|
||||
|
@ -16,8 +16,8 @@ enum class video_renderer;
|
||||
enum class system_state : u32
|
||||
{
|
||||
running,
|
||||
paused,
|
||||
stopped,
|
||||
paused,
|
||||
ready,
|
||||
};
|
||||
|
||||
@ -238,7 +238,7 @@ public:
|
||||
void CleanUp();
|
||||
|
||||
bool IsRunning() const { return m_state == system_state::running; }
|
||||
bool IsPaused() const { return m_state == system_state::paused; }
|
||||
bool IsPaused() const { return m_state >= system_state::paused; } // ready is also considered paused by this function
|
||||
bool IsStopped() const { return m_state == system_state::stopped; }
|
||||
bool IsReady() const { return m_state == system_state::ready; }
|
||||
auto GetStatus() const { return m_state.load(); }
|
||||
|
@ -199,16 +199,20 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
|
||||
case Qt::Key_E:
|
||||
if (keyEvent->modifiers() == Qt::ControlModifier && !m_disable_kb_hotkeys)
|
||||
{
|
||||
if (Emu.IsReady())
|
||||
switch (Emu.GetStatus())
|
||||
{
|
||||
case system_state::ready:
|
||||
{
|
||||
Emu.Run(true);
|
||||
return;
|
||||
}
|
||||
else if (Emu.IsPaused())
|
||||
case system_state::paused:
|
||||
{
|
||||
Emu.Resume();
|
||||
return;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::Key_C:
|
||||
|
@ -296,19 +296,12 @@ void main_window::ResizeIcons(int index)
|
||||
|
||||
void main_window::OnPlayOrPause()
|
||||
{
|
||||
if (Emu.IsReady())
|
||||
switch (Emu.GetStatus())
|
||||
{
|
||||
Emu.Run(true);
|
||||
}
|
||||
else if (Emu.IsPaused())
|
||||
{
|
||||
Emu.Resume();
|
||||
}
|
||||
else if (Emu.IsRunning())
|
||||
{
|
||||
Emu.Pause();
|
||||
}
|
||||
else if (Emu.IsStopped())
|
||||
case system_state::ready: Emu.Run(true); return;
|
||||
case system_state::paused: Emu.Resume(); return;
|
||||
case system_state::running: Emu.Pause(); return;
|
||||
case system_state::stopped:
|
||||
{
|
||||
if (m_selected_game)
|
||||
{
|
||||
@ -326,6 +319,10 @@ void main_window::OnPlayOrPause()
|
||||
{
|
||||
BootRecentAction(m_recent_game_acts.first());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
default: fmt::throw_exception("Unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2640,7 +2637,15 @@ void main_window::keyPressEvent(QKeyEvent *keyEvent)
|
||||
{
|
||||
switch (keyEvent->key())
|
||||
{
|
||||
case Qt::Key_E: if (Emu.IsPaused()) Emu.Resume(); else if (Emu.IsReady()) Emu.Run(true); return;
|
||||
case Qt::Key_E:
|
||||
{
|
||||
switch (Emu.GetStatus())
|
||||
{
|
||||
case system_state::paused: Emu.Resume(); return;
|
||||
case system_state::ready: Emu.Run(true); return;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
case Qt::Key_P: if (Emu.IsRunning()) Emu.Pause(); return;
|
||||
case Qt::Key_S: if (!Emu.IsStopped()) Emu.Stop(); return;
|
||||
case Qt::Key_R: if (!Emu.GetBoot().empty()) Emu.Restart(); return;
|
||||
|
Loading…
Reference in New Issue
Block a user