mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
CommonHostInterface: Enable rewind for Android
This commit is contained in:
parent
0000750527
commit
b01d49fa52
|
@ -2010,6 +2010,12 @@ bool CommonHostInterface::AddRumbleToInputMap(const std::string& binding, u32 co
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void DisplayHotkeyBlockedByChallengeModeMessage()
|
||||||
|
{
|
||||||
|
g_host_interface->AddOSDMessage(g_host_interface->TranslateStdString(
|
||||||
|
"OSDMessage", "Hotkey unavailable because achievements hardcore mode is active."));
|
||||||
|
}
|
||||||
|
|
||||||
void CommonHostInterface::SetFastForwardEnabled(bool enabled)
|
void CommonHostInterface::SetFastForwardEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (!System::IsValid())
|
if (!System::IsValid())
|
||||||
|
@ -2034,6 +2040,33 @@ void CommonHostInterface::SetTurboEnabled(bool enabled)
|
||||||
2.0f);
|
2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommonHostInterface::SetRewindState(bool enabled)
|
||||||
|
{
|
||||||
|
if (!System::IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!IsCheevosChallengeModeActive())
|
||||||
|
{
|
||||||
|
if (!g_settings.rewind_enable)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
AddOSDMessage(TranslateStdString("OSDMessage", "Rewinding is not enabled."), 5.0f);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddOSDMessage(enabled ? TranslateStdString("OSDMessage", "Rewinding...") :
|
||||||
|
TranslateStdString("OSDMessage", "Stopped rewinding."),
|
||||||
|
5.0f);
|
||||||
|
System::SetRewinding(enabled);
|
||||||
|
UpdateSpeedLimiterState();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DisplayHotkeyBlockedByChallengeModeMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CommonHostInterface::RegisterHotkeys()
|
void CommonHostInterface::RegisterHotkeys()
|
||||||
{
|
{
|
||||||
RegisterGeneralHotkeys();
|
RegisterGeneralHotkeys();
|
||||||
|
@ -2043,12 +2076,6 @@ void CommonHostInterface::RegisterHotkeys()
|
||||||
RegisterAudioHotkeys();
|
RegisterAudioHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DisplayHotkeyBlockedByChallengeModeMessage()
|
|
||||||
{
|
|
||||||
g_host_interface->AddOSDMessage(g_host_interface->TranslateStdString(
|
|
||||||
"OSDMessage", "Hotkey unavailable because achievements hardcore mode is active."));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CommonHostInterface::RegisterGeneralHotkeys()
|
void CommonHostInterface::RegisterGeneralHotkeys()
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
|
@ -2189,25 +2216,12 @@ void CommonHostInterface::RegisterSystemHotkeys()
|
||||||
DisplayHotkeyBlockedByChallengeModeMessage();
|
DisplayHotkeyBlockedByChallengeModeMessage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("Rewind"),
|
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("Rewind"),
|
||||||
StaticString(TRANSLATABLE("Hotkeys", "Rewind")), [this](bool pressed) {
|
StaticString(TRANSLATABLE("Hotkeys", "Rewind")), [this](bool pressed) { SetRewindState(pressed); });
|
||||||
if (System::IsValid())
|
|
||||||
{
|
|
||||||
if (!IsCheevosChallengeModeActive())
|
|
||||||
{
|
|
||||||
AddOSDMessage(pressed ? TranslateStdString("OSDMessage", "Rewinding...") :
|
|
||||||
TranslateStdString("OSDMessage", "Stopped rewinding."),
|
|
||||||
5.0f);
|
|
||||||
System::SetRewinding(pressed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DisplayHotkeyBlockedByChallengeModeMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
#ifndef __ANDROID__
|
||||||
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("ToggleCheats"),
|
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "System")), StaticString("ToggleCheats"),
|
||||||
StaticString(TRANSLATABLE("Hotkeys", "Toggle Cheats")), [this](bool pressed) {
|
StaticString(TRANSLATABLE("Hotkeys", "Toggle Cheats")), [this](bool pressed) {
|
||||||
if (pressed && System::IsValid())
|
if (pressed && System::IsValid())
|
||||||
|
|
|
@ -334,6 +334,9 @@ public:
|
||||||
bool IsTurboEnabled() const { return m_turbo_enabled; }
|
bool IsTurboEnabled() const { return m_turbo_enabled; }
|
||||||
void SetTurboEnabled(bool enabled);
|
void SetTurboEnabled(bool enabled);
|
||||||
|
|
||||||
|
/// Toggles rewind state.
|
||||||
|
void SetRewindState(bool enabled);
|
||||||
|
|
||||||
/// ImGui window drawing.
|
/// ImGui window drawing.
|
||||||
void DrawFPSWindow();
|
void DrawFPSWindow();
|
||||||
void DrawOSDMessages();
|
void DrawOSDMessages();
|
||||||
|
|
Loading…
Reference in a new issue