mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
Fix Emulator::IsPaused()
This commit is contained in:
parent
66df38957b
commit
aad5283786
5 changed files with 32 additions and 45 deletions
|
@ -741,7 +741,7 @@ bool gdb_thread::cmd_vcont(gdb_cmd& cmd)
|
||||||
}
|
}
|
||||||
ppu->state -= cpu_flag::dbg_pause;
|
ppu->state -= cpu_flag::dbg_pause;
|
||||||
//special case if app didn't start yet (only loaded)
|
//special case if app didn't start yet (only loaded)
|
||||||
if (!Emu.IsPaused() && !Emu.IsRunning()) {
|
if (Emu.IsReady()) {
|
||||||
Emu.Run(true);
|
Emu.Run(true);
|
||||||
}
|
}
|
||||||
if (Emu.IsPaused()) {
|
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;
|
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)
|
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;
|
m_force_boot = false;
|
||||||
}
|
}
|
||||||
else if (IsPaused())
|
|
||||||
{
|
|
||||||
m_state = system_state::ready;
|
|
||||||
GetCallbacks().on_ready();
|
|
||||||
}
|
|
||||||
return game_boot_result::no_errors;
|
return game_boot_result::no_errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Emulator::Run(bool start_playtime)
|
void Emulator::Run(bool start_playtime)
|
||||||
{
|
{
|
||||||
if (!IsReady())
|
ensure(IsReady());
|
||||||
{
|
|
||||||
// Reload with prior configuration.
|
|
||||||
Load(m_title_id, false, m_force_global_config);
|
|
||||||
|
|
||||||
if (!IsReady())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsRunning())
|
|
||||||
{
|
|
||||||
Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsPaused())
|
|
||||||
{
|
|
||||||
Resume();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetCallbacks().on_run(start_playtime);
|
GetCallbacks().on_run(start_playtime);
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ enum class video_renderer;
|
||||||
enum class system_state : u32
|
enum class system_state : u32
|
||||||
{
|
{
|
||||||
running,
|
running,
|
||||||
paused,
|
|
||||||
stopped,
|
stopped,
|
||||||
|
paused,
|
||||||
ready,
|
ready,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ public:
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
bool IsRunning() const { return m_state == system_state::running; }
|
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 IsStopped() const { return m_state == system_state::stopped; }
|
||||||
bool IsReady() const { return m_state == system_state::ready; }
|
bool IsReady() const { return m_state == system_state::ready; }
|
||||||
auto GetStatus() const { return m_state.load(); }
|
auto GetStatus() const { return m_state.load(); }
|
||||||
|
|
|
@ -199,16 +199,20 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
|
||||||
case Qt::Key_E:
|
case Qt::Key_E:
|
||||||
if (keyEvent->modifiers() == Qt::ControlModifier && !m_disable_kb_hotkeys)
|
if (keyEvent->modifiers() == Qt::ControlModifier && !m_disable_kb_hotkeys)
|
||||||
{
|
{
|
||||||
if (Emu.IsReady())
|
switch (Emu.GetStatus())
|
||||||
|
{
|
||||||
|
case system_state::ready:
|
||||||
{
|
{
|
||||||
Emu.Run(true);
|
Emu.Run(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (Emu.IsPaused())
|
case system_state::paused:
|
||||||
{
|
{
|
||||||
Emu.Resume();
|
Emu.Resume();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::Key_C:
|
case Qt::Key_C:
|
||||||
|
|
|
@ -296,19 +296,12 @@ void main_window::ResizeIcons(int index)
|
||||||
|
|
||||||
void main_window::OnPlayOrPause()
|
void main_window::OnPlayOrPause()
|
||||||
{
|
{
|
||||||
if (Emu.IsReady())
|
switch (Emu.GetStatus())
|
||||||
{
|
{
|
||||||
Emu.Run(true);
|
case system_state::ready: Emu.Run(true); return;
|
||||||
}
|
case system_state::paused: Emu.Resume(); return;
|
||||||
else if (Emu.IsPaused())
|
case system_state::running: Emu.Pause(); return;
|
||||||
{
|
case system_state::stopped:
|
||||||
Emu.Resume();
|
|
||||||
}
|
|
||||||
else if (Emu.IsRunning())
|
|
||||||
{
|
|
||||||
Emu.Pause();
|
|
||||||
}
|
|
||||||
else if (Emu.IsStopped())
|
|
||||||
{
|
{
|
||||||
if (m_selected_game)
|
if (m_selected_game)
|
||||||
{
|
{
|
||||||
|
@ -326,6 +319,10 @@ void main_window::OnPlayOrPause()
|
||||||
{
|
{
|
||||||
BootRecentAction(m_recent_game_acts.first());
|
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())
|
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_P: if (Emu.IsRunning()) Emu.Pause(); return;
|
||||||
case Qt::Key_S: if (!Emu.IsStopped()) Emu.Stop(); return;
|
case Qt::Key_S: if (!Emu.IsStopped()) Emu.Stop(); return;
|
||||||
case Qt::Key_R: if (!Emu.GetBoot().empty()) Emu.Restart(); return;
|
case Qt::Key_R: if (!Emu.GetBoot().empty()) Emu.Restart(); return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue