diff --git a/bios_extract/src/phoenix.c b/bios_extract/src/phoenix.c index faf3d57..4240d34 100644 --- a/bios_extract/src/phoenix.c +++ b/bios_extract/src/phoenix.c @@ -986,20 +986,21 @@ PhoenixExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset, /* BCPCMP parsing */ unsigned char *bcpcmp = memmem(BIOSImage, BIOSLength - 6, "BCPCMP", 6); - if (!bcpcmp) { - fprintf(stderr, "Error: Failed to locate BCPCMP offset.\n"); - return FALSE; + struct bcpCompress *bcpComp = NULL; + if (bcpcmp) { + uint32_t bcpoff = bcpcmp - BIOSImage; + bcpComp = (struct bcpCompress *)(BIOSImage + bcpoff); + phx.compression = bcpComp->alg; + if ((bcpComp->head.major_revision == 0) && (bcpComp->head.minor_revision == 0)) + phx.commonCharacterLZSS = bcpComp->alt.commonCharacterLZSS; + else + phx.commonCharacterLZSS = bcpComp->main.commonCharacterLZSS; + } else { + /* BCPCMP can be missing (Hitachi Flora 3100 - 4.04 for Corollary C-bus) */ + phx.compression = 0; + phx.commonCharacterLZSS = ' '; } - uint32_t bcpoff = bcpcmp - BIOSImage; - struct bcpCompress *bcpComp = - (struct bcpCompress *)(BIOSImage + bcpoff); - phx.compression = bcpComp->alg; - if ((bcpComp->head.major_revision == 0) && (bcpComp->head.minor_revision == 0)) - phx.commonCharacterLZSS = bcpComp->alt.commonCharacterLZSS; - else - phx.commonCharacterLZSS = bcpComp->main.commonCharacterLZSS; - Offset = le32toh(*((uint32_t *) (((char *)SYS) + 0x77))); Offset &= (BIOSLength - 1); if (!Offset) { @@ -1197,7 +1198,9 @@ PhoenixExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset, Offset = 0; Length = BIOSLength; } - if ((bcpComp->head.major_revision == 0) && (bcpComp->head.minor_revision == 0)) { + if (!bcpComp) { + /* ignore */ + } else if ((bcpComp->head.major_revision == 0) && (bcpComp->head.minor_revision == 0)) { Offset += le16toh(bcpComp->alt.unc_start_offset); Length -= le16toh(bcpComp->alt.unc_start_offset); } else {