jsbeeb icon indicating copy to clipboard operation
jsbeeb copied to clipboard

Joystick support

Open mattgodbolt opened this issue 8 years ago • 10 comments

mattgodbolt avatar Sep 25 '16 12:09 mattgodbolt

If possible, two joystick support would be good, but even if only one is possible, supporting both fire buttons would be good.

richard-broadhurst avatar Sep 27 '16 06:09 richard-broadhurst

Looks like browsers now have good joystick support https://gamepad-tester.com/ although it looks like it might only be xinput drivers on windows.

richard-broadhurst avatar Aug 22 '20 08:08 richard-broadhurst

There's already some undocumented syntax for this in https://github.com/mattgodbolt/jsbeeb/blob/master/main.js

                } else if (key.indexOf("GP.") === 0) {
                    // gamepad mapping
                    // eg ?GP.FIRE2=RETURN
                    var gamepadKey = key.substring(3).toUpperCase(); // remove GP. prefix
                    gamepad.remap(gamepadKey, val.toUpperCase());
                } else {
                    switch (key) {
                        case "LEFT":
                        case "RIGHT":
                        case "UP":
                        case "DOWN":
                        case "FIRE":
                            gamepad.remap(key, val.toUpperCase());
                            break;

Maybe you can test if this still works :)

murkle avatar Aug 23 '20 22:08 murkle

Another request over email (for BBC Joystick emulation to a PC joypad).

mattgodbolt avatar Oct 20 '20 19:10 mattgodbolt

I just tested on iPad 6 with XBox One controller (need to be careful to get the right model, must be Bluetooth 1708) and my old gamepad code still seems to be working 🎉

Apple actually support this officially! https://support.apple.com/en-us/HT210414c

https://www.macworld.com/article/3410800/how-to-pair-an-xbox-one-controller-with-iphone-or-ipad.html

murkle avatar Nov 28 '20 15:11 murkle

That's amazing! Thanks Michael!

On Sat, Nov 28, 2020 at 9:08 AM Michael Borcherds [email protected] wrote:

I just tested on iPad 6 with XBox One controller (need to be careful to get the right model, must be Bluetooth 1708) and my old gamepad code still seems to be working 🎉

Apple actually support this officially! https://support.apple.com/en-us/HT210414c

https://www.macworld.com/article/3410800/how-to-pair-an-xbox-one-controller-with-iphone-or-ipad.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattgodbolt/jsbeeb/issues/128#issuecomment-735242260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2Y5IXTOCMU74RLJYIAALSSEG77ANCNFSM4CQXR4CQ .

-- Matt (he/him)

mattgodbolt avatar Nov 28 '20 19:11 mattgodbolt

Looks like I added support for buttons only, not for the ADC joystick itself

Martin B has made a nice SSD so at least we can test it easily once it's implemented :) https://bbc.godbolt.org/?disc=https://test.geogebra.org/~mike/jsbeeb/JoystickTest.ssd

murkle avatar Dec 06 '20 14:12 murkle

https://github.com/mattgodbolt/jsbeeb/blob/master/adc.js

murkle avatar Dec 06 '20 14:12 murkle

@mattgodbolt https://github.com/murkle/jsbeeb/commit/a0816a1295c2afc721d3443a68ff25b0accd0614 https://github.com/murkle/jsbeeb/commit/0d048c6d81f7db92f6bb5e069fd40f5a49067ee6

Seems to work 😇 https://test.geogebra.org/~mike/jsBeebJoysticks/?autoboot&&disc1=sth%3AAcornsoft%2FSnapper-v2.zip#

murkle avatar Dec 06 '20 16:12 murkle

All good now https://test.geogebra.org/~mike/jsBeebJoysticks/?autorun&loadBasic=https://test.geogebra.org/~mike/jsbeeb/joystickTest.bbc

If we change the "fire" button to A then we should also disable the default mapping of A as <Return>

            // often <Return> = "Fire"
            this.gamepadMapping[0] = BBC.RETURN;

murkle avatar Dec 07 '20 22:12 murkle