XWA Pilot File Author: Jagged Fel (jaggedfel621@gmail.com) Site: http://idmr.empirereborn.net Updated: 2010.08.01 ===== PLT Overview XWA added some and removed some from where XvT advanced the format. When all is said and done, we have a pilot file with a fixed-length of 0x2520C (149 KB). There's a lot of duplication in the format, some values duped only a couple bytes away from the original value. Just about the entire back half of the file is comprised of duplicated values, but this may be similar to TIE's backup function. XWA really makes it easy to check validation. ===== PLT Structure The following values are used through this and all of my file definitions unless otherwise specified: NAME LENGTH DESC ---- ------ ---- BOOL 1 0=false, 1=true BYTE 1 unsigned 8-bit SBYTE 1 signed 8-bit, [-128, +127] CHAR 1 ASCII character SHORT 2 signed Int16 INT 4 signed Int32 STR(*) * null-terminated string, * is a decimal number NOTE: Any byte locations that are between defined values and are not explicitly defined are deemed as Reserved(0), and have only been found to have zero values. Unknown bytes that have non-zero values have been called out in the structure. Rest assured you have everything here to piece together a mission file from scratch, but please note offsets if creating read/write procedures. -- 0x00000 FileHeader 0x000D2 INT[#] TodKillsByType 0x008CE INT[#] AzzameenKillsByType 0x010D2 INT[#] CombatKillsByType 0x018D2 INT[#] TodAssistsByType 0x020CE INT[#] AzzameenAssistsByType 0x028D2 INT[#] CombatAssistsByType 0x04996 INT[#] HumanKillsByRating 0x04D36 WeaponStats 0x04D6E CraftLosses 0x04F0A LastMission 0x0AD16 Mission[53] 0x10E9E PilotStatus 0x11446 TodScoreBlock 0x1148A INT[#] TodKillsByType2 0x12C8A INT[#] TodAssistsByType2 0x13C12 INT[#] CombatKillsByType2 0x160EE WeaponStats [duplicate] 0x1B2CE CombatScoreBlock 0x1DB12 INT[#] CombatAssistsByType2 0x1FBD6 INT[#] HumanKillsByRating2 0x1FFAE CraftLosses [duplicate] 0x20212 AzzScoreBlock 0x20A52 INT[#] AzzameenKillsByType 0x22252 INT[#] AzzameenAssistsByType 0x250FF STR(#) CombatFile -- struct FileHeader (size 0xD2) { 0x00 CHAR[14] PilotName 0x0E INT Unknown 0x4A CHAR[32] MultiplayerPilotName 0x6A CHAR[32] MultiplayerHostGame 0x9A INT PercentToNextRank 0x9E INT TodTotalScore 0xA2 INT AzzameenTotalScore 0xA6 INT CombatTotalScore 0xB6 INT Unknown 0xBA INT Unknown 0xBE INT CombatKills } struct WeaponStats (size 0x28) { 0x00 INT LasersHit 0x0C INT LasersTotal 0x18 INT WarheadsHit 0x24 INT WarheadsTotal } struct CraftLosses (size 0x###) { 0x000 INT Total 0x00C INT DueToCollisions 0x018 INT DueToStarships 0x024 INT DueToMines 0x0F0 INT[#] DueToHumansByRating } struct LastMission (size 0x5C2C) { // This is currently under review 0x0000 INT Score 0x0F84 INT BonusScore 0x0FB8 INT[#] KillsByType // Next may actually be a WeaponStats struct, changes size 0x5C1C INT LasersHit 0x5C28 INT LasersTotal } struct Mission (size 0x30) { // there's a couple other values in here, possibly attempts 0x00 INT Score 0x04 INT SecondsTaken 0x10 INT BonusScore } struct PilotStatus (size 0x###) { 0x000 INT Rating 0x004 INT Rank 0x008 INT CurrentMedal 0x00C INT Unknown 0x074 CHAR[32] Rating 0x0B2 CHAR[##] Name } struct TodScoreBlock (size 0x2C) { 0x00 INT Score2 0x08 INT BonusScore 0x0C INT Score3 0x10 INT Score4 0x24 INT Kills } struct CombatScoreBlock (size 0x24) { 0x00 INT Score2? 0x08 INT BonusScore? 0x0C INT Score3 0x18 INT Score4 0x20 INT Kills } struct AzzScoreBlock (size 0x30) { 0x00 INT Score2 0x08 INT BonusScore 0x0C INT Score3 0x14 INT Score4 0x2C INT Kills } ===== PLT Detail The format itself is fairly simple, as most of it is flled with INT arrays due to craft types or pilot ratings. The fixed filesize makes for easier construction, pilot files are much nicer to work with than missions. -- Fileheader -- The Fileheader block as usual just starts off the file with basic information. The pilot's name start's it off, and should be the filename without the extra zero. Some multiplayer strings, notably the default names of the games when creating or attempting to join. Some overall stats and scores, and what's a struct without a few values we don't know? Kill and Assist arrays starting with the X-Wing, and continuing through the entire craft listing. NOTE: it may be possible that it starts with an empty slot value, but the X-wing is called out as first useful. -- WeaponStats -- A nice small block (as are most here), this simply contains the laser and warhead data to calculate hit percentage. Ions do not appear to be tracked. -- CraftLosses -- The first four values here may be combined single player and multiplayer, but the ByRating array is MP only, as AI-controlled craft don't have MP ratings. -- LastMission -- This stores the stats of the last mission flown, may be the actual data shown at the post-mission briefing before you decide to accept or refly. Fairly simple; scores, kills and weapons. -- Mission -- This is the simple block that keeps track of the per-mission stats. To be honest I don't know what the mission limit actually is. There's definitely more than 53, as the original way to play custom missions was add them after the normal campaign. You might be able to extend the array all the way to the next struct. Okay, so for values there's the typical Score, then XWA keeps track of how long it takes you to fly the mission, then there's the Bonus Score. Easy. -- PilotStatus -- Not exactly sure how large this struct is, depends on the length of the Name string. Plenty of room after it, so I don't think it's not that much of a concern. Anyway, index values that are self-explanatory, and then for some reason the string of the rating value, then the pilot's name again. -- *ScoreBock -- These are all more or less the same, but for one reason or another have different spacing within the struct. These should be self-explanatory. -- Everything else is either a duplicate or variantion of a similar block and really doesn't need to be explained separately. As it is, I've chunked up the format further than really is necessary as it makes I/O a little easier to manage. So there you go, the XWA pilot file.