dethrace-labs / dethrace

Reverse engineering the 1997 game "Carmageddon"
https://twitter.com/dethrace_labs
GNU General Public License v3.0
859 stars 44 forks source link

Smack video is corrupted in hi-res mode (and a bit in normal mode) #306

Closed madebr closed 1 year ago

madebr commented 1 year ago

After applying the patch, suggested in https://github.com/dethrace-labs/dethrace/issues/305#issue-1675860843, the smack video in hi-res mode looks as following: image

the smack video in normal mode looks as following: image (note the slight corrupted line at the bottom)

This happens because smackw32.c blindly copies the smacker buffer to screen whereas it should do e.g. row doubling for hi-res mode, and handle the difference in dimensions between the source and target buffer. Or we dynamically change the window dimension.

https://github.com/dethrace-labs/dethrace/blob/6c0b26cc8d72c21d4152adee3328aa88a3c95363/src/DETHRACE/common/cutscene.c#L97

https://github.com/dethrace-labs/dethrace/blob/6c0b26cc8d72c21d4152adee3328aa88a3c95363/src/smackw32/smackw32.c#L59-L73

I don't understand why the width of the video is handled correctly. I would have expected the hi-res video to be scaled by 2 as well.

dethrace-labs commented 1 year ago

thanks. The issue was we were copying from smack frame to video assuming the same width for both. The pixel-doubling is taken care of in PDScreenBufferSwap

Fixed in https://github.com/dethrace-labs/dethrace/commit/d3fe4ed5d956b7fabcd5fbdc2da3fa43abe1e58c