Another update to my script, I managed to find a way to start STEAM in BIG PICTURE MODE. All that is required is a small registry tweak. Sadly steam changes it back every time so the script itself has to handle the change.
Usage:
call launcher_steam with an argument that is the steamid of the game
ex: launcher_steam 40800
Script will start steam in big picture mode by default, in this mode steam will **not** close by itself since it's impossible to track the BPM in-game overlay.
In desktop mode steam will close itself if it wasn't running in the first place
Arguments:
launcher_steam gameid [PAUSE] [OFFLINE] [BPM]
only the first argument is mandatory, arguments are parsed in order and if null they will use their default value.
If you need to set OFFLINE you **must** set a value for PAUSE, if you need to set BPM you **must** set a value for PAUSE **and** OFFLINE
PAUSE will define if a process must be tracked
possible values are: TRUE|FALSE
default is: TRUE
OFFLINE will define if STEAM must be started in offline mode
possible values are: TRUE|FALSE
default is: FALSE
BPM will define if STEAM must be started in big picture mode
possible values are: TRUE|FALSE
default is: TRUE
Code:
@echo off
REM simple usage:
REM call launcher_steam with an argument that is the steamid of the game
REM ex: launcher_steam 40800
REM script will start steam in big picture mode by default
REM in this mode steam will **not** close by itself since it's impossible to track the BPM in-game overlay
REM in desktop mode steam will close itself if it wasn't running in the first place
REM arguments:
REM launcher_steam gameid [PAUSE] [OFFLINE] [BPM]
REM only the first argument is mandatory, arguments are parsed in order and if null they will use their default value
REM if you need to set OFFLINE you **must** set a value for PAUSE, if you need to set BPM you **must** set a value for PAUSE **and** OFFLINE
REM PAUSE will define if a process must be tracked
REM possible values are: TRUE|FALSE
REM default is: TRUE
REM OFFLINE will define if STEAM must be started in offline mode
REM possible values are: TRUE|FALSE
REM default is: FALSE
REM BPM will define if STEAM must be started in big picture mode
REM possible values are: TRUE|FALSE
REM default is: TRUE
REM global variables usually these won't need to be tweaked
REM the process that must be tracked
set process_1=gameoverlayui.exe
REM steam process
set process_2=steam.exe
REM process to be paused
set process_3=xbmc.exe
REM don't touch this
set ignore_result=INFO:
REM initialize iteration
set iteration=0
REM if second argument is true or not set it will pause process_3 while process_1 is running
IF "%2"=="" (
set PAUSE=TRUE
) ELSE (
IF "%2"=="TRUE" (
set PAUSE=TRUE
) ELSE (
set PAUSE=FALSE
)
)
REM if third argument is true it start steam as offline
IF "%3"=="" (
set OFFLINE=FALSE
) ELSE (
IF "%3"=="TRUE" (
set OFFLINE=TRUE
) ELSE (
set OFFLINE=FALSE
)
)
REM if fourth argument is true it will not start steam in bpm
IF "%4"=="" (
set BPM=TRUE
) ELSE (
IF "%4"=="TRUE" (
set BPM=FALSE
) ELSE (
set BPM=TRUE
)
)
echo --
echo PAUSE=%PAUSE%
echo OFFLINE=%OFFLINE%
echo BPM=%BPM%
set STEAMSTATE=STOPPED
set GAMESTATE=STOPPED
set LAUNCHERSTATE=INITIALIZING
echo --
echo --
REM setup steam to start in bpm if required
IF %BPM%==TRUE (
REM start "REGEX" regedit /s c:\windows\bpm.reg
set process_1=steam.exe
)
:CHECKSTEAM
echo --
if %LAUNCHERSTATE%==INITIALIZING set limit=5
if %LAUNCHERSTATE%==STARTSTEAM set limit=60
echo check if steam is running
echo -----------------------------------------------------------------
set iteration=0
set interval=1
set limit=10
echo launcher status: %LAUNCHERSTATE%
echo steam status: %STEAMSTATE%
echo game status: %GAMESTATE%
:0
set var=NOT_RUNNING
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_2%"`) do if not %%A==%ignore_result% set var=RUNNING
echo waiting...
set /a iteration=iteration+1
timeout %interval% > null
IF %var% == NOT_RUNNING (
IF %LAUNCHERSTATE%==INITIALIZING (
set LAUNCHERSTATE=STARTSTEAM
goto :LAUNCH
)
IF %LAUNCHERSTATE%==STARTSTEAM (
if %iteration%==%limit% goto :FAILURE
goto :0
)
IF %LAUNCHERSTATE%==STOPSTEAM (
set STEAMSTATE=STOPPED
goto :EXIT
)
)
IF %var% == RUNNING (
IF %LAUNCHERSTATE%==INITIALIZING (
set STEAMSTATE=ALREADYRUNNING
set LAUNCHERSTATE=STARTINGGAME
goto :LAUNCH
)
IF %LAUNCHERSTATE%==STARTSTEAM (
IF %STEAMSTATE%==STOPPED set STEAMSTATE=STARTED
set LAUNCHERSTATE=STARTINGGAME
goto :CHECKGAME
)
IF %LAUNCHERSTATE%==STOPSTEAM (
if %iteration%==%limit% goto :FAILURE
goto :0
)
)
exit /B
:CHECKGAME
echo --
echo check if game is running
echo -----------------------------------------------------------------
set iteration=0
set limit=60
IF %LAUNCHERSTATE% == STARTINGGAME (
set interval=1
)
IF %LAUNCHERSTATE% == WAITING (
set interval=10
)
echo launcher status: %LAUNCHERSTATE%
echo steam status: %STEAMSTATE%
echo game status: %GAMESTATE%
:1
set var=NOT_RUNNING
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%A==%ignore_result% set var=RUNNING
echo waiting...
set /a iteration=iteration+1
timeout %interval% > null
IF %var% == NOT_RUNNING (
IF %LAUNCHERSTATE% == STARTINGGAME (
if %iteration%==%limit% goto :FAILURE
goto :1
)
IF %LAUNCHERSTATE% == WAITING (
SET LAUNCHERSTATE=STOPSTEAM
SET GAMESTATE=STOPPED
goto :STOP
)
)
IF %var% == RUNNING (
IF %LAUNCHERSTATE% == STARTINGGAME (
SET LAUNCHERSTATE=WAITING
SET GAMESTATE=STARTED
if %PAUSE%==TRUE (
echo pausing %process_3%
pssuspend %process_3%
)
goto :CHECKGAME
)
IF %LAUNCHERSTATE% == WAITING (
goto :1
)
)
exit /B
:LAUNCH
echo --
echo call launcher
echo -----------------------------------------------------------------
set iteration=0
set interval=1
set limit=60
echo launcher status: %LAUNCHERSTATE%
echo steam status: %STEAMSTATE%
echo game status: %GAMESTATE%
start "GAME" "steam://rungameid/"%1
echo waiting...
set /a iteration=iteration+1
timeout %interval% > null
IF %STEAMSTATE%==ALREADYRUNNING (
goto :CHECKGAME
)
IF %STEAMSTATE%==STOPPED (
goto :CHECKSTEAM
)
exit /B
:STOP
echo --
echo stopping launcher
echo -----------------------------------------------------------------
set iteration=0
set interval=1
set limit=60
echo launcher status: %LAUNCHERSTATE%
echo steam status: %STEAMSTATE%
echo game status: %GAMESTATE%
if %PAUSE%==TRUE (
echo unpausing %process_3%
pssuspend -r %process_3%
)
IF %STEAMSTATE%==ALREADYRUNNING (
set STEAMSTATE=WONTSTOP
goto :EXIT
)
IF %STEAMSTATE%==STARTED (
IF %BPM%==FALSE (
start C:\Games\steam\steam.exe -shutdown
echo waiting...
set /a iteration=iteration+1
timeout %interval% > null
)
goto :CHECKSTEAM
)
echo waiting...
:EXIT
echo --
echo cleanup
echo -----------------------------------------------------------------
set iteration=0
set interval=1
set limit=60
echo launcher status: %LAUNCHERSTATE%
echo steam status: %STEAMSTATE%
echo game status: %GAMESTATE%
echo done..
timeout %limit%
exit /B
:FAILURE
echo FAILURE %LAUNCHERSTATE%
exit /B
To use it you must have
PsTools installed and on your path. I usually extract those to
C:\WINDOWS to make it easy.
Also to use BIG PICTURE MODE tweak you must be able to import settings to registry (so no UAC) or you could schedule an import process to run every hour or so. If you have UAC disabled you can save the text below as
C:\WINDOWS\BPM.REG and uncomment the REGEDIT line at this section:
Code:
REM setup steam to start in bpm if required
IF %BPM%==TRUE (
REM start "REGEX" regedit /s c:\windows\bpm.reg
set process_1=steam.exe
)
If you're going to use task scheduler for this purpose you should run
regedit /s registryfile.reg
The registry changes that must be made are the following:
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\steam\Shell\Open\Command]
@="\"C:\\Games\\Steam\\steam.exe\" \"-bigpicture\" \"%1\""