PEW File Format: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(part one edit)
Line 29: Line 29:
|}
|}


Although technically there should never be negetive values for many of the 16 bit & 32 bit values, it's 'safer' in programming terms to use signed datatypes as opposed to unsigned datatypes.
===XYPair===
XYPair
{
  ulong x,y;
}
===RGBAColor===
RGBAColor
{
  byte r,g,b,a;
}
===String===
String
{
  ulong  Length;
  Asciiz Characters;// null terminated regardless. Actual len = len+1;
----
----


Line 43: Line 57:
   POSEW60
   POSEW60
   {
   {
     structHeader                               Header;
     PoseHeader                               Header;
     int                                        NoOfObjectTypes;
     ulong                                    nObjectTypes;
     structObjectType[NoOfObjectTypes]         ObjectTypes;
     ObjectType                              ObjectTypes[nObjectTypes];
    short                                      Unknown;
     RoadNets                                RoadNets[...];
    short                                      Unknown;
     XYPair                  TerrainGridSize;
     short                                      RoadNetworkTypesIndicator;
     float                   TerrainGridHeights[TerrainGridSize];
    if(RoadNetworkTypesIndicator == 0)
     float                   BlueEdgeTerrainHeights[NoOfBlueFloats] ; //Always zero values.
    {
                                                  // NoOfBlueFloats = (TerrainGrid_X / 16) * TerrainGrid_X;
      int                                                NoOfRoadNetworkTypes;
      structRoadNetworkType[NoOfRoadNetworkTypes]        RoadNetworkTypes;
      int                                                NoOfCrossRoads;
      structCrossRoadType[NoOfCrossRoads]                 CrossRoadsTypes;
    }
    int                                        TerrainGrid_X;
     int                                        TerrainGrid_Z;
     float[TerrainGrid_Z,TerrainGrid_X]         TerrainGridHeights;
    int NoOfBlueFloats = (TerrainGrid_X / 16) * TerrainGrid_X;
     float[NoOfBlueFloats]                     BlueEdgeTerrainHeights; //Always zero values.
    int                                        Unknown;
    int NoOfObjects;
    structObject[NoOfObjects]                  Objects;
    int                                        NoOfLayers;
    structLayer[NoOfLayers]                    Layers;
    RoadNetworks; // Sort of defined, needs more work...
    int                                        NoOfBackgrounds;
    structBackground[NoOfBackgrounds]          Backgrounds;
    EndBlocks; // Sort of defined, needs more work...
  }
</nowiki></code>


----
    ulong                    Unknown;
 
     ulong                    NoOfObjects;
== Structures ==
     Object                  Objects[NoOfObjects];
 
     ulong                    NoOfLayers;
=== structObject ===
     Layer                    Layers[[NoOfLayers] ;
 
     RoadNetworks;           // Sort of defined, needs more work...
<code><nowiki>
     ulong                    NoOfBackgrounds;
  structObject
     Background              Backgrounds[NoOfBackgrounds] ;
  {
     EndBlocks;              // Sort of defined, needs more work...
      short Indicator;
      if (Indicator != 0)
      {
        short Unknown;
        int  InstanceId;
        float TransformColumn[3][4]; // described here to solidly illustrate to reader
                                    // this is a standard DirectX Transform matrix
                                    // but in COLUMN format;
        double ObjectRelativeSize;  // decimal percentage
        int NoOfCharsInInstanceName;
        ascii[NoOfCharsInInstanceName] InstanceName;
        float RelativeSurfaceElevation;
        byte[4] OutlineColour; // rgba 0xFFFF FFFF means 'default'
        byte[4] ObjectColour;  // rgba 0xFFFF FFFF means 'default'
        int ObjectTypeId;
      };
  };
</nowiki></code>
 
 
 
=== structLayer ===
 
<code><nowiki>
  struct structLayer
  {
     int NoOfCharsInLayerName1;
     ascii[NoOfCharsInLayerName1] LayerName1;
     int LayerSizeType;
     int NoOfCharsInLayerName2;
    ascii[NoOfCharsInLayerName2] LayerName2;
     short DefaultIndicator;
     int NoOfTerrainMaterials;
     if (NoOfTerrainMaterials != 0)
    {
      structTerrainMaterial[NoOfTerrainMaterials] TerrainMaterials;
     }
  }
</nowiki></code>
 
 
=== structTerrainMaterial ===
 
<code><nowiki>
  struct structTerrainMaterial
  {
    int Unknown;
    int NoOfCharsInMaterialName;
    ascii[NoOfCharsInMaterialName] MaterialName;
    int Unknown;
   }
   }
</nowiki></code>
</nowiki></code>


 
===PoseHeader===
 
Header
 
{
=== structObjectType ===
  char  Signature[7]; "POSEW59" or "POSEW60" note not null terminated
 
  bytes  Unknown[37];
}
===ObjectType===
<code><nowiki>
<code><nowiki>
   struct structObjectType
   ObjectType
   {
   {
     int                                            NoOfCharsInObjectModelFilename;
     String      ModelFilename; //"SomePrefixRoot\data\SomeFile.p3d\0"
    ascii[NoOfCharsInObjectModelFilename]          ModelFilename;
     String      ObjectTypeName;//"SomePrefixRoot\data\SomeFile\0"
     int                                            NoOfCharsInObjectName;
     ulong        ObjectClassId;
    ascii[NoOfCharsInObjectName]                  ObjectTypeName;
     RGBAColor    OutlineColour; // 0xFF:FF:FF:FF means 'default'
     int                                            ObjectClassId;
     RGBAColor    ObjectColour; // ditto
     byte[4]                                        OutlineColour; // rgba 0xFFFF FFFF means 'default'
     byte[4]                                        ObjectColour; // rgba 0xFFFF FFFF means 'default'


     switch (ObjectClassId)
     switch (ObjectClassId)
Line 171: Line 114:
     }
     }


     int                                            NoOfArtificialSubObjects;
     ulong                    nOfArtificialSubObjects;


     if (NoOfArtificialSubObjects != 0)
     ArtificialSubObject      ArtificialSubObjects[nOfArtificialSubObjects];
    {
      structArtificialSubObject[NoOfArtificialSubObjects]       ArtificialSubObjects;
    }


     int                                                        MarkerType; //See MarkerTypeEnum
     ulong                    MarkerType; //See MarkerTypeEnum


     int ObjectTypeId = VariousInfo.Offset(16).[4].ToInt; // The 4-bytes at offset 16 in the VariousInfo is the ObjectTypeId.
     ulong                    ObjectTypeId // VariousInfo.Offset(16).[4].ToInt; // The 4-bytes at offset 16 in the VariousInfo is the ObjectTypeId.
   }
   }
</nowiki></code>
</nowiki></code>
Line 187: Line 127:
::    The most important data is the ''ObjectTypeId'' found at the 16th byte and is an 4-byte int.
::    The most important data is the ''ObjectTypeId'' found at the 16th byte and is an 4-byte int.


=== structArtificialSubObject ===
====ArtificialSubObject====


<code><nowiki>
<code><nowiki>
   struct structArtificialSubObject
   ArtificialSubObject
   {
   {
     int NoOfCharsInArtificialSubObjectName;
     String  ArtificialSubObjectName;
    ascii[NoOfCharsInArtificialSubObjectName]    ArtificialSubObjectName;
     ulong    Something1;
     int Something1;
     ulong    Something2;
     int Something2;
     XYZTriplet StartEndPos[2];
     float[3][2] StartEndPosXYZ;
   }
   }
</nowiki></code>
</nowiki></code>
 
===RoadNets===
=== structRoadNetworkType ===
RoadNets
 
{
    ushort  IgnoreNets;
    if(IgnoreNets== 0)
    {
      ulong nRoads;
      Road  RoadTypes[nRoads];
      ulong nXRoads;
      XRoad XRoads[nXRoads];
    }
}
====Road====
<code><nowiki>
<code><nowiki>
   struct structRoadNetworkType
   Road
   {
   {
     int                                            NoOfCharsInRoadNetworkTypeName;
     String      NetworkTypeName;
    ascii[NoOfCharsInRoadNetworkTypeName]          NetworkTypeName;
     RGBA        KeyPartsColour;   // 0xFF:FF:FF:FF means 'default'
     byte[4]                                        KeyPartsColour; // rgba 0xFFFF FFFF means 'default'
     RGBA        NormalPartsColour; // ditto
     byte[4]                                        NormalPartsColour; // rgba 0xFFFF FFFF means 'default'
     ushort      FilledLine;       // 0x0000=No, 0x0100=Yes
     short                                          FilledLine; // 0x0000=No, 0x0100=Yes
     double       MaxAngle;         // degrees
     double                                         MaxAngle; // degrees
     double       MaxBankAngle;     // degrees
     double                                         MaxBankAngle; // degrees
     ulong        nStraights;
     int                                            NoOfStraightParts;
     RoadPart     Straights[nStraights] ;
     if (NoOfStraightParts != 0)
     ulong        nCurves;
     {
     RoadPart     Curves[nCurves];
      structRoadNetworkTypeStraightPart[NoOfStraightParts]       RoadNetworkTypeStraightParts;
     ulong        nSpecials;
     }
     RoadPart     Specials[nSpecials];
    int                                            NoOfCurveParts;
     ulong        nTerminators;
     if (NoOfCurveParts != 0)
     RoadPart     Terminators[nTerminators];
     {
      structRoadNetworkTypeCurvePart[NoOfCurveParts]       RoadNetworkTypeCurveParts;
     }
    int                                            NoOfSpecialParts;
     if (NoOfSpecialParts != 0)
     {
      structRoadNetworkTypeSpecialPart[NoOfSpecialParts]       RoadNetworkTypeSpecialParts;
     }
    int                                            NoOfTerminatorParts;
     if (NoOfTerminatorParts != 0)
     {
      structRoadNetworkTypeTerminatorPart[NoOfTerminatorParts]       RoadNetworkTypeTerminatorParts;
     }
     }
   }
   }
</nowiki></code>
</nowiki></code>


=== structRoadNetworkTypeStraightPart ===
=====RoadPart=====
 
   RoadPart   
<code><nowiki>
   struct structRoadNetworkTypeStraightPart
   {
   {
       int                                  NoOfCharsInStraightPartName;
       String  Name;
       ascii[NoOfCharsInStraightPartName]   StraightPartName;
       ulong   ObjectId;
      int                                  ObjectId;
       ushort  Type;
       short                                StraightPartType;
       ushort  CanChangeBankAngle; // not present for Curves
       short                                CanChangeBankAngle;
   }
   }
</nowiki></code>
===Object===
 
 
=== structRoadNetworkTypeCurvePart ===
 
<code><nowiki>
<code><nowiki>
   struct structRoadNetworkTypeCurvePart
   Object
   {
   {
      int                                  NoOfCharsInCurvePartName;
      ushort IsPresent;
      ascii[NoOfCharsInCurvePartName]     CurvePartName;
      if (IsPresent)
      int                                  ObjectId;
      {
      short                                CurvePartType;
        ushort Unknown;
   }
        ulong  InstanceId;
        float  TransformColumn[3][4]; // described here to solidly illustrate to reader
                                      // this is a standard DirectX Transform matrix
                                      // but in COLUMN format;
        double ObjectRelativeSize;   // decimal percentage
        String InstanceName;
        float  RelativeSurfaceElevation;
        RGBA  OutlineColour;
        RGBA  ObjectColour; 
        ulong  ObjectTypeId;
      };
   };
</nowiki></code>
</nowiki></code>


===Layer===


=== structRoadNetworkTypeSpecialPart ===
   Layer
 
<code><nowiki>
   struct structRoadNetworkTypeSpecialPart
   {
   {
      int                                  NoOfCharsInSpecialPartName;
    String LayerName1;
      ascii[NoOfCharsInSpecialPartName]    SpecialPartName;
    ulong  LayerSizeType;
      int                                  ObjectId;
    String LayerName2;
      short                                SpecialPartType;
    ushort DefaultIndicator;
      short                                CanChangeBankAngle;
    ulong  NoOfTerrainMaterials;
    TerrainMaterial TerrainMaterials[NoOfTerrainMaterials];
    }
   }
   }
</nowiki></code>


=== structRoadNetworkTypeTerminatorPart ===
====TerrainMaterial====


<code><nowiki>
<code><nowiki>
   struct structRoadNetworkTypeTerminatorPart
   TerrainMaterial
   {
   {
      int                                  NoOfCharsInTerminatorPartName;
    ulong  Unknown;
      ascii[NoOfCharsInTerminatorPartName] TerminatorPartName;
    String MaterialName;
      int                                  ObjectId;
    ulong  Unknown;
      short                                TerminatorPartType;
      short                                CanChangeBankAngle;
   }
   }
</nowiki></code>
</nowiki></code>
 
===Background===
 
=== structBackground ===
 
<code><nowiki>
<code><nowiki>
   struct structBackground
   Background
   {
   {
       int                                  NoOfCharsInBackgroundFilename;
       String BackgroundFilename;
      ascii[NoOfCharsInBackgroundFilename] BackgroundFilename;
       String BackgroundName;
       int                                  NoOfCharsInBackgroundName;
       float OffsetX;
      ascii[NoOfCharsInBackgroundFilename] BackgroundName;
       float OffsetY;
       float                               OffsetX;
       float SizeX;
       float                               OffsetY;
       float SizeY;
       float                               SizeX;
       ulong  Transparency;
       float                               SizeY;
       ulong  Visible;
       int                                  Transpareny;
       short                                Visible;
   }
   }
</nowiki></code>
</nowiki></code>


== Enums ==
== Enums ==

Revision as of 16:43, 9 February 2009

Template:unsupported-doc

Introduction

To do...

Legend

Type Description
byte 8 bit (1 byte)
short 16 bit signed short (2 bytes)
int 32 bit signed integer (4 bytes)
float 32 bit signed single precision floating point value (4 bytes)
double 64 bit signed single precision floating point value (8 bytes)
asciiz Null terminated (0x00) variable length ascii string
ascii fixed length ascii string(UTF-8)

XYPair

XYPair
{
 ulong x,y;
}

RGBAColor

RGBAColor
{
 byte r,g,b,a;
}

String

String
{
 ulong  Length;
 Asciiz Characters;// null terminated regardless. Actual len = len+1;

File Format

The following is a mix of pseudo-code and structure references that could be used to describe the file format of POSEW60.pew project design file.
Any naming definitions or naming conventions used may or may not be accurate.
  • This file format is principally used with Armed Assault v1.09 and later plus the ArmA Tools Suite Final release (v1.14).

POSEW60 { PoseHeader Header; ulong nObjectTypes; ObjectType ObjectTypes[nObjectTypes]; RoadNets RoadNets[...]; XYPair TerrainGridSize; float TerrainGridHeights[TerrainGridSize]; float BlueEdgeTerrainHeights[NoOfBlueFloats]  ; //Always zero values. // NoOfBlueFloats = (TerrainGrid_X / 16) * TerrainGrid_X; ulong Unknown; ulong NoOfObjects; Object Objects[NoOfObjects]; ulong NoOfLayers; Layer Layers[[NoOfLayers] ; RoadNetworks; // Sort of defined, needs more work... ulong NoOfBackgrounds; Background Backgrounds[NoOfBackgrounds] ; EndBlocks; // Sort of defined, needs more work... }

PoseHeader

Header
{
 char   Signature[7]; "POSEW59" or "POSEW60" note not null terminated
 bytes  Unknown[37];
}

ObjectType

ObjectType { String ModelFilename; //"SomePrefixRoot\data\SomeFile.p3d\0" String ObjectTypeName;//"SomePrefixRoot\data\SomeFile\0" ulong ObjectClassId; RGBAColor OutlineColour; // 0xFF:FF:FF:FF means 'default' RGBAColor ObjectColour; // ditto switch (ObjectClassId) { case ObjectClassEnum.Natural // 1 { byte[118] VariousInfo; } case ObjectClassEnum.Artificial // 2 { byte[118] VariousInfo; } case ObjectClassEnum.ArtificialAndDefinedInRoad // 5 { byte[118] VariousInfo; } case ObjectClassEnum.Road // 3 { byte[214] VariousInfo; } } ulong nOfArtificialSubObjects; ArtificialSubObject ArtificialSubObjects[nOfArtificialSubObjects]; ulong MarkerType; //See MarkerTypeEnum ulong ObjectTypeId // VariousInfo.Offset(16).[4].ToInt; // The 4-bytes at offset 16 in the VariousInfo is the ObjectTypeId. }

NB: While the 'VariousInfo' byte array is decernable at this time it essentially defines various floats, integers, transforms etc. that denote the 'default' and/or 'seed' values for a given ObjectType.
The most important data is the ObjectTypeId found at the 16th byte and is an 4-byte int.

ArtificialSubObject

ArtificialSubObject { String ArtificialSubObjectName; ulong Something1; ulong Something2; XYZTriplet StartEndPos[2]; }

RoadNets

RoadNets
{
   ushort   IgnoreNets;
   if(IgnoreNets== 0)
   {
      ulong nRoads;
      Road  RoadTypes[nRoads];
      ulong nXRoads;
      XRoad XRoads[nXRoads];
   }
}

Road

Road { String NetworkTypeName; RGBA KeyPartsColour; // 0xFF:FF:FF:FF means 'default' RGBA NormalPartsColour; // ditto ushort FilledLine; // 0x0000=No, 0x0100=Yes double MaxAngle; // degrees double MaxBankAngle; // degrees ulong nStraights; RoadPart Straights[nStraights] ; ulong nCurves; RoadPart Curves[nCurves]; ulong nSpecials; RoadPart Specials[nSpecials]; ulong nTerminators; RoadPart Terminators[nTerminators]; } }

RoadPart
 RoadPart     
 {
      String  Name;
      ulong   ObjectId;
      ushort  Type;
      ushort  CanChangeBankAngle; // not present for Curves
 }

Object

Object { ushort IsPresent; if (IsPresent) { ushort Unknown; ulong InstanceId; float TransformColumn[3][4]; // described here to solidly illustrate to reader // this is a standard DirectX Transform matrix // but in COLUMN format; double ObjectRelativeSize; // decimal percentage String InstanceName; float RelativeSurfaceElevation; RGBA OutlineColour; RGBA ObjectColour; ulong ObjectTypeId; }; };

Layer

 Layer
 {
   String LayerName1;
   ulong  LayerSizeType;
   String LayerName2;
   ushort DefaultIndicator;
   ulong  NoOfTerrainMaterials;
   TerrainMaterial TerrainMaterials[NoOfTerrainMaterials];
   }
 }

TerrainMaterial

TerrainMaterial { ulong Unknown; String MaterialName; ulong Unknown; }

Background

Background { String BackgroundFilename; String BackgroundName; float OffsetX; float OffsetY; float SizeX; float SizeY; ulong Transparency; ulong Visible; }

Enums

ObjectClassEnum

enum ObjectClassEnum { Natural = 1, Artificial = 2, ArtificialAndDefinedInRoad = 5, Road = 3 }

MarkerTypeEnum

enum MarkerTypeEnum { Rectangular = 0, Elliptical = 1 }