samuelgr/Xidi

DigitalGamepad with extra buttons

Closed this issue · 9 comments

How do I configure extra buttons for Type=DigitalGamepad ?
This cfg doesn't work:

[Mapper]
Type = DigitalGamepad

; These changes are applied on top of the template.
ButtonA             = Button(4)
ButtonB             = Button(3)
ButtonX             = Button(2)
ButtonY             = Button(1)

it fails saying ButtonA etc. are unknown. My goal is to force my Hori Fighting Stick MINI arcade stick (DPAD for directions + 8 buttons) as LS controller with at least 4 buttons.

With Type = DigitalGamepad it works fine, but the emulator then detects just 1 fire button.

You need to put your customizations into a custom mapper. Try this instead:

[Mapper]
Type = Custom

[CustomMapper]
Template = DigitalGamepad

; These changes are applied on top of the template.
ButtonA             = Button(4)
ButtonB             = Button(3)
ButtonX             = Button(2)
ButtonY             = Button(1)

Doesn't seem to be working: Log
Always shows 1 button only...

You might need to change the mapping scheme then.

Does the application actually support multiple gamepad buttons, and if so does it work with another controller with or without Xidi?

You can try mapping to a keyboard button. For example:

; Maps the A button on the controller to the X key on the keyboard
ButtonA = Keyboard(X)

Thanks...
Yes "forcing" ButtonB = Keyboard(z)... does work as expected and the buttons get mapped to the corresponding key in the emu now. The strange thing is that it always sees one single button joystick only:
image
Of course if I use the XBox One BT controller it shows correctly all the buttons. Same if I use XInputPlus wrapper with the Hori Fighting Stick Mini: the emulator gives me all the expected buttons to be remapped internally...

P.S.
Consider originally emulated ZX Spectrum joystick had one button only, so it's the default for the emulator.

Digging in a little bit more, it looks like there are some bugs that affect how the game enumerates objects (more specifically, buttons).

One of them is an API issue that can be fixed pretty easily, and the other of which might need a workaround.

This is partially addressed by 9efe81a.

The emulator is doing something strange in terms of how it figures out the return value from a call to EnumObjects, which is used to enumerate virtual controller objects like axes, buttons, and so on. For axes it seems fine, but for buttons it seems to be reading memory it shouldn't be reading.

For the system's DirectInput implementation and XInput Plus it seems to get back a non-zero value, which is interpreted as "give me more buttons." But with Xidi it is somehow computing zero, which means "stop giving me buttons." This is why it is only seeing one button with Xidi.

I added a workaround that ignores the return code from the application and enumerates all objects regardless of what the application says. It appears to fix this issue.

Please give this development build a try, along with the supplied configuration.

Xidi-v4.1.1-dev.6.0+a8e64f50.zip

Xidi.ini:

[Mapper]
Type = DigitalGamepad

[Workarounds]
IgnoreEnumObjectsCallbackReturnCode = yes

Works fine as expected now! All buttons are available and remappable from within the emulator.

Great, glad to hear that this fixes the problem.