mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
HostInterface: Add keys to a bunch of OSD messages
This commit is contained in:
parent
7522304360
commit
928e492963
|
@ -1583,15 +1583,16 @@ void CommonHostInterface::DoToggleCheats()
|
||||||
CheatList* cl = System::GetCheatList();
|
CheatList* cl = System::GetCheatList();
|
||||||
if (!cl)
|
if (!cl)
|
||||||
{
|
{
|
||||||
AddOSDMessage(TranslateStdString("OSDMessage", "No cheats are loaded."), 10.0f);
|
AddKeyedOSDMessage("ToggleCheats", TranslateStdString("OSDMessage", "No cheats are loaded."), 10.0f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl->SetMasterEnable(!cl->GetMasterEnable());
|
cl->SetMasterEnable(!cl->GetMasterEnable());
|
||||||
AddOSDMessage(cl->GetMasterEnable() ?
|
AddKeyedOSDMessage("ToggleCheats",
|
||||||
TranslateStdString("OSDMessage", "%n cheats are now active.", "", cl->GetEnabledCodeCount()) :
|
cl->GetMasterEnable() ?
|
||||||
TranslateStdString("OSDMessage", "%n cheats are now inactive.", "", cl->GetEnabledCodeCount()),
|
TranslateStdString("OSDMessage", "%n cheats are now active.", "", cl->GetEnabledCodeCount()) :
|
||||||
10.0f);
|
TranslateStdString("OSDMessage", "%n cheats are now inactive.", "", cl->GetEnabledCodeCount()),
|
||||||
|
10.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<CommonHostInterface::HostKeyCode>
|
std::optional<CommonHostInterface::HostKeyCode>
|
||||||
|
@ -2233,16 +2234,17 @@ void CommonHostInterface::SetRewindState(bool enabled)
|
||||||
if (!g_settings.rewind_enable)
|
if (!g_settings.rewind_enable)
|
||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
AddOSDMessage(TranslateStdString("OSDMessage", "Rewinding is not enabled."), 5.0f);
|
AddKeyedOSDMessage("SetRewindState", TranslateStdString("OSDMessage", "Rewinding is not enabled."), 5.0f);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_fullscreen_ui_enabled)
|
if (!m_fullscreen_ui_enabled)
|
||||||
{
|
{
|
||||||
AddOSDMessage(enabled ? TranslateStdString("OSDMessage", "Rewinding...") :
|
AddKeyedOSDMessage("SetRewindState",
|
||||||
TranslateStdString("OSDMessage", "Stopped rewinding."),
|
enabled ? TranslateStdString("OSDMessage", "Rewinding...") :
|
||||||
5.0f);
|
TranslateStdString("OSDMessage", "Stopped rewinding."),
|
||||||
|
5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
System::SetRewinding(enabled);
|
System::SetRewinding(enabled);
|
||||||
|
@ -2446,14 +2448,15 @@ void CommonHostInterface::RegisterSystemHotkeys()
|
||||||
const u32 percent = g_settings.GetCPUOverclockPercent();
|
const u32 percent = g_settings.GetCPUOverclockPercent();
|
||||||
const double clock_speed =
|
const double clock_speed =
|
||||||
((static_cast<double>(System::MASTER_CLOCK) * static_cast<double>(percent)) / 100.0) / 1000000.0;
|
((static_cast<double>(System::MASTER_CLOCK) * static_cast<double>(percent)) / 100.0) / 1000000.0;
|
||||||
AddFormattedOSDMessage(5.0f,
|
AddKeyedFormattedOSDMessage(
|
||||||
TranslateString("OSDMessage", "CPU clock speed control enabled (%u%% / %.3f MHz)."),
|
"ToggleOverclocking", 5.0f,
|
||||||
percent, clock_speed);
|
TranslateString("OSDMessage", "CPU clock speed control enabled (%u%% / %.3f MHz)."), percent, clock_speed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddFormattedOSDMessage(5.0f, TranslateString("OSDMessage", "CPU clock speed control disabled (%.3f MHz)."),
|
AddKeyedFormattedOSDMessage("ToggleOverclocking", 5.0f,
|
||||||
static_cast<double>(System::MASTER_CLOCK) / 1000000.0);
|
TranslateString("OSDMessage", "CPU clock speed control disabled (%.3f MHz)."),
|
||||||
|
static_cast<double>(System::MASTER_CLOCK) / 1000000.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2476,10 +2479,11 @@ void CommonHostInterface::RegisterGraphicsHotkeys()
|
||||||
g_gpu->UpdateSettings();
|
g_gpu->UpdateSettings();
|
||||||
g_gpu->ResetGraphicsAPIState();
|
g_gpu->ResetGraphicsAPIState();
|
||||||
System::ClearMemorySaveStates();
|
System::ClearMemorySaveStates();
|
||||||
AddOSDMessage(g_settings.gpu_pgxp_enable ?
|
AddKeyedOSDMessage("TogglePGXP",
|
||||||
TranslateStdString("OSDMessage", "PGXP is now enabled.") :
|
g_settings.gpu_pgxp_enable ?
|
||||||
TranslateStdString("OSDMessage", "PGXP is now disabled."),
|
TranslateStdString("OSDMessage", "PGXP is now enabled.") :
|
||||||
5.0f);
|
TranslateStdString("OSDMessage", "PGXP is now disabled."),
|
||||||
|
5.0f);
|
||||||
|
|
||||||
if (g_settings.gpu_pgxp_enable)
|
if (g_settings.gpu_pgxp_enable)
|
||||||
PGXP::Initialize();
|
PGXP::Initialize();
|
||||||
|
@ -2520,7 +2524,8 @@ void CommonHostInterface::RegisterGraphicsHotkeys()
|
||||||
StaticString(TRANSLATABLE("Hotkeys", "Reload Texture Replacements")), [this](bool pressed) {
|
StaticString(TRANSLATABLE("Hotkeys", "Reload Texture Replacements")), [this](bool pressed) {
|
||||||
if (pressed && System::IsValid())
|
if (pressed && System::IsValid())
|
||||||
{
|
{
|
||||||
AddOSDMessage(TranslateStdString("OSDMessage", "Texture replacements reloaded."), 10.0f);
|
AddKeyedOSDMessage("ReloadTextureReplacements",
|
||||||
|
TranslateStdString("OSDMessage", "Texture replacements reloaded."), 10.0f);
|
||||||
g_texture_replacements.Reload();
|
g_texture_replacements.Reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2545,10 +2550,11 @@ void CommonHostInterface::RegisterGraphicsHotkeys()
|
||||||
g_gpu->UpdateSettings();
|
g_gpu->UpdateSettings();
|
||||||
g_gpu->ResetGraphicsAPIState();
|
g_gpu->ResetGraphicsAPIState();
|
||||||
System::ClearMemorySaveStates();
|
System::ClearMemorySaveStates();
|
||||||
AddOSDMessage(g_settings.gpu_pgxp_depth_buffer ?
|
AddKeyedOSDMessage("TogglePGXPDepth",
|
||||||
TranslateStdString("OSDMessage", "PGXP Depth Buffer is now enabled.") :
|
g_settings.gpu_pgxp_depth_buffer ?
|
||||||
TranslateStdString("OSDMessage", "PGXP Depth Buffer is now disabled."),
|
TranslateStdString("OSDMessage", "PGXP Depth Buffer is now enabled.") :
|
||||||
5.0f);
|
TranslateStdString("OSDMessage", "PGXP Depth Buffer is now disabled."),
|
||||||
|
5.0f);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2708,9 +2714,15 @@ void CommonHostInterface::RegisterAudioHotkeys()
|
||||||
const s32 volume = GetAudioOutputVolume();
|
const s32 volume = GetAudioOutputVolume();
|
||||||
m_audio_stream->SetOutputVolume(volume);
|
m_audio_stream->SetOutputVolume(volume);
|
||||||
if (g_settings.audio_output_muted)
|
if (g_settings.audio_output_muted)
|
||||||
AddOSDMessage(TranslateStdString("OSDMessage", "Volume: Muted"), 2.0f);
|
{
|
||||||
|
AddKeyedOSDMessage("AudioControlHotkey", TranslateStdString("OSDMessage", "Volume: Muted"),
|
||||||
|
2.0f);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
AddFormattedOSDMessage(2.0f, TranslateString("OSDMessage", "Volume: %d%%"), volume);
|
{
|
||||||
|
AddKeyedFormattedOSDMessage("AudioControlHotkey", 2.0f,
|
||||||
|
TranslateString("OSDMessage", "Volume: %d%%"), volume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "Audio")), StaticString("AudioCDAudioMute"),
|
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "Audio")), StaticString("AudioCDAudioMute"),
|
||||||
|
@ -2718,10 +2730,11 @@ void CommonHostInterface::RegisterAudioHotkeys()
|
||||||
if (pressed && System::IsValid())
|
if (pressed && System::IsValid())
|
||||||
{
|
{
|
||||||
g_settings.cdrom_mute_cd_audio = !g_settings.cdrom_mute_cd_audio;
|
g_settings.cdrom_mute_cd_audio = !g_settings.cdrom_mute_cd_audio;
|
||||||
AddOSDMessage(g_settings.cdrom_mute_cd_audio ?
|
AddKeyedOSDMessage("AudioControlHotkey",
|
||||||
TranslateStdString("OSDMessage", "CD Audio Muted.") :
|
g_settings.cdrom_mute_cd_audio ?
|
||||||
TranslateStdString("OSDMessage", "CD Audio Unmuted."),
|
TranslateStdString("OSDMessage", "CD Audio Muted.") :
|
||||||
2.0f);
|
TranslateStdString("OSDMessage", "CD Audio Unmuted."),
|
||||||
|
2.0f);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "Audio")), StaticString("AudioVolumeUp"),
|
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "Audio")), StaticString("AudioVolumeUp"),
|
||||||
|
@ -2734,7 +2747,8 @@ void CommonHostInterface::RegisterAudioHotkeys()
|
||||||
g_settings.audio_output_volume = volume;
|
g_settings.audio_output_volume = volume;
|
||||||
g_settings.audio_fast_forward_volume = volume;
|
g_settings.audio_fast_forward_volume = volume;
|
||||||
m_audio_stream->SetOutputVolume(volume);
|
m_audio_stream->SetOutputVolume(volume);
|
||||||
AddFormattedOSDMessage(2.0f, TranslateString("OSDMessage", "Volume: %d%%"), volume);
|
AddKeyedFormattedOSDMessage("AudioControlHotkey", 2.0f,
|
||||||
|
TranslateString("OSDMessage", "Volume: %d%%"), volume);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "Audio")), StaticString("AudioVolumeDown"),
|
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "Audio")), StaticString("AudioVolumeDown"),
|
||||||
|
@ -2747,7 +2761,8 @@ void CommonHostInterface::RegisterAudioHotkeys()
|
||||||
g_settings.audio_output_volume = volume;
|
g_settings.audio_output_volume = volume;
|
||||||
g_settings.audio_fast_forward_volume = volume;
|
g_settings.audio_fast_forward_volume = volume;
|
||||||
m_audio_stream->SetOutputVolume(volume);
|
m_audio_stream->SetOutputVolume(volume);
|
||||||
AddFormattedOSDMessage(2.0f, TranslateString("OSDMessage", "Volume: %d%%"), volume);
|
AddKeyedFormattedOSDMessage("AudioControlHotkey", 2.0f,
|
||||||
|
TranslateString("OSDMessage", "Volume: %d%%"), volume);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue