mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-07 13:58:09 +00:00
Issue #1139,#930 Windows Installer: Correct ActiveX download link, Download latest java from webpages
This commit is contained in:
102
installer.nsi
102
installer.nsi
@@ -17,7 +17,7 @@
|
||||
!define JRE_VERSION "1.8"
|
||||
!endif
|
||||
|
||||
Unicode true
|
||||
Unicode true
|
||||
|
||||
|
||||
!define APP_EXENAME "ffdec.exe"
|
||||
@@ -27,12 +27,15 @@
|
||||
|
||||
|
||||
SetCompressor /SOLID lzma
|
||||
;Java 8 Update 31 JRE
|
||||
!define JRE_URL_32 "http://javadl.sun.com/webapps/download/AutoDL?BundleId=101406"
|
||||
!define JRE_URL_64 "http://javadl.sun.com/webapps/download/AutoDL?BundleId=101408"
|
||||
!include "StrFunc.nsh"
|
||||
${StrLoc}
|
||||
!include "nsis_plugins\JREDyna_Inetc.nsh"
|
||||
|
||||
!define FLASH_URL "http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player_ax.exe"
|
||||
;Old not working
|
||||
;!define FLASH_URL "http://download.macromedia.com/pub/flashplayer/current/support/install_flash_player_ax.exe"
|
||||
|
||||
!define FLASH_URL "http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe"
|
||||
|
||||
!include "nsis_plugins\Flash_Inetc.nsh"
|
||||
!include x64.nsh
|
||||
|
||||
@@ -106,81 +109,6 @@ Function GetInstalledSize
|
||||
Push $GetInstalledSize.total
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
!define StrLoc "!insertmacro StrLoc"
|
||||
|
||||
!macro StrLoc ResultVar String SubString StartPoint
|
||||
Push "${String}"
|
||||
Push "${SubString}"
|
||||
Push "${StartPoint}"
|
||||
Call StrLoc
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
|
||||
Function StrLoc
|
||||
/*After this point:
|
||||
------------------------------------------
|
||||
$R0 = StartPoint (input)
|
||||
$R1 = SubString (input)
|
||||
$R2 = String (input)
|
||||
$R3 = SubStringLen (temp)
|
||||
$R4 = StrLen (temp)
|
||||
$R5 = StartCharPos (temp)
|
||||
$R6 = TempStr (temp)*/
|
||||
|
||||
;Get input from user
|
||||
Exch $R0
|
||||
Exch
|
||||
Exch $R1
|
||||
Exch 2
|
||||
Exch $R2
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
Push $R6
|
||||
|
||||
;Get "String" and "SubString" length
|
||||
StrLen $R3 $R1
|
||||
StrLen $R4 $R2
|
||||
;Start "StartCharPos" counter
|
||||
StrCpy $R5 0
|
||||
|
||||
;Loop until "SubString" is found or "String" reaches its end
|
||||
${Do}
|
||||
;Remove everything before and after the searched part ("TempStr")
|
||||
StrCpy $R6 $R2 $R3 $R5
|
||||
|
||||
;Compare "TempStr" with "SubString"
|
||||
${If} $R6 == $R1
|
||||
${If} $R0 == `<`
|
||||
IntOp $R6 $R3 + $R5
|
||||
IntOp $R0 $R4 - $R6
|
||||
${Else}
|
||||
StrCpy $R0 $R5
|
||||
${EndIf}
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
;If not "SubString", this could be "String"'s end
|
||||
${If} $R5 >= $R4
|
||||
StrCpy $R0 ``
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
;If not, continue the loop
|
||||
IntOp $R5 $R5 + 1
|
||||
${Loop}
|
||||
|
||||
;Return output to user
|
||||
Pop $R6
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Exch
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
Function GetTime
|
||||
!define GetTime `!insertmacro GetTimeCall`
|
||||
|
||||
@@ -411,7 +339,7 @@ var SMDir
|
||||
!insertmacro MUI_LANGUAGE "${LANGLOAD}"
|
||||
!verbose push
|
||||
!verbose 0
|
||||
!include "nsis_locales/${LANGLOAD}.nsh"
|
||||
!include "nsis_locales\${LANGLOAD}.nsh"
|
||||
!verbose pop
|
||||
!undef LANG
|
||||
!macroend
|
||||
@@ -738,14 +666,6 @@ Section "FFDec" SecDummy
|
||||
SetOutPath "$INSTDIR"
|
||||
File /r "dist\lib"
|
||||
|
||||
/*
|
||||
${If} $AddToContextMenu == 1
|
||||
|
||||
|
||||
|
||||
${EndIf}
|
||||
|
||||
*/
|
||||
;create start-menu items
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN 0 ;This macro sets $SMDir and skips to MUI_STARTMENU_WRITE_END if the "Don't create shortcuts" checkbox is checked...
|
||||
|
||||
@@ -803,7 +723,7 @@ Section "$(STRING_SWC)" SecPlayerGlobal
|
||||
;checkadobe:
|
||||
DetailPrint "$(STRING_SWC_CHECK)"
|
||||
GetTempFileName $pghtml
|
||||
inetc::get /SILENT /USERAGENT "${APP_NAME} Setup" "https://www.adobe.com/support/flashplayer/downloads.html" "$pghtml"
|
||||
inetc::get /SILENT /USERAGENT "${APP_NAME} Setup" "https://www.adobe.com/support/flashplayer/downloads.html" "$pghtml" /END
|
||||
Pop $0
|
||||
StrCmp $0 "OK" dlok
|
||||
MessageBox MB_OK "$(STRING_SWC_NOTFOUND)"
|
||||
@@ -843,7 +763,7 @@ done:
|
||||
IfFileExists "$APPDATA\JPEXS\FFDec\flashlib\$pgname" swcexists
|
||||
CreateDirectory "$APPDATA\JPEXS\FFDec\flashlib"
|
||||
DetailPrint "$(STRING_STARTING_DOWNLOAD) PlayerGlobal.swc"
|
||||
inetc::get /USERAGENT "${APP_NAME} Setup" $txt "$APPDATA\JPEXS\FFDec\flashlib\$pgname"
|
||||
inetc::get /USERAGENT "${APP_NAME} Setup" $txt "$APPDATA\JPEXS\FFDec\flashlib\$pgname" /END
|
||||
Pop $0
|
||||
StrCmp $0 "OK" saved
|
||||
MessageBox MB_OK "$(STRING_SWC_NOTFOUND)"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
; Version 1.0.1
|
||||
|
||||
;JPEXS : Added 64 bit support
|
||||
;JPEXS : Added getting latest JRE from java web
|
||||
|
||||
|
||||
!ifndef JRE_DECLARES
|
||||
@@ -17,13 +18,17 @@
|
||||
!ifndef JRE_VERSION
|
||||
!error "JRE_VERSION must be defined"
|
||||
!endif
|
||||
|
||||
!ifndef JRE_URL_64
|
||||
!error "JRE_URL_64 must be defined"
|
||||
|
||||
!ifndef JRE_DOWNLOAD_PAGE_URL
|
||||
!define JRE_DOWNLOAD_PAGE_URL "https://java.com/en/download/manual.jsp"
|
||||
!endif
|
||||
|
||||
!ifndef JRE_URL_32
|
||||
!error "JRE_URL_32 must be defined"
|
||||
|
||||
!ifndef JRE_DOWNLOAD_ANCHOR_32
|
||||
!define JRE_DOWNLOAD_ANCHOR_32 "Windows Offline"
|
||||
!endif
|
||||
|
||||
!ifndef JRE_DOWNLOAD_ANCHOR_64
|
||||
!define JRE_DOWNLOAD_ANCHOR_64 "Windows Offline (64-bit)"
|
||||
!endif
|
||||
|
||||
|
||||
@@ -77,6 +82,39 @@ exit:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function Trim
|
||||
Exch $R1 ; Original string
|
||||
Push $R2
|
||||
Loop:
|
||||
StrCpy $R2 "$R1" 1
|
||||
StrCmp "$R2" " " TrimLeft
|
||||
StrCmp "$R2" "$\r" TrimLeft
|
||||
StrCmp "$R2" "$\n" TrimLeft
|
||||
StrCmp "$R2" "$\t" TrimLeft
|
||||
GoTo Loop2
|
||||
TrimLeft:
|
||||
StrCpy $R1 "$R1" "" 1
|
||||
Goto Loop
|
||||
Loop2:
|
||||
StrCpy $R2 "$R1" 1 -1
|
||||
StrCmp "$R2" " " TrimRight
|
||||
StrCmp "$R2" "$\r" TrimRight
|
||||
StrCmp "$R2" "$\n" TrimRight
|
||||
StrCmp "$R2" "$\t" TrimRight
|
||||
GoTo Done
|
||||
TrimRight:
|
||||
StrCpy $R1 "$R1" -1
|
||||
Goto Loop2
|
||||
Done:
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!define Trim "!insertmacro Trim"
|
||||
!macro Trim ResultVar String
|
||||
Push "${String}"
|
||||
Call Trim
|
||||
Pop "${ResultVar}"
|
||||
!macroend
|
||||
|
||||
|
||||
|
||||
@@ -86,6 +124,14 @@ FunctionEnd
|
||||
|
||||
|
||||
var JRE_URL
|
||||
var JRE_ANCHOR
|
||||
var jpghtml
|
||||
var aurl
|
||||
var astate
|
||||
var atext
|
||||
var jf
|
||||
var jtxt
|
||||
var jpos
|
||||
|
||||
Function DownloadAndInstallJREIfNecessary
|
||||
Push $0
|
||||
@@ -104,12 +150,79 @@ Function DownloadAndInstallJREIfNecessary
|
||||
downloadJRE:
|
||||
|
||||
${If} ${RunningX64}
|
||||
Push ${JRE_URL_64}
|
||||
Push "${JRE_DOWNLOAD_ANCHOR_64}"
|
||||
${Else}
|
||||
Push ${JRE_URL_32}
|
||||
Push "${JRE_DOWNLOAD_ANCHOR_32}"
|
||||
${EndIf}
|
||||
Pop $JRE_URL
|
||||
Pop $JRE_ANCHOR
|
||||
|
||||
GetTempFileName $jpghtml
|
||||
inetc::get /SILENT /USERAGENT "${APP_NAME} Setup" "${JRE_DOWNLOAD_PAGE_URL}" "$jpghtml" /END
|
||||
Pop $0
|
||||
StrCmp $0 "OK" 0 urlcheckfailed
|
||||
|
||||
StrCpy $astate 0
|
||||
|
||||
FileOpen $jf "$jpghtml" r
|
||||
jloop:
|
||||
FileRead $jf $jtxt
|
||||
IfErrors jdone
|
||||
${Trim} $jtxt $jtxt
|
||||
;MessageBox MB_OK $jtxt
|
||||
StrCmp $astate 0 astate0
|
||||
StrCmp $astate 1 astate1
|
||||
StrCmp $astate 2 astate2
|
||||
StrCmp $astate 3 astate3
|
||||
|
||||
astate0:
|
||||
${StrLoc} $jpos $jtxt "<a " ">"
|
||||
StrCmp $jpos "" jloop
|
||||
IntOp $jpos $jpos + 3 ;<a len
|
||||
StrCpy $jtxt $jtxt "" $jpos
|
||||
|
||||
astate1:
|
||||
StrCpy $astate 1
|
||||
${StrLoc} $jpos $jtxt "href=$\"" ">"
|
||||
StrCmp $jpos "" jloop
|
||||
IntOp $jpos $jpos + 6 ;href=" len
|
||||
StrCpy $jtxt $jtxt "" $jpos
|
||||
${StrLoc} $jpos $jtxt "$\"" ">"
|
||||
StrCmp $jpos "" jloop
|
||||
StrCpy $aurl $jtxt $jpos
|
||||
IntOp $jpos $jpos + 1 ;" len
|
||||
StrCpy $jtxt $jtxt "" $jpos
|
||||
|
||||
astate2:
|
||||
StrCpy $astate 2
|
||||
${StrLoc} $jpos $jtxt ">" ">"
|
||||
StrCmp $jpos "" jloop
|
||||
IntOp $jpos $jpos + 1 ;> len
|
||||
StrCpy $jtxt $jtxt "" $jpos
|
||||
|
||||
StrCpy $atext ""
|
||||
|
||||
astate3:
|
||||
StrCpy $astate 3
|
||||
${StrLoc} $jpos $jtxt "</a>" ">"
|
||||
StrCmp $jpos "" 0 telse
|
||||
StrCpy $atext "$atext$jtxt"
|
||||
Goto jloop
|
||||
telse:
|
||||
StrCpy $jtxt $jtxt $jpos
|
||||
StrCpy $atext "$atext$jtxt"
|
||||
StrCpy $astate 0
|
||||
|
||||
StrCmp $atext $JRE_ANCHOR 0 jloop
|
||||
StrCpy $JRE_URL $aurl
|
||||
jdone:
|
||||
FileClose $jf
|
||||
|
||||
StrCmp $JRE_URL "" urlcheckfailed urlgetsuccessfull
|
||||
urlcheckfailed:
|
||||
MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "$(STRING_JRE_CANNOTDOWNLOAD)" /SD IDIGNORE IDRETRY downloadJRE IDIGNORE End
|
||||
Abort
|
||||
urlgetsuccessfull:
|
||||
|
||||
DetailPrint "$(STRING_JRE_WILLDOWNLOAD)$JRE_URL"
|
||||
Inetc::get "$JRE_URL" "$TEMP\jre_Setup.exe" /END
|
||||
Pop $0 # return value = exit code, "OK" if OK
|
||||
@@ -121,14 +234,13 @@ downloadJRE:
|
||||
|
||||
downloadsuccessful:
|
||||
|
||||
|
||||
DetailPrint "$(STRING_JRE_LAUNCHSETUP)"
|
||||
|
||||
IfSilent doSilent
|
||||
ExecWait '"$TEMP\jre_setup.exe" REBOOT=Suppress /L \"$TEMP\jre_setup.log\"' $0
|
||||
ExecWait '"$TEMP\jre_setup.exe" REBOOT=Suppress SPONSORS=0 /L "$TEMP\jre_setup.log"' $0
|
||||
goto jreSetupfinished
|
||||
doSilent:
|
||||
ExecWait '"$TEMP\jre_setup.exe" /S REBOOT=Suppress /L \"$TEMP\jre_setup.log\"' $0
|
||||
ExecWait '"$TEMP\jre_setup.exe" /S REBOOT=Suppress SPONSORS=0 /L "$TEMP\jre_setup.log"' $0
|
||||
|
||||
|
||||
jreSetupFinished:
|
||||
|
||||
Reference in New Issue
Block a user