Skip to content

Commit

Permalink
move GameExecutable offset finder, switch ctr_toolkit link to release…
Browse files Browse the repository at this point in the history
…s, 2.13
  • Loading branch information
ihaveamac committed Apr 28, 2016
1 parent c9ddcd4 commit f242886
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions 3dsconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
workdir = "work" # temporary folder to store files in

#################
version = "2.13d"
version = "2.13"

helptext = """3dsconv.py ~ version %s
"convert" a Nintendo 3DS ROM to a CIA (CTR Importable Archive)
Expand Down Expand Up @@ -151,8 +151,8 @@ def bytes2int(string):
fail = False
if not testcommand("make_cia"):
print("! make_cia doesn't appear to be in your PATH.")
print(" you can build the source here:")
print(" https://github.com/ihaveamac/ctr_toolkit")
print(" you can find releases here:")
print(" https://github.com/ihaveamac/ctr_toolkit/releases")
fail = True
if fail:
print("- if you want to force the script to run,")
Expand Down Expand Up @@ -216,7 +216,9 @@ def bytes2int(string):
romf.seek(0x108)
tid = binascii.hexlify(romf.read(8)[::-1])
xorpad = os.path.join(xorpad_directory, "%s.Main.exheader.xorpad" % tid.upper())
romf.seek(0x418F)
romf.seek(0x120)
gamecxi_offset = bytes2int(romf.read(0x4)[::-1]) * mu
romf.seek(gamecxi_offset + 0x18F)
decrypted = int(binascii.hexlify(romf.read(1))) & 0x04
print("- processing: %s (%s)" % (rom[1], "decrypted" if decrypted else "encrypted"))
if noconvert:
Expand Down Expand Up @@ -282,8 +284,7 @@ def bytes2int(string):
new_exh_hash = hashlib.sha256(exh).hexdigest()

# Game Executable CXI
romf.seek(0x120)
gamecxi_offset = bytes2int(romf.read(0x4)[::-1]) * mu
# the offset is found earlier
print_v("- extracting Game Executable CXI")
romf.seek(0x124)
gamecxi_size = bytes2int(romf.read(0x4)[::-1]) * mu
Expand Down Expand Up @@ -393,4 +394,4 @@ def bytes2int(string):
print(" view the Decrypt9 README and download releases at")
print(" https://github.com/d0k3/Decrypt9WIP")
print("* done converting!")
print(" %i out of %i roms processed" % (processedroms, totalroms))
print(" %i out of %i roms processed" % (processedroms, totalroms))

0 comments on commit f242886

Please sign in to comment.