2012-09-01, 06:17
(2012-08-31, 23:20)fr500 Wrote: Hey, I updated my steam script so it no longer kills steam, now it closes it gracefully, also now it timeouts if it can start an app without pausing XBMC, here are my scripts
These scripts pause XBMC so it's not consuming any resources while games are running. First my steam script:
All you need to do is point Advanced launcher to the script and use the Steam Id of the game you want to launch, you can find the ID by creating a steam desktop icon and checking it's properties. for it to function you need to have steam community in-game enabled as it will track for gameoverlayui.exe. Some steam IDs here.
Code:@echo off
REM *****************************************************************************************************
REM Usage:
REM call launcher_steam with an argument that is the steamid of the game
REM ex: launcher_steam 40800
REM script will track for gameoverlayui.exe
REM *****************************************************************************************************
REM setup variables
set limit=120
set iteration=0
echo STARTING GAME
echo *******************************************************
start "GAME" "steam://rungameid/"%1
set process_1=gameoverlayui.exe
set process_2=steam.exe
set ignore_result=INFO:
timeout 30
echo CHECK IF STEAM HAS STARTED
echo *******************************************************
:0
set var=notrunning
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_2%"`) do if not %%A==%ignore_result% set var=running
echo steam %var% after %iteration% seconds
timeout 1
set /a iteration=iteration+1
if %iteration% == %limit% goto :3
if %var% == notrunning goto :0
set iteration=0
echo STEAM RUNNING CHECK IF GAME HAS STARTED
echo *******************************************************
:1
set var=notrunning
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%A==%ignore_result% set var=running
echo game %var% after %iteration% seconds
timeout 1
set /a iteration=iteration+1
if %iteration% == %limit% goto :5
if %var% == notrunning goto :1
echo GAME STARTED PAUSE XBMC
echo *******************************************************
pssuspend XBMC.exe
echo GAME STARTED CHECK IF GAME IS STILL RUNNING
echo *******************************************************
:2
set var=notrunning
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%A==%ignore_result% set var=running
echo game still %var%
timeout 5
if %var% == running goto :2
echo GAME STOPPED RESUME XBMC AND SHUTDOWN STEAM
echo *******************************************************
pssuspend -r XBMC.exe
start C:\Games\steam\steam.exe -shutdown
set limit=600
set iteration=0
echo CHECK IF STEAM IS STILL RUNNING
echo *******************************************************
:3
set var=notrunning
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_2%"`) do if not %%A==%ignore_result% set var=running
echo steam still %var%
timeout 1
set /a iteration=iteration+1
if %iteration% == %limit% goto :4
if %var% == running goto :3
exit
:4
echo STEAM DIDN'T SHUTDOWN AFTER %limit% SECONDS, KILLING IT
echo *******************************************************
taskkill /IM steam.exe /f
exit
:5
echo GAME %1 DIDN'T START OR PROCESS %2 COULDNT' BE FOUND
echo *******************************************************
echo GAME %1 DIDN'T START OR PROCESS %2 COULDNT' BE FOUND > c:\launcherlog.txt
echo SHUTDOWN STEAM
echo *******************************************************
start C:\Games\steam\steam.exe -shutdown
echo CHECK IF STEAM IS STILL RUNNING
echo *******************************************************
goto :3
The second one, a generic .lnk launcher, it will launch the game.lnk file you specify (no need to add .lnk to arguments) and will track any specific process you want it to track, remember to set the path to your launchers in the batch file itself on this line:
set launcher_path=C:\path\to\your\shortcuts\
Code:@echo off
REM *****************************************************************************************************
REM Usage:
REM call launcher_regular with 2 arguments, first argument is the game shortcutname, second argument
REM is the name of the process that must be tracked
REM ex: launcher_regular supermeatboy supermeatboy.exe
REM *****************************************************************************************************
REM setup variables
set limit=120
set iteration=0
set launcher_path=C:\path\to\your\shortcuts\
echo STARTING GAME
echo *******************************************************
start "GAME" %launcher_path%\%1.lnk
set process_1=%2
set ignore_result=INFO:
timeout 10
echo CHECK IF GAME HAS STARTED
echo *******************************************************
:1
set var=notrunning
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%A==%ignore_result% set var=running
echo game %var% after %iteration% seconds
timeout 1
set /a iteration=iteration+1
if %iteration% == %limit% goto :3
if %var% == notrunning goto :1
echo GAME STARTED PAUSE XBMC
echo *******************************************************
pssuspend XBMC.exe
echo GAME STARTED CHECK IF GAME IS STILL RUNNING
echo *******************************************************
:2
set var=notrunning
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%A==%ignore_result% set var=running
echo game still %var%
timeout 5
if %var% == running goto :2
echo GAME STOPPED RESUME XBMC
echo *******************************************************
pssuspend -r XBMC.exe
exit
:3
echo GAME %1 DIDN'T START OR PROCESS %2 COULDNT' BE FOUND
echo *******************************************************
echo GAME %1 DIDN'T START OR PROCESS %2 COULDNT' BE FOUND > c:\launcherlog.txt
exit
Both scripts will log to c:\launcherlog.txt in case of an error, hope these are helpful
Thank you. I will go through these scripts in order to integrate them into rom-jacket.