FS check, CV2.DLL fix, cleanup

- Only install on NTFS (FAT installations fail)
- Ask the user to install the Media Feature Pack on Windows 10 N (fixes python cv2 errors)
- Code cleanup
This commit is contained in:
JeLuF 2022-11-08 00:20:36 +01:00 committed by GitHub
parent 9b89ede9c4
commit bd5a6e6fb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,9 +17,7 @@ Unicode True
Var Dialog Var Dialog
Var Label Var Label
Var Text Var Button
Var V14
Var V15
Var InstDirLen Var InstDirLen
Var LongPathsEnabled Var LongPathsEnabled
@ -102,14 +100,38 @@ Function DirectoryLeave
has $R0 space character$R1.$\nPlease choose an installation directory without space characters." has $R0 space character$R1.$\nPlease choose an installation directory without space characters."
Abort Abort
${EndIf} ${EndIf}
; Check for NTFS filesystem. Installations on FAT fail.
; -----------------------------------------------------
StrCpy $5 $INSTDIR 3
System::Call 'Kernel32::GetVolumeInformation(t "$5",t,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r1,i ${NSIS_MAX_STRLEN})i.r0'
${If} $0 <> 0
${AndIf} $1 == "NTFS"
MessageBox mb_ok "$5 has filesystem type '$1'.$\nOnly NTFS filesystems are supported.$\nPlease choose a different drive."
Abort
${EndIf}
FunctionEnd FunctionEnd
;---------------------------------------------------------------------------------------------------------
; This function is currently not being used. To be used in the future for the v1.4 vs v1.5 chooser
Function nsDialogsPage
!insertmacro MUI_HEADER_TEXT "Default Stable diffusion model" "Select the default model to be installed"
;---------------------------------------------------------------------------------------------------------
; Open the MS download page in a browser and enable the [Next] button
Function MSMediaFeaturepack
ExecShell "open" "https://www.microsoft.com/en-us/software-download/mediafeaturepack"
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 1
FunctionEnd
;---------------------------------------------------------------------------------------------------------
; Install the MS Media Feature Pack, if it is missing (e.g. on Windows 10 N)
Function MediaPackDialog
!insertmacro MUI_HEADER_TEXT "Windows Media Feature Pack" "Required software module is missing"
; Skip this dialog if mf.dll is installed
${If} ${FileExists} "$WINDIR\system32\mf.dll"
Abort
${EndIf}
nsDialogs::Create 1018 nsDialogs::Create 1018
Pop $Dialog Pop $Dialog
@ -117,16 +139,17 @@ Function nsDialogsPage
${If} $Dialog == error ${If} $Dialog == error
Abort Abort
${EndIf} ${EndIf}
${NSD_CreateLabel} 0 0 100% 48u "Which Stable Diffusion Modell do you want to use?$\r$\n$\r$\nThere are two models of Stable Diffusion.$\r$\n- Version 1.4 is using less memory.$\r$\n- Version 1.5 is bigger, but has slightly better results." ${NSD_CreateLabel} 0 0 100% 48u "The Windows Media Feature Pack is missing on this computer. It is required for the Stable Diffusion UI.$\nYou can continue the installation after installing the Windows Media Feature Pack."
Pop $Label Pop $Label
${NSD_CreateFirstRadioButton} 0 49u 100% 12u "Use SD v1.4 as default (3.97 GB)" ${NSD_CreateButton} 10% 49u 80% 12u "Download Meda Feature Pack from Microsoft"
Pop $V14 Pop $Button
${NSD_CreateAdditionalRadioButton} 0 62u 100% 12u "Use SD v1.5 as default (4.7 GB)"
Pop $V15
GetFunctionAddress $0 MSMediaFeaturePack
nsDialogs::OnClick $Button $0
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0
nsDialogs::Show nsDialogs::Show
FunctionEnd FunctionEnd
@ -142,6 +165,8 @@ FunctionEnd
!define MUI_WELCOMEPAGE_TEXT "This installer will guide you through the installation of Stable Diffusion UI.$\n$\n\ !define MUI_WELCOMEPAGE_TEXT "This installer will guide you through the installation of Stable Diffusion UI.$\n$\n\
Click Next to continue." Click Next to continue."
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
Page custom MediaPackDialog
; License page ; License page
!insertmacro MUI_PAGE_LICENSE "..\LICENSE" !insertmacro MUI_PAGE_LICENSE "..\LICENSE"
!insertmacro MUI_PAGE_LICENSE "..\CreativeML Open RAIL-M License" !insertmacro MUI_PAGE_LICENSE "..\CreativeML Open RAIL-M License"
@ -149,12 +174,6 @@ Click Next to continue."
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "DirectoryLeave" !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "DirectoryLeave"
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
;; TODO: Requires support from "Start Stable Diffusion UI.cmd" and "server.py"
;; which needs to be developed first
; --------
;Page custom nsDialogsPage
; --------
; Instfiles page ; Instfiles page
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
@ -186,6 +205,7 @@ Section "MainSection" SEC01
File "..\scripts\bootstrap.bat" File "..\scripts\bootstrap.bat"
File "..\scripts\install_status.txt" File "..\scripts\install_status.txt"
File "..\scripts\on_env_start.bat" File "..\scripts\on_env_start.bat"
File "C:\windows\system32\curl.exe"
CreateDirectory "$INSTDIR\profile" CreateDirectory "$INSTDIR\profile"
CreateDirectory "$SMPROGRAMS\Stable Diffusion UI" CreateDirectory "$SMPROGRAMS\Stable Diffusion UI"
CreateShortCut "$SMPROGRAMS\Stable Diffusion UI\Start Stable Diffusion UI.lnk" "$INSTDIR\Start Stable Diffusion UI.cmd" CreateShortCut "$SMPROGRAMS\Stable Diffusion UI\Start Stable Diffusion UI.lnk" "$INSTDIR\Start Stable Diffusion UI.cmd"