audetto / AppleWin

Apple II emulator for Linux
GNU General Public License v2.0
50 stars 13 forks source link

libretro: play games without a keyboard. #148

Open audetto opened 8 months ago

audetto commented 8 months ago

From https://github.com/audetto/AppleWin/issues/139#issuecomment-1986960448

It might be useful to remap some keys to the gamepad so a keyboard is not needed.

I think it is a good idea. Can you give more details. Is there another libretro core which allows it?

sfatula commented 8 months ago

I believe fmsx does. And Dosbox pure. There was at least one more, it was even in the retroarch core doc but can't locate it right now. I think it was fuse. Libretro seems to indicate so.

So, think loderunner as an example. Using the joystick works wonderfully. But you get stuck and you have to abort the level and lose a life. That's takes a ctrl-a, meaning, hooking up a keyboard just so you can type a ctrl-a.

There are other games (esp some SSI games) where there are keyboard commands, but they are very limited in number.

If a game was truly keyboard, then, you'd have to use a real keyboard of course if it had a lot of commands like typing names, etc. (thinking Wizardry).

I have a big problem using Applewin as is though, even on the keyboard, ctrl-a or ctrl-r does not work. Is there also any way to stop "start" from resetting the machine, very easy to accidentally do.

audetto commented 8 months ago

If CTRL-A and -R do not work, it is a bug. Their scancode is 1 and 12. Uncomment line 221 of game.cpp and copy here the output when you press these keys.

audetto commented 8 months ago

And now, start must be pressed twice in 1 second to restart.

sfatula commented 8 months ago

I tried with ascii keyboard core setting or not (typed on KB), key code or not via xboxdrv and gamepad to send codes (they all send except control keys), just could never get it to work and you can't beat all the levels without a few times needing control-a. I will change the logging line (it's 222 in my version) and recompile and post back.

audetto commented 8 months ago

I think this is the line in fuse you refer to

https://github.com/libretro/fuse-libretro/blob/847dbbd6f787823ac9a5dfacdd68ab181063374e/src/libretro.c#L35

and

https://github.com/libretro/fuse-libretro/blob/847dbbd6f787823ac9a5dfacdd68ab181063374e/src/libretro.c#L286-L300

If I read this correctly, once they are set, they override whichever meaning the joypad button already had.

I don't know, it seems such an obvious requirement, that libretro should provide it once and for all cores. Are we sure, it is not already available?

sfatula commented 8 months ago

So, here's some log entries:

RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00 RA2: processKeyDown - 00 132 00 00

An entry is made when holding down the left control key in this case, but, then any key with it is missed and has no log entry. So, no combo apparently.

Pretty sure there is no all cores feature to type a keyboard key from a controller button. In the manual, they suggest using xboxdrv. That does work but it's a lot of work.

audetto commented 8 months ago

As you can see, there is no early exit in that function. It sounds an issue with the frontend.

Which one are you using?

sfatula commented 8 months ago

ra2 via retroarch

audetto commented 8 months ago

It is controlled by a setting in retroarch.

AppleWin recommends to enable Game Focus Mode

https://github.com/audetto/AppleWin?tab=readme-ov-file#ra2

For the exact behaviour, check the libretro doc or forums.

sfatula commented 8 months ago

Yes, I am aware of game focus mode, on or off makes no difference, I cannot abort the level with control-a. It does work with SA2. Just not libretro

audetto commented 8 months ago

On my retroarch (been using git version for the last N years, at the moment I am on 1.17.0)

  1. Game Focus On: all CTRL- are passed to the core.
  2. Game Focus Off: some CTRL- are trapped (including A and R, but not C).

Unless you find another core which works, I can only suggest to reach to a libretro forum.

sfatula commented 8 months ago

Helpful to know it works for you, will have to look elsewhere then as it definitely does not work for me. Strange!

audetto commented 2 months ago

Unless more evidence points to an AppleWin issue, I will close this.