Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

Scenario: Your steam game doesn't allow you to define custom keys in game. So... do them outside the game via AutoHotKey.

[sOLVED} How to:

You'll need to use AutoHotKey. You'll have to gem up elsewhere on this! Use following as template for ahk scripts:

; >> -------------------------------- STEAM WRAPPER AND KEYMAP ----------------------------------------------
; >> --------------------------------------- NAME: XXXXXXX ---------------------------------------
; >> -------------------------------------- NUMBER: XXXXX --------------------------------------------------

SetTitleMatchMode 2
WinWait, xxxxx
WinWaitClose, xxxxx
exitAPP

; >> -------------------------------- STEAM KEYS -----------------------------------------------------------
,::F12
]::+Tab

; >> -------------------------------- GAME SPECIFIC KEYS --------------------------------------------------

c::s
Numpad4::a
v::Enter
z: :D
x::space
;Numpad1::
;Numpad2::
;Numpad3::

;--------------------------------------- CAB FUNCTION BUTTONS ---------------------------------------------

Script explanation:

; >> -------------------------------- STEAM WRAPPER AND KEYMAP ----------------------------------------------
; >> --------------------------------------- NAME: XXXXXXX ---------------------------------------
; >> -------------------------------------- NUMBER: XXXXX --------------------------------------------------

SetTitleMatchMode 2 ;<<This accommodates dynamic Window Titles (e.g. ones with dynamic FPS displayed)
WinWait, xxxxx; <<Replace xxxxxxx with uncanging part of window title - e.g. "EtherVapor Trial"
WinWaitClose, xxxxx; <<Same as above
exitAPP; Kills the ahk script for the game

;Above 4 lines have to be before keymaps

; >> -------------------------------- STEAM KEYS -----------------------------------------------------------
,::F12
]::+Tab

; Maps the screenshot and Overlay to keyboard/cab keys

; >> -------------------------------- GAME SPECIFIC KEYS --------------------------------------------------

c::s
Numpad4::a
v::Enter
z: :D
x::space
;Numpad1::
;Numpad2::
;Numpad3::

; Your key remaps

;--------------------------------------- CAB FUNCTION BUTTONS ---------------------------------------------

An Example:

; >> ---------------------------------------STEAM WRAPPER---------------------------------------------------
; >> ---------------------------------------NAME: Ether Vapour Trial ---------------------------------------
; >> -------------------------------------- NUMBER: 219240 ------------------------------------------------

SetTitleMatchMode 2
WinWait, EtherVapor Trial
WinWaitClose, EtherVapor Trial
exitAPP

; >> -------------------------------- STEAM KEYS -----------------------------------------------------------
,::F12
]::+Tab

; >> -------------------------------- GAME SPECIFIC KEYS --------------------------------------------------

c::z
Numpad4::x
v::c
z::v
x::a
Numpad1::s
Numpad2: :D
Numpad3::f

;--------------------------------------- CAB FUNCTION BUTTONS ---------------------------------------------

SETUP:

1. Run AU3_Spy.exe (in AutoHotKey Program folder)

2. If you have two displays - place AU3_Spy on second monitor (most games play fullscreen)

3. Run your game from Steam

4. Copy the window title (or a static part of it if dynamic) from AU_Spy. Screenshot:

AU_Spy.png

5. Create a script from the default using what you've copied (see example). Replace "xxxxxx" with the window title copied.

6. Do your key mappings.

7. Go to Steam Launcher. Top Menu bar: Steam>Settings. Make sure following ticked:

steam.png

8. Right Click game + select "go to community hub"

steam2.png

9. You will see a number in the address bar. Copy this:

steam3.png

10. Save your AHK script as this number in GameEx>Media>Steam>Wrappers2>Source (create Source folder if not there) (e.g. 219240.ahk)

11. Right click on script, select compile

12. Cut .exe file

13. Paste in GameEx>Media>Steam>Wrappers2. Should have something like this:

steamrem.png

And you should be good to go!

Hope this helps!


Original Thread

OK... into the magical world of steam.

After one thing... schmups!!

Ether Vapour and Sine Mora exactly what I'm after. BUUUUTTTT...

Keys mapped to specific keyboard keys in the games!! Can change the order in options, but has to be one of the pre-sets in the game (e.g. z,x,c,v,a,s,d,f are assignable).

Can't find any way to edit this (e.g. game.ini files or anything) - how shortsighted of these devs!

So... I'll have to remap the game keys to my cab keys...

How do I do this on a per-game basis, though?

(oh I do wish xpadder would extend to keyboard remaps!)

Cheers chaps.

  • Like 1
Posted

So, I was thinking about this, but would eelcome the advice of you coders...

How about a launch before that passes the name of the rom to a batch file. The bat would then check if an AHK of the same name exists and if so, runs it to mapad the keys. Only thing uncertain of is the bat would have to wait for the game to terminate, then kill the ahk process. Used a cmd something like ProcessClose in the past or is it Wait which pauses bat until another process closes. If bat has command in it, and its being run as alunch before, will the game exe get run by GE even thought the bat is waiting?

Posted

Ether Vapor and Sine Mora are my 2 fave modern shmups!! B) However like you i'm a bit peeved that there is no option for remapping :angry: I don't have the Steam version of EV (yet) but in Sine Mora you are forced to use the A button on xbox controller, in all the presets and that irritates me to no end. I have rather gigantic hands and so have to pull my thumb back quite a bit which becomes rather painful when holding A for sometimes hours at a time. I always map the X button as my main button. I absolutely adore Sine Mora (the radio chatter has me peeing myself! :lol:) but can't play it often for that silly reason..

Anyhoo, as to your question you could possibly get an AHK script to load with them BUT bare in mind that there are no Launch Before options for Steam (currently) and also that you would need support for PER game options - otherwise you'll be running the same .bat for all your Steam games!

The only (unsatisfactory) work around i can think of is to add your .bat files to Steam itself (ie add one .bat that launches your Sine Mora script+Sine Mora, another that launches EV script+EV etc). This should work however the problem here is that you will have two entries for each game (one for the .bat and the other for the actual game) :wacko:

I am by no means a genius at this kinda stuff though :P so hopefully one of our actual geniuses can come up with something cleaner.

EDIT - Correction i see there is launch before and after there now! When did that sneak in?! My point above still stands though - it will launch the same batch file for ALL your steam games.

Posted

I had a busy weekend, so I apologize that I'm just now getting back to this. GameEx actually does have the ability to launch custom wrappers on a per game basis for Steam. Take a look at the GameEx\MEDIA\STEAM\WRAPPERS directory. Basically you would create a compiled script named according to the numeric Steam identifier of the associated game and place it in that directory. Then GameEx will auto-magically launch that script along side the associated game. AutoHotKey is by far the most popular choice for pulling this off, but really I suppose the script could be any executable, so long as it was named identically to the numeric identifier of the associated game.

If you need help determining the numeric Steam identifier for a game, you can find it in the URL of the store page for said game. I'm blocked from reaching Steam at my current location, or I'd provide an example. Just take a look though, it's pretty easy to spot. The other thing you can do is take a look in the GameEx\MEDIA\STEAM\BOX directory, and find the banner for your game. The banner snap will also be named according to the Steam ID.

Good luck man!

  • Like 1
Posted

Thanks man i had no idea you could do that! GameEx - always full of awesome little surprises :D

So for Sine Mora you would need an exe, bat etc called 207040 and plonk it in the mentioned directory - sweet!

post-6865-0-43531800-1392654931_thumb.pn

Posted

Cheers chaps.

I know nothing about wrappers. But to check my understanding, I would create an ahk script for a game. Compile the ahk into an .exe and then name it to the number that corresponds to the game?

So, in dazzles eg above (thanks for the steer, chap!)

Put

207040.exe in the wrappers folder?

Wow. Does this work for other platforms too? :)

Posted

Yes the steps you listed should work in terms of the Steam wrappers. The reason why Steam games got their own wrapper functionality is that Steam games sometimes require an intermediary "launcher" screen that pops up between launching the game and actually starting the game outright. So the Steam wrappers came about as a solution to automate these launcher screens and jump right into the game with no intervention from the user (Trine, Arkham Asylum, and GTAIV are a few games I can think of in this category). As a result, you will see some pre-existing wrappers in the wrapper directory (at least if you opted to download them during installation). So ... in a rare circumstance, you may encounter a situation in which you want to do a custom wrapper where one has already been written for that game. In that case you can see the source of each wrapper located one directory below the wrapper directory itself (I'm away from my Gaming machine ATM, but again it's pretty easy to find). So in a really rare situation you might end up adding code to a preexisting wrapper and recompiling it.

This functionality isn't explicitly available for "standard emulators" in GameEx, but you could probably fake it using Launch Before and Launch After. Something along the lines of:

Launch Before= "C:\Wrapper Directory\[ROM].exe"

In this scenario, you might end up separating "games that require wrappers" vs. "games that don't" and run two separate emulator entries for each. This would help to avoid the issue in which the Launch Before command couldn't find an exe named "[ROM].exe". Then you could subsequently regroup the two separate emulator entries into a single list using the Emulator Groups feature. I'm just spit balling on that one. I imagine that writing custom wrappers for several games would get pretty tedious after a while though, so I'd certainly only go that route if I absolutely had to. In terms of standard emulators a lot of this sort of functionality can be managed through plug-ins so if I could get away with it at all I'd go that route instead.

Posted

Fantastic - made my own ahk script + remaps keys brilliantly!! :)

However, ahk.exe process not being killed on game kill.

Looking at the other wrappers, they all seem to have code like this one:

WinTitle = Call of Duty - Steam
WinText =
Control2Send2 =
Keys2Send = {ENTER}

WinWait, %WinTitle%, %WinText%, 120
WinActivate, %WinTitle%, %WinText%
Sleep 500
ControlSend, %Control2Send2% , %Keys2Send%, %WinTitle%, %WinText%

or:

;35140 - Batman Arkham Asylum Game of the Year Edition
;Click Play on the Batman Arkham Asylum Game of the Year Edition launcher window
WinWait, Batman: Arkham Asylum GOTY Launcher, , 60
Sleep 500
ControlClick, WindowsForms10.Window.8.app.0.378734a7, Batman: Arkham Asylum GOTY Launcher

Do I need some code somewhere in my ahk script to kill (errr) itself??

thanks

Posted

Here is where we start to approach the limit of my AHK knowledge (hey I never claimed to be an AHK wiz! :lol:). But ... I believe AHK has a function to keep a given script running only as long as a certain window/application is held in memory. I may have an example of this somewhere. I'll take a look when I get home if someone else doesn't beat me to it.

Tempest is the man who could probably answer this question most effectively.

Posted

Ahhh...

Loooking at the various scripts, one common denominator seems to be:

WinWait, [???], [???], [60/120 etc]

However - this looks like a wait before sending keys to clear splash pages

No commands after this! :(

Might just try a simpler script, because nicked one of my ahks to also map cab function buttons:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

; >> Steam Game Wrappers by Stigzler
; >> Method A - Use before Method B. To "enable" a line - just delete the ";" Don't delete ; lines with >> in!
; >> Obviously, change the keys to your own!
; >> --------Fx--------------- <- name of the function button on cab, not the F keys on keyboard
; >> See F2 for example
; >> See F1 for how it works

; >> -------------------------------------GAME-----------------------------------------------------
; >> ----------------------------------NAME: ETHOR VAPOUR REMASTER --------------------------------------------------
; >> ---------------------------------- NUMBER: 219240 -------------------------------------------------

;>>Optional enables:
;#InstallKeybdHook
;>>Change below if 'Event' not working. Options: Event,Input,Play,InputThenPlay
SendMode Event

; >> -------------------------------- GAMNE KEYS --------------------------------------------------

c::z
Numpad4::x
v::c
z::v
x::a
Numpad1::s
Numpad2: :D
Numpad3::f





;------------------------2 - Shift Key -----------------------------
;>>2 is essentially the shift key. If you are wanting to use 2 in emu, then enable below. Enabling first line means 2 wont register on keydown, but sends 2 on key up. Try without first line enabled first
;2::return
2 up::Send 2
;KeyWait, 2
return

;------------------------F1 + example----------------------------
$Esc:: ; >>This is the 'hotkey' i.e. the key you press on the keyboard/controller
;>>The dollar there b/c sent key (below) = the hotkey (above) and $ stops infinite loop
Send {Esc} ; sends Escape
;>>Line below stops key repeating - i.e. waits until key is released
KeyWait, Esc
return

2 & Esc:: ; >> This is a combo Hotkey - the & specifies both keys pressed together
Send {NumpadDiv}
;>>Below stops NumberDiv sent key repeating. If take out second ; you have to release 2 before using it again to shift. As is - it acts like a normal shift key
KeyWait, Esc
;KeyWait, 2
return

;------------------------F2----------------------------
; Example - pressing [ on own sends a non repeating Shift+Space.
; Pressing 2 and [ Sends non-repeating NumPad0
; Comment out "KeyWait, [" to make sent key repeat (Shift and space in this e.g.)
; Enable "KeyWait, [" to stop sent key repeating.
; Comment out "KeyWait, 2" to make 2 act like a normal shift key
; Enable "KeyWait, 2" to require user to release 2 and press it down again to do a subsequent shift function

$[::
;>>below sends shift and space
Send {Shift down} ; Press down the shift key.
Send {Space} ; Send Space
Send {Shift up} ; Release Shift key
KeyWait, [
return
2 & [::
Send {Numpad0}
KeyWait, [
;KeyWait, 2
return

;------------------------F3----------------------------
$,::
; >> If your sent key = your 'hotkey' (key specified in line above) you have to prefix it with hash
Send, `,
KeyWait, `,
return
2 & ,::
Send {Numpad6}
KeyWait, `,
;KeyWait, 2
return

;------------------------FA----------------------------
$y::
Send y
KeyWait, y
return
2 & y::
Send {Numpad7}
KeyWait, y
;KeyWait, 2
return

;------------------------FB----------------------------
$u::
Send u
KeyWait, u
return
2 & u::
Send {Numpad8}
KeyWait, u
;KeyWait, 2
return

;------------------------F4----------------------------
$]::
Send ]
KeyWait, ]
return
2 & ]::
Send {Numpad9}
KeyWait, ]
;KeyWait, 2
return

;------------------------F5----------------------------
$h::
Send h
KeyWait, h
return
2 & h::
Send {NumpadAdd}
KeyWait, h
;KeyWait, 2
return

;------------------------F6----------------------------
`;::f
;Send f
;KeyWait, `;
;return
2 & `;::
Send {NumpadSub}
KeyWait, `;
;KeyWait, 2
return

hmmm - KISS principle may apply here!

EDIT: Nope: didn't work :(

;#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
;SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

; >> Steam Game Wrappers by Stigzler
; >> ------------------------------------------GAME-----------------------------------------------------
; >> ----------------------------------NAME: ETHOR VAPOUR REMASTER ---------------
; >> ---------------------------------- NUMBER: 219240 ------------------------------------------------



; >> -------------------------------- STEAM KEYS ------------------------------------------------------
,::F12
]::+Tab

; >> -------------------------------- GAME SPECIFIC KEYS --------------------------------------------------

c::z
Numpad4::x
v::c
z::v
x::a
Numpad1::s
Numpad2::D
Numpad3::f

;--------------------------------------- CAB FUNCTION BUTTONS ---------------------------------------------

Posted

I think you might be able to use the combination of WinWait and WinWaitClose to manage activating and closing the script. Check out the documentation of WinWaitClose (particularly the code example).

The only catch is that you will need to figure out the Window Title or Text. That's where the Window Spy tool can be your best friend.

I believe you can do something similar dependent on whether a Process (as opposed to a Window) exists as well. See here

Posted

Thanks null - will take a look at this tomorrow.

Oh and btw - how amazing is Sine Mora!!!! - one of the best modernizations of a classic game genre I've ever played! Games like this make this son of a beast worth a year's labour! :)

Posted

I would think that you could include a command line to taskkill the process (tskill if using XP) on launch after.

Posted

The reason that your script continues to run while the others do not is because you have hotkeys in your script. A script automatically becomes Persistent if it has hotkeys.

There are numerous ways to handle it. Nullpointer's advice on WinWaitClose, or Process, WaitClose is a good place to start.

Draco is correct about using TSKill, but If your scripts are all named differently it would be difficult to implement.

It's too bad that you can't use and Advanced Emulator Config for Steem. With an advanced config, not only can you remap keys, but you can also close additional processes. Sounds like a feature request to me. :-)

  • Like 1
Posted

Cool. Thanks fellas. Looks like a combo of winwaitclose and exitapp. Will have to find game win names. Quick google on windows spy tool - is this uitool?

Posted

Window Spy comes with AutoHotkey. Before you try anything else, try adding either

Esc::ExitApp

or

KeyWait, Esc, D

ExitApp

to your script. I'm assuming that you are using {Escape} as the key to exit your emulators.

  • Like 1
Posted

Thanks Tempest. The only issue I can see with the Esc key map is that soem steam games appear to use Esc as a game control key. For example, Sine MOra has preset, unmappable keys set - Esc is used for "back." To exit Sine Mora, I have to navigate to the first game menu page and choose "Exit Game." So, I'm thinking that the Esc mapping isn't going to work for some games....

I'll give the WinWaitClose and ExitApp a go tonight + thanks for the steer around Window Spy.

If things were simple in this pursuit - the hobby might be very dull!

Posted

Thanks for sharing your solution stigzler! There is potentially one other aspect to this that you might want to consider. Occasionally new common Steam wrappers are created and added to the FTP, at which point they are distributed with GameEx (at least if one opts to download/update their wrappers). There could be a very slight chance that someones custom wrappers could be overwritten in this fashion (although Tom would need to confirm on this).

So ... I think you could circumvent this in one of two ways. You would either want to opt out of updating Steam wrappers during your update process, or you would want to set your custom wrappers as being read-only. Personally I would just set them as read-only. Certainly wouldn't want to lose your hard work!

Thanks again for the write up!

Posted

Cheers chaps. I try to summarise the results of investigations into individual issues once solved, as it can be frustrating sometimes ready through entire threads to pick out all the 'bits' of a solution. Hopefully will save someone in the future a job! Also, try to write it like I am reading it a year ago when I was a newb. At that stage I was asking "wtf is a bat file?" and didn't know the difference between an ini and a exe file!

I've read somewhere, null that the Wrappers2 folder is protected from update - updates go into Wrappers. Think it was the thread where the steam integration got started/discussed. Thanks for the steer, however.

Posted

You can write protect individual files within an unprotected folder by setting the attribute to read only via the file properties.

Guest
This topic is now closed to further replies.
×
×
  • Create New...