Browse Source

Merge pull request #3420 from Fenrirthviti/vcam-scripts

win-dshow: Add installer scripts for manual Virtual Cam registration
Jim 5 years ago
parent
commit
bad7b557c5

+ 3 - 0
plugins/win-dshow/CMakeLists.txt

@@ -143,5 +143,8 @@ source_group("libdshowcapture\\Header Files" FILES ${libdshowcapture_HEADERS})
 install_obs_plugin_with_data(win-dshow data)
 
 if(VIRTUALCAM_ENABLED)
+	configure_file(virtualcam-install.bat.in "${CMAKE_CURRENT_BINARY_DIR}/data/virtualcam-install.bat")
+	configure_file(virtualcam-uninstall.bat.in "${CMAKE_CURRENT_BINARY_DIR}/data/virtualcam-uninstall.bat")
+	install_obs_data_from_abs_path(win-dshow "${CMAKE_CURRENT_BINARY_DIR}/data" "obs-plugins/win-dshow")
 	add_subdirectory(virtualcam-module)
 endif()

+ 78 - 0
plugins/win-dshow/virtualcam-install.bat.in

@@ -0,0 +1,78 @@
+@echo off
+goto checkAdmin
+
+:checkAdmin
+	net session >nul 2>&1
+	if %errorLevel% == 0 (
+		echo.
+	) else (
+		echo Administrative rights are required, please re-run this script as Administrator.
+		goto end
+	)
+
+:checkDLL
+	echo Checking for 32-bit Virtual Cam registration...
+	reg query "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{@VIRTUALCAM_GUID@}" >nul 2>&1
+	if %errorLevel% == 0 (
+		echo 32-bit Virtual Cam found, skipping install...
+		echo.
+	) else (
+		echo 32-bit Virtual Cam not found, installing...
+		goto install32DLL
+	)
+
+:CheckDLLContinue
+	echo Checking for 64-bit Virtual Cam registration...
+	reg query "HKLM\SOFTWARE\Classes\CLSID\{@VIRTUALCAM_GUID@}" >nul 2>&1
+	if %errorLevel% == 0 (
+		echo 64-bit Virtual Cam found, skipping install...
+		echo.
+	) else (
+		echo 64-bit Virtual Cam not found, installing...
+		goto install64DLL
+	)
+	goto endSuccess
+
+:install32DLL
+	echo Installing 32-bit Virtual Cam...
+	if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll" (
+		regsvr32.exe /i /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll"
+	) else (
+		regsvr32.exe /i /s obs-virtualcam-module32.dll
+	)
+	reg query "HKLM\SOFTWARE\Classes\WOW6432Node\CLSID\{@VIRTUALCAM_GUID@}" >nul 2>&1
+	if %errorLevel% == 0 (
+		echo 32-bit Virtual Cam successfully installed
+		echo.
+	) else (
+		echo 32-bit Virtual Cam installation failed
+		echo.
+		goto end
+	)
+	goto checkDLLContinue
+
+:install64DLL
+	echo Installing 64-bit Virtual Cam...
+	if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" (
+		regsvr32.exe /i /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll"
+	) else (
+		regsvr32.exe /i /s obs-virtualcam-module64.dll
+	)
+	reg query "HKLM\SOFTWARE\Classes\CLSID\{@VIRTUALCAM_GUID@}" >nul 2>&1
+	if %errorLevel% == 0 (
+		echo 64-bit Virtual Cam successfully installed
+		echo.
+		goto endSuccess
+	) else (
+		echo 64-bit Virtual Cam installation failed
+		echo.
+		goto end
+	)
+
+:endSuccess
+	echo Virtual Cam installed!
+	echo.
+
+:end
+	pause
+	exit

+ 31 - 0
plugins/win-dshow/virtualcam-uninstall.bat.in

@@ -0,0 +1,31 @@
+@echo off
+goto checkAdmin
+
+:checkAdmin
+	net session >nul 2>&1
+	if %errorLevel% == 0 (
+		echo.
+	) else (
+		echo Administrative rights are required, please re-run this script as Administrator.
+		goto end
+	)
+
+:uninstallDLLs
+	if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll" (
+		regsvr32.exe /u /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll"
+	) else (
+		regsvr32.exe /u /s obs-virtualcam-module32.dll
+	)
+	if exist "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" (
+		regsvr32.exe /u /s "%~dp0\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll"
+	) else (
+		regsvr32.exe /u /s obs-virtualcam-module64.dll
+	)
+
+:endSuccess
+	echo Virtual Cam uninstalled!
+	echo.
+
+:end
+	pause
+	exit