\ \  / (____  \                   _   (_)_   (_)                        
  \ \/ / ____)  )____   ____  ____| |_  _| |_  _  ___  ____   ____  ____ 
   )  ( |  __  (|  _ \ / _  |/ ___)  _)| |  _)| |/ _ \|  _ \ / _  )/ ___)
  / /\ \| |__)  ) | | ( ( | | |   | |__| | |__| | |_| | | | ( (/ /| |    
 /_/  \_\______/| ||_/ \_||_|_|    \___)_|\___)_|\___/|_| |_|\____)_|    
================| |=============================================================
                |_|                   Xbox Hard Drive Partitioner and Formatter

Thanks to h3inrich, kl0wn, and oz_paulb.
Thanks to www.modchipsource.com for donation of a 250GB drive.

Version 1.0

Fixed a bug which wouldn't allow writing of table or formatting under
non-compliant kernels.

Version 1.0RC1

 No longer warns on LBA48 version 2, since it works around the ver 2 bug.
 Will allow single partition formatting on X2 4979-4981.
 Automatically uses 32k clusters when formatting > 256GB partitions.
 Cluster size used displayed when formatting.
 Fixed some UI bugs.
Version 0.9

 Option to format with 32k clusters.
 Partition start position can be changed.
 Left thumb stick fine resize control.
 More presice partition size control.
 Non-proportional font for table display.
 Button function changes (see help screen).
 UI tweaks.
 Other internal code changes.
 Bug causing some partition info to not update when using quick setup buttons.

Version 0.8.5

 Wrong number displayed when formatting single partition.
 (Only a display error. The correct partition formatted.)
 Format all changed partitions skipped partitions 1-5.

Version 0.8

 Can now edit partitions 0-5.
 Partitions can be enabled out of order.
 Start button action selection.
 Added button combo for undo.
 More UI tweaks and bug fixes.

Version 0.7

 UI updated.
 Help screen updated.
 Fixed failure to format some partitions.
 UI and input fixes and tweaks.
 Thanks to kl0wn (DIE! Mr. kl0wn!) for graphics help.

Version 0.6

 UI updated.
 Allows custom sizes for partitions 6-14.
 Function to distribute space equally among enabled partitions.
 Enabled partition table writing on version 2 LBA48 patch.
 Drawing code updated.
Version 0.5

 Added drive formatting toggle (thanks to h3inrich for help).
 Big warning before formatting.
 No longer uses font files (thanks to h3inrich for making me do that =).
 No longer needs to reboot after changing partitions.

Version 0.4

 Only adds display of the LBA48 version. I know that's a minor change
 for an update, but if anyone reports a problem getting it to work this info
 will be important.

This is NOT partition magic. If you change a partition it should be formatted.
If you format a partition all data will be lost on that partition. The built-in
formatter will not format unchanged partitions.

* The single partition format action doesn't check whether the partition has


 A...................Cycle through quick setup schemes

 B...................distribute allocated and free space among extended

 X...................toggle change size \ change start sector

 Y...................toggle cluster size for single partition format

 L-Trigger...........increase partition size

 R-Trigger...........decrease partition size

 D-Pad-Left..........increase partition size by 1GB

 D-Pad-Right.........decrease partition size by 1GB

 R-Thumb.............enable\disable current partition

 L+R Thumb Buttons...undo all changes since last write

 Black...............erase partition table

 White...............select Start Button action

 Start...............write & format changed partitions \ write only \ format
                     selected partition depending on current mode


You will always be asked for confirmation before anything is written to the

Quick setup schemes are:

 F takes everything above the standard partitions up to 129GB \ no G
 F takes everything above the standard partitions
 F takes everything above the standard partitions up to 129GB \ G takes rest
 F & G split everything above the standard partitions


 If in 'write and format mode' all changed partitions will be formatted.
 Partitions which haven't been changed won't be formatted.
 If in 'format mode' only the currently highlighted partition will be formatted
 (regardless of whether it has been changed or not). In 'format mode' the Y
 Button toggles between 16k and 32k clusters.
 32k clusters may solve the corruption problem some people have reported when
 using 06 BIOS's on 300GB and larger drives. Assuming this is a cluster count
 limit, 32k cluster would allow partitions of up to 512GB.
Supported BIOS's

 Current BIOS's which can read the partition table from disk are X2 4976.02,
 x2 4977, Evox D6, Evox M7 and Evox M8. These BIOS's need to be patched with
 XBtool  or EVtool for LBA48 support before they can read the partition table.

 Team X-ecuter has announced that they will support on-disk partition tables in
 their future releases.

XBpartitioner should run under most any BIOS, LBA48 patch version 2 is
supported, but it is recommended that you update to version 3 if you are using a
patched kernel.

Changing partitions 2, 3, 4, and 5 is not recommended.

Changing partition 1 should be safe, but you shouldn't use a BIOS which doesn't
read the partition table from the disk if you do this. That means all non LBA48
BIOS's and X2 4979 and up should NOT be used with a modified partition 1.

The LBA48 info checking code in XBpartitioner is mostly copied from a post made
by Paul Bartholomew on xbox-scene.com. 

Source code included.