mirror of https://github.com/PCSX2/pcsx2.git
VMManager: Add frame advance hotkey
Now that exits are consistent, this is easy.
This commit is contained in:
parent
5ac9419703
commit
25e15a16b1
|
@ -108,6 +108,7 @@ static u32 s_active_game_fixes = 0;
|
||||||
static std::vector<u8> s_widescreen_cheats_data;
|
static std::vector<u8> s_widescreen_cheats_data;
|
||||||
static bool s_widescreen_cheats_loaded = false;
|
static bool s_widescreen_cheats_loaded = false;
|
||||||
static s32 s_current_save_slot = 1;
|
static s32 s_current_save_slot = 1;
|
||||||
|
static u32 s_frame_advance_count = 0;
|
||||||
static u32 s_mxcsr_saved;
|
static u32 s_mxcsr_saved;
|
||||||
|
|
||||||
VMState VMManager::GetState()
|
VMState VMManager::GetState()
|
||||||
|
@ -932,6 +933,15 @@ void VMManager::SetLimiterMode(LimiterModeType type)
|
||||||
GetMTGS().SetVSync(EmuConfig.GetEffectiveVsyncMode());
|
GetMTGS().SetVSync(EmuConfig.GetEffectiveVsyncMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VMManager::FrameAdvance(u32 num_frames /*= 1*/)
|
||||||
|
{
|
||||||
|
if (!HasValidVM())
|
||||||
|
return;
|
||||||
|
|
||||||
|
s_frame_advance_count = num_frames;
|
||||||
|
SetState(VMState::Running);
|
||||||
|
}
|
||||||
|
|
||||||
bool VMManager::ChangeDisc(std::string path)
|
bool VMManager::ChangeDisc(std::string path)
|
||||||
{
|
{
|
||||||
std::string old_path(CDVDsys_GetFile(CDVD_SourceType::Iso));
|
std::string old_path(CDVDsys_GetFile(CDVD_SourceType::Iso));
|
||||||
|
@ -1027,6 +1037,18 @@ void VMManager::Internal::VSyncOnCPUThread()
|
||||||
ApplyLoadedPatches(PPT_CONTINUOUSLY);
|
ApplyLoadedPatches(PPT_CONTINUOUSLY);
|
||||||
ApplyLoadedPatches(PPT_COMBINED_0_1);
|
ApplyLoadedPatches(PPT_COMBINED_0_1);
|
||||||
|
|
||||||
|
// Frame advance must be done *before* pumping messages, because otherwise
|
||||||
|
// we'll immediately reduce the counter we just set.
|
||||||
|
if (s_frame_advance_count > 0)
|
||||||
|
{
|
||||||
|
s_frame_advance_count--;
|
||||||
|
if (s_frame_advance_count == 0)
|
||||||
|
{
|
||||||
|
// auto pause at the end of frame advance
|
||||||
|
SetState(VMState::Paused);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Host::PumpMessagesOnCPUThread();
|
Host::PumpMessagesOnCPUThread();
|
||||||
InputManager::PollSources();
|
InputManager::PollSources();
|
||||||
}
|
}
|
||||||
|
@ -1309,6 +1331,10 @@ DEFINE_HOTKEY("ResetVM", "System", "Reset Virtual Machine", [](bool pressed) {
|
||||||
if (!pressed && VMManager::HasValidVM())
|
if (!pressed && VMManager::HasValidVM())
|
||||||
VMManager::Reset();
|
VMManager::Reset();
|
||||||
})
|
})
|
||||||
|
DEFINE_HOTKEY("FrameAdvance", "System", "Frame Advance", [](bool pressed) {
|
||||||
|
if (!pressed)
|
||||||
|
VMManager::FrameAdvance(1);
|
||||||
|
})
|
||||||
|
|
||||||
DEFINE_HOTKEY("PreviousSaveStateSlot", "Save States", "Select Previous Save Slot", [](bool pressed) {
|
DEFINE_HOTKEY("PreviousSaveStateSlot", "Save States", "Select Previous Save Slot", [](bool pressed) {
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
|
|
|
@ -123,6 +123,9 @@ namespace VMManager
|
||||||
/// Updates the host vsync state, as well as timer frequencies. Call when the speed limiter is adjusted.
|
/// Updates the host vsync state, as well as timer frequencies. Call when the speed limiter is adjusted.
|
||||||
void SetLimiterMode(LimiterModeType type);
|
void SetLimiterMode(LimiterModeType type);
|
||||||
|
|
||||||
|
/// Runs the virtual machine for the specified number of video frames, and then automatically pauses.
|
||||||
|
void FrameAdvance(u32 num_frames = 1);
|
||||||
|
|
||||||
/// Changes the disc in the virtual CD/DVD drive. Passing an empty will remove any current disc.
|
/// Changes the disc in the virtual CD/DVD drive. Passing an empty will remove any current disc.
|
||||||
/// Returns false if the new disc can't be opened.
|
/// Returns false if the new disc can't be opened.
|
||||||
bool ChangeDisc(std::string path);
|
bool ChangeDisc(std::string path);
|
||||||
|
|
Loading…
Reference in New Issue