Cannot use joystick or controller in KEGS, GSPlus, etc.

305 views
Skip to first unread message

Nicola

unread,
Aug 21, 2021, 12:53:11 PM8/21/21
to
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

unread,
Aug 22, 2021, 12:50:19 AM8/22/21
to
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

unread,
Aug 22, 2021, 5:30:03 AM8/22/21
to
On 2021-08-22, Kent Dickey <ke...@provalid.com> wrote:
> In article <sfrb1e$1bkr$1...@gioia.aioe.org>, Nicola <nic...@nohost.org> wrote:
>>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!

> 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).

> 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

> 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

unread,
Aug 22, 2021, 5:30:57 PM8/22/21
to
In article <sft5ep$1fcb$1...@gioia.aioe.org>, Nicola <nic...@nohost.org> wrote:
>On 2021-08-22, Kent Dickey <ke...@provalid.com> wrote:
>> In article <sfrb1e$1bkr$1...@gioia.aioe.org>, Nicola <nic...@nohost.org> wrote:
>>>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!
>
>> 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

unread,
Aug 23, 2021, 4:00:23 AM8/23/21
to
On 2021-08-22, Kent Dickey <ke...@provalid.com> wrote:
> 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.

Well, that was fast, thanks! However...

> 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

unread,
Aug 23, 2021, 4:48:11 AM8/23/21
to
On 2021-08-23, Nicola <nic...@nohost.org> wrote:
> On 2021-08-22, Kent Dickey <ke...@provalid.com> wrote:
>> 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

unread,
Aug 23, 2021, 6:19:31 AM8/23/21
to
I am afraid that GCController may only work with some types of "MFi"
(made for iPhone) controllers...

Nicola

Kent Dickey

unread,
Aug 23, 2021, 9:24:38 AM8/23/21
to
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

unread,
Aug 23, 2021, 3:34:10 PM8/23/21
to
On 2021-08-23, Kent Dickey <ke...@provalid.com> wrote:
> 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

unread,
Sep 7, 2021, 11:34:00 PM9/7/21
to
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

unread,
Sep 10, 2021, 4:43:22 AM9/10/21
to
On 2021-09-08, Kent Dickey <ke...@provalid.com> wrote:
> 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!

> 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

Kent Dickey

unread,
Sep 23, 2021, 9:16:04 PM9/23/21
to
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.

Kent

Nicola

unread,
Oct 3, 2021, 5:41:43 AM10/3/21
to
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

unread,
Oct 3, 2021, 11:38:33 PM10/3/21
to
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

unread,
Oct 7, 2021, 2:12:15 PM10/7/21
to
On 2021-10-04, Kent Dickey <ke...@provalid.com> wrote:
> 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

unread,
Nov 11, 2021, 4:57:54 PM11/11/21
to
The next KEGS release will default to this setting.

Kent

Douglas S

unread,
Dec 21, 2022, 6:03:00 PM12/21/22
to
Do you have anything to do with the GSplus emulator for retropie? -Doug

Kent Dickey

unread,
Dec 22, 2022, 4:39:37 PM12/22/22
to
In article <8897f8b1-2cbd-4926...@googlegroups.com>,
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

unread,
Dec 23, 2022, 2:57:30 AM12/23/22
to

> 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

unread,
Dec 23, 2022, 2:59:17 AM12/23/22
to
sores= stores

Kent Dickey

unread,
Dec 23, 2022, 2:09:23 PM12/23/22
to
In article <dd6d3248-6277-4bda...@googlegroups.com>,
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

unread,
Jan 12, 2023, 2:17:58 AMJan 12
to
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. :)
Reply all
Reply to author
Forward
Message has been deleted
0 new messages