Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snavig BPal blorbs not backwards compatible with Frotz #2

Open
dfabulich opened this issue Aug 23, 2024 · 4 comments
Open

snavig BPal blorbs not backwards compatible with Frotz #2

dfabulich opened this issue Aug 23, 2024 · 4 comments

Comments

@dfabulich
Copy link

Such Blorb files are backward compatible: they contain all information in the original Blorb plus the BPal chunk.

To repro:

Expected: snavig blorb files are supposed to be backwards compatible, so this blorb should work in Frotz.
Actual: Frotz crashes with an error. "Frotz Fatal Error: Non-paletted graphics cannot be adaptive"

My goal was to create a single-file blorb that would work well in Glk interpreters or in Frotz, and primarily link to that highly compatible blorb on IFDB, but that doesn't seem to work.

@cspiegel
Copy link
Owner

I think this is an implementation issue in Frotz (which also affects Windows Frotz: it doesn't abort but also doesn't use the adaptive palette). It's a result of compressing the images. The Frotz code effectively does this:

if (m_adaptiveMode && (color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth <= 4) {
    // use adaptive palette;
} else if is_adaptive {
    abort("non-paletted graphics cannot be adaptive");
}

But this is checking both for paletted images and images 4 bits or less. The compression code in Snavig will sometimes generate 8-bit images, and this is causing Frotz to fail. The Blorb specification says this about the adaptive palette:

However, the following rules still apply from the PNG standard:

  • Any bit depth of PNG is valid (1, 2, 4, or 8 bits per pixel).

So technically speaking the Blorbs generated are valid, but since the Infocom Blorbs have contained 4-bit images since the dawn of time, Frotz is apparently making the assumption that they must be 4 bits. The quick fix here is to not use -c, but I can also modify things to prevent compression by default with Blorbs that contain an adaptive palette chunk.

@cspiegel
Copy link
Owner

I found another Frotz issue with embedded stories in Blorbs. It's not visible in Zork Zero as the message gets overwritten, but you can see it in Arthur. Frotz says:

Warning: @draw_picture called but picture resources are missing (PC = 4fd) (will ignore further occurrences)

It's not fatal, so is just cosmetic, but it's an issue with Frotz assuming pictures will always come from an external Blorb file, and not from an embedded story.

I've added two new issues to Frotz's tracker, one for the adaptive palette, and one for this "missing resources" issue.

@dfabulich
Copy link
Author

Cross-linking those issues here:

@cspiegel
Copy link
Owner

I've also filed a report against Windows Frotz at DavidKinder/Windows-Frotz#34.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants