diff --git a/Java/RT-RP Install Script - JAVA.nsi b/Java/RT-RP Install Script - JAVA.nsi index 3ed24bd..c9e83ac 100644 --- a/Java/RT-RP Install Script - JAVA.nsi +++ b/Java/RT-RP Install Script - JAVA.nsi @@ -14,7 +14,7 @@ Name "Reverse Tethering RePack" ; The file to write -OutFile "C:\Users\$PROFILE\Desktop\RT-RP Installer (Java).exe" +OutFile "$DESKTOP\RT-RP Installer (Java).exe" ; Request application privileges for Windows Vista and higher RequestExecutionLevel admin @@ -23,12 +23,15 @@ RequestExecutionLevel admin Unicode True ; The default installation directory -InstallDir $PROGRAMFILES\RTRP +InstallDir $PROGRAMFILES64\RTRP ; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM "Software\RTRP" "Install_Dir" +; Path to the folder containing files to pack - relative to this script +!define SRCDIR "Source" + ;-------------------------------- ; Pages @@ -52,9 +55,12 @@ Section "Java Runtime & Core Files (required)" ; Put file there - File /r "C:\Users\KUIJEN\Desktop\Source\" + File /r "${SRCDIR}\" - Execwait "$INSTDIR\Support\Java Runtime Installer.exe" + ; Install Java Runtime if bundled + IfFileExists "$INSTDIR\Support\Java Runtime Installer.exe" 0 skipJava + ExecWait "$INSTDIR\Support\Java Runtime Installer.exe" + skipJava: ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\RTRP "Install_Dir" "$INSTDIR" @@ -117,13 +123,12 @@ Function .onInstSuccess IfFileExists "$INSTDIR\Text Files\README.txt" openReadMe - ; Delete regardless of whether readme exists or not + ; Delete legacy config filename if present Delete "$DOCUMENTS\RT-RP Config.txt" Return openReadMe: ExecShell "open" "$INSTDIR\Text Files\README.txt" Delete "$DOCUMENTS\RT-RP Config.txt" - Delete "$DOCUMENTS\RT-RP Config.ini" Return FunctionEnd diff --git a/Java/START.cmd b/Java/START.cmd index 6ba7c62..373efe6 100644 --- a/Java/START.cmd +++ b/Java/START.cmd @@ -1,461 +1,4 @@ - -@echo off -REM Kills Virtual Desktop when the script starts or resets -:start - tasklist >NUL | findstr "Virtual Desktop Streamer" - taskkill >NUL /F /IM VirtualDesktop.Streamer.exe - cls -) -REM Displays the Logo - @echo on - @echo Repack By KUIJEN - Gnirehtet By Genymobile - Java By Oracle - ADB By Google - @echo[ - @echo[ - @echo[ - @echo off & Title RT-RP V2.6.0 - echo/ /$$$$$$$ /$$$$$$$$ /$$$$$$$ /$$$$$$$ - echo/ ^| $$__ $$^|__ $$__/ ^| $$__ $$^| $$__ $$ - echo/ ^| $$ \ $$ ^| $$ ^| $$ \ $$^| $$ \ $$ - echo/ ^| $$$$$$$/ ^| $$ /$$$$$$^| $$$$$$$/^| $$$$$$$/ - echo/ ^| $$__ $$ ^| $$^|______/^| $$__ $$^| $$____/ - echo/ ^| $$ \ $$ ^| $$ ^| $$ \ $$^| $$ - echo/ ^| $$ ^| $$ ^| $$ ^| $$ ^| $$^| $$ - echo/ ^|__/ ^|__/ ^|__/ V2.6.0 ^|__/ ^|__/^|__/ - echo/ - echo/ JAVA EDITION - echo/ - echo/ - echo/ - @echo off -) - -setlocal enabledelayedexpansion - -REM Defines the Backup Config location as "cfgbk" -set "cfgbk=Text Files\Backup Config.txt" - -REM Defines the Config file location as "config" -set "config=%userprofile%\Documents\RT-RP Config.ini" - -REM Checks if the config file exists and puts it in it's correct place if it isn't -if not exist "%config%" ( - copy >NUL "%cfgbk%" "%config%" - echo Config File Not Found, Copied New Config To Documents. - echo. -) - -REM Reads and processes each line in config.txt -for /f "usebackq tokens=1,2 delims==" %%A in ("%config%") do ( - REM Convert true/false to 1/0 - if /i "%%B"=="true" ( - set "%%A=1" - ) else if /i "%%B"=="false" ( - set "%%A=0" - ) else ( - set "%%A=%%B" - ) -) - -REM Define the path to check for vrmonitor.exe (SteamVR) -set "steamvrpath=C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win64\vrmonitor.exe" - - -IF not EXIST "%steamvrpath%" ( - echo SteamVR Is Not Installed! -) - - -REM Check if vrmonitor.exe (SteamVR) is running -tasklist /FI "IMAGENAME eq vrmonitor.exe" 2>NUL | find /I "vrmonitor.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo SteamVR is Already Running! - goto :res1 - -) - -REM Check if SteamVR should launch -if "%Launch_SteamVR%"=="1" ( - REM Check if vrmonitor.exe exists at the specified path - IF EXIST "%steamvrpath%" ( - start "" "%steamvrpath%" - echo SteamVR Started! - ) ELSE ( - (echo SteamVR Was Not Found!) && pause & rundll32 url.dll,FileProtocolHandler https://store.steampowered.com/app/250820/SteamVR/ - ) -) ELSE ( - goto :res1 -) - -:res1 - -REM Define the path to check for Amethyst.exe -set "amethystPath=%Amethyst%" - -REM Check if Amethyst.exe is running -tasklist /FI "IMAGENAME eq Amethyst.exe" 2>NUL | find /I "Amethyst.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo Amethyst is Already Running! - goto :res2 -) - -REM Check if Amethyst should launch -if "%Launch_Amethyst%"=="1" ( - REM Check if Amethyst.exe exists at the specified path - IF EXIST "%amethystPath%" ( - start "" "%amethystPath%" - echo Amethyst Started! - ) ELSE ( - echo Amethyst Was Not Found! - ) -) - -:res2 - -REM Define the path to check for slimevr.exe -set "slimevrPath=%SlimeVR%" - -REM Check if slimevr.exe is running -tasklist /FI "IMAGENAME eq slimevr.exe" 2>NUL | find /I "slimevr.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo SlimeVR Server is Already Running! - goto :res3 -) - -REM Check if SlimeVR should launch -if "%Launch_SlimeVR%"=="1" ( - REM Check if slimevr.exe exists at the specified path - IF EXIST "%slimevrPath%" ( - start "" "%slimevrPath%" - echo SlimeVR Server Started! - ) ELSE ( - echo SlimeVR Server Was Not Found! - ) -) - -:res3 - -REM Define the path to check for VRCFaceTracking.exe -set "VRCFTPath=%VRCFT%" - -REM Check if VRCFaceTracking.exe is running -tasklist /FI "IMAGENAME eq VRCFaceTracking.exe" 2>NUL | find /I "VRCFaceTracking.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo VRCFT is Already Running! - goto :res4 -) - -REM Check if VRCFT should launch -if "%Launch_VRCFT%"=="1" ( - REM Check if VRCFaceTracking.exe exists at the specified path - IF EXIST "%VRCFTPath%" ( - start "" "%VRCFTPath%" - echo VRCFT Started! - ) ELSE ( - echo VRCFT Was Not Found! - ) -) ELSE ( - goto :res4 -) - -:res4 - -REM Define the path to check for VirtualDesktop.Streamer.exe -set "VDPath=%Virtual_Desktop%" - -REM Check if VirtualDesktop.Streamer.exe is running -tasklist /FI "IMAGENAME eq VirtualDesktop.Streamer.exe" 2>NUL | find /I "VirtualDesktop.Streamer.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo Virtual Desktop Streamer is Already Running! - goto :res5 -) - -REM Check if Virtual Desktop should launch -if "%Launch_Virtual_Desktop%"=="1" ( - REM Check if VirtualDesktop.Streamer.exe exists at the specified path - IF EXIST "%VDPath%" ( - start "" "%VDPath%" - echo Virtual Desktop Streamer Started! - ) ELSE ( - echo Virtual Desktop Streamer Was Not Found! - ) -) ELSE ( - goto :res5 -) - -:res5 - -REM Define the path to check for VHConsole.exe (Vive Hub) -set "VIVEpath=%Vive_Hub%" - -REM Check if VHConsole.exe is running -tasklist /FI "IMAGENAME eq VHConsole.exe" 2>NUL | find /I "VHConsole.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo Vive Hub is Already Running! - goto :res6 -) - -REM Check if Vive Hub should launch -if "%Launch_VIVE_HUB%"=="1" ( - REM Check if VHConsole.exe exists at the specified path - IF EXIST "%VIVEpath%" ( - start "" "%VIVEpath%" - echo Vive Hub Started! - ) ELSE ( - echo Vive Hub Was Not Found! - ) -) ELSE ( - goto :res6 -) - -:res6 - -REM Define the path to check for ALVR Dashboard.exe -set "ALVRpath=%ALVR%" - -REM Check if ALVR Dashboard.exe is running -tasklist /FI "IMAGENAME eq ALVR Dashboard.exe" 2>NUL | find /I "ALVR Dashboard.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo ALVR is Already Running! - goto :res7 -) - -REM Check if ALVR should launch -if "%Launch_ALVR%"=="1" ( - REM Check if ALVR Dashboard.exe exists at the specified path - IF EXIST "%ALVRpath%" ( - start "" "%ALVRpath%" - echo ALVR Started! - ) ELSE ( - echo ALVR Was Not Found! - ) -) ELSE ( - goto :res7 -) - -:res7 - -REM Define the path to check for VRCX.exe -set "VRCXpath=%VRCX%" - -REM Check if VRCX.exe is running -tasklist /FI "IMAGENAME eq VRCX.exe" 2>NUL | find /I "VRCX.exe" >NUL -if %ERRORLEVEL% EQU 0 ( - echo VRCX is Already Running! - goto :res8 -) - -REM Check if VRCX should launch -if "%Launch_VRCX%"=="1" ( - REM Check if VRCX.exe exists at the specified path - if exist "%VRCXpath%" ( - start "" "%VRCXpath%" - echo VRCX Started! - ) else ( - echo VRCX Was Not Found! - ) -) else ( - goto :res8 -) - -:res8 - -REM Custom app launch stuff -if "!Launch_APP1!"=="1" ( - if exist "!APP1_path!" ( - start "" "!APP1_path!" - echo !APP1! Started! - ) else ( - echo !APP1! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP2!"=="1" ( - if exist "!APP2_path!" ( - start "" "!APP2_path!" - echo !APP2! Started! - ) else ( - echo !APP2! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP3!"=="1" ( - if exist "!APP3_path!" ( - start "" "!APP3_path!" - echo !APP3! Started! - ) else ( - echo !APP3! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP4!"=="1" ( - if exist "!APP4_path!" ( - start "" "!APP4_path!" - echo !APP4! Started! - ) else ( - echo !APP4! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP5!"=="1" ( - if exist "!APP5_path!" ( - start "" "!APP5_path!" - echo !APP5! Started! - ) else ( - echo !APP5! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP6!"=="1" ( - if exist "!APP6_path!" ( - start "" "!APP6_path!" - echo !APP6! Started! - ) else ( - echo !APP6! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP7!"=="1" ( - if exist "!APP7_path!" ( - start "" "!APP7_path!" - echo !APP7! Started! - ) else ( - echo !APP7! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP7!"=="1" ( - if exist "!APP7_path!" ( - start "" "!APP7_path!" - echo !APP7! Started! - ) else ( - echo !APP7! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP8!"=="1" ( - if exist "!APP8_path!" ( - start "" "!APP8_path!" - echo !APP8! Started! - ) else ( - echo !APP8! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP9!"=="1" ( - if exist "!APP9_path!" ( - start "" "!APP9_path!" - echo !APP9! Started! - ) else ( - echo !APP9! Was Not Found! - ) -) - -echo. -echo. - -REM Installs gnirehtet.apk -if %Enable_RT%==1 ( - gnirehtet.exe start > nul -) - -REM Checks if High priority is set to true or false and responds accordingly. -if "%High_Prioriority%"=="1" start /MIN "" "High Priority.CMD" && echo Launching In High Priority! - -REM Throws an error if gnirehtet fails to run and prompts the user to reset the script and plays the error sound -if errorlevel 1 ( - if %Enable_Sound%==1 ( - start "" "cmdmp3win.exe" "STM\error.mp3") - echo Please connect your headset and restart RT-RP - echo Press Any Key To Restart. . . - pause >nul - cls - goto :start -) - -REM Plays sound on RT start when set to true in config -if %Enable_Sound%==1 ( - start "" "cmdmp3win.exe" "STM\start.mp3" -) - -if not defined Launch_Steam_Link_Client set "Launch_Steam_Link_Client=0" - -REM Launches steam link on the headset -:: Couldn't get it running properly due to steam link complaining about not being on local network, to enable paste "Launch_Steam_Link_Client=true" in conf. -if %Launch_Steam_Link_Client%==1 ( - start "" adb.exe shell monkey -p com.valvesoftware.steamlinkvr -c android.intent.category.LAUNCHER 1 -) - -REM Launches the Virtual Desktop client on the headset. -if %Launch_VD_Client%==1 ( - start "" adb.exe shell monkey -p VirtualDesktop.Android -c android.intent.category.LAUNCHER 1 -) - -REM Toggles Windows's Internet Connection Sharing feature intended for streaming over ethernet instead of ADB. -if %Enable_ICS%==1 ( - powershell -Command "Start-Process -FilePath '%CD%\ICS START.cmd' -WorkingDirectory '%CD%' -Verb RunAs" && echo ICS Started Successfully!! && timeout /t 4 >nul && exit -) - -echo RT Started Successfully!! - -REM Starts the reverse tether. -if %Enable_RT%==1 ( - @java -jar gnirehtet.jar relay > nul 2>&1 -) - -REM Displays message if both RT and ICS are OFF, then exits. -if "%Enable_RT%"=="0" ( - if "%Enable_ICS%"=="0" ( - start "" "cmdmp3win.exe" "STM\start.mp3" - echo RT And ICS are OFF, Launching Selected Apps ONLY!! - timeout /T 4 /nobreak && exit - )) - -echo Another Instance of RT-RP Is Already Running!!! - -pause - -endlocal - -:: START.cmd Copyright 2025/2026 by KUIJEN is licensed under GNU General Public Licence Version 3.0 https://www.gnu.org/licenses/gpl-3.0.txt - -:: *@@@@@@@@@@#######@@@@@@@@@@ -:: %@@@@@ ,@@@@@( -:: @@@@& @@@@. -:: @@@@ ,@@@% -:: ,@@@ @@@ -:: &@@ @@@. -:: %@@. @@@ -:: @@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@ -:: @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ %@@ -:: ,@@ #@@@@@@@@@@@@@@@@@@ &@@@@@@@@@@@@@@@@& .@@ -:: /@@ @@@@@@@@@@@@@@/ @@@@@@@@@@@@@@@@@@% ,@@ -:: @@ #@@@@@@@@@@@@@@@@@@@@/ @@@ -:: %@% @@@@@@@@@@@@@@@@@@@@@@@, @@ -:: @@ @@@@@@@ @@@@@@@@@@@@ %@@ -:: @@ @@@@@@@@@@ @@@@@@@@@@@@ @@ -:: @@ @@@@@@@@@@@ @@@@@@@@@@@ @@ -:: @@ *@@@@@@@@@@@ &@@@@@@@@@@ @@ -:: @@ @@@@@@@# @@@@@@@@@@ %@@ -:: %@@ @@@@@@& #@@@@@@@@@ @@ -:: @@ @@@@@@, @@@@@@@@% @@@ -:: @@ @@@@@. @@@@@@@@& ,@@ -:: ,@@ @@@@@@@, /@@ -:: @@/ (@@@@@@ @@@ -:: @@@ @@@@@ @@/ -:: .@@# @@@ -:: .@@@ @@@ -:: @@@ %@@@ -:: %@@@, %@@@, -:: @@@@ /@@@@ -:: @@@@@& ,@@@@@& -:: *@@@@@@@@@@@@@@@@@@@@@@@@@* - \ No newline at end of file +@echo off +Title RT-RP V2.6.0 +powershell -ExecutionPolicy Bypass -NoProfile -File "%~dp0START.ps1" +if %errorlevel% neq 0 pause diff --git a/Java/START.ps1 b/Java/START.ps1 new file mode 100644 index 0000000..fc23ca8 --- /dev/null +++ b/Java/START.ps1 @@ -0,0 +1,355 @@ +# RT-RP V2.6.0 - START.ps1 (Java Edition) +# Repack By KUIJEN - Gnirehtet By Genymobile - Java By Oracle - ADB By Google + +$ErrorActionPreference = 'SilentlyContinue' +$host.UI.RawUI.WindowTitle = 'RT-RP V2.6.0' + +# ---- Paths ---- +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$cfgBk = Join-Path $scriptDir "Text Files\Backup Config.txt" +$configPath = "$env:USERPROFILE\Documents\RT-RP Config.ini" +$logFile = "$env:USERPROFILE\Documents\RT-RP debug.log" +$adb = Join-Path $scriptDir "adb.exe" +$gni = Join-Path $scriptDir "gnirehtet.exe" +$gniJar = Join-Path $scriptDir "gnirehtet.jar" +$mp3 = Join-Path $scriptDir "cmdmp3win.exe" + +# ---- Log / display helpers ---- +function Log { param($m) Add-Content $logFile "[DBG] $(Get-Date -f HH:mm:ss) $m" } +function LErr { param($m) Write-Host $m -ForegroundColor Red; Add-Content $logFile "ERR $(Get-Date -f HH:mm:ss) $m" } +function LWrn { param($m) Write-Host $m -ForegroundColor Yellow; Add-Content $logFile "WARN $(Get-Date -f HH:mm:ss) $m" } + +function Write-NotFound { param($name) + Write-Host "$name Was " -NoNewline + Write-Host "Not" -ForegroundColor Yellow -NoNewline + Write-Host " Found!" +} + +# ---- Config reader ---- +function Read-Config { + param($path) + $out = @{} + if (-not (Test-Path $path)) { return $out } + foreach ($line in Get-Content $path) { + if ($line -match '^\s*([^=\s#;]+)\s*=\s*(.+)$') { + $k = $matches[1].Trim() + $v = $matches[2].Trim() + if ($v -ieq 'true') { $out[$k] = $true } + elseif ($v -ieq 'false') { $out[$k] = $false } + else { $out[$k] = $v } + } + } + return $out +} + +function G { param($key, $default = $false) if ($cfg.ContainsKey($key)) { $cfg[$key] } else { $default } } + +# ---- App launcher ---- +function Launch-App { + param($name, $path) + if (-not $path) { + Write-NotFound $name + Log "$name - path not configured" + return + } + $procName = [System.IO.Path]::GetFileNameWithoutExtension($path) + if (Get-Process -Name $procName -EA SilentlyContinue) { + Write-Host "$name is " -NoNewline + Write-Host "Already Running!" -ForegroundColor Green + return + } + if (Test-Path $path) { + Start-Process $path + Write-Host "$name " -NoNewline + Write-Host "Started!" -ForegroundColor Green + Log "$name started: $path" + } else { + Write-NotFound $name + Log "$name Was Not Found - path: $path" + } +} + +# ---- Main loop (restarts on gnirehtet failure) ---- +$restart = $true +while ($restart) { + $restart = $false + + Stop-Process -Name "VirtualDesktop.Streamer" -Force -EA SilentlyContinue + + # Logo + Clear-Host + Write-Host "Repack By KUIJEN - Gnirehtet By Genymobile - Java By Oracle - ADB By Google" + Write-Host "" + Write-Host ' /$$$$$$$ /$$$$$$$$ /$$$$$$$ /$$$$$$$' + Write-Host ' | $$__ $$|__ $$__/ | $$__ $$| $$__ $$' + Write-Host ' | $$ \ $$ | $$ | $$ \ $$| $$ \ $$' + Write-Host ' | $$$$$$$/ | $$ /$$$$$$| $$$$$$$/| $$$$$$$/`' + Write-Host ' | $$__ $$ | $$|______/| $$__ $$| $$____/' + Write-Host ' | $$ \ $$ | $$ | $$ \ $$| $$' + Write-Host ' | $$ | $$ | $$ | $$ | $$| $$' + Write-Host ' |__/ |__/ |__/ V2.6.0 |__/ |__/|__/' + Write-Host '' + Write-Host ' JAVA EDITION' + Write-Host '' + Write-Host '' + + # New log session + "=== RT-RP session $(Get-Date) ===" | Set-Content $logFile + + # ---- Config ---- + Log "scriptDir : $scriptDir" + Log "configPath : $configPath" + Log "cfgBk : $cfgBk" + + if (-not (Test-Path $configPath)) { + if (-not (Test-Path $cfgBk)) { + LErr "Config not found and backup is missing." + LErr "Looked for backup at: $cfgBk" + LErr "Is the script in the right folder?" + } else { + try { + Copy-Item $cfgBk $configPath -ErrorAction Stop + Write-Host "Config not found - copied fresh config to Documents." -ForegroundColor Black -BackgroundColor Yellow + Log "Config copied from backup." + } catch { + LErr "Config copy failed: $_" + } + } + Write-Host "" + } else { + Log "Config found OK." + } + + $cfg = Read-Config $configPath + Log "Config loaded - Enable_RT=$(G 'Enable_RT') Enable_ICS=$(G 'Enable_ICS') Enable_Sound=$(G 'Enable_Sound')" + Log "Launch_Virtual_Desktop=$(G 'Launch_Virtual_Desktop') Virtual_Desktop=$(G 'Virtual_Desktop')" + Log "Launch_VD_Client=$(G 'Launch_VD_Client') High_Prioriority=$(G 'High_Prioriority')" + + # ---- USB Selective Suspend ---- + Log "Disabling USB Selective Suspend..." + $usbGuid = '2a737441-1930-4402-8d77-b2bebba308a3' + $usbSsGuid = '48e6b7a6-50f5-4782-a5d4-53bb8f07e226' + & powercfg /SETACVALUEINDEX SCHEME_CURRENT $usbGuid $usbSsGuid 0 2>&1 | Out-Null + & powercfg /SETDCVALUEINDEX SCHEME_CURRENT $usbGuid $usbSsGuid 0 2>&1 | Out-Null + & powercfg /SETACTIVE SCHEME_CURRENT 2>&1 | Out-Null + if ($LASTEXITCODE -eq 0) { + Log "USB Selective Suspend disabled OK." + } else { + Log "USB Selective Suspend: powercfg returned $LASTEXITCODE (may need admin rights)" + LWrn "USB Selective Suspend: could not disable - try running as admin" + } + + # ---- ADB ---- + if (-not (Test-Path $adb)) { + LErr "adb.exe not found in $scriptDir" + } else { + Log "ADB version:`n$(& $adb version 2>&1 | Out-String)" + $devOut = & $adb devices 2>&1 | Out-String + Log "ADB devices:`n$devOut" + + if ($devOut -match 'unauthorized') { + LWrn "ADB: device unauthorized - tap Allow USB Debugging on the headset." + } + if ($devOut -match '\boffline\b') { + LWrn "ADB: device offline - try replugging the USB cable." + } + + # USB speed check - 480=USB2 (bad), 5000=USB3 (good) + $usbSpeeds = & $adb shell "cat /sys/bus/usb/devices/*/speed 2>/dev/null" 2>&1 + $maxSpeed = ($usbSpeeds | Where-Object { $_ -match '^\d+$' } | ForEach-Object { [int]$_ } | Measure-Object -Maximum).Maximum + Log "USB connection speed: $maxSpeed Mbps (480=USB2, 5000=USB3)" + if ($maxSpeed -and $maxSpeed -le 480) { + LWrn "USB 2.0 detected ($maxSpeed Mbps) - connect to a USB 3.0 port for best tether performance." + } + + $wifiOn = (& $adb shell settings get global wifi_on 2>&1).Trim() + Log "Headset WiFi state: $wifiOn (1=on, 0=off)" + if ($wifiOn -eq '1') { + $wifiResult = & $adb shell svc wifi disable 2>&1 + Log "Headset WiFi was ON - disabled. Result: $wifiResult" + } + + Log "Headset IP routes:`n$(& $adb shell ip route 2>&1 | Out-String)" + Log "Headset interfaces:`n$(& $adb shell ip link show 2>&1 | Out-String)" + Log "Headset DNS: $(& $adb shell getprop net.dns1 2>&1) / $(& $adb shell getprop net.dns2 2>&1)" + } + + Write-Host "" + + # ---- SteamVR ---- + $steamvrPath = 'C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win64\vrmonitor.exe' + if (-not (Test-Path $steamvrPath)) { + Write-Host "SteamVR Is " -NoNewline + Write-Host "Not" -ForegroundColor Yellow -NoNewline + Write-Host " Installed!" + } + if (G 'Launch_SteamVR') { + if (Get-Process vrmonitor -EA SilentlyContinue) { + Write-Host "SteamVR is " -NoNewline + Write-Host "Already Running!" -ForegroundColor Green + } elseif (Test-Path $steamvrPath) { + Start-Process $steamvrPath + Write-Host "SteamVR " -NoNewline + Write-Host "Started!" -ForegroundColor Green + } else { + Write-NotFound "SteamVR" + Start-Process "https://store.steampowered.com/app/250820/SteamVR/" + } + } + + # ---- Apps ---- + if (G 'Launch_Amethyst') { Launch-App "Amethyst" (G 'Amethyst') } + if (G 'Launch_SlimeVR') { Launch-App "SlimeVR Server" (G 'SlimeVR') } + if (G 'Launch_VRCFT') { Launch-App "VRCFT" (G 'VRCFT') } + + # Virtual Desktop - process name has a dot so handled separately + $vdPath = G 'Virtual_Desktop' + Log "VD Streamer path: $vdPath" + if (G 'Launch_Virtual_Desktop') { + if (Get-Process "VirtualDesktop.Streamer" -EA SilentlyContinue) { + Write-Host "Virtual Desktop Streamer is " -NoNewline + Write-Host "Already Running!" -ForegroundColor Green + } elseif (-not $vdPath) { + LErr "Virtual_Desktop path is empty in config." + } elseif (Test-Path $vdPath) { + Start-Process $vdPath + Write-Host "Virtual Desktop Streamer " -NoNewline + Write-Host "Started!" -ForegroundColor Green + Log "VD Streamer started: $vdPath" + } else { + Write-NotFound "Virtual Desktop Streamer" + Log "VD Streamer Not Found - path: $vdPath" + } + } + + if (G 'Launch_VIVE_HUB') { Launch-App "Vive Hub" (G 'Vive_Hub') } + if (G 'Launch_ALVR') { Launch-App "ALVR" (G 'ALVR') } + if (G 'Launch_VRCX') { Launch-App "VRCX" (G 'VRCX') } + + # Custom apps + for ($i = 1; $i -le 9; $i++) { + if (G "Launch_APP$i") { + $appName = G "APP$i" + $appPath = G "APP${i}_path" + $label = if ($appName) { $appName } else { "APP$i" } + Launch-App $label $appPath + } + } + + Write-Host "" + Write-Host "" + + # ---- Gnirehtet ---- + $gniOk = $true + if (G 'Enable_RT') { + Log "Gnirehtet enabled. Checking $gni..." + if (-not (Test-Path $gni)) { + LErr "gnirehtet.exe not found in $scriptDir" + $gniOk = $false + } else { + Log "Running gnirehtet start..." + $gniOut = & $gni start 2>&1 + $gniExit = $LASTEXITCODE + $gniOut | ForEach-Object { Write-Host $_ } + Log "gnirehtet start output:`n$($gniOut | Out-String)" + Log "gnirehtet start exit: $gniExit" + if ($gniExit -ne 0) { $gniOk = $false } + } + } + + # ---- High Priority ---- + if (G 'High_Prioriority') { + $hp = Join-Path $scriptDir "High Priority.CMD" + if (Test-Path $hp) { + Start-Process $hp -WindowStyle Minimized + Write-Host "Launching In " -NoNewline + Write-Host "High" -ForegroundColor Yellow -NoNewline + Write-Host " Priority!" + } + } + + + # ---- VD network check ---- + if ($gniOk -and (G 'Enable_RT')) { + $rndisLine = & $adb shell ip addr show rndis0 2>&1 | Where-Object { $_ -match 'inet ' } + Log "rndis0: $rndisLine" + if ($rndisLine -match 'inet\s+(\d+\.\d+\.\d+)\.\d+') { + $headsetSubnet = $matches[1] + $pcSubnets = Get-NetIPAddress -AddressFamily IPv4 | + Where-Object { $_.IPAddress -notmatch '^127\.' } | + ForEach-Object { $_.IPAddress -replace '\.\d+$', '' } + Log "VD subnet check - headset: $headsetSubnet.x PC: $($pcSubnets -join ', ').x" + if ($pcSubnets -contains $headsetSubnet) { + Log "VD network OK: subnet match ($headsetSubnet.x)" + } else { + LWrn "Virtual Desktop: subnet mismatch (headset $headsetSubnet.x vs PC). Bitrate may be capped to ~60 Mbps." + } + } else { + Log "VD network check: rndis0 not found on headset" + } + } + + # ---- Gnirehtet failure handling ---- + if ((G 'Enable_RT') -and -not $gniOk) { + Log "gnirehtet failed. ADB devices: $(& $adb devices 2>&1 | Out-String)" + Log "WiFi at failure: $(& $adb shell settings get global wifi_on 2>&1)" + Log "IP routes at failure: $(& $adb shell ip route 2>&1 | Out-String)" + if (G 'Enable_Sound') { Start-Process $mp3 -ArgumentList "STM\error.mp3" } + LErr "Please connect your headset and restart RT-RP" + LErr "See $logFile for details." + Read-Host "Press Enter to restart" + $restart = $true + continue + } + + # ---- Sound ---- + if (G 'Enable_Sound') { Start-Process $mp3 -ArgumentList "STM\start.mp3" } + + # ---- ADB: Steam Link ---- + if (G 'Launch_Steam_Link_Client') { + Log "Launching Steam Link via ADB..." + $r = & $adb shell monkey -p com.valvesoftware.steamlinkvr -c android.intent.category.LAUNCHER 1 2>&1 + Log "ADB Steam Link result: $($r | Out-String)" + } + + # ---- ADB: VD client ---- + if (G 'Launch_VD_Client') { + Log "Launching VD client via ADB..." + $r = & $adb shell monkey -p VirtualDesktop.Android -c android.intent.category.LAUNCHER 1 2>&1 + Log "ADB VD client result: $($r | Out-String)" + } + + # ---- ICS ---- + if (G 'Enable_ICS') { + $ics = Join-Path $scriptDir "ICS START.cmd" + Start-Process $ics -Verb RunAs -WorkingDirectory $scriptDir + Write-Host "ICS Started Successfully!!" -ForegroundColor Green + Start-Sleep 4 + exit + } + + Write-Host "RT Started Successfully!!" -ForegroundColor Green + Write-Host "Log: $logFile" + Add-Content $logFile "RT Started Successfully." + + # ---- Gnirehtet run (blocks - WARN/ERROR only go to log) ---- + if (G 'Enable_RT') { + if (-not (Test-Path $gniJar)) { + LErr "gnirehtet.jar not found in $scriptDir" + } else { + & java -jar $gniJar relay 2>&1 | Where-Object { $_ -match '(WARN|ERROR)' } | Add-Content $logFile + } + # Only reaches here if gnirehtet exits - usually means another instance was running + Write-Host "Another Instance of RT-RP Is Already Running!!!" -ForegroundColor White -BackgroundColor Red + Read-Host "Press Enter to exit" + exit + } + + # ---- RT and ICS both off - launched apps only ---- + if (-not (G 'Enable_RT') -and -not (G 'Enable_ICS')) { + if (G 'Enable_Sound') { Start-Process $mp3 -ArgumentList "STM\start.mp3" } + Write-Host "RT And ICS are OFF, Launching Selected Apps ONLY!!" -ForegroundColor Black -BackgroundColor Yellow + Start-Sleep 4 + exit + } +} diff --git a/Rust/RT-RP Install Script - RUST.nsi b/Rust/RT-RP Install Script - RUST.nsi index d2920ff..bb66374 100644 --- a/Rust/RT-RP Install Script - RUST.nsi +++ b/Rust/RT-RP Install Script - RUST.nsi @@ -14,7 +14,7 @@ Name "Reverse Tethering RePack" ; The file to write -OutFile "C:\Users\$PROFILE\Desktop\RT-RP Installer (Rust).exe" +OutFile "$DESKTOP\RT-RP Installer (Rust).exe" ; Request application privileges for Windows Vista and higher RequestExecutionLevel admin @@ -23,12 +23,15 @@ RequestExecutionLevel admin Unicode True ; The default installation directory -InstallDir $PROGRAMFILES\RTRP +InstallDir $PROGRAMFILES64\RTRP ; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM "Software\RTRP" "Install_Dir" +; Path to the folder containing files to pack - relative to this script +!define SRCDIR "Source" + ;-------------------------------- ; Pages @@ -52,7 +55,7 @@ Section "Core Files (required)" ; Put file there - File /r "C:\Users\KUIJEN\Desktop\Source\" + File /r "${SRCDIR}\" ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\RTRP "Install_Dir" "$INSTDIR" @@ -115,13 +118,12 @@ Function .onInstSuccess IfFileExists "$INSTDIR\Text Files\README.txt" openReadMe - ; Delete regardless of whether readme exists or not + ; Delete legacy config filename if present Delete "$DOCUMENTS\RT-RP Config.txt" Return openReadMe: ExecShell "open" "$INSTDIR\Text Files\README.txt" Delete "$DOCUMENTS\RT-RP Config.txt" - Delete "$DOCUMENTS\RT-RP Config.ini" Return FunctionEnd diff --git a/Rust/START.cmd b/Rust/START.cmd index 39796ee..373efe6 100644 --- a/Rust/START.cmd +++ b/Rust/START.cmd @@ -1,465 +1,4 @@ - -@echo off -REM Kills Virtual Desktop when the script starts or resets -:start - tasklist >NUL | findstr "Virtual Desktop Streamer" - taskkill >NUL /F /IM VirtualDesktop.Streamer.exe - cls -) -REM Displays the Logo - @echo on - @echo Repack By KUIJEN - Gnirehtet By Genymobile - Java By Oracle - ADB By Google - @echo[ - @echo[ - @echo[ - @echo off & Title RT-RP V2.6.0 - echo/ /$$$$$$$ /$$$$$$$$ /$$$$$$$ /$$$$$$$ - echo/ ^| $$__ $$^|__ $$__/ ^| $$__ $$^| $$__ $$ - echo/ ^| $$ \ $$ ^| $$ ^| $$ \ $$^| $$ \ $$ - echo/ ^| $$$$$$$/ ^| $$ /$$$$$$^| $$$$$$$/^| $$$$$$$/ - echo/ ^| $$__ $$ ^| $$^|______/^| $$__ $$^| $$____/ - echo/ ^| $$ \ $$ ^| $$ ^| $$ \ $$^| $$ - echo/ ^| $$ ^| $$ ^| $$ ^| $$ ^| $$^| $$ - echo/ ^|__/ ^|__/ ^|__/ V2.6.0 ^|__/ ^|__/^|__/ - echo/ - echo/ RUST EDITION - echo/ - echo/ - echo/ - @echo off -) - -setlocal enabledelayedexpansion - -REM Defines the Backup Config location as "cfgbk" -set "cfgbk=Text Files\Backup Config.txt" - -REM Defines the Config file location as "config" -set "config=%userprofile%\Documents\RT-RP Config.ini" - -REM Checks if the config file exists and puts it in it's correct place if it isn't -if not exist "%config%" ( - copy >NUL "%cfgbk%" "%config%" - echo Config File Not Found, Copied New Config To Documents. - echo. -) - -REM Reads and processes each line in config.txt -for /f "usebackq tokens=1,2 delims==" %%A in ("%config%") do ( - REM Convert true/false to 1/0 - if /i "%%B"=="true" ( - set "%%A=1" - ) else if /i "%%B"=="false" ( - set "%%A=0" - ) else ( - set "%%A=%%B" - ) -) - -REM Define the path to check for vrmonitor.exe (SteamVR) -set "steamvrpath=C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win64\vrmonitor.exe" - - -IF not EXIST "%steamvrpath%" ( - echo SteamVR Is Not Installed! -) - - -REM Check if vrmonitor.exe (SteamVR) is running -tasklist /FI "IMAGENAME eq vrmonitor.exe" 2>NUL | find /I "vrmonitor.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo SteamVR is Already Running! - goto :res1 - -) - -REM Check if SteamVR should launch -if "%Launch_SteamVR%"=="1" ( - REM Check if vrmonitor.exe exists at the specified path - IF EXIST "%steamvrpath%" ( - start "" "%steamvrpath%" - echo SteamVR Started! - ) ELSE ( - (echo SteamVR Was Not Found!) && pause & rundll32 url.dll,FileProtocolHandler https://store.steampowered.com/app/250820/SteamVR/ - ) -) ELSE ( - goto :res1 -) - -:res1 - -REM Define the path to check for Amethyst.exe -set "amethystPath=%Amethyst%" - -REM Check if Amethyst.exe is running -tasklist /FI "IMAGENAME eq Amethyst.exe" 2>NUL | find /I "Amethyst.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo Amethyst is Already Running! - goto :res2 -) - -REM Check if Amethyst should launch -if "%Launch_Amethyst%"=="1" ( - REM Check if Amethyst.exe exists at the specified path - IF EXIST "%amethystPath%" ( - start "" "%amethystPath%" - echo Amethyst Started! - ) ELSE ( - echo Amethyst Was Not Found! - ) -) ELSE ( - goto :res2 -) - -:res2 - -REM Define the path to check for slimevr.exe -set "slimevrPath=%SlimeVR%" - -REM Check if slimevr.exe is running -tasklist /FI "IMAGENAME eq slimevr.exe" 2>NUL | find /I "slimevr.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo SlimeVR Server is Already Running! - goto :res3 -) - -REM Check if SlimeVR should launch -if "%Launch_SlimeVR%"=="1" ( - REM Check if slimevr.exe exists at the specified path - IF EXIST "%slimevrPath%" ( - start "" "%slimevrPath%" - echo SlimeVR Server Started! - ) ELSE ( - echo SlimeVR Server Was Not Found! - ) -) ELSE ( - goto :res3 -) - -:res3 - -REM Define the path to check for VRCFaceTracking.exe -set "VRCFTPath=%VRCFT%" - -REM Check if VRCFaceTracking.exe is running -tasklist /FI "IMAGENAME eq VRCFaceTracking.exe" 2>NUL | find /I "VRCFaceTracking.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo VRCFT is Already Running! - goto :res4 -) - -REM Check if VRCFT should launch -if "%Launch_VRCFT%"=="1" ( - REM Check if VRCFaceTracking.exe exists at the specified path - IF EXIST "%VRCFTPath%" ( - start "" "%VRCFTPath%" - echo VRCFT Started! - ) ELSE ( - echo VRCFT Was Not Found! - ) -) ELSE ( - goto :res4 -) - -:res4 - -REM Define the path to check for VirtualDesktop.Streamer.exe -set "VDPath=%Virtual_Desktop%" - -REM Check if VirtualDesktop.Streamer.exe is running -tasklist /FI "IMAGENAME eq VirtualDesktop.Streamer.exe" 2>NUL | find /I "VirtualDesktop.Streamer.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo Virtual Desktop Streamer is Already Running! - goto :res5 -) - -REM Check if Virtual Desktop should launch -if "%Launch_Virtual_Desktop%"=="1" ( - REM Check if VirtualDesktop.Streamer.exe exists at the specified path - IF EXIST "%VDPath%" ( - start "" "%VDPath%" - echo Virtual Desktop Streamer Started! - ) ELSE ( - echo Virtual Desktop Streamer Was Not Found! - ) -) ELSE ( - goto :res5 -) - -:res5 - -REM Define the path to check for VHConsole.exe (Vive Hub) -set "VIVEpath=%Vive_Hub%" - -REM Check if VHConsole.exe is running -tasklist /FI "IMAGENAME eq VHConsole.exe" 2>NUL | find /I "VHConsole.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo Vive Hub is Already Running! - goto :res6 -) - -REM Check if Vive Hub should launch -if "%Launch_VIVE_HUB%"=="1" ( - REM Check if VHConsole.exe exists at the specified path - IF EXIST "%VIVEpath%" ( - start "" "%VIVEpath%" - echo Vive Hub Started! - ) ELSE ( - echo Vive Hub Was Not Found! - ) -) ELSE ( - goto :res6 -) - -:res6 - -REM Define the path to check for ALVR Dashboard.exe -set "ALVRpath=%ALVR%" - -REM Check if ALVR Dashboard.exe is running -tasklist /FI "IMAGENAME eq ALVR Dashboard.exe" 2>NUL | find /I "ALVR Dashboard.exe" >NUL -IF %ERRORLEVEL% EQU 0 ( - echo ALVR is Already Running! - goto :res7 -) - -REM Check if ALVR should launch -if "%Launch_ALVR%"=="1" ( - REM Check if ALVR Dashboard.exe exists at the specified path - IF EXIST "%ALVRpath%" ( - start "" "%ALVRpath%" - echo ALVR Started! - ) ELSE ( - echo ALVR Was Not Found! - ) -) ELSE ( - goto :res7 -) - -:res7 - -REM Define the path to check for VRCX.exe -set "VRCXpath=%VRCX%" - -REM Check if VRCX.exe is running -tasklist /FI "IMAGENAME eq VRCX.exe" 2>NUL | find /I "VRCX.exe" >NUL -if %ERRORLEVEL% EQU 0 ( - echo VRCX is Already Running! - goto :res8 -) - -REM Check if VRCX should launch -if "%Launch_VRCX%"=="1" ( - REM Check if VRCX.exe exists at the specified path - if exist "%VRCXpath%" ( - start "" "%VRCXpath%" - echo VRCX Started! - ) else ( - echo VRCX Was Not Found! - ) -) else ( - goto :res8 -) - -:res8 - -REM Custom app launch stuff -if "!Launch_APP1!"=="1" ( - if exist "!APP1_path!" ( - start "" "!APP1_path!" - echo !APP1! Started! - ) else ( - echo !APP1! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP2!"=="1" ( - if exist "!APP2_path!" ( - start "" "!APP2_path!" - echo !APP2! Started! - ) else ( - echo !APP2! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP3!"=="1" ( - if exist "!APP3_path!" ( - start "" "!APP3_path!" - echo !APP3! Started! - ) else ( - echo !APP3! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP4!"=="1" ( - if exist "!APP4_path!" ( - start "" "!APP4_path!" - echo !APP4! Started! - ) else ( - echo !APP4! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP5!"=="1" ( - if exist "!APP5_path!" ( - start "" "!APP5_path!" - echo !APP5! Started! - ) else ( - echo !APP5! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP6!"=="1" ( - if exist "!APP6_path!" ( - start "" "!APP6_path!" - echo !APP6! Started! - ) else ( - echo !APP6! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP7!"=="1" ( - if exist "!APP7_path!" ( - start "" "!APP7_path!" - echo !APP7! Started! - ) else ( - echo !APP7! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP7!"=="1" ( - if exist "!APP7_path!" ( - start "" "!APP7_path!" - echo !APP7! Started! - ) else ( - echo !APP7! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP8!"=="1" ( - if exist "!APP8_path!" ( - start "" "!APP8_path!" - echo !APP8! Started! - ) else ( - echo !APP8! Was Not Found! - ) -) - -REM Custom app launch stuff -if "!Launch_APP9!"=="1" ( - if exist "!APP9_path!" ( - start "" "!APP9_path!" - echo !APP9! Started! - ) else ( - echo !APP9! Was Not Found! - ) -) - -echo. -echo. - -REM Installs gnirehtet.apk -if %Enable_RT%==1 ( - gnirehtet-g7.exe start > nul -) - -REM Checks if High priority is set to true or false and responds accordingly. -if "%High_Prioriority%"=="1" start /MIN "" "High Priority.CMD" && echo Launching In High Priority! - -REM Throws an error if gnirehtet fails to run and prompts the user to reset the script and plays the error sound -if errorlevel 1 ( - if %Enable_Sound%==1 ( - start "" "cmdmp3win.exe" "STM\error.mp3") - echo Please connect your headset and restart RT-RP - echo Press Any Key To Restart. . . - pause >nul - cls - goto :start -) - -REM Plays sound on RT start when set to true in config -if %Enable_Sound%==1 ( - start "" "cmdmp3win.exe" "STM\start.mp3" -) - -if not defined Launch_Steam_Link_Client set "Launch_Steam_Link_Client=0" - -REM Launches steam link on the headset -:: Couldn't get it running properly due to steam link complaining about not being on local network, to enable paste "Launch_Steam_Link_Client=true" in conf. -if %Launch_Steam_Link_Client%==1 ( - start "" adb.exe shell monkey -p com.valvesoftware.steamlinkvr -c android.intent.category.LAUNCHER 1 -) - -REM Launches the Virtual Desktop client on the headset. -if %Launch_VD_Client%==1 ( - start "" adb.exe shell monkey -p VirtualDesktop.Android -c android.intent.category.LAUNCHER 1 -) - -REM Toggles Windows's Internet Connection Sharing feature intended for streaming over ethernet instead of ADB. -if %Enable_ICS%==1 ( - powershell -Command "Start-Process -FilePath '%CD%\ICS START.cmd' -WorkingDirectory '%CD%' -Verb RunAs" && echo ICS Started Successfully!! && timeout /t 4 >nul && exit -) - -echo RT Started Successfully!! - -REM Starts the reverse tether. -if %Enable_RT%==1 ( - @gnirehtet-g7.exe run > nul -) - -REM Displays message if both RT and ICS are OFF, then exits. -if "%Enable_RT%"=="0" ( - if "%Enable_ICS%"=="0" ( - start "" "cmdmp3win.exe" "STM\start.mp3" - echo RT And ICS are OFF, Launching Selected Apps ONLY!! - timeout /T 4 /nobreak && exit - )) - -echo Another Instance of RT-RP Is Already Running!!! - -pause - -endlocal - -:: START.cmd Copyright 2025/2026 by KUIJEN is licensed under GNU General Public Licence Version 3.0 https://www.gnu.org/licenses/gpl-3.0.txt - -:: *@@@@@@@@@@#######@@@@@@@@@@ -:: %@@@@@ ,@@@@@( -:: @@@@& @@@@. -:: @@@@ ,@@@% -:: ,@@@ @@@ -:: &@@ @@@. -:: %@@. @@@ -:: @@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@ -:: @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ %@@ -:: ,@@ #@@@@@@@@@@@@@@@@@@ &@@@@@@@@@@@@@@@@& .@@ -:: /@@ @@@@@@@@@@@@@@/ @@@@@@@@@@@@@@@@@@% ,@@ -:: @@ #@@@@@@@@@@@@@@@@@@@@/ @@@ -:: %@% @@@@@@@@@@@@@@@@@@@@@@@, @@ -:: @@ @@@@@@@ @@@@@@@@@@@@ %@@ -:: @@ @@@@@@@@@@ @@@@@@@@@@@@ @@ -:: @@ @@@@@@@@@@@ @@@@@@@@@@@ @@ -:: @@ *@@@@@@@@@@@ &@@@@@@@@@@ @@ -:: @@ @@@@@@@# @@@@@@@@@@ %@@ -:: %@@ @@@@@@& #@@@@@@@@@ @@ -:: @@ @@@@@@, @@@@@@@@% @@@ -:: @@ @@@@@. @@@@@@@@& ,@@ -:: ,@@ @@@@@@@, /@@ -:: @@/ (@@@@@@ @@@ -:: @@@ @@@@@ @@/ -:: .@@# @@@ -:: .@@@ @@@ -:: @@@ %@@@ -:: %@@@, %@@@, -:: @@@@ /@@@@ -:: @@@@@& ,@@@@@& -:: *@@@@@@@@@@@@@@@@@@@@@@@@@* - \ No newline at end of file +@echo off +Title RT-RP V2.6.0 +powershell -ExecutionPolicy Bypass -NoProfile -File "%~dp0START.ps1" +if %errorlevel% neq 0 pause diff --git a/Rust/START.ps1 b/Rust/START.ps1 new file mode 100644 index 0000000..3faa705 --- /dev/null +++ b/Rust/START.ps1 @@ -0,0 +1,350 @@ +# RT-RP V2.6.0 - START.ps1 (Rust Edition) +# Repack By KUIJEN - Gnirehtet By Genymobile - Java By Oracle - ADB By Google + +$ErrorActionPreference = 'SilentlyContinue' +$host.UI.RawUI.WindowTitle = 'RT-RP V2.6.0' + +# ---- Paths ---- +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$cfgBk = Join-Path $scriptDir "Text Files\Backup Config.txt" +$configPath = "$env:USERPROFILE\Documents\RT-RP Config.ini" +$logFile = "$env:USERPROFILE\Documents\RT-RP debug.log" +$adb = Join-Path $scriptDir "adb.exe" +$gni = Join-Path $scriptDir "gnirehtet-g7.exe" +$mp3 = Join-Path $scriptDir "cmdmp3win.exe" + +# ---- Log / display helpers ---- +function Log { param($m) Add-Content $logFile "[DBG] $(Get-Date -f HH:mm:ss) $m" } +function LErr { param($m) Write-Host $m -ForegroundColor Red; Add-Content $logFile "ERR $(Get-Date -f HH:mm:ss) $m" } +function LWrn { param($m) Write-Host $m -ForegroundColor Yellow; Add-Content $logFile "WARN $(Get-Date -f HH:mm:ss) $m" } + +function Write-NotFound { param($name) + Write-Host "$name Was " -NoNewline + Write-Host "Not" -ForegroundColor Yellow -NoNewline + Write-Host " Found!" +} + +# ---- Config reader ---- +function Read-Config { + param($path) + $out = @{} + if (-not (Test-Path $path)) { return $out } + foreach ($line in Get-Content $path) { + if ($line -match '^\s*([^=\s#;]+)\s*=\s*(.+)$') { + $k = $matches[1].Trim() + $v = $matches[2].Trim() + if ($v -ieq 'true') { $out[$k] = $true } + elseif ($v -ieq 'false') { $out[$k] = $false } + else { $out[$k] = $v } + } + } + return $out +} + +function G { param($key, $default = $false) if ($cfg.ContainsKey($key)) { $cfg[$key] } else { $default } } + +# ---- App launcher ---- +function Launch-App { + param($name, $path) + if (-not $path) { + Write-NotFound $name + Log "$name - path not configured" + return + } + $procName = [System.IO.Path]::GetFileNameWithoutExtension($path) + if (Get-Process -Name $procName -EA SilentlyContinue) { + Write-Host "$name is " -NoNewline + Write-Host "Already Running!" -ForegroundColor Green + return + } + if (Test-Path $path) { + Start-Process $path + Write-Host "$name " -NoNewline + Write-Host "Started!" -ForegroundColor Green + Log "$name started: $path" + } else { + Write-NotFound $name + Log "$name Was Not Found - path: $path" + } +} + +# ---- Main loop (restarts on gnirehtet failure) ---- +$restart = $true +while ($restart) { + $restart = $false + + Stop-Process -Name "VirtualDesktop.Streamer" -Force -EA SilentlyContinue + + # Logo + Clear-Host + Write-Host "Repack By KUIJEN - Gnirehtet By Genymobile - Java By Oracle - ADB By Google" + Write-Host "" + Write-Host ' /$$$$$$$ /$$$$$$$$ /$$$$$$$ /$$$$$$$' + Write-Host ' | $$__ $$|__ $$__/ | $$__ $$| $$__ $$' + Write-Host ' | $$ \ $$ | $$ | $$ \ $$| $$ \ $$' + Write-Host ' | $$$$$$$/ | $$ /$$$$$$| $$$$$$$/| $$$$$$$/`' + Write-Host ' | $$__ $$ | $$|______/| $$__ $$| $$____/' + Write-Host ' | $$ \ $$ | $$ | $$ \ $$| $$' + Write-Host ' | $$ | $$ | $$ | $$ | $$| $$' + Write-Host ' |__/ |__/ |__/ V2.6.0 |__/ |__/|__/' + Write-Host '' + Write-Host ' RUST EDITION' + Write-Host '' + Write-Host '' + + # New log session + "=== RT-RP session $(Get-Date) ===" | Set-Content $logFile + + # ---- Config ---- + Log "scriptDir : $scriptDir" + Log "configPath : $configPath" + Log "cfgBk : $cfgBk" + + if (-not (Test-Path $configPath)) { + if (-not (Test-Path $cfgBk)) { + LErr "Config not found and backup is missing." + LErr "Looked for backup at: $cfgBk" + LErr "Is the script in the right folder?" + } else { + try { + Copy-Item $cfgBk $configPath -ErrorAction Stop + Write-Host "Config not found - copied fresh config to Documents." -ForegroundColor Black -BackgroundColor Yellow + Log "Config copied from backup." + } catch { + LErr "Config copy failed: $_" + } + } + Write-Host "" + } else { + Log "Config found OK." + } + + $cfg = Read-Config $configPath + Log "Config loaded - Enable_RT=$(G 'Enable_RT') Enable_ICS=$(G 'Enable_ICS') Enable_Sound=$(G 'Enable_Sound')" + Log "Launch_Virtual_Desktop=$(G 'Launch_Virtual_Desktop') Virtual_Desktop=$(G 'Virtual_Desktop')" + Log "Launch_VD_Client=$(G 'Launch_VD_Client') High_Prioriority=$(G 'High_Prioriority')" + + # ---- USB Selective Suspend ---- + Log "Disabling USB Selective Suspend..." + $usbGuid = '2a737441-1930-4402-8d77-b2bebba308a3' + $usbSsGuid = '48e6b7a6-50f5-4782-a5d4-53bb8f07e226' + & powercfg /SETACVALUEINDEX SCHEME_CURRENT $usbGuid $usbSsGuid 0 2>&1 | Out-Null + & powercfg /SETDCVALUEINDEX SCHEME_CURRENT $usbGuid $usbSsGuid 0 2>&1 | Out-Null + & powercfg /SETACTIVE SCHEME_CURRENT 2>&1 | Out-Null + if ($LASTEXITCODE -eq 0) { + Log "USB Selective Suspend disabled OK." + } else { + Log "USB Selective Suspend: powercfg returned $LASTEXITCODE (may need admin rights)" + LWrn "USB Selective Suspend: could not disable - try running as admin" + } + + # ---- ADB ---- + if (-not (Test-Path $adb)) { + LErr "adb.exe not found in $scriptDir" + } else { + Log "ADB version:`n$(& $adb version 2>&1 | Out-String)" + $devOut = & $adb devices 2>&1 | Out-String + Log "ADB devices:`n$devOut" + + if ($devOut -match 'unauthorized') { + LWrn "ADB: device unauthorized - tap Allow USB Debugging on the headset." + } + if ($devOut -match '\boffline\b') { + LWrn "ADB: device offline - try replugging the USB cable." + } + + # USB speed check - 480=USB2 (bad), 5000=USB3 (good) + $usbSpeeds = & $adb shell "cat /sys/bus/usb/devices/*/speed 2>/dev/null" 2>&1 + $maxSpeed = ($usbSpeeds | Where-Object { $_ -match '^\d+$' } | ForEach-Object { [int]$_ } | Measure-Object -Maximum).Maximum + Log "USB connection speed: $maxSpeed Mbps (480=USB2, 5000=USB3)" + if ($maxSpeed -and $maxSpeed -le 480) { + LWrn "USB 2.0 detected ($maxSpeed Mbps) - connect to a USB 3.0 port for best tether performance." + } + + $wifiOn = (& $adb shell settings get global wifi_on 2>&1).Trim() + Log "Headset WiFi state: $wifiOn (1=on, 0=off)" + if ($wifiOn -eq '1') { + $wifiResult = & $adb shell svc wifi disable 2>&1 + Log "Headset WiFi was ON - disabled. Result: $wifiResult" + } + + Log "Headset IP routes:`n$(& $adb shell ip route 2>&1 | Out-String)" + Log "Headset interfaces:`n$(& $adb shell ip link show 2>&1 | Out-String)" + Log "Headset DNS: $(& $adb shell getprop net.dns1 2>&1) / $(& $adb shell getprop net.dns2 2>&1)" + } + + Write-Host "" + + # ---- SteamVR ---- + $steamvrPath = 'C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win64\vrmonitor.exe' + if (-not (Test-Path $steamvrPath)) { + Write-Host "SteamVR Is " -NoNewline + Write-Host "Not" -ForegroundColor Yellow -NoNewline + Write-Host " Installed!" + } + if (G 'Launch_SteamVR') { + if (Get-Process vrmonitor -EA SilentlyContinue) { + Write-Host "SteamVR is " -NoNewline + Write-Host "Already Running!" -ForegroundColor Green + } elseif (Test-Path $steamvrPath) { + Start-Process $steamvrPath + Write-Host "SteamVR " -NoNewline + Write-Host "Started!" -ForegroundColor Green + } else { + Write-NotFound "SteamVR" + Start-Process "https://store.steampowered.com/app/250820/SteamVR/" + } + } + + # ---- Apps ---- + if (G 'Launch_Amethyst') { Launch-App "Amethyst" (G 'Amethyst') } + if (G 'Launch_SlimeVR') { Launch-App "SlimeVR Server" (G 'SlimeVR') } + if (G 'Launch_VRCFT') { Launch-App "VRCFT" (G 'VRCFT') } + + # Virtual Desktop - process name has a dot so handled separately + $vdPath = G 'Virtual_Desktop' + Log "VD Streamer path: $vdPath" + if (G 'Launch_Virtual_Desktop') { + if (Get-Process "VirtualDesktop.Streamer" -EA SilentlyContinue) { + Write-Host "Virtual Desktop Streamer is " -NoNewline + Write-Host "Already Running!" -ForegroundColor Green + } elseif (-not $vdPath) { + LErr "Virtual_Desktop path is empty in config." + } elseif (Test-Path $vdPath) { + Start-Process $vdPath + Write-Host "Virtual Desktop Streamer " -NoNewline + Write-Host "Started!" -ForegroundColor Green + Log "VD Streamer started: $vdPath" + } else { + Write-NotFound "Virtual Desktop Streamer" + Log "VD Streamer Not Found - path: $vdPath" + } + } + + if (G 'Launch_VIVE_HUB') { Launch-App "Vive Hub" (G 'Vive_Hub') } + if (G 'Launch_ALVR') { Launch-App "ALVR" (G 'ALVR') } + if (G 'Launch_VRCX') { Launch-App "VRCX" (G 'VRCX') } + + # Custom apps + for ($i = 1; $i -le 9; $i++) { + if (G "Launch_APP$i") { + $appName = G "APP$i" + $appPath = G "APP${i}_path" + $label = if ($appName) { $appName } else { "APP$i" } + Launch-App $label $appPath + } + } + + Write-Host "" + Write-Host "" + + # ---- Gnirehtet ---- + $gniOk = $true + if (G 'Enable_RT') { + Log "Gnirehtet enabled. Checking $gni..." + if (-not (Test-Path $gni)) { + LErr "gnirehtet-g7.exe not found in $scriptDir" + $gniOk = $false + } else { + Log "Running gnirehtet start..." + $gniOut = & $gni start 2>&1 + $gniExit = $LASTEXITCODE + $gniOut | ForEach-Object { Write-Host $_ } + Log "gnirehtet start output:`n$($gniOut | Out-String)" + Log "gnirehtet start exit: $gniExit" + if ($gniExit -ne 0) { $gniOk = $false } + } + } + + # ---- High Priority ---- + if (G 'High_Prioriority') { + $hp = Join-Path $scriptDir "High Priority.CMD" + if (Test-Path $hp) { + Start-Process $hp -WindowStyle Minimized + Write-Host "Launching In " -NoNewline + Write-Host "High" -ForegroundColor Yellow -NoNewline + Write-Host " Priority!" + } + } + + + # ---- VD network check ---- + if ($gniOk -and (G 'Enable_RT')) { + $rndisLine = & $adb shell ip addr show rndis0 2>&1 | Where-Object { $_ -match 'inet ' } + Log "rndis0: $rndisLine" + if ($rndisLine -match 'inet\s+(\d+\.\d+\.\d+)\.\d+') { + $headsetSubnet = $matches[1] + $pcSubnets = Get-NetIPAddress -AddressFamily IPv4 | + Where-Object { $_.IPAddress -notmatch '^127\.' } | + ForEach-Object { $_.IPAddress -replace '\.\d+$', '' } + Log "VD subnet check - headset: $headsetSubnet.x PC: $($pcSubnets -join ', ').x" + if ($pcSubnets -contains $headsetSubnet) { + Log "VD network OK: subnet match ($headsetSubnet.x)" + } else { + LWrn "Virtual Desktop: subnet mismatch (headset $headsetSubnet.x vs PC). Bitrate may be capped to ~60 Mbps." + } + } else { + Log "VD network check: rndis0 not found on headset" + } + } + + # ---- Gnirehtet failure handling ---- + if ((G 'Enable_RT') -and -not $gniOk) { + Log "gnirehtet failed. ADB devices: $(& $adb devices 2>&1 | Out-String)" + Log "WiFi at failure: $(& $adb shell settings get global wifi_on 2>&1)" + Log "IP routes at failure: $(& $adb shell ip route 2>&1 | Out-String)" + if (G 'Enable_Sound') { Start-Process $mp3 -ArgumentList "STM\error.mp3" } + LErr "Please connect your headset and restart RT-RP" + LErr "See $logFile for details." + Read-Host "Press Enter to restart" + $restart = $true + continue + } + + # ---- Sound ---- + if (G 'Enable_Sound') { Start-Process $mp3 -ArgumentList "STM\start.mp3" } + + # ---- ADB: Steam Link ---- + if (G 'Launch_Steam_Link_Client') { + Log "Launching Steam Link via ADB..." + $r = & $adb shell monkey -p com.valvesoftware.steamlinkvr -c android.intent.category.LAUNCHER 1 2>&1 + Log "ADB Steam Link result: $($r | Out-String)" + } + + # ---- ADB: VD client ---- + if (G 'Launch_VD_Client') { + Log "Launching VD client via ADB..." + $r = & $adb shell monkey -p VirtualDesktop.Android -c android.intent.category.LAUNCHER 1 2>&1 + Log "ADB VD client result: $($r | Out-String)" + } + + # ---- ICS ---- + if (G 'Enable_ICS') { + $ics = Join-Path $scriptDir "ICS START.cmd" + Start-Process $ics -Verb RunAs -WorkingDirectory $scriptDir + Write-Host "ICS Started Successfully!!" -ForegroundColor Green + Start-Sleep 4 + exit + } + + Write-Host "RT Started Successfully!!" -ForegroundColor Green + Write-Host "Log: $logFile" + Add-Content $logFile "RT Started Successfully." + + # ---- Gnirehtet run (blocks - WARN/ERROR only go to log) ---- + if (G 'Enable_RT') { + & $gni run 2>&1 | Where-Object { $_ -match '\b(WARN|ERROR)\b' } | Add-Content $logFile + # Only reaches here if gnirehtet exits - usually means another instance was running + Write-Host "Another Instance of RT-RP Is Already Running!!!" -ForegroundColor White -BackgroundColor Red + Read-Host "Press Enter to exit" + exit + } + + # ---- RT and ICS both off - launched apps only ---- + if (-not (G 'Enable_RT') -and -not (G 'Enable_ICS')) { + if (G 'Enable_Sound') { Start-Process $mp3 -ArgumentList "STM\start.mp3" } + Write-Host "RT And ICS are OFF, Launching Selected Apps ONLY!!" -ForegroundColor Black -BackgroundColor Yellow + Start-Sleep 4 + exit + } +}