AppleWin icon indicating copy to clipboard operation
AppleWin copied to clipboard

libretro: play games without a keyboard.

Open audetto opened this issue 11 months ago • 13 comments

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?

audetto avatar Mar 09 '24 20:03 audetto

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.

sfatula avatar Mar 10 '24 23:03 sfatula

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 avatar Mar 16 '24 16:03 audetto

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

audetto avatar Mar 16 '24 16:03 audetto

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.

sfatula avatar Mar 16 '24 17:03 sfatula

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?

audetto avatar Mar 16 '24 18:03 audetto

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.

sfatula avatar Mar 17 '24 02:03 sfatula

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

Which one are you using?

audetto avatar Mar 17 '24 15:03 audetto

ra2 via retroarch

sfatula avatar Mar 17 '24 20:03 sfatula

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.

audetto avatar Mar 19 '24 11:03 audetto

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

sfatula avatar Mar 20 '24 05:03 sfatula

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.

audetto avatar Mar 21 '24 14:03 audetto

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

sfatula avatar Mar 21 '24 17:03 sfatula

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

audetto avatar Sep 01 '24 18:09 audetto