A little looking around in the FromFiles method revealed a precarious situation: the MemoryStream stored in RawCompChunks included the 4-byte decompressed length. It wasn't the source of any corruption because the stream's position was moved to the start of the real data, but I'm sure the arrangement would have resulted in baffling bugs down the road.
It was after fixing the FromFiles chunkifier that I realized there must be a problem with the chunks representing the Terminator-style texts because those were the resources about to be called when the game crash occurred. Interrogation of RawCompChunks showed that NextGenGraphics was not changing the decompressed size of any chunks, but one of the two Terminator text chunks was immensely larger than the other. Even more suspiciously, the entry for the smaller chunk was claiming to be the same size as a masked tile.
The problem was that I had configured chunk settings wrong in all my tests. I must have miscopied MaskTileEnd as I was transcribing the settings from the old GalaxyGraphics format; the mistake was replicated into all my testing methods. Setting the correct end of masked tiles (which have a fixed decompressed length and therefore don't get the heading UInteger) fixed the crash. Everything else appeared to be working correctly.
Tomorrow, I'll see if the image serialization code I wrote yesterday actually works.
No comments:
Post a Comment