mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
CommonHostInterface: Add post processing toggle hotkeys
This commit is contained in:
parent
441f26706e
commit
9c28b3e167
|
@ -1439,6 +1439,12 @@ void CommonHostInterface::RegisterGraphicsHotkeys()
|
|||
ModifyResolutionScale(-1);
|
||||
});
|
||||
|
||||
RegisterHotkey(StaticString("Graphics"), StaticString("TogglePostProcessing"),
|
||||
StaticString(TRANSLATABLE("Hotkeys", "Toggle Post-Processing")), [this](bool pressed) {
|
||||
if (!pressed)
|
||||
TogglePostProcessing();
|
||||
});
|
||||
|
||||
RegisterHotkey(StaticString("Graphics"), StaticString("ReloadPostProcessingShaders"),
|
||||
StaticString(TRANSLATABLE("Hotkeys", "Reload Post Processing Shaders")), [this](bool pressed) {
|
||||
if (!pressed)
|
||||
|
@ -2279,15 +2285,35 @@ void CommonHostInterface::ApplyCheatCode(u32 index)
|
|||
}
|
||||
}
|
||||
|
||||
void CommonHostInterface::TogglePostProcessing()
|
||||
{
|
||||
if (!m_display)
|
||||
return;
|
||||
|
||||
g_settings.display_post_processing = !g_settings.display_post_processing;
|
||||
if (g_settings.display_post_processing)
|
||||
{
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Post-processing is now enabled."), 10.0f);
|
||||
|
||||
if (!m_display->SetPostProcessingChain(g_settings.display_post_process_chain))
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Failed to load post processing shader chain."), 20.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Post-processing is now disabled."), 10.0f);
|
||||
m_display->SetPostProcessingChain({});
|
||||
}
|
||||
}
|
||||
|
||||
void CommonHostInterface::ReloadPostProcessingShaders()
|
||||
{
|
||||
if (!m_display || !g_settings.display_post_processing)
|
||||
return;
|
||||
|
||||
if (!m_display->SetPostProcessingChain(g_settings.display_post_process_chain))
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Failed to load post processing shader chain."), 20.0f);
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Failed to load post-processing shader chain."), 20.0f);
|
||||
else
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Post processing shaders reloaded."), 10.0f);
|
||||
AddOSDMessage(TranslateStdString("OSDMessage", "Post-processing shaders reloaded."), 10.0f);
|
||||
}
|
||||
|
||||
#ifdef WITH_DISCORD_PRESENCE
|
||||
|
|
|
@ -166,6 +166,9 @@ public:
|
|||
/// Immediately applies the specified cheat code.
|
||||
void ApplyCheatCode(u32 index);
|
||||
|
||||
/// Temporarily toggles post-processing on/off.
|
||||
void TogglePostProcessing();
|
||||
|
||||
/// Reloads post processing shaders with the current configuration.
|
||||
void ReloadPostProcessingShaders();
|
||||
|
||||
|
|
Loading…
Reference in a new issue