# 129 — Input Mapping Profile (`DA_InputMappingProfile`)

## Purpose
Primary Data Asset that defines all Enhanced Input bindings across three platforms (PC/Mouse, Xbox, PS5 DualSense). Single source of truth for: which Input Actions map to which keys per platform, which Input Mapping Contexts each action belongs to, context priority defaults, and all modifier configurations (Negate, Swizzle, Dead Zone, Chord). Loaded by [`SS_EnhancedInputManager`](docs/blueprints/15-input/128_SS_EnhancedInputManager.md) at initialization.

## Dependencies
- **Requires:** None (self-contained Data Asset)
- **Required By:** [`SS_EnhancedInputManager`](docs/blueprints/15-input/128_SS_EnhancedInputManager.md) (loads and caches this), [`SS_SettingsSystem`](docs/blueprints/12-settings/105_SS_SettingsSystem.md) (references for key rebinding), [`BPC_HapticsController`](docs/blueprints/12-settings/148_BPC_HapticsController.md) (reads `bEnableControllerRumble` for haptics master toggle)
- **Engine/Plugin Requirements:** Enhanced Input Plugin, `UInputMappingContext`, `UInputAction`

## Class Info
| Property | Value |
|----------|-------|
| **Parent Class** | `UPrimaryDataAsset` |
| **Class Type** | Data Asset |
| **Asset Path** | `Content/Framework/DataAssets/DA_InputMappingProfile` |
| **Implements Interfaces** | None |

---

## 1. Enums

*No enums are defined by this Data Asset. Uses `E_InputContext` and `E_InputPlatform` from [`SS_EnhancedInputManager`](docs/blueprints/15-input/128_SS_EnhancedInputManager.md).*

---

## 2. Structs

### `S_PlatformActionBinding`
| Field | Type | Description |
|-------|------|-------------|
| `Action` | `UInputAction*` | Reference to the IA_ Input Action asset |
| `ContextType` | `E_InputContext` | Which IMC this action belongs to |
| `PrimaryKey` | `FKey` | Primary key/button |
| `SecondaryKey` | `FKey` | Secondary key/button (optional) |
| `bIsHold` | `Bool` | Whether this is a hold-triggered action (vs tap) |
| `HoldDuration` | `Float` | Seconds to hold before triggering (0.0 = instant) |
| `Modifiers` | `TArray<UInputModifier*>` | Array of modifier instances (Negate, Swizzle, DeadZone, etc.) |
| `Triggers` | `TArray<UInputTrigger*>` | Array of trigger instances (Pressed, Released, Hold, Tap, Chord) |

### `S_PlatformProfile`
| Field | Type | Description |
|-------|------|-------------|
| `Platform` | `E_InputPlatform` | Which platform this profile is for |
| `Bindings` | `TArray<S_PlatformActionBinding>` | All action bindings for this platform |
| `ControllerGlyphSet` | `FName` | Which glyph set to display ("Xbox", "PS5", "Keyboard") |
| `DeadZoneThreshold` | `Float` | Analog stick dead zone for this platform |
| `MouseSensitivity` | `Float` | Default mouse sensitivity (PC only, 1.0 = baseline) |
| `ControllerSensitivity` | `Float` | Default controller sensitivity |

### `S_ContextDefinition`
| Field | Type | Description |
|-------|------|-------------|
| `ContextType` | `E_InputContext` | Which context this defines |
| `MappingContext` | `UInputMappingContext*` | Reference to the IMC_ asset for this context |
| `DefaultPriority` | `Int32` | Default priority when pushed |
| `bBlockLowerContexts` | `Bool` | Whether this context consumes input (prevents passthrough) |
| `Description` | `FText` | Human-readable description for debugging |

---

## 3. Variables

### Configuration (Instance Editable)

| Variable | Type | Default | Category | Description |
|----------|------|---------|----------|-------------|
| `PlatformProfiles` | `TArray<S_PlatformProfile>` | `Empty` | `Profiles` | One profile per platform (3 total) |
| `ContextDefinitions` | `TArray<S_ContextDefinition>` | `Empty` | `Contexts` | IMC asset references and defaults |
| `GlobalDeadZone` | `Float` | `0.15` | `Global` | Fallback analog stick dead zone |
| `bEnableControllerRumble` | `Bool` | `true` | `Global` | Master toggle for force feedback (read by BPC_HapticsController) |
| `bSwapSticksForLeftHanded` | `Bool` | `false` | `Accessibility` | Swap left/right stick for accessibility |
| `AxisInvertSettings` | `TMap<FName, Bool>` | `Empty` | `Accessibility` | Per-action axis inversion (e.g., "IA_Look" = InvertY) |

---

## 4. Functions

*This Data Asset has no Blueprint functions. All data retrieval is performed by [`SS_EnhancedInputManager`](docs/blueprints/15-input/128_SS_EnhancedInputManager.md) reading the struct arrays directly.*

---

## 5. Event Dispatchers

*None. Data Assets do not have event dispatchers.*

---

## 6. Overridden Events / Custom Events

*None.*

---

## 7. Complete Binding Table

### IMC_Default (Priority 0) — Core Gameplay

| Input Action | PC Keyboard/Mouse | Xbox | PS5 DualSense | Modifiers |
|:---|:---|:---|:---|:---|
| `IA_Move` | W (Y=1), S (Y=-1, Negate), D (X=1, Swizzle), A (X=-1, Swizzle+Negate) | Left Stick | Left Stick | DeadZone 0.15 |
| `IA_Look` | Mouse XY | Right Stick | Right Stick | InvertY optional |
| `IA_Interact` | E / Left Click | X (Face Left) | Square | Tap/Hold trigger |
| `IA_PrimaryAction` | Left Mouse Button | RT (Right Trigger) | R2 | — |
| `IA_SecondaryAction` | Right Mouse Button | LT (Left Trigger) | L2 | — |
| `IA_Sprint` | Left Shift | LS Click (L3) | L3 | Hold trigger |
| `IA_Crouch` | C / Left Ctrl | B (Face Right) | Circle | Toggle or Hold |
| `IA_Vault_Climb` | Spacebar | A (Face Bottom) | Cross | Contextual |
| `IA_Jump` | Spacebar | A (Face Bottom) | Cross | Passthrough when no vault context |
| `IA_Flashlight` | F | D-Pad Up | D-Pad Up | Toggle |
| `IA_QuickHeal` | Q / H | D-Pad Down | D-Pad Down | Instant |
| `IA_Reload` | R | Y (Face Top) | Triangle | — |
| `IA_OpenWatch` | Tab / I | View Button | Touchpad Click | — |
| `IA_PauseMenu` | Esc / P | Menu Button | Options Button | — |
| `IA_QuickSlotScroll` | Scroll Wheel Up/Down | — | — | Axis1D |
| `IA_QuickSlot1` | 1 | — | — | Digital |
| `IA_QuickSlot2` | 2 | — | — | Digital |
| `IA_QuickSlot3` | 3 | — | — | Digital |
| `IA_QuickSlot4` | 4 | — | — | Digital |
| `IA_QuickSlot5` | 5 | — | — | Digital |
| `IA_QuickSlot6` | 6 | — | — | Digital |
| `IA_QuickSlot7` | 7 | — | — | Digital |
| `IA_QuickSlot8` | 8 | — | — | Digital |
| `IA_SkipCutscene` | Spacebar (Hold) | A/Cross (Hold) | Cross (Hold) | Hold 2.0s trigger |

### IMC_Hiding (Priority 5) — Hiding Spots

| Input Action | PC Keyboard/Mouse | Xbox | PS5 DualSense | Notes |
|:---|:---|:---|:---|:---|
| `IA_Hide_Look` | Mouse XY (clamped ±45°) | Right Stick (clamped) | Right Stick (clamped) | Axis2D |
| `IA_Hide_Peek` | W/S | Left Stick Y | Left Stick Y | Axis1D |
| `IA_Hide_HoldBreath` | Spacebar (Hold) | LT + RT (Hold) | L2 + R2 (Hold) | Hold trigger |
| `IA_Exit_Hide` | C / Esc | B (Face Right) | Circle | — |

### IMC_WristwatchUI (Priority 10) — Inventory Screen

| Input Action | PC Keyboard/Mouse | Xbox | PS5 DualSense | Notes |
|:---|:---|:---|:---|:---|
| `IA_UI_Navigate` | W/A/S/D or Arrow Keys | D-Pad / Left Stick | D-Pad / Left Stick | Axis2D |
| `IA_UI_Select` | E / Enter | A (Face Bottom) | Cross | — |
| `IA_UI_Combine` | C | X (Face Left) | Square | — |
| `IA_UI_DropItem` | X | Y (Face Top) | Triangle | — |
| `IA_CloseWatch` | Tab / Esc | B / View Button | Circle / Touchpad | — |

### IMC_Inspection (Priority 20) — 3D Item Inspection

| Input Action | PC Keyboard/Mouse | Xbox | PS5 DualSense | Notes |
|:---|:---|:---|:---|:---|
| `IA_Inspect_Rotate` | Mouse XY | Right Stick | Right Stick | Axis2D |
| `IA_Inspect_Zoom` | Scroll Wheel | LT / RT | L2 / R2 | Axis1D |
| `IA_Inspect_Flip` | F | Y (Face Top) | Triangle | — |
| `IA_Cancel_Drop` | Right Click / Esc | B (Face Right) | Circle | — |

### IMC_UI (Priority 100) — Full-Screen Menus and Pause

| Input Action | PC Keyboard/Mouse | Xbox | PS5 DualSense | Notes |
|:---|:---|:---|:---|:---|
| `IA_UI_Navigate` | W/A/S/D or Arrow Keys | D-Pad / Left Stick | D-Pad / Left Stick | Axis2D (reused from WristwatchUI) |
| `IA_UI_Select` | E / Enter | A (Face Bottom) | Cross | (reused) |
| `IA_UI_Back` | Esc / Backspace | B (Face Right) | Circle | Universal back |
| `IA_ToggleAccessibility` | F6 | View+Menu (Chord) | Touchpad Long Press | Accessibility quick toggle |
| `IA_PauseMenu` | Esc / P | Menu Button | Options Button | Close pause = pop context |

---

## 8. Modifier Configuration Reference

### W/A/S/D Key Swizzle Setup
For `IA_Move` on PC:
- **W** = `Input Action Value.Y = 1.0` (default, no modifier)
- **S** = Add **Negate** modifier → `Input Action Value.Y = -1.0`
- **D** = Add **Swizzle Input Axis Values** modifier (Order: YXZ) + default → `Input Action Value.X = 1.0`
- **A** = Add **Swizzle Input Axis Values** modifier (Order: YXZ) + **Negate** → `Input Action Value.X = -1.0`

### Hold Trigger Configuration
| Action | Hold Duration | Trigger Type |
|--------|---------------|--------------|
| `IA_Interact` (physics drag) | 0.3s | Hold + Release |
| `IA_Sprint` | 0.0s (instant) | Hold (continuous while pressed) |
| `IA_Crouch` (if toggle off) | 0.0s | Hold |
| `IA_Hide_HoldBreath` | 0.0s | Hold (continuous) |
| `IA_SkipCutscene` | 2.0s | Hold (trigger on completion) |

### Chord Actions
| Action | Chord Combination | Description |
|--------|-------------------|-------------|
| `IA_ToggleAccessibility` (Xbox) | View + Menu (simultaneous) | Two-button chord for rare action |
| `IA_Hide_HoldBreath` (Xbox/PS5) | LT + RT / L2 + R2 | Both triggers held simultaneously |

---

## 9. Validation / Testing Checklist

- [ ] All 30+ Input Actions are referenced in at least one platform binding
- [ ] Every `E_InputContext` has a corresponding `S_ContextDefinition` with `MappingContext` assigned
- [ ] W/A/S/D modifiers (Negate, Swizzle) produce correct axis values
- [ ] Analog stick dead zones prevent drift on all three platforms
- [ ] Hold actions correctly distinguish tap vs hold (Interact: tap=pickup, hold=drag)
- [ ] `IA_Vault_Climb` and `IA_Jump` coexist correctly (contextual vs general)
- [ ] Quick slots 1–8 are keyboard-only; console uses scroll
- [ ] `IA_UI_Back` vs `IA_Cancel_Drop` have separate bindings (back ≠ cancel)
- [ ] Chord actions (HoldBreath on controller, Accessibility toggle) work as two-button combos
- [ ] Controller glyph set switches correctly on platform hot-swap
- [ ] Edge case: No duplicate keys within the same IMC for mutually exclusive actions
- [ ] Edge case: Dead zone on Scroll Wheel (IA_QuickSlotScroll) prevents accidental scrolling

---

## 10. Reuse Notes

- This Data Asset is the **single source of truth** for ALL input bindings. No other system hardcodes key references.
- When adding a new Input Action: 1) Create the IA_ asset, 2) Add it to this DA under the correct context/platform, 3) The IMC asset references this DA — update the IMC accordingly.
- Platform profiles can be authored in the Content Browser; designers don't need to touch Blueprint graphs.
- For accessibility: `AxisInvertSettings` allows per-player Y-axis inversion without modifying the core bindings.
- `bBlockLowerContexts` on `S_ContextDefinition` controls whether IMC_Hiding passes through `IA_Move` to IMC_Default (it blocks) vs whether IMC_UI allows `IA_QuickSlotScroll` passthrough (it doesn't).
- Console-specific glyphs (Xbox ABXY vs PS5 Cross/Circle/Square/Triangle) are handled by `ControllerGlyphSet` for dynamic UI updates.

---

*Blueprint Spec: Input Mapping Profile Data Asset. Conforms to TEMPLATE.md v1.0 — part of the UE5 Modular Game Framework, INPUT layer.*