Read client signed int32 fields as signed
Add ResStream.read_long/write_long and use them for every CObjects field the client loads with ResStream_ReadInt32 (sb.exe 0x7E1700) as a value: rank info, attribute/skill/resource amounts, requirements, door/deed/container/key fields, natural attacks, hardpoints, sound event types and sparse VAL_LONG (LoadSaveBehavior<long>). Hash/enum fields, list counts and flag words keep unsigned reads. The binary is unchanged; JSON now shows e.g. -1 instead of 4294967295 (rank_hirelings, rank_rank) and -10 instead of 4294967286 (attr_adj). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6a8598f33f
commit
0adbfe0d99
14 files changed
+190
-182
No files matched your search
@@ -30,7 +30,7 @@ class Inventory:
|
||||
elif self.inventory_type == INVENTORY_TYPE_BOOTYTABLE:
|
||||
self.inventory_table = [
|
||||
stream.read_float(),
|
||||
stream.read_dword(),
|
||||
stream.read_long(),
|
||||
]
|
||||
|
||||
def save_binary(self, stream: ResStream):
|
||||
@@ -44,7 +44,7 @@ class Inventory:
|
||||
stream.write_qword(self.inventory_items[1])
|
||||
elif self.inventory_type == INVENTORY_TYPE_BOOTYTABLE:
|
||||
stream.write_float(self.inventory_table[0])
|
||||
stream.write_dword(self.inventory_table[1])
|
||||
stream.write_long(self.inventory_table[1])
|
||||
|
||||
def load_json(self, data):
|
||||
self.inventory_type = STRING_TO_INVENTORY_TYPE[data['type']]
|
||||
|
||||
@@ -23,7 +23,7 @@ class SparseData:
|
||||
value = None
|
||||
|
||||
if sparse_type == SPARSE_VAL_LONG:
|
||||
value = stream.read_dword()
|
||||
value = stream.read_long()
|
||||
|
||||
elif sparse_type == SPARSE_VAL_FLOAT:
|
||||
value = stream.read_float()
|
||||
@@ -65,7 +65,7 @@ class SparseData:
|
||||
|
||||
sparse_type = SPARSE_TAG_TO_SPARSE_TYPE[tag]
|
||||
if sparse_type == SPARSE_VAL_LONG:
|
||||
stream.write_dword(value)
|
||||
stream.write_long(value)
|
||||
|
||||
elif sparse_type == SPARSE_VAL_FLOAT:
|
||||
stream.write_float(value)
|
||||
|
||||
Reference in new issue
Block a user