From bb9bea4a5659466ea8a4a1cb0058cd16428f7c1c Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 8 Oct 2024 18:36:30 +0100 Subject: [PATCH] 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. --- .../installers/windows/installer_template.nsi | 73 +++++++++++++++---- indra/newview/viewer_manifest.py | 2 +- 2 files changed, 61 insertions(+), 14 deletions(-) diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index e0c515917b..1018b3d6db 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -178,9 +178,57 @@ Var FRIENDLY_APP_NAME # 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 # 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} diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 515cdd75fd..f1e706b0dd 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -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() # FIRE-30446: Register hop-protocol for OS version only substitution_strings['friendly_app_name'] = self.friendly_app_name() # FIRE-30446: Set FriendlyAppName for protocol registrations substitution_strings['icon_suffix'] = ("_os" if (self.fs_is_opensim()) else "") # FIRE-24335: Use different icon for OpenSim version