CommonHostInterface: Add onscreen indicator for rewind

This commit is contained in:
Connor McLaughlin 2021-08-07 12:07:04 +10:00
parent 8bea6e1530
commit 50a09384e1
4 changed files with 20 additions and 6 deletions

View file

@ -2368,6 +2368,11 @@ bool LoadRewindState(u32 skip_saves /*= 0*/, bool consume_state /*=true */)
return true;
}
bool IsRewinding()
{
return (s_rewind_load_frequency >= 0);
}
void SetRewinding(bool enabled)
{
if (enabled)

View file

@ -237,6 +237,7 @@ void CalculateRewindMemoryUsage(u32 num_saves, u64* ram_usage, u64* vram_usage);
void ClearMemorySaveStates();
void UpdateMemorySaveStateSettings();
bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true);
bool IsRewinding();
void SetRewinding(bool enabled);
void SetRunaheadReplayFlag();

View file

@ -2069,9 +2069,13 @@ void CommonHostInterface::SetRewindState(bool enabled)
return;
}
AddOSDMessage(enabled ? TranslateStdString("OSDMessage", "Rewinding...") :
TranslateStdString("OSDMessage", "Stopped rewinding."),
5.0f);
if (!m_fullscreen_ui_enabled)
{
AddOSDMessage(enabled ? TranslateStdString("OSDMessage", "Rewinding...") :
TranslateStdString("OSDMessage", "Stopped rewinding."),
5.0f);
}
System::SetRewinding(enabled);
UpdateSpeedLimiterState();
}

View file

@ -3420,10 +3420,14 @@ void DrawStatsOverlay()
DRAW_LINE(g_large_font, g_large_font->FontSize, 0.0f, IM_COL32(255, 255, 255, 255));
}
if (s_show_status_indicators && (s_host_interface->IsFastForwardEnabled() || s_host_interface->IsTurboEnabled()))
if (s_show_status_indicators)
{
text.Assign(ICON_FA_FAST_FORWARD);
DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255));
const bool rewinding = System::IsRewinding();
if (rewinding || s_host_interface->IsFastForwardEnabled() || s_host_interface->IsTurboEnabled())
{
text.Assign(rewinding ? ICON_FA_FAST_BACKWARD : ICON_FA_FAST_FORWARD);
DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255));
}
}
}
else if (s_show_status_indicators && state == System::State::Paused)