forked from smogon/pokemon-showdown-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokemonshowdown.nsi
executable file
·159 lines (122 loc) · 5.16 KB
/
pokemonshowdown.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
;NSIS Modern User Interface
;Installer builder for Pokemon Showdown
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
# MUI Symbol Definitions
!define MUI_ICON "icons\pokemonshowdown.ico"
!define APPNAME "Pokemon Showdown"
!define COMPANYNAME "Pokemon Showdown"
!define ABOUTURL "http://pokemonshowdown.com/" # "Publisher" link
!define INSTALLSIZE 48000
;Name and file
Name "Pokemon Showdown"
OutFile "setup.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Pokemon Showdown"
CRCCheck on
XPStyle on
ShowInstDetails show
;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation"
;Request application privileges for Windows Vista
# RequestExecutionLevel user
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "icons\installerbg.bmp" ; optional
!define MUI_ABORTWARNING
;--------------------------------
;Pages
# !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Play Pokemon Showdown"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Main" SecMain
setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
file "pokemonshowdown.exe"
file "package.json"
file "index.html"
file "nw.pak"
file "d3dcompiler_47.dll"
file "icudtl.dat"
file "ffmpegsumo.dll"
file "libEGL.dll"
file "libGLESv2.dll"
file "pdf.dll"
CreateDirectory "$INSTDIR\icons"
setOutPath "$INSTDIR\icons"
file "icons\icon_32x32.png"
file "icons\pokemonshowdown.ico"
writeUninstaller "$INSTDIR\uninstall.exe"
createShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\pokemonshowdown.exe" "" "$INSTDIR\icons\pokemonshowdown.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icons\pokemonshowdown.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
SectionEnd
;--------------------------------
;Descriptions
;Language strings
# LangString DESC_SecMain ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
# !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
# !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
# !insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
# Remove Start Menu launcher
delete "$SMPROGRAMS\${APPNAME}.lnk"
# Remove files
delete "$INSTDIR\pokemonshowdown.exe"
delete "$INSTDIR\package.json"
delete "$INSTDIR\index.html"
delete "$INSTDIR\d3dcompiler_47.dll"
delete "$INSTDIR\ffmpegsumo.dll"
delete "$INSTDIR\icudtl.dat"
delete "$INSTDIR\icudt.dll"
delete "$INSTDIR\libEGL.dll"
delete "$INSTDIR\libGLESv2.dll"
delete "$INSTDIR\nw.pak"
delete "$INSTDIR\pdf.dll"
delete "$INSTDIR\icons\icon_32x32.png"
delete "$INSTDIR\icons\pokemonshowdown.ico"
delete "$INSTDIR\data\icon_32x32.png"
delete "$INSTDIR\data\pokemonshowdown.ico"
rmDir "$INSTDIR\icons"
rmDir "$INSTDIR\data"
rmDir "$INSTDIR\locales"
# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
# Try to remove the install directory - this will only happen if it is empty
rmDir $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd
Function LaunchLink
ExecShell "" "$INSTDIR\pokemonshowdown.exe"
FunctionEnd