2323workdir = "work" # temporary folder to store files in
2424
2525#################
26- version = "2.13d "
26+ version = "2.13 "
2727
2828helptext = """3dsconv.py ~ version %s
2929"convert" a Nintendo 3DS ROM to a CIA (CTR Importable Archive)
@@ -151,8 +151,8 @@ def bytes2int(string):
151151 fail = False
152152 if not testcommand ("make_cia" ):
153153 print ("! make_cia doesn't appear to be in your PATH." )
154- print (" you can build the source here:" )
155- print (" https://github.com/ihaveamac/ctr_toolkit" )
154+ print (" you can find releases here:" )
155+ print (" https://github.com/ihaveamac/ctr_toolkit/releases " )
156156 fail = True
157157 if fail :
158158 print ("- if you want to force the script to run," )
@@ -216,7 +216,9 @@ def bytes2int(string):
216216 romf .seek (0x108 )
217217 tid = binascii .hexlify (romf .read (8 )[::- 1 ])
218218 xorpad = os .path .join (xorpad_directory , "%s.Main.exheader.xorpad" % tid .upper ())
219- romf .seek (0x418F )
219+ romf .seek (0x120 )
220+ gamecxi_offset = bytes2int (romf .read (0x4 )[::- 1 ]) * mu
221+ romf .seek (gamecxi_offset + 0x18F )
220222 decrypted = int (binascii .hexlify (romf .read (1 ))) & 0x04
221223 print ("- processing: %s (%s)" % (rom [1 ], "decrypted" if decrypted else "encrypted" ))
222224 if noconvert :
@@ -282,8 +284,7 @@ def bytes2int(string):
282284 new_exh_hash = hashlib .sha256 (exh ).hexdigest ()
283285
284286 # Game Executable CXI
285- romf .seek (0x120 )
286- gamecxi_offset = bytes2int (romf .read (0x4 )[::- 1 ]) * mu
287+ # the offset is found earlier
287288 print_v ("- extracting Game Executable CXI" )
288289 romf .seek (0x124 )
289290 gamecxi_size = bytes2int (romf .read (0x4 )[::- 1 ]) * mu
@@ -393,4 +394,4 @@ def bytes2int(string):
393394 print (" view the Decrypt9 README and download releases at" )
394395 print (" https://github.com/d0k3/Decrypt9WIP" )
395396 print ("* done converting!" )
396- print (" %i out of %i roms processed" % (processedroms , totalroms ))
397+ print (" %i out of %i roms processed" % (processedroms , totalroms ))
0 commit comments