Gamepad emulator and panda

Continuing the discussion from ButtonThrower and button events:

So I put it in both panda/bin and system32, it still doesnt work. The emulator didnt want me to create it in system32 so I tried it manually. Tried both 64 and 32 bit.
Usually I just have to direct it in the games folder where the .exe is. It puts the dll there.
Also tried the python.exe folder.

edit: Here you can get the emulator if you want to test it
edit2: I use the 64bit one.

What problem are you trying to solve? An error message? If so, can you share it?

No, trying to get it detected by my game/panda.

edit: No idea which .exe to choose, since there is no executable for the game or which one is for panda.
When my game runs, in task manager it shows python.exe but that didnt work.

So what made you think that that DLL was the problem? Did you see an error message suggesting that was the case?

If you set notify-level-device debug in Config.prc you should see more information about Panda loading the DLL.

Ok, sorry, I didnt read the joystick section. By the debug info it detects the gamepad. But

gamepad = base.devices.getDevices(InputDevice.DeviceClass.gamepad)[0]

gives me InputDeviceSet index out of range, do I need to do something before that?

the debug info btw

:device(debug): Started input device listener thread.
:device(debug): GIDC_ARRIVAL: \\?\HID#VID_2563&PID_0523#6&3469ea92&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
:device(debug): Successfully loaded hid.dll
:device(debug): Found flight_stick device "PS3/PC Adaptor" with 18 data indices, 2 button caps, 5 value caps
:device(debug): Found button range: DataIndex=5..16, ReportID=0, UsagePage=0x9, Usage=0x1..0xc
:device(debug): Found button: DataIndex=17, ReportID=0, UsagePage=0xff00, Usage=0x1
:device(debug): Found value: DataIndex=0, ReportID=0, UsagePage=0x1, Usage=0x35, LogicalMin=0, LogicalMax=255
:device(debug): Found value: DataIndex=1, ReportID=0, UsagePage=0x1, Usage=0x32, LogicalMin=0, LogicalMax=255
:device(debug): Found value: DataIndex=2, ReportID=0, UsagePage=0x1, Usage=0x31, LogicalMin=0, LogicalMax=255
:device(debug): Found value: DataIndex=3, ReportID=0, UsagePage=0x1, Usage=0x30, LogicalMin=0, LogicalMax=255
:device(debug): Found value: DataIndex=4, ReportID=0, UsagePage=0x1, Usage=0x39, LogicalMin=0, LogicalMax=7
:device(debug): Discovered input device PS3/PC Adaptor (connected), flight_stick, 16 buttons, 4 axes

edit: Oh, I see, it detected it as flight_stick. Can I correct it somehow?
edit:2 Sooo, it gets detected even without the emulator DLL. Triangle which should be button1 is sending trigger and changing the layout in the emulator doesnt change it. Im guessing the reason I need the emulator for games is because they detect it also as flight stick and because of that it doesnt work without the emulator. So I think panda doesnt detect the emulator, which is what I need.

Could you run in the gamepad sample program folder and let me know which buttons/axes are mapped to which buttons/axes in Panda? We can probably add the appropriate mapping to Panda.

I could if you want. For me, I would rather get the emulator going. The thing is, this is PS2 controller connected through a usb adapter. I dont think adding it would be a use to many people but lots of people use emulators because you can change the sensitivity, deadzones, have various profiles etc.

Please file a feature request for supporting the emulator in GitHub.

I would still appreciate knowing the mapping so that we can handle your gamepad out of the box.

  Name        : PS3/PC Adaptor
  Type        : flight_stick
  ID          : 2563:0523
  Axes        : 4 (yaw, throttle, pitch, roll)
  Buttons     : 16 (trigger, joystick2, joystick3, joystick4, joystick5, joystick6, joystick7, joystick8, joystick9, joystick10, joystick11, joystick12, hat_left, hat_right, hat_down, hat_up)

Is this enough? trigger is button 1 / left stick is pitch(up/down) + roll / right stick: yaw(up/down) + throttle

I dont have GitHub and dont know how to request a feature there.

No, I need to know which axis/button is triggered by which input. That means pressing every button and writing down which slider/button is engaged for that button in Panda.

It seems mapped almost perfectly. It probably just needs to change the type.
Button1: trigger
B2-B12: joystick2 - joystick12
D-pad correlates: hat_left, hat_right, hat_down, hat_up
Left stick:
left - roll slider goes left / right opposite
up - pitch slider goes left / down opposite
Right stick:
left - throttle goes left / right opposite
up - yaw goes right / down opposite

Thanks. What are B2-B12? Are the buttons numbered on your gamepad? Do you have a picture of it if so?

Its Button2-Button12

Perfect, thanks.

I am adding support for the gamepad to 1.10.9.

I also tried X360CE and… it works fine for me. I just had to go to the Issues tab in X360CE and Install the virtual device driver. Did you perhaps not yet do this? I used version 4.x, is that the same version you used?

Note that Panda only loads the XInput DLL and checks for XInput devices once it receives an event from the operating system that an XInput device has been found. So emulators that simply swap out the XInput DLL (like, apparently, the older X360CE 3.x) without also registering a virtual device with the operating system won’t work.

I suggest trying X360CE 4.x. If you can’t use it for some reason then I will have to check whether we can add a config variable to Panda to forcibly load XInput always—I would rather not enable this by default because loading XInput and checking for devices all the time is rather slow.

Yeah, I was using the 3.2 version. :frowning: and avoided the 4.x since it keeps asking me to download some drivers for x360 controller and when I clicked “Ignore” it would crash. But I tried it again and figured that if I select “Ignore All”, it doesnt crash.
Anyways, I use the 4.x version now and it works. Thanks!

This version of Panda3D should have support for your gamepad:
If you try it, let me know whether it is mapped properly.

Seems good.