Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II Emulation » Cannot use joystick or controller in KEGS, GSPlus, etc.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410569] Sat, 21 August 2021 12:53 Go to next message
Anonymous
Karma:
Originally posted 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?

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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410572 is a reply to message #410569] Sun, 22 August 2021 00:50 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <sfrb1e$1bkr$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> 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

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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410576 is a reply to message #410572] Sun, 22 August 2021 05:30 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-08-22, Kent Dickey <kegs@provalid.com> wrote:
> In article <sfrb1e$1bkr$1@gioia.aioe.org>, Nicola <nicola@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/Se rvicesDiscovery/Conceptual/GameControllerPG/Introduction/Int roduction.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/sup porting_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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410586 is a reply to message #410576] Sun, 22 August 2021 17:30 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <sft5ep$1fcb$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> On 2021-08-22, Kent Dickey <kegs@provalid.com> wrote:
>> In article <sfrb1e$1bkr$1@gioia.aioe.org>, Nicola <nicola@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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410592 is a reply to message #410586] Mon, 23 August 2021 04:00 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-08-22, Kent Dickey <kegs@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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410593 is a reply to message #410592] Mon, 23 August 2021 04:48 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-08-23, Nicola <nicola@nohost.org> wrote:
> On 2021-08-22, Kent Dickey <kegs@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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410594 is a reply to message #410593] Mon, 23 August 2021 06:19 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-08-23, Nicola <nicola@nohost.org> wrote:
> On 2021-08-23, Nicola <nicola@nohost.org> wrote:
>> On 2021-08-22, Kent Dickey <kegs@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.

I am afraid that GCController may only work with some types of "MFi"
(made for iPhone) controllers...

Nicola
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410596 is a reply to message #410593] Mon, 23 August 2021 09:24 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <sfvnca$je8$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> On 2021-08-23, Nicola <nicola@nohost.org> wrote:
>> On 2021-08-22, Kent Dickey <kegs@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

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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410605 is a reply to message #410596] Mon, 23 August 2021 15:34 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-08-23, Kent Dickey <kegs@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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410832 is a reply to message #410605] Tue, 07 September 2021 23:33 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <sg0t7h$1g8n$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> On 2021-08-23, Kent Dickey <kegs@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

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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #410878 is a reply to message #410832] Fri, 10 September 2021 04:43 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-09-08, Kent Dickey <kegs@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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #411190 is a reply to message #410878] Thu, 23 September 2021 21:15 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <shf5r9$420$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> On 2021-09-08, Kent Dickey <kegs@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

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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #411536 is a reply to message #411190] Sun, 03 October 2021 05:41 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-09-24, Kent Dickey <kegs@provalid.com> wrote:
> In article <shf5r9$420$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
>> On 2021-09-08, Kent Dickey <kegs@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
>
> 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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #411566 is a reply to message #411536] Sun, 03 October 2021 23:38 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <sjbtsm$1f06$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> On 2021-09-24, Kent Dickey <kegs@provalid.com> wrote:
>> In article <shf5r9$420$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
>>> On 2021-09-08, Kent Dickey <kegs@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
>>
>> 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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #411743 is a reply to message #411566] Thu, 07 October 2021 14:12 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Nicola

On 2021-10-04, Kent Dickey <kegs@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
Re: Cannot use joystick or controller in KEGS, GSPlus, etc. [message #412290 is a reply to message #411743] Thu, 11 November 2021 16:57 Go to previous message
Anonymous
Karma:
Originally posted by: kegs

In article <sjnd9u$1o21$1@gioia.aioe.org>, Nicola <nicola@nohost.org> wrote:
> On 2021-10-04, Kent Dickey <kegs@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

The next KEGS release will default to this setting.

Kent
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: More donuts
Next Topic: KEGS v1.14 released
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Dec 09 01:39:14 EST 2021

Total time taken to generate the page: 0.00976 seconds