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; return true;
} }
bool IsRewinding()
{
return (s_rewind_load_frequency >= 0);
}
void SetRewinding(bool enabled) void SetRewinding(bool enabled)
{ {
if (enabled) if (enabled)

View file

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

View file

@ -2069,9 +2069,13 @@ void CommonHostInterface::SetRewindState(bool enabled)
return; return;
} }
AddOSDMessage(enabled ? TranslateStdString("OSDMessage", "Rewinding...") : if (!m_fullscreen_ui_enabled)
TranslateStdString("OSDMessage", "Stopped rewinding."), {
5.0f); AddOSDMessage(enabled ? TranslateStdString("OSDMessage", "Rewinding...") :
TranslateStdString("OSDMessage", "Stopped rewinding."),
5.0f);
}
System::SetRewinding(enabled); System::SetRewinding(enabled);
UpdateSpeedLimiterState(); 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)); 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); const bool rewinding = System::IsRewinding();
DRAW_LINE(g_large_font, g_large_font->FontSize * 2.0f, margin, IM_COL32(255, 255, 255, 255)); 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) else if (s_show_status_indicators && state == System::State::Paused)