1. storm75x

    OP storm75x Remember that thing I don't remember? Yeah, that!
    Member

    Joined:
    Jan 3, 2015
    Messages:
    632
    Country:
    py3DSorter 1.01
    [​IMG]

    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.
     

    Attached Files:

  2. nosklo

    nosklo Member
    Newcomer

    Joined:
    Oct 16, 2010
    Messages:
    49
    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 +
     
    storm75x likes this.
  3. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!
    Member

    Joined:
    Nov 24, 2014
    Messages:
    3,161
    Country:
    Italy
  4. nosklo

    nosklo Member
    Newcomer

    Joined:
    Oct 16, 2010
    Messages:
    49
    Country:
    Brazil
    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.
     
  5. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!
    Member

    Joined:
    Nov 24, 2014
    Messages:
    3,161
    Country:
    Italy
    MMhhh i'll try to make it without moving and i'll see if i get it.
     
  6. storm75x

    OP storm75x Remember that thing I don't remember? Yeah, that!
    Member

    Joined:
    Jan 3, 2015
    Messages:
    632
    Country:
    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.
     
  7. nosklo

    nosklo Member
    Newcomer

    Joined:
    Oct 16, 2010
    Messages:
    49
    Country:
    Brazil
    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.
     
  8. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!
    Member

    Joined:
    Nov 24, 2014
    Messages:
    3,161
    Country:
    Italy
    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
    [​IMG]
     
  9. nosklo

    nosklo Member
    Newcomer

    Joined:
    Oct 16, 2010
    Messages:
    49
    Country:
    Brazil
    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.
     
  10. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!
    Member

    Joined:
    Nov 24, 2014
    Messages:
    3,161
    Country:
    Italy
    By deleting i want to say this infact Gateway Sorter use the same method to update sorting list.
     
  11. storm75x

    OP storm75x Remember that thing I don't remember? Yeah, that!
    Member

    Joined:
    Jan 3, 2015
    Messages:
    632
    Country:
    Updated with an executable file.
     
  12. yoshinatsu

    yoshinatsu GBAtemp Fan
    Member

    Joined:
    Sep 14, 2009
    Messages:
    384
    Country:
    Greece
    Finally, a sorting tool that works!! I've wanted this for a long time.
     
  13. storm75x

    OP storm75x Remember that thing I don't remember? Yeah, that!
    Member

    Joined:
    Jan 3, 2015
    Messages:
    632
    Country:
    Glad it helped out. Sorting was a bane to me too.
     
  14. Xenon Hacks

    Xenon Hacks GBAtemp Guru
    Member

    Joined:
    Nov 13, 2014
    Messages:
    7,413
    Country:
    United States
    Love this tool thank you so much
     
  15. Leslie White

    Leslie White GBAtemp Regular
    Member

    Joined:
    Feb 21, 2015
    Messages:
    230
    Country:
    France
    Works like a charm ! Thanks
     
  16. storm75x

    OP storm75x Remember that thing I don't remember? Yeah, that!
    Member

    Joined:
    Jan 3, 2015
    Messages:
    632
    Country:
    Hmm maybe I should make a universal ROM tool that sorts and do whatever.
    And this time, I will actually code in my comfortable coding language. :P
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - py3DSorter, [Release], sorter