~w-shackleton/droidpad-pc/trunk

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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
;--------------------------------
;Includes

  !include "MUI2.nsh"
  !include "LogicLib.nsh"
  !include "x64.nsh"

  
;--------------------------------
;General

  ;Name and file
  Name "DroidPad"
  OutFile "droidpad-setup.exe"

  ;Default installation folder
  InstallDir "$PROGRAMFILES\DroidPad"
  
  ;Get installation folder from registry if available
  InstallDirRegKey HKLM "Software\DroidPad" ""

  ;Request application privileges for Windows Vista
  RequestExecutionLevel admin

;--------------------------------
;Variables

  Var StartMenuFolder

;--------------------------------
;Interface Settings

  !define MUI_ABORTWARNING

Function .onInit
    ${If} ${RunningX64}
        ${DisableX64FSRedirection}
        SetRegView 64
	StrCpy $INSTDIR "$PROGRAMFILES64\DroidPad"
    ${EndIf}
  ; Remove old DroidPad version
  ; Check to see if already installed
  ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{046B525C-FEC6-42A2-A637-53CC2F58100E}_is1" "UninstallString"
  ${If} ${FileExists} $R0
    ${OrIf} ${FileExists} "C:\Program Files\DroidPad\unins000.exe"
    ${OrIf} ${FileExists} "C:\Program Files (x86)\DroidPad\unins000.exe"
      ${If} ${Cmd} 'MessageBox MB_YESNO "You currently have a previous version of DroidPad installed; would you like to remove it first?$\nThis is recommended as it is no longer needed.$\nThis will also remove the old joystick software used by DroidPad from this computer,$\nwhich is also no longer needed. When prompted, please uninstall the old joystick driver, PPJoy." IDYES'
  
        nsExec::Exec $R0
    ${EndIf}
  ${EndIf}
  
FunctionEnd


;--------------------------------
;Pages

  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_LICENSE "COPYING"
  ; !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY
  
  ;Start Menu Folder Page Configuration
  !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" 
  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\DroidPad" 
  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
  
  !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
  
  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_PAGE_FINISH
  
  !insertmacro MUI_UNPAGE_WELCOME
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  !insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Languages
 
  !insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "DroidPad" DESC_DPInstall

;64-bit stuff
	SetOutPath "$INSTDIR"
  
    ${If} ${RunningX64}
	File "build\winexport64\droidpad.exe"
	File "build\winexport64\droidpad.exe.manifest"
	File "build\winexport64\libgcc_s_sjlj-1.dll"
	File "build\winexport64\libstdc++-6.dll"
	File "build\winexport64\wxbase28u_gcc_custom.dll"
	File "build\winexport64\wxbase28u_net_gcc_custom.dll"
	File "build\winexport64\wxbase28u_xml_gcc_custom.dll"
	File "build\winexport64\wxmsw28u_adv_gcc_custom.dll"
	File "build\winexport64\wxmsw28u_core_gcc_custom.dll"
	File "build\winexport64\wxmsw28u_html_gcc_custom.dll"
	File "build\winexport64\wxmsw28u_xrc_gcc_custom.dll"
	${Else}
	File "build\winexport32\droidpad.exe"
	File "build\winexport32\droidpad.exe.manifest"
	File "build\winexport32\mingwm10.dll"
	File "build\winexport32\wxbase28u_gcc_custom.dll"
	File "build\winexport32\wxbase28u_net_gcc_custom.dll"
	File "build\winexport32\wxbase28u_xml_gcc_custom.dll"
	File "build\winexport32\wxmsw28u_adv_gcc_custom.dll"
	File "build\winexport32\wxmsw28u_core_gcc_custom.dll"
	File "build\winexport32\wxmsw28u_html_gcc_custom.dll"
	File "build\winexport32\wxmsw28u_xrc_gcc_custom.dll"
	${EndIf}
	
	; The data is the same for both platforms
	SetOutPath "$INSTDIR\data"
	File "build\winexport32\data\icon.xpm"
	File "build\winexport32\data\layout.xrc"
	File "build\winexport32\data\iconlarge.png"
	File "build\winexport32\data\reactos-logo.png"
	SetOutPath "$INSTDIR\data\docs"
	File "build\winexport32\data\docs\intro.zip"
	SetOutPath "$INSTDIR\data\adb"
	File "build\winexport32\data\adb\adb.exe"
	File "build\winexport32\data\adb\AdbWinApi.dll"
	File "build\winexport32\data\adb\AdbWinUsbApi.dll"
	SetOutPath "$INSTDIR\data\driver"
	${If} ${RunningX64}
	SetOutPath "$INSTDIR\data\driver\amd64"
	File "build\winexport32\data\driver\amd64\hidkmdf.sys"
	File "build\winexport32\data\driver\amd64\droidpad.cat"
	File "build\winexport32\data\driver\amd64\droidpad.inf"
	File "build\winexport32\data\driver\amd64\droidpad.sys"
	File "build\winexport32\data\driver\amd64\WdfCoInstaller01009.dll"
	File "build\winexport32\data\driver\amd64\WUDFUpdate_01009.dll"
	${Else}
	SetOutPath "$INSTDIR\data\driver\x86"
	File "build\winexport32\data\driver\x86\hidkmdf.sys"
	File "build\winexport32\data\driver\x86\droidpad.cat"
	File "build\winexport32\data\driver\x86\droidpad.inf"
	File "build\winexport32\data\driver\x86\droidpad.sys"
	File "build\winexport32\data\driver\x86\WdfCoInstaller01009.dll"
	File "build\winexport32\data\driver\x86\WUDFUpdate_01009.dll"
	${EndIf}

	DetailPrint "Installing Driver"
	nsExec::Exec "$\"$INSTDIR\droidpad.exe$\" -s"
  
  ;Store installation folder
  WriteRegStr HKLM "Software\DroidPad" "" $INSTDIR
  
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

  MessageBox MB_OK "Thank you for installing DroidPad.$\nTo access the complete set of features available,$\nplease make sure to update the Android application in Google Play."
  
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
    
    ;Create shortcuts
    CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
    CreateShortCut "$SMPROGRAMS\$StartMenuFolder\DroidPad.lnk" "$INSTDIR\droidpad.exe"
    CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
    CreateDirectory "$SMPROGRAMS\$StartMenuFolder\Advanced"
    CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Advanced\Install Driver.lnk" "$INSTDIR\droidpad.exe" "-s"
    CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Advanced\Remove Driver.lnk" "$INSTDIR\droidpad.exe" "-u"
  
  !insertmacro MUI_STARTMENU_WRITE_END

SectionEnd

;--------------------------------
;Descriptions

  ;Language strings
  LangString DESC_DPInstall ${LANG_ENGLISH} "Install DroidPad"

  ;Assign language strings to sections
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_DPInstall)
  !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
;--------------------------------
;Uninstaller Section

Section "Uninstall"

	SetOutPath "$INSTDIR"
  
	DetailPrint "Removing Driver"
  nsExec::Exec "$\"$INSTDIR\droidpad.exe$\" -u"
  
	Delete "$INSTDIR\droidpad.exe"
	Delete "$INSTDIR\droidpad.exe.manifest"
	Delete "$INSTDIR\libgcc_s_sjlj-1.dll"
	Delete "$INSTDIR\libstdc++-6.dll"
	Delete "$INSTDIR\mingwm10.dll"
	Delete "$INSTDIR\wxbase28u_gcc_custom.dll"
	Delete "$INSTDIR\wxbase28u_net_gcc_custom.dll"
	Delete "$INSTDIR\wxbase28u_xml_gcc_custom.dll"
	Delete "$INSTDIR\wxmsw28u_adv_gcc_custom.dll"
	Delete "$INSTDIR\wxmsw28u_core_gcc_custom.dll"
	Delete "$INSTDIR\wxmsw28u_html_gcc_custom.dll"
	Delete "$INSTDIR\wxmsw28u_xrc_gcc_custom.dll"
	Delete "$INSTDIR\data\icon.xpm"
	Delete "$INSTDIR\data\layout.xrc"
	Delete "$INSTDIR\data\iconlarge.png"
	Delete "$INSTDIR\data\reactos-logo.png"
	Delete "$INSTDIR\data\docs\intro.zip"
	Delete "$INSTDIR\data\adb\adb.exe"
	Delete "$INSTDIR\data\adb\AdbWinApi.dll"
	Delete "$INSTDIR\data\adb\AdbWinUsbApi.dll"
	Delete "$INSTDIR\data\driver\amd64\hidkmdf.sys"
	Delete "$INSTDIR\data\driver\amd64\droidpad.cat"
	Delete "$INSTDIR\data\driver\amd64\droidpad.inf"
	Delete "$INSTDIR\data\driver\amd64\droidpad.sys"
	Delete "$INSTDIR\data\driver\amd64\WdfCoInstaller01009.dll"
	Delete "$INSTDIR\data\driver\amd64\WUDFUpdate_01009.dll"
	Delete "$INSTDIR\data\driver\x86\hidkmdf.sys"
	Delete "$INSTDIR\data\driver\x86\droidpad.cat"
	Delete "$INSTDIR\data\driver\x86\droidpad.inf"
	Delete "$INSTDIR\data\driver\x86\droidpad.sys"
	Delete "$INSTDIR\data\driver\x86\WdfCoInstaller01009.dll"
	Delete "$INSTDIR\data\driver\x86\WUDFUpdate_01009.dll"
	RMDir "$INSTDIR\data\driver\amd64"
	RMDir "$INSTDIR\data\driver\x86"
	RMDir "$INSTDIR\data\driver"
	RMDir "$INSTDIR\data\docs"
	RMDir "$INSTDIR\data\adb"
	RMDir "$INSTDIR\data"
  

  Delete "$INSTDIR\Uninstall.exe"

  RMDir "$INSTDIR"
  
  !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
    
  Delete "$SMPROGRAMS\$StartMenuFolder\Advanced\Install Driver.lnk"
  Delete "$SMPROGRAMS\$StartMenuFolder\Advanced\Remove Driver.lnk"
  RMDir "$SMPROGRAMS\$StartMenuFolder\Advanced"
  Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
  Delete "$SMPROGRAMS\$StartMenuFolder\DroidPad.lnk"
  RMDir "$SMPROGRAMS\$StartMenuFolder"
  
  DeleteRegKey /ifempty HKLM "Software\DroidPad"

SectionEnd