wbfs2fat.py - WBFS to FAT32 conversion
© 2012 by PsyBlade - all rights reserved
http://gbatemp.net/t291320-wbfs2fat-py: http://gbatemp.net/t291320-wbfs2fat-py
version 0.9.0beta2 - 2013-01-03

Features:
   - converts a WBFS partition into a Fat32 partition - on the fly/in place
   - keeps Games as 4GiB splited ID6.wbfs files in wbfs folder
   - blazing fast - over 10GiB/s! (50GiB Test in 4.27s)
   - needs very little space on other drives
       only ~0.0125% of the partition size for Backup and RAM
   - Windows + Linux (with some adjustments everything that runs python)
   - both GUI and CLI available
   - designed with security in mind
       only modifies disk after all other computations
       creates backup of modified data

Requirements:
   Windows(.exe): nothing!
   Linux(.py): python (+PyQt4 for GUI)
   Windows(.py): python + pywin32 + WMI for python (+PyQt4 for GUI)
   Windows(Cygwin .py): Cygwin + its python package
   (The versions marked "update" need to be copied over the next earlier full version)


Usage GUI:
   run wbfs2fat without options (e.g. double click)
   Select partition from list
   Click "convert to Fat32"

Usage CLI:
   "wbfs2fat --help" to see all options
   "wbfs2fat -m scan" to list of all wbfs partitions
   "wbfs2fat -m convert <device>" to convert

FAQ:
   - yes Error 6 can be fixed - the msg even says how - see the error section below for details
   - no it does delete the games - that's the whole fucking point
   - no it's not Linux only - look at the edit dates of the posts
   - the first post is updated - the rest is not
   - uploading it to every pirate hoster is pointless - you can get it from me free of charge
   - I don't like it either and therefore forbid hosting it unless I give explicit permission
   - yes I know you are gonna ignore this
   - if you expect an answer from me you should post here - not in some other forum where I'm not registered
   - looking at the (implied) Q's of this FAQ make makes one wanna bang ones head against a wall
   - I still think it should be named "Tips for the mentally challenged" but apparently no one reads that


Exit Codes and Error descriptions:
   0: No Error 
       Everything went as expected

   1: General Error
       Something totally unexpected happened
       Post the output and ask

   2: Argument Error
       Check the command line options for typos and the like

   3: Not a WBFS partition (missing magic)
       Partition is probably not in WBFS format.
       If it really should be a WBFS at least the identifier in the header is missing.

   4: Unknown WBFS Version
       So far I only encountered versions 0 and 1.
       If other versions appear wbfs2fat needs to be updated first.

   5: additional free Blocks needed
       Conversion needs more free space.
       See chapter "Space" it the tutorial for details.

   6: WBFS is corrupted: Blocks used multiple Times
       Two or more games claim ownership of the same WBFS data, but only one can be right about it.
       That meant that at least parts of some games are corrupted.
       As possibly only a tiny part of a game was overwritten this may have gone unnoticed for years.

       This is caused by a known bug in the original version of the wbfs C library.
       If you delete a game using a manager, loader or whatever uses an affected library,
       parts of another game are marked as free too. If you add a game (even with a good lib)
       these parts are overwritten and the original game is corrupted.
       Unfortunately it is impossible to recover the data, delete and re-rip is the only way to fix it.

       wiimms "wwt" can figure out which game the block really belongs to and delete the corrupted ones.
       You need to download it and run it from a command-line.
       For details on how to do this see wit verify: http://wit.wiimm.de/wwt/cmd-verify.html

       If you can or want not do this there is another way.
       Run wbfs2fat with the "ignore-error-6" option. This will generate one copy of the affected block for
       each game that claims it. This will NOT fix nor identify the corrupted games.
       But it will allow you to go ahead while keeping your games in the same (bad) shape they are in now.

   7: permission denied
       wbfs2fat was unable to read any data from the partition.
       Most likely you simply lack the rights required to do so. Try running wbfs2fat as admin/root.
       And try closing all WBFS mangers because they sometimes lock the drives.
       Empty CD drives and the like can show this too.


Licence:
   wbfs2fat is copyrighted software, use it as such with the exceptions mentioned below  

   You may to download and use it free of charge.

   You are not allowed to host/sell/rent or in any other way provide it to others.
   (simply give them the 2. Link from below instead)
   In case this link stops working you are allowed to host unmodified versions till it works again.

   You may make changes to it for yourself.
   If you want to make them available to others you can only do so through me.
   (For now at least, given a serious contributor asks it I will consider a copyleft licence e.g. GPL.
   But I see no reason to read, understand and choose them right now)

   No warranty is given at all. Not even implied ones. If you want to be sure it does not eat you cat
   you will have to read the python files yourself.

Links:
Download wbfs2fat: http://www.unix-ag.uni-kl.de/~t_schmid/wbfs2fat/
Homepage/Discussion Thread: http://gbatemp.net/t291320-wbfs2fat-py
Detailed Tutorial/Howto: http://gbatemp.net/t292391-how-to-convert-from-wbfs-to-fat32-or-ntfs
GUI demo video: http://www.youtube.com/watch?v=2YqSNQnnvcI

If you have questions/suggestions/comments just ask. Especially patches are welcome.
