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
@@ -20,9 +20,9 @@ class Sound:
|
||||
self.sound_max_dist = stream.read_float()
|
||||
self.sound_dist = stream.read_bool()
|
||||
self.sound_loop = stream.read_bool()
|
||||
self.sound_chance = stream.read_dword()
|
||||
self.sound_chance = stream.read_long()
|
||||
self.sound_interval = stream.read_float()
|
||||
self.sound_reserved = stream.read_dword()
|
||||
self.sound_reserved = stream.read_long()
|
||||
|
||||
def save_binary(self, stream: ResStream):
|
||||
stream.write_qword(self.sound_0)
|
||||
@@ -31,9 +31,9 @@ class Sound:
|
||||
stream.write_float(self.sound_max_dist)
|
||||
stream.write_bool(self.sound_dist)
|
||||
stream.write_bool(self.sound_loop)
|
||||
stream.write_dword(self.sound_chance)
|
||||
stream.write_long(self.sound_chance)
|
||||
stream.write_float(self.sound_interval)
|
||||
stream.write_dword(self.sound_reserved)
|
||||
stream.write_long(self.sound_reserved)
|
||||
|
||||
def load_json(self, data):
|
||||
self.sound_0 = data['sound_0']
|
||||
|
||||
Reference in new issue
Block a user