diff --git a/Include/StrContains.nsh b/Include/StrContains.nsh new file mode 100644 index 0000000..65e176d --- /dev/null +++ b/Include/StrContains.nsh @@ -0,0 +1,48 @@ +; 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"' \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index c9a78ce..e036d10 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,23 @@ +2012-08-20 - nQuake v2.1 for Windows + +* Setup now checks if nQuake is installed in Program Files, if it is, cfg_use_home 1 is added to config. +* Added warning about installing nQuake into Program Files folder. +* Added readme to start menu. +* Fixed the bug where start menu items would not get removed by uninstall. + +2012-08-18 - nQuake v2.0 for OS X + +* Reduced amount of distfiles. +* Installation now removes dud files when pak1.pak is found. +* Bugfixes. + +2012-08-18 - nQuake v2.0 for Linux + +* Reduced amount of distfiles. +* Now checks if 'unzip' is installed before proceeding with install. +* Installation now removes dud files when pak1.pak is found. +* Bugfixes. + 2012-08-16 - nQuake v2.0 for Windows * Changed the installer graphics. diff --git a/nquake-installer_source.nsi b/nquake-installer_source.nsi index 87124b3..5556829 100644 --- a/nquake-installer_source.nsi +++ b/nquake-installer_source.nsi @@ -1,14 +1,16 @@ ;nQuake NSIS Online Installer Script -;By Empezar 2007-05-31; Last modified 2012-08-16 +;By Empezar 2007-05-31; Last modified 2012-08-20 -!define VERSION "2.0" -!define SHORTVERSION "20" +!define VERSION "2.1" +!define SHORTVERSION "21" Name "nQuake" OutFile "nquake${SHORTVERSION}_installer.exe" -InstallDir "$PROGRAMFILES\nQuake" +InstallDir "C:\nQuake" -!define INSTALLER_URL "http://nquake.com" # Note: no trailing slash! +RequestExecutionLevel admin # Request admin permissions + +!define INSTALLER_URL "http://nquake.sourceforge.net" # Note: no trailing slash! !define DISTFILES_PATH "C:\nquake-distfiles" # Note: no trailing slash! # Editing anything below this line is not recommended @@ -29,11 +31,13 @@ InstallDirRegKey HKLM "Software\nQuake" "Install_Dir" !include "VersionCompare.nsh" !include "VersionConvert.nsh" !include "WinMessages.nsh" +!include "StrContains.nsh" !include "nquake-macros.nsh" ;---------------------------------------------------- ;Variables +Var CONFIGCFG Var DISTFILES_DELETE Var ASSOCIATE_FILES Var DISTFILES_PATH @@ -84,6 +88,7 @@ Page custom MIRRORSELECT Page custom ASSOCIATION +DirText "Setup will install nQuake in the following folder. To install in a different folder, click Browse and select another folder. Click Next to continue.$\r$\n$\r$\nIt is NOT ADVISABLE to install in the Program Files folder." "Destination Folder" "Browse" "Select the folder to install nQuake in:" !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_STARTMENU "Application" $STARTMENU_FOLDER @@ -283,6 +288,8 @@ SectionEnd Section "" # StartMenu + SetShellVarContext all + # Copy the first char of the startmenu folder selected during installation StrCpy $0 $STARTMENU_FOLDER 1 @@ -298,7 +305,8 @@ Section "" # StartMenu WriteINIStr "$SMPROGRAMS\$STARTMENU_FOLDER\Links\Custom Graphics.url" "InternetShortcut" "URL" "http://gfx.quakeworld.nu/" # Create shortcuts - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start ezQuake.lnk" "$INSTDIR\ezquake-gl.exe" "" "$INSTDIR\ezquake-gl.exe" 0 + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Play QuakeWorld.lnk" "$INSTDIR\ezquake-gl.exe" "" "$INSTDIR\ezquake-gl.exe" 0 + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Readme.lnk" "$INSTDIR\readme.txt" "" "$INSTDIR\readme.txt" 0 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall nQuake.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 # Write startmenu folder to registry @@ -327,6 +335,18 @@ Section "" # Clean up installation FileClose $R0 FileClose $INSTLOG + # Check if installed to "program files" and add cfg_use_home 1 if it is + ${StrContains} $0 "Program Files" $INSTDIR + ${If} $0 != "" + FileOpen $CONFIGCFG "$INSTDIR\ezquake\configs\config.cfg" a + FileSeek $CONFIGCFG 0 END + FileWrite $CONFIGCFG "$\r$\n// Added by nQuake installer$\r$\n" + FileWrite $CONFIGCFG "cfg_use_gamedir 0$\r$\n" + FileWrite $CONFIGCFG "cfg_use_home 1$\r$\n" + FileWrite $CONFIGCFG "cl_mediaroot 1$\r$\n" + FileClose $CONFIGCFG + ${EndIf} + # Remove downloaded distfiles ${If} $DISTFILES_DELETE == 1 FileOpen $DISTLOG $DISTLOGTMP r @@ -392,6 +412,8 @@ SectionEnd Section "Uninstall" + SetShellVarContext all + # Set out path to temporary files SetOutPath $TEMP