From f242886989b5419933fb4c853ca331a408777967 Mon Sep 17 00:00:00 2001 From: ihaveamac Date: Wed, 27 Apr 2016 23:52:54 -0700 Subject: [PATCH] move GameExecutable offset finder, switch ctr_toolkit link to releases, 2.13 --- 3dsconv.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/3dsconv.py b/3dsconv.py index c8fbb06..b1bdf3e 100755 --- a/3dsconv.py +++ b/3dsconv.py @@ -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) @@ -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,") @@ -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: @@ -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 @@ -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)) \ No newline at end of file + print(" %i out of %i roms processed" % (processedroms, totalroms))