In doing some more research on the patch format, I have discovered that Nexon's patching algorithm has a small mistake in it. It's very, very rare that this mistake might actually come to fruition, but it is possible.
Programmers, Try to see if you can catch the mistake. I've labeled it in the spoiler.
This is the file rebuilding algorithm ripped straight from patcher.exe:
Code:
for(Command = GetInt(&zlibBlock); Command != 0x00000000; Command = GetInt(&zlibBlock))
{
if((Command & 0xC0000000) == 0xC0000000)
{
//This is a repeat block. It's essentially run length encoding.
repeatedByte = Command & 0x000000FF
lengthOfBlock = (Command & 0x3FFFFF00) >> 8;
//use memset in C to write to a buffer containing the repeatedByte for lengthOfBlock number of bytes, then write it to the file.
}
else if((Command & 0x80000000) == 0x80000000)
{
// This is a direct write block. The bytes to be written are contained directly in the zlib stream. Simply write these bytes out to the file.
lengthOfBlock = Command & 0x7FFFFFFF;
}
else
{
//This means we take from the old file and write to the new file.
lengthOfBlock = Command
oldFileOffset = GetInt(&zlibBlock);
//So open the old file, seek to the oldFileOffset, read lengthOfBlock number of bytes, then write those bytes to the new file.
}
}
Bookmarks