Skip to content

Commit

Permalink
Merge pull request #24 from deiteris/main
Browse files Browse the repository at this point in the history
Add SlimeVR Feeder App and refactor
  • Loading branch information
Eirenliel authored Mar 21, 2022
2 parents e43e8ba + ff633f9 commit ca10b74
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 22 deletions.
102 changes: 82 additions & 20 deletions windows/web/slimevr_web_installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ InstallDir "$PROGRAMFILES\SlimeVR Server" ; $InstDir default value. Defaults to
ShowInstDetails show
ShowUninstDetails show

BrandingText "SlimeVR Installer 0.1.4"
BrandingText "SlimeVR Installer 0.1.5"

# Admin rights are required for:
# 1. Removing Start Menu shortcut in Windows 7+
Expand Down Expand Up @@ -85,11 +85,13 @@ Function cleanTemp
Delete "$TEMP\SlimeVR.zip"
Delete "$TEMP\OpenJDK11U-jre_x64_windows_hotspot_11.0.14_9.zip"
Delete "$TEMP\OpenJDK11U-jre_x86-32_windows_hotspot_11.0.14_9.zip"
Delete "$TEMP\SlimeVR-Feeder-App-win64.zip"
RMDir /r "$TEMP\slimevr-openvr-driver-win64"
RMDir /r "$TEMP\SlimeVR"
RMDir /r "$TEMP\OpenJDK11U-jre_x86-32_windows_hotspot_11.0.14_9"
RMDir /r "$TEMP\OpenJDK11U-jre_x64_windows_hotspot_11.0.14_9"
RMDir /r "$TEMP\slimevr_usb_drivers_inst"
RMDir /r "$TEMP\SlimeVR-Feeder-App-win64"
FunctionEnd

Function .onInstFailed
Expand All @@ -102,8 +104,7 @@ Function .onGUIEnd
Call cleanTemp
FunctionEnd

!macro cleanInstDir un
Function ${un}cleanInstDir
Function cleanInstDir
Delete "$INSTDIR\uninstall.exe"
Delete "$INSTDIR\run.bat"
Delete "$INSTDIR\run.ico"
Expand All @@ -121,13 +122,10 @@ Function ${un}cleanInstDir
RMdir /r "$INSTDIR\jre"
RMdir /r "$INSTDIR\driver"
RMDir /r "$INSTDIR\logs"
RMdir /r "$INSTDIR\Feeder-App"

RMDir $INSTDIR
FunctionEnd
!macroend

!insertmacro cleanInstDir ""
!insertmacro cleanInstDir "un."
# Init functions end #

Page Custom startPage startPageLeave
Expand Down Expand Up @@ -424,13 +422,36 @@ Section "SlimeVR Driver" SEC_VRDRIVER
${EnableX64FSRedirection}
Pop $0
${If} $0 != 0
Abort "Failed to copy SlimeVR Driver. Make sure you have SteamVR installed."
Abort "Failed to copy SlimeVR Driver."
${EndIf}
${Else}
CopyFiles /SILENT "$TEMP\slimevr-openvr-driver-win64\slimevr" "$STEAMVRDIR\drivers\slimevr"
${Endif}
SectionEnd

Section "SlimeVR Feeder App" SEC_FEEDER_APP
SetOutPath $INSTDIR

DetailPrint "Downloading SlimeVR Feeder App..."
NScurl::http GET "https://github.com/SlimeVR/SlimeVR-Feeder-App/releases/latest/download/SlimeVR-Feeder-App-win64.zip" "$TEMP\SlimeVR-Feeder-App-win64.zip" /CANCEL /RESUME /END
Pop $0 ; Status text ("OK" for success)
${If} $0 != "OK"
Abort "Failed to download SlimeVR Feeder App. Reason: $0."
${EndIf}
DetailPrint "Downloaded!"

DetailPrint "Unpacking downloaded files..."
nsisunz::Unzip "$TEMP\SlimeVR-Feeder-App-win64.zip" "$TEMP"
Pop $0
DetailPrint "Unzipping finished with $0."

DetailPrint "Copying SlimeVR Feeder App..."
CopyFiles /SILENT "$TEMP\SlimeVR-Feeder-App-win64\*" "$INSTDIR\Feeder-App"

DetailPrint "Installing SlimeVR Feeder App driver..."
nsExec::ExecToLog '"$INSTDIR\Feeder-App\SlimeVR-Feeder-App.exe" --install'
SectionEnd

SectionGroup "USB drivers" SEC_USBDRIVERS

Section "CP210x driver" SEC_CP210X
Expand Down Expand Up @@ -546,39 +567,80 @@ Function componentsPre
SectionSetFlags ${SEC_JRE} 0
SectionSetFlags ${SEC_REGISTERAPP} 0
SectionSetFlags ${SEC_USBDRIVERS} ${SF_SECGRP}
Abort
SectionSetFlags ${SEC_VRDRIVER} ${SF_SELECTED}
SectionSetFlags ${SEC_SERVER} ${SF_SELECTED}
${EndIf}
FunctionEnd

# Uninstaller section start
Section "uninstall"
${DisableX64FSRedirection}
nsExec::ExecToLog '"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File "$INSTDIR\steamvr.ps1" -SteamPath "$STEAMDIR" -DriverPath "slimevr" -Uninstall' $0
${EnableX64FSRedirection}
Pop $0

Section "-un.SlimeVR Server" un.SEC_SERVER
# Remove the shortcuts
RMdir /r "$SMPROGRAMS\SlimeVR Server"
# Remove separate shortcuts introduced with first release
Delete "$SMPROGRAMS\Uninstall SlimeVR Server.lnk"
Delete "$SMPROGRAMS\SlimeVR Server.lnk"
Delete "$DESKTOP\SlimeVR Server.lnk"

Delete "$INSTDIR\run.bat"
Delete "$INSTDIR\run.ico"
Delete "$INSTDIR\slimevr.jar"
Delete "$INSTDIR\MagnetoLib.dll"
Delete "$INSTDIR\log*"
Delete "$INSTDIR\*.log"
Delete "$INSTDIR\*.lck"
Delete "$INSTDIR\vrconfig.yml"
Delete "$INSTDIR\LICENSE*"

RMDir /r "$INSTDIR\Recordings"
RMdir /r "$INSTDIR\jre"
RMDir /r "$INSTDIR\logs"

IfErrors fail success
fail:
DetailPrint "Failed to remove SlimeVR Server files. Make sure SlimeVR Server is closed."
Abort
success:
SectionEnd

Section "-un.SlimeVR Driver" un.SEC_VRDRIVER
${DisableX64FSRedirection}
nsExec::ExecToLog '"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File "$INSTDIR\steamvr.ps1" -SteamPath "$STEAMDIR" -DriverPath "slimevr" -Uninstall' $0
${EnableX64FSRedirection}
Pop $0
${If} $0 != 0
Abort "Failed to remove SlimeVR Driver."
${EndIf}
Delete "$INSTDIR\steamvr.ps1"
SectionEnd

Section "-un.SlimeVR Feeder App" un.SEC_FEEDER_APP
IfFileExists "$INSTDIR\Feeder-App\SlimeVR-Feeder-App.exe" found not_found
found:
DetailPrint "Unregistering SlimeVR Feeder App driver..."
nsExec::ExecToLog '"$INSTDIR\Feeder-App\SlimeVR-Feeder-App.exe" --uninstall'
DetailPrint "Removing SlimeVR Feeder App..."
RMdir /r "$INSTDIR\Feeder-App"
not_found:
SectionEnd

Section "-un." un.SEC_FIREWALL
DetailPrint "Removing SlimeVR Server from firewall exceptions...."
nsExec::Exec '"$INSTDIR\firewall_uninstall.bat"'
Pop $0
Delete "$INSTDIR\firewall*.bat"
SectionEnd

Section "-un." un.SEC_POST_UNINSTALL
DetailPrint "Unregistering installation..."
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SlimeVR"

Call un.cleanInstDir

Delete "$INSTDIR\uninstall.exe"
RMDir $INSTDIR
DetailPrint "Done."
SectionEnd
# Uninstaller section end

LangString DESC_SEC_SERVER ${LANG_ENGLISH} "Installs latest SlimeVR Server. Additionally downloads Java JRE 11."
LangString DESC_SEC_VRDRIVER ${LANG_ENGLISH} "Installs latest SlimeVR Driver in SteamVR."
LangString DESC_SEC_USBDRIVERS ${LANG_ENGLISH} "A list of USB drivers that are used by various boards."
LangString DESC_SEC_FEEDER_APP ${LANG_ENGLISH} "Installs SlimeVR Feeder App that sends position of SteamVR trackers (Vive trackers, controllers) to SlimeVR Server. Required for elbow tracking."
LangString DESC_SEC_CP210X ${LANG_ENGLISH} "Installs CP210X USB driver that comes with the following boards: NodeMCU v2, Wemos D1 Mini."
LangString DESC_SEC_CH340 ${LANG_ENGLISH} "Installs CH340 USB driver that comes with the following boards: NodeMCU v3, SlimeVR, Wemos D1 Mini."
LangString DESC_SEC_CH9102x ${LANG_ENGLISH} "Installs CH9102x USB driver that comes with the following boards: NodeMCU v2.1."
Expand Down
16 changes: 14 additions & 2 deletions windows/web/steamvr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ param (
[parameter(Position=2)][switch]$Uninstall = $false
)

$ErrorActionPreference = 'Stop'

# Required for System.Web.Script.Serialization.JavaScriptSerializer
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")

Expand Down Expand Up @@ -75,13 +77,23 @@ foreach ($SteamVrPath in $SteamVrPaths) {
if (Test-Path -Path "$SteamVrPath\bin") {
$SteamVrDriverPath = "$SteamVrPath\drivers\$DriverFolder"
if (Test-Path -Path $SteamVrDriverPath) {
Remove-Item -Recurse -Path $SteamVrDriverPath
try {
Remove-Item -Recurse -Path $SteamVrDriverPath
} catch [System.Management.Automation.ActionPreferenceStopException] {
Write-Host "Failed to remove SlimeVR driver. Make sure SteamVR is closed."
exit 1
}
}
if ($Uninstall -eq $true) {
Write-Host "Deleted SlimeVR Driver from `"$SteamVrDriverPath`""
exit 0
}
Copy-Item -Recurse -Force -Path $DriverPath -Destination "$SteamVrPath\drivers"
try {
Copy-Item -Recurse -Force -Path $DriverPath -Destination "$SteamVrPath\drivers"
} catch [System.Management.Automation.ActionPreferenceStopException] {
Write-Host "Failed to remove old SlimeVR driver. Make sure SteamVR is closed and there's enough free disk space."
exit 1
}
Write-Host "Installed SlimeVR Driver to `"$SteamVrDriverPath`""
exit 0
}
Expand Down

0 comments on commit ca10b74

Please sign in to comment.