Controller Control Assignments - cressie176/Load64 GitHub Wiki

1. Overview

┌─────────────────────────────────────────────────┐    ┌─────────────────────────────────────────────────┐
│                                                 │    │                                                 │
│               SystemKeyAssignment               │    │            JoystickActionAssignment             │
│                                                 │    │                                                 │
└─────────────────────────────────────────────────┘    └─────────────────────────────────────────────────┘
                         ┼                                                      ┼                         
                         ○                                                      ○                         
                         │                                                      │                         
                         │                                                      │                         
                         ○                                                      ○                         
                        ╱│╲                                                    ╱│╲                        
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                        │
│                                      ControllerControlAssignment                                       │
│                                                                                                        │
├────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ id: integer [pk]                                                                                       │
│ system_key_assignment_id: integer [fk, required(1)]                                                    │
│ joystick_action_assignment_id: integer [fk, required(1)]                                               │
│ canonical_control_name: canonical_control_names [unique(GameControl), unique(PlayerControl), required] │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘

See Game Controls for the full model, including GameControlAssignment, SystemKeyAssignment, and JoystickActionAssignment.

A ControllerControlAssignment maps a physical controller button (identified by its canonical_control_name) to either a SystemKeyAssignment or a JoystickActionAssignment. LoadC64 uses these mappings to configure the emulator at launch.

2. Canonical Control Names

The canonical_control_names enum defines the set of valid values for controller button and axis identifiers used throughout LoadC64.

Value Label Description
button_south Button South Face button south (e.g. A/Cross)
button_east Button East Face button east (e.g. B/Circle)
button_west Button West Face button west (e.g. X/Square)
button_north Button North Face button north (e.g. Y/Triangle)
dpad_up D-Pad Up D-pad up
dpad_down D-Pad Down D-pad down
dpad_left D-Pad Left D-pad left
dpad_right D-Pad Right D-pad right
left_shoulder Left Shoulder Left shoulder button (L1)
right_shoulder Right Shoulder Right shoulder button (R1)
left_trigger Left Trigger Left trigger (L2)
right_trigger Right Trigger Right trigger (R2)
left_stick_x Left Stick X Left thumbstick horizontal axis
left_stick_y Left Stick Y Left thumbstick vertical axis
left_stick_press Left Stick Press Left thumbstick click (L3)
right_stick_x Right Stick X Right thumbstick horizontal axis
right_stick_y Right Stick Y Right thumbstick vertical axis
right_stick_press Right Stick Press Right thumbstick click (R3)
start Start Start button
back Back Back / Select button

3. Default Assignments

LoadC64 creates the following default assignments for every player of every new game.

Game control Canonical name
up dpad_up
down dpad_down
left dpad_left
right dpad_right
fire button_south
space button_west

Beyond these, C64 games are too inconsistent to define further defaults.

4. Tables

ControllerControlAssignment

Exactly one of system_key_assignment_id or joystick_action_assignment_id must be set (check constraint).

Field Type PK FK Nullable Unique Description
id integer yes Surrogate primary key.
system_key_assignment_id integer SystemKeyAssignment.id yes The system key assignment this controller button triggers. Null if this is a joystick action assignment.
joystick_action_assignment_id integer JoystickActionAssignment.id yes The joystick action assignment this controller button triggers. Null if this is a system key assignment.
canonical_control_name canonical_control_names GameControl, PlayerControl The canonical controller button assigned (e.g. "button_south"). Unique within its owning game or player.
⚠️ **GitHub.com Fallback** ⚠️