Homebrew [Release] py3DSorter: ROM sorter for GW/MT Card

storm75x

Remember that thing I don't remember? Yeah, that!
OP
Member
Joined
Jan 3, 2015
Messages
632
Trophies
0
Location
__̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲͡ ̲__
Website
www.fort42.com
XP
920
Country
py3DSorter 1.01
bu0E8Sl.png

This is a simple but effective standalone Python scripts that allows you to sort 3DS ROMS on Gateway/MT Micro SD Cards.

Requirements
Python 3.4 or above

Instructions
Download and run py3DSorter.exe for Windows users. For non-Windows users however, extract the scripts attached to this thread and run it from Python IDLE 3.4, tkinter could not be ran normally.

Editing the scripts is allowed but don't forget to credit.

Big thanks to Mthodmn101 on Maxconsole for compiling it for Windows.
Download for Windows here: https://www.mediafire.com/?0mtwjw684n33154

As seen on MaxConsole.
 

Attachments

  • py3DSorter1.01.zip
    1.9 KB · Views: 360

nosklo

Well-Known Member
Newcomer
Joined
Oct 16, 2010
Messages
49
Trophies
0
XP
175
Country
Brazil
Thanks, it seems it works by creating a temporary folder, and moving all files inside it, and then moving them back in desired order.

My issue is that it seems to move each file inside the temp dir and back again, before starting the next file, so it will return to the same FAT entry and won't change the order!

I would change:

Code:
                for line in range(len(tmp_files)):
                    shutil.move(dir+tmp_files[line],dir+".temp_gw/"+tmp_files[line])
                    shutil.move(dir+".temp_gw/"+tmp_files[line],dir+tmp_files[line])

To:

Code:
                for filename in tmp_files:
                    shutil.move(os.path.join(dir, filename),os.path.join(dir, ".temp_gw", filename))
                for filename in tmp_files:
                    shutil.move(os.path.join(dir, ".temp_gw", filename), os.path.join(dir, filename))

That way it moves all files to the temp dir first, and then move back in order.

Another suggestion is to use os.path.join function to join paths, it works better than using +
 
  • Like
Reactions: storm75x

storm75x

Remember that thing I don't remember? Yeah, that!
OP
Member
Joined
Jan 3, 2015
Messages
632
Trophies
0
Location
__̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲͡ ̲__
Website
www.fort42.com
XP
920
Country
Thanks, it seems it works by creating a temporary folder, and moving all files inside it, and then moving them back in desired order.

My issue is that it seems to move each file inside the temp dir and back again, before starting the next file, so it will return to the same FAT entry and won't change the order!

I would change:

Code:
                for line in range(len(tmp_files)):
                    shutil.move(dir+tmp_files[line],dir+".temp_gw/"+tmp_files[line])
                    shutil.move(dir+".temp_gw/"+tmp_files[line],dir+tmp_files[line])

To:

Code:
                for filename in tmp_files:
                    shutil.move(os.path.join(dir, filename),os.path.join(dir, ".temp_gw", filename))
                for filename in tmp_files:
                    shutil.move(os.path.join(dir, ".temp_gw", filename), os.path.join(dir, filename))

That way it moves all files to the temp dir first, and then move back in order.

Another suggestion is to use os.path.join function to join paths, it works better than using +
Thank you for a feedback, I have implemented the change. This looks like a more refined way of doing things, however, I couldn't help but notice that it takes a split of a second longer to complete the operation.
 

nosklo

Well-Known Member
Newcomer
Joined
Oct 16, 2010
Messages
49
Trophies
0
XP
175
Country
Brazil
Thank you for a feedback, I have implemented the change. This looks like a more refined way of doing things, however, I couldn't help but notice that it takes a split of a second longer to complete the operation.

Are you sure? How did you measure? It shouldn't take longer, as the number of operations is the same in the end - only the order changed.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
Have you tried? Touching the file doesn't seem to change its position in the gateway menu here... Only moving it around does the trick.

Ok, i tested all possible file attributes changing and it seems that GW uses the same Sorting algorithm of GetFiles() func of .NET Framework 3.5 [ https://msdn.microsoft.com/en-us/library/4cyf24ss(v=vs.110).aspx ] so i don't know why but only physically deleting the file and replacing it could change their loading order. :/
Anyway, doing my tests, i create a quite similar program to py3DSorter in VB.Net.
If someone installed Microsoft .NET Framework 3.5 and doesn't want to install Python 3.4 just grab it here: https://mega.co.nz/#!oJ4kSLpB!b6d6k2TXISye7VpD-CuvKOtBLjrPGKOTgPurFue9sjE
sorter.png
 

nosklo

Well-Known Member
Newcomer
Joined
Oct 16, 2010
Messages
49
Trophies
0
XP
175
Country
Brazil
Ok, i tested all possible file attributes changing and it seems that GW uses the same Sorting algorithm of GetFiles() func of .NET Framework 3.5 [ https://msdn.microsoft.com/en-us/library/4cyf24ss(v=vs.110).aspx ] so i don't know why but only physically deleting the file and replacing it could change their loading order. :/
Anyway, doing my tests, i create a quite similar program to py3DSorter in VB.Net.
You don't have to delete the file. Just moving all files to a separate folder and moving them back in order does the trick. It is also faster than a copy, since the data is not actually moved, only the name of the file in the allocation table gets changed, so it is really fast.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
You don't have to delete the file. Just moving all files to a separate folder and moving them back in order does the trick. It is also faster than a copy, since the data is not actually moved, only the name of the file in the allocation table gets changed, so it is really fast.

By deleting i want to say this infact Gateway Sorter use the same method to update sorting list.
 

Xenon Hacks

Well-Known Member
Member
Joined
Nov 13, 2014
Messages
7,414
Trophies
1
Age
31
XP
4,700
Country
United States
Ok, i tested all possible file attributes changing and it seems that GW uses the same Sorting algorithm of GetFiles() func of .NET Framework 3.5 [ https://msdn.microsoft.com/en-us/library/4cyf24ss(v=vs.110).aspx ] so i don't know why but only physically deleting the file and replacing it could change their loading order. :/
Anyway, doing my tests, i create a quite similar program to py3DSorter in VB.Net.
If someone installed Microsoft .NET Framework 3.5 and doesn't want to install Python 3.4 just grab it here: https://mega.co.nz/#!oJ4kSLpB!b6d6k2TXISye7VpD-CuvKOtBLjrPGKOTgPurFue9sjE
sorter.png

Love this tool thank you so much
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    BigOnYa @ BigOnYa: :shit: "BigOnYa Shat Here - 11/14/24"