From 110ffbd96c65b0622ba700097b3dc21b10482394 Mon Sep 17 00:00:00 2001 From: ghaushe Date: Sat, 15 Feb 2003 00:04:15 +0000 Subject: [PATCH] Major update of windows installer. Supports seperated ogg files, save game moving, and other niceties for the 0.2 release git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@752 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/build/win32_install/README | 77 ++--- sc2/build/win32_install/TODO | 2 - sc2/build/win32_install/build_archives.pl | 97 ++++-- sc2/build/win32_install/build_contour.pl | 17 +- sc2/build/win32_install/contour_0_1 | 2 +- sc2/build/win32_install/download.ini | 49 ++-- sc2/build/win32_install/uqm.nsi | 343 ++++++++++++++++------ sc2/build/win32_install/uqm_english.nsh | 25 +- 8 files changed, 432 insertions(+), 180 deletions(-) diff --git a/sc2/build/win32_install/README b/sc2/build/win32_install/README index acbbb1096..61151a151 100644 --- a/sc2/build/win32_install/README +++ b/sc2/build/win32_install/README @@ -6,7 +6,7 @@ alternatively, steps 3 and 4 can be completed on a linux machine (which will probably work better anyway) The following additional tools are required: -NSIS 2.0b0 or newer: nsis.sourceforge.net +NSIS 2.0b1 or newer: nsis.sourceforge.net NSIS 'ZipDLL' http://nsis.sourceforge.net/archive/download.php?file=ZipDLL.zip NSIS 'unTGZ' http://nsis.sourceforge.net/archive/viewpage.php?pageid=84 @@ -14,66 +14,77 @@ Optionally: upx 1.90 or newer: http://upx.sourceforge.net/#unstable resource hacker: http://www.users.on.net/johnson/resourcehacker/ -1) Compile uqm.exe - -2) If you have upx, run it on uqm.exe as follows: - upx --best --crp-ms=100000 uqm.exe - -3) Update the 'upgrade' reference. +0) Update the 'upgrade' reference. + NOTE: Only run this step if you are building an official release! If you + are building a development release, or anything not sanctioned by the + UQM developers, you do not need to run this. The UQM installer can install either a 'full' version of the content dir or an 'upgrade' from a previous version. The last official version was - 0.1 as of Jan 31, 2003. To build the upgrade, it is necessary to determine + 0.1 as of Feb 14, 2003. To build the upgrade, it is necessary to determine what has changed since the previous release. Each release is taggged in the CVS repository with something like 'version_0_1'. A perl script is included which can build a list of file versions tagged with a specific tag. - The procedure is: - cvs log -h > logfile - build_contour.pl logfile version_0_1 >content_0_1 + The command is: + ./build_contour.pl version_0_1 contour_0_1 + (NOTE that this may take a very long time to run, as it is fetching the + CVS log for each file in the content directory) This will generate a reference contour to compare the current CVS build against. This only needs to be done once (after each release) -4) Build content .zip files and content.nsh +1) Compile uqm.exe + +1a) If you have upx, run it on uqm.exe as follows: + upx --best --crp-ms=100000 uqm.exe + +2) Build content .zip files and content.nsh For this procedure, you must have no modifications in the content tree. having additional files won't cause any issues, but there can't be any modified files. use the 'full' option when building a production release where you plan to create a full content directory rather than just the upgrade zip - ./build_archives.pl 0.2 content_0_1 [full] + ./build_archives.pl 0.2 contour_0_1 [full] This will generate .zip files of the content directory: - uqm_0_2_upgrade_0_1.zip + uqm-0.1_to_0.2-content.zip + uqm-0.1_to_0.2-voice.zip and (if 'full' is specified) - uqm_0_2_content.zip + uqm-0.2-content.zip + uqm-0.2-voice.zip + uqm-0.2-3domusic.zip These files should be uploaded to the disrtibution web page - It will also generate content.nsh which is a list of all files in the - content directory, for use in building the uninstaller + It will also generate content.nsh which contains a list of files for the + uninstaller, as well as the file-size of each of the archives, for use in + the installer - Lastly, this script will display the sizes of the uncompressed archives - which are needed for the next step - -5) Modify the install script: +3) Modify the install script: Edit uqm.nsi, and change the following variables: MUI_VERSION: The version you are building OLD_VERSION: The earliest version that can be upgraded from - MIRROR_LOCATION: Where the mirror file lives (probbaly ok as is) - NO_MIRROR_LOCATION: Where to get non-mirrored files from FULL_NEEDS_UPGRADE: This parameter is set if a 'full' build requires both the 'content' archive pak along with the 'upgrade' archive pak. In general, only official builds wil have this set to '0' all other builds ahould leave it at '1' - CONTENT_USE_MIRROR: Whether to use the mirror for the 'content' archive - CONTENT_PACKAGE_FILE: the name of the 'content' file (from step 4) - CONTENT_TYPE_ZIP/CONTENT_TYPE_TGZ: set the correct define - CONTENT_SIZE: The size of the content archive (uncompressed) + also, there are 5 sections: + CONTENT, VOICE, THREEDO, UPGRADE, and VUPGRADE, which represent how to + retreive the data-files, voice-files, 3do music files, upgrade to the + data files, and upgrade to the voice files respectively). These + variables are: - UPGRADE_USE_MIRROR: Whether to use the mirror for the 'upgrade' archive - UPGRADE_PACKAGE_FILE: the name of the 'upgrade' file (from step 4) - UPGRADE_TYPE_ZIP/CONTENT_TYPE_TGZ: set the correct define - UPGRADE_SIZE: The size of the upgrade archive (uncompressed) + <...>_USE_MIRROR: Whether the 'LOCATION' is pointing to a mirror file + or a directory for direct-download. The mirror file + contains a list of directries (http) where the data- + file can be downloaded from. + <...>_LOCATION: The path (http) to retrieve the data-file or mirror- + file from (depending on the value of 'USE_MIRROR') + <...>_PACKAGE_FILE: The name of the data-file to retreive + <...>_TYPE: The type of archiver used (must be "zip" or "tgz") + <...>_ROOT: The directory to unpack the data-file archive into + It should only be bnecessary to modify the first two variables + (USE_MIRROR and LOCATION) -6) run NSIS to build the installer: +4) run NSIS to build the installer: makensis uqm.nsi the installer expects all the dlls to be in the same directory as uqm.exe -7) you should be done. +5) you should be done. diff --git a/sc2/build/win32_install/TODO b/sc2/build/win32_install/TODO index 3497bfa0a..ae9ddbc1a 100644 --- a/sc2/build/win32_install/TODO +++ b/sc2/build/win32_install/TODO @@ -1,6 +1,4 @@ Things stiill needing doing of rthe installer: - - Support for moving save-game files to the correct location - untgz.dll doesn't support error checking yet - - suppot different mirror files for upgrade and full innstalls - check md5 sums on downloaded files - the uninstaller doesn't seem to get everything diff --git a/sc2/build/win32_install/build_archives.pl b/sc2/build/win32_install/build_archives.pl index 06f043d34..5e06e4ddf 100755 --- a/sc2/build/win32_install/build_archives.pl +++ b/sc2/build/win32_install/build_archives.pl @@ -2,7 +2,7 @@ use File::Find; use Cwd; # set use_zip = 1 for .zip, = 0 for .tgz -$use_zip = 0; +$use_zip = 1; $version = shift @ARGV; @@ -38,10 +38,10 @@ if ($use_zip) { } if ($tag) { - if ($tag =~ /(\d+_\d+\S*)$/) { - $vernum = $1; + if ($tag =~ /(\d+[._]\d+\S*)$/) { + $oldver = $1; } else { - $vernum = ""; + $oldver = ""; } # read in a cvs log for the content dir. # log is made by doing: @@ -87,11 +87,11 @@ if ($tag) { find (\&find_callback, "."); # use a contour file and the 'CVS' directories to determine the file list $first = 1; - $vernum = ""; + $oldver = ""; while () { chomp; if ($first) { - $vernum = $_; + $oldver = $_; $first = 0; next; } @@ -114,41 +114,78 @@ if ($tag) { } } } -$change_zip = "$cwd/uqm_${version}_upgrade${vernum}.$ext"; -$content_zip = "$cwd/uqm_${version}_content.$ext"; - +$change_zip = "$cwd/uqm-${oldver}_to_${version}-content.$ext"; +$change_ogg_zip = "$cwd/uqm-${oldver}_to_${version}-voice.$ext"; +$content_zip = "$cwd/uqm-${version}-content.$ext"; +$voice_zip = "$cwd/uqm-${version}-voice.$ext"; +$threedo_zip = "$cwd/uqm-${version}-3domusic.$ext"; # build the upgrade .zip file $last_dir = ""; $change_size = 0; +$change_ogg_size = 0; +$num_change = 0; +$num_change_ogg = 0; open FH1, ">tmpfile" || die "Couldn't create temp file!\n"; +open FH2, ">tmpfile1" || die "Couldn't create temp file!\n"; foreach $path (@changed) { if (-f $path) { ($null,$null,$null,$null,$null,$null,$null,$siz1) = stat $path; - $change_size += $siz1; - print FH1 "$path\n"; + if ($path =~ /comm\/.*\/.*\.ogg$/) { + $change_ogg_size += $siz1; + $num_change_ogg++; + print FH2 "$path\n"; + } else { + $change_size += $siz1; + $num_change++; + print FH1 "$path\n"; + } } else { print "WARNING: '$path' was not found in local repository\n"; } } close FH1; +close FH2; unlink $change_zip; +unlink $change_ogg_zip; if ($use_zip) { `cat tmpfile | zip -r $change_zip -@`; + `cat tmpfile1 | zip -r $change_ogg_zip -@` if ($change_ogg_size); } else { `tar -T tmpfile -czf $change_zip`; + `tar -T tmpfile1 -czf $change_ogg_zip` if ($change_ogg_size); } open (FH, ">$cwd/content.nsh"); +print FH "!macro REMOVE_CONTENT\n"; open FH1, ">tmpfile" || die "Couldn't create temp file!\n"; +open FH2, ">tmpfile1" || die "Couldn't create temp file!\n"; +open FH3, ">tmpfile2" || die "Couldn't create temp file!\n"; $last_dir = ""; $content_size = 0; +$voice_size = 0; +$threedo_size = 0; +$num_voice = 0; +$num_content = 0; +$num_3do = 0; @dirs = (); foreach $path (@all) { if (-f $path) { ($null,$null,$null,$null,$null,$null,$null,$siz1) = stat $path; - $content_size += $siz1; - print FH1 "$path\n"; + if ($path =~ /comm\/.*\/.*\.ogg$/) { + $voice_size += $siz1; + $num_voice++; + print FH2 "$path\n"; + } elsif ($path =~ /\.ogg$/) { + print "$path : $siz1\n"; + $threedo_size += $siz1; + $num_3do++; + print FH3 "$path\n"; + } else { + $content_size += $siz1; + $num_content++; + print FH1 "$path\n"; + } } else { print "WARNING: '$path' was not found in local repository\n"; } @@ -158,25 +195,51 @@ foreach $path (@all) { push @dirs, $dir; $last_dir = $dir; } + $path =~ s/\//\\/g; print FH "Delete \"\$INSTDIR\\content\\$path\"\n"; } } close FH1; +close FH2; +close FH3; foreach $dir (@dirs) { + $dir =~ s/\/$//; + $dir =~ s/\//\\/g; print FH "RMDir \"\$INSTDIR\\content\\$dir\"\n"; } -close FH; +print FH "!macroend\n"; if ($do_full) { unlink $content_zip; + unlink $voice_zip; if ($use_zip) { `cat tmpfile | zip -r $content_zip -@`; + `cat tmpfile1 | zip -r $voice_zip -@` if($voice_size); + `cat tmpfile2 | zip -r $threedo_zip -@` if($threedo_size); } else { `tar -T tmpfile -czf $content_zip`; + `tar -T tmpfile1 -czf $voice_zip` if ($voice_size); + `tar -T tmpfile2 -czf $threedo_zip` if ($threedo_size); } - unlink "tmpfile"; } -print "changed: #files: " . scalar (@changed) . " ($change_size kb)\n"; -print "total: #files: " . scalar (@all) . " ($content_size kb)\n"; +unlink "tmpfile"; +unlink "tmpfile1"; +unlink "tmpfile2"; +$change_size = int(0.5 + $change_size / 1000); +$change_ogg_size = int(0.5 + $change_ogg_size / 1000); +$content_size = int(0.5 + $content_size / 1000); +$voice_size = int(0.5 + $voice_size / 1000); +$threedo_size = int(0.5 + $threedo_size / 1000); +print FH "!define CONTENT_SIZE $content_size\n"; +print FH "!define VOICE_SIZE $voice_size\n"; +print FH "!define THREEDO_SIZE $threedo_size\n"; +print FH "!define UPGRADE_SIZE $change_size\n"; +print FH "!define VUPGRADE_SIZE $change_ogg_size\n"; +close FH; +print "upgrade : #files: $num_change ($change_size kb)\n"; +print "voiceupgrade: #files: $num_change_ogg ($change_ogg_size kb)\n"; +print "content : #files: $num_content ($content_size kb)\n"; +print "voice : #files: $num_voice ($voice_size kb)\n"; +print "threedo : #files: $num_3do ($threedo_size kb)\n"; exit; ########################################## diff --git a/sc2/build/win32_install/build_contour.pl b/sc2/build/win32_install/build_contour.pl index 585d31dd0..a89a9c34e 100755 --- a/sc2/build/win32_install/build_contour.pl +++ b/sc2/build/win32_install/build_contour.pl @@ -1,20 +1,24 @@ #! /usr/bin/perl -w if (scalar (@ARGV) != 2) { - print STDERR "$0 cvs_log_file cvs_tag\n"; + print STDERR "$0 cvs_tag output_contour_file\n"; exit 1; } -$file = shift @ARGV; $ver = shift @ARGV; +$file = shift @ARGV; if ($ver =~ /(\d+_\d+\S*)$/) { $vernum = $1; + $vernum =~ s/_/./g; } else { print STDERR "Couldn't parse the cvs-tag for a release version\n"; - $vernum = "0_0"; + $vernum = "0.0"; } -print "$vernum\n"; -open FH, $file || die "Couldn't find file $file\n"; +open FH1, ">$file" or die "Couldn't write to $file\n"; +print FH1 "$vernum\n"; +chdir "../../content"; +open FH, "cvs log -h|" or die "Couldn't run 'cvs log -h'\n"; +$file = ""; while () { chomp; if (/Working file: (.+)\s*$/) { @@ -24,9 +28,10 @@ while () { $head = $1; } if (/\s+${ver}:\s+(\S+)/) { - print "$file : $1\n"; + print FH1 "$file : $1\n"; $file = ""; $head = ""; } } close FH; +close FH1; diff --git a/sc2/build/win32_install/contour_0_1 b/sc2/build/win32_install/contour_0_1 index bcabc1d04..701936aa0 100644 --- a/sc2/build/win32_install/contour_0_1 +++ b/sc2/build/win32_install/contour_0_1 @@ -1,4 +1,4 @@ -0_1 +0.1 androsyn.shp : 1.1 arilou.con : 1.1 arilou.shp : 1.1 diff --git a/sc2/build/win32_install/download.ini b/sc2/build/win32_install/download.ini index bd099ec8a..58d7c9035 100644 --- a/sc2/build/win32_install/download.ini +++ b/sc2/build/win32_install/download.ini @@ -7,58 +7,59 @@ BackEnabled=1 [Field 1] Type=label left=0 -right=450 +right=-1 top=0 -bottom=15 +bottom=13 [Field 2] Type=label -left=0 -right=450 -top=15 -bottom=45 +left=20 +right=-1 +top=13 +bottom=36 [Field 3] Type=label left=0 -right=450 -top=45 -bottom=86; 59 +right=-1 +top=36 +bottom=66; 59 [Field 4] Type=RadioButton State=1 left=0 -right=450 -top=90 -bottom=105 +right=-1 +top=70 +bottom=80 [Field 5] Type=RadioButton State=0 left=0 -right=450 -top=105 -bottom=120 +right=-1 +top=80 +bottom=90 [Field 6] Type=CheckBox State=0 left=0 -right=450 -top=130 -bottom=145 +right=-1 +top=90 +bottom=100 [Field 7] Type=DirRequest left=20 -right=450 -top=145 -bottom=168 +right=-1 +top=100 +bottom=112 [Field 8] Type=label left=20 -right=450 -top=170 -bottom=210 \ No newline at end of file +right=-1 +top=112 +bottom=160 + diff --git a/sc2/build/win32_install/uqm.nsi b/sc2/build/win32_install/uqm.nsi index 1f96e350e..5f71661cf 100644 --- a/sc2/build/win32_install/uqm.nsi +++ b/sc2/build/win32_install/uqm.nsi @@ -1,5 +1,5 @@ !define MUI_PRODUCT "The Ur-Quan Masters" ;Define your own software name here -!define MUI_VERSION "0.13" ;Define your own software version here +!define MUI_VERSION "0.2" ;Define your own software version here !define OLD_VERSION "0.1" ; The earliest version that we can upgrade from !define DEFAULT_UPGRADE 1 ; Define if the default install should be 'upgrade' @@ -10,24 +10,41 @@ !define FULL_NEEDS_UPGRADE 1 !define CONTENT_USE_MIRROR 1 -;!define CONTENT_PACKAGE_FILE "uqm_0_1_3_content.tgz" -!define CONTENT_PACKAGE_FILE "uqm-0.1-content-full.tgz" -;!define CONTENT_TYPE_ZIP -!define CONTENT_TYPE_TGZ -!define CONTENT_ROOT "" -!define CONTENT_SIZE 148454 +!define CONTENT_LOCATION "http://sc2.sourceforge.net/install_files/mirrors.txt" +!define CONTENT_PACKAGE_FILE "uqm-${MUI_VERSION}-content.zip" +!define CONTENT_TYPE "zip" +!define CONTENT_ROOT "\content" -;!define UPGRADE_USE_MIRROR 1 -!define UPGRADE_PACKAGE_FILE "uqm_0_1_3_upgrade0_1.tgz" -;!define UPGRADE_TYPE_ZIP -!define UPGRADE_TYPE_TGZ +!define VOICE_USE_MIRROR 1 +!define VOICE_LOCATION "http://sc2.sourceforge.net/install_files/mirrors.txt" +!define VOICE_PACKAGE_FILE "uqm-${MUI_VERSION}-voice.zip" +!define VOICE_TYPE "zip" +!define VOICE_ROOT "\content" + +!define THREEDO_USE_MIRROR 1 +!define THREEDO_LOCATION "http://sc2.sourceforge.net/install_files/mirrors.txt" +!define THREEDO_PACKAGE_FILE "uqm-${MUI_VERSION}-3domusic.zip" +!define THREEDO_TYPE "zip" +!define THREEDO_ROOT "\content" + +!define UPGRADE_USE_MIRROR 0 +!define UPGRADE_LOCATION "http://sc2.sourceforge.net/install_files/" +!define UPGRADE_PACKAGE_FILE "uqm-${OLD_VERSION}_to_${MUI_VERSION}-content.zip" +!define UPGRADE_TYPE "zip" !define UPGRADE_ROOT "\content" -!define UPGRADE_SIZE 1324 +!define VUPGRADE_USE_MIRROR 0 +!define VUPGRADE_LOCATION "http://sc2.sourceforge.net/install_files/" +!define VUPGRADE_PACKAGE_FILE "uqm-${OLD_VERSION}_to_${MUI_VERSION}-voice.zip" +!define VUPGRADE_TYPE "zip" +!define VUPGRADE_ROOT "\content" ;-------------------------------- -!include "${NSISDIR}\Contrib\Modern UI\System.nsh" +!include "MUI.nsh" +!verbose 3 +!include "content.nsh" +!verbose 4 ;-------------------------------- ;Configuration @@ -35,9 +52,9 @@ !packhdr temp.dat "upx.exe --best --crp-ms=100000 temp.dat" ;SetCompressor bzip2 ;Interface + !define MUI_UI "${NSISDIR}\Contrib\UIs\modern2.exe" ;!define MUI_ICON "uqm.ico" ;!define MUI_UNICON "uninstall.ico" - !define MUI_LICENSEPAGE !define MUI_COMPONENTSPAGE !define MUI_DIRECTORYPAGE @@ -88,11 +105,9 @@ ;-------------------------------- ;Modern UI system - -!undef MUI_DIRECTORYPAGE +!define MUI_CUSTOMFUNCTION_DIRECTORY_PRE SetDirectory +!define MUI_CUSTOMFUNCTION_DIRECTORY_SHOW SetDirectoryDialog !insertmacro MUI_SYSTEM -!define MUI_DIRECTORYPAGE - ;-------------------------------- ;Installer Sections @@ -144,25 +159,16 @@ SectionIn 2 AddSize ${CONTENT_SIZE} - SetOutPath "$INSTDIR\content" + ; $0 = download file name + ; $1 = web site for download or mirror + ; $2 = install directory + ; $3 = use mirror + ; $4 = archive type ("zip" or "tgz") StrCpy $0 ${CONTENT_PACKAGE_FILE} - !ifdef CONTENT_USE_MIRROR - StrCpy $1 ${MIRROR_LOCATION} - StrCpy $3 1 - !else - StrCpy $1 ${NO_MIRROR_LOCATION} - StrCpy $3 0 - !endiF + StrCpy $1 ${CONTENT_LOCATION} StrCpy $2 "$INSTDIR${CONTENT_ROOT}" - !ifdef CONTENT_TYPE_ZIP - StrCpy $4 "zip" - !else - !ifdef CONTENT_TYPE_TGZ - StrCpy $4 "tgz" - !else - !error "Content file type unknown" - !endif - !endif + StrCpy $3 ${CONTENT_USE_MIRROR} + StrCpy $4 ${CONTENT_TYPE} call DownloadAndExtract Pop $0 StrCmp $0 success content_ok content_failure @@ -175,51 +181,140 @@ SectionIn 2 SectionEnd -Section $(SecUpgradeName) SecUpgrade - !ifdef FULL_NEEDS_UPGRADE - SectionIn 1 2 - !else - !ifndef DEFAULT_UPGRADE - SectionIn 2 - !else - SectionIn 1 - !endif - !endif +Section $(SecVoiceName) SecVoice +!ifndef DEFAULT_UPGRADE +SectionIn 1 +!else +SectionIn 2 +!endif - AddSize ${UPGRADE_SIZE} + AddSize ${VOICE_SIZE} - StrCpy $R1 0 - SetOutPath $INSTDIR\content - StrCpy $0 ${UPGRADE_PACKAGE_FILE} - !ifdef UPGRADE_USE_MIRROR - StrCpy $1 ${MIRROR_LOCATION} - StrCpy $3 1 - !else - StrCpy $1 ${NO_MIRROR_LOCATION} - StrCpy $3 0 - !endiF - StrCpy $2 "$INSTDIR${UPGRADE_ROOT}" - !ifdef UPGRADE_TYPE_ZIP - StrCpy $4 "zip" - !else - !ifdef UPGRADE_TYPE_TGZ - StrCpy $4 "tgz" - !else - !error "Upgrade file type unknown" - !endif - !endif + ; $0 = download file name + ; $1 = web site for download or mirror + ; $2 = install directory + ; $3 = use mirror + ; $4 = archive type ("zip" or "tgz") + StrCpy $0 ${VOICE_PACKAGE_FILE} + StrCpy $1 ${VOICE_LOCATION} + StrCpy $2 "$INSTDIR${VOICE_ROOT}" + StrCpy $3 ${VOICE_USE_MIRROR} + StrCpy $4 ${VOICE_TYPE} call DownloadAndExtract Pop $0 - StrCmp $0 success upgrade_ok upgrade_failure - upgrade_ok: - StrCpy $0 "upgrade" - goto upgrade_end - upgrade_failure: + StrCmp $0 success voice_ok voice_failure + voice_ok: + StrCpy $0 "voice" + goto voice_end + voice_failure: StrCpy $0 "" - upgrade_end: - + voice_end: + SectionEnd +Section $(Sec3doMusicName) Sec3doMusic +!ifndef DEFAULT_UPGRADE +SectionIn 1 +!else +SectionIn 2 +!endif + + AddSize ${THREEDO_SIZE} + + ; $0 = download file name + ; $1 = web site for download or mirror + ; $2 = install directory + ; $3 = use mirror + ; $4 = archive type ("zip" or "tgz") + StrCpy $0 ${THREEDO_PACKAGE_FILE} + StrCpy $1 ${THREEDO_LOCATION} + StrCpy $2 "$INSTDIR${THREEDO_ROOT}" + StrCpy $3 ${THREEDO_USE_MIRROR} + StrCpy $4 ${THREEDO_TYPE} + call DownloadAndExtract + Pop $0 + StrCmp $0 success threedo_ok threedo_failure + threedo_ok: + StrCpy $0 "3domusic" + goto threedo_end + threedo_failure: + StrCpy $0 "" + threedo_end: + +SectionEnd + +SubSection $(SubSecUpgradeName) SubSecUpgrade + Section $(SecUpgradeName) SecUpgrade + !ifdef FULL_NEEDS_UPGRADE + SectionIn 1 2 + !else + !ifndef DEFAULT_UPGRADE + SectionIn 2 + !else + SectionIn 1 + !endif + !endif + + AddSize ${UPGRADE_SIZE} + + ; $0 = download file name + ; $1 = web site for download or mirror + ; $2 = install directory + ; $3 = use mirror + ; $4 = archive type ("zip" or "tgz") + StrCpy $0 ${UPGRADE_PACKAGE_FILE} + StrCpy $1 ${UPGRADE_LOCATION} + StrCpy $2 "$INSTDIR${UPGRADE_ROOT}" + StrCpy $3 ${UPGRADE_USE_MIRROR} + StrCpy $4 ${UPGRADE_TYPE} + call DownloadAndExtract + Pop $0 + StrCmp $0 success upgrade_ok upgrade_failure + upgrade_ok: + StrCpy $0 "upgrade" + goto upgrade_end + upgrade_failure: + StrCpy $0 "" + upgrade_end: + + SectionEnd + + Section $(SecVUpgradeName) SecVUpgrade + !ifdef FULL_NEEDS_UPGRADE + SectionIn 1 2 + !else + !ifndef DEFAULT_UPGRADE + SectionIn 2 + !else + SectionIn 1 + !endif + !endif + + AddSize ${VUPGRADE_SIZE} + + ; $0 = download file name + ; $1 = web site for download or mirror + ; $2 = install directory + ; $3 = use mirror + ; $4 = archive type ("zip" or "tgz") + StrCpy $0 ${VUPGRADE_PACKAGE_FILE} + StrCpy $1 ${VUPGRADE_LOCATION} + StrCpy $2 "$INSTDIR${VUPGRADE_ROOT}" + StrCpy $3 ${VUPGRADE_USE_MIRROR} + StrCpy $4 ${VUPGRADE_TYPE} + call DownloadAndExtract + Pop $0 + StrCmp $0 success vupgrade_ok vupgrade_failure + vupgrade_ok: + StrCpy $0 "vupgrade" + goto vupgrade_end + vupgrade_failure: + StrCpy $0 "" + vupgrade_end: + + SectionEnd +SubSectionEnd + SubSection $(SecSupportDLLName) SecSupportDLL Section $(SecSDLName) SecSDL @@ -239,7 +334,7 @@ SectionIn 2 File "..\..\SDL_image.dll" SectionEnd -Section $(SecVoiceName) SecVoice +Section $(SecVoiceDLLName) SecVoiceDLL !ifndef DEFAULT_UPGRADE SectionIn 1 !else @@ -256,6 +351,35 @@ SectionEnd SubSectionEnd +Section $(SecMoveSaveName) SecMoveSave +SectionIn 1 2 + IfFileExists "$INSTDIR\content\starcon2.0*" +2 + return + ReadEnvStr $R0 "APPDATA" + StrCmp $R0 "" 0 MoveSave + ReadEnvStr $R0 "USERPROFILE" + StrCmp $R0 "" MoveSaveLastResort + StrCpy $R0 "$R0\Application Data" + IfFileExists "$R0\*.*" MoveSave + MoveSaveLastResort: + StrCpy $R0 "$INSTDIR\userdata" + IfFileExists "$R0\*.*" MoveSave + CreateDirectory $R0 + MoveSave: + StrCpy $R0 "$R0\uqm\save" + IfFileExists "$R0\starcon2.0*" 0 MoveSaveContinue + MessageBox MB_OK|MB_ICONEXCLAMATION $(MoveSaveAlreadyExists) + return + MoveSaveContinue: + CreateDirectory $R0 + ClearErrors + CopyFiles /FILESONLY "$INSTDIR\content\starcon2.0*" "$R0\" + IfErrors +3 + Delete "$INSTDIR\content\starcon2.0*" + return + MessageBox MB_OK|MB_ICONEXCLAMATION $(MoveSaveBadCopy) +SectionEnd + Section $(SecStartMenuName) SecStartMenu SectionIn 1 2 CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT}" @@ -311,22 +435,20 @@ FunctionEnd Function DownloadOptions Push $0 Call CheckDownloadDialog - IntCmp $0 1 +2 + StrCmp $0 "" 0 +2 Return - Pop $0 + Push $0 !insertmacro MUI_HEADER_TEXT $(PageDownloadTitle) $(PageDownloadSubTitle) - !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 1" text $(DownloadDialog1) !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 3" text $(DownloadDialog3) !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 4" text $(DownloadDialog4) !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 5" text $(DownloadDialog5) !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 6" text $(DownloadDialog6) !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 8" text $(DownloadDialog8) - - StrCpy $R1 "" - StrCpy $R1 $(SecContentName) + Pop $R1 !insertmacro MUI_INSTALLOPTIONS_WRITE "download.ini" "Field 2" text $R1 + Pop $0 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "download.ini" FunctionEnd @@ -336,7 +458,7 @@ Function SetDirectoryDialog Push $0 Call CheckDownloadDialog - IntCmp $0 0 buttoninst + StrCmp $0 "" buttoninst StrCpy $R0 $(DownloadDialogNext2) goto buttondone buttoninst: @@ -349,22 +471,56 @@ FunctionEnd Function CheckDownloadDialog Push $R0 + Push $R1 + Push $2 + StrCpy $2 "" + StrCpy $R1 ", " SectionGetFlags ${SecContent} $R0 Intop $R0 $R0 & "0x1" + IntCmp $R0 0 dlchk_voice + StrCpy $R0 $(SecContentName) + StrCpy $2 $R0 + dlchk_voice: + SectionGetFlags ${SecVoice} $R0 + Intop $R0 $R0 & "0x1" + IntCmp $R0 0 dlchk_3domusic + StrLen $R0 $2 + IntCmp $R0 0 +2 + StrCpy $2 $2$R1 + StrCpy $R0 $(SecVoiceName) + StrCpy $2 $2$R0 + dlchk_3domusic: + SectionGetFlags ${Sec3doMusic} $R0 + Intop $R0 $R0 & "0x1" IntCmp $R0 0 dlchk_upg - Pop $R0 - StrCpy $0 1 - Return + StrLen $R0 $2 + IntCmp $R0 0 +2 + StrCpy $2 $2$R1 + StrCpy $R0 $(Sec3doMusicName) + StrCpy $2 $2$R0 dlchk_upg: SectionGetFlags ${SecUpgrade} $R0 Intop $R0 $R0 & "0x1" + IntCmp $R0 0 dlchk_vupg + StrLen $R0 $2 + IntCmp $R0 0 +2 + StrCpy $2 $2$R1 + StrCpy $R0 $(SecUpgradeName) + StrCpy $2 $2$R0 + dlchk_vupg: + SectionGetFlags ${SecVUpgrade} $R0 + Intop $R0 $R0 & "0x1" IntCmp $R0 0 dlchk_end - Pop $R0 - StrCpy $0 1 - Return + StrLen $R0 $2 + IntCmp $R0 0 +2 + StrCpy $2 $2$R1 + StrCpy $R0 $(SecVUpgradeName) + StrCpy $2 $2$R0 dlchk_end: + StrCpy $0 $2 + Pop $2 + Pop $R1 Pop $R0 - StrCpy $0 0 Return FunctionEnd @@ -376,10 +532,14 @@ FunctionEnd !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecUQM} $(SecUQMDesc) !insertmacro MUI_DESCRIPTION_TEXT ${SecUpgrade} $(SecUpgradeDesc) + !insertmacro MUI_DESCRIPTION_TEXT ${SecVUpgrade} $(SecVUpgradeDesc) !insertmacro MUI_DESCRIPTION_TEXT ${SecContent} $(SecContentDesc) + !insertmacro MUI_DESCRIPTION_TEXT ${SecVoice} $(SecVoiceDesc) + !insertmacro MUI_DESCRIPTION_TEXT ${Sec3doMusic} $(Sec3doMusicDesc) !insertmacro MUI_DESCRIPTION_TEXT ${SecSupportDLL} $(SecSupportDLLDesc) !insertmacro MUI_DESCRIPTION_TEXT ${SecSDL} $(SecSDLDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecVoice} $(SecVoiceDesc) + !insertmacro MUI_DESCRIPTION_TEXT ${SecVoiceDLL} $(SecVoiceDLLDesc) + !insertmacro MUI_DESCRIPTION_TEXT ${SecMoveSave} $(SecMoveSaveDesc) !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(SecStartMenuDesc) !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(SecDesktopIconDesc) !insertmacro MUI_FUNCTIONS_DESCRIPTION_END @@ -414,7 +574,9 @@ Section "Uninstall" Delete "$INSTDIR\ogg.dll" ; Remove content dir - !include "content.nsh" + !verbose 3 + !insertmacro REMOVE_CONTENT + !verbose 4 ; MUST REMOVE UNINSTALLER, too Delete $INSTDIR\uninstall.exe @@ -447,4 +609,3 @@ SectionEnd ;Written by Joost Verburg ;and FileZilla installation ;written by Tim Kosse (mailto:tim.kosse@gmx.de) - diff --git a/sc2/build/win32_install/uqm_english.nsh b/sc2/build/win32_install/uqm_english.nsh index 2b89b3978..ca1212651 100644 --- a/sc2/build/win32_install/uqm_english.nsh +++ b/sc2/build/win32_install/uqm_english.nsh @@ -13,25 +13,34 @@ LicenseData /LANG=${LANG_ENGLISH} "..\..\COPYING" LangString InstTypeFullName ${LANG_ENGLISH} "Full" LangString InstTypeUpgradeName ${LANG_ENGLISH} "Upgrade" LangString SecUQMName ${LANG_ENGLISH} "Ur-Quan Masters (required)" -LangString SecUpgradeName ${LANG_ENGLISH} "Upgrade Data from ${OLD_VERSION}" -LangString SecContentName ${LANG_ENGLISH} "Install All data" +LangString SecContentName ${LANG_ENGLISH} "Install data files" +LangString SecVoiceName ${LANG_ENGLISH} "Install voice files" +LangString Sec3doMusicName ${LANG_ENGLISH} "Install 3DO Music" +LangString SubSecUpgradeName ${LANG_ENGLISH} "Upgrade from ${OLD_VERSION}" +LangString SecUpgradeName ${LANG_ENGLISH} "Upgrade data files" +LangString SecVUpgradeName ${LANG_ENGLISH} "Upgrade voice files" LangString SecSupportDLLName ${LANG_ENGLISH} "Graphics/Sound libs" LangString SecSDLName ${LANG_ENGLISH} "SDL" -LangString SecVoiceName ${LANG_ENGLISH} "Voice" +LangString SecVoiceDLLName ${LANG_ENGLISH} "Voice" +LangString SecMoveSaveName ${LANG_ENGLISH} "Move Save Games" LangString SecStartMenuName ${LANG_ENGLISH} "Start Menu Shortcuts" LangString SecDesktopIconName ${LANG_ENGLISH} "Desktop Icon" LangString SecUQMDesc ${LANG_ENGLISH} "Install uqm.exe and other required files" -LangString SecUpgradeDesc ${LANG_ENGLISH} "Download the upgrade uqm from a previous ${OLD_VERSION} (or later) install. NOTE: aborting an upgrade can leave your uqm install corrupted" +LangString SecUpgradeDesc ${LANG_ENGLISH} "Download the upgrade data-files from a previous ${OLD_VERSION} (or later) install." +LangString SecVUpgradeDesc ${LANG_ENGLISH} "Download the upgrade voices from a previous ${OLD_VERSION} (or later) install." LangString SecContentDesc ${LANG_ENGLISH} "Download all data files needed to play uqm." +LangString SecVoiceDesc ${LANG_ENGLISH} "Download all voice files needed to play uqm." +LangString Sec3doMusicDesc ${LANG_ENGLISH} "Download optional music from the 3do version." LangString SecSupportDLLDesc ${LANG_ENGLISH} "Install Support .dll files needed to play Ur-Quan Masters" LangString SecSDLDesc ${LANG_ENGLISH} "Install SDL and SDL_image libraries for graphics and sound support" -LangString SecVoiceDesc ${LANG_ENGLISH} "Install OggVorbis libraries for playing voice" +LangString SecVoiceDLLDesc ${LANG_ENGLISH} "Install OggVorbis libraries for playing voice" +LangString SecMoveSaveDesc ${LANG_ENGLISH} "Move SavedGames from ${OLD_VERSION} location to new location" LangString SecStartMenuDesc ${LANG_ENGLISH} "Create shortcuts in the start menu" LangString SecDesktopIconDesc ${LANG_ENGLISH} "Add a desktop icon for quick access to UrQuan Masters" ;Page titles -LangString PageDownloadTitle ${LANG_ENGLISH} ": Download options" +LangString PageDownloadTitle ${LANG_ENGLISH} "Download options" LangString PageDownloadSubTitle ${LANG_ENGLISH} "Some components have to be downloaded" ;Download dialog @@ -59,6 +68,10 @@ LangString DownloadExtractFailedBox ${LANG_ENGLISH} "Failed to extract contents ; Mirror problems LangString DownloadMirrorBroken ${LANG_ENGLISH} "Failed to parse mirror file" LangString DownloadMirrorBrokenDlg ${LANG_ENGLISH} "There were problems reading the mirror file. We wil not be able to install downloaded content. You can retrieve the files directly from http://sc2.sourceforge.net" +;Move Saved Games +LangString MoveSaveAlreadyExists ${LANG_ENGLISH} "Saved games already exist in $R0. We will not overwrite them!" +LangString MoveSaveBadCopy ${LANG_ENGLISH} "Error while copying saved games to $R0!" + ;Uninstaller LangString un.QuestionDeleteRegistry ${LANG_ENGLISH} "Delete all Registry keys created by Ur-Quan Masters?"