Jump to content
LaunchBox Community Forums

PC / Steam games Virtual Controls Kill on game Exit


Dreygor

Recommended Posts

So here is the scenario. I have a control panel with a JPC2 / IPAC control style set up that converts everything into key strokes. it seems to work fine with everything except Steam / Windows games and the Xenia emulator which Work better using an Xbox 360 controller. 

 

So the work around I found for this was using the Virtual Controller and Vjoy combination ( https://sourceforge.net/p/vjoy-controller/discussion/general/thread/4855b925cd/?limit=25 ) I used the instructions and managed to get everything bound and working good. I have managed to figure out how to get it to start when the Steam / Windows game starts but the issue I am having is how to get the bat file to kill the process to kick in after I exit from the game. 

 

Normally I am able to kill the process using an AHK script command on exit. However for Windows / Steam games I do not appear to have this capability as there is no emulator tied to it. Then I thought I could do it as an App that kicks in after the program exits. That did not seem to work as when I checked the box for execute after application exits it seemed to want to kill it as soon as the program started.

 

So here are the .bat files I am using..

 

VC_Start.bat..

@echo off
CLS
start VirtualController.exe /load Custom.vcd /run /minimize
CLS
Exit

 

VC_KILL.bat...

@echo off
CLS
nircmd.exe killprocess VirtualController.exe
CLS
Exit

 

As I said I got it to where it will run VC_Start.bat when the game starts but I can not figure out how to get the VC_Kill.bat to kick in on exit. I considered starting it at Windows boot up BUT it creates some other issues. So the main path to follow is starting at game start then killing it on game exit.

 

i would be extremely grateful for any assistance.

Edited by Dreygor
Link to comment
Share on other sites

OK i found a work around of sorts but it definately not a very good solution as I have to create a .bat file for every Windows / Steam game I want to run.

 

In additional applications I add the batch file specific for that game and set it to start prior to the game starting..

EXAMPLE:

SoulcaliburVI.bat

start VirtualController.exe /load Custom.vcd /run /minimize
D:\Steam\steamapps\common\SoulcaliburVI\SoulcaliburVI\Binaries\Win64\SoulcaliburVI.exe
TIMEOUT 70
taskkill /IM VirtualController.exe /F

 

What this does is launch VirtualController.exe loading the dual xbox 360 controller profile I made, starts running, then minimizes it. Then next line tells it what to watch for. The timeout 70 gives the game 70 seconds to launch before taskkill starts watching to see if the program is still running or not. This is needed because some games take a while to start up. Without the timeout I kept running into the issue of the scirpt immediately killing VirtualController.exe because SoulcaliburVI.exe had not even started up yet,  Then the last line kills VirtualController.exe when SoulcaliburVI.exe stops running using /f (force quit).

 

i am by no means a scripter and this is VERY sloppy, but it was the best solution I could cobble together until someone who knows what they are doing comes up with a better solution.

*EDIT* Oh I forgot to mention all the .bat files are residing in the same folder where VirtualController.exe is.

 

Edited by Dreygor
Link to comment
Share on other sites

...and back to square one.

The TIMEOUT I had to add apearantly broke the taskkill command and so when the timer ran out it was going ahead and killing the game.exe .

 

I guess the real fix would be on the game tab, in Launchbox, if it's a Steam game it might help for it to have a box where the actual exe goes so when the game is exited it knows what to really look for so it can execute the app on game exit.

Edited by Dreygor
Link to comment
Share on other sites

Bat file removed as not working currently-Will return when (or maybe that should be if) working

This is going to be your "Emulator" for Steam games

Make a new Emulator like normal and call it whatever you want.

Make the Details tab in edit emulator look as below-but the application path will obviously point to wherever you put the bat file.

image.thumb.png.826e0aed29a43ad18c70719e38077bc1.pngIn Associated Platforms put Windows - or whatever platform you have them under and leave command line blank

No idea if you use start screen, exit and pause screens but if you do they will need sorting- I have had to do mine with custom on each Steam/Windows game as they are all awkward in some way or other. But they should all work with this bat file.

Running AutoHotKey Tab

Made an assumption here and I have used Escape as an exit key-Because it is a nice easy key to practice with and I had no idea what you use. You need to put your pathway in as I don't know it.

image.thumb.png.30abb7f64c943d0316939d3428b49526.pngI cannot test the opening or closing of VirtualController.exe here as I don't use it, but I did use another bat file in it's place to do something else and it worked.

You might even be able to use WinClose in the AHK part rather than running a bat file, but I didn't know the name of it so couldn't do that.

Also reading the info on the link you provided it looks like you can set an exit key for Virtual Controller-if you did that could you get the AHK above to send the exit key to Virtual Controller? But if the kill bat works then might just be easier.

This will leave Steam running in the background as well.

Also your edit game page needs to look like this, but with whatever Steam number your game is

image.thumb.png.4985419b2ea97186e8e9c637b71098fd.pngAnd REMOVE the current additional app you have put on the game, I am opening Virtual Controller and launching the game in the one bat file. 

Goodluck

Ps The annoying thing is this is actually a much better way of doing it than I already do it, having spent days on sorting out my own lot in the past and having a much more annoying system involving specific ahks for each game running as an additional app

Pps I take no credit for the bat file and ahk stuff here. I have only taken work done by other people and cobbled it together into something else. So thank you and credit to the original people who I cannot name as I don't know. But if anyone recognises the work then please take credit for it. 

 

 

Edited by Kiinkyfoxx
Remove non working bat file
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...