Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions psptool/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def main():
'-r idx: specifies rom_index (default: 0)',
'-d idx: specifies directory_index',
'-e idx: specifies file_index',
'-s file: specifies subfile (i.e. the new file contents)',
'-s file: specifies substitution file (i.e. the new file contents)',
'(optional to allow plain re-signs)',
'-o file: specifies outfile',
'-p file: specifies file-stub (e.g. \'keys/id\') for the re-signing keys',
'-a pass: specifies password for the re-signing keys'
Expand Down Expand Up @@ -239,7 +240,7 @@ def main():
if args.directory_index is not None and args.file_index is not None and args.outfile is not None:
file = psp.blob.roms[args.rom_index].directories[args.directory_index].files[args.file_index]

# Substituting an file is actually optional to allow plain re-signs
# Substituting a file is actually optional to allow plain re-signs
if args.subfile is not None:
with open(args.subfile, 'rb') as f:
sub_binary = f.read()
Expand Down
5 changes: 4 additions & 1 deletion psptool/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ def update_entry_fields(self, file: File, type_, size, offset):
if my_entry.type == file.type:
entry = my_entry
break
assert(entry is not None)
assert (entry is not None)

if entry.address_mode == 2 or entry.address_mode == 3:
offset -= self.buffer_offset

# 2. Update fields
entry.type = type_
Expand Down
2 changes: 1 addition & 1 deletion psptool/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def move_buffer(self, new_address, size):
current_address = self.get_address()
move_offset = new_address - current_address
self.buffer_offset += move_offset
self.buffer_size = int(ceil(size / self.ENTRY_ALIGNMENT)) * self.ENTRY_ALIGNMENT
self.buffer_size = size

# update all directories' headers that point to this entry
for directory in self.references:
Expand Down