From b02409a9cde6a2080b84dbed543368f8404cb475 Mon Sep 17 00:00:00 2001 From: Emmanuel AYME Date: Tue, 24 Mar 2026 23:16:57 +0100 Subject: [PATCH] Add simulated hotkeys --- includes/HotkeysManager.h | 13 +++++++++++++ libs/HotkeysManager.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/includes/HotkeysManager.h b/includes/HotkeysManager.h index 382505c..09c1423 100644 --- a/includes/HotkeysManager.h +++ b/includes/HotkeysManager.h @@ -42,3 +42,16 @@ void RegisterHotkey(int vk, Modifier mods, std::function callback); */ void ProcessHotkeys(reshade::api::effect_runtime* runtime); +/** + * @brief Simulate Alt + Enter shortcut + * + * This function should be calld on event `on_present` + */ +void SimulateAltEnter(); + +/** + * @brief Simulate Alt + Tab shortcut + * + * This function should be calld on event `on_present` + */ +void SimulateAltTab(); diff --git a/libs/HotkeysManager.cpp b/libs/HotkeysManager.cpp index fe22034..b74b166 100644 --- a/libs/HotkeysManager.cpp +++ b/libs/HotkeysManager.cpp @@ -30,3 +30,31 @@ void ProcessHotkeys(reshade::api::effect_runtime* runtime) { hotkey.wasPressed = pressed; } } + +void SimulateAltEnter() { + INPUT inputs[4] = {}; + // ALT down + inputs[0].type = INPUT_KEYBOARD; + inputs[0].ki.wVk = VK_MENU; + // ENTER down + inputs[1].type = INPUT_KEYBOARD; + inputs[1].ki.wVk = VK_RETURN; + // ENTER up + inputs[2].type = INPUT_KEYBOARD; + inputs[2].ki.wVk = VK_RETURN; + inputs[2].ki.dwFlags = KEYEVENTF_KEYUP; + // ALT up + inputs[3].type = INPUT_KEYBOARD; + inputs[3].ki.wVk = VK_MENU; + inputs[3].ki.dwFlags = KEYEVENTF_KEYUP; + + SendInput(4, inputs, sizeof(INPUT)); +} + +void SimulateAltTab() { + keybd_event(VK_MENU, 0, 0, 0); // Appuyer sur Alt + keybd_event(VK_TAB, 0, 0, 0); // Appuyer sur Tab + + keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0); // Relācher Tab + keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); // Relācher Alt +} \ No newline at end of file