diff options
-rw-r--r-- | indra/newview/installers/windows/installer_template.nsi | 86 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 1 |
2 files changed, 86 insertions, 1 deletions
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 77f24ac6a6..0e36698018 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -164,6 +164,74 @@ Var DO_UNINSTALL_V2 # If non-null, path to a previous Viewer 2 installation !include "x64.nsh" # for 64bit detection
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Substring function
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+!define StrStr "!insertmacro StrStr"
+
+!macro StrStr ResultVar String SubString
+ Push `${String}`
+ Push `${SubString}`
+ Call StrStr
+ Pop `${ResultVar}`
+!macroend
+
+Function StrStr
+
+# After this point:
+# ------------------------------------------
+# $R0 = SubString (input)
+# $R1 = String (input)
+# $R2 = SubStringLen (temp)
+# $R3 = StrLen (temp)
+# $R4 = StartCharPos (temp)
+# $R5 = TempStr (temp)
+# function from nsis.sourceforge.io/StrStr
+
+ ;Get input from user
+ Exch $R0
+ Exch
+ Exch $R1
+ Push $R2
+ Push $R3
+ Push $R4
+ Push $R5
+
+ ;Get "String" and "SubString" length
+ StrLen $R2 $R0
+ StrLen $R3 $R1
+ ;Start "StartCharPos" counter
+ StrCpy $R4 0
+
+ ;Loop until "SubString" is found or "String" reaches its end
+ ${Do}
+ ;Remove everything before and after the searched part ("TempStr")
+ StrCpy $R5 $R1 $R2 $R4
+
+ ;Compare "TempStr" with "SubString"
+ ${IfThen} $R5 == $R0 ${|} ${ExitDo} ${|}
+ ;If not "SubString", this could be "String"'s end
+ ${IfThen} $R4 >= $R3 ${|} ${ExitDo} ${|}
+ ;If not, continue the loop
+ IntOp $R4 $R4 + 1
+ ${Loop}
+
+# After this point:
+# ------------------------------------------
+# $R0 = ResultVar (output)
+
+ ;Remove part before "SubString" on "String" (if there has one)
+ StrCpy $R0 $R1 `` $R4
+
+ ;Return output to user
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Exch $R0
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Pre-directory page callback
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Function dirPre
@@ -190,15 +258,31 @@ Function .onInit # However, SL-10506 complains about the resulting behavior, so the logic below
# is adapted from before we introduced MultiUser.nsh.
+# Check if user specified /D= on the command line
+System::Call 'kernel32::GetCommandLine()t .r0'
+Push $0
+Push " /D="
+Call StrStr
+Pop $1
+${If} $1 != ""
+ # /D= was specified, extract the path
+ # spaces are allowed in path after /D=, it's expected to be the last parameter
+ StrLen $2 $1
+ StrCpy $INSTDIR $1 $2 4 # Skip over " /D="
+ Goto after_instdir
+${EndIf}
+
# if $0 is empty, this is the first time for this viewer name
ReadRegStr $0 SHELL_CONTEXT "${INSTNAME_KEY}" ""
# viewer with this name was installed before
${If} $0 != ""
- # use the value we got from registry as install location
+ # use the value we got from registry as install location
StrCpy $INSTDIR $0
${EndIf}
+after_instdir:
+
Call CheckCPUFlags # Make sure we have SSE2 support
Call CheckWindowsVersion # Don't install On unsupported systems
Push $0
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ba7437798a..5df7eca5f5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -397,6 +397,7 @@ bool idle_startup() LL_WARNS_ONCE() << "gViewerWindow is not initialized" << LL_ENDL; return false; // No world yet } + LL_PROFILE_ZONE_SCOPED; const F32 PRECACHING_DELAY = gSavedSettings.getF32("PrecachingDelay"); static LLTimer timeout; |