From a94ede6d003dd8c1f1f3ac109e09880287798cf0 Mon Sep 17 00:00:00 2001 From: Joel Bethke Date: Sat, 5 Sep 2020 20:13:00 -0500 Subject: [PATCH] win-dshow: Add VirtualCam installer scripts This adds two batch scripts to install and uninstall the virtual cam devices for installations where the installer could not be used. Most commonly, this is for portable installations or those who prefer the .zip file. --- plugins/win-dshow/CMakeLists.txt | 3 + plugins/win-dshow/virtualcam-install.bat.in | 78 +++++++++++++++++++ plugins/win-dshow/virtualcam-uninstall.bat.in | 31 ++++++++ 3 files changed, 112 insertions(+) create mode 100644 plugins/win-dshow/virtualcam-install.bat.in create mode 100644 plugins/win-dshow/virtualcam-uninstall.bat.in diff --git a/plugins/win-dshow/CMakeLists.txt b/plugins/win-dshow/CMakeLists.txt index e483ac536..a30038d1a 100644 --- a/plugins/win-dshow/CMakeLists.txt +++ b/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() diff --git a/plugins/win-dshow/virtualcam-install.bat.in b/plugins/win-dshow/virtualcam-install.bat.in new file mode 100644 index 000000000..3474a3fb1 --- /dev/null +++ b/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 diff --git a/plugins/win-dshow/virtualcam-uninstall.bat.in b/plugins/win-dshow/virtualcam-uninstall.bat.in new file mode 100644 index 000000000..0c1aec50b --- /dev/null +++ b/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