Fix the AVX2 logic checks

I derped the check in viewer_mainfest so all builds seemed like AVX to the installer
The weird NSIS DSL also has weird behaviour in the if statements so I've reworked that and also added a "open in new window" for the download page offer.
meow-7.2.2
Beq 2024-10-08 18:36:30 +01:00
parent 962214a90c
commit bb9bea4a56
2 changed files with 61 additions and 14 deletions

View File

@ -178,9 +178,57 @@ Var FRIENDLY_APP_NAME # <FS:Ansariel> FIRE-30446: Set FriendlyAppName for prot
Function dirPre
StrCmp $SKIP_DIALOGS "true" 0 +2
Abort
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Open link in a new browser window
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function openLinkNewWindow
Push $3
Exch
Push $2
Exch
Push $1
Exch
Push $0
Exch
ReadRegStr $0 HKCR "http\shell\open\command" ""
# Get browser path
DetailPrint $0
StrCpy $2 '"'
StrCpy $1 $0 1
StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
StrCpy $2 ' '
StrCpy $3 1
loop:
StrCpy $1 $0 1 $3
DetailPrint $1
StrCmp $1 $2 found
StrCmp $1 "" found
IntOp $3 $3 + 1
Goto loop
found:
StrCpy $1 $0 $3
StrCmp $2 " " +2
StrCpy $1 '$1"'
Pop $0
Exec '$1 $0'
Pop $0
Pop $1
Pop $2
Pop $3
FunctionEnd
!macro _OpenURL URL
Push "${URL}"
Call openLinkNewWindow
!macroend
!define OpenURL '!insertmacro "_OpenURL"'
; Add the AVX2 check functions
Function CheckCPUFlagsAVX2
Push $1
@ -188,6 +236,7 @@ Function CheckCPUFlagsAVX2
IntCmp $1 1 OK_AVX2
; AVX2 not supported
MessageBox MB_OK $(MissingAVX2)
${OpenURL} 'https://www.firestormviewer.org/early-access-beta-downloads-legacy-cpus'
Quit
OK_AVX2:
@ -198,23 +247,17 @@ FunctionEnd
Function CheckCPUFlagsAVX2_Prompt
Push $1
System::Call 'kernel32::IsProcessorFeaturePresent(i 40) i .r1' ; 40 is PF_AVX2_INSTRUCTIONS_AVAILABLE
IntCmp $1 1 OK_AVX2 Not_AVX2
IntCmp $1 1 OK_AVX2
Pop $1
Return
OK_AVX2:
MessageBox MB_YESNO $(AVX2Available) IDYES DownloadAVX2 IDNO ContinueInstall
DownloadAVX2:
ExecShell open 'https://www.firestormviewer.org/early-access-beta-downloads/'
${OpenURL} 'https://www.firestormviewer.org/early-access-beta-downloads/'
Quit
ContinueInstall:
Goto End
Not_AVX2:
; CPU does not support AVX2, continue installation
Goto End
End:
Pop $1
Return
Pop $1
Return
FunctionEnd
# <FS:Ansariel> Optional start menu entry
@ -260,6 +303,10 @@ ${If} $0 != ""
${EndIf}
Call CheckCPUFlags # Make sure we have SSE2 support
# Two checks here, if we are an AVX2 build we want to abort if no AVX2 support on this CPU.
# If we are not an AVX2 build but the CPU can support it then we want to prompt them to download the AVX2 version
# but also allow them to override.
${If} ${ISAVX2} == 1
Call CheckCPUFlagsAVX2
${Else}

View File

@ -951,7 +951,7 @@ class Windows_x86_64_Manifest(ViewerManifest):
substitution_strings['installer_file'] = installer_file
substitution_strings['is64bit'] = (1 if (self.address_size == 64) else 0)
substitution_strings['isavx2'] = (1 if (self.fs_is_avx2) else 0)
substitution_strings['isavx2'] = (1 if (self.fs_is_avx2()) else 0)
substitution_strings['is_opensim'] = self.fs_is_opensim() # <FS:Ansariel> FIRE-30446: Register hop-protocol for OS version only
substitution_strings['friendly_app_name'] = self.friendly_app_name() # <FS:Ansariel> FIRE-30446: Set FriendlyAppName for protocol registrations
substitution_strings['icon_suffix'] = ("_os" if (self.fs_is_opensim()) else "") # <FS:Ansariel> FIRE-24335: Use different icon for OpenSim version