Skip to content

Commit

Permalink
Forcibly instal 1.62, even if it's a downgrade. Yeah, it's silly.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jun 24, 2004
1 parent cfb599d commit ab91eb0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 38 deletions.
42 changes: 25 additions & 17 deletions build-patchfile.sh
Expand Up @@ -14,26 +14,34 @@ rm -rf "/Users/icculus/Desktop/Hordes of the Underdark Installer.app"
# 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 \
Expand All @@ -43,17 +51,17 @@ find "/Users/icculus/Desktop/Hordes of the Underdark Installer.app" -name ".svn"
--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

Expand Down
41 changes: 21 additions & 20 deletions mojopatch.c
Expand Up @@ -192,6 +192,7 @@ static unsigned int maxxdeltamem = 128; /* in megabytes. */
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)
{
Expand Down Expand Up @@ -574,6 +575,9 @@ static void _current_operation(const char *fmt, ...)
/* 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 */

Expand Down Expand Up @@ -2015,11 +2019,6 @@ static char nwnbase[MAXPATHLEN];

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)))
Expand All @@ -2046,13 +2045,7 @@ static int nwn_patch_start(void)
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 */


Expand Down Expand Up @@ -2091,12 +2084,8 @@ static int do_patching(void)
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;
Expand Down Expand Up @@ -2136,8 +2125,20 @@ static int do_patching(void)

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);
Expand Down
2 changes: 1 addition & 1 deletion platform_unix.c
Expand Up @@ -335,7 +335,7 @@ int parse_info_dot_plist(const char *ident,
{
// 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
Expand Down

0 comments on commit ab91eb0

Please sign in to comment.