audetto/AppleWin

joystick device name?

Closed this issue · 7 comments

How do I find the joystick device name and how do I tell if AppleWin registers the joystick as usable?

I'm running AppleWin inside the bullseye crouton instance on an arm Chromebook.

Applewin works great. The only difficult I have is figuring out how to associate the USB joystick I have connected.

If go to https://gamepad-tester.com in FireFox in the bullseye instance, it sees the joystick and responds to moving the stick and pressing the buttons so I know the joystick works and is connected to USB and visible to Bullseye.

using jstest-sdl from the command line also finds the joystick and responds to movement and buttons as expected.

when I run AppleWin with the MECC Computer inspector desk that has a joystick test I don't get any response to the joystick test (no button presses, no cursor movement)
https://archive.org/details/MECC-A240_Computer_Inspector_v1.0

./sa2 --gl-swap=0 --device-name /dev/input/by-id/??? -1 MECC-A240_Computer_Inspector_v1.0.dsk
Where ???
is any of:
usb-Trooper_V2_Trooper_V2-event-joystick (what is found in /dev/input/by-id/)
usb-Trooper_V2_Trooper_V2-joystick (what else is found in /dev/inpuit/by-id/)
event6 (what is found in ls -l /dev/input/by-id/)
js0 (what else is found in ls -l /dev/input/by-id/)

jstest-dsl identifies the JoyStick Name: 'Trooper V2'

Options for applen and sa2 are a bit mixed.

I tried to clean it a little.
Use --game-controller and try from 0, 1, 2... it will either print the name of the controller or give an error.

Will probably make it selectable in the settings later.

Thank you for your help. When I load sa2 now I get the error "SDL_GameControllerOpen: Couldn't find mapping for device(?) where ? is the number specified (or 0 if no number is specified._)

I believe the default behavior if nothing is found (--game-controller 5) or nothing is specified (no --game-controller flag set) is that it should ignore the gamepad and continue to load sa2. Right now it drops back to shell.

It looks like the HyperKin Trooper v2 joystick/gamepad is not included in the default SDL2_GAmeControllerDB. I made a new mapping (below) with the SDL2 GamePad Tool. Is it possible to add into AppleWin that it will look in the local directory for gamecontrollerdb.txt to load custom/otherwise not-default supported controllers as described here? https://github.com/gabomdq/SDL_GameControllerDB
http://wiki.libsdl.org/SDL2/SDL_GameControllerAddMappingsFromFile

03000000242e00006a38000000000000,Hyperkin Trooper V2,platform:Windows,a:b0,b:b1,back:b4,start:b5,leftstick:-a4,leftshoulder:b2,rightshoulder:b3,leftx:a0,lefty:a1,

Are you 100% sure that the output for

--game controller 0 and --game-controller 10

is the same except the number in the message?

If this is true, I will go back to ignore bad controller.

And I will look into the mapping file.

Try with the latest code.

  1. if no --game-controller is specified and it does not work, do not throw
  2. add support for mapping file --game-mapping-file
  3. throw if a required controller does not work

Currently these settings are not remembered, I will have to revisit it.

Thank you for your prompt response and update.
When I run lsusb I see:
(bullseye)woz@localhost:~/AppleWIn/build$ lsusb Bus 002 Device 002: ID 0bda:0416 Realtek Semiconductor Corp. 4-Port USB 3.0 Hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 008: ID 2e24:386a Hyperkin Trooper V2 Bus 001 Device 003: ID 0bda:5416 Realtek Semiconductor Corp. 4-Port USB 2.0 Hub Bus 001 Device 002: ID 04ca:707c Lite-On Technology Corp. EasyCamera 1M Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
The joystick is the Hyperkin Trooper V2.

If I run the new version of AppleWin you updated with minimum parameters, it runs fine, but without the joystick.
(bullseye)woz@localhost:~/AppleWIn/build$ ./sa2 --gl-swap=0 -1 MECC-A240_Computer_Inspector_v1.0.dsk SDL_GameControllerOpen: Couldn't find mapping for device (0)

I have a file "gamecontrollerdb.txt" in the build directory that reads:
03000000242e00006a38000000000000,Hyperkin Trooper V2,platform:Windows,a:b0,b:b1,back:b4,start:b5,leftstick:-a4,leftshoulder:b2,rightshoulder:b3,leftx:a0,lefty:a1,
in its entirety.

If I specify the game controller file Applewin runs, but reports it can't map my device.
(bullseye)woz@localhost:~/AppleWIn/build$ ./sa2 --gl-swap=0 -1 MECC-A240_Computer_Inspector_v1.0.dsk --game-mapping-file gamecontrollerdb.txt SDL Game Controller: Loaded 0 mappings SDL_GameControllerOpen: Couldn't find mapping for device (0)
Running Applewin specifying a gamecontroller causes an error no matter the controller number specified 0-10.
(bullseye)woz@localhost:~/AppleWIn/build$ ./sa2 --gl-swap=0 -1 MECC-A240_Computer_Inspector_v1.0.dsk --game-mapping-file gamecontrollerdb.txt --game-controller 0 ERROR: boost::bad_any_cast: failed conversion using boost::any_cast

It appears there is an error in the parsing of the --game-controller flag now.

Fixed, that was bad coding from me.

But you can see the problem:

Loaded 0 mappings

If you use this mapping file

03000000242e00006a38000000000000,Hyperkin Trooper V2,platform:Windows,a:b0,b:b1,back:b4,start:b5,leftstick:-a4,leftshoulder:b2,rightshoulder:b3,leftx:a0,lefty:a1,

I dont think it will work as it is a Windows mapping.

Until you get your mapping to load, it wont work.

Thanks much! It works great now!

I used sdl-jstest ( https://github.com/Grumbel/sdl-jstest ) to find out the linux parameters. I added both the windows and linux parameters to the gamecontrollerdb.txt project. https://github.com/gabomdq/SDL_GameControllerDB