rickomax / psxprev

PSXPREV - Playstation (PSX) Files Previewer/Extractor
BSD 2-Clause "Simplified" License
193 stars 10 forks source link

Fix reading 24bpp images #81

Closed trigger-segfault closed 12 months ago

trigger-segfault commented 12 months ago

24bpp images were reading a little under twice the pixels they should, since x was looping over [0,width-1), but using (x * 2) to set two pixels for each loop. This has been changed by using ReadByte() for each color channel, rather than three ReadUInt16()s for two sets of color channels.

Currently it's unclear how row padding is handled, but a note is left at the end of the loop, and a debug warning will be displayed if an image with an odd-numbered width is encountered.

Refactored pmode 0's and pmode 1's local variable to by called data1, like other pmodes, rather than color, which can be mixed up with color1.