Consistent exception trying to decode specific MAP file
A toolbox for Sid Meier's Civilization
Status: Alpha
Brought to you by:
darkpandaman
Working on the SWY's CivOne project. The attached is a generated .MAP file from that code. I consistently get an EOF exception when trying to load this file (LittleEndianDataInputStream, readUnsignedByte()). Other .MAP files from CivOne have no similar problems.
CivOne decodes it without complaint, and Microprose CivDOS appears to as well.
I don't yet understand the PIC format well enough to know if this is a bug in the CivOne code or jCivEd. Any input to fix this would be appreciated - jCivEd is a very useful tool and it is frustrating to not be able to use it with certain CivOne games.
Thanks for reporting, I will try to have a look at it as soon as possible.
Maybe an opportunity to write unit tests for this part too.
Apparently a conditional read is not correctly checking that it has enough bytes to consum, at line 102 in LZWDecoder:
https://sourceforge.net/p/jcived/code/HEAD/tree/branches/dev-commons/src/dd/commons/graphics/pic/compression/LZWDecoder.java
By modifying the condition to the below, it seems to fix the problem (very little testing):
Before:
After:
Excellent! Certainly seems to work, at least for that .MAP file! Much appreciated!
Trying to move forward with CivOne, your disassembly code and other articles in CivFanatics have proven to be indispensible [not to mention jCivEd!]! My thanks for your efforts!
Fixed in 0.0.19a