Initial Commit WIP
This commit is contained in:
commit
1079efb42f
43
Pages/page_download_files.nsi
Normal file
43
Pages/page_download_files.nsi
Normal file
@ -0,0 +1,43 @@
|
||||
Function Page_DownloadContent
|
||||
nsDialogs::Create 1018
|
||||
Pop $0
|
||||
|
||||
${NSD_CreateLabel} 0 0 100% 12u "Downloading required files..."
|
||||
Pop $1
|
||||
|
||||
${NSD_CreateProgressBar} 0 14u 100% 12u ""
|
||||
Pop $2
|
||||
|
||||
|
||||
|
||||
MessageBox MB_OK "Saving to: $INSTPATH\sinfarFiles.7z"
|
||||
; Real progress bar download using inetc plugin
|
||||
inetc::get /CAPTION "Downloading files..." /RESUME /POPUP "" /NOCANCEL \
|
||||
/FILE "$INSTPATH\sinfarFiles.7z" \
|
||||
"https://sinfar.net/haks/sinfar_all_files_v30.7z"
|
||||
|
||||
Pop $0
|
||||
StrCmp $0 "OK" +2
|
||||
Goto download_failed
|
||||
|
||||
; Download the 7za executable (or bundle it inside installer — up to you)
|
||||
;NSISdl::download "https://your.url/7za.exe" "$INSTPATH\7za.exe"
|
||||
;Pop $0
|
||||
;StrCmp $0 "cancel" download_failed
|
||||
|
||||
; Extract archive
|
||||
;nsExec::ExecToLog '"$INSTPATH\7za.exe" x "$INSTPATH\sinfarFiles.7z" -o"$INSTPATH" -y'
|
||||
|
||||
; Delete "$INSTPATH\sinfarFiles.7z"
|
||||
; Delete "$INSTPATH\7za.exe"
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
Goto done
|
||||
|
||||
download_failed:
|
||||
MessageBox MB_ICONSTOP "Download failed or was canceled."
|
||||
Abort
|
||||
|
||||
done:
|
||||
FunctionEnd
|
48
Pages/page_select_path.nsi
Normal file
48
Pages/page_select_path.nsi
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
!include "nsDialogs.nsh"
|
||||
|
||||
Var PathTextBoxHandle
|
||||
|
||||
Function Page_SelectNWNPath
|
||||
nsDialogs::Create 1018
|
||||
Pop $0
|
||||
|
||||
${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
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function OnBrowseClicked
|
||||
nsDialogs::SelectFolderDialog "Select Neverwinter Nights Folder" "$INSTPATH"
|
||||
Pop $0
|
||||
StrCmp $0 "" done
|
||||
StrCpy $INSTPATH "$0"
|
||||
${NSD_SetText} $PathTextBoxHandle $INSTPATH
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
Function Page_SelectNWNPath_Validation
|
||||
; Get the current text in the folder path textbox
|
||||
${NSD_GetText} $PathTextBoxHandle $INSTPATH
|
||||
|
||||
; Check if tlk and hak folder exists
|
||||
IfFileExists "$INSTPATH\tlk\*.*" 0 invalid
|
||||
IfFileExists "$INSTPATH\hak\*.*" 0 invalid
|
||||
|
||||
; Everything is valid
|
||||
Return
|
||||
|
||||
invalid:
|
||||
MessageBox MB_ICONEXCLAMATION|MB_OK "The selected folder must contain both 'tlk' and 'hak' subfolders."
|
||||
Abort ; Prevents advancing to next page
|
||||
FunctionEnd
|
BIN
installerico.ico
Normal file
BIN
installerico.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 220 KiB |
35
sinfarInstaller.nsi
Normal file
35
sinfarInstaller.nsi
Normal file
@ -0,0 +1,35 @@
|
||||
;!include "MUI2.nsh"
|
||||
!include "nsDialogs.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
|
||||
|
||||
Outfile "SinfarInstaller-v30.exe" ; Name of the output file
|
||||
RequestExecutionLevel admin ; We need admin right just to be sure everything work smoothly, use can refuse anyway.
|
||||
Icon "installerico.ico" ; Sinfar icon!!!
|
||||
|
||||
InstallDir "$PROGRAMFILES\DummyInstall"
|
||||
|
||||
Var INSTPATH
|
||||
|
||||
|
||||
!include "Pages\page_select_path.nsi"
|
||||
!include "Pages\page_download_files.nsi"
|
||||
|
||||
Page custom Page_SelectNWNPath Page_SelectNWNPath_Validation ; Custom page first
|
||||
Page custom Page_DownloadContent "" ; Download page
|
||||
Page InstFiles ; Then show Install progress
|
||||
|
||||
|
||||
|
||||
Section "Install Dummy Files" SEC01
|
||||
|
||||
; Create the install directory
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
; Write a simple Hello World text file
|
||||
FileOpen $0 "$INSTDIR\hello.txt" w
|
||||
FileWrite $0 "Hello World!"
|
||||
FileClose $0
|
||||
|
||||
SectionEnd
|
Loading…
x
Reference in New Issue
Block a user