Homebrew [Release] Stupid simple 3ds python tools

froatsnook

Well-Known Member
OP
Newcomer
Joined
Mar 18, 2014
Messages
76
Trophies
0
Age
54
XP
758
Country
United States
As much as I like you guys, I try to avoid downloading random binaries to manage 3ds files as much as possible. I wrote a couple python scripts with the goal doing common tasks via drag and drop in windows explorer. They work for me. Maybe they'll work for you.

At the moment I have python 3.4 installed. They might work with older pythons but I haven't tested it. For python 2.x, at least a future print function import would be necessary. If there's any interest I'll fix them up.

rename.py:
Choose your file name format near the top of the file (mine is
Code:
target_format = "{id} - {name} {region} {filename}"
). Then drag and drop roms onto it. It will download the latest XML from 3ds.essh.co when it doesn't recognize a rom.

crc.py:
Drag and drop a rom onto it and it will print its CRC in the console. Useful for verifying untrimmed roms.

trim.py:
untrim.py:
Here you need rom_tool.exe in your path (or in the same directory as (un)trim.py). Drag and drop to trim, or drag and drop to untrim. The file is modified in place. But according to rom_tool.exe, it's a lossless operation so that shouldn't be an issue.

rename_save.py:
Drag a save file to rename from 0004000000XXXXXX.sav to something readable. Drag it back to change it back. Since titleids aren't unique (e.g. Pokemon X), you might see the wrong release name/id (but it should be sufficient for figuring out what game it is). I didn't test it on too many saves, so let me know if it doesn't work for some game.
 

Attachments

  • stupid simple 3ds tools.zip
    4.5 KB · Views: 302
  • stupid simple 3ds tools_V2.zip
    8.1 KB · Views: 313

Timburpton

Well-Known Member
Member
Joined
Nov 18, 2014
Messages
648
Trophies
0
Age
46
XP
580
Country
Yes. For example auto rename 000040000000.sav to Pokemon_Omega.sav when detect Pokemon_omega.3ds titleid as 000040000000
 

Timburpton

Well-Known Member
Member
Joined
Nov 18, 2014
Messages
648
Trophies
0
Age
46
XP
580
Country
The script work great after update python 3.4.2. It no work 2.7.8.

One other thing, how I modify rename.py so it'll rename format to Pokemon_X_USA.3ds instead of the 250 - Pokemon X - USA -AEVAD.3ds
 

froatsnook

Well-Known Member
OP
Newcomer
Joined
Mar 18, 2014
Messages
76
Trophies
0
Age
54
XP
758
Country
United States
First change target_format (top of file):

Code:
target_format = "{name}_{region}"
then you have to change sanitize_for_file_name (line 245). Something like this:
Code:
def sanitize_for_file_name(text):
    text = text.replace(": ", "_")
    text = text.replace(":", "_")
    text = text.replace(" ", "_")
    text = text.replace("!", "")
    text = text.replace("?", "")
    return text
 

Timburpton

Well-Known Member
Member
Joined
Nov 18, 2014
Messages
648
Trophies
0
Age
46
XP
580
Country
Thanks! That works!

I checked your python script and it retrieves the xml from 3ds.essh.co. Some titles not show up like some eshop games. Any way to add them? I think can edit titles.xml but your script fetches the title.xml each time.
 

froatsnook

Well-Known Member
OP
Newcomer
Joined
Mar 18, 2014
Messages
76
Trophies
0
Age
54
XP
758
Country
United States
Thanks! That works!

I checked your python script and it retrieves the xml from 3ds.essh.co. Some titles not show up like some eshop games. Any way to add them? I think can edit titles.xml but your script fetches the title.xml each time.


Is it just new stuff that isn't showing up?
 

froatsnook

Well-Known Member
OP
Newcomer
Joined
Mar 18, 2014
Messages
76
Trophies
0
Age
54
XP
758
Country
United States
For example denpamen does not show up and it's not that new

Do you mean 'THE "DENPA" MEN: They Came By Wave USA'? That is on 3ds.essh.co. Maybe you just need to remove the quotes in the file name:

Code:
def sanitize_for_file_name(text):
    text = text.replace(": ", "_")
    text = text.replace(":", "_")
    text = text.replace(" ", "_")
    text = text.replace("\"", "")
    text = text.replace("!", "")
    text = text.replace("?", "")
    return text
 

Timburpton

Well-Known Member
Member
Joined
Nov 18, 2014
Messages
648
Trophies
0
Age
46
XP
580
Country
Do you mean 'THE "DENPA" MEN: They Came By Wave USA'? That is on 3ds.essh.co. Maybe you just need to remove the quotes in the file name:

Code:
def sanitize_for_file_name(text):
    text = text.replace(": ", "_")
    text = text.replace(":", "_")
    text = text.replace(" ", "_")
    text = text.replace("\"", "")
    text = text.replace("!", "")
    text = text.replace("?", "")
    return text

This work good. Much thanks.
 

pattho

Member
Newcomer
Joined
Apr 6, 2015
Messages
6
Trophies
0
Age
44
XP
41
Country
United States
Excellent!
Thank you very much, was messing with the weird gui binaries with little luck and this did exactly the things I needed
 

cearp

瓜老外
Developer
Joined
May 26, 2008
Messages
8,722
Trophies
2
XP
8,491
Country
Tuvalu
why make a python script for checking the crc? why not just type 'crc32' in terminal if you are going to type out the python command?
but thanks, a python trimmer can come in handy! although i guess rom_tool would be faster because it is in C. it's hardly a random binary, it's made by 3dsguy and is open source, no need to reinvent the wheel and worry about things
 

pattho

Member
Newcomer
Joined
Apr 6, 2015
Messages
6
Trophies
0
Age
44
XP
41
Country
United States
I'm glad it was useful :).


Hey froatsnook,
Can you make a python script to replace private headers in the sky3ds template? They distribute an executable but would prefer python but I dont know how to do it

https://docs.python.org/2/library/string.html

Basically the 16 groups of two characters (hex bytes) above the 48 groups of FF need to be replaced by your private set of 16 hex bytes

Here is a snipit from sky3ds latest template.txt

Code:
** : KTR-P-CAFJ
 
SHA1: 2136BBF38844407133927BA84F567B4C0E814A63
00 00 00 00 C2 F0 02 90 C2 22 13 00 9E 23 61 DC
43 54 52 49 4D 41 47 45 00 00 00 00 00 00 00 00
E8 00 55 6E DC 52 75 E0 B8 72 57 D4 2A 1F F7 89
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
4B 54 52 2D 50 2D 43 41 46 4A 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 DA 6D
 
 
** : KTR-P-CAFP
 
SHA1: 7DB6EE2B8C06649D31AA2D5A69E05653722BE4E4
00 00 00 00 C2 F0 02 90 C2 22 13 00 E0 83 1F 7C
43 54 52 49 4D 41 47 45 00 00 00 00 00 00 00 00
72 29 98 09 08 8C 64 A6 1D D0 41 E5 FF 92 65 17
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
4B 54 52 2D 50 2D 43 41 46 50 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 BA 6F

So if my private header hex bytes were =
Code:
11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00


Then my template.txt would look like the below

Code:
** : KTR-P-CAFJ
 
SHA1: 2136BBF38844407133927BA84F567B4C0E814A63
00 00 00 00 C2 F0 02 90 C2 22 13 00 9E 23 61 DC
43 54 52 49 4D 41 47 45 00 00 00 00 00 00 00 00
E8 00 55 6E DC 52 75 E0 B8 72 57 D4 2A 1F F7 89
11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
4B 54 52 2D 50 2D 43 41 46 4A 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 DA 6D
 

cearp

瓜老外
Developer
Joined
May 26, 2008
Messages
8,722
Trophies
2
XP
8,491
Country
Tuvalu
Hey froatsnook,
Can you make a python script to replace private headers in the sky3ds template? They distribute an executable but would prefer python but I dont know how to do it

i'm pretty sure there already is a python sky tool, made by someone here, did you see/search for it? :)
-- or, did you see it and it is not what you want?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sonic Angel Knight @ Sonic Angel Knight: :ninja: