Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Tech-How authored Jun 26, 2023
1 parent 838d6a8 commit 5cee260
Show file tree
Hide file tree
Showing 14 changed files with 401 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Backup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@echo off
title Oculus Backup Tool

goto integrity
:integrityfail
cls
echo Integrity check failed.
echo.
echo Please re-download this program from GitHub, making sure to extract all files and disable any software that could
echo interfere with extraction.
echo.
echo.
echo View minimized command window in taskbar for more info...
echo Press any key to exit...
timeout -1 >nul
exit
:integrity
echo Verifying integrity...
del /q "%temp%\IntegrityVerification.store" >nul 2>&1
del /q "%temp%\IntegrityVerificationDone.store" >nul 2>&1
start "INTEGRITY" /min "%cd%\Integrity.cmd"
timeout 1 /nobreak >nul
if not exist "%temp%\IntegrityVerificationDone.store" goto integrity
if not exist "%temp%\IntegrityVerification.store" goto integrityfail
cls

if exist Oculus\Support Redistributables\NirCmd.exe infobox "Configuration data from a previous backup is still present. Please run the Reset script to clear any previously backed up data before proceeding." "Oculus Backup Tool" && exit
if exist AppData\Local Redistributables\NirCmd.exe infobox "Configuration data from a previous backup is still present. Please run the Reset script to clear any previously backed up data before proceeding." "Oculus Backup Tool" && exit
if exist AppData\Roaming Redistributables\NirCmd.exe infobox "Configuration data from a previous backup is still present. Please run the Reset script to clear any previously backed up data before proceeding." "Oculus Backup Tool" && exit
if not exist "C:\Program Files\Oculus\Support" Redistributables\NirCmd.exe infobox "Oculus was not detected on this computer. No data found to backup.~n~nPlease note:~nOnly the default installation directory is supported. You can use another directory by creating a symbolic link to the default installation directory, however it's not recommended nor supported." "Oculus Backup Tool" && exit
Redistributables\NirCmd.exe infobox "This utility will backup your current Oculus data, including your installed software version and headset configuration. In order for the restore process to complete successfully, please ensure you are signed in to the Oculus Client and have configured your headset.~n~nPlease note: All downloaded software will be included in the backup, which can significantly extend the backup time. To avoid this, uninstall items from your Oculus library before running this utility.~n~n~nPress OK to start the backup process." "Oculus Backup Tool"
set "installpath=C:\Program Files\Oculus\"
echo Backing up Oculus...
Xcopy /E "%installpath%." "%cd%\Oculus\" /y >nul 2>&1
echo.
echo Backing up User Data...
Xcopy /E "%LocalAppData%\Oculus" "%cd%\AppData\Local\Oculus\" /y >nul 2>&1
Xcopy /E "%AppData%\Oculus" "%cd%\AppData\Roaming\Oculus\" /y >nul 2>&1
Xcopy /E "%AppData%\OculusClient" "%cd%\AppData\Roaming\OculusClient\" /y >nul 2>&1
echo.
echo.
echo Backup Complete.
Redistributables\NirCmd.exe infobox "Backup complete. Use the Install script to install this configuration on another machine." "Oculus Backup Tool"
pause
exit
128 changes: 128 additions & 0 deletions Install.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
@echo off
title Oculus Setup

if exist "%temp%\BypassIntegrityCheck.store" del /q "%temp%\BypassIntegrityCheck.store" && goto BypassIntegrityCheck
goto integrity
:integrityfail
cls
echo Integrity check failed.
echo.
echo Please re-download this program from GitHub, making sure to extract all files and disable any software that could
echo interfere with extraction.
echo.
echo.
echo View minimized command window in taskbar for more info...
echo Press any key to exit...
timeout -1 >nul
exit
:integrity
echo Verifying integrity...
del /q "%temp%\IntegrityVerification.store" >nul 2>&1
del /q "%temp%\IntegrityVerificationDone.store" >nul 2>&1
start "INTEGRITY" /min "%cd%\Integrity.cmd"
timeout 1 /nobreak >nul
if not exist "%temp%\IntegrityVerificationDone.store" goto integrity
if not exist "%temp%\IntegrityVerification.store" goto integrityfail
cls
echo BypassIntegrity > "%temp%\BypassIntegrityCheck.store"
:BypassIntegrityCheck

:: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B

:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
title Oculus Setup
set "installpath=C:\Program Files\Oculus\"
md TestDir >nul 2>&1
if errorlevel 1 Redistributables\NirCmd.exe infobox "Oculus Setup doesn't work on write-protected disks. Please remove the write-protection and try again." "Oculus Setup" && exit
rd TestDir >nul 2>&1

if not exist Oculus\Support Redistributables\NirCmd.exe infobox "There is no backup to install from. Please follow the instructions on GitHub and run the Backup script on a machine with Oculus already installed to prepare this utility for installation." "Oculus Setup" && exit
if not exist AppData\Local Redistributables\NirCmd.exe infobox "There is no backup to install from. Please follow the instructions on GitHub and run the Backup script on a machine with Oculus already installed to prepare this utility for installation." "Oculus Setup" && exit
if not exist AppData\Roaming Redistributables\NirCmd.exe infobox "There is no backup to install from. Please follow the instructions on GitHub and run the Backup script on a machine with Oculus already installed to prepare this utility for installation." "Oculus Setup" && exit
if exist "%installpath%Support" Redistributables\NirCmd.exe infobox "Oculus is already installed on this machine." "Oculus Setup" && exit
Redistributables\NirCmd.exe qboxcom "Ready to install.~n~nAfter installation, your computer will reboot.~nWould you like to proceed with the installation now?" "Oculus Setup" inisetval "Redistributables\Install.ini" "section1" "TestValue" "1"
if not exist Redistributables\Install.ini exit
del /q Redistributables\Install.ini
Redistributables\NirCmd.exe qboxcom "Would you like to block communication with Facebook and Oculus? This can be removed later by running the uninstaller.~n~nUse this mode if you only want the Oculus dash and headset drivers installed, and don't plan on using the store." "Oculus Setup" inisetval "Redistributables\BlockNet.ini" "section1" "TestValue" "1"
if exist Redistributables\BlockNet.ini goto blockcomms
:resumesetup
:: Restore registry entries
regedit /s "%cd%\Registry\Oculus.reg"
regedit /s "%cd%\Registry\Uninstall.reg"
:: Copy Oculus software
echo Copying Oculus Software...
Xcopy /E "%cd%\Oculus" "%installpath%" /y >nul 2>&1
Xcopy /E "%cd%\Shortcuts\programdataStartMenu\Oculus" "%programdata%\Microsoft\Windows\Start Menu\Oculus\" >nul 2>&1
Xcopy /E "%cd%\Shortcuts\publicDesktop" "%systemdrive%\Users\Public\Desktop\" >nul 2>&1
:: Restore AppData backup
echo.
echo Copying User Data...
Xcopy /E "%cd%\AppData\Local\Oculus" "%LocalAppData%\Oculus\" /y >nul 2>&1
Xcopy /E "%cd%\AppData\Roaming\Oculus" "%AppData%\Oculus\" /y >nul 2>&1
Xcopy /E "%cd%\AppData\Roaming\OculusClient" "%AppData%\OculusClient\" /y >nul 2>&1
:: Add Environment Variables
echo.
echo Setting Environment Paths...
reg add "HKCU\Software\Oculus VR, LLC\Oculus\Libraries" /f >nul 2>&1
setx /M PATH "%PATH%;%installpath%Support\oculus-runtime" >nul 2>&1
setx /M OculusBase "%installpath%\" >nul 2>&1
echo.
echo Setting Up Librarian...
cacls "%installpath%Software" /e /p "%username%":f >nul 2>&1
regedit /s Registry\OVRLibraryService.reg >nul 2>&1
echo.
echo Installing Redistributables...
"%cd%\Redistributables\visual-cpp-2013.exe" /install /quiet /norestart
"%cd%\Redistributables\visual-cpp-2013-x86.exe" /install /quiet /norestart
echo.
echo Installing Drivers...
:: Install Drivers
"%installpath%Support\oculus-drivers\oculus-driver.exe"
:: Install OVRService
"%installpath%Support\oculus-runtime\OVRServiceLauncher.exe" -install -start
shutdown /r /t 0
timeout -1 /nobreak >nul 2>&1

:blockcomms
echo Applying Network Settings...
echo.
del /q Redistributables\BlockNet.ini
copy %windir%\System32\drivers\etc\hosts "Network Backup" /y >nul 2>&1
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 graph.oculus.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 edge-mqtt.facebook.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 scontent.oculuscdn.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 securecdn.oculus.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 graph.facebook.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
goto resumesetup
34 changes: 34 additions & 0 deletions Integrity.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@echo off
del /q "%temp%\IntegrityVerification.store" >nul 2>&1
del /q "%temp%\IntegrityVerificationDone.store" >nul 2>&1
set integrityverification=2
if not exist "AppData" set integrityverification=1 && echo Missing "AppData"
if not exist "Network Backup" set integrityverification=1 && echo Missing "Network Backup"
if not exist "Network Backup\Block.cmd" set integrityverification=1 && echo Missing "Network Backup\Block.cmd"
if not exist "Network Backup\Restore.cmd" set integrityverification=1 && echo Missing "Network Backup\Restore.cmd"
if not exist "Oculus" set integrityverification=1 && echo Missing "Oculus"
if not exist "Redistributables" set integrityverification=1 && echo Missing "Redistributables"
if not exist "Redistributables\NirCmd.exe" set integrityverification=1 && echo Missing "Redistributables\NirCmd.exe"
if not exist "Redistributables\visual-cpp-2013.exe" set integrityverification=1 && echo Missing "Redistributables\visual-cpp-2013.exe"
if not exist "Redistributables\visual-cpp-2013-x86.exe" set integrityverification=1 && echo Missing "Redistributables\visual-cpp-2013-x86.exe"
if not exist "Registry" set integrityverification=1 && echo Missing "Registry"
if not exist "Registry\Oculus.reg" set integrityverification=1 && echo Missing "Registry\Oculus.reg"
if not exist "Registry\OVRLibraryService.reg" set integrityverification=1 && echo Missing "Registry\OVRLibraryService.reg"
if not exist "Registry\Uninstall.reg" set integrityverification=1 && echo Missing "Registry\Uninstall.reg"
if not exist "Shortcuts" set integrityverification=1 && echo Missing "Shortcuts"
if not exist "Shortcuts\programdataStartMenu" set integrityverification=1 && echo Missing "Shortcuts\programdataStartMenu"
if not exist "Shortcuts\programdataStartMenu\Oculus" set integrityverification=1 && echo Missing "Shortcuts\programdataStartMenu\Oculus"
if not exist "Shortcuts\programdataStartMenu\Oculus\Oculus Support.lnk" set integrityverification=1 && echo Missing "Shortcuts\programdataStartMenu\Oculus\Oculus Support.lnk"
if not exist "Shortcuts\programdataStartMenu\Oculus\Oculus.lnk" set integrityverification=1 && echo Missing "Shortcuts\programdataStartMenu\Oculus\Oculus.lnk"
if not exist "Shortcuts\programdataStartMenu\Oculus\Uninstall Oculus.lnk" set integrityverification=1 && echo Missing "Shortcuts\programdataStartMenu\Oculus\Uninstall Oculus.lnk"
if not exist "Shortcuts\publicDesktop" set integrityverification=1 && echo Missing "Shortcuts\publicDesktop"
if not exist "Shortcuts\publicDesktop\Oculus.lnk" set integrityverification=1 && echo Missing "Shortcuts\publicDesktop\Oculus.lnk"
if not exist Backup.cmd set integrityverification=1 && echo Missing "Backup.cmd"
if not exist Install.cmd set integrityverification=1 && echo Missing "Install.cmd"
if not exist Reset.cmd set integrityverification=1 && echo Missing "Reset.cmd"
if not exist Uninstall.cmd set integrityverification=1 && echo Missing "Uninstall.cmd"
if not exist Integrity.cmd set integrityverification=1 && echo Missing "Integrity.cmd"
echo Done > "%temp%\IntegrityVerificationDone.store"
if %integrityverification% equ 1 echo. && pause && exit
echo IntegrityPassed > "%temp%\IntegrityVerification.store"
exit
44 changes: 44 additions & 0 deletions Network Backup/Block.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@echo off
title Oculus Setup
:: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B

:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
echo Applying Network Settings...
copy %windir%\System32\drivers\etc\hosts /y >nul 2>&1
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 graph.oculus.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 edge-mqtt.facebook.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 scontent.oculuscdn.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 securecdn.oculus.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
echo 127.0.0.1 graph.facebook.com >> "%windir%\System32\drivers\etc\hosts"
timeout 1 /nobreak >nul 2>&1
34 changes: 34 additions & 0 deletions Network Backup/Restore.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@echo off
title Oculus Setup
:: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B

:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
if not exist hosts start "" ..\Redistributables\NirCmd.exe infobox "No hosts file to restore. Network settings have not been modified." "Oculus Setup" && exit
copy hosts %windir%\System32\drivers\etc\hosts /y >nul 2>&1 && del /q hosts >nul 2>&1 && start "" ..\Redistributables\NirCmd.exe infobox "Communication with Facebook and Oculus servers has been set to default." "Oculus Setup"
exit
Binary file added Registry/OVRLibraryService.reg
Binary file not shown.
Binary file added Registry/Oculus.reg
Binary file not shown.
Binary file added Registry/Uninstall.reg
Binary file not shown.
43 changes: 43 additions & 0 deletions Reset.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@echo off
title Reset Oculus Backup

goto integrity
:integrityfail
cls
echo Integrity check failed.
echo.
echo Please re-download this program from GitHub, making sure to extract all files and disable any software that could
echo interfere with extraction.
echo.
echo.
echo View minimized command window in taskbar for more info...
echo Press any key to exit...
timeout -1 >nul
exit
:integrity
echo Verifying integrity...
del /q "%temp%\IntegrityVerification.store" >nul 2>&1
del /q "%temp%\IntegrityVerificationDone.store" >nul 2>&1
start "INTEGRITY" /min "%cd%\Integrity.cmd"
:integritywait
timeout 1 /nobreak >nul
if not exist "%temp%\IntegrityVerificationDone.store" goto integritywait
if not exist "%temp%\IntegrityVerification.store" goto integrityfail
cls

Redistributables\NirCmd.exe qboxcom "You are about to reset the currently stored configuration, which will delete this backup from your hard drive. The current Oculus installation will not be affected.~n~nProceed?" "Reset Oculus Backup" inisetval "Redistributables\Reset.ini" "section1" "TestValue" "1"
if exist Redistributables\Reset.ini goto reset
exit

:reset
del /q Redistributables\Reset.ini
echo Reset in progress...
rd /s /q Oculus >nul 2>&1
md Oculus >nul 2>&1
rd /s /q AppData >nul 2>&1
md AppData >nul 2>&1
echo.
echo.
echo Reset Complete.
Redistributables\NirCmd.exe infobox "Reset Complete." "Reset Oculus Backup"
exit
Binary file not shown.
Binary file added Shortcuts/programdataStartMenu/Oculus/Oculus.lnk
Binary file not shown.
Binary file not shown.
Binary file added Shortcuts/publicDesktop/Oculus.lnk
Binary file not shown.
Loading

0 comments on commit 5cee260

Please sign in to comment.