Forcibly instal 1.62, even if it's a downgrade. Yeah, it's silly. nwn-expansion-packs
authorRyan C. Gordon <icculus@icculus.org>
Thu, 24 Jun 2004 11:17:22 +0000
branchnwn-expansion-packs
changeset 62 a8870c194a0b
parent 61 99052e0a5fe0
child 67 86af2c3326dd
Forcibly instal 1.62, even if it's a downgrade. Yeah, it's silly.
build-patchfile.sh
mojopatch.c
platform_unix.c
--- a/build-patchfile.sh	Thu Jun 24 10:02:48 2004 +0000
+++ b/build-patchfile.sh	Thu Jun 24 11:17:22 2004 +0000
@@ -14,26 +14,34 @@
 # Just a blank dir, so everything in the patch dir is added in the patch...
 mkdir -p tmp
 
+# Bioware doesn't want us to check for 1.62 or later and patch as necessary,
+#  but rather force installation of 1.62, even if it downgrades the game.
+#
+# While this arguably simplifies the installers, it's a little silly.  --ryan.
+
 # Put the 1.62 patch together...
-./MojoPatch.app/Contents/MacOS/mojopatch  --create --alwaysadd --zliblevel 1 \
---product "Neverwinter Nights" \
---identifier "nwmain.icns" \
---version "0.0.1d1" --newversion "1.62" --replace --append --quietonsuccess \
---titlebar "Neverwinter Nights 1.62 patch" \
-"./MojoPatch.app/default.mojopatch" \
-"./tmp" \
-"/Users/icculus/Desktop/nwn162"
+#./MojoPatch.app/Contents/MacOS/mojopatch  --create --alwaysadd --zliblevel 1 \
+#--product "Neverwinter Nights" \
+#--identifier "nwmain.icns" \
+#--version "0.0.1d1" --newversion "1.62" --replace --append --quietonsuccess \
+#--titlebar "Neverwinter Nights 1.62 patch" \
+#"./MojoPatch.app/default.mojopatch" \
+#"./tmp" \
+#"/Users/icculus/Desktop/nwn162"
 
 # Copy initial patchfile to seperate expansion pack installers...
+
+# Stupid spaces in the name! Copy to a temp dir to nuke .svn dirs first...
+cp -R MojoPatch.app x.app
+for feh in `find x.app -name ".svn" -type d -exec echo {} \;` ; do rm -rf $feh ; done
+
 echo "copying initial patch to SoU branch..."
-cp -R MojoPatch.app "/Users/icculus/Desktop/Shadows of Undrentide Installer.app"
-rm -f "/Users/icculus/Desktop/Shadows of Undrentide Installer.app/Contents/MacOS/xdelta"
-find "/Users/icculus/Desktop/Shadows of Undrentide Installer.app" -name ".svn" -type d -exec rm -rf {} \; 2>/dev/null
+cp -R x.app "/Users/icculus/Desktop/Shadows of Undrentide Installer.app"
 
 echo "copying initial patch to HotU branch..."
-cp -R MojoPatch.app "/Users/icculus/Desktop/Hordes of the Underdark Installer.app"
-rm -f "/Users/icculus/Desktop/Hordes of the Underdark Installer.app/Contents/MacOS/xdelta"
-find "/Users/icculus/Desktop/Hordes of the Underdark Installer.app" -name ".svn" -type d -exec rm -rf {} \; 2>/dev/null
+cp -R x.app "/Users/icculus/Desktop/Hordes of the Underdark Installer.app"
+
+rm -rf x.app
 
 # Add XP1 data to patchfile...
 ./MojoPatch.app/Contents/MacOS/mojopatch  --create --alwaysadd --zliblevel 1 \
@@ -43,17 +51,17 @@
 --titlebar "NWN Shadows of Undrentide Expansion Pack" \
 "/Users/icculus/Desktop/Shadows of Undrentide Installer.app/default.mojopatch" \
 "./tmp" \
-"/Users/icculus/Desktop/XP1/XP1-1.62.8047e"
+"/Users/icculus/Desktop/XP1-1.62.8047e"
 
 # Add XP2 data to the other patchfile...
-./MojoPatch.app/Contents/MacOS/mojopatch  --create --alwaysadd --zliblevel 1 \
+./MojoPatch.app/Contents/MacOS/mojopatch  --create --alwaysadd --zliblevel 9 \
 --product "Neverwinter Nights" \
 --identifier "HotU" \
 --version "a" --newversion "b" --replace --append \
 --titlebar "NWN Hordes of the Underdark Expansion Pack" \
 "/Users/icculus/Desktop/Hordes of the Underdark Installer.app/default.mojopatch" \
 "./tmp" \
-"/Users/icculus/Desktop/XP2/XP2-1.62.8047e"
+"/Users/icculus/Desktop/XP2-1.62.8047e"
 
 rmdir tmp
 
--- a/mojopatch.c	Thu Jun 24 10:02:48 2004 +0000
+++ b/mojopatch.c	Thu Jun 24 11:17:22 2004 +0000
@@ -192,6 +192,7 @@
 static unsigned char iobuf[512 * 1024];
 static unsigned char compbuf[520 * 1024];
 
+static int might_be_downgraded = 0;
 
 static int serialize(SerialArchive *ar, void *val, size_t size)
 {
@@ -574,6 +575,9 @@
 /* don't taunt this function. */
 int version_ok(const char *ver, const char *allowed_ver)
 {
+    char *endptr = NULL;
+    double dver = strtod(ver, &endptr);
+    might_be_downgraded = ((endptr != ver) && (dver > 1.62));
     return(strcmp(ver, "0.0.1d1") == 0);
 } /* version_ok */
 
@@ -2015,11 +2019,6 @@
 
 static int nwn_patch_start(void)
 {
-    int rc = 0;
-    ui_msgbox("Welcome to the Neverwinter Nights expansion pack installer!"
-              " Before installing the expansion pack, we need to make sure"
-              " the game is patched up to an acceptable version.");
-
     while (1)
     {
         if (!manually_locate_product("Neverwinter Nights", nwnbase, sizeof (nwnbase)))
@@ -2046,13 +2045,7 @@
         return(0);
     } /* if */
 
-    rc = parse_info_dot_plist("nwmain.icns", "0.0.1d1", "1.62");
-    if (!rc)
-        return(0);
-    else if (rc == -1)
-        skip_patch = 1;
-
-    return(1);
+    return(parse_info_dot_plist("nwmain.icns", "0.0.1d1", "1.62") != 0);
 } /* nwn_patch_start */
 
 
@@ -2091,12 +2084,8 @@
             return(0);
         } /* if */
 
-        /* if there's no identifier, then we're past the game patches. */
-        if (*header.identifier == '\0')
-        {
-            ui_msgbox("Now we're ready to install the expansion pack.\n"
-                      "  This will take around 5 to 10 minutes.");
-        } /* if */
+        ui_msgbox("Now we're ready to install the expansion pack.\n"
+                  "  This may take up to 20 minutes.");
 
         if (process_patch_header(&ar, &header) == PATCHERROR)
             goto do_patching_done;
@@ -2136,8 +2125,20 @@
 
     retval = PATCHSUCCESS;
     ui_total_progress(100);
-    if ( (!info_only()) && (!quietonsuccess) )
-        ui_success("Installation successful!");
+    if (!info_only())
+    {
+        if (!quietonsuccess)
+            ui_success("Installation successful!");
+
+        if (might_be_downgraded)
+        {
+            /* Compatibility reasons my ass. */
+            ui_msgbox("For compatibility reasons, this installer has"
+                      " downgraded your game to version 1.62. Please visit"
+                      " http://www.macsoftgames.com/ for a patch that will"
+                      " safely update your game to the latest version.");
+        } /* if */
+    } /* if */
 
 do_patching_done:
     close_serialized_archive(&ar);
--- a/platform_unix.c	Thu Jun 24 10:02:48 2004 +0000
+++ b/platform_unix.c	Thu Jun 24 11:17:22 2004 +0000
@@ -335,7 +335,7 @@
         {
 //            if (strcmp(ptr, newversion) == 0)
 //            {
-                _fatal("You seem to have the required %s patch already!", newversion);
+//                _fatal("You seem to have the required %s patch already!", newversion);
                 retval = -1;
 //            } /* if */
 //            else