Created
February 17, 2025 08:48
-
-
Save morya/acfa64a3a7854a0ee4af4818ec7ca352 to your computer and use it in GitHub Desktop.
golive studio install script for nsis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; file saved with utf8-with-BOM | |
| ; | |
| ; NSIS Installer Script for OBS Studio, https://obsproject.com/ | |
| ; | |
| ; This installer script is designed only for the release process | |
| ; of OBS Studio. It requires a lot of files to be in exactly the | |
| ; right places. If you're making a fork, it's strongly suggested | |
| ; that you make your own installer. | |
| ; | |
| ; If you choose to use this script anyway, be absolutely sure you | |
| ; have replaced every OBS specific check, whether process names, | |
| ; application names, files, registry entries, etc. | |
| ; | |
| ; To auto-install required Visual C++ components, download from | |
| ; https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0 | |
| ; and copy to this directory (UI/installer/) | |
| ; | |
| ; This script also requires OBSInstallerUtils for additional | |
| ; functions. You can find it at | |
| ; https://github.com/notr1ch/OBSInstallerUtils | |
| Unicode true | |
| ManifestDPIAware true | |
| ; Define your application name | |
| !define APPNAME "Golive Studio" | |
| !ifndef APPVERSION | |
| !define APPVERSION "29.1.5" | |
| !define SHORTVERSION "29.1.5" | |
| !endif | |
| !define APPNAMEANDVERSION "${APPNAME} ${SHORTVERSION}" | |
| !define INSTALL64 ; set 64bit only | |
| ; Additional script dependencies | |
| !include WinVer.nsh | |
| !include x64.nsh | |
| ; Main Install settings | |
| Name "${APPNAMEANDVERSION}" | |
| InstallDir "$PROGRAMFILES64\Golive-Studio" | |
| InstallDirRegKey HKLM "Software\${APPNAME}" "" | |
| OutFile "Golive-Studio-${SHORTVERSION}-Installer-x64.exe" | |
| ; Use compression | |
| SetCompressor /SOLID LZMA | |
| ; Need Admin | |
| RequestExecutionLevel admin | |
| ; Modern interface settings | |
| !include "MUI.nsh" | |
| !define MUI_ICON "obs-studio.ico" ; this icon has been replaced | |
| !define MUI_HEADERIMAGE_BITMAP "golive-logo.bmp" | |
| !define MUI_WELCOMEFINISHPAGE_BITMAP "OBSBanner.bmp" | |
| !define MUI_ABORTWARNING | |
| !define MUI_FINISHPAGE_TITLE "Completed Setup" | |
| !define MUI_FINISHPAGE_RUN | |
| !define MUI_FINISHPAGE_RUN_TEXT "Launch ${APPNAMEANDVERSION}" | |
| !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchGolive" | |
| !define MUI_FINISHPAGE_SHOWREADME "https://help.eagleplan.fun/teacher" | |
| !define MUI_FINISHPAGE_SHOWREADME_TEXT "View Release Notes" | |
| !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED | |
| !define MUI_FINISHPAGE_LINK "New to Golive? Check out our 4-step Quickstart Guide." | |
| !define MUI_FINISHPAGE_LINK_LOCATION "https://help.eagleplan.fun/teacher/" | |
| !define MUI_FINISHPAGE_LINK_COLOR 000080 | |
| !define MUI_WELCOMEPAGE_TEXT "This setup will guide you through installing Golive Studio.\n\nIt is recommended that you close all other applications before starting, including Golive Studio. This will make it possible to update relevant files without having to reboot your computer.\n\nClick Next to continue." | |
| !define MUI_PAGE_CUSTOMFUNCTION_LEAVE PreReqCheck | |
| !define MUI_HEADERIMAGE | |
| !define MUI_PAGE_HEADER_TEXT "License Information" | |
| !define MUI_PAGE_HEADER_SUBTEXT "Please review the license terms before installing Golive Studio." | |
| !define MUI_LICENSEPAGE_TEXT_TOP "Press Page Down or scroll to see the rest of the license." | |
| !define MUI_LICENSEPAGE_TEXT_BOTTOM " " | |
| !define MUI_LICENSEPAGE_BUTTON "&Next >" | |
| !insertmacro MUI_PAGE_WELCOME | |
| !insertmacro MUI_PAGE_LICENSE "data\obs-studio\license\gplv2.txt" | |
| !insertmacro MUI_PAGE_DIRECTORY | |
| !insertmacro MUI_PAGE_INSTFILES | |
| !insertmacro MUI_PAGE_FINISH | |
| !define MUI_COMPONENTSPAGE_TEXT_TOP "Check the components you want to uninstall. Keeping Settings unchecked is recommended." | |
| !define MUI_COMPONENTSPAGE_TEXT_COMPLIST "Select components:" | |
| ;!insertmacro MUI_UNPAGE_CONFIRM | |
| !insertmacro MUI_UNPAGE_COMPONENTS | |
| !insertmacro MUI_UNPAGE_INSTFILES | |
| ; Set languages (first is default language) | |
| !insertmacro MUI_LANGUAGE "SimpChinese" | |
| !insertmacro MUI_RESERVEFILE_LANGDLL | |
| Function .onInit | |
| Push $R0 | |
| ReadRegStr $R0 HKLM "Software\${APPNAME}" "" | |
| StrCmp $R0 "" 0 MUST_UNINSTALL | |
| Return | |
| ; StrCpy $R0 "1" | |
| MUST_UNINSTALL: | |
| ; StrCpy $MyDllPath "请先卸载 ${APPNAME} $MyDllPath/Golive-Capture\screen-capture-gby-x64.dll" | |
| ; MessageBox MB_OK|MB_ICONSTOP "请先卸载 ${APPNAME} $MyDllPath/Golive-Capture\screen-capture-gby-x64.dll" | |
| UnRegDLL "$R0/Golive-Capture\screen-capture-recorder.dll" | |
| UnRegDLL "$R0/Golive-Capture\screen-capture-recorder-x64.dll" | |
| UnRegDLL "$R0/Golive-Capture\screen-capture-gby-x64.dll" | |
| FunctionEnd | |
| Function PreReqCheck | |
| ${IfNot} ${RunningX64} | |
| MessageBox MB_OK|MB_ICONSTOP "${APPNAME} is not compatible with your operating system's architecture." | |
| Quit | |
| ${EndIf} | |
| ; Abort on 8.1 or lower | |
| ${IfNot} ${AtLeastWin10} | |
| MessageBox MB_OK|MB_ICONSTOP "${APPNAME} requires Windows 10 or higher and cannot be installed on this version of Windows." | |
| Quit | |
| ${EndIf} | |
| ; DirectX Version Check | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_33.dll" $R0 $R1 | |
| IfErrors dxMissing33 dxOK | |
| dxMissing33: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_34.dll" $R0 $R1 | |
| IfErrors dxMissing34 dxOK | |
| dxMissing34: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_35.dll" $R0 $R1 | |
| IfErrors dxMissing35 dxOK | |
| dxMissing35: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_36.dll" $R0 $R1 | |
| IfErrors dxMissing36 dxOK | |
| dxMissing36: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_37.dll" $R0 $R1 | |
| IfErrors dxMissing37 dxOK | |
| dxMissing37: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_38.dll" $R0 $R1 | |
| IfErrors dxMissing38 dxOK | |
| dxMissing38: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_39.dll" $R0 $R1 | |
| IfErrors dxMissing39 dxOK | |
| dxMissing39: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_40.dll" $R0 $R1 | |
| IfErrors dxMissing40 dxOK | |
| dxMissing40: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_41.dll" $R0 $R1 | |
| IfErrors dxMissing41 dxOK | |
| dxMissing41: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_42.dll" $R0 $R1 | |
| IfErrors dxMissing42 dxOK | |
| dxMissing42: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_43.dll" $R0 $R1 | |
| IfErrors dxMissing43 dxOK | |
| dxMissing43: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_47.dll" $R0 $R1 | |
| IfErrors dxMissing47 dxOK | |
| dxMissing47: | |
| ClearErrors | |
| GetDLLVersion "D3DCompiler_49.dll" $R0 $R1 | |
| IfErrors dxMissing49 dxOK | |
| dxMissing49: | |
| IfSilent +1 +3 | |
| SetErrorLevel 4 | |
| Quit | |
| MessageBox MB_YESNO|MB_ICONEXCLAMATION "Your system is missing DirectX components that ${APPNAME} requires. Would you like to download them?" IDYES dxtrue IDNO dxfalse | |
| dxtrue: | |
| ExecShell "open" "https://obsproject.com/go/dxwebsetup" | |
| dxfalse: | |
| Quit | |
| dxOK: | |
| ClearErrors | |
| ; Check previous instance | |
| ${if} ${RunningX64} | |
| check64BitRunning: | |
| OBSInstallerUtils::IsProcessRunning "obs64.exe" | |
| IntCmp $R0 1 0 notRunning2 | |
| IfSilent +1 +3 | |
| SetErrorLevel 5 | |
| Quit | |
| MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDCANCEL IDRETRY check64BitRunning | |
| Quit | |
| notRunning2: | |
| ${endif} | |
| FunctionEnd | |
| Var dllFilesInUse | |
| Function checkDLLs | |
| OBSInstallerUtils::ResetInUseFileChecks | |
| OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\bin\64bit\avutil-57.dll" | |
| OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\bin\64bit\swscale-6.dll" | |
| OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook64.dll" | |
| OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll" | |
| OBSInstallerUtils::AddInUseFileCheck "$APPDATA\obs-studio-hook\graphics-hook64.dll" | |
| OBSInstallerUtils::GetAppNameForInUseFiles | |
| StrCpy $dllFilesInUse "$R0" | |
| FunctionEnd | |
| Function checkFilesInUse | |
| retryFileChecks: | |
| Call checkDLLs | |
| StrCmp $dllFilesInUse "" dllsNotInUse | |
| IfSilent +1 +3 | |
| SetErrorLevel 6 | |
| Quit | |
| MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "Golive files are being used by the following applications:$\r$\n$\r$\n$dllFilesInUse$\r$\nPlease close these applications to continue setup." /SD IDCANCEL IDRETRY retryFileChecks | |
| Quit | |
| dllsNotInUse: | |
| FunctionEnd | |
| Function LaunchGolive | |
| Exec '"$WINDIR\explorer.exe" "$SMPROGRAMS\Golive Studio\Golive Studio (64bit).lnk"' | |
| FunctionEnd | |
| Section "Golive Studio" SecCore | |
| SetShellVarContext all | |
| Call checkFilesInUse | |
| ; Set Section properties | |
| SectionIn RO | |
| SetOverwrite on | |
| AllowSkipFiles off | |
| ; Set Section Files and Shortcuts | |
| SetOutPath "$INSTDIR" | |
| File /r "data" | |
| SetOutPath "$INSTDIR\bin" | |
| File /r "bin\64bit" | |
| SetOutPath "$INSTDIR\obs-plugins" | |
| File /r "obs-plugins\64bit" | |
| SetOutPath "$INSTDIR" | |
| File /r "Golive-Capture" | |
| ; Exec 'regsvr32.exe /s "$INSTDIR\Golive-Capture\screen-capture-recorder.dll"' | |
| Exec 'regsvr32.exe /s "$INSTDIR\Golive-Capture\screen-capture-gby-x64.dll"' | |
| !ifdef INSTALL64 | |
| ;; 64 bit Visual Studio 2019 runtime check | |
| ; ClearErrors | |
| ; SetOutPath "$PLUGINSDIR" | |
| ; File check_for_64bit_visual_studio_2019_runtimes.exe | |
| ; ExecWait "$PLUGINSDIR\check_for_64bit_visual_studio_2019_runtimes.exe" $R0 | |
| ; Delete "$PLUGINSDIR\check_for_64bit_visual_studio_2019_runtimes.exe" | |
| ; IntCmp $R0 126 vs2019Missing_64 vs2019OK_64 | |
| ; vs2019Missing_64: | |
| ; File VC_redist.x64.exe | |
| ; ExecWait '"$PLUGINSDIR\VC_redist.x64.exe" /quiet /norestart' | |
| ; Delete "$PLUGINSDIR\VC_redist.x64.exe" | |
| ; vs2019OK_64: | |
| ; ClearErrors | |
| !else | |
| !endif | |
| # ---------------------------- | |
| SetShellVarContext all | |
| # ---------------------------- | |
| # Copy game capture files to ProgramData | |
| SetOutPath "$APPDATA\golive-studio-hook" | |
| File "data\obs-plugins\win-capture\graphics-hook64.dll" | |
| File "data\obs-plugins\win-capture\obs-vulkan64.json" | |
| OBSInstallerUtils::AddAllApplicationPackages "$APPDATA\golive-studio-hook" | |
| WriteUninstaller "$INSTDIR\uninstall.exe" | |
| SetOutPath "$INSTDIR\bin\64bit" | |
| CreateShortCut "$DESKTOP\Golive Studio.lnk" "$INSTDIR\bin\64bit\obs64.exe" | |
| CreateDirectory "$SMPROGRAMS\Golive Studio" | |
| SetOutPath "$INSTDIR\bin\64bit" | |
| CreateShortCut "$SMPROGRAMS\Golive Studio\Golive Studio (64bit).lnk" "$INSTDIR\bin\64bit\obs64.exe" | |
| CreateShortCut "$SMPROGRAMS\Golive Studio\Uninstall.lnk" "$INSTDIR\uninstall.exe" | |
| SectionEnd | |
| Section -FinishSection | |
| SetShellVarContext all | |
| # --------------------------------------- | |
| # 64bit vulkan hook registry stuff | |
| ${if} ${RunningX64} | |
| SetRegView 64 | |
| WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR" | |
| ClearErrors | |
| DeleteRegValue HKCU "Software\Khronos\Vulkan\ImplicitLayers" "$APPDATA\golive-studio-hook\obs-vulkan64.json" | |
| ClearErrors | |
| WriteRegDWORD HKLM "Software\Khronos\Vulkan\ImplicitLayers" "$APPDATA\golive-studio-hook\obs-vulkan64.json" 0 | |
| ${endif} | |
| ${if} ${RunningX64} | |
| Exec '"$SYSDIR\regsvr32.exe" /s "$INSTDIR\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll"' | |
| ${endif} | |
| # --------------------------------------- | |
| ClearErrors | |
| SetRegView default | |
| WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "ProductID" "d16d2409-3151-4331-a9b1-dfd8cf3f0d9c" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\bin\64bit\obs64.exe" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "Golive Project" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "https://www.eagleplan.fun" | |
| WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${APPVERSION}" | |
| WriteRegStr HKCU "SOFTWARE\screen-capture-gby" "cap_program" "$INSTDIR\Golive-Capture\SCRM.exe" | |
| WriteRegStr HKCU "SOFTWARE\screen-capture-gby" "img_filename" "$INSTDIR\Golive-Capture\1.bmp" | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "is_load_cap_program" 1 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "show_img" 1 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "param_set" 0 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "default_max_fps" 15 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "capture_border" 0x03 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "capture_height" 0x01c2 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "capture_width" 0x0320 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "is_load_cap_program" 0x1 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "open_cam" 0x1 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "screen_scale" 0x64 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "show_capture" 0x1 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "start_x" 0x40 | |
| WriteRegDWORD HKCU "SOFTWARE\screen-capture-gby" "start_y" 0x40 | |
| SectionEnd | |
| ; Modern install component descriptions | |
| !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN | |
| !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Core Golive Studio files" | |
| !insertmacro MUI_FUNCTION_DESCRIPTION_END | |
| ;Uninstall section | |
| Section "un.${APPNAME} App Files" UninstallSection1 | |
| SectionIn RO | |
| ; Remove hook files and vulkan registry | |
| SetShellVarContext all | |
| RMDir /r "$APPDATA\golive-studio-hook" | |
| ${if} ${RunningX64} | |
| SetRegView 64 | |
| DeleteRegValue HKCU "Software\Khronos\Vulkan\ImplicitLayers" "$APPDATA\obs-studio-hook\obs-vulkan64.json" | |
| DeleteRegValue HKLM "Software\Khronos\Vulkan\ImplicitLayers" "$APPDATA\obs-studio-hook\obs-vulkan64.json" | |
| ${endif} | |
| SetRegView default | |
| SetShellVarContext current | |
| ClearErrors | |
| ; Unregister virtual camera dlls | |
| ${if} ${RunningX64} | |
| Exec '"$SYSDIR\regsvr32.exe" /u /s "$INSTDIR\data\obs-plugins\win-dshow\obs-virtualcam-module64.dll"' | |
| ${endif} | |
| ; Remove from registry... | |
| DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" | |
| DeleteRegKey HKLM "SOFTWARE\${APPNAME}" | |
| DeleteRegKey HKCU "SOFTWARE\screen-capture-gby" | |
| ; Delete self | |
| Delete "$INSTDIR\uninstall.exe" | |
| ; Delete Shortcuts | |
| SetShellVarContext all | |
| Delete "$DESKTOP\Golive Studio.lnk" | |
| Delete "$SMPROGRAMS\Golive Studio\Uninstall.lnk" | |
| ${if} ${RunningX64} | |
| Delete "$SMPROGRAMS\Golive Studio\Golive Studio (64bit).lnk" | |
| ${endif} | |
| SetShellVarContext current | |
| # intel real sence camera: disabled by default | |
| IfFileExists "$INSTDIR\data\obs-plugins\win-ivcam\seg_service.exe" UnregisterSegService SkipUnreg | |
| UnregisterSegService: | |
| ExecWait '"$INSTDIR\data\obs-plugins\win-ivcam\seg_service.exe" /UnregServer' | |
| SkipUnreg: | |
| ; Clean up OBS Studio | |
| RMDir /r "$INSTDIR\bin" | |
| RMDir /r "$INSTDIR\data" | |
| RMDir /r "$INSTDIR\obs-plugins" | |
| ; Exec 'regsvr32.exe /s /u "$INSTDIR\Golive-Capture\screen-capture-recorder.dll"' | |
| Exec 'regsvr32.exe /u /s "$INSTDIR\Golive-Capture\screen-capture-gby-x64.dll"' | |
| RMDir /r "$INSTDIR\Golive-Capture" | |
| RMDir "$INSTDIR" | |
| ; Remove remaining directories | |
| RMDir "$SMPROGRAMS\Golive Studio" | |
| RMDir "$INSTDIR\Golive Studio" | |
| SectionEnd | |
| Section /o "un.Settings, Scenes, etc." UninstallSection2 | |
| RMDir /r "$APPDATA\golive-studio" | |
| SectionEnd | |
| !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN | |
| !insertmacro MUI_DESCRIPTION_TEXT ${UninstallSection1} "Remove the golive program files." | |
| !insertmacro MUI_DESCRIPTION_TEXT ${UninstallSection2} "Removes all settings, scenes, sources, profiles, log files, and other application data.$\r$\n$\r$\nTHIS CANNOT BE UNDONE." | |
| !insertmacro MUI_UNFUNCTION_DESCRIPTION_END | |
| ; Version information | |
| VIProductVersion "${APPVERSION}.0" | |
| VIAddVersionKey "ProductName" "${APPNAME}" | |
| VIAddVersionKey "CompanyName" "Golive" | |
| VIAddVersionKey "LegalCopyright" "(C) 2012-2023" | |
| ; FileDescription is what shows in the UAC elevation prompt when signed | |
| VIAddVersionKey "FileDescription" "${APPNAME} Installer" | |
| VIAddVersionKey "FileVersion" "${APPVERSION}" | |
| ; eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment