Jump to content
(Open Beta) HyperSpin 2 is now available for everyone ×

Simple key remapping in HyperLaunch


Twoflower

Recommended Posts

Posted

I'm kind of a noob at this. I'm trying to make a launch module for Pinball Arcade, which lets me map the buttons on my X-Arcade to the UI and play controls in Pinball Arcade. Just run the EXE with some button remappings, that's all.

 

(I know there's a more complex launcher out there which launches right into a table etc., but I'd rather stick with HyperLaunch rather than install and configure RocketLauncher, because everything else already works and I'm not trying to mess anything up here.)

 

My script is currently:

#IfWinActive ahk_exe PinballArcade.exe
SendMode Play
  LControl::Enter
  1::Enter
  3::LShift
  4::RShift
  2::Backspace
#IfWinActive

RunWait, %Executable%, %EmuPath%

Process, WaitClose, %Executable%
     
ExitApp

CloseProcess:
Return

When I test it out in HyperLaunch's standalone... nothing happens. HyperLaunch hangs and does not launch the game.

 

If I remove the entire #IfWinActive block, it'll launch just fine. My guess is it's not formatted right. How should I be doing this? If I can get a good generic "remap some keys and launch the thing" script going I can apply that to all sorts of standalone games.

Posted

Addendum: I figured out I didn't even need to set the active window, and I had to move the keys to the bottom of the script.

RunWait, %Executable%, %EmuPath%

Process, WaitClose, %Executable%
     
ExitApp

CloseProcess:
Return

LControl::Enter
1::Enter
3::LShift
4::RShift
2::Backspace

I tested this launching Notepad instead of Pinball Arcade and it worked just fine. Not sure why PA can't take inputs, or if I'm doing something wrong with scripts. I know others have managed to rebind keys using AHK in PA, so it's clearly POSSIBLE, but not sure what I'm doing wrong.

Posted

Okay, this is crazypants, but I figured it out.

 

Adding a sleep,5000 between runwait and process waitclose worked. Apparently Pinball Arcade boots a secondary process or something? Because HyperLaunch thinks it's all done and quits processing. If I force it to wait before proceeding it'll keep running until finished.

 

Soooo... nevermind. But hey! Good for folks who don't know already.

Posted

I feel doubly like an idiot because apparently Pinball Arcade actually has full key rebinding. I just didn't notice. So I didn't even NEED a script.

 

But anyway, if you're having a similar issue with some other game, the script above works just fine and basically resembles my final. If you run into issues getting it to recognize a game is running insert a Sleep, 5000 just after the RunWait to ensure the program's started up properly.

Posted

I feel doubly like an idiot because apparently Pinball Arcade actually has full key rebinding. I just didn't notice. So I didn't even NEED a script.

 

But anyway, if you're having a similar issue with some other game, the script above works just fine and basically resembles my final. If you run into issues getting it to recognize a game is running insert a Sleep, 5000 just after the RunWait to ensure the program's started up properly.

Ha! Yeah, you can fully remap in-game.

I'm interested in your script though.

Without having the Window AHK Class in the script how does it know what program to look for before running?

RunWait, %Executable%, %EmuPath%
doesn't seem specific enough... or are you replace %executable% with the actual .exe you're waiting for?

Like Runwait, %MK10.exe% %Steamapps%?

Posted

The trick is that while not havking the AHK means EVERY application gets the same remapping... on an arcade cabinet, you only have one application running, and that's the game. And once the game exits the Hyperlaunch script ends, restoring your keys back to normal. So it's effectively the same thing, you don't need to specify the window because the only window in focus at the time of script execution is your game.

 

As for the runwait, yeah, that's basically it. You could just hardcore the path and the filename if you want, too. Not applicable to a generic launcher like an emulator but for single-purpose, single-program modules, it'll be fine.

Posted

The trick is that while not havking the AHK means EVERY application gets the same remapping... on an arcade cabinet, you only have one application running, and that's the game. And once the game exits the Hyperlaunch script ends, restoring your keys back to normal. So it's effectively the same thing, you don't need to specify the window because the only window in focus at the time of script execution is your game.

 

As for the runwait, yeah, that's basically it. You could just hardcore the path and the filename if you want, too. Not applicable to a generic launcher like an emulator but for single-purpose, single-program modules, it'll be fine.

Gotcha. When (and where from) are you launching this script though? You can't do it at startup because then the .exe for Hyperspin, RocketLauncher, Steam, Catalyst control, any other AHK exe's etc... would all cause it to go off right?

Posted

Way I have this set up is a standalone game, using hyperlaunch. The PinballArcade.exe and path are loaded into HyperHQ's data for the single-program wheel for Pinball Arcade. It passes those parameters to the script. Script launches, rebinds keys, shuts itself down when Pinball Arcade shuts down.

 

I'm still a little vague on the timing and sequencing and everything... I just started rigging up Hyperspin two days ago and am working from example scripts, kludgery, guesswork, and lots of trial and error. All I can say is this works. I don't know WHY it works, but it works.

Posted

Interesting. I tried to get something similar working for MK10 when it was a new release.

A script that launches when you launch the game from the PC games wheel that enables the drivers for Vjoy.

However no matter what I did HyperLaunchHQ 1.33 would always launch the game's exe before it would run my AHK.exe so it never worked (the drivers have to be on in Device Manager before the game boots).

So since I couldn't automate it I changed it to a script that starts with windows and is always running in the background and if I want to play MKX I press a button combo to turn on/off the drivers.

I'd much rather automate it though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...