Skip to content

[CONTROLLERS] Multiple controllers on different ports don't stick after restart of engine #6420

@Tartifless

Description

@Tartifless

Hello,
WINDOWS 11 OS, last version of soh.

When setting up 2 controllers (port 1 and port 2), the controller assignment to ports 1 and 2 do not stick and all controllers get assigned to port 1 upon restart.
It seems there is no information of controller ID (instanceID or index) used in json settings files, which indeed makes the engine unable to determine which controller should be assigned to which port.

Example of settings:
port 1:

Image

port2:

Image

Upon restart:

Image

And port 2:

Image

As a hint, other emulators usually use an index or the controller guid to store the information of which controller was assigned to which port, however, using GUID is not recommended as 2 controllers can use the same GUID (people do tend to have multiple time the same controller).

Using SDL index / instance ID can be a good idea, even though it might revert P1 and P2 upon restart, that's not a big issue, controllers are usually enumerated in a similar order upon restart and with SDL button IDs are similar for the same position on the device.
At least that would allow keeping separate controllers by port upon restart, even in case they are reverted.

Adding some json parameter like controllerIndex would be a quick way to do it:
"Port2": {
"Buttons": {
"1024ButtonMappingIds": "P1-B1024-SDLB12,",
"16384ButtonMappingIds": "P1-B16384-SDLB1,",
"16ButtonMappingIds": "P1-B16-SDLA5-ADP,",
"1ButtonMappingIds": "P1-B1-SDLA2-ADP,",
"2048ButtonMappingIds": "P1-B2048-SDLB11,",
"256ButtonMappingIds": "P1-B256-SDLB14,",
"2ButtonMappingIds": "P1-B2-SDLA2-ADN,",
"32768ButtonMappingIds": "P1-B32768-SDLB0,",
"32ButtonMappingIds": "P1-B32-SDLB9,",
"4096ButtonMappingIds": "P1-B4096-SDLB6,",
"4ButtonMappingIds": "P1-B4-SDLA3-ADP,",
"512ButtonMappingIds": "P1-B512-SDLB13,",
"8192ButtonMappingIds": "P1-B8192-SDLA4-ADP,",
"8ButtonMappingIds": "P1-B8-SDLA3-ADN,"
},
"HasConfig": 1,
"LEDMappingIds": "",
"ControllerIndex": 0,
....

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions