Browse Source

UI: Add latest installer fixes from R1CH

Uses a custom library for checking whether game capture is active and
for killing stray obs processes
jp9000 8 years ago
parent
commit
10a28cd1d2
1 changed files with 14 additions and 6 deletions
  1. 14 6
      UI/installer/mp-installer.nsi

+ 14 - 6
UI/installer/mp-installer.nsi

@@ -167,19 +167,28 @@ Function PreReqCheck
 	ClearErrors
 	ClearErrors
 
 
 	; Check previous instance
 	; Check previous instance
-	FindProcDLL::FindProc "obs32.exe"
+
+	OBSInstallerUtils::IsProcessRunning "obs32.exe"
 	IntCmp $R0 1 0 notRunning1
 	IntCmp $R0 1 0 notRunning1
 		MessageBox MB_OK|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDOK
 		MessageBox MB_OK|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDOK
 		Quit
 		Quit
 	notRunning1:
 	notRunning1:
+
 	${if} ${RunningX64}
 	${if} ${RunningX64}
-		FindProcDLL::FindProc "obs64.exe"
+		OBSInstallerUtils::IsProcessRunning "obs64.exe"
 		IntCmp $R0 1 0 notRunning2
 		IntCmp $R0 1 0 notRunning2
 			MessageBox MB_OK|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDOK
 			MessageBox MB_OK|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDOK
 			Quit
 			Quit
+		notRunning2:
 	${endif}
 	${endif}
-	notRunning2:
 
 
+	OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook32.dll"
+	OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook64.dll"
+	OBSInstallerUtils::GetAppNameForInUseFiles
+	StrCmp $R0 "" gameCaptureNotRunning
+		MessageBox MB_OK|MB_ICONEXCLAMATION "Game Capture is still in use by the following applications:$\r$\n$\r$\n$R0$\r$\nPlease close these applications before installing a new version of OBS." /SD IDOK
+		Quit
+	gameCaptureNotRunning:
 FunctionEnd
 FunctionEnd
 
 
 Function filesInUse
 Function filesInUse
@@ -195,9 +204,6 @@ Section "OBS Studio" SecCore
 	SetOverwrite on
 	SetOverwrite on
 	AllowSkipFiles off
 	AllowSkipFiles off
 
 
-	KillProcDLL::KillProc "obs-plugins\32bit\cef-bootstrap.exe"
-	KillProcDLL::KillProc "obs-plugins\64bit\cef-bootstrap.exe"
-
 	SetShellVarContext all
 	SetShellVarContext all
 
 
 	; Set Section Files and Shortcuts
 	; Set Section Files and Shortcuts
@@ -264,9 +270,11 @@ SectionGroup /e "Plugins" SecPlugins
 		SetShellVarContext all
 		SetShellVarContext all
 
 
 		SetOutPath "$INSTDIR\obs-plugins"
 		SetOutPath "$INSTDIR\obs-plugins"
+		OBSInstallerUtils::KillProcess "32bit\cef-bootstrap.exe"
 		File /r "new\obs-browser\obs-plugins\32bit"
 		File /r "new\obs-browser\obs-plugins\32bit"
 
 
 		${if} ${RunningX64}
 		${if} ${RunningX64}
+			OBSInstallerUtils::KillProcess "64bit\cef-bootstrap.exe"
 			File /r "new\obs-browser\obs-plugins\64bit"
 			File /r "new\obs-browser\obs-plugins\64bit"
 		${endif}
 		${endif}