@@ -20,7 +20,6 @@ Var CreateSMShortcuts
20
20
Var CreateDesktopIcon
21
21
Var RegisterProtocol
22
22
Var AddToGameExplorer
23
- Var RedistVC12Installed
24
23
Var ExeMD5
25
24
Var PatchInstalled
26
25
Var DEFAULT_INSTDIR
@@ -248,19 +247,6 @@ Function .onInit
248
247
${LogText} " ${PRODUCT_VERSION}"
249
248
${LogText} " Function begin - .onInit"
250
249
251
- ; Check if we must install the Microsoft Visual Studio 2013 redistributable
252
- ClearErrors
253
- ReadRegDWORD $0 HKLM " SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" " Install"
254
- StrCmp " $0" " 1" DontInstallVC12Redist
255
- StrCpy $RedistVC12Installed " 0"
256
- ${LogText} " VS2013 runtime not installed"
257
- Goto PostVC12Check
258
- DontInstallVC12Redist:
259
- StrCpy $RedistVC12Installed " 1"
260
- ${LogText} " VS2013 runtime already installed"
261
- PostVC12Check:
262
-
263
-
264
250
; Try to find previously saved MTA:SA install path
265
251
ReadRegStr $Install_Dir HKLM " SOFTWARE\Multi Theft Auto: San Andreas All\${0.0}" " Last Install Location"
266
252
${If} $Install_Dir == " "
@@ -465,11 +451,7 @@ SectionGroup /e "$(INST_SEC_CLIENT)" SECGCLIENT
465
451
SectionIn 1 RO ; section is required
466
452
${LogText} " Section begin - CLIENT CORE"
467
453
468
- StrCmp " $RedistVC12Installed" " 1" DontInstallRedistVC12
469
- Call InstallVC12Redistributable
470
- StrCmp " $RedistVC12Installed" " 1" DontInstallRedistVC12
471
- Abort
472
- DontInstallRedistVC12:
454
+ Call UpdateVCRedistributables
473
455
474
456
SetShellVarContext all
475
457
@@ -809,11 +791,7 @@ SectionGroup /e "$(INST_SEC_SERVER)" SECGSERVER
809
791
${LogText} " Section begin - SERVER CORE"
810
792
SectionIn 1 2 RO ; section is required
811
793
812
- StrCmp " $RedistVC12Installed" " 1" DontInstallRedistVC12
813
- Call InstallVC12Redistributable
814
- StrCmp " $RedistVC12Installed" " 1" DontInstallRedistVC12
815
- Abort
816
- DontInstallRedistVC12:
794
+ Call UpdateVCRedistributables
817
795
818
796
SetOutPath " $INSTDIR\server"
819
797
SetOverwrite on
@@ -1143,6 +1121,17 @@ Function SkipDirectoryPage
1143
1121
FunctionEnd
1144
1122
1145
1123
1124
+ ; ====================================================================================
1125
+ ; Download and install Microsoft Visual Studio redistributables if required
1126
+ ; ====================================================================================
1127
+ Function UpdateVCRedistributables
1128
+ Call IsVC12RedistributableInstalled
1129
+ ${If} $0 != " 1"
1130
+ Call InstallVC12Redistributable
1131
+ ${EndIf}
1132
+ FunctionEnd
1133
+
1134
+
1146
1135
; ====================================================================================
1147
1136
; Download and install Microsoft Visual Studio 2013 redistributable
1148
1137
; ====================================================================================
@@ -1159,43 +1148,39 @@ Function InstallVC12Redistributable
1159
1148
StrCpy $REDISTVC12 " $TEMP\vcredist12_x86.exe"
1160
1149
NSISdl::download " http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe" $REDISTVC12
1161
1150
Pop $0
1162
- StrCmp " $0" " success" DownloadSuccessful
1163
-
1164
- DetailPrint " * Download of Microsoft Visual Studio 2013 redistributable failed:"
1165
- DetailPrint " * $0"
1166
- DetailPrint " * Installation continuing anyway"
1167
- MessageBox MB_ICONSTOP " $(MSGBOX_VC12RED_ERROR1)"
1168
- Goto InstallEnd
1169
-
1170
- DownloadSuccessful:
1171
- ; /passive = 'This option will display a progress dialog (but requires no user interaction) and perform an install.'
1172
- ; /quiet = 'This option will suppress all UI and perform an install.'
1173
- ExecWait ' "$REDISTVC12" /quiet'
1174
- ClearErrors
1175
- ReadRegDWORD $0 HKLM " SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" " Install"
1176
- StrCmp " $0" " 1" 0 VC12RedistInstallFailed
1177
-
1178
- StrCpy $RedistVC12Installed " 1"
1179
- Goto InstallEnd
1180
-
1181
- VC12RedistInstallFailed:
1182
- StrCpy $RedistVC12Installed " 0"
1183
- DetailPrint " * Some error occured installing Microsoft Visual Studio 2013 redistributable"
1184
- DetailPrint " * It is required in order to run Multi Theft Auto : San Andreas"
1185
- DetailPrint " * Installation continuing anyway"
1186
- MessageBox MB_ICONSTOP " $(MSGBOX_VC12RED_ERROR2)"
1187
-
1188
-
1189
- InstallEnd:
1190
1151
1191
- StrCmp " $RedistVC12Installed" " 1" InstallEnd2
1192
- MessageBox MB_ICONSTOP " $(MSGBOX_VC12RED_ERROR3)"
1193
- StrCpy $RedistVC12Installed " 1"
1152
+ ${If} $0 != " success"
1153
+ DetailPrint " * Download of Microsoft Visual Studio 2013 redistributable failed:"
1154
+ DetailPrint " * $0"
1155
+ DetailPrint " * Installation continuing anyway"
1156
+ MessageBox MB_ICONSTOP " $(MSGBOX_VC12RED_ERROR3)"
1157
+ ${Else}
1158
+ ; /passive = 'This option will display a progress dialog (but requires no user interaction) and perform an install.'
1159
+ ; /quiet = 'This option will suppress all UI and perform an install.'
1160
+ ExecWait ' "$REDISTVC12" /quiet'
1161
+ Call IsVC12RedistributableInstalled
1162
+ ${If} $0 != " 1"
1163
+ DetailPrint " * Some error occured installing Microsoft Visual Studio 2013 redistributable"
1164
+ DetailPrint " * It is required in order to run Multi Theft Auto : San Andreas"
1165
+ DetailPrint " * Installation continuing anyway"
1166
+ MessageBox MB_ICONSTOP " $(MSGBOX_VC12RED_ERROR2)"
1167
+ MessageBox MB_ICONSTOP " $(MSGBOX_VC12RED_ERROR3)"
1168
+ ${EndIf}
1169
+ ${EndIf}
1194
1170
1195
- InstallEnd2:
1196
1171
${LogText} " Function end - InstallVC12Redistributable"
1197
1172
FunctionEnd
1198
1173
1174
+ ; ----------------------------------------
1175
+ ; Out $0 = result ("1" = yes, "0" = no)
1176
+ Function IsVC12RedistributableInstalled
1177
+ ReadRegDWORD $0 HKLM " SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" " Install"
1178
+ ${If} $0 != " 1"
1179
+ StrCpy $0 " 0"
1180
+ ${EndIf}
1181
+ FunctionEnd
1182
+
1183
+
1199
1184
; ====================================================================================
1200
1185
; Patcher related functions
1201
1186
; ====================================================================================
@@ -1209,36 +1194,29 @@ Function InstallPatch
1209
1194
StrCpy $PATCHFILE " $TEMP\$ExeMD5.GTASAPatch"
1210
1195
NSISdl::download " http://mirror.multitheftauto.com/gdata/$ExeMD5.GTASAPatch" $PATCHFILE
1211
1196
Pop $0
1212
- StrCmp " $0" " success" PatchDownloadSuccessful
1213
-
1214
- DetailPrint " * Download of patch file failed:"
1215
- DetailPrint " * $0"
1216
- DetailPrint " * Installation continuing anyway"
1217
- MessageBox MB_ICONSTOP " $(MSGBOX_PATCH_FAIL1)"
1218
- StrCpy $PatchInstalled " 0"
1219
- Goto FinishPatch
1220
-
1221
- PatchDownloadSuccessful:
1222
- DetailPrint " Patch download successful. Installing patch..."
1223
- vpatch::vpatchfile " $PATCHFILE" " $GTA_DIR\gta_sa.exe.bak" " $GTA_DIR\gta_sa.exe"
1224
- Pop $R0
1225
-
1226
- ${If} $R0 == " OK"
1227
- StrCpy $PatchInstalled " 1"
1228
- Goto FinishPatch
1229
- ${ElseIf} $R0 == " OK, new version already installed"
1230
- StrCpy $PatchInstalled " 1"
1231
- Goto FinishPatch
1197
+ ${If} $0 != " success"
1198
+ DetailPrint " * Download of patch file failed:"
1199
+ DetailPrint " * $0"
1200
+ DetailPrint " * Installation continuing anyway"
1201
+ MessageBox MB_ICONSTOP " $(MSGBOX_PATCH_FAIL1)"
1202
+ StrCpy $PatchInstalled " 0"
1203
+ ${Else}
1204
+ DetailPrint " Patch download successful. Installing patch..."
1205
+ vpatch::vpatchfile " $PATCHFILE" " $GTA_DIR\gta_sa.exe.bak" " $GTA_DIR\gta_sa.exe"
1206
+ Pop $R0
1207
+ ${If} $R0 == " OK"
1208
+ StrCpy $PatchInstalled " 1"
1209
+ ${ElseIf} $R0 == " OK, new version already installed"
1210
+ StrCpy $PatchInstalled " 1"
1211
+ ${Else}
1212
+ StrCpy $PatchInstalled " 0"
1213
+ DetailPrint " * Some error occured installing the patch for Grand Theft Auto: San Andreas:"
1214
+ DetailPrint " * $R0"
1215
+ DetailPrint " * It is required in order to run Multi Theft Auto : San Andreas"
1216
+ DetailPrint " * Installation continuing anyway"
1217
+ MessageBox MB_ICONSTOP MSGBOX_PATCH_FAIL2
1218
+ ${EndIf}
1232
1219
${EndIf}
1233
-
1234
- DetailPrint " * Some error occured installing the patch for Grand Theft Auto: San Andreas:"
1235
- DetailPrint " * $R0"
1236
- DetailPrint " * It is required in order to run Multi Theft Auto : San Andreas"
1237
- DetailPrint " * Installation continuing anyway"
1238
- MessageBox MB_ICONSTOP MSGBOX_PATCH_FAIL2
1239
- StrCpy $PatchInstalled " 0"
1240
-
1241
- FinishPatch:
1242
1220
${LogText} " Function end - InstallPatch"
1243
1221
FunctionEnd
1244
1222
@@ -1254,22 +1232,22 @@ LangString UAC_RIGHTS4 ${LANG_ENGLISH} "Unable to elevate"
1254
1232
!insertmacro UAC_RunElevated
1255
1233
# MessageBox mb_TopMost "0=$0 1=$1 2=$2 3=$3"
1256
1234
${Switch} $0
1257
- ${Case} 0
1258
- ${IfThen} $1 = 1 ${|} Quit ${|} ; we are the outer process, the inner process has done its work, we are done
1259
- ${IfThen} $3 <> 0 ${|} ${Break} ${|} ; we are admin, let the show go on
1260
- ${If} $1 = 3 ; RunAs completed successfully, but with a non-admin user
1261
- MessageBox mb_IconExclamation |mb_TopMost |mb_SetForeground " ${AdminError}" /SD IDNO IDOK uac_tryagain IDNO 0
1262
- ${EndIf}
1263
- ; fall-through and die
1264
- ${Case} 1223
1265
- MessageBox mb_IconStop |mb_TopMost |mb_SetForeground " ${AdminError}"
1266
- Quit
1267
- ${Case} 1062
1268
- MessageBox mb_IconStop |mb_TopMost |mb_SetForeground " $(UAC_RIGHTS3)"
1269
- Quit
1270
- ${Default}
1271
- MessageBox mb_IconStop |mb_TopMost |mb_SetForeground " $(UAC_RIGHTS4), error $0"
1272
- Quit
1235
+ ${Case} 0
1236
+ ${IfThen} $1 = 1 ${|} Quit ${|} ; we are the outer process, the inner process has done its work, we are done
1237
+ ${IfThen} $3 <> 0 ${|} ${Break} ${|} ; we are admin, let the show go on
1238
+ ${If} $1 = 3 ; RunAs completed successfully, but with a non-admin user
1239
+ MessageBox mb_IconExclamation |mb_TopMost |mb_SetForeground " ${AdminError}" /SD IDNO IDOK uac_tryagain IDNO 0
1240
+ ${EndIf}
1241
+ ; fall-through and die
1242
+ ${Case} 1223
1243
+ MessageBox mb_IconStop |mb_TopMost |mb_SetForeground " ${AdminError}"
1244
+ Quit
1245
+ ${Case} 1062
1246
+ MessageBox mb_IconStop |mb_TopMost |mb_SetForeground " $(UAC_RIGHTS3)"
1247
+ Quit
1248
+ ${Default}
1249
+ MessageBox mb_IconStop |mb_TopMost |mb_SetForeground " $(UAC_RIGHTS4), error $0"
1250
+ Quit
1273
1251
${EndSwitch}
1274
1252
!macroend
1275
1253
0 commit comments