Discussion:
Cannot use joystick or controller in KEGS, GSPlus, etc.
(too old to reply)
Nicola
2021-08-21 16:53:02 UTC
Permalink
Hi,
I have an original Apple Joystick and a modern controller. Both can be
connected via USB to my Mac running macOS 10.13. Both input devices are
recognized, and movements and buttons work as expected: I have verified
that with an app call Joystick Show, and also using Virtual ][.

But none of them seems to work with any IIGS emulator. I have tried
Sweet16 3.0.3, GSPlus 0.14, and the recently updated KEGS 1.11. Since
the results (or lack thereof) are the same for all of them, I am likely
skipping some mandatory configuration. Can you help?

This is what I have done in each emulator:

- Sweet16: I make sure that Setup > Joystick support is checked.

- GSPlus: F4 > Joystick Configuration > Joystick Emulation is already
set to Native Joystick 1 (which I believe to be correct), but I have
also tried with Native Joystick 2. I "Save Changes to configuration
file" to be sure that the settings stick.

- KEGS: same procedure as GSPlus.

I have tried with several games, but none receives input from the
joystick. Any idea how to debug that?

Nicola
Kent Dickey
2021-08-22 04:50:14 UTC
Permalink
Post by Nicola
Hi,
I have an original Apple Joystick and a modern controller. Both can be
connected via USB to my Mac running macOS 10.13. Both input devices are
recognized, and movements and buttons work as expected: I have verified
that with an app call Joystick Show, and also using Virtual ][.
But none of them seems to work with any IIGS emulator. I have tried
Sweet16 3.0.3, GSPlus 0.14, and the recently updated KEGS 1.11. Since
the results (or lack thereof) are the same for all of them, I am likely
skipping some mandatory configuration. Can you help?
- Sweet16: I make sure that Setup > Joystick support is checked.
- GSPlus: F4 > Joystick Configuration > Joystick Emulation is already
set to Native Joystick 1 (which I believe to be correct), but I have
also tried with Native Joystick 2. I "Save Changes to configuration
file" to be sure that the settings stick.
- KEGS: same procedure as GSPlus.
I have tried with several games, but none receives input from the
joystick. Any idea how to debug that?
Nicola
I wrote KEGS. On a Mac, I don't know how to access the joystick, and so KEGS
doesn't support joysticks on a Mac. If you can help provide pointers to how
to do this, I can code it in KEGS. Or if someone who knows how to do this in
a Mac could share that info with me, that would be great. Or if you could
share the source to Joystick Show with me.

KEGS supports joysticks on Linux (and Windows) since someone shared that
code with me a long time ago.

Kent
Nicola
2021-08-22 09:30:01 UTC
Permalink
Post by Kent Dickey
Post by Nicola
Hi,
I have an original Apple Joystick and a modern controller.
But none of them seems to work with any IIGS emulator. I have tried
Sweet16 3.0.3, GSPlus 0.14, and the recently updated KEGS 1.11.
I wrote KEGS.
Thanks for the time you and the other developers invest to keep ol'good
times alive!
Post by Kent Dickey
On a Mac, I don't know how to access the joystick, and so KEGS
doesn't support joysticks on a Mac.]
Good to know. I assume that the same holds for the other emulators (but
see below).
Post by Kent Dickey
If you can help provide pointers to how to do this, I can code it in
KEGS.
If that can be done in Obj-C or Swift, this is the official documentation:

https://developer.apple.com/library/archive/documentation/ServicesDiscovery/Conceptual/GameControllerPG/Introduction/Introduction.html
https://developer.apple.com/documentation/gamecontroller
Post by Kent Dickey
Or if someone who knows how to do this in a Mac could share that info
with me, that would be great. Or if you could share the source to
Joystick Show with me.
Unfortunately, Joystick Show is not open source. All I could find is
some sample code from Apple, in Swift:

https://developer.apple.com/documentation/gamecontroller/supporting_game_controllers/

Judging from the following GitHub issue in GSPlus's repo (which seems to
share some code with KEGS), though, it seems that detecting a joystick
in macOS should, at least partially, work:

https://github.com/digarok/gsplus/issues/87

Nicola
Kent Dickey
2021-08-22 21:30:51 UTC
Permalink
Post by Nicola
Post by Kent Dickey
Post by Nicola
Hi,
I have an original Apple Joystick and a modern controller.
But none of them seems to work with any IIGS emulator. I have tried
Sweet16 3.0.3, GSPlus 0.14, and the recently updated KEGS 1.11.
I wrote KEGS.
Thanks for the time you and the other developers invest to keep ol'good
times alive!
Post by Kent Dickey
On a Mac, I don't know how to access the joystick, and so KEGS
doesn't support joysticks on a Mac.]
Good to know. I assume that the same holds for the other emulators (but
see below).
OK, based on your information, I think I've made Mac joysticks work in KEGS.
This was easier than I expected since Apple DID have a sample project (I just
didn't find it right away). I didn't know you could just plug in PS4
controllers to your Mac with a USB cable, so I did that, and made it work
under KEGS 1.12. You can download KEGS.1.12 at:

http://kegs.sourceforge.net/

Select "Native Joystick 1" from the Joystick Configuration sub-menu, from the
configuration settings you can change after pressing F4.

There are issues. The PS4 joysticks are "circular", so moving to a "corner"
doesn't move to a corner like a real Apple II joystick would. For instance,
moving to the upper right would be x=255,y=0 on an Apple II joystick, but it's
something like x=200,y=30 on my PS4 controller. It seemed to work "OK" if I
changed the "Joystick Scale X/Y" to 20%, which just magnifies the values being
read. How would you like to handle this? I also made the left stick the
"joystick", the right stick (if it exists) is ignored. As for all the
buttons, I kinda assigned them randomly to button 0 and button 1. I don't
know what makes sense. Try it, and let me know what button you're pressing,
what you get, and what you'd like to get. Oh, and I ignore the D-pad.
Controllers other than PS4 controllers should work, that's just what I had.

The Apple IIgs gameport supports two joysticks, and a total of 4 buttons.
I guess KEGS could support multiple joysticks--is that something I should
implement? Or should the right stick be the second joystick, and map more
buttons for the second joystick? Again, let me know what you'd like, and I'll
try to implement it.

If a joystick isn't detected, then Joystick Emulation will jump back to
Keypad Joystick when you go back to the F4 page.

(This is not a release I'm going to announce generally since it just adds
the joystick stuff, and it's honestly probably not useful yet, I need
feedback).

Kent
Nicola
2021-08-23 08:00:22 UTC
Permalink
Post by Kent Dickey
OK, based on your information, I think I've made Mac joysticks work in KEGS.
This was easier than I expected since Apple DID have a sample project (I just
didn't find it right away). I didn't know you could just plug in PS4
controllers to your Mac with a USB cable, so I did that, and made it work
http://kegs.sourceforge.net/
Select "Native Joystick 1" from the Joystick Configuration sub-menu, from the
configuration settings you can change after pressing F4.
Well, that was fast, thanks! However...
Post by Kent Dickey
If a joystick isn't detected, then Joystick Emulation will jump back to
Keypad Joystick when you go back to the F4 page.
That is what I am seeing. When I choose "Native Joystick 1", the config
is updated with `g_joystick_type = 2`, but when I go back to the F4
page, it's still set to "Keypad Joystick". The input device does not
work, of course.

I don't think it matters, but my controller is Logitech. My Apple
Joystick is plugged via a DB8-to-USB adapter, and is treated like
a controller with only a left pad and two buttons by any software I have
thrown at it (Virtual ][, Joystick Show, RetroPie, ...).

I'll be gladly provide more feedback when I get this sorted out!

Nicola
Nicola
2021-08-23 08:48:10 UTC
Permalink
Post by Nicola
Post by Kent Dickey
If a joystick isn't detected, then Joystick Emulation will jump back to
Keypad Joystick when you go back to the F4 page.
That is what I am seeing.
I have played a bit with your source code and the sample code provided
by Apple. In both, calling controllers() on GCController returns an
empty list, even if a controller is attached. So, I am at a loss,
because at the same time apps such as Joystick Show and Virtual ][ see
the controller without issues.

Nicola
Nicola
2021-08-23 10:19:30 UTC
Permalink
Post by Nicola
Post by Nicola
Post by Kent Dickey
If a joystick isn't detected, then Joystick Emulation will jump back to
Keypad Joystick when you go back to the F4 page.
That is what I am seeing.
I have played a bit with your source code and the sample code provided
by Apple. In both, calling controllers() on GCController returns an
empty list, even if a controller is attached. So, I am at a loss,
because at the same time apps such as Joystick Show and Virtual ][ see
the controller without issues.
I am afraid that GCController may only work with some types of "MFi"
(made for iPhone) controllers...

Nicola
Kent Dickey
2021-08-23 13:24:32 UTC
Permalink
Post by Nicola
Post by Nicola
Post by Kent Dickey
If a joystick isn't detected, then Joystick Emulation will jump back to
Keypad Joystick when you go back to the F4 page.
That is what I am seeing.
I have played a bit with your source code and the sample code provided
by Apple. In both, calling controllers() on GCController returns an
empty list, even if a controller is attached. So, I am at a loss,
because at the same time apps such as Joystick Show and Virtual ][ see
the controller without issues.
Nicola
OK, that could be--your joystick works, but not through GCController.

Can you find any program which can use your joystick, and which has source
code available? I think you're saying the Apple GCController sample code
does not see your joystick, so the code which works must be doing something
differently. You could try other emulators (VirtualC64 has full source)
and see if you can find one which detects and uses your joystick. Does
MAME detect your joystick? However, figuring out how MAME works is not
easy for me since it is difficult to build.

Kent
Nicola
2021-08-23 19:34:09 UTC
Permalink
Post by Kent Dickey
OK, that could be--your joystick works, but not through GCController.
Can you find any program which can use your joystick, and which has source
code available? I think you're saying the Apple GCController sample code
does not see your joystick, so the code which works must be doing something
differently. You could try other emulators (VirtualC64 has full source)
and see if you can find one which detects and uses your joystick.
VirtualC64 detects both of my input devices. Skimming through the source
code, it appears to use IOKit.hid. This should be the documentation of
the used framework:

https://developer.apple.com/documentation/hiddriverkit

Nicola
Kent Dickey
2021-09-08 03:33:54 UTC
Permalink
Post by Nicola
Post by Kent Dickey
OK, that could be--your joystick works, but not through GCController.
Can you find any program which can use your joystick, and which has source
code available? I think you're saying the Apple GCController sample code
does not see your joystick, so the code which works must be doing something
differently. You could try other emulators (VirtualC64 has full source)
and see if you can find one which detects and uses your joystick.
VirtualC64 detects both of my input devices. Skimming through the source
code, it appears to use IOKit.hid. This should be the documentation of
https://developer.apple.com/documentation/hiddriverkit
Nicola
I have purchased a 15-pin joystick to USB adapter, and I can make my old
Apple II joystick work in Virtual ][ (so the hardware works). Unfortunately,
I've not had time to really figure this HID software stuff out. I'll get to
it soon.

Kent
Nicola
2021-09-10 08:43:21 UTC
Permalink
Post by Kent Dickey
I have purchased a 15-pin joystick to USB adapter, and I can make my old
Apple II joystick work in Virtual ][ (so the hardware works).
Wow, that's real commitment to the project!
Post by Kent Dickey
Unfortunately, I've not had time to really figure this HID software
stuff out. I'll get to it soon.
Thanks! I hope you will be able to take advantage of the existing code
in Virtual C64!

Nicola
Nicola
2021-10-03 09:41:42 UTC
Permalink
Post by Nicola
Post by Kent Dickey
I have purchased a 15-pin joystick to USB adapter, and I can make my old
Apple II joystick work in Virtual ][ (so the hardware works).
Wow, that's real commitment to the project!
Post by Kent Dickey
Unfortunately, I've not had time to really figure this HID software
stuff out. I'll get to it soon.
Thanks! I hope you will be able to take advantage of the existing code
in Virtual C64!
Nicola
Try kegs.1.13.tar.gz from http://kegs.sourceforge.net/. I now use the
older IOHID code (following the example of Virtual C64) to make my USB
joystick work, and my Sony PS4 controller still works, too.
Yeah, my joysticks work great, too! Thanks a lot!

I have tried it on macOS 10.13 and 11.6. KEGS appears to be a lot
snappier on older macOS: scrolling through the configuration is
significantly slower on Big Sur. Also, KEGS starts stuttering when in
full-screen in Big Sur. I have no issues with High Sierra, not even when
in full-screen mode.

Besides, I have to launch KEGS from the terminal: if I double-click on
the app, it doesn't seem to pick up config.kegs. And in High Sierra,
when I launch the KEGS app, it crashes as soon as I try to save or exit
the configuration screen. When I launch KEGS from the terminal
everything is fine.

The above are not big issues for me: I am using KEGS with the older Mac
anyway, and it's fine for me to start it from the command-line. But you
may want to look into them.

Going back in time with Alien Mind now :)

Thanks again!
Nicola
Kent Dickey
2021-10-04 03:38:28 UTC
Permalink
Post by Nicola
Post by Nicola
Post by Kent Dickey
I have purchased a 15-pin joystick to USB adapter, and I can make my old
Apple II joystick work in Virtual ][ (so the hardware works).
Wow, that's real commitment to the project!
Post by Kent Dickey
Unfortunately, I've not had time to really figure this HID software
stuff out. I'll get to it soon.
Thanks! I hope you will be able to take advantage of the existing code
in Virtual C64!
Nicola
Try kegs.1.13.tar.gz from http://kegs.sourceforge.net/. I now use the
older IOHID code (following the example of Virtual C64) to make my USB
joystick work, and my Sony PS4 controller still works, too.
Yeah, my joysticks work great, too! Thanks a lot!
I have tried it on macOS 10.13 and 11.6. KEGS appears to be a lot
snappier on older macOS: scrolling through the configuration is
significantly slower on Big Sur. Also, KEGS starts stuttering when in
full-screen in Big Sur. I have no issues with High Sierra, not even when
in full-screen mode.
Besides, I have to launch KEGS from the terminal: if I double-click on
the app, it doesn't seem to pick up config.kegs. And in High Sierra,
when I launch the KEGS app, it crashes as soon as I try to save or exit
the configuration screen. When I launch KEGS from the terminal
everything is fine.
KEGS uses a very simple way to draw to the screen. Apple has decided to
do a TON of work to process the pixels (which I used every means I
could figure out to ask it not to), so that on some Macs, KEGS draws to
the screen extremely slowly. On other Macs, it works fine.

Every other app avoids this by writing 1500 lines of complex code to use
Metal to just send pixels to the screen. I have not done this yet.

One user suggested doing Cmd-I on the KEGSMAC.app icon, and selecting
"Open in Low Resolution" button. I've not fully confirmed this, but
it might help.

KEGS doesn't fully support being run by the Finder yet. I'm working on it.
If you place config.kegs and your ROM file in your home directory, then
running KEGS from the Finder (double-clicking on it) will work.

Kent
Nicola
2021-10-07 18:12:14 UTC
Permalink
Post by Kent Dickey
One user suggested doing Cmd-I on the KEGSMAC.app icon, and selecting
"Open in Low Resolution" button. I've not fully confirmed this, but
it might help.
That help indeed, thanks!
Nicola
Kent Dickey
2021-11-11 21:57:47 UTC
Permalink
Post by Nicola
Post by Kent Dickey
One user suggested doing Cmd-I on the KEGSMAC.app icon, and selecting
"Open in Low Resolution" button. I've not fully confirmed this, but
it might help.
That help indeed, thanks!
Nicola
The next KEGS release will default to this setting.

Kent
Douglas S
2022-12-21 23:02:59 UTC
Permalink
Post by Kent Dickey
Post by Nicola
Post by Kent Dickey
One user suggested doing Cmd-I on the KEGSMAC.app icon, and selecting
"Open in Low Resolution" button. I've not fully confirmed this, but
it might help.
That help indeed, thanks!
Nicola
The next KEGS release will default to this setting.
Kent
Do you have anything to do with the GSplus emulator for retropie? -Doug
Kent Dickey
2022-12-22 21:39:36 UTC
Permalink
Post by Douglas S
Post by Kent Dickey
Post by Nicola
Post by Kent Dickey
One user suggested doing Cmd-I on the KEGSMAC.app icon, and selecting
"Open in Low Resolution" button. I've not fully confirmed this, but
it might help.
That help indeed, thanks!
Nicola
The next KEGS release will default to this setting.
Kent
Do you have anything to do with the GSplus emulator for retropie? -Doug
No. GSPlus is by Dagen Brock, who has made many modifications to KEGS.
I just googled retropie, so I have now heard of it at least. What are you
using retropie for?

Kent
Douglas S
2022-12-23 07:57:29 UTC
Permalink
No. GSPlus is by Dagen Brock, who has made many modifications to KEGS.
I just googled retropie, so I have now heard of it at least. What are you
using retropie for?
Kent
I use it to emulate a total of 50 systems from Apple 2 and old computers to arcade games and consoles up until 1999/2000.

Does your emulator play apple 2 gs games... especially Ancient Glory, Sensei, The Gate and Shufflepuck Cafe?? With joystick? Is there a port for it that someone has made for the Retropie?
Thanks for looking up “retropie”. Barnes and Noble has entire magazines devoted to them in their sores :)
Douglas S
2022-12-23 07:59:15 UTC
Permalink
sores= stores
Kent Dickey
2022-12-23 19:09:22 UTC
Permalink
Post by Douglas S
No. GSPlus is by Dagen Brock, who has made many modifications to KEGS.
I just googled retropie, so I have now heard of it at least. What are you
using retropie for?
Kent
I use it to emulate a total of 50 systems from Apple 2 and old computers
to arcade games and consoles up until 1999/2000.
Does your emulator play apple 2 gs games... especially Ancient Glory,
Sensei, The Gate and Shufflepuck Cafe?? With joystick? Is there a port
for it that someone has made for the Retropie?
Thanks for looking up “retropie”. Barnes and Noble has entire
magazines devoted to them in their sores :)
I couldn't find instructions on compiling Retropie from source, so the whole
project appears to be a "dead end"--grabbing others work, putting a light
wrapper around it, and killing the original projects by only distributing
binaries. It looks like it's a "fork" of RetroArch, which is it's own type
of "dead end".

KEGS runs just about all Apple IIgs games. If you find one that doesn't
work, I'll fix it. KEGS supports joysticks on Linux and Mac. See
http://kegs.sourceforge.net/. KEGS is GPLv3, so it is required to distribute
source if you repackage it.

Kent
Douglas S
2023-01-12 07:17:57 UTC
Permalink
Post by Kent Dickey
Post by Douglas S
No. GSPlus is by Dagen Brock, who has made many modifications to KEGS.
I just googled retropie, so I have now heard of it at least. What are you
using retropie for?
Kent
I use it to emulate a total of 50 systems from Apple 2 and old computers
to arcade games and consoles up until 1999/2000.
Does your emulator play apple 2 gs games... especially Ancient Glory,
Sensei, The Gate and Shufflepuck Cafe?? With joystick? Is there a port
for it that someone has made for the Retropie?
Thanks for looking up “retropie”. Barnes and Noble has entire
magazines devoted to them in their sores :)
I couldn't find instructions on compiling Retropie from source, so the whole
project appears to be a "dead end"--grabbing others work, putting a light
wrapper around it, and killing the original projects by only distributing
binaries. It looks like it's a "fork" of RetroArch, which is it's own type
of "dead end".
KEGS runs just about all Apple IIgs games. If you find one that doesn't
work, I'll fix it. KEGS supports joysticks on Linux and Mac. See
http://kegs.sourceforge.net/. KEGS is GPLv3, so it is required to distribute
source if you repackage it.
Kent
The last 2 .gsp files i created work and load the games but the joypad does not work. I think i need a keyboard joypad for the first game and a mouse joystick for the 2nd. The first needing to emulate the keypad presses 8,3,4,6 and 5. And Left Alt to fire. The second needing to emulate a mouse with the joypad. Currently i need a keyboard to play the first game and a mouse to play the second and I'd like to use the joypad for both. :)
Douglas S
2023-01-12 07:18:39 UTC
Permalink
Post by Douglas S
Post by Kent Dickey
Post by Douglas S
No. GSPlus is by Dagen Brock, who has made many modifications to KEGS.
I just googled retropie, so I have now heard of it at least. What are you
using retropie for?
Kent
I use it to emulate a total of 50 systems from Apple 2 and old computers
to arcade games and consoles up until 1999/2000.
Does your emulator play apple 2 gs games... especially Ancient Glory,
Sensei, The Gate and Shufflepuck Cafe?? With joystick? Is there a port
for it that someone has made for the Retropie?
Thanks for looking up “retropie”. Barnes and Noble has entire
magazines devoted to them in their sores :)
I couldn't find instructions on compiling Retropie from source, so the whole
project appears to be a "dead end"--grabbing others work, putting a light
wrapper around it, and killing the original projects by only distributing
binaries. It looks like it's a "fork" of RetroArch, which is it's own type
of "dead end".
KEGS runs just about all Apple IIgs games. If you find one that doesn't
work, I'll fix it. KEGS supports joysticks on Linux and Mac. See
http://kegs.sourceforge.net/. KEGS is GPLv3, so it is required to distribute
source if you repackage it.
Kent
The last 2 .gsp files i created work and load the games but the joypad does not work. I think i need a keyboard joypad for the first game and a mouse joystick for the 2nd. The first needing to emulate the keypad presses 8,3,4,6 and 5. And Left Alt to fire. The second needing to emulate a mouse with the joypad. Currently i need a keyboard to play the first game and a mouse to play the second and I'd like to use the joypad for both. :)
Loading...