PHost generates this file from HULLFUNC.TXT, for use by other programs. PHost itself never reads this file. Your program, should it want to support this mechanism, can either read this file or manually parse HULLFUNC.TXT. For example, for older PCC, the `hullgen' utility converts HULLFUNC.TXT into HULLSPEC.CC (PCC started earlier than PHost 3).

 +0     DWORD   Signature B1297F35h (that is, 4 bytes 35h, 7Fh, 29h, B1h)
 +4     BYTE    PHost minor version
 +5     BYTE    PHost major version
 +6  32 BYTEs   Game name
+38     DWORD   Pointer to modified hull functions structure. Zero if none
                present.
+42     DWORD   Pointer to ship functions structure. Zero if none present.
                This field and the previous one were part of the following
                "reserved" field up to PHost 4.0k, and always zero.
+46   8 BYTEs   reserved
--- Functions assigned to hulls ---
+54     WORD    Number of records following
+56   n RECORDs Records of variable length
                 +0     WORD    Hull Number (1..105)
                 +2     WORD    Number of special functions assigned to
                                this hull
                 +4   n RECORDs of 4 bytes each
                                 +0     WORD    Special function; see below.
                                 +2     WORD    Player bitfield. Bits 1 to
                                                11 mark players who can use
                                                this function. Bits 0 and
                                                12..15 are undefined
--- Modified hull functions (only if pointer at +38 is nonzero) ---
 +?     WORD    Number of modified hull functions
 +?     WORD    Size of each modified hull function record
 +?   n RECORDs Records of variable length:
                 +0     WORD    Function Id.
                 +2     WORD    Basic function. See below for a list.
                 +4     WORD    Experience level mask (bit 0 = level 0 etc.)
                This is the same as UTILx.DAT record 57. New data may be
                appended to these records in the future.
--- Functions assigned to ships (only if pointer at +42 is nonzero) ---
 +?     WORD    Number of records following
 +?   n RECORDs Records of variable length
                 +0     WORD    Hull Number (1..105)
                 +2     WORD    Number of special functions
                 +4   n RECORDs of 4 bytes each
                                 +0     WORD    Special function
                                 +2     WORD    Player bitfield
                This is the same format as the Functions assigned to Hulls
                section. It describes functions assigned to ships when they
                are built.
--- Always ---
 +?   n BYTEs   Additional future data may follow here
 +?     DWORD   Signature 1F0C219Ah
 +?     DWORD   Checksum. This is the sum of all 2-byte words (interpreted
                as unsigned integers) in this file, excluding this DWORD.

The "Special function" field in a hull record may either be a number from the following table, or a modified function (modified with a Level assignment in HULLFUNC.TXT). Note that the assignments of the modified functions can change each turn, and need not necessarily correspond to the assignment in UTILx.DAT (because the player uses a HULLFUNC.DAT from a turn other than the current). The Function Ids from a modified hull function are taken from the reserved range.

The sections are always packed tightly together without gaps; the pointer is provided (instead of a simple binary flag) for programs to find it without having to parse the whole device assignments part. Possible future data may be added before the signature field.

Special functions

  Value | Function                      | Code for HULLFUNC.TXT
  ======|===============================|==============================
    0   | Merlin Alchemy                | Alchemy
    1   | Neutronic Refinery            | Refinery
    2   | Aries Alchemy                 | AdvancedRefinery
    3   | Terraforming (Bohemian)       | HeatsTo50
    4   | Terraforming (Eros)           | CoolsTo50
    5   | Terraforming (Onyx)           | HeatsTo100
    6   | Hyperdrive                    | Hyperdrive
    7   | Gravitonic Accelerators       | Gravitonic
    8   | Advanced Wormhole scanner     | ScansAllWormholes
    9   | Lady Royale                   | Gambling
   10   | Loki                          | AntiCloak
   11   | Super Star Destroyer          | ImperialAssault
   12   | Firecloud Chunnel             | Chunneling
   13   | Cobol Ramscoop                | Ramscoop
   14   | Bioscanner (Pawn)             | FullBioscan
   15   | Advanced Cloaking             | AdvancedCloak
   16   | Cloaking Device               | Cloak
   17   | Bioscanner (Brynhild/Cobol)   | Bioscan
   18   | Glory Device (Saber)          | GloryDeviceLowDamage
   19   | Glory Device (D19b)           | GloryDeviceHighDamage
 -------'-------------------------------'------------------------------
 PHost 4.0 and later:
 -------.-------------------------------.------------------------------
   20   | Unclonable                    | Unclonable
   21   | Clonable only once            | CloneOnce
   22   | Cannot be given away          | Ungiveable
   23   | Can be given away once        | GiveOnce
   24   | Stronger Tractor Beam         | Level2Tow
 -------'-------------------------------'------------------------------
 PHost 4.0i and later:
 -------.-------------------------------.------------------------------
   25   | Tractor beam                  | Tow
   26   | Can chunnel itself            | ChunnelSelf
   27   | Can chunnel other ships       | ChunnelOthers
   28   | Can act as a chunnel target   | ChunnelTarget
   29   | Immune to ATT / NUK           | PlanetImmunity
   30   | Increases ore density         | OreCondenser
   31   | Can board (tow-capture)       | Boarding
   32   | Immune to Lokis               | AntiCloakImmunity
   33   | Educates crew                 | Academy
   34   | Can repair other ships        | Repairs
   35   | Fully armed even if damaged   | FullWeaponry
   36   | Full speed even if damaged    | HardenedEngines
 -------'-------------------------------'------------------------------
 PHost 4.0j and later:
 -------.-------------------------------.------------------------------
   37   | Combat experience bonus       | Commander
   38   | Not affected by ion storms    | IonShield
   39   | Can cloak even if damaged     | HardenedCloak
 -------'-------------------------------'------------------------------
 PHost 4.0k and later:
 -------.-------------------------------.------------------------------
   40   | Advanced Anti-Cloak function  | AdvancedAntiCloak

Values up to 999 are reserved for future use by PHost, values above 999 are available to add-ons.

PHost 4.0i and later allows to define hull functions restricted to particular experience levels. Until 4.0l, however, these are not stored in HULLFUNC.DAT.

This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.