Skip to content

Commit

Permalink
Handle $C1/0000 > 32KB
Browse files Browse the repository at this point in the history
A project under development is storing additional data in the
uncompressed PIC format, which is normally 32768 bytes.  IIgs
applications such as SuperConvert simply ignore everything past the
first 32KB.  We now do the same thing.

(I would argue that APF is a better way to handle this, but there's
no harm in leniency here, especially when it matches the behavior
of vintage applications.)
  • Loading branch information
fadden committed Dec 19, 2024
1 parent e6ce238 commit 07f4093
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions FileConv/Gfx/SuperHiRes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ protected override Applicability TestApplicability() {
if (DataStream == null) {
return Applicability.Not;
}
// Must be 32KB or we won't know what to do with it.
if (DataStream.Length != EXPECTED_LEN) {
return Applicability.Not;
}
// Official definition is 32KB PIC/$0000.
if (FileAttrs.FileType == FileAttribs.FILE_TYPE_PIC && FileAttrs.AuxType == 0x0000) {
return Applicability.Yes;
if (DataStream.Length == EXPECTED_LEN) {
return Applicability.Yes;
} else {
// A modern project is storing additional data in PIC/$0000 files. The
// image viewers on the IIgs (e.g. SuperConvert) tend to ignore everything
// past the first 32KB, rather than rejecting the file outright. Do the
// same thing here.
return Applicability.Probably;
}
}
// Must be 32KB or we won't know what to do with it.
if (DataStream.Length < EXPECTED_LEN) {
return Applicability.Not;
}
// Sometimes the aux type is set wrong.
if (FileAttrs.FileType == FileAttribs.FILE_TYPE_PIC) {
Expand Down

0 comments on commit 07f4093

Please sign in to comment.