Jump to content
LaunchBox Community Forums

Additional apps - Run after not waiting until game exits


BuckoA51

Recommended Posts

So I'm trying to use the "Additional apps" feature to launch Xpadder before my PC game starts, then run Xpadder again once the game closes to clear the custom bindings once the game exits. However, when I try to do this, Xpadder starts, loads my custom key bindings, then immediately starts again and wipes them out. Why isn't Launch Box waiting for me to quit my game before running the "After" command? Is this a bug or am I missing something.
Link to comment
Share on other sites

scree said You need to make 2 additional apps. One to start Xpadder before the game and the second to close Xpadder once you quit the game. See attached images for examples.
That's exactly how I have it set up, but Launchbox does not wait for my game to exit Confused
Link to comment
Share on other sites

I use those additional app settings to play many games including PC games and all work ok. As far as I'm aware other members use the same additional app structure for Xpadder. I did have issues with some PC games that could read my controller and would do their own thing. So when Xpadder said Shoot the game might also tell the character to jump. Disabling the game's own controller support and just leaving keyboard input support solved those issues for me.
Link to comment
Share on other sites

The game I'm trying to get it working with is Trackmania 2. I guess LaunchBox just thinks the game has exited when it hasn't? I know that can happen for instance if a game calls another executable or suchlike, or maybe it doesn't work for Steam games at all?
Link to comment
Share on other sites

  • 4 months later...

Thanks @Wutex. Unfortunately the method we're using just waits for the initial process to exit, which isn't fail-proof. Sometimes emulators will launch one process from another, which is very difficult to detect. I don't have an immediate way to solve this problem, but I'd appreciate if you could report it using Issues/Requests in the header. :)

Link to comment
Share on other sites

  • 11 months later...

Sorry for the necrobump - wanted to add for relevancy and it doesn't make sense to start a new thread. I just had the same problem with Anodyne running as a Steam game and resolved it.

As Jason mentioned, there's probably no way to reliably read an exit code for a game running from a Steam ID. You can, however, edit the game profile in Launchbox to use the actual executable under <Program Files (x86)>\Steam\steamapps\common\<Your Game>\<Game.exe> -- "Run After" applications should then work as expected.

Not sure if this will work with all games, but it works with Anodyne at least.

Link to comment
Share on other sites

On 4/6/2016 at 1:35 PM, Jason Carr said:

Just saw this and confirming that it is correct. Unfortunately with Steam we have no way to know when a game exits.

I wonder if an option to run after controller automation's exit key combo kicks in, could solve this for things like Steam games and others?

Link to comment
Share on other sites

  • 3 months later...

Sorry for the double necrobump.

I have a similar problem with Sega Rally 2 for the PC. I launch it with a batch file that Kills Fraps (because I have it running from PC startup and the FPS counter looks ugly and massive at 800x600 resolution), mounts CD2 for the music, and launches the game. That's fine.

I then have an 'additional app' which is a batch file for me to manually restart Fraps when I quit Sega Rally 2. That's fine too, just clunky. I try to set it to "run after main application' in the Edit box and the "wait for exit" box is greyed out. Exactly the option I need, but it is FIFTY SHADES OF greyed out :-(

That makes me want to cry. And throw my hands up to the sky. I ain't even joking ;-)

Edited by JamesBond@ge
Link to comment
Share on other sites

The "wait for exit" box will un-grey (?) if you select the "run before" box. I have just been sorting out a load of additional apps. I find that if you want to run an app when game exits. Then selecting just the "run after main application" box works.

 

I would like to know if "run before main application" and the "wait for exit" boxes are checked how does it work.

Edited by jayjay
  • Thanks 1
Link to comment
Share on other sites

17 minutes ago, jayjay said:

I would like to know if "run before main application" and the "wait for exit" boxes are checked how does it work.

That's what I'm talking about. I need to run a batch file after Sega Rally 2 is exited so that batch file can BOOM, restart Fraps afterwards.

The options for additional apps is "run before main application", "run after main application" and a supplementary option to "wait for exit".

I need to "run after main application" and "wait for exit" but I can't do that because when I check the "run after main application" box, the "wait for exit" box then greys out.

Edited by JamesBond@ge
Link to comment
Share on other sites

I have xpadder run "before main application". Then a script to close xpadder "after main application". Wont selecting just the "run after main application" work for you? Iv just been using it and it works for me. The "wait for exit" isn't needed.

 

I have found it confusing. But "run after main application" is basically wait for exit as I read it. But im guessing, not to sure, that if an app uses the "run before" and the "wait for exit" its basically saying... This app will run and then exit before the game starts.

 

Hope that makes sense.

 

"Run after main application" sounds like, run the game, then run the app after game starts. But actually what it does is, runs the game, waits for the game to exit, then runs the app.

Edited by jayjay
  • Thanks 1
Link to comment
Share on other sites

Or you could use a script:

#SingleInstance, Force
#Persistent
SetTitleMatchMode, 2
DetectHiddenWindows, On
 
SetTimer, ProcessCheckTimer, 3000
Return
 
ProcessCheckTimer:
Process, Exist, GAME.exe
pid1 := ErrorLevel
If (!pid1)
         {
	 Run, path-to-fraps
         ExitApp
         }
Return

Change GAME.exe to sega rally process. Change path-to-fraps... It will check every 3 seconds for sega rally process. When it doesn't find it, it will run fraps then exit.

  • Thanks 1
Link to comment
Share on other sites

9 hours ago, jayjay said:

Change GAME.exe to sega rally process. Change path-to-fraps... It will check every 3 seconds for sega rally process. When it doesn't find it, it will run fraps then exit.

You little beauty! That worked. I just needed to tweak the timing up to 20 seconds to keep the script playing the game. (I've chosen "Launch Before" but I don't think I need to do that now)

Your post above this one gave me food for thought. I tried the "Restart Fraps" script with another game "Duck Tales Remastered" that is simple to run and the "run before main application£ option worked. This tells me that because I was running Sega Rally 2 with a "mount ISO and Launch Game" script, Launchbox is thinking the script is the main application and launching the other one prematurely.  Something like that. My brains are blown LOL. One of these days I'm gonna get a PS4 and just press the start button lol.

Thanks mate! I appreciate your time. Your script with the "check and wait" function worked and LaunchBox is working as it should. I can build on it for other things as well.

Edited by JamesBond@ge
  • 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...