Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output with module name and allow drag and drop #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions ps2-bios-extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
#to-do: implement 16bytes padding in parseROMDIR function - ok
#to-do: make report file with numbers, names and offsets for packing modules back in to dump
#to-do: implement command line argument file opening and excetions
filename = 'rom.bin' ##type yours
#filename = 'rom.bin' ##type yours
import os
import sys
filename = sys.argv[1]


def romOPEN(romfile):
Expand Down Expand Up @@ -126,14 +127,16 @@ def extractModule(romfile, modules, module_number ):


romfile.seek(modules[module_number][1])
print(str(module_number)+".Module:" + str(modules[module_number][0]) + " extracted")
print(str(module_number)+".Module: [" + str(modules[module_number][0]) + "] extracted")
print(" Offset:"+hex(modules[module_number][1]))
print(" Size 16byte padding:"+hex(modules[module_number][2]))
print(" Size decimal:"+str(modules[module_number][2]))
print(" Size as in ROMDIR:"+hex(modules[module_number][3]))

module_out=romfile.read(modules[module_number][2])
f = open(str(module_number), "wb")
FILENAME = str(modules[module_number][0]).lstrip()

f = open(str(module_number) + "@" + FILENAME.rstrip('\x00'), "wb")
f.write(module_out)
f.close()

Expand All @@ -142,7 +145,6 @@ def extractModule(romfile, modules, module_number ):
#structROMDIR = {'name':10,'ext':2,'size':4}
#Формат записей в ROMDIR

#filename = 'rom.bin'

size=os.path.getsize(filename)
romfile=romOPEN(filename)
Expand Down