mirror of
https://github.com/86Box/bios-tools.git
synced 2026-02-22 01:25:34 -07:00
Fix extraction of partially-compressed Award 4.50
This commit is contained in:
@@ -39,6 +39,7 @@ AwardExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
|
||||
unsigned int BufferSize, PackedSize;
|
||||
char *filename;
|
||||
unsigned short crc;
|
||||
Bool First = TRUE;
|
||||
|
||||
printf("Found Award BIOS.\n");
|
||||
|
||||
@@ -48,6 +49,25 @@ AwardExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
|
||||
if (!p)
|
||||
break;
|
||||
p -= 2;
|
||||
|
||||
if (First) {
|
||||
First = FALSE;
|
||||
BufferSize = p - BIOSImage;
|
||||
if (BufferSize > 0) {
|
||||
filename = "awardboot.rom";
|
||||
printf("0x00000 (%6d bytes) -> %s\n",
|
||||
BufferSize, filename);
|
||||
|
||||
Buffer = MMapOutputFile(filename, BufferSize);
|
||||
if (!Buffer)
|
||||
return FALSE;
|
||||
|
||||
memcpy(Buffer, BIOSImage, BufferSize);
|
||||
|
||||
munmap(Buffer, BufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
HeaderSize = LH5HeaderParse(p, BIOSLength - (p - BIOSImage),
|
||||
&BufferSize, &PackedSize, &filename,
|
||||
&crc);
|
||||
@@ -69,5 +89,5 @@ AwardExtract(unsigned char *BIOSImage, int BIOSLength, int BIOSOffset,
|
||||
p += HeaderSize + PackedSize;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return !First;
|
||||
}
|
||||
|
||||
@@ -186,14 +186,14 @@ class BIOSExtractor(Extractor):
|
||||
# Bad data can cause infinite loops.
|
||||
pass
|
||||
|
||||
# Assume failure if nothing was extracted. A lone amiboot.bin also counts as a failure, since
|
||||
# the AMI extractor writes the boot block before attempting to extract any actual BIOS modules.
|
||||
# Assume failure if nothing was extracted. A lone boot block file also counts as a failure,
|
||||
# as the extractors produce them before attempting to extract any actual BIOS modules.
|
||||
dest_dir_files = os.listdir(dest_dir_0)
|
||||
num_files_extracted = len(dest_dir_files)
|
||||
if num_files_extracted < 1:
|
||||
return False
|
||||
elif num_files_extracted == 1 and dest_dir_files[0] in ('amiboot.rom', 'ssboot.rom'):
|
||||
# Remove amiboot so that the destination directory can be rmdir'd later.
|
||||
# Remove boot block file so that the destination directory can be rmdir'd later.
|
||||
try:
|
||||
os.remove(os.path.join(dest_dir_0, dest_dir_files[0]))
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user