Skip to content

Commit

Permalink
patterns: Parse supplementary volume descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
xZise committed Jan 22, 2025
1 parent cdb3d72 commit bf02423
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion patterns/iso.hexpat
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ struct DirectoryRecord {
padding[$ % 2];
};

fn GetSupplementaryEncoding() {
const u128 escapeSequencesOffset = 89 - 8;

str encoding = std::mem::read_string($ + escapeSequencesOffset, 0x20);
return encoding == "%/@\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|| encoding == "%/C\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
|| encoding == "%/E\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
};

struct VolumeDescriptor {
VolumeDescriptorTypes type;
char id[5];
Expand All @@ -120,7 +129,7 @@ struct VolumeDescriptor {
char setId[0x80];
char publisherId[0x80];
char preparerId[0x80];
char applicationId[0x80];
} else if (type == VolumeDescriptorTypes::SupplementaryVolume && GetSupplementaryEncoding()) {
char copyrightFileId[0x25];
char abstractFileId[0x25];
char bibliographicFileId[0x25];
Expand All @@ -129,6 +138,34 @@ struct VolumeDescriptor {
StrDateFormat expirationTime[[format("FormatStrDate")]];
StrDateFormat effectiveTime[[format("FormatStrDate")]];
u8 fileStructVersion;
} else if (type == VolumeDescriptorTypes::SupplementaryVolume) {
u8 flags;
be char16 systemId[0x10];
be char16 volumeId[0x10];
padding[8];
di32 spaceSize;
u8 escapeSequences[0x20];
di16 setSize;
di16 sequenceNumber;
di16 logicalBlockSize;
di32 pathTableSize;
PathTablePtr pathTableOffset;
DirectoryRecord rootDir;
be char16 setId[0x40];
be char16 publisherId[0x40];
be char16 preparerId[0x40];
be char16 applicationId[0x40];
be char16 copyrightFileId[0x12];
padding[1];
be char16 abstractFileId[0x12];
padding[1];
be char16 bibliographicFileId[0x12];
padding[1];
StrDateFormat creationTime[[format("FormatStrDate")]];
StrDateFormat modificationTime[[format("FormatStrDate")]];
StrDateFormat expirationTime[[format("FormatStrDate")]];
StrDateFormat effectiveTime[[format("FormatStrDate")]];
u8 fileStructVersion;
}
padding[0x800 - $ % 0x800];
};
Expand Down

0 comments on commit bf02423

Please sign in to comment.