Skip to content

Commit

Permalink
Merge pull request #11 from ju1ce/pr-install-messages
Browse files Browse the repository at this point in the history
Add some messages during driver install
  • Loading branch information
ju1ce authored Jul 20, 2022
2 parents 8e8d653 + a1fbee2 commit 9ccb02e
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 36 deletions.
67 changes: 66 additions & 1 deletion install_driver.bat
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ IF NOT "%2"=="" (
)

IF NOT EXIST "%DRIVER_PATH%" (
ECHO Driver install not found: "%DRIVER_PATH%"
ECHO Driver not found: "%DRIVER_PATH%"
echo(
echo Check that you downloaded the right files and make sure to unzip the folder before running this script^^!
echo(
GOTO end
)
IF NOT EXIST "%VRPATHREG_EXE%" (
ECHO vrpathreg.exe not found: "%VRPATHREG_EXE%"
echo(
echo This usualy means an error with your SteamVR installation.
echo(
GOTO end
)

Expand All @@ -78,6 +84,65 @@ IF NOT "%errorlevel%"=="0" GOTO end
REM display the current configuration, with the newly added driver
CALL "%VRPATHREG_EXE%" show

echo(
echo The driver has been installed successfully^^!
echo(

echo(
echo Enabling multiple drivers in SteamVR config...
echo(

REM the path can be found in openvrpaths.vrpath, which should always be in %localappdata%

REM the file is in json, and the path is under the "config" field. We first find the line number of the "config" field

set /a count = 1
set /a line = 0

for /F %%A in (%localappdata%\openvr\openvrpaths.vrpath) do (
if %%A=="config" set /a line = count+2
set /a count += 1
)

set /a count = 1

REM then, we parse whole lines and save the path. It should be 2 fields under "config"

for /F "tokens=*" %%A in (%localappdata%\openvr\openvrpaths.vrpath) do (
if !count!==!line! set VRCONFIG=%%A
set /a count += 1
)

set VRCONFIG=%VRCONFIG:"=%

set VRSETTINGS=!VRCONFIG!\\steamvr.vrsettings

set search="steamvr" : {
set replace="steamvr" : { "activateMultipleDrivers" : true,

set "textFile=%VRSETTINGS%"

for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>"%textFile%" echo(!line:%search%=%replace%!
endlocal
)

set search="activateMultipleDrivers" : false,
set replace="activateMultipleDrivers" : true,

for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>"%textFile%" echo(!line:%search%=%replace%!
endlocal
)

echo(
echo Finished^^!
echo(

:end
ENDLOCAL
PAUSE
Expand Down
18 changes: 15 additions & 3 deletions install_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ vrpathreg_exe="$vrpath"/bin/vrpathreg.sh

#check if all the needed paths exist
if ! test -d "$driver_path"; then
echo "Driver install not found: $driver_path"
echo "Driver not found: $driver_path"
echo
echo Check that you downloaded the right files and make sure to unzip the folder before running this script!
echo
exit
fi

if ! test -f "$vrpathreg_exe"; then
echo "vrpathreg.exe not found: $vrpathreg_exe"
echo
echo This usualy means an error with your SteamVR installation.
echo
exit
fi

Expand All @@ -30,11 +36,17 @@ if test -d "$vrpath"/drivers/apriltagtrackers; then
fi

#cleanup previous drivers, then installs the driver
$vrpathreg_exe removedriver $driver_path
$vrpathreg_exe removedriver "$driver_path"
$vrpathreg_exe removedriverswithname $driver_name
$vrpathreg_exe adddriver $driver_path
$vrpathreg_exe adddriver "$driver_path"

#shows currently installed drivers
$vrpathreg_exe show

echo
echo The driver has been installed successfully!
echo

echo Could not activate multiple drivers in steamvr config! If trackers do not appear in SteamVR, you may need to edit steamvr.vrsettings manualy.
echo

27 changes: 0 additions & 27 deletions test_install.bat

This file was deleted.

5 changes: 5 additions & 0 deletions uninstall_driver.bat
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ IF NOT "%errorlevel%"=="0" GOTO end
REM display the current configuration, with the newly added driver
CALL "%VRPATHREG_EXE%" show

echo(
echo The driver has been uninstalled successfully^^!
echo(


:end
ENDLOCAL
PAUSE
Expand Down
8 changes: 3 additions & 5 deletions uninstall_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ vrpath=$(echo $vrpath | sed 's|[]"[]||g' | sed 's|^[[:space:]]*||' | sed 's|[[:s
vrpathreg_exe="$vrpath"/bin/vrpathreg.sh

#check if all the needed paths exist
if ! test -d "$driver_path"; then
echo "Driver install not found: $driver_path"
exit
fi

if ! test -f "$vrpathreg_exe"; then
echo "vrpathreg.exe not found: $vrpathreg_exe"
Expand All @@ -36,4 +32,6 @@ $vrpathreg_exe removedriverswithname $driver_name
#shows currently installed drivers
$vrpathreg_exe show


echo
echo The driver has been uninstalled successfully!
echo

0 comments on commit 9ccb02e

Please sign in to comment.