Skip to content

Commit 778872a

Browse files
committed
directory.update_entry_fields: follow address_mode
1 parent cfab1a2 commit 778872a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

psptool/directory.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,17 @@ def update_entry_fields(self, file: File, type_, size, offset):
187187
if my_entry.type == file.type:
188188
entry = my_entry
189189
break
190-
assert(entry is not None)
190+
assert (entry is not None)
191+
192+
if entry.address_mode == 2 or entry.address_mode == 3:
193+
offset -= self.buffer_offset
194+
195+
print(self.buffer_offset == self.get_address())
191196

192197
# 2. Update fields
193198
entry.type = type_
194199
entry.size = size
195-
entry.offset = offset - self.get_address()
200+
entry.offset = offset
196201
# todo: allow updating the address_mode which consists of two bytes right here
197202

198203
# 3. Update checksum

0 commit comments

Comments
 (0)