PadCrafter JSON Export
Generate a PadCrafter-compatible JSON file from VibePad's current button mappings for use at padcrafter.com.
Instructions
- •
Read the current mappings from
VibePad/InputMapper.swift. Extract:- •
defaultDescriptions— base layer button descriptions - •
l1Descriptions— L1 layer button descriptions - •Any buttons in
defaultMappingsorl1Mappingsthat lack descriptions (use the code comment as a fallback)
- •
- •
Map VibePad button names to PadCrafter keys using this table:
GamepadButton (VibePad) PadCrafter key buttonA aButton buttonB bButton buttonX xButton buttonY yButton dpadUp dpadUp dpadDown dpadDown dpadLeft dpadLeft dpadRight dpadRight leftShoulder leftBumper rightShoulder rightBumper leftTrigger leftTrigger rightTrigger rightTrigger leftThumbstickButton leftStickClick rightThumbstickButton rightStickClick buttonMenu startButton buttonOptions backButton - •
Build two templates in a single PadCrafter JSON:
Template 1 — "VibePad":
- •Populate every PadCrafter key. Use the description from
defaultDescriptionsif present, otherwise"". - •Force
leftBumper="Layer Modifier (L1)"(L1 is the layer toggle, not a regular mapping). - •Set
leftStick="Arrow Keys"andrightStick="Scroll"(these are PadCrafter-specific fields for the analog sticks, separate from the click buttons).
Template 2 — "L1 Layer (Hold L1)":
- •Only include buttons that have entries in
l1Descriptions(orl1Mappings). - •All other buttons should be
"". - •Set
leftStick="Prev/Next App"(L1+left stick does app switching) andrightStick="Mouse Cursor"(L1+right stick moves the cursor).
- •Populate every PadCrafter key. Use the description from
- •
Output format — the JSON structure must be exactly:
json{ "PadCrafter": { "": [ { "templatename": "VibePad", "buttons": { "leftTrigger": "...", "rightTrigger": "...", "leftBumper": "Layer Modifier (L1)", "rightBumper": "...", "aButton": "...", "bButton": "...", "xButton": "...", "yButton": "...", "dpadUp": "...", "dpadDown": "...", "dpadLeft": "...", "dpadRight": "...", "leftStickClick": "...", "rightStickClick": "...", "startButton": "...", "backButton": "...", "leftStick": "Arrow Keys", "rightStick": "Scroll" } }, { "templatename": "L1 Layer (Hold L1)", "buttons": { "leftTrigger": "", "rightTrigger": "", "leftBumper": "", "rightBumper": "", "aButton": "", "bButton": "...", "xButton": "", "yButton": "", "dpadUp": "", "dpadDown": "", "dpadLeft": "", "dpadRight": "", "leftStickClick": "", "rightStickClick": "", "startButton": "", "backButton": "", "leftStick": "Prev/Next App", "rightStick": "Mouse Cursor" } } ] } } - •
Write the JSON to the scratchpad directory and display the full JSON in the response so the user can copy-paste it.
- •
Build the padcrafter.com URL:
- •Collect all PadCrafter button keys from the templates built in step 3 (e.g.
aButton,bButton,leftStick, etc.). - •For each button key, gather its value across all templates into an ordered list (template 1 first, then template 2).
- •Trim trailing empty strings from the list (e.g.
["Accept", ""]→["Accept"];["", "Delete"]stays as-is). - •If ALL values are empty after trimming, skip the button entirely (don't include it as a query param).
- •Join the remaining values with
|(e.g.AcceptorCancel|Delete). - •Start with
templates=VibePad|L1 Layer (Hold L1). - •Append each non-empty button as
&key=value. - •URL-encode each param value: spaces →
+,|→%7C, parentheses and other special chars →%XXas needed. Use standard percent-encoding. - •Final URL:
https://www.padcrafter.com/index.php?templates=...&aButton=...&bButton=... - •Display the URL in the response so the user can click it to open their layout directly on padcrafter.com.
- •Collect all PadCrafter button keys from the templates built in step 3 (e.g.