Skip to content

Commit

Permalink
Version 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaslindstedt committed Oct 13, 2013
1 parent 3817b82 commit 240ef7d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 6 deletions.
48 changes: 48 additions & 0 deletions Include/StrContains.nsh
Original file line number Diff line number Diff line change
@@ -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"'
20 changes: 20 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
34 changes: 28 additions & 6 deletions nquake-installer_source.nsi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -392,6 +412,8 @@ SectionEnd

Section "Uninstall"

SetShellVarContext all

# Set out path to temporary files
SetOutPath $TEMP

Expand Down

0 comments on commit 240ef7d

Please sign in to comment.