nsis: Remove old v1.4 checks no longer needed.

Remove StrContains.nsh which was used for the
1.4 check.
This commit is contained in:
lightningterror 2020-09-23 13:51:08 +02:00
parent 6040f8c838
commit da5da1425b
3 changed files with 2 additions and 74 deletions

View File

@ -2,12 +2,7 @@
Function UninstallPrevious
; Here's how StrContains works:
; $result_var: This will store our result if the "needle" is found. Otherwise it will return null ("")
; $needle: String to search for
; $Haystack: String to look in
; This will become the primary version check for 1.6.0 and later
; This will become the primary version check
ReadRegStr $R1 HKLM "${INSTDIR_REG_KEY}" "DisplayVersion"
ReadRegStr $R2 HKLM Software\PCSX2 "Install_Dir"
${If} $R1 != ""
@ -15,14 +10,9 @@ ${AndIf} $R2 != ""
Goto UserPrompt
${EndIf}
; Search for 1.4.0
ReadRegStr $R3 HKLM "${INSTDIR_REG_KEY}" "Uninst-pcsx2 1.4.0Directory"
${StrContains} "$2" "1.4.0" "$R3"
; If all cases return null, our work here is done.
${If} $R2 == ""
${AndIf} $R3 == ""
Return
Return
${EndIf}
UserPrompt:
@ -41,23 +31,10 @@ ${If} $R1 != ""
Goto ExecNormal
${EndIf}
${If} $R3 != ""
${AndIf} $2 == "1.4.0"
Goto Exec1.4.0
${EndIf}
ExecNormal:
SetOutPath "$TEMP"
CopyFiles /SILENT /FILESONLY "$R2\Uninst-pcsx2.exe" "$TEMP"
ExecWait '"$TEMP\Uninst-pcsx2.exe" /S _?=$R2'
Delete "$TEMP\Uninst-pcsx2.exe"
Return
Exec1.4.0:
SetOutPath "$TEMP"
CopyFiles /SILENT /FILESONLY "$R3\Uninst-pcsx2 1.4.0.exe" "$TEMP"
ExecWait '"$TEMP\Uninst-pcsx2 1.4.0.exe" /S _?=$R3'
Delete "$TEMP\Uninst-pcsx2 1.4.0.exe"
DeleteRegKey HKLM Software\PCSX2
Return
FunctionEnd

View File

@ -1,48 +0,0 @@
; StrContains
; This function does a case sensitive searches for an occurrence of a substring in a string.
; It returns the substring if it is found.
; Otherwise it returns null("").
; Written by kenglish_hi
; Adapted from StrReplace written by dandaman32
Var STR_HAYSTACK
Var STR_NEEDLE
Var STR_CONTAINS_VAR_1
Var STR_CONTAINS_VAR_2
Var STR_CONTAINS_VAR_3
Var STR_CONTAINS_VAR_4
Var STR_RETURN_VAR
Function StrContains
Exch $STR_NEEDLE
Exch 1
Exch $STR_HAYSTACK
; Uncomment to debug
;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
StrCpy $STR_RETURN_VAR ""
StrCpy $STR_CONTAINS_VAR_1 -1
StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
loop:
IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
Goto loop
found:
StrCpy $STR_RETURN_VAR $STR_NEEDLE
Goto done
done:
Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
Exch $STR_RETURN_VAR
FunctionEnd
!macro _StrContainsConstructor OUT NEEDLE HAYSTACK
Push `${HAYSTACK}`
Push `${NEEDLE}`
Call StrContains
Pop `${OUT}`
!macroend
!define StrContains '!insertmacro "_StrContainsConstructor"'

View File

@ -19,7 +19,6 @@ InstallDir "$PROGRAMFILES\PCSX2"
!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_FILENAME}"
!include "StrContains.nsh"
!include "SectionVersionCheck.nsh"
!insertmacro MUI_PAGE_COMPONENTS