-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtextools.nsi
169 lines (115 loc) · 5.33 KB
/
textools.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
RequestExecutionLevel admin
!addplugindir "NsisDotNetChecker\bin"
!include "MUI.nsh"
!include "FileAssociation.nsh"
!include "NsisDotNetChecker\nsis\DotNetChecker.nsh"
!include LogicLib.nsh
!include x64.nsh
!define MUI_PRODUCT "FFXIV TexTools"
!define MUI_VERSION "3.0.0.0"
!define MUI_BRANDINGTEXT "FFXIV TexTools"
!define MUI_ICON "ffxiv2.ico"
!define MUI_UNICON "ffxiv2.ico"
# define installation directory
InstallDir "$PROGRAMFILES64\FFXIV TexTools"
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
MessageBox mb_iconstop "This installer must be run as Administrator to continue."
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd
!define MUI_PAGE_HEADER_TEXT "Installing FFXIV TexTools"
!define MUI_DIRECTORYPAGE_VARIABLE $INSTDIR
!define MUI_UNINSTALLER
Var StartMenuFolder
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
#!insertmacro MUI_PAGE_STARTMENU "FFXIV TexTools" $StartMenuFolder
#name of installer
OutFile "Install_TexTools.exe"
Name "FFXIV TexTools"
# start default section
Section "Install"
!insertmacro CheckNetFramework 48
# set the installation directory as the destination for the following actions
SetOutPath "$INSTDIR\FFXIV_TexTools"
File /a /r "FFXIV_TexTools\"
# VC Redistributables
# 2022 is used by the FBX Converter and TexConv
File "2022_redist.x86.exe"
ExecWait '"$INSTDIR\FFXIV_TexTools\2022_redist.x86.exe" /install /quiet /norestart'
Sleep 1000
Delete "$INSTDIR\FFXIV_TexTools\2022_redist.x86.exe"
# 2012 is used by NotAssetCC
File "2012_redist.x86.exe"
ExecWait '"$INSTDIR\FFXIV_TexTools\2012_redist.x86.exe" /install /quiet /norestart'
Sleep 1000
Delete "$INSTDIR\FFXIV_TexTools\2012_redist.x86.exe"
# Only install the 64 bit files if we're actually on a 64 bit machine.
${If} ${RunningX64}
File "2022_redist.x64.exe"
ExecWait '"$INSTDIR\FFXIV_TexTools\2022_redist.x64.exe" /install /quiet /norestart'
Sleep 1000
Delete "$INSTDIR\FFXIV_TexTools\2022_redist.x64.exe"
File "2012_redist.x64.exe"
ExecWait '"$INSTDIR\FFXIV_TexTools\2012_redist.x64.exe" /install /quiet /norestart'
Sleep 1000
Delete "$INSTDIR\FFXIV_TexTools\2012_redist.x64.exe"
${EndIf}
# create a shortcut named "new shortcut" in the start menu programs directory
# point the new shortcut at the program uninstaller
CreateDirectory "$SMPROGRAMS\FFXIV TexTools"
CreateShortcut "$SMPROGRAMS\FFXIV TexTools\FFXIV TexTools.lnk" "$INSTDIR\FFXIV_TexTools\FFXIV_TexTools.exe"
CreateShortcut "$SMPROGRAMS\FFXIV TexTools\Uninstall Textools.lnk" "$INSTDIR\uninstall.exe"
# Create Uninstaller Registry Entry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FFXIV_TexTools" \
"DisplayName" "FFXIV TexTools"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FFXIV_TexTools" \
"DisplayIcon" "$\"$INSTDIR\FFXIV_TexTools\Resources\ffxiv2.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FFXIV_TexTools" \
"DisplayVersion" "2.2.1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FFXIV_TexTools" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FFXIV_TexTools" \
"InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" \
"QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" \
"Publisher" "TexTools Github Group"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" \
"VersionMajor" 0x2
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" \
"VersionMinor" 0x2
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" \
"NoModify" 0x1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" \
"NoRepair" 0x1
${registerExtension} "$INSTDIR\FFXIV_TexTools\FFXIV_TexTools.exe" ".ttmp" "TexTools Modpack File"
${registerExtension} "$INSTDIR\FFXIV_TexTools\FFXIV_TexTools.exe" ".ttmp2" "TexTools2 Modpack File"
${registerExtension} "$INSTDIR\FFXIV_TexTools\FFXIV_TexTools.exe" ".pmp" "Penumbra Modpack File"
# create the uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
# uninstaller section start
Section "Uninstall"
# first, delete the uninstaller
Delete "$INSTDIR\uninstall.exe"
# Remove windows add/remove programs entry.
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FFXIV_TexTools"
# Remove TexTools files and shortcuts
RMDir /r "$INSTDIR\FFXIV_TexTools"
RMDir /r "$SMPROGRAMS\FFXIV TexTools"
# Unregister file extensions
${unregisterExtension} ".ttmp" "TexTools Modpack File"
${unregisterExtension} ".ttmp2" "TexTools2 Modpack File"
${unregisterExtension} ".pmp" "Penumbra Modpack File"
# Remove installation folder if it's empty.
RMDir $INSTDIR
# uninstaller section end
SectionEnd