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. Thank you for your support. Tom Speirs

Patreon

[Resolved] 'Launch After' Watching Wrong Process?


nullPointer

Recommended Posts

Hello

I'm in the process of (finally) setting up my registered copy of GameEx after having tooled around with the unregistered copy for quite a while. I'm in the process of setting up Nestopia and would like to run a batch process both before the emulator loads and upon exiting the emulator. I'm running the process via a shortcut (.lnk) so that it can run minimized. In a nut shell the Launch Before process loads an Xpadder profile and launches an AutoHotKey script. The Launch after command conversely exits from Xpadder and kills the AHK script.

The Launch Before process seems to execute in the correct order. My problem is that the Launch After command executes immediately after launching the emulator, in effect closing the supporting processes before the emulator even has a chance to get going.

My only guess is that GameEx might be watching the wrong process when it opts to execute the Launch After command?

Here's my emulator config for Nestopia:

[Emulator_4]

Enabled=True

System=Nintendo NES

Category=Console

Emulator=Nestopia

Version=1.41

Rating=

DownloadUrl=http://www.gamesdbase.com/setupwizard/emulators/download/Nestopia.7z

RequiredFiles=

Website=http://nestopia.sourceforge.net/

Info=Nintendo NES 8bit emulator

TITLETEXT=Nintendo NES

STARTPAGENAME=[Console] Nintendo NES (Nestopia)

StartPageLogo=Nintendo NES

Command=Nestopia.exe "[ROMPATH]\[ROMFILE]"

ROMFilter=

DATABASE=[Console] Nintendo NES

configFile=[Mapping Off] Exit (Process Close)

MAPFile=

RomPath=E:\Emulation\Roms\Nintendo_NES[NI]\

SnapPath=E:\Emulation\Assets\Nintendo_NES\Video_AVI

TitlePath=E:\Emulation\Assets\Nintendo_NES\Title

BoxPath=E:\Emulation\Assets\Nintendo_NES\Box

CartPath=E:\Emulation\Assets\Nintendo_NES\Cart

ManualPath=E:\Emulation\Assets\Nintendo_NES\Manual

ControlPanelPath=E:\Emulation\Assets\Nintendo_NES\Controls

WorkingPath=E:\Emulation\Emulators\Nestopia v1.40\

MapKeys=True

WaitBeforeKeys=

SendKeys=

ReplaceDash=False

ReplaceUnder=True

Capitals=False

RemoveBrackets=True

ShowDesktop=True

Debug=True

AlsoLaunch=

OLDatZip=

LaunchBefore=E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.lnk

LaunchAfter=E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.lnk

ExcludedFiles=

CustomBackground=

PlayMusic=False

DontShowInfo=

PlaySelectionMusic=False

SelectionMusicFolder=

PCGame=False

GamesIn7Zips=False

PlayInScreenSaver=True

ShowMostPlayed=True

RandomMostPlayed=True

CDCheck=False

CDCheckFile=

MergeSets=True

RomsInFolders=

InstructionsPath=

TVAdPath=

MusicPath=

ImageNotFound=

UseDbName=

CustomArtName1=

CustomArtPath1=

CustomArtName2=

CustomArtPath2=

CustomArtName3=

CustomArtPath3=

CustomArtName4=

CustomArtPath4=

CustomArtName5=

CustomArtPath5=

GameExtenderCustomArtPath=

GameExtenderConstants=

Here's the runitgame.bat that illustrates the problem (I've been running it in debug mode while troubleshooting, but I don't think it's related):

E:

CD "E:\Emulation\Emulators\Nestopia v1.40"

@echo.

@echo E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.lnk

@echo.

@echo.

@echo Nestopia.exe "E:\Emulation\Roms\Nintendo_NES[NI]\Legend of Zelda, The (USA) (Rev A).zip"

@echo.

@echo E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.lnk

@echo.

PAUSE

E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.lnk

Nestopia.exe "E:\Emulation\Roms\Nintendo_NES[NI]\Legend of Zelda, The (USA) (Rev A).zip"

E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.lnk

My GameEx Log looks like pretty standard stuff by my estimation (no visible errors), but I can post that to if it would help to see what's going on here.

Stuff I've tried thus far:

  • Running Launch Before / Launch After commands with and without ""
  • Running the associated batch files rather than the shortcuts (.lnks)
  • Running only the Launch Before command. This works, but obviously when I exit the emulator Xpadder is still running and sending wonky input to GameEx

Any help on this would be awesome. I'm feel like I'm missing something basic here, just not sure what. I've double checked my batch files which seem to run fine on their own (I can post them too if it would help). I'm feeling a bit absurd as this should be the absolute easiest emulator to set up! :unsure:

Thanks!

Link to comment
Share on other sites

Why do you need a batchfile? You can launch Xpadder in Launch before. Launch the emulator and game from the command, and close xpadder from the launch after.

Whats the batchfile for?

Perhaps the AHK that was mentioned? What does this script do?

Link to comment
Share on other sites

Perhaps the AHK that was mentioned? What does this script do?

Perhaps, but id think that he would just compile the script to EXE. Ive been wrong before though and your probably right.

I just think there are too many things going on, perhaps the OP can tell us exactly what they are trying to accomplish between the scripts, batchfiles and shortcuts. Other than using the LNK to make the bat file run minimized.

Link to comment
Share on other sites

Hi Guys. Thanks for checking this out.

Basically I wrote the AHK script to allow the use of save states and load states using a controller. The AHK script sends the Save / Load state keyboard shortcut (F5 or F7 respectively in this case) when I press a specific button combination on the controller. When the Save / Open state dialog box opens up, the script swaps out the loaded Xpadder profile for another Xpadder profile that allows the controller to act as a mouse. When the dialog box closes, the script reloads the original 'gaming' controller profile.

The batch process simply allows me to load and/or exit the Xpadder profile and script simultaneously (and the .lnk lets it run minimized). Another approach would be to run a small .vbs script in place of the .lnks (trouble is in my experience Windows 7 doesn't really like to run 'hidden' .vbs scripts). It's also occurred to me that the .ahk script could take control of the whole shebang, although honestly either of these options sounds like it's getting a bit elaborate, particularly where GameEx has this functionality built in.

I've also thought about compiling the AHK script to an executable, so maybe that would be the next thing to try out. I've mainly left it uncompiled in the event that I need to modify anything in the meantime.

Edit: Running the compiled executable doesn't seem to make any difference vs. running the raw AHK script.

Thanks again for having a look!

Link to comment
Share on other sites

UPDATE: I've more or less verified that it doesn't matter what I'm running under the Launch After option, it's always running immediately after running the emulator. In order to verify this, I entered paths to the batch files themselves (rather than the shortcuts) under Launch Before and Launch After options. I commented out everything contained in the batch files (meaning they were completely empty .bat files from a functional perspective). This still resulted in the following runitgame.bat:

E:

CD "E:\Emulation\Emulators\Nestopia v1.40"

@echo.

@echo "E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.bat"

@echo.

@echo.

@echo Nestopia.exe "E:\Emulation\Roms\Nintendo_NES[NI]\Legend of Zelda, The (Europe) (Rev A).zip"

@echo.

@echo "E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.bat"

@echo.

PAUSE

"E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.bat"

Nestopia.exe "E:\Emulation\Roms\Nintendo_NES[NI]\Legend of Zelda, The (Europe) (Rev A).zip"

"E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.bat"

Note that everything runs as expected if I don't enter anything under Launch After (but the supporting processes continue to run after I exit the emulator). If I don't enter anything under Launch Before but leave the Launch After process in place, it still runs that process immediately after running the emulator.

This leads me to believe that the error has nothing to do with the contents of my batch file(s), .lnk(s), or AHK script. This is not to say that I don't think I've made an error somewhere, but I think that I've possibly made an error in my emulator configuration (see my first post) rather than the supporting Launch Before / Launch After files (I could of course be absolutely wrong on this point ;) ).

Is anyone else running a batch file as a Launch After process? If so does my emulator config appear to be in error? Am I simply misunderstanding the functionality of Launch After (meaning: is this intended to run upon exiting the game/emulator)? Is this a bug in GameEx (I rather doubt it)? Any help I can get is greatly appreciated at this point. Thanks!

Link to comment
Share on other sites

Why do you need a batchfile? You can launch Xpadder in Launch before. Launch the emulator and game from the command, and close xpadder from the launch after.

Whats the batchfile for?

I've had bad luck calling XPadder from the launch before/after commands. I don't know why since XPadder is supposed to be fully command line compatible, but there you go...it doesn't work from GameEx. For whatever reason, things work fine when called from a batch file though (AHK should work too).

Link to comment
Share on other sites

Thanks for the info bkenobi!

I think Iâ??ve decided to let the AHK script handle the closing (and potentially the starting) of Xpadder. One last question though (this probably should have been my very first question):

Am I correct to assume that the Launch After process in GameEx should run immediately after exiting the game/emulator, and not immediately after launching the emulator? Which is to say, at what point in processing should the Launch After command be running in GameEx?

Ideally I'd still like Launch After to have the ability to close the AHK script when I exit the emulator. This would be via batch process or taskkill command, although I suppose the AHK script could also close itself if necessary.

Iâ??m beginning to suspect that my whole line of thought here is based on a faulty premise of what Iâ??m assuming about the Launch After option. :unsure:

Link to comment
Share on other sites

Just for the record here...

I found Xpadder works great if you launch and close it from Advanced Config - Tweaks menu. I call up Xpadder and have it load the default (blank) profile, and close when GameEx quits.

I use the Launch Before and After commands to load up the profile for that emu and then reload the blank one.

Does this help you at all?

Link Here

Link to comment
Share on other sites

Thanks for the info bkenobi!

I think Iâ??ve decided to let the AHK script handle the closing (and potentially the starting) of Xpadder. One last question though (this probably should have been my very first question):

Am I correct to assume that the Launch After process in GameEx should run immediately after exiting the game/emulator, and not immediately after launching the emulator? Which is to say, at what point in processing should the Launch After command be running in GameEx?

Ideally I'd still like Launch After to have the ability to close the AHK script when I exit the emulator. This would be via batch process or taskkill command, although I suppose the AHK script could also close itself if necessary.

Iâ??m beginning to suspect that my whole line of thought here is based on a faulty premise of what Iâ??m assuming about the Launch After option. :unsure:

Launch after is suppose to launch after the emulator closes is how I believed it to work as well. Maybe it's not working correctly. I'd have to do some testing. I will also point Tom to this discussion. Please stand by!

Link to comment
Share on other sites

Just for the record here...

I found Xpadder works great if you launch and close it from Advanced Config - Tweaks menu. I call up Xpadder and have it load the default (blank) profile, and close when GameEx quits.

I use the Launch Before and After commands to load up the profile for that emu and then reload the blank one.

Does this help you at all?

Link Here

Thanks Adultery that’s an excellent suggestion. I was very interested when I saw that post. It may not fix my current issue, but I think it’s a good option for running Xpadder in GameEx. It also saves a bit of processing when starting the emulator(s) since Xpadder is already running.

My main issue is that Launch After seems to be executing immediately after running the emulator, rather than when it exits (see my runitgame.bat examples).

Launch after is suppose to launch after the emulator closes is how I believed it to work as well. Maybe it's not working correctly. I'd have to do some testing. I will also point Tom to this discussion. Please stand by!

Thanks for the confirmation fReq. It’s just occurred to me that I still need to test Launch After with a simple command rather than running a batch file. At least from the comments here, that option seems like it's working for various users. I’ll give it a go tonight (or later – my wife has been feeling like she’s in competition with GameEx this week). GameEx you are a fickle mistress! :wub: It would be weird if this issue was tied only to running batch jobs as a Launch After parameter, but stranger things have happened I suppose.

Thanks again you guys!

Link to comment
Share on other sites

If that were the case it wouldn't load my profiles correctly (which it does), so I have to say I'm 100% sure it launches LaunchAfter after the emulator quits but before GameEx regains focus. It seems some things work better than others though... it won't close Xpadder from the command line but it *will* execute a profile change from the command line.

Same with DaemonTools, it ejects the drive after the emulator exits for me.

Link to comment
Share on other sites

If GameEx is watching the wrong process, it will fire the Launch After command after the emulator loads, too.

Thanks for confirmation bkenobi. That brings me around full circle to wondering whether I have something misconfigured for the emulator itself. This functionality seems to be working for some users as Adultery confirms above.

Hereâ??s my emulator config in the event that it might indicate the source of the error:

[Emulator_4]

Enabled=True

System=Nintendo NES

Category=Console

Emulator=Nestopia

Version=1.41

Rating=

DownloadUrl=http://www.gamesdbase.com/setupwizard/emulators/download/Nestopia.7z

RequiredFiles=

Website=http://nestopia.sourceforge.net/

Info=Nintendo NES 8bit emulator

TITLETEXT=Nintendo NES

STARTPAGENAME=Nintendo NES

StartPageLogo=Nintendo NES

Command=Nestopia.exe "[ROMPATH]\[ROMFILE]"

ROMFilter=

DATABASE=[Console] Nintendo NES

configFile=[Mapping Off] Exit (Process Close)

MAPFile=

RomPath=E:\Emulation\Roms\Nintendo_NES[NI]\

SnapPath=E:\Emulation\Assets\Nintendo_NES\Video_AVI

TitlePath=E:\Emulation\Assets\Nintendo_NES\Title

BoxPath=E:\Emulation\Assets\Nintendo_NES\Box

CartPath=E:\Emulation\Assets\Nintendo_NES\Cart

ManualPath=E:\Emulation\Assets\Nintendo_NES\Manual

ControlPanelPath=E:\Emulation\Assets\Nintendo_NES\Controls

WorkingPath=E:\Emulation\Emulators\Nestopia v1.40\

MapKeys=True

WaitBeforeKeys=

SendKeys=

ReplaceDash=False

ReplaceUnder=True

Capitals=False

RemoveBrackets=True

ShowDesktop=True

Debug=True

AlsoLaunch=

OLDatZip=

LaunchBefore=E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.bat

LaunchAfter=E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.bat

ExcludedFiles=

CustomBackground=

PlayMusic=False

DontShowInfo=

PlaySelectionMusic=False

SelectionMusicFolder=

PCGame=False

GamesIn7Zips=False

PlayInScreenSaver=True

ShowMostPlayed=True

RandomMostPlayed=True

CDCheck=False

CDCheckFile=

MergeSets=True

RomsInFolders=

InstructionsPath=

TVAdPath=

MusicPath=

ImageNotFound=

UseDbName=

CustomArtName1=

CustomArtPath1=

CustomArtName2=

CustomArtPath2=

CustomArtName3=

CustomArtPath3=

CustomArtName4=

CustomArtPath4=

CustomArtName5=

CustomArtPath5=

GameExtenderCustomArtPath=

GameExtenderConstants=

I can post my batch files later if that would help to troubleshoot the issue, but theyâ??re really nothing fancy.

Launch Before: Start Xpadder with a controller profile. Start an AHK script

Launch After: Close Xpadder, Taskkill the AHK script

Itâ??s worth noting that I still have the error even when I remove all commands from the Launch Before / Launch After batch files.

Iâ??d definitely like to figure this out using the built-in GameEx functionality, but if not Iâ??m leaning pretty heavily towards using only the AHK script as the Launch Before parameter. From there, the script can handle starting Xpadder and the controller profile, as well as and exiting Xpadder and shutting itself down when the emulator closes.

Itâ??s not as neat or as easily configurable as Iâ??d like, but Iâ??m pretty sure I can pull it off.

Link to comment
Share on other sites

Ok. Since you couldn't get into the chat room, please try the following:

Launch Before:

start "" "E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaStartup.bat"

Launch After:

start "" "E:\Emulation\Emulators\Nestopia v1.40\batch\NestopiaExit.bat"

Launch before/after was designed for executables in mind. However, tweaking the command-line will make it work.

Link to comment
Share on other sites

Thanks fRequEnCy!

As always you are the man! :D That worked perfectly. Also thanks to everyone else who helped out with this problem! I can now move on to setting up the next system. Please feel free to mark this thread as [RESOLVED].

Yay! Glad it worked. Enjoy! ;)

Link to comment
Share on other sites

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