Skip to content

Commit

Permalink
Update binary.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Captian-obvious authored Oct 23, 2023
1 parent 032852f commit f997baa
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions pyrbxm/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,23 @@ def HasMetadata(self):
@property
def Metadata(self):
return self.META.Data if self.META else {}

##end
@property
def HasSharedStrings(self):
return self.SSTR is not None

##end
@property
def SharedStrings(self):
return self.SSTR.Strings if self.SSTR else {}

##end
@property
def HasSignatures(self):
return self.SIGN is not None

##end
@property
def Signatures(self):
return self.SIGN.Signatures if self.SIGN else []

##end
def deserialize(self, file):
stream = BinaryStream(file)
# Verify the signature of the file.
Expand All @@ -311,21 +311,18 @@ def deserialize(self, file):
raise ValueError(
"Provided file's signature does not match BinaryRobloxFile.MAGIC_HEADER!"
)

##endif
# Read header data.
(
self.Version,
self.NumClasses,
self.NumInstances,
self.Reserved,
) = stream.unpack("<HIIq")

# Begin reading the file chunks.
reading = True

self.Classes = [None] * self.NumClasses
self.Instances = [None] * self.NumInstances

while reading:
chunk = BinaryRobloxFileChunk()
chunk.deserialize(stream)
Expand All @@ -348,8 +345,13 @@ def deserialize(self, file):
self.LogError(
f"BinaryRobloxFile - Unhandled chunk-type: {chunk.ChunkType}!"
)
##endif
if handler:
chunk_stream = BinaryStream(BytesIO(chunk.Data))
chunk.Handler = handler
handler.deserialize(chunk_stream, self)
##endif
self.ChunksImpl.append(chunk)
##end
##end
##end

0 comments on commit f997baa

Please sign in to comment.