Controller Controls - cressie176/Load64 GitHub Wiki
┌────────────────────────────────────────────────────────────────────────────┐
│ │
│ ControllerControl │
│ │
├────────────────────────────────────────────────────────────────────────────┤
│ │
│ id: integer [pk] │
│ controller_family_id: integer [fk, required(1)] │
│ controller_id: integer [fk, required(1)] │
│ name: text [unique(controller_family_id), unique(controller_id), required] │
│ event: text [required] │
│ canonical_name: canonical_control_names [required] │
│ │
└────────────────────────────────────────────────────────────────────────────┘
╲│╱ ╲│╱
○ ○
│ │
│ │
│ │
│ │
┼ ┼
┌───────────────────────────────┐ ┌───────────────────────────────────────────┐
│ │ │ │
│ ControllerFamily │ │ Controller │
│ │ │ │
└───────────────────────────────┘ └───────────────────────────────────────────┘
A ControllerControl maps a physical button or axis on a controller to LoadC64's canonical control names (e.g. button_south, dpad_up). It belongs to either a Controller Family or a Controller — exactly one of controller_family_id or controller_id must be set (check constraint).
When a controller belongs to a family, its ControllerControl rows are merged with the family's by name. Controller-level rows override family-level rows for matching names; unmatched family rows are inherited unchanged. See Controllers for merge rules.
name must be unique within its owner — a controller family cannot define the same control twice, and similarly for controllers.
Exactly one of controller_family_id or controller_id must be set (check constraint).
| Field | Type | PK | FK | Nullable | Unique | Description |
|---|---|---|---|---|---|---|
| id | integer | yes | Surrogate primary key. | |||
| controller_family_id | integer | ControllerFamily.id | yes | The family this control belongs to. Null if owned by a controller. | ||
| controller_id | integer | Controller.id | yes | The controller this control belongs to. Null if owned by a controller family. | ||
| name | text | unique(controller_family_id), unique(controller_id) | Label printed on the physical button (e.g. "A"). |
|||
| event | text | OS event identifier (e.g. "button_0"). May vary between devices in the family. |
||||
| canonical_name | canonical_control_names | LoadC64 canonical control name (e.g. "button_south"). |
The Logitech family defines controls for all buttons. The Logitech Dual Action controller overrides the events for A and B where the driver reports them differently.
controller_control
| id | controller_family_id | controller_id | name | event | canonical_name |
|---|---|---|---|---|---|
| 1 | 1 | null | A | button_0 | button_south |
| 2 | 1 | null | B | button_1 | button_east |
| 3 | 1 | null | X | button_2 | button_west |
| 4 | 1 | null | Y | button_3 | button_north |
| 5 | 1 | null | Start | button_7 | start |
| 6 | 1 | null | Back | button_8 | back |
| 7 | null | 1 | A | button_1 | button_south |
| 8 | null | 1 | B | button_0 | button_east |