================================================================================
 \ \  / (____  \                   _   (_)_   (_)                        
  \ \/ / ____)  )____   ____  ____| |_  _| |_  _  ___  ____   ____  ____ 
   )  ( |  __  (|  _ \ / _  |/ ___)  _)| |  _)| |/ _ \|  _ \ / _  )/ ___)
  / /\ \| |__)  ) | | ( ( | | |   | |__| | |__| | |_| | | | ( (/ /| |    
 /_/  \_\______/| ||_/ \_||_|_|    \___)_|\___)_|\___/|_| |_|\____)_|    
================| |=============================================================
                |_|                   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.1 - 30/05/2008

 Update by Bomb Bloke (see end of document for my moment on the soapbox).
 Cluster size update correction.
 Automatically uses 64k clusters when formatting > 512GB partitions,
 128k clusters when formatting > 1TB partitions, and so forth.
 (New system does not allow for users to 'toggle' cluster size via Y button).
 Switched display of megabytes to equal 1,048,576 bytes (1024^2).
 Extended partitions are now displayed in gigabytes.

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
 changed.

================================================================================
Keys:

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

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

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

 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

 Back................help
 

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

================================================================================
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


Formatting

 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).
 
 32k clusters solve the corruption problem many people have reported when
 using partitions larger then 256GB. As this is a cluster count limitation
 issue, 32k clusters allow partitions of up to 512GB. Above that, 64k
 clusters are used up to the 1TB mark, and so forth.
 
================================================================================
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.

================================================================================

-NghtShd

================================================================================
Additional notes from Bomb Bloke

 Thanks to wildonrio and Ainatap for testing, and especially to lordvader129 for
 likely doing most of the actual work while I mucked around without a compiler.

 And of course to NghtShd for writing what is still the only program out there
 that'll format a 256GB+ HDD to work with the original X-Box.

 This new version supports even larger cluster sizes to accommodate the huge
 HDDs that have started to appear on the market. FATX was only ever designed to 
 work with partitions of just a few GB in size and accepts only a limited number
 of clusters (using larger ones means less are required overall).

 Note that while it should let you install a drive of any capacity, efficiency 
 drops with each step up in cluster size. You'll get more on a drive split into
 multiple partitions that require smaller clusters then a drive that uses only
 a single partition but with larger clusters.

 Roughly you'll waste <cluster size> times <files on drive> divided by two in
 space. Fewer, larger files along with smaller clusters result in better
 efficiency.

 For those who wish to use very large drives, I would recommend looking into
 obtaining a Network Attached Storage in order to use a file system that isn't
 so limited.
 
 As the largest IDE drive out there (that I know of) is still only 750GB, some
 people have started to use adaptors to install SATA drives. While testing in
 this matter is still in it's early stages, let me warn you that most have met 
 with failure in that partitions either disappear or the console randomly gives 
 error codes.
 
 On the other hand, zx6r6 on the XS Forums recently pointed out that similar
 issues on PCs have been fixed by switching to an 80 wire IDE cable.

 One other problem people have reported re XBPartitioner is that the video
 display is sometimes stretched to something greater then that of their screen.
 In these cases you should check that your display settings in the MS Dash 
 match that of your television set's capabilities.
 
- Bomb Bloke