From 8500bc08e2a378eb87aa9d82eff9b1bb6b3d02b7 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sat, 5 Dec 2020 17:35:02 +0700 Subject: [PATCH] Add hotkey for "force gamma correction" setting. Fixed #2318 Request: Keyboard shortcut to enable Custom Gamma Correction Levels --- src/Config.cpp | 2 ++ src/Config.h | 1 + src/GLideNUI/ConfigDialog.cpp | 2 ++ src/VI.cpp | 8 ++++++++ src/mupenplus/Config_mupenplus.cpp | 2 ++ 5 files changed, 15 insertions(+) diff --git a/src/Config.cpp b/src/Config.cpp index 93d210fd..04eb4379 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -184,6 +184,8 @@ const char* Config::hotkeyIniName(u32 _idx) return "hkOsdInternalResolution"; case Config::HotKey::hkOsdRenderingResolution: return "hkOsdRenderingResolution"; + case Config::HotKey::hkForceGammaCorrection: + return "hkForceGammaCorrection"; } return nullptr; } diff --git a/src/Config.h b/src/Config.h index b665b22b..05f1dad3 100644 --- a/src/Config.h +++ b/src/Config.h @@ -225,6 +225,7 @@ struct Config hkOsdPercent, hkOsdInternalResolution, hkOsdRenderingResolution, + hkForceGammaCorrection, hkTotal }; diff --git a/src/GLideNUI/ConfigDialog.cpp b/src/GLideNUI/ConfigDialog.cpp index d7a67d76..11008dff 100644 --- a/src/GLideNUI/ConfigDialog.cpp +++ b/src/GLideNUI/ConfigDialog.cpp @@ -95,6 +95,8 @@ QString ConfigDialog::_hotkeyDescription(quint32 _idx) const return tr("Toggle OSD internal resolution"); case Config::HotKey::hkOsdRenderingResolution: return tr("Toggle OSD rendering resolution"); + case Config::HotKey::hkForceGammaCorrection: + return tr("Toggle force gamma correction"); } return tr("Unknown hotkey"); } diff --git a/src/VI.cpp b/src/VI.cpp index 46069500..fbc019a4 100644 --- a/src/VI.cpp +++ b/src/VI.cpp @@ -187,6 +187,14 @@ static void checkHotkeys() if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdRenderingResolution], 0x0001)) { config.onScreenDisplay.renderingResolution = !config.onScreenDisplay.renderingResolution; } + + if (osal_is_key_pressed(config.hotkeys.keys[Config::hkForceGammaCorrection], 0x0001)) { + if (config.gammaCorrection.force == 0) + dwnd().getDrawer().showMessage("Force gamma correction on\n", Milliseconds(750)); + else + dwnd().getDrawer().showMessage("Force gamma correction off\n", Milliseconds(750)); + config.gammaCorrection.force = !config.gammaCorrection.force; + } } void VI_UpdateScreen() diff --git a/src/mupenplus/Config_mupenplus.cpp b/src/mupenplus/Config_mupenplus.cpp index d98671f2..a497b69d 100644 --- a/src/mupenplus/Config_mupenplus.cpp +++ b/src/mupenplus/Config_mupenplus.cpp @@ -45,6 +45,8 @@ const char* _hotkeyDescription(u32 _idx) return "Hotkey: toggle OSD internal resolution"; case Config::HotKey::hkOsdRenderingResolution: return "Hotkey: toggle OSD rendering resolution"; + case Config::HotKey::hkForceGammaCorrection: + return "Hotkey: toggle force gamma correction"; } return "Unknown hotkey"; }