Input API
Interface ID 9, version 2.1 (ROCK 1.0.3; 2.1 adds getWandPickReference). A mod built against these headers needs ROCK 1.0.3 or newer; a mod built against 2.0 keeps working. Include <ROCK/Input.h>. Namespace rock::api::input. Permissions: Read (1), Write (2). Hand input suppression, raw controller reads, native input context, and leases on the reload button and support trigger of the equipped weapon. All functions except getSample run on the game thread.
Entry points
| Function | Permission | Thread | Purpose |
|---|---|---|---|
setHandInputSuppression | Write | Game | Suppresses ROCK and native input on one hand for a lease. |
clearHandInputSuppression | Write | Game | Clears one hand, or both with Hand::None. |
getHandInputSuppressionState | Read | Game | Your lease and the flags in effect from every owner. |
getRawWandButtonState | Read | Game | Level state of one physical button. |
getRawWandThumbstick | Read | Game | Physical stick axes. |
isNativePipboyInputSuppressed | Read | Game | 1 while ROCK suppresses native Pip-Boy input. |
getNativeInputContext | Read | Game | NativeInputContextFlag bits: Available, MenuActive, PrimaryActivationTarget. |
getLogicalInputActionState | Read | Game | The jump action's level, press sequence and availability, or whether the right stick click is RobCo PALM's (PalmWheel). |
getPlacementClickState | Read | Game | Whether a held placement action owns the right-stick click. |
setReloadGesture | Write | Game | Leases the firing hand's Accept button. |
clearReloadGesture | Write | Game | Releases it. |
getReloadGesture | Read | Game | The current reload gesture lease. |
setSupportTrigger | Write | Game | Leases the supporting hand's trigger. |
clearSupportTrigger | Write | Game | Releases it. |
getSupportTrigger | Read | Game | The current support trigger lease. |
getSample | Read | Any | Identity of the current publication. |
getWandPickReference | Read | Game | 2.1. Form ID of the reference the hand's wand points at for activation. |
Hand input suppression
setHandInputSuppression(owner, request) lasts leaseFrames (up to kMaxSuppressionLeaseFrames, 120); renew it each frame you need it. Up to kMaxSuppressions (32) leases are held across owners. HandInputSuppressionFlag: SuppressNormalGrabPress, SuppressGrabRelease, SuppressHeldWeaponTriggerEquip, SuppressGameplayCandidates, SuppressOpenVrGameInput, SuppressNativeVats, SuppressNativeVans, SuppressGrenadeQuickDraw, ReserveTriggerGripChord, ReserveButtonChord; SuppressConfigModeChord is the first four together. ReserveButtonChord reserves the OpenVR buttons in chordButtons[0] (left wand) and chordButtons[1] (right wand); allowed bits are 1, 2, 7, 32 and 33, and the requesting hand's entry must be nonzero. Nonzero generation fields must match ROCK's current ones.
getHandInputSuppressionState reports callerFlags, callerLeaseActive, callerExpiresAfterFrame, callerRemainingFrames, lastInvalidationReason (None, Expired, GenerationChanged, OwnerUnregistered, ProviderLost, ExplicitClear, CallbackFault) and effectiveFlags. A lost suppression shows up as a failed renew and in lastInvalidationReason.
Raw reads
getRawWandButtonState reports available and held of one physical button with the controller sample's sequence and age; edges are not exposed. availabilityReason is Available, HookNotSampled, BlockingMenu, ReleaseToRearm or InvalidButton. getPlacementClickState sets PlacementClickFlag::RightInputReserved or LeftInputReserved while an add-on's held placement action owns that hand's stick click, including its release; the other hand's click stays free. Bits 0 and 1 (one shared click) are retired and never reused.
getLogicalInputActionState with LogicalInputAction::PalmWheel reports whether the primary (right) stick click is RobCo PALM's. The player binds PALM and the stick actions (bipod, placement, Favorites) in ROCK's [Bindings], and ROCK presents a moved PALM binding as a right stick click: held is 1 while that click is PALM's and 0 while it is another function's, so PALM opens only on its own. pressSequence is 0.
getWandPickReference(owner, hand, referenceFormId) (2.1) gives the form ID of the reference that hand's wand points at for activation: the game's own pick, the one its prompts and quick-loot view follow. It is 0 when the wand points at nothing. ROCK keeps the game's left-handed mode off, so the right hand is always the game's primary wand.
Reload gesture
setReloadGesture(owner, request) leases the Accept button (X left, A right) of the firing hand of the weapon in weaponSlot for 1 to kMaxWeaponInputLeaseFrames (120) frames. The request names the weapon (weaponSlot, with weaponFormId and weaponGenerationKey as witnesses) and a sample from the current or previous frame. Slot 1 returns TargetUnavailable. One owner at a time (Busy otherwise); the wrong hand returns HandUnavailable.
ROCK classifies the press with Scopes.ManualScopeHoldSeconds: a short release adds one to tapSequence; a hold stays ROCK scope input (scopeHeld) and never becomes a tap. ReloadGestureFlag:
BlockFire: suppress that hand's native trigger while set; firing resumes after a physical trigger release.GameplayPriority: a workbench, use or take target of the primary wand owns the whole press and release. Without it, Accept is masked from the game for the lease.
Menus, input loss, hand changes and lease changes (including flags) cancel an unfinished gesture and need a release before rearming. Expiry, clearing and owner loss keep a held button drained from the game until it is released.
Support trigger
setSupportTrigger(owner, request) leases the physical trigger of the supporting hand of an active two-hand grip on the weapon in weaponSlot (1 to kMaxWeaponInputLeaseFrames frames, current or previous sample; slot 1 returns TargetUnavailable). It suppresses only that trigger's game button, axis and native action. pressSequence is monotonic across leases; read a baseline after acquiring. A new claim or unavailable input needs a release before a fresh press; clearing, expiry, hand changes and owner loss drain a held trigger.
PlacementClickFlag bit 0 is retired and never reused.
Declarations
Complete public declarations: ROCK/Input.h
#pragma once
#include "Abi.h"
#pragma pack(push, 8)
namespace rock::api::input {
inline constexpr InterfaceId kInterfaceId = InterfaceId::Input;
inline constexpr std::uint32_t kMajor = 2;
inline constexpr std::uint32_t kMinor = 1;
inline constexpr std::uint32_t kMaxSuppressions = 32;
inline constexpr std::uint32_t kMaxSuppressionLeaseFrames = 120;
inline constexpr std::uint32_t kMaxWeaponInputLeaseFrames = 120;
enum class HandInputSuppressionFlag : std::uint32_t
{
None = 0,
SuppressNormalGrabPress = 1u << 0,
SuppressGrabRelease = 1u << 1,
SuppressHeldWeaponTriggerEquip = 1u << 2,
SuppressGameplayCandidates = 1u << 3,
SuppressOpenVrGameInput = 1u << 4,
SuppressNativeVats = 1u << 5,
SuppressNativeVans = 1u << 6,
SuppressGrenadeQuickDraw = 1u << 7,
ReserveTriggerGripChord = 1u << 8,
ReserveButtonChord = 1u << 9,
SuppressConfigModeChord =
static_cast<std::uint32_t>(SuppressNormalGrabPress) |
static_cast<std::uint32_t>(SuppressGrabRelease) |
static_cast<std::uint32_t>(SuppressHeldWeaponTriggerEquip) |
static_cast<std::uint32_t>(SuppressGameplayCandidates),
};
enum class InputAvailabilityReason : std::uint32_t
{
Available = 0,
HookNotSampled = 1,
BlockingMenu = 2,
ReleaseToRearm = 3,
InvalidButton = 4,
};
enum class LogicalInputAction : std::uint32_t
{
Jump = 1,
// RobCo PALM's wheel: held while the primary stick click ROCK presents
// is PALM's under the player's [Bindings] (Palm), never while it is a
// bipod, placement or Favorites click bound elsewhere.
PalmWheel = 2,
};
enum class SuppressionInvalidationReason : std::uint32_t
{
None = 0,
Expired = 1,
GenerationChanged = 2,
OwnerUnregistered = 3,
ProviderLost = 4,
ExplicitClear = 5,
CallbackFault = 6,
};
enum class NativeInputContextFlag : std::uint32_t
{
Available = 1u << 0,
MenuActive = 1u << 1,
PrimaryActivationTarget = 1u << 2,
};
// chordButtons[0] is the left wand, [1] the right: OpenVR button bits
// (1, 2, 7, 32, 33) reserved by ReserveButtonChord. The generations guard
// the request; zero skips that guard.
struct HandInputSuppressionRequest
{
std::uint32_t size{ sizeof(HandInputSuppressionRequest) };
std::uint32_t version{ 1 };
Hand hand{ Hand::None };
std::uint32_t flags{ 0 };
std::uint32_t leaseFrames{ 0 };
std::uint32_t worldGeneration{ 0 };
std::uint32_t skeletonGeneration{ 0 };
std::uint32_t providerGeneration{ 0 };
std::uint64_t chordButtons[2]{};
};
// leaseFrameIndex is the lease clock callerExpiresAfterFrame counts
// against; sample identifies the publication.
struct HandInputSuppressionState
{
std::uint32_t size{ sizeof(HandInputSuppressionState) };
std::uint32_t version{ 1 };
Sample sample{};
std::uint64_t leaseFrameIndex{ 0 };
std::uint64_t callerExpiresAfterFrame{ 0 };
Hand hand{ Hand::None };
std::uint32_t callerFlags{ 0 };
std::uint32_t effectiveFlags{ 0 };
std::uint32_t callerLeaseActive{ 0 };
std::uint32_t callerRemainingFrames{ 0 };
SuppressionInvalidationReason lastInvalidationReason{ SuppressionInvalidationReason::None };
};
// Level state of one physical button. sampleSequence and
// sampleAgeMilliseconds describe the controller input sample.
struct RawWandButtonState
{
std::uint32_t size{ sizeof(RawWandButtonState) };
std::uint32_t version{ 1 };
std::uint32_t available{ 0 };
std::uint32_t held{ 0 };
std::uint64_t sampleSequence{ 0 };
std::uint32_t sampleAgeMilliseconds{ 0 };
InputAvailabilityReason availabilityReason{ InputAvailabilityReason::HookNotSampled };
};
struct LogicalInputActionState
{
std::uint32_t size{ sizeof(LogicalInputActionState) };
std::uint32_t version{ 1 };
Sample sample{};
std::uint64_t sampleSequence{ 0 };
std::uint64_t pressSequence{ 0 };
LogicalInputAction action{ LogicalInputAction::Jump };
std::uint32_t available{ 0 };
std::uint32_t held{ 0 };
InputAvailabilityReason availabilityReason{ InputAvailabilityReason::HookNotSampled };
std::uint32_t sampleAgeMilliseconds{ 0 };
};
// Bits 0 and 1 (one shared stick click) are retired; never reuse them.
enum class PlacementClickFlag : std::uint32_t { RightInputReserved = 4, LeftInputReserved = 8 };
// A reserved stick click belongs to an add-on's held placement action for
// the object in that hand, including its release; other users of that
// hand's click yield. The other hand's click stays free.
struct PlacementClickState
{
std::uint32_t size{ sizeof(PlacementClickState) };
std::uint32_t version{ 1 };
std::uint32_t flags{ 0 };
Sample sample{};
};
enum class ReloadGestureFlag : std::uint32_t
{
// Suppress only that hand's native trigger button, axis and actions
// while the lease holds; firing resumes after a physical release.
BlockFire = 1u << 0,
// ROCK's gameplay activation keeps priority: a workbench, use or take
// target of the primary wand owns the whole press and release, and no
// tap or scope hold is published for it. Without this flag, Accept is
// masked from the game for the lease.
GameplayPriority = 1u << 1,
// Accept stays entirely with the game: no mask, tap or scope hold, so
// its native reload and activation keep working and the lease only
// carries BlockFire. Not valid with GameplayPriority.
KeepAcceptNative = 1u << 2,
};
/*
* Reload gesture lease on the firing hand of the weapon in weaponSlot. One
* owner at a time; the request names that weapon (slot, form, generation
* key) and the sample (current or previous frame). ROCK classifies the Accept button
* (X left, A right) with the Scope binding's duration: a short release adds one
* to tapSequence; a hold stays ROCK scope input and never becomes a tap.
* Menus, input loss, hand changes and changing the lease (including its
* flags) cancel an unfinished gesture and require a release before
* rearming. UI suppression wins. weaponGenerationKey is the weapon's
* interaction key (Weapon getInteractionKey); the lease stays held when
* the colliders arrive and that key changes.
*/
struct ReloadGestureRequest
{
std::uint32_t size{ sizeof(ReloadGestureRequest) };
std::uint32_t version{ 1 };
std::uint32_t weaponSlot{ 0 };
std::uint32_t weaponFormId{ 0 };
std::uint64_t weaponGenerationKey{ 0 };
Sample sample{};
Hand hand{ Hand::None };
std::uint32_t leaseFrames{ 2 };
std::uint32_t flags{ 0 };
};
struct ReloadGestureState
{
std::uint32_t size{ sizeof(ReloadGestureState) };
std::uint32_t version{ 1 };
OwnerToken owner{ 0 };
std::uint64_t tapSequence{ 0 };
std::uint64_t expiresAfterFrame{ 0 };
Sample sample{};
std::uint32_t active{ 0 };
Hand hand{ Hand::None };
std::uint32_t held{ 0 };
std::uint32_t scopeHeld{ 0 };
std::uint32_t weaponSlot{ 0 };
};
/*
* Support-trigger lease: the physical trigger of the supporting hand of the
* active two-hand grip on the weapon in weaponSlot. Suppresses only that trigger's game button, axis
* and native action. A new claim or unavailable input requires a release
* before a fresh press; pressSequence is monotonic across leases, so read
* a baseline after acquiring. Clearing, expiry, hand changes and owner
* loss drain a held trigger before returning it to gameplay. UI capture
* wins and cancels pending input. weaponGenerationKey is the weapon's
* interaction key (Weapon getInteractionKey); the lease stays held when
* the colliders arrive and that key changes.
*/
struct SupportTriggerRequest
{
std::uint32_t size{ sizeof(SupportTriggerRequest) };
std::uint32_t version{ 1 };
std::uint32_t weaponSlot{ 0 };
std::uint32_t weaponFormId{ 0 };
std::uint64_t weaponGenerationKey{ 0 };
Sample sample{};
Hand hand{ Hand::None };
std::uint32_t leaseFrames{ 2 };
};
struct SupportTriggerState
{
std::uint32_t size{ sizeof(SupportTriggerState) };
std::uint32_t version{ 1 };
OwnerToken owner{ 0 };
std::uint64_t pressSequence{ 0 };
std::uint64_t expiresAfterFrame{ 0 };
Sample sample{};
std::uint32_t active{ 0 };
Hand hand{ Hand::None };
std::uint32_t held{ 0 };
std::uint32_t weaponSlot{ 0 };
};
// Permission bits are local to this interface major. Discovery grants none.
enum class Permission : std::uint32_t { Read = 1, Write = 2 };
inline constexpr std::uint32_t kSupportedPermissions = 3;
struct Api
{
static constexpr InterfaceId interfaceId = kInterfaceId;
static constexpr std::uint32_t majorVersion = kMajor;
static constexpr std::uint32_t minorVersion = kMinor;
// Game thread (Write); lease up to kMaxSuppressionLeaseFrames.
Status(ROCK_CALL* setHandInputSuppression)(OwnerToken owner, const HandInputSuppressionRequest* request) noexcept;
// Hand::None clears both hands.
Status(ROCK_CALL* clearHandInputSuppression)(OwnerToken owner, Hand hand) noexcept;
// Game thread (Read).
Status(ROCK_CALL* getHandInputSuppressionState)(OwnerToken owner, Hand hand, HandInputSuppressionState* outState) noexcept;
Status(ROCK_CALL* getRawWandButtonState)(OwnerToken owner, Hand hand, std::uint32_t buttonId, RawWandButtonState* outState) noexcept;
Status(ROCK_CALL* getRawWandThumbstick)(OwnerToken owner, Hand hand, float* outX, float* outY) noexcept;
Status(ROCK_CALL* isNativePipboyInputSuppressed)(OwnerToken owner, std::uint32_t* outValue) noexcept;
// NativeInputContextFlag bits; 0 when the input hook is unavailable.
Status(ROCK_CALL* getNativeInputContext)(OwnerToken owner, std::uint32_t* outValue) noexcept;
Status(ROCK_CALL* getLogicalInputActionState)(OwnerToken owner, LogicalInputAction action, LogicalInputActionState* outState) noexcept;
Status(ROCK_CALL* getPlacementClickState)(OwnerToken owner, PlacementClickState* outState) noexcept;
// Game thread; Write for set/clear, Read for get. Lease 1 to
// kMaxWeaponInputLeaseFrames frames.
Status(ROCK_CALL* setReloadGesture)(OwnerToken owner, const ReloadGestureRequest* request) noexcept;
Status(ROCK_CALL* clearReloadGesture)(OwnerToken owner) noexcept;
Status(ROCK_CALL* getReloadGesture)(OwnerToken owner, ReloadGestureState* outState) noexcept;
Status(ROCK_CALL* setSupportTrigger)(OwnerToken owner, const SupportTriggerRequest* request) noexcept;
Status(ROCK_CALL* clearSupportTrigger)(OwnerToken owner) noexcept;
Status(ROCK_CALL* getSupportTrigger)(OwnerToken owner, SupportTriggerState* outState) noexcept;
// Any thread. Identity of the current publication.
Status(ROCK_CALL* getSample)(OwnerToken owner, Sample* outSample) noexcept;
// 2.1. Game thread (Read). Form ID of the reference the hand's wand
// points at for activation, the game's own pick; 0 when it points at
// nothing. ROCK keeps the game's left-handed mode off, so the right
// hand is always the game's primary wand.
Status(ROCK_CALL* getWandPickReference)(OwnerToken owner, Hand hand, std::uint32_t* outReferenceFormId) noexcept;
};
}
#pragma pack(pop)