Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up --- Bug Reports --- Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Keyboard mapping for Windows games  (Read 276 times)

0 Members and 1 Guest are viewing this topic.

jlfreund

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 186
  • Last login:October 09, 2023, 06:26:07 pm
    • My project's blog
Keyboard mapping for Windows games
« on: October 02, 2023, 08:15:55 pm »
I use a typical USB keyboard encoder for my control panel joysticks and buttons which works great for emulators that already support mapping capability, but I was wondering if anyone has found a way to perform higher-level or dynamic keyboard mapping for specific games?

I use Bigbox as my frontend to launch Mame, Retroarch, and other emulators, and so far, I think everything is able to work with my chosen USB encoder key mappings.

But for Windows games, some require WASD, some require arrow keys for movement, and some have other keyboard buttons (spacebar, enter, etc) with special meaning, with no way to internally remap within the game. 

Does anyone have any ideas for a frontend, windows setting, or app that can somehow remap keys when running a certain program or game?

Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3151
  • Last login:Today at 11:05:13 am
Re: Keyboard mapping for Windows games
« Reply #1 on: October 02, 2023, 09:36:32 pm »
I use IPACs which can be re-programmed by a command-line utility. Then I setup my frontend to reprogram the IPAC as starting the game via a pre-emulator command, and to then reset the IPAC back (to MAME defaults) on exit, via a post-emulator command.

Most frontends support pre- and post- emulator commands. If your doesn't, or if you are launching from a desktop, then launch the game via a batch file or script that includes the extra commands.

If you can't re-program your USB keyboard encoder and you don't want to get a new one...

There are some "wrappers", like closemul.exe, which launch your game an monitor the processes for specific keys, like ESC, to quit the game. Some might allow keyboard remapping.

If none of that works for you, try Autohotkey. "AutoHotkey is a free and open-source custom scripting language for Microsoft Windows, initially aimed at providing easy keyboard shortcuts or hotkeys, fast macro-creation and software automation" (Wikipedia :P).

AHK is quite powerful yet lightweight and easy to use. You could use AHK scripts like custom wrappers for your games, to re-program keys automatically to whatever you want, and only while running the game. Not sure how much delay/lag it would introduce. I've only used AHK for pretty simple stuff, but the capabilities are there. There's a whole community for examples/support, and there are probably whole threads on this forum if you search.

Then there are keyboard-joystick emulators. Worth another thread by itself  :)
Check out my completed projects!


jlfreund

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 186
  • Last login:October 09, 2023, 06:26:07 pm
    • My project's blog
Re: Keyboard mapping for Windows games
« Reply #2 on: October 02, 2023, 10:59:08 pm »
Wow, thanks!  I use IPAC as well, and could see using BigBox to script either: (A) WinIPAC modifying and restoring the control mapping, or (B) Using a wrapper to remap keys.

Do you know how WinIPAC could be scripted to load a config, flash it, and restore the original config when the process exits?


Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3151
  • Last login:Today at 11:05:13 am
Re: Keyboard mapping for Windows games
« Reply #3 on: October 03, 2023, 12:24:50 am »
1) Re-mapping keys withing the game, or 2) re-programming the IPAC, are the better ways to do it, if possible, because you'll have less "layers" (=lag and more things to go wrong). But it is great to have options.

Here's an example of how I used to do it with MameWAH for Doom, just easier to for me to copy from the config file. These days I use Attract Mode, but the principle is the same (you can put pre- and post- emulator commands in via the GUI with Attract-Mode, I imagine it is similar for Big Box).


### Execution Settings ###
pre_emulator_app_commandlines             c:\program files\winipac\winipac.exe doom.ipc
emulator_commandline                      D:\doom\zdoom.exe -iwad D:\doom\iwads\[name].wad{nodosbox}
post_emulator_app_commandlines            c:\program files\winipac\winipac.exe mame.ipc



Obviously, before you do this, you need to create a custom [game].ipc file for your game. You can do that with WinIPAC. The drivers are available from the Ultimarc website, make sure you get the right one for your model IPAC.

Quote
BTW I "invented" WASD in 1992 at a Doom tournament in Sydney. Prior to that, everyone used arrow keys. But I'd just learned about using keys to "strafe" left/right, instead of turning, from some new players. They still used arrow keys, and was trying out different control options that felt better. At about 4am on the morning of the final day I discovered WASD was perfect. I played that way on the day, but lack of practice with strafing and the new controls meant that I came only third (after the 2 new guys with the strafing technique). Another day of practice and I would have swept the floor.

After I introduced WASD + strafing to all my mates it went viral and became the gold standard in about 2 weeks.

Now you have some idea how long I've been a serious gamer [ie a lot longer even than that].

You can also substitute a batch file for an executable. For example, below is what I did for music playlists. "Kill.bat" simply kills any processes for previously queued/running playlists, "play.bat" accepts a playlist name as a parameter and plays it (with mplayer).

You can ignore the "{nodosbox}" in those examples, that was solely for making things play nicely with MameWAH.


Quote
### Execution Settings ###
pre_emulator_app_commandlines             c:\multools\mplayer\kill.bat
emulator_commandline                      c:\multools\mplayer\play.bat "c:\multools\playlists\[name].m3u"{nodosbox}

Check out my completed projects!