-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB Joystick support? #142
Comments
You know why. Because people who can program have no interest to implement this, while people who want this feature but have no expertise to do this (I'm not implying or referring you in either category) In any case, you can think about how to implement this by reading networking in BII. It is a good learning path. |
How hard is it to implement an ADB device emulator? There were ADB joysticks back in the 1990s. Surely it'd be possible to map the values from say a linux /dev/js device to a virtual ADB device? Would it be easier to load the Thrustmaster drivers for macOS and then map the values from the host OS, or would you implement a driver from scratch as well as the Host OS Mapping? |
Or USB pass-thru. Although that would be limited to Mac OS 8.1 or later and PowerPC. |
This would be good option to have. For example, WinUAE (Amiga emulator) has this option. |
I found some developer documentation on ADB devices: https://developer.apple.com/library/archive/technotes/hw/hw_01.html#Extended Based on this I suspect that a joystick is either going to present itself as either a mouse, or a miscellaneous device. Based on models of joystick I've found, it's likely the quickest thing to implement would be a 4-5 button joystick with X/Y axis and 5 buttons (e.g a CH Mouse Stick II), that identifies itself to the OS as a mouse, but map joystick inputs to it. There is a three-axis joystick I've found called a Gravis Mac Blackhawk. It has 4 buttons and a scroll wheel in addition to X/Y axes. It also has custom drivers. I suspect it appears to the OS as 2 mice and then the drivers do some magic to make it a coherent device. |
I also found this super useful website (you will want to translate from French.) In it the author talks about multiple ADB devices. |
First, forget about USB passthrough. It is not how BII works to handle HID. Secondly, the way it works in BII is that you trigger an event in the host and then BII translate that event into the event in the guest OS. Take SDL2 as an example (see here), SDL2 intercept your joystick's event in your host OS and then translate into ADB event in the guest OS. It should be an easy fix. For sure, you should read the mapping from the table storing form an external file just like the way the existing keyboard code does. Hope this helps. |
It helped a lot, I've started to code up some support for it. I am also reaching out to people to try to get some Apple device ID's sadly lsadb on Linux hasn't got any id's other than keyboards/mice, but I've reached out to some people both online and irl who might be able to help me get some. I've already implemented most of the event handler code, luckily I've used libSDL for joystick handling before so it's been pretty straightforward. Once I have something useful I'll do a pull request. |
Quick update, I got this working, my joystick is pretending to be a mouse, but in Super Wing Commander it's working in joystick mode. Looks like ADB Joysticks are probably just Extended mouse devices. I haven't got multi-button working yet, but it'll happen soon. |
Sweet. Do show a demo in a screencast. Don't forget to send a PR. Have a good weekend! |
I've just been able to make my joystick code resolution independent. This means the joystick will behave correctly at 640x480, 1024x768 or any other resolution in between. This is an important part of the code. I am now moving on to focus on getting more buttons than the first Button working. I will update progress in this thread until I do the pull request itself. The code is quite simple and easy to debug. Currently I am just binding the first joystick automatically, however I have two USB joysticks here so I might tinker with having the used device be selectable via the GUI. |
My Gravis Mousestick II just arrived! I've got a friend loaning me a G3 Power Mac soon. I'm going to sniff the ADB id and see if I can make an identical device appear in Basilisk 2. |
Hi @DMJC! I was just wondering if you ever finished this? I would love for it to be added so I can put sheepshaver on my arcade machine. |
I wasn't able to get more than one button to work on it, but I did get a
joystick mapped with SDL and working like a mac joystick. Happy to provide
code when I'm home a bit later.
…On Fri, 1 Mar 2024, 2:28 pm Finn, ***@***.***> wrote:
Hi @DMJC <https://github.com/DMJC>! I was just wondering if you ever
finished this? I would love for it to be added so I can put sheepshaver on
my arcade machine.
—
Reply to this email directly, view it on GitHub
<#142 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFS2Y6L4Z5TL6PWYM4R7B3YV74FZAVCNFSM4EDKHCV2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJXGI2DMNBSGQ4Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Alright, that would be great! Thanks. |
I don't understand why, but Basilisk II and Sheepshaver have never supported USB Joysticks, or more importantly Analog Joysticks. I've been curious as to whether such support will be added in ever. Anybody have any info on that front?
The text was updated successfully, but these errors were encountered: