diff --git a/Pages/page_download_files.nsi b/Pages/page_download_files.nsi index 771b8bd..d31a8bc 100644 --- a/Pages/page_download_files.nsi +++ b/Pages/page_download_files.nsi @@ -23,10 +23,10 @@ diamond_download: Goto after_download ee_download: - inetc::get /CAPTION "Downloading Sinfar EE Launcher" /POPUP "Sinfarx launcher" /QUESTION "" "https://nwn.sinfar.net/files/sinfarx_ee.exe" "$INSTPATH\sinfarx.exe" - Pop $0 - StrCmp $0 "OK" +2 - Goto download_failed + ; inetc::get /CAPTION "Downloading Sinfar EE Launcher" /POPUP "Sinfarx launcher" /QUESTION "" "https://nwn.sinfar.net/files/sinfarx/8181/win32_8181.zip" "$EE_EXEPATH\sinfarLauncher.zip" + ; Pop $0 + ; StrCmp $0 "OK" +2 + ; Goto download_failed after_download: diff --git a/Pages/page_game_selection.nsi b/Pages/page_game_selection.nsi index 7a01f92..ce63aff 100644 --- a/Pages/page_game_selection.nsi +++ b/Pages/page_game_selection.nsi @@ -1,7 +1,7 @@ !include "nsDialogs.nsh" Var InstallTypeRadio_NWNDIAMOND -;Var InstallTypeRadio_NWNEE +Var InstallTypeRadio_NWNEE Function Page_GameSelection nsDialogs::Create 1018 @@ -13,10 +13,10 @@ Function Page_GameSelection ${NSD_CreateRadioButton} 0 20u 100% 10u "Neverwinter Nights Diamond Edition" Pop $InstallTypeRadio_NWNDIAMOND -; ${NSD_CreateRadioButton} 0 32u 100% 10u "Neverwinter Nights: Enhanced Edition" -; Pop $InstallTypeRadio_NWNEE + ${NSD_CreateRadioButton} 0 32u 100% 10u "Neverwinter Nights: Enhanced Edition" + Pop $InstallTypeRadio_NWNEE - ${NSD_SetState} $InstallTypeRadio_NWNDIAMOND ${BST_CHECKED} + ${NSD_SetState} $InstallTypeRadio_NWNDIAMOND ${BST_CHECKED} nsDialogs::Show FunctionEnd diff --git a/Pages/page_select_path.nsi b/Pages/page_select_path.nsi index 30462aa..82c1ec0 100644 --- a/Pages/page_select_path.nsi +++ b/Pages/page_select_path.nsi @@ -2,26 +2,53 @@ !include "nsDialogs.nsh" Var PathTextBoxHandle +Var EEEXEPathTextBoxHandle +Var EEButtonHandle Function Page_SelectNWNPath - - StrCpy $INSTPATH "C:\Program Files (x86)\GOG Galaxy\Games\NWN Diamond" nsDialogs::Create 1018 - Pop $0 + Pop $0 + StrCmp $INSTALL_TYPE "diamond" diamond_select_path ee_select_path +ee_select_path: + StrCpy $INSTPATH "$DOCUMENTS\Neverwinter Nights" + Goto selectpath_end +diamond_select_path: + StrCpy $INSTPATH "C:\Program Files (x86)\GOG Galaxy\Games\NWN Diamond" + Goto selectpath_end +selectpath_end: + + ;________________________________________ + ; Create label above ${NSD_CreateLabel} 0 0 100% 12u "Please select your Neverwinter Nights install folder:" Pop $1 - ; Create a read-only text box to display the selected path ${NSD_CreateText} 0 14u 75% 12u "$INSTPATH" Pop $PathTextBoxHandle - ; Create a "Browse..." button ${NSD_CreateButton} 80% 14u 20% 12u "Browse..." Pop $2 ${NSD_OnClick} $2 OnBrowseClicked + ;________________________________________ + StrCmp $INSTALL_TYPE "diamond" skipee_exe + StrCpy $EE_EXEPATH "C:\Program Files (x86)\GOG Galaxy\Games\Neverwinter Nights Enhanced Edition" + ; Create the label + ${NSD_CreateLabel} 0 32u 100% 12u "Select the location of the nwn exectable for EE:" + Pop $2 + ; Create the text + ${NSD_CreateText} 0 44u 75% 12u "$EE_EXEPATH" + Pop $EEEXEPathTextBoxHandle + ; CReate the button + ${NSD_CreateButton} 80% 44u 20% 12u "Browse..." + Pop $EEButtonHandle + ${NSD_OnClick} $EEButtonHandle OnBrowse2Clicked + ${NSD_CreateLabel} 0 58u 100% 24u "(Path may differ for steam ex: C:\Program Files (x86)\Steam\steamapps\common\Neverwinter Nights)" + ;________________________________________ + +skipee_exe: + nsDialogs::Show FunctionEnd @@ -29,11 +56,22 @@ Function OnBrowseClicked nsDialogs::SelectFolderDialog "Select Neverwinter Nights Folder" "$INSTPATH" Pop $0 StrCmp $0 "" done + StrCmp $0 "error" done StrCpy $INSTPATH "$0" ${NSD_SetText} $PathTextBoxHandle $INSTPATH done: FunctionEnd +Function OnBrowse2Clicked + nsDialogs::SelectFolderDialog "Select Neverwinter Nights executable location" "$EE_EXEPATH" + Pop $0 + StrCmp $0 "" done + StrCmp $0 "error" done + StrCpy $EE_EXEPATH "$0" + ${NSD_SetText} $EEEXEPathTextBoxHandle $EE_EXEPATH +done: +FunctionEnd + Function Page_SelectNWNPath_Validation ; Get the current text in the folder path textbox ${NSD_GetText} $PathTextBoxHandle $INSTPATH @@ -42,6 +80,10 @@ Function Page_SelectNWNPath_Validation IfFileExists "$INSTPATH\tlk\*.*" 0 invalid IfFileExists "$INSTPATH\hak\*.*" 0 invalid +StrCmp $INSTALL_TYPE "diamond" skipee_exe_validation + ; IF EE Gotta validate for the exetucable's presence!! + IfFileExists "$EE_EXEPATH\bin\win32" 0 invalid +skipee_exe_validation: ; Everything is valid Return diff --git a/Sections/section_extract_files.nsi b/Sections/section_extract_files.nsi index ed5a4ac..ba4f866 100644 --- a/Sections/section_extract_files.nsi +++ b/Sections/section_extract_files.nsi @@ -1,14 +1,26 @@ ; The stuff to install -Section "Installing" ;No components page, name is not important +Section "Installing haks and tlk" ;No components page, name is not important SetOutPath $INSTPATH - DetailPrint "Extracting package..." + DetailPrint "Extracting custom content..." - Nsis7z::ExtractWithDetails "$EXEDIR\sinfar_all_files_v30.7z" "Installing package %s..." + ;Nsis7z::ExtractWithDetails "$EXEDIR\sinfar_all_files_v30.7z" "Installing package %s..." - DetailPrint "Extraction complete." + DetailPrint "Custom content extraction complete." - DetailPrint "Deleting temporary files." + ; DetailPrint "Deleting temporary files." ; Delete "$INSTPATH\sinfarFiles.7z" SectionEnd ; end the section + +Section "Installing haks and tlk" ;No components page, name is not important + + StrCmp $INSTALL_TYPE "diamond" skip_ee_extract + SetOutPath "$EE_EXEPATH\bin\win32_8181" + DetailPrint "Extracting Sinfare EE 8181..." + File "win32_8181.7z" + Nsis7z::ExtractWithDetails "win32_8181.7z" "Installing Sinfer EE v8181 %s..." + +skip_ee_extract: +SectionEnd ; end the section + diff --git a/main.nsi b/main.nsi index ca9b3f8..93f8372 100644 --- a/main.nsi +++ b/main.nsi @@ -14,6 +14,7 @@ InstallDir "$PROGRAMFILES\DummyInstall" Var INSTALL_TYPE Var INSTPATH +Var EE_EXEPATH ;Pages !include "Pages\page_select_path.nsi" @@ -27,14 +28,6 @@ Page custom Page_SelectNWNPath Page_SelectNWNPath_Validation ; Custom page first Page custom Page_DownloadContent "" ; Download page Page InstFiles ; Then show Install progress -Function .onInit - SetDetailsView show ; ensure log is visible - DetailPrint "===============================" - DetailPrint "Sinfar Installer v30" - DetailPrint "===============================" - DetailPrint "Initializing..." -FunctionEnd - Section "Create Shortcut" DetailPrint "Creating desktop shortcut." File "UIContent\installerico.ico"