Created
November 2, 2019 19:57
-
-
Save infval/fce9e5f5e04d627f567a96b1b5a7a0ec to your computer and use it in GitHub Desktop.
[PS2] Hana to Otome ni Shukufuku o: Harukaze no Okurimono | extractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import re | |
import pathlib | |
from struct import unpack | |
pathlib.Path('./EXTRACTED').mkdir(exist_ok=True) | |
with open("SLPM_552.63", "rb") as f: | |
bexe = f.read() | |
max_offset = 1736953856 | |
files = [] | |
prev_offset = -1 | |
offset = 0 | |
index = 0 | |
while offset * 2048 < max_offset and offset >= prev_offset: | |
prev_offset = offset | |
offset = unpack('<i', bexe[0x24B5D0+index+0:0x24B5D0+index+4])[0] | |
size = unpack('<i', bexe[0x24B5D0+index+4:0x24B5D0+index+8])[0] | |
index += 8 | |
files.append((offset,size)) | |
del files[-1] | |
with open("cd.bin", "rb") as f: | |
b = f.read() | |
for offset, size in files: | |
with open(f"./EXTRACTED/file{offset:010}.bin", "wb") as f: | |
f.write(b[offset * 2048:offset * 2048 + size]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment