Files
gtav-src/tools_ng/bin/RockstarTargetManager2/_connect_target_durango.bat
T
2025-09-29 00:52:08 +02:00

75 lines
3.0 KiB
Batchfile
Executable File

::
:: %RS_TOOLSBIN%\RockstarTargetManager\_connect_target_durango.bat should not be directly modified.
::
:: This file gets automatically copied from %RS_CODEBRANCH%\rage\base\tools\ui\RockstarTargetManager\RockstarTargetManager\_connect_target_durango.bat
:: when a new version of R*TM is released (see %RS_CODEBRANCH%\rage\base\tools\ui\RockstarTargetManager\CopyToTools.bat).
::
if not exist "%DurangoXDK%\bin" (
echo Xbox One XDK or support tools not installed as expected
exit 1
)
:: Make sure Durango XDK is in the path
set PATH=%DurangoXDK%\bin;%PATH%
if not exist "%exename%.exe" (
echo Can't find Xbox One executable [%exename%.exe]
exit 1
)
:: If no target was specified, then get the address of the default target.
if "%target_ip%" == "" (
echo No ip address specied, looking up default target.
rem :: What is this ridiculous syntax? See
rem :: http://stackoverflow.com/questions/7516064/escaping-double-quote-in-delims-option-of-for-f
rem :: Why ^"^" instead of just ^"? Because having just one " confuses Emacs syntax highlighting.
for /F usebackq^ tokens^=2^ delims^=^"^" %%a in (`xbconnect ^| find "Default console set to "`) do set target_ip=%%a
if "!target_ip!" == "" (
echo No default Xbox One target selected
exit 1
)
)
:: Strip off the optional access key from the target ip address
for /F "tokens=1* delims=+" %%a in ("%target_ip%") do set target_ip_bare=%%a
:: Kill any currently running game.
call "%batch_dir%..\..\script\util\kill_durango_processes.bat" [%target_ip%]
:: Before we start R*TM, make sure that kernel debugging is enabled. Otherwise R*TM will try
:: to enable it and in the process reboot the console while we are trying to deploy to it.
:: This should only really happen when running on a new kit for the first time.
set enablekerneldebugging=false
for /F "usebackq tokens=1,2" %%a in (`xbconfig /x%target_ip% EnableKernelDebugging`) do set enablekerneldebugging=%%b
if not "%enablekerneldebugging%" == "true" (
echo %target_ip% kernel debugging not yet enabled
echo Enabling and rebooting console
echo.
xbconfig /x%target_ip% EnableKernelDebugging=true
echo.
xbreboot /x%target_ip%
rem :: Wait a bit before calling xbconnect, as if we call it too quickly it can succeed before the reboot has started.
ping -w 5000 -n 2 127.0.0.1 >nul
rem :: Call xbconnect continiously until it returns without error.
:wait_reboot
xbconnect /q %target_ip% > nul
if errorlevel 1 goto wait_reboot
echo Reboot complete.
)
:: If not running with R*TM, determine what type of console this is, devkit or testkit.
if not "%RS_RTM_DISABLE%" == "" (
set tooltype=TestKit
for /F "usebackq tokens=2" %%a in (`xbDiagInfo /x%target_ip% ^| find "CCat2"`) do set tooltype=DevKit
if errorlevel 1 (
echo Failed to determine if running on a testkit or a devkit.
exit 1
)
echo Console type = !tooltype!
echo.
if "!tooltype!" == "DevKit" (
set autoGeneratedCmdline=!autoGeneratedCmdline! -devkit
)
)