diff --git a/portables/win/NSIS/Plugins/amd64-unicode/INetC.dll b/portables/win/NSIS/Plugins/amd64-unicode/INetC.dll new file mode 100644 index 00000000..2427cfd4 Binary files /dev/null and b/portables/win/NSIS/Plugins/amd64-unicode/INetC.dll differ diff --git a/portables/win/NSIS/Plugins/x64-ansi/ExecDos.dll b/portables/win/NSIS/Plugins/x64-ansi/ExecDos.dll new file mode 100644 index 00000000..61643098 Binary files /dev/null and b/portables/win/NSIS/Plugins/x64-ansi/ExecDos.dll differ diff --git a/portables/win/NSIS/Plugins/x64-unicode/ExecDos.dll b/portables/win/NSIS/Plugins/x64-unicode/ExecDos.dll new file mode 100644 index 00000000..f47c0d0a Binary files /dev/null and b/portables/win/NSIS/Plugins/x64-unicode/ExecDos.dll differ diff --git a/portables/win/NSIS/Plugins/x86-ansi/ExecDos.dll b/portables/win/NSIS/Plugins/x86-ansi/ExecDos.dll new file mode 100644 index 00000000..0d8a871a Binary files /dev/null and b/portables/win/NSIS/Plugins/x86-ansi/ExecDos.dll differ diff --git a/portables/win/NSIS/Plugins/x86-ansi/INetC.dll b/portables/win/NSIS/Plugins/x86-ansi/INetC.dll new file mode 100644 index 00000000..d01dc48a Binary files /dev/null and b/portables/win/NSIS/Plugins/x86-ansi/INetC.dll differ diff --git a/portables/win/NSIS/Plugins/x86-unicode/ExecDos.dll b/portables/win/NSIS/Plugins/x86-unicode/ExecDos.dll new file mode 100644 index 00000000..d6b7ab02 Binary files /dev/null and b/portables/win/NSIS/Plugins/x86-unicode/ExecDos.dll differ diff --git a/portables/win/NSIS/Plugins/x86-unicode/INetC.dll b/portables/win/NSIS/Plugins/x86-unicode/INetC.dll new file mode 100644 index 00000000..d867f8c2 Binary files /dev/null and b/portables/win/NSIS/Plugins/x86-unicode/INetC.dll differ diff --git a/scripts/win/Install_scripts/XsollaInstaller.nsi b/scripts/win/Install_scripts/XsollaInstaller.nsi index 00cceb86..dd97b4fe 100644 --- a/scripts/win/Install_scripts/XsollaInstaller.nsi +++ b/scripts/win/Install_scripts/XsollaInstaller.nsi @@ -49,6 +49,8 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show +Var launcherAlreadyExists + Function .onInit !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd @@ -79,6 +81,7 @@ FunctionEnd Function DirectoryLeave ${If} ${FileExists} "$InstDir\launcher.exe" + StrCpy $launcherAlreadyExists "TRUE" Return ${EndIf} @@ -107,8 +110,9 @@ FunctionEnd Section "-MainSection" SEC01 SetOutPath "$INSTDIR" - ExecWait '"cmd.exe" /C icacls "$INSTDIR" /grant:r %userdomain%\%username%:f /t /c' - + ${If} $launcherAlreadyExists != "TRUE" ; assume this command was executed with previous install, or even in silent mode CMD window appears. + ExecWait '"cmd.exe" /C icacls "$INSTDIR" /grant:r %userdomain%\%username%:f /t /c' + ${EndIf} SetOverwrite ifnewer File /r "data" File /r "fonts" diff --git a/scripts/win/Install_scripts/XsollaWebInstaller.nsi b/scripts/win/Install_scripts/XsollaWebInstaller.nsi new file mode 100644 index 00000000..f612f9ae --- /dev/null +++ b/scripts/win/Install_scripts/XsollaWebInstaller.nsi @@ -0,0 +1,189 @@ +!define PRODUCT_NAME "Xsolla_launcher" ;Launcher name in the Start menu. The value must be duplicated in the "product_name" parameter in the launcher/win/config.json file. +!define PRODUCT_PUBLISHER "Xsolla" +!define PRODUCT_VERSION "" ;Version shown in the Launcher installer window. +!define PRODUCT_WEB_SITE "xsolla.com" ;Game URL opened from the shortcut in the Start menu. +!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}" +!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +!define PRODUCT_UNINST_ROOT_KEY "HKLM" +!define LAUNCHER_REGKEY "${PRODUCT_NAME}_XsollaLauncher" + +!define EXE_FILE_NAME "Xsolla_Launcher.exe" ; Name of temporary downloaded file. +!define BIG_LAUNCHER_URL "PUT URL HERE" +;-------------------------------- +; General Attributes +Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" +OutFile "bin\Xsolla_Launcher_web_installer.exe" ; Launcher installer name. +InstallDir "$LOCALAPPDATA\${PRODUCT_NAME}" ; Default directory for Launcher installation. +InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" +ShowInstDetails show +ShowUnInstDetails show +RequestExecutionLevel admin +SpaceTexts none ; We dont know how much disk space big installer requires. Otherwise, 0.0 KB will be displayed on directory page. + +!include LogicLib.nsh ; Ability to use simple if +;-------------------------------- +; MUI Settings +; Macrs for putting image into header +!macro BIMAGE IMAGE PARMS + Push $0 + GetTempFileName $0 + File /oname=$0 "${IMAGE}" + SetBrandingImage ${PARMS} $0 + Delete $0 + Pop $0 +!macroend + +AddBrandingImage top 200 50 +!include "MUI2.nsh" +!define MUI_ABORTWARNING +!define MUI_ICON "launcherIcon.ico" +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" + +; Note: all images has to be in installer_images folder. installer_images folder is right next to this file. All images has to be saved as .bmp. +; !define MUI_HEADERIMAGE ; Uncomment this lane if you want to customize header images on Directory and InstallFiles pages. +; Also, you need to uncomment following functions in order to change default images: DirectoryPageShow and InstPageShow +; !define MUI_WELCOMEFINISHPAGE_BITMAP "finish_image.bmp" ; Uncomment this line if you want to customize image on finish page. Unlike Directoty and Install pages, Finish page don't need additional function. Image has to be 164x314 px to fit without resize. +!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" +!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" +!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" + +; Directory page +!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryPageShow +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "DirectoryLeave" +!insertmacro MUI_PAGE_DIRECTORY +; Instfiles page +!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstPageShow +!insertmacro MUI_PAGE_INSTFILES +; Finish page +!define MUI_FINISHPAGE_RUN "$INSTDIR\launcher.exe" +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Installer Sections +Section ; InstallSection + ; Disale detail log to clear space for download progressbar + ; Downoad big launcher + ; /resume allows an user to restart the download if it was interrupted + DetailPrint "Download launcher files..." + SetDetailsView hide + inetc::get /resume "" /caption "Download launcher files..." "${BIG_LAUNCHER_URL}" "$TEMP\${EXE_FILE_NAME}" /end + ; Get download status + Pop $0 # "OK" means OK + SetDetailsView show + SetDetailsPrint both + DetailPrint "Launcher files download completed" + + ;MessageBox MB_OK "Download Status: $0" ; test + ${If} $0 == "Cancelled" ; User did cancel setup + DetailPrint "Install is cancelled." + goto fail + ${EndIf} + ${If} $0 != "OK" ; If download error happened + DetailPrint "Install error: download finished with an error: $0" + goto fail + ${Else} ; No error, good to go + DetailPrint "Unpacking launcher files..." + ${If} ${FileExists} "$TEMP\${EXE_FILE_NAME}" ; Even if we dont have a download error make sure the file exists + ExecDos::exec /detailed "$TEMP\${EXE_FILE_NAME} /S /D=$INSTDIR" ; Exec a big installer and get its stdout to our details field. But I didn't find a way to make the big installer write details to stdout instead details field. And now I'm making out my own messages. Maybe sometime we will solve this issue. + ; /S - silence mode + ; /D - default install directory. The user cannot to change it because installer runs in silence mode. + Pop $0 # The big installer's exit code. + ${If} $0 != 0 + ${If} $0 = 2 ; Code 2 is easy, it means user doesn't have enough disk space. + DetailPrint "Install error. Please, check if you have enough free space on your disk. " + ${Else} + DetailPrint "Install error: could not to unpack launcher files, error code: $0" + ${EndIf} + goto fail + ${EndIf} + ${Else} + DetailPrint "Install error: could not to find launcher archive." + ${EndIf} + ${EndIf} + + SetOutPath "$INSTDIR" ; We have to set OutPath to instdir or launcher will crash on start from finish page + goto success + fail: + Call CleanTempExe + Abort + success: + Call CleanTempExe +SectionEnd + +;-------------------------------- +; Installer Functions + +Function .onInit + !insertmacro MUI_LANGDLL_DISPLAY +FunctionEnd + +;-------------------------------- +; Page Functions + +Function DirectoryPageShow +; !ifdef MUI_HEADERIMAGE +; !insertmacro BIMAGE "directory_page_header.bmp" "" ; The image must be 57 pixels high. The image width can be different. The page header has default text, and if you want to display it, the image must be 150 pixels wide or less. If you want to hide the default text behind the image, its width must be exactly 497 pixels. +; !endif +FunctionEnd + +Function InstPageShow +; !ifdef MUI_HEADERIMAGE +; !insertmacro BIMAGE "install_page_header.bmp" "" ; Same rules as on Directory page. If you use custom header image in Directory page, you have to uncomment this function too. Otherwise, old header image wont repaint and will be oberlaped by text from Install page. It's ungly (example: https://prnt.sc/uut8xp). +; !endif +FunctionEnd + +;-------------------------------- +; User Functions + +; If we use big installer in silent mode, it doesn't check if INSTDIR is empty. We need to do it here. +Function isEmptyDir + Exch $0 + Push $1 + FindFirst $0 $1 "$0\*.*" + strcmp $1 "." 0 _notempty + FindNext $0 $1 + strcmp $1 ".." 0 _notempty + ClearErrors + FindNext $0 $1 + IfErrors 0 _notempty + FindClose $0 + Pop $1 + StrCpy $0 1 + Exch $0 + goto _end + _notempty: + FindClose $0 + ClearErrors + Pop $1 + StrCpy $0 0 + Exch $0 + _end: +FunctionEnd + +Function DirectoryLeave + ${If} ${FileExists} "$InstDir\launcher.exe" + Return + ${EndIf} + + Push $InstDir + Call isEmptyDir + Pop $0 + + ${If} $0 == 1 + Return + ${Else} + ${If} ${FileExists} "$InstDir" + MessageBox MB_OK `"$InstDir" is not empty. Choose another directory` + Abort + ${EndIf} + ${EndIf} +FunctionEnd + +Function CleanTempExe + ${If} ${FileExists} "$TEMP\${EXE_FILE_NAME}" + SetDetailsPrint none ; Don't scarry the user with a delete file message + Delete "$TEMP\${EXE_FILE_NAME}" + ${EndIf} +FunctionEnd \ No newline at end of file diff --git a/scripts/win/Install_scripts/installer_images/directory_page_header.bmp b/scripts/win/Install_scripts/installer_images/directory_page_header.bmp new file mode 100644 index 00000000..f35434f6 Binary files /dev/null and b/scripts/win/Install_scripts/installer_images/directory_page_header.bmp differ diff --git a/scripts/win/Install_scripts/installer_images/finish_image.bmp b/scripts/win/Install_scripts/installer_images/finish_image.bmp new file mode 100644 index 00000000..5524eef9 Binary files /dev/null and b/scripts/win/Install_scripts/installer_images/finish_image.bmp differ diff --git a/scripts/win/Install_scripts/installer_images/install_page_header.bmp b/scripts/win/Install_scripts/installer_images/install_page_header.bmp new file mode 100644 index 00000000..f35434f6 Binary files /dev/null and b/scripts/win/Install_scripts/installer_images/install_page_header.bmp differ diff --git a/scripts/win/deploy.bat b/scripts/win/deploy.bat index 759ade57..f33f1275 100644 --- a/scripts/win/deploy.bat +++ b/scripts/win/deploy.bat @@ -5,6 +5,9 @@ SET BUILD_PATH=..\..\launcher\win SET ARCHIVER_PATH=..\..\portables\win\7zip SET NSIS_PATH=..\..\portables\win\NSIS SET SCRIPTS_PATH=..\win\Install_scripts +SET SKIP_BIG_INSTALLER=FALSE +SET SKIP_WEB_INSTALLER=FALSE +SET ASK_TO_CONTINUE_WEB_INSTALLER=TRUE SET NEED_OUT="" @@ -106,20 +109,34 @@ XCOPY "%BUILD_PATH%" "%TARGET_PATH%" /E /R ECHO * Create deploy archive "%ARCHIVER_PATH%\7za.exe" a -t7z "%TARGET_PATH%\bin\XsollaLauncher.7z" "%TARGET_PATH%\." -mx=9 -m0=lzma - ECHO * Copying installer's stuff COPY %BUILD_PATH%\launcherIcon.ico "%TARGET_PATH%" COPY %SCRIPTS_PATH%\XsollaInstaller.nsi "%TARGET_PATH%" +XCOPY %SCRIPTS_PATH%\installer_images "%TARGET_PATH%" COPY %BUILD_PATH%\qwebchannel.js "%TARGET_PATH%" - + +pushd %SCRIPTS_PATH% +SET ABS_SCRIPTS_PATH=%CD% +popd pushd %NSIS_PATH% SET NSIS_PATH=%CD% popd ECHO * Creating installer CD "%TARGET_PATH%" -"%NSIS_PATH%\makensis.exe" XsollaInstaller.nsi + +if "%SKIP_BIG_INSTALLER%" == "FALSE" ( + "%NSIS_PATH%\makensis.exe" XsollaInstaller.nsi +) + +if "%SKIP_WEB_INSTALLER%" == "FALSE" ( + if "%ASK_TO_CONTINUE_WEB_INSTALLER%" == "TRUE" ( + SET /P _=Before make WebInstaller you have to upload big installer to any cdn and put URL link to XsollaWebInstaller.nsi line 11. Press ENTER if you did that already to continue. + ) + COPY %ABS_SCRIPTS_PATH%\XsollaWebInstaller.nsi %CD% + "%NSIS_PATH%\makensis.exe" XsollaWebInstaller.nsi +) For /F "tokens=*" %%F In ('Dir %CD% /A:-D /B') Do ( If /I Not "%%F"=="bin" (Del /F /Q "%CD%\%%F")