Skip to content

Controller Database

How SDL reads each controller, where its mapping came from, and how to copy, paste, find or guess one, with your own rows kept in PadForge.xml.

PadForge reads gamepads through SDL, which knows a controller's layout from a mapping: one row that says which button is A, which axis is the left stick, and so on. SDL carries its own rows, PadForge's build adds the community SDL_GameControllerDB, and you can download newer community rows or add your own. Every device's panel shows which row it reads through.


The SDL Mapping card

Select a gamepad or joystick on the Devices page. The SDL Mapping card sits under Test Inputs.

Line What it says
Read as A gamepad, “…” with the name in SDL's mapping, A joystick. SDL has no mapping for it., or A joystick. PadForge reads it raw, so SDL’s mapping is not used. A joystick SDL does not read, such as a plugin's device, reads A joystick, laid out as a gamepad by your row. once you add a row for it. A device that is not connected says The device is not connected. SDL reads it once it is., and with the engine stopped the line reads SDL reads devices while the engine runs.
From Where the mapping came from: SDL, The SDL_GAMECONTROLLERCONFIG variable, which SDL holds above any row you add, The community copy built in with its date, Downloaded with its date, PadForge’s own file, or Yours, added with its date.
ID The device's ID as SDL reports it.

The buttons under it:

Button What it does
Copy SDL Mapping Puts the device's mapping on the clipboard as a row of the community database.
Paste SDL Mapping… Takes a row for this device, checks it, keeps it as yours and applies it.
Remove Mine Shows in place of Paste while you have a row for the device. Puts back the row and the controller rows from before.
Find a Mapping… Searches every row PadForge carries by name and applies the one you pick, for a clone whose IDs differ.
Guess a Layout Guesses a gamepad layout from the device's axes, buttons and hats, for a device no database knows. Shows while you have no row for it and SDL has no mapping.

More

The card's More holds:

  • A table for the controller the device is on, with Controller to pick one when it is on several. Each of that controller's rows that reads the device shows its target, Its input now, and SDL’s row says, where SDL's row places that target. A line where the two differ is marked differs.
  • Not used by PadForge: …, the fields of SDL's row that no row of the device's controllers reads.
  • The row itself, under the community ID.
  • Map Again, which makes the device's rows on each controller it is on again from SDL's layout, as assigning it does.
  • Community Database Page, which opens the community database's guide to new mappings.

Copy a mapping

Copy SDL Mapping writes the device's row in the community database's form, under the device's ID with its checksum and version zeroed, as the community's rows are. The bus stays: SDL compares it, so a Bluetooth pad's row keeps its own.

While SDL maps the device, the row is SDL's mapping. For a raw joystick, the row is built from the rows of the controller picked in More. SDL's form holds only a layout, so the result says what it left out: Copied. SDL’s form cannot hold macros, curves and dead zones. The five things it can leave out are macros, curves, dead zones, keyboard and mouse outputs, and turbo, toggles and other actions.

To share a mapping with everyone, send the row to the community database. Community Database Page under More opens its guide.

Paste a mapping

Paste SDL Mapping… opens Paste an SDL Mapping for … with the clipboard's row filled in when it passes the check. It takes one row or a whole gamecontrollerdb.txt, skips comments and rows for other systems, and picks the row SDL would read this device through, then one of the same vendor and product, then the first. The dialog says what it found, such as A row for this device. Windows, 23 fields, its ID matches this device., and which controllers' rows are mapped again from the new layout.

A row is refused, with the reason, when it is empty, over 1,024 characters, not a row of SDL's database, or for another system than Windows (a row for no system in particular is taken). It is refused too for an ID that is not 32 hex digits, a name that is empty, over 128 characters, holds a field marker SDL reads such as type: or holds a character other than letters, digits, punctuation, symbols and the plain space, a hint or Android field, a field or binding SDL does not know, a field given twice, or no binding at all.

Paste keeps the row as yours in PadForge.xml under this device's own ID and hands it to SDL at once, while the engine runs and the device is connected. Otherwise it is kept and used once both are true. Your row wins for that device over every other source but the SDL_GAMECONTROLLERCONFIG variable. The From line then reads Yours, added ….

The device's rows on its controllers are mapped again from the new layout once SDL reads the device through your row. Profile shortcuts that read the device keep the inputs they were set to.

Remove Mine deletes your row, gives SDL back the mapping it had, and puts back the device's rows from before: for the active profile at once, for other profiles the next time each is active.

Find a Mapping and Guess a Layout

Find a Mapping… lists every row PadForge carries, SDL's, the downloaded rows, PadForge's own and yours, with this device's rows first. Search by name, ID or VID:PID, pick a row and click Apply. It goes through the same check as Paste and is kept under this device's own ID, which is what a clone with its own IDs needs. With the engine stopped, the list leaves out the rows SDL holds, its own and the community copy built in, and says so. They are listed once the engine runs.

Guess a Layout builds a layout from the device's axes, buttons and hats and shows it as A guessed layout. Check it in Test Inputs before you click Apply. Once applied it is your row like any other.


The Controller Database row

On Settings, the Updates card holds the Controller Database row. Its line counts what PadForge reads, Built in: … mappings, community copy of … with the date of the copy the release carries, and after a download adds Downloaded …: … new rows, … changed., or Downloaded … from …: … new rows. for an address you set.

Update Now downloads the community database from its own repository on GitHub, or from the address set under Download From, over HTTPS, only when you click it. PadForge keeps, in PadForge.xml, the rows this release lacks, with the time, the source and a SHA-256, and uses them at once (In use at once.).

  • A changed row replaces the community copy's row for that device, never SDL's own or PadForge's.
  • A new row is first used only for a controller that SDL reports as a gamepad or as no particular type, that nothing else reads as a gamepad, that PadForge’s own file has no row for and does not read raw, that no saved assignment names by its vendor and product, and that is not in Force Raw Joystick Mode. Once in use, it stays in use after the controller is assigned, and it stays when a later download no longer carries it.
  • A downloaded row maps no device's rows again.
  • A file is refused whole when it is over 4 MB or under 100 KB, not plain UTF-8 text, or missing more than a fifth of the rows PadForge knows: PadForge refused the download because it is not the controller database it expects. Nothing changed.

The row's reset removes every downloaded row and puts the community's address back. A new release of PadForge drops the downloaded rows it now carries itself.

Download From

Under the row's More, Download From shows the address Update Now downloads from: the community's own file on GitHub unless you set another. Change… takes another HTTPS address, such as a mirror of the community's file when GitHub is out of reach. The address must start with https://, name a host and use the default port, run to 2,048 characters at most, and carry no user name, password or part after #. Every redirect must stay on that host, three at most. From an address that is not the community's, PadForge keeps new rows only: a file from elsewhere carries no date that tells a newer row from an older one, so a changed row from there could roll back a row this release carries. The row's line then names the host the rows came from. Use the Community’s File puts the community's address back, and so do the row's reset and Reset to Defaults. Only you can change the address: no assistant, script or plugin can.

Your Rows

Under the row's More, Your Rows lists how many rows of yours PadForge keeps. Add Rows From a File or the Clipboard… takes many rows at once, for many devices, through the same check as Paste, and keeps each as yours under its own ID. Clear removes them all and gives each device back its reading. Your rows win for their devices over every other source but the SDL_GAMECONTROLLERCONFIG variable, and they stay through the download's reset. PadForge keeps up to 2,048 and never drops one to make room: past that, a row for a new device is not added. The dialog's count says how many rows will be added, and how many will not when they would pass 2,048. Paste on a device's card says Not kept in the same case.

SDL in PadForge reads the SDL_GAMECONTROLLERCONFIG environment variable PadForge started with, as other SDL programs read it. SDL holds a row from it above every row PadForge adds, yours included, and the From line names the variable. When the variable in your Windows profile holds rows SDL did not read at start, such as the ones SDL2 Gamepad Tool's Set Mapping As Environment Variable writes while PadForge runs, and PadForge does not keep them, Your Rows says how many, and Add Rows From a File or the Clipboard… opens with them when the clipboard holds no row. Rows SDL already applies from the variable are left out. Click Add to keep them as yours.

See also: Devices, SDL3 Integration.


Last updated for PadForge 6.1.0.