diff --git a/build_scripts/compile_version_string.txt b/build_scripts/compile_version_string.txt index 3b51fcf..6389c36 100644 --- a/build_scripts/compile_version_string.txt +++ b/build_scripts/compile_version_string.txt @@ -1 +1 @@ -5.1.2-release \ No newline at end of file +5.1.2-dev \ No newline at end of file diff --git a/src/keyboard_input/input_sender.h b/src/keyboard_input/input_sender.h index 94bf044..1f17a7d 100644 --- a/src/keyboard_input/input_sender.h +++ b/src/keyboard_input/input_sender.h @@ -75,6 +75,26 @@ inline void sendTokensAsInput( const std::vector tokens ) shutdownOsSystems(); } +inline void sendTokenPress( const Token token, KeyStatus event = KeyStatus::Up ) +{ + initOsSystems(); + + sendKeyPress( token, event ); + + shutdownOsSystems(); +} + +inline void sendFirstCharAsInput( const std::string inputstring, + KeyStatus event ) +{ + const auto tokens = ParseKeyboardInputsToTokens( inputstring ); + const auto inputs = removeIncorrectTokens( tokens ); + if ( !tokens.empty() ) + { + sendTokenPress( inputs.front(), event ); + } +} + inline void sendStringAsInput( const std::string input ) { const auto tokens = ParseKeyboardInputsToTokens( input ); diff --git a/src/openvr/ivrinput.cpp b/src/openvr/ivrinput.cpp index 49261ef..66a24f8 100644 --- a/src/openvr/ivrinput.cpp +++ b/src/openvr/ivrinput.cpp @@ -138,6 +138,8 @@ SteamIVRInput::SteamIVRInput() m_keyboardOne( action_keys::keyboardOne ), m_keyboardTwo( action_keys::keyboardTwo ), m_keyboardThree( action_keys::keyboardThree ), + m_keyboardPressOne( action_keys::keyboardPressOne ), + m_keyboardPressTwo( action_keys::keyboardPressTwo ), m_chaperoneToggle( action_keys::chaperoneToggle ), m_pushToTalk( action_keys::pushToTalk ), m_leftHaptic( action_keys::hapticsLeft ), @@ -349,6 +351,15 @@ bool SteamIVRInput::keyboardThree() { return isDigitalActionActivatedOnce( m_keyboardThree ); } +bool SteamIVRInput::keyboardPressOne() +{ + return isDigitalActionActivatedConstant( m_keyboardPressOne ); +} +bool SteamIVRInput::keyboardPressTwo() +{ + return isDigitalActionActivatedConstant( m_keyboardPressTwo ); +} + /*! Returns the action handle of the Left Haptic Action */ diff --git a/src/openvr/ivrinput.h b/src/openvr/ivrinput.h index fa9a0ee..d868cd6 100644 --- a/src/openvr/ivrinput.h +++ b/src/openvr/ivrinput.h @@ -55,6 +55,8 @@ namespace action_keys constexpr auto keyboardOne = "/actions/misc/in/KeyboardOne"; constexpr auto keyboardTwo = "/actions/misc/in/KeyboardTwo"; constexpr auto keyboardThree = "/actions/misc/in/KeyboardThree"; + constexpr auto keyboardPressOne = "/actions/misc/in/KeyboardPressOne"; + constexpr auto keyboardPressTwo = "/actions/misc/in/KeyboardPressTwo"; constexpr auto hapticsLeft = "/actions/haptic/out/HapticsLeft"; constexpr auto hapticsRight = "/actions/haptic/out/HapticsRight"; @@ -158,6 +160,8 @@ public: bool keyboardOne(); bool keyboardTwo(); bool keyboardThree(); + bool keyboardPressOne(); + bool keyboardPressTwo(); vr::VRActionHandle_t leftHapticActionHandle(); vr::VRActionHandle_t rightHapticActionHandle(); @@ -225,6 +229,8 @@ private: DigitalAction m_keyboardOne; DigitalAction m_keyboardTwo; DigitalAction m_keyboardThree; + DigitalAction m_keyboardPressOne; + DigitalAction m_keyboardPressTwo; // Misc Bindings DigitalAction m_chaperoneToggle; diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index 21297ab..901e603 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -698,6 +698,37 @@ void OverlayController::processKeyboardBindings() sendStringAsInput( commands ); } + // Press Key One + if ( m_actions.keyboardPressOne() && !m_keyPressOneState ) + { + const auto commands = settings::getSetting( + settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressOne ); + sendFirstCharAsInput( commands, KeyStatus::Down ); + m_keyPressOneState = true; + } + if ( m_keyPressOneState && !m_actions.keyboardPressOne() ) + { + const auto commands = settings::getSetting( + settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressOne ); + sendFirstCharAsInput( commands, KeyStatus::Up ); + m_keyPressOneState = false; + } + + // Press Key Two + if ( m_actions.keyboardPressTwo() && !m_keyPressTwoState ) + { + const auto commands = settings::getSetting( + settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressTwo ); + sendFirstCharAsInput( commands, KeyStatus::Down ); + m_keyPressTwoState = true; + } + if ( m_keyPressTwoState && !m_actions.keyboardPressTwo() ) + { + const auto commands = settings::getSetting( + settings::StringSetting::KEYBOARDSHORTCUT_keyboardPressTwo ); + sendFirstCharAsInput( commands, KeyStatus::Up ); + m_keyPressTwoState = false; + } } void OverlayController::processRotationBindings() { diff --git a/src/overlaycontroller.h b/src/overlaycontroller.h index 9f79d26..46f8957 100644 --- a/src/overlaycontroller.h +++ b/src/overlaycontroller.h @@ -179,6 +179,9 @@ private: void processKeyboardBindings(); void processRotationBindings(); + bool m_keyPressOneState = false; + bool m_keyPressTwoState = false; + public: OverlayController( bool desktopMode, bool noSound, QQmlEngine& qmlEngine ); virtual ~OverlayController(); diff --git a/src/package_files/action_manifest.json b/src/package_files/action_manifest.json index f0512b5..a119a0f 100644 --- a/src/package_files/action_manifest.json +++ b/src/package_files/action_manifest.json @@ -204,6 +204,16 @@ "name": "/actions/misc/in/KeyboardThree", "requirement": "optional", "type": "boolean" + }, + { + "name": "/actions/misc/in/KeyboardPressOne", + "requirement": "optional", + "type": "boolean" + }, + { + "name": "/actions/misc/in/KeyboardPressTwo", + "requirement": "optional", + "type": "boolean" } ], @@ -278,7 +288,9 @@ "/actions/haptic/in/ProxSensor" : "Proximity Sensor", "/actions/misc/in/KeyboardOne" : "Keyboard Shortcut One", "/actions/misc/in/KeyboardTwo" : "Keyboard Shortcut Two", - "/actions/misc/in/KeyboardThree" : "Keyboard Shortcut Three" + "/actions/misc/in/KeyboardThree" : "Keyboard Shortcut Three", + "/actions/misc/in/KeyboardPressOne": "Keyboard Press One", + "/actions/misc/in/KeyboardPressTwo": "Keyboard Press Two" } ] } \ No newline at end of file diff --git a/src/settings/internal/settings_controller.h b/src/settings/internal/settings_controller.h index ba1fafe..80dc50e 100644 --- a/src/settings/internal/settings_controller.h +++ b/src/settings/internal/settings_controller.h @@ -481,6 +481,7 @@ private: constexpr static auto stringSettingsSize = static_cast( StringSetting::LAST_ENUMERATOR ) + 1; constexpr static auto discordDefaultMuteKeybinding = "^>m"; + constexpr static auto pressDefaultOne = "F9"; std::array m_stringSettings{ StringSettingValue{ StringSetting::KEYBOARDSHORTCUT_keyboardOne, SettingCategory::KeyboardShortcut, @@ -494,6 +495,14 @@ private: SettingCategory::KeyboardShortcut, QtInfo{ "keyboardThree" }, discordDefaultMuteKeybinding }, + StringSettingValue{ StringSetting::KEYBOARDSHORTCUT_keyboardPressOne, + SettingCategory::KeyboardShortcut, + QtInfo{ "keyboardPressOne" }, + pressDefaultOne }, + StringSettingValue{ StringSetting::KEYBOARDSHORTCUT_keyboardPressTwo, + SettingCategory::KeyboardShortcut, + QtInfo{ "keyboardPressTwo" }, + pressDefaultOne }, }; constexpr static auto intSettingsSize diff --git a/src/settings/settings.h b/src/settings/settings.h index a018c83..9368ddd 100644 --- a/src/settings/settings.h +++ b/src/settings/settings.h @@ -90,8 +90,10 @@ enum class StringSetting KEYBOARDSHORTCUT_keyboardOne, KEYBOARDSHORTCUT_keyboardTwo, KEYBOARDSHORTCUT_keyboardThree, + KEYBOARDSHORTCUT_keyboardPressOne, + KEYBOARDSHORTCUT_keyboardPressTwo, // LAST_ENUMERATOR must always be set to the last value - LAST_ENUMERATOR = KEYBOARDSHORTCUT_keyboardThree, + LAST_ENUMERATOR = KEYBOARDSHORTCUT_keyboardPressTwo, }; enum class IntSetting