AbyssEngine / AbyssEngineOld

The Open Source ARPG Engine.
https://www.abyssengine.com
GNU General Public License v3.0
438 stars 46 forks source link

Fix parsing of certain dc6 found in casc #116

Closed DarthGandalf closed 2 years ago

DarthGandalf commented 2 years ago

Normally, the frame data starts at the beginning, and has Length bytes, and after that there are several (3 or 4) bytes filled with Termination e.g. EE EE EE, before the next frame header starts

But in the new buysellbtn.dc6 there's no termination, and instead the data is aligned to the right: first several bytes are 00 00 00, which are noop, but if to just take the first Length bytes, the last bytes (which were previously just before the termination area) are now outside the Length range

Old file (from MPQ):

1F 04 00 00 20 AE AD AD AD AE AE AE ... 16 C6 C7 19 BC 80 80 EE EE EE 00 00 00 00
~~~~~       ~~~~                                        ~~~~ ~~~~~~~~ ~~~~
length      data starts                          data ends    termi-    next frame header
                                   (according to "length")    nation

New file:

1F 04 00 00 00 00 00 20 AE AD AD AD AE AE AE ... 16 C6 C7 19 BC 80 80 00 00 00 00
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~
                                      same data as before              next frame header