fuzziqersoftware / resource_dasm

Classic Mac OS resource fork and application disassembler, with reverse-engineering tools for specific applications
MIT License
113 stars 12 forks source link

warning: PICT rendering failed (mask region rect Rect(x1=-27892, y1=26790, x2=0, y2=256) is not same as source rect #58

Closed MikeRich88 closed 1 year ago

MikeRich88 commented 1 year ago

Always make a new build before submitting issues 🀣

I got a new one for you 😊

Most of the PICT resources in Dude 2000 v2.71 fail to decode. (Disclaimer: I wrote this game when I was like, 11)

... dudenew/Dude 2000 v2.71_PICT_1118.pict
warning: PICT rendering failed (mask region rect Rect(x1=-27892, y1=26790, x2=0, y2=256) is not same as source rect Rect(x1=152, y1=163, x2=398, y2=388)); attempting rendering using picttoppm
picttoppm: Invalid PICT: compressed line of 63232 bytes for Row 0 is too big to represent a 256-byte padded row, even with worse case compression.
warning: failed to decode resource: picttoppm failed (256)

PICT 1118 totally fails both resource_dasm and picttoppm. I will raise this issue separately with the NetPBM guy. The picttoppm error here doesn't make sense to me, since the entire PICT is only 6826 bytes.

... dudenew/Dude 2000 v2.71_PICT_1119.pict
warning: PICT rendering failed (mask region rect Rect(x1=-27892, y1=26790, x2=0, y2=256) is not same as source rect Rect(x1=152, y1=163, x2=398, y2=388)); attempting rendering using picttoppm

PICT 1119 fails in resource_dasm, and picttoppm does not have an error but I still don't get the BMP output for some reason?

Actually, now I'm confused, because for 1120 I did get a BMP file, but the program output looks identical to 1118, which failed totally and gave me the raw PICT output?

... dudenew/Dude 2000 v2.71_PICT_1120.bmp
warning: PICT rendering failed (mask region rect Rect(x1=-27892, y1=26790, x2=0, y2=256) is not same as source rect Rect(x1=27, y1=163, x2=523, y2=388)); attempting rendering using picttoppm
picttoppm: Invalid PICT: compressed line of 1153 bytes for Row 0 is too big to represent a 496-byte padded row, even with worse case compression.
warning: failed to decode resource: picttoppm failed (256)

I ran resource_dasm again with skip-decode and the 3 PICTs (1118, 1119, 1120) are in the attached ZIP. The entire game is available here, use The Unarchiver to decompress: https://mikerichardson.name/graveyard/dude2000_271.sit

3 picts.zip

Even weirder: 1118 and 1119 render fine in Catalina (Preview, QuickLook, etc). 1120 does not (just shows white). The BMP output I got from (whatever managed to decode it) is correct (just shows blue).

image

My build of resource_dasm is from master on July 11, 2022. If any PICT stuff changed since then let me know and I'll try with the latest sources. (It's not super easy to build for me, for some reason.)

MikeRich88 commented 1 year ago

I was using a December 2021 build at first, which gave the first title, then I ran again with July 2022 build.

This is on Intel and Catalina, btw.

fuzziqersoftware commented 1 year ago

There were some recent changes to PICT decoding; if I recall correctly, some coordinates were computed incorrectly if the bounds rect wasn't anchored at (0, 0), and the region model was entirely rewritten to handle egregiously large regions gracefully. The new code is a bit slower in certain cases but substantially more correct; many more PICTs now render properly.

I downloaded the copy of Dude 2000 that you linked, and it appears that all of the PICTs are correctly decoded with the latest version. (Except for PICT 3001, which uses vector drawing commands... I'll get around to implementing those someday.)

MikeRich88 commented 1 year ago

Yeah I just built the latest version (because I noticed that the machine code disassembly stuff was separate, so I thought the build size of resource_dasm would be smaller). I opened a separate issue for that.

MikeRich88 commented 1 year ago

New Nov 12 2022 build confirmed, decodes everything except 3001.

You know what's wild? Catalina does render something for 3001... It's even sort of correct. If I recall, 3001 is basically the thick outer portion of a default push button in the System 7 style.

picttoppm is just rendering all white (does it handle vector? I know it handles text opcodes because I have other games that use that for the about window).

Catalina rendering PICT

image

Example of default button

image
MikeRich88 commented 1 year ago

59 for the build size stuff, closing this one