I wrote NXPatcher located here: https://github.com/mechpaul/NXPatcher

I was working with KMST data tonight and tried to patch from version 1123 to 1128 - this is one of the most recent versions from the last few months, I believe. However, I noticed that Nexon changed the patch format. NXPatcher will not work on .patch files within the next six months.

Q: So, what did Nexon change in the patch format?
A: The differences are minor but helpful:

Before, the .patch file contained a stream of bytes that looked like this:

FILENAME (UNPACK_TYPE) [UNPACK INSTRUCTIONS] FILENAME (UNPACK_TYPE) [UNPACK INSTRUCTIONS]....

And you would read the .patch data all the way until the end of the file until all files were patched. This posed a problem: The patcher couldn't know if a patch file would be successful until it reached that point in the patch data because of how the data is laid out (in a stream fashion). This means you could be patching fine until you reached, for example, base.wz where the patcher would fail.

Now, the patch data looks like this:

PREAMBLE:
NUM_FILES (length_string) [Filename] [[CRC]] (length string) [Filename] [[CRC]]

This preamble contains ALL files in your WZ directory, whether the patcher is patching them or not. This completely ensures file integrity.

PATCH FILE:
FILENAME (UNPACK_TYPE) [UNPACK INSTRUCTIONS] FILENAME (UNPACK_TYPE) [UNPACK INSTRUCTIONS]....

So, this preamble means that the patcher can check all the file CRCs before attempting to patch your game. Meaning the patcher will fast fail if it finds any bad files.

Q: What does this mean for pre-patchers?
A: They will fail until the new format is supported.

Q: Will it be hard to change NXPatcher code to support the new format?
A: No. I could update it in a night or two. Other than the preamble, there were other minor differences in each block, but they aren't hard to figure out or parse.

Q: Did Nexon put anything in their patch format to signify that one is the old format and the other is the new format?
A: No, they didn't. There is a PATCH_FILE_VERSION in the header, but Nexon did not update this. The only way I could know which .patch format it is would be to guess and check. It's not great. Also, in order for NXPatcher to create the proper pre-patcher for a file, it must know which type of .patch file it is... which would be impossible without NXPatcher unpacking the .patch data first to see which version it is, unfortunately.

Q: So what does this mean for the future of NXPatcher?
A: I will have to hard fork it and ONLY support the new format. Also, I can't create prepatchers using NXPatcherLite until I have a sample of Nexon's new .exe patch file. If anyone has this, I would love for someone to point it to me.