Accept unsigned values in signed fields when packing
Dumps made before the signed-read change store values like -1 as 4294967295. write_long now converts 2147483648..4294967295 to the signed equivalent (same bytes), so existing community dumps still pack. Verified: all 10332 files of an older dump repack identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
50d8d76a21
commit
7bcbed08a8
2 files changed
+8
-7
No files matched your search
@@ -77,6 +77,9 @@ class ResStream:
|
||||
self.buffer.write(data)
|
||||
|
||||
def write_long(self, value):
|
||||
# Older dumps stored signed fields as unsigned; both forms are the same bytes.
|
||||
if 0x7FFFFFFF < value <= 0xFFFFFFFF:
|
||||
value -= 0x100000000
|
||||
data = struct.pack('<i', value)
|
||||
self.buffer.write(data)
|
||||
|
||||
|
||||
Reference in new issue
Block a user