Skip to content

Commit ca10b74

Browse files
authored
Merge pull request #24 from deiteris/main
Add SlimeVR Feeder App and refactor
2 parents e43e8ba + ff633f9 commit ca10b74

File tree

2 files changed

+96
-22
lines changed

2 files changed

+96
-22
lines changed

windows/web/slimevr_web_installer.nsi

Lines changed: 82 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ InstallDir "$PROGRAMFILES\SlimeVR Server" ; $InstDir default value. Defaults to
2727
ShowInstDetails show
2828
ShowUninstDetails show
2929

30-
BrandingText "SlimeVR Installer 0.1.4"
30+
BrandingText "SlimeVR Installer 0.1.5"
3131

3232
# Admin rights are required for:
3333
# 1. Removing Start Menu shortcut in Windows 7+
@@ -85,11 +85,13 @@ Function cleanTemp
8585
Delete "$TEMP\SlimeVR.zip"
8686
Delete "$TEMP\OpenJDK11U-jre_x64_windows_hotspot_11.0.14_9.zip"
8787
Delete "$TEMP\OpenJDK11U-jre_x86-32_windows_hotspot_11.0.14_9.zip"
88+
Delete "$TEMP\SlimeVR-Feeder-App-win64.zip"
8889
RMDir /r "$TEMP\slimevr-openvr-driver-win64"
8990
RMDir /r "$TEMP\SlimeVR"
9091
RMDir /r "$TEMP\OpenJDK11U-jre_x86-32_windows_hotspot_11.0.14_9"
9192
RMDir /r "$TEMP\OpenJDK11U-jre_x64_windows_hotspot_11.0.14_9"
9293
RMDir /r "$TEMP\slimevr_usb_drivers_inst"
94+
RMDir /r "$TEMP\SlimeVR-Feeder-App-win64"
9395
FunctionEnd
9496

9597
Function .onInstFailed
@@ -102,8 +104,7 @@ Function .onGUIEnd
102104
Call cleanTemp
103105
FunctionEnd
104106

105-
!macro cleanInstDir un
106-
Function ${un}cleanInstDir
107+
Function cleanInstDir
107108
Delete "$INSTDIR\uninstall.exe"
108109
Delete "$INSTDIR\run.bat"
109110
Delete "$INSTDIR\run.ico"
@@ -121,13 +122,10 @@ Function ${un}cleanInstDir
121122
RMdir /r "$INSTDIR\jre"
122123
RMdir /r "$INSTDIR\driver"
123124
RMDir /r "$INSTDIR\logs"
125+
RMdir /r "$INSTDIR\Feeder-App"
124126

125127
RMDir $INSTDIR
126128
FunctionEnd
127-
!macroend
128-
129-
!insertmacro cleanInstDir ""
130-
!insertmacro cleanInstDir "un."
131129
# Init functions end #
132130

133131
Page Custom startPage startPageLeave
@@ -424,13 +422,36 @@ Section "SlimeVR Driver" SEC_VRDRIVER
424422
${EnableX64FSRedirection}
425423
Pop $0
426424
${If} $0 != 0
427-
Abort "Failed to copy SlimeVR Driver. Make sure you have SteamVR installed."
425+
Abort "Failed to copy SlimeVR Driver."
428426
${EndIf}
429427
${Else}
430428
CopyFiles /SILENT "$TEMP\slimevr-openvr-driver-win64\slimevr" "$STEAMVRDIR\drivers\slimevr"
431429
${Endif}
432430
SectionEnd
433431

432+
Section "SlimeVR Feeder App" SEC_FEEDER_APP
433+
SetOutPath $INSTDIR
434+
435+
DetailPrint "Downloading SlimeVR Feeder App..."
436+
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
437+
Pop $0 ; Status text ("OK" for success)
438+
${If} $0 != "OK"
439+
Abort "Failed to download SlimeVR Feeder App. Reason: $0."
440+
${EndIf}
441+
DetailPrint "Downloaded!"
442+
443+
DetailPrint "Unpacking downloaded files..."
444+
nsisunz::Unzip "$TEMP\SlimeVR-Feeder-App-win64.zip" "$TEMP"
445+
Pop $0
446+
DetailPrint "Unzipping finished with $0."
447+
448+
DetailPrint "Copying SlimeVR Feeder App..."
449+
CopyFiles /SILENT "$TEMP\SlimeVR-Feeder-App-win64\*" "$INSTDIR\Feeder-App"
450+
451+
DetailPrint "Installing SlimeVR Feeder App driver..."
452+
nsExec::ExecToLog '"$INSTDIR\Feeder-App\SlimeVR-Feeder-App.exe" --install'
453+
SectionEnd
454+
434455
SectionGroup "USB drivers" SEC_USBDRIVERS
435456

436457
Section "CP210x driver" SEC_CP210X
@@ -546,39 +567,80 @@ Function componentsPre
546567
SectionSetFlags ${SEC_JRE} 0
547568
SectionSetFlags ${SEC_REGISTERAPP} 0
548569
SectionSetFlags ${SEC_USBDRIVERS} ${SF_SECGRP}
549-
Abort
570+
SectionSetFlags ${SEC_VRDRIVER} ${SF_SELECTED}
571+
SectionSetFlags ${SEC_SERVER} ${SF_SELECTED}
550572
${EndIf}
551573
FunctionEnd
552574

553-
# Uninstaller section start
554-
Section "uninstall"
555-
${DisableX64FSRedirection}
556-
nsExec::ExecToLog '"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File "$INSTDIR\steamvr.ps1" -SteamPath "$STEAMDIR" -DriverPath "slimevr" -Uninstall' $0
557-
${EnableX64FSRedirection}
558-
Pop $0
559-
575+
Section "-un.SlimeVR Server" un.SEC_SERVER
560576
# Remove the shortcuts
561577
RMdir /r "$SMPROGRAMS\SlimeVR Server"
562578
# Remove separate shortcuts introduced with first release
563579
Delete "$SMPROGRAMS\Uninstall SlimeVR Server.lnk"
564580
Delete "$SMPROGRAMS\SlimeVR Server.lnk"
565581
Delete "$DESKTOP\SlimeVR Server.lnk"
566582

583+
Delete "$INSTDIR\run.bat"
584+
Delete "$INSTDIR\run.ico"
585+
Delete "$INSTDIR\slimevr.jar"
586+
Delete "$INSTDIR\MagnetoLib.dll"
587+
Delete "$INSTDIR\log*"
588+
Delete "$INSTDIR\*.log"
589+
Delete "$INSTDIR\*.lck"
590+
Delete "$INSTDIR\vrconfig.yml"
591+
Delete "$INSTDIR\LICENSE*"
592+
593+
RMDir /r "$INSTDIR\Recordings"
594+
RMdir /r "$INSTDIR\jre"
595+
RMDir /r "$INSTDIR\logs"
596+
597+
IfErrors fail success
598+
fail:
599+
DetailPrint "Failed to remove SlimeVR Server files. Make sure SlimeVR Server is closed."
600+
Abort
601+
success:
602+
SectionEnd
603+
604+
Section "-un.SlimeVR Driver" un.SEC_VRDRIVER
605+
${DisableX64FSRedirection}
606+
nsExec::ExecToLog '"$SYSDIR\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -File "$INSTDIR\steamvr.ps1" -SteamPath "$STEAMDIR" -DriverPath "slimevr" -Uninstall' $0
607+
${EnableX64FSRedirection}
608+
Pop $0
609+
${If} $0 != 0
610+
Abort "Failed to remove SlimeVR Driver."
611+
${EndIf}
612+
Delete "$INSTDIR\steamvr.ps1"
613+
SectionEnd
614+
615+
Section "-un.SlimeVR Feeder App" un.SEC_FEEDER_APP
616+
IfFileExists "$INSTDIR\Feeder-App\SlimeVR-Feeder-App.exe" found not_found
617+
found:
618+
DetailPrint "Unregistering SlimeVR Feeder App driver..."
619+
nsExec::ExecToLog '"$INSTDIR\Feeder-App\SlimeVR-Feeder-App.exe" --uninstall'
620+
DetailPrint "Removing SlimeVR Feeder App..."
621+
RMdir /r "$INSTDIR\Feeder-App"
622+
not_found:
623+
SectionEnd
624+
625+
Section "-un." un.SEC_FIREWALL
567626
DetailPrint "Removing SlimeVR Server from firewall exceptions...."
568627
nsExec::Exec '"$INSTDIR\firewall_uninstall.bat"'
628+
Pop $0
629+
Delete "$INSTDIR\firewall*.bat"
630+
SectionEnd
569631

632+
Section "-un." un.SEC_POST_UNINSTALL
570633
DetailPrint "Unregistering installation..."
571634
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SlimeVR"
572-
573-
Call un.cleanInstDir
574-
635+
Delete "$INSTDIR\uninstall.exe"
636+
RMDir $INSTDIR
575637
DetailPrint "Done."
576638
SectionEnd
577-
# Uninstaller section end
578639

579640
LangString DESC_SEC_SERVER ${LANG_ENGLISH} "Installs latest SlimeVR Server. Additionally downloads Java JRE 11."
580641
LangString DESC_SEC_VRDRIVER ${LANG_ENGLISH} "Installs latest SlimeVR Driver in SteamVR."
581642
LangString DESC_SEC_USBDRIVERS ${LANG_ENGLISH} "A list of USB drivers that are used by various boards."
643+
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."
582644
LangString DESC_SEC_CP210X ${LANG_ENGLISH} "Installs CP210X USB driver that comes with the following boards: NodeMCU v2, Wemos D1 Mini."
583645
LangString DESC_SEC_CH340 ${LANG_ENGLISH} "Installs CH340 USB driver that comes with the following boards: NodeMCU v3, SlimeVR, Wemos D1 Mini."
584646
LangString DESC_SEC_CH9102x ${LANG_ENGLISH} "Installs CH9102x USB driver that comes with the following boards: NodeMCU v2.1."

windows/web/steamvr.ps1

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ param (
55
[parameter(Position=2)][switch]$Uninstall = $false
66
)
77

8+
$ErrorActionPreference = 'Stop'
9+
810
# Required for System.Web.Script.Serialization.JavaScriptSerializer
911
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
1012

@@ -75,13 +77,23 @@ foreach ($SteamVrPath in $SteamVrPaths) {
7577
if (Test-Path -Path "$SteamVrPath\bin") {
7678
$SteamVrDriverPath = "$SteamVrPath\drivers\$DriverFolder"
7779
if (Test-Path -Path $SteamVrDriverPath) {
78-
Remove-Item -Recurse -Path $SteamVrDriverPath
80+
try {
81+
Remove-Item -Recurse -Path $SteamVrDriverPath
82+
} catch [System.Management.Automation.ActionPreferenceStopException] {
83+
Write-Host "Failed to remove SlimeVR driver. Make sure SteamVR is closed."
84+
exit 1
85+
}
7986
}
8087
if ($Uninstall -eq $true) {
8188
Write-Host "Deleted SlimeVR Driver from `"$SteamVrDriverPath`""
8289
exit 0
8390
}
84-
Copy-Item -Recurse -Force -Path $DriverPath -Destination "$SteamVrPath\drivers"
91+
try {
92+
Copy-Item -Recurse -Force -Path $DriverPath -Destination "$SteamVrPath\drivers"
93+
} catch [System.Management.Automation.ActionPreferenceStopException] {
94+
Write-Host "Failed to remove old SlimeVR driver. Make sure SteamVR is closed and there's enough free disk space."
95+
exit 1
96+
}
8597
Write-Host "Installed SlimeVR Driver to `"$SteamVrDriverPath`""
8698
exit 0
8799
}

0 commit comments

Comments
 (0)