adventuregamestudio / ags

AGS editor and engine source code
Other
672 stars 159 forks source link

room file: fix loading of zak mckraken 2 #2382

Closed rofl0r closed 1 month ago

rofl0r commented 1 month ago

roomver is 2.53, and the skip_rle code skips way too many bytes way over the script data, this change fixes the game.

ivan-mogilko commented 1 month ago

I have no more errors with this game currently, could you tell which commit or branch you are building from, and which room or scene you have a problem with?

Also, you say that "skip_rle" skips too many bytes, in which case that should be fixed instead. skip_rle is there to skip the data instead of allocating an actual bitmap object. It is supposed to skip past exact same amount of data as load_rle_bitmap8 reads.

ivan-mogilko commented 1 month ago

There was this fix to skip_rle function a while ago, could it be the same problem in your case? 3df6b7185685bcd6a2d6cbdb7b5c3b62ea5dc9b0

rofl0r commented 1 month ago

i'm on 38922c2eb62b8082ae7ba07f07a8fe2192f1bac5 - i didn't update yet because rebuilding everything from scratch is so slow, and i've seen some more C++ features are in use, which may no longer be compatible with my C++-14 compiler (gcc 6.5.0). skip_rle skips

(gdb) p (w * h) + (3 * 256)
$101 = 64768

~64 kbytes, but the next data block starts way earlier. when skip is called, position is 0x4c83 but next non-rle data is ~0x68cd, so only 7242 bytes. since rle is compressed, i think you cant just multiply the sizes but have to actually decode it.

ivan-mogilko commented 1 month ago

i'm on https://github.com/adventuregamestudio/ags/commit/38922c2eb62b8082ae7ba07f07a8fe2192f1bac5

So, likely the fix I mentioned above (https://github.com/adventuregamestudio/ags/commit/3df6b7185685bcd6a2d6cbdb7b5c3b62ea5dc9b0) should fix this problem.

and i've seen some more C++ features are in use, which may no longer be compatible with my C++-14 compiler (gcc 6.5.0).

We're not targetting C++14 standard yet, we use only couple select features from C++14 which we had to reimplement in case a compiler does not support them. I don't think we have anything beyond 14.

rofl0r commented 1 month ago

nice! thanks, in that case i'll update to master. kinda odd, everytime i try a game for recreational purposes, i'm hitting some new cornercase bug... bad luck i guess

ivan-mogilko commented 1 month ago

I do not try or test old games much nowadays, so when regressions happen they might go unnoticed for some time...