Difference between revisions of "Game.dtz"

From GTAMods Wiki
Jump to navigation Jump to search
m (LCS)
m
 
(23 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''GAME.DTZ''' ('''D'''a'''T'''a '''Z'''lib) is a file regarding PS2 and PSP versions of [[GTA LCS]] and [[GTA VCS]]. It contains data files, as well as main textures and models analogue to existing 3D era games compiled in binary form. It is compressed using the zlib/deflate algorithm [http://zlib.net/zlib] (max compression). Its contents can be viewed using any zlib compression/decompression utility, such as offzip [http://aluigi.altervista.org/mytoolz/offzip.zip] and zdrop, though some can be viewed with DTZ Editor [http://www.mediafire.com/file/ubcu958tgb9k79a/DTZ+EDitor.rar], a tool made by [[Dageron]]. ''All info provided is about decompressed version''
+
'''GAME.DTZ''' ('''D'''a'''T'''a '''Z'''lib) is a file in PS2 and PSP versions of [[GTA LCS]] and [[GTA VCS]]. It contains data files, as well as main textures and models analogue to existing 3D era games compiled in binary form. It is compressed using the zlib/deflate algorithm [http://zlib.net/zlib] (max compression). It can be decompressed by any zlib compression/decompression utility, such as offzip [http://aluigi.altervista.org/mytoolz/offzip.zip] and zdrop [https://cdn.discordapp.com/attachments/338352146946981889/442752002993160222/zdrop.exe]. Data can be extracted by [[guard3]]'s DTZpy [http://gtaforums.com/topic/908702-dtzpy/], though textures and some data files can be manipulated with [[Dageron]]'s DTZ Editor [http://www.mediafire.com/file/ubcu958tgb9k79a/DTZ+EDitor.rar]. ''All info provided is about decompressed version''
 
==Header==
 
==Header==
The '''Header''' for both [[GTA LCS]] and [[GTA VCS]] versions is defined like so:
+
The '''Header''' for both [[GTA LCS]] and [[GTA VCS]] versions is nothing but a standard '''Relocatable Chunk''' header, defined like so:
 
  <nowiki>
 
  <nowiki>
0x0  [4b] "GTAG" signature
+
struct base::sChunkHeader
0x4  [4b] 1, unknown
+
{
0x8  [4b] size of decompressed file
+
uint32 ident;
0xC  [4b] ?
+
uint32 shrink;
0x10  [4b] offset to global table of offsets
+
uint32 fileEnd;
0x14  [4b] number of offsets in global table
+
uint32 dataEnd;
0x18  [4b] same as 0xC
+
uint32 relocTab;
0x1C  [2b] ?
+
uint32 numRelocs;
0x1E  [2b] ?</nowiki>
+
uint32 globalTab;
 
+
uint16 numClasses;
 +
uint16 numFuncs;
 +
};</nowiki>
 +
More info on [[Relocatable chunk]]
 
===LCS Version===
 
===LCS Version===
 
{{stub}}
 
{{stub}}
Line 26: Line 29:
 
0x38  number of offsets in IDE table
 
0x38  number of offsets in IDE table
 
0x3C  offset to IDE table
 
0x3C  offset to IDE table
0x40  car class table (poorfamily, etc.)
+
0x40  offset to car class table 1
0x44  number of cars in each class
+
0x44  offset to car class table 2
 
0x48  offset to GTA3.ZON
 
0x48  offset to GTA3.ZON
 
0x4C  0, ?
 
0x4C  0, ?
Line 50: Line 53:
 
0x98  number of CULL.IPL "lines"
 
0x98  number of CULL.IPL "lines"
 
0x9C  offset to CULL.IPL
 
0x9C  offset to CULL.IPL
0xA0  number of OCCLU.IPL (0 in VCS)
+
0xA0  number of OCCLU.IPL �lines� (0 in VCS)
 
0xA4  offset to OCCLU.IPL (0 in VCS)
 
0xA4  offset to OCCLU.IPL (0 in VCS)
 
0xA8  offset to WATERPRO.DAT
 
0xA8  offset to WATERPRO.DAT
Line 66: Line 69:
 
0xD8  ?
 
0xD8  ?
 
0xDC  0, ?
 
0xDC  0, ?
0xE0  offset to FRONTENT.TEX (zlib/deflate compressed)
+
0xE0  offset to MENU.XTX (zlib/deflate compressed)
 
0xE4  ?
 
0xE4  ?
 
0xE8  ?
 
0xE8  ?
 
0xEC  ?
 
0xEC  ?
 
0xF0  ?
 
0xF0  ?
0xF4  ?
+
0xF4  offset to font data
0xF8  size of decompressed FONTS.TEX
+
0xF8  size of decompressed FSFONTS.XTX
0xFC  offset to FONTS.TEX (zlib/deflate compressed)
+
0xFC  offset to FSFONTS.XTX (zlib/deflate compressed)
 
0x100 offset to radar textures offset table</nowiki>
 
0x100 offset to radar textures offset table</nowiki>
 
==Table of Analogy==
 
''Needs some serious editing''
 
{|{{Prettytable}}
 
! Description
 
! Analogy
 
! Offset
 
! Notes
 
|-
 
| colspan="4" | <b>Textures</b>
 
|-
 
| textures of menu
 
| frontend.txd
 
| <code> LCS PS2: 0x4E4A30 </code>
 
<code> LCS PSP: 0x4DA830 </code>
 
 
<code> VCS PS2: 0x581330 </code>
 
 
<code> VCS PSP: 0x51D95C </code>
 
| contain texture of menu, packed deflate/zlib algorithm (*)
 
|-
 
| texture of fonts
 
| fonts.txd
 
| <code> LCS PS2: 0x4EF4D8 </code>
 
<code> LCS PSP: 0x4E2B1C </code>
 
 
<code> VCS PS2: 0x57BE4C </code>
 
 
<code> VCS PSP: 0x530AFC </code>
 
| also packed deflate/zlib algorithm (*)
 
|-
 
| particle effects
 
| particle.txd
 
| LCS PS2: <code>0x4A1C28</code>
 
 
LCS PSP: <code>0x38AB90</code>
 
 
VCS PS2: <code>0x761F0</code>
 
 
VCS PSP: <code>0x3F7FB0</code>
 
| contain all textures of particle effect (*)
 
|-
 
| generic-textures
 
| generic.txd, wheels.txd, vehicle.txd
 
| LCS PS2: <code>0x4A1BFC</code>
 
 
LCS PSP: <code>0x392B04</code>
 
 
VCS PS2: <code>0x539E0</code>
 
 
VCS PSP: <code>0x3D60B4</code>
 
| contains general textures for cars and all the textures of wheels (*)
 
|-
 
| radar icons
 
| hud.txd
 
| LCS PS2: <code>0x4A1BE4</code>
 
 
LCS PSP: <code>0x38AD30</code>
 
 
VCS PS2: <code>0x287B0</code>
 
 
VCS PSP: <code>0x3B4678</code>
 
| contain icons for hud (*)
 
|-
 
| texture of radar
 
| radarNN.txd
 
|
 
| Contain textures for radar
 
|-
 
| colspan="4" | <b>Animation</b>
 
|-
 
| ?
 
| ped.ifp
 
|
 
|
 
|-
 
| ?
 
| swim.ifp
 
|
 
| only in [[GTA VCS]]
 
|-
 
| ?
 
| fight.ifp
 
|
 
| only in [[GTA VCS]]
 
|-
 
| ?
 
| driveby.ifp
 
|
 
| only in [[GTA VCS]]
 
|-
 
! [[IMG|DIR]]-files
 
|-
 
| for cuts.img
 
| cuts.dir
 
|
 
| not working
 
|-
 
| for GTA3PS2.IMG
 
| GTA3PS2.dir
 
|
 
| specific for stories, doesn't contain the names.
 
|-
 
| colspan="4" | <b>Collision</b>
 
|-
 
| ?
 
| peds.col
 
|
 
| peds.col2
 
|-
 
| ?
 
| vehicles.col
 
|
 
| vehicles.col2
 
|-
 
| ?
 
| weapons.col
 
|
 
| weapons.col2
 
|-
 
| colspan="4" | <b>Models</b>
 
|-
 
| model of plane
 
| air_vlo.dff
 
|
 
| air_vlo.mdl
 
|-
 
| model of arrow
 
| arrow.dff
 
|
 
| arrow.mdl
 
|-
 
| model of wheels
 
| wheels.dff
 
|
 
|
 
|-
 
| model of marker (zone)
 
| zonecylb.dff
 
|
 
|
 
|-
 
| colspan="4" | <b>IDE / IPL / DAT</b>
 
|-
 
| [[IDE]]
 
| *.ide
 
|
 
| contain all name of models and textures.
 
|-
 
| [[IPL]]
 
| *.ipl
 
|
 
| contains all the coordinates for the placement of collisions in the game.
 
|-
 
| colors of cars
 
| carcols.dat
 
|
 
|-
 
| cullzone data
 
| cullzone.dat
 
|
 
|-
 
| fistfite data
 
| fistfite.dat
 
|
 
|
 
|-
 
| handling data
 
| handling.dat
 
| <code>LCS PS2: 0x1647A0</code>
 
<code>LCS PSP: 0x50190</code>
 
 
<code>VCS PS2: 0x4C2A10</code>
 
 
<code>VCS PSP: 0x3AF30F</code>
 
| LCS and VCS have different structure of handling
 
|-
 
|
 
| info.zon
 
|
 
|
 
|-
 
|
 
| map.zon
 
|
 
|
 
|-
 
| object data
 
| object.dat
 
|
 
|
 
|-
 
| particle data
 
| particle.cfg
 
| LCS PS2: <code>0x3917D0</code>
 
| characteristics of special effects
 
|-
 
| pedstats data
 
| pedstats.dat
 
| LCS PS2:
 
part 1 - <code>0x49E820</code>
 
 
part 2 - <code>0x49EB78</code>
 
 
part 3 - <code>0x4A1A10</code>
 
 
LCS PSP:
 
 
<code>0x391DA0</code>
 
 
VCS PS2:
 
 
part 1 - <code>0x4C8080</code>
 
 
part 2 - <code>0x4C8428</code>
 
 
VCS PSP:
 
 
<code>0x3B1F10</code>
 
| characteristics of pedestrians, in the PS2-version split into parts
 
 
LCS PS2:
 
 
part 1 - 15 items
 
 
part 2 - 18 items
 
 
part 3 - 9 items
 
 
LCS PSP:
 
 
42 items
 
 
VCS PS2:
 
 
part 1 - 6 items
 
 
part 2 - 36 items
 
 
VCS PSP:
 
 
42 items
 
|-
 
| timecyc data
 
| timecyc.dat
 
|
 
|
 
|-
 
| data about waters surfaces
 
| waterpro.dat
 
|
 
|
 
|-
 
| weapon data
 
| [[weapon.dat]]
 
| <code>VCS PS2: 0x3D7530</code>
 
<code>VCS PSP: 0x2E8B60</code>
 
|
 
|-
 
| colspan="4" | <b>Other</b>
 
|-
 
| [[SDT]]-files.
 
|
 
|
 
| only in PSP versions
 
|}
 
<b>Notes:</b><br/>
 
* Offset is specified for the unpacked game.dtz
 
* * - Data marked with (*) are opened by [[GTA Stories Texture Explorer]].
 
  
 
==Data Formats==
 
==Data Formats==
Line 388: Line 122:
 
In order to calculate the original rotation values, this algorythm comes in handy:
 
In order to calculate the original rotation values, this algorythm comes in handy:
 
<source lang="java">
 
<source lang="java">
 +
float tr = m00 + m11 + m22
 +
 
if (tr > 0) {  
 
if (tr > 0) {  
 
   float S = sqrt(tr+1.0) * 2; // S=4*qw  
 
   float S = sqrt(tr+1.0) * 2; // S=4*qw  
Line 419: Line 155:
 
Rotation Z = -qz
 
Rotation Z = -qz
 
Rotation W = qw</nowiki>
 
Rotation W = qw</nowiki>
 +
 
===IDE===
 
===IDE===
 
On both LCS and VCS, 0x3C points to a table containing offsets to IDE lines and 0x38 specifies the number of values in the table. Each value-offset is assigned an ID, starting from 0. If it so happens and the value-offset is 0x00000000, then the ID isn't assigned to any object. The structure is like so:
 
On both LCS and VCS, 0x3C points to a table containing offsets to IDE lines and 0x38 specifies the number of values in the table. Each value-offset is assigned an ID, starting from 0. If it so happens and the value-offset is 0x00000000, then the ID isn't assigned to any object. The structure is like so:
Line 507: Line 244:
 
4b int  Time Off</nowiki>
 
4b int  Time Off</nowiki>
 
''More info soon''
 
''More info soon''
 
+
===Car class tables===
 +
Each table has as many elements as there are vehicle classes: 11 for LCS and 13 for VCS. Each element is given an ID:
 +
<nowiki>
 +
0: normal
 +
1: poorfamily
 +
2: richfamily
 +
3: executive
 +
4: worker
 +
5: big
 +
6: taxi
 +
7: moped
 +
8: motorbike
 +
9: leisureboat
 +
10: workerboat</nowiki>
 +
VCS has 2 extra (they are used for some boats, their exact names are unknown since they're not present in other games)
 +
====Table 1====
 +
Each table element is an array of the IDs of the vehicle models in that class.
 +
<nowiki>
 +
4b int ID of a vehicle</nowiki>
 +
Each table element has 100 bytes allocated, thus the maximum number of vehicles per class is 25. If there are fewer than 25 vehicles in the class, the rest of the array is uninitialized. The format is the same for both LCS and VCS.
 +
====Table 2====
 +
Each table element is the number of vehicles in each class.
 +
<nowiki>
 +
4b int Number of vehicles in the class</nowiki>
 +
Again, same case for both LCS and VCS.
 
===2DFX===
 
===2DFX===
 
'''2DFX''' data is read directly from DTZ header. Each line is 64 bytes (depending on the 2DFX type, padding is used at the end). 24 bytes are common for all types (only 0, 1 and 3 are used). Each line is assigned an ID, counting from 0.
 
'''2DFX''' data is read directly from DTZ header. Each line is 64 bytes (depending on the 2DFX type, padding is used at the end). 24 bytes are common for all types (only 0, 1 and 3 are used). Each line is assigned an ID, counting from 0.
 
  <nowiki>
 
  <nowiki>
4b float Position X (relative to centre of the object) (CVuVector)
+
4b float Position X (relative to centre of the object)
4b float Position Y (relative to centre of the object) (CVuVector)
+
4b float Position Y (relative to centre of the object)
4b float Position Z (relative to centre of the object) (CVuVector)
+
4b float Position Z (relative to centre of the object)
4b float 0.0                                          (CVuVector)
+
4b float Position W (relative to centre of the object)
 
1b int  Colour R
 
1b int  Colour R
 
1b int  Colour G
 
1b int  Colour G
Line 579: Line 340:
 
1b int  K Camera to avoid this object
 
1b int  K Camera to avoid this object
 
1b -    Padding</nowiki>
 
1b -    Padding</nowiki>
 +
Notes about actual values (what is expected to be in original file):
 +
<nowiki>
 +
Bouyance = 0.8 * Mass / Bouyance</nowiki>
  
 
====VCS====
 
====VCS====
Line 587: Line 351:
 
4b float D Air Resistance
 
4b float D Air Resistance
 
4b float E Elasticity
 
4b float E Elasticity
4b float ?
+
4b float F Bouyance
 
4b float G Uproot Limit
 
4b float G Uproot Limit
 
4b float H Collision Damage Multiplier
 
4b float H Collision Damage Multiplier
 
1b int  ?
 
1b int  ?
1b int  J Special Collision Response Cases
+
1b int  ? (J Special Collision Response Cases?)
1b int  K Camera to avoid this object
+
1b int  ? (K Camera to avoid this object?)
 
1b int  ?
 
1b int  ?
 
1b int  ?
 
1b int  ?
3b -</nowiki>
+
3b -     Padding</nowiki>
 +
Notes about actual values (what is expected to be in original file):
 +
<nowiki>
 +
Bouyance = 0.8 * Mass / Bouyance</nowiki>
 +
 
 +
===PEDSTATS.DAT===
 +
The GAME.DTZ header redirects to a table which contains 4byte values, each one being an offset to each PEDSTATS.DAT line. Each line is defined as so:
 +
====LCS====
 +
{{stub}}
 +
====VCS====
 +
<nowiki>
 +
4b int    ID
 +
4b float B Flee Distance
 +
4b float C Heading Change Rate
 +
4b float H Attack Strength
 +
4b float I Attack Weakness
 +
2b int  J Flags
 +
1b int  D Fear
 +
1b int  E Temper
 +
1b int  F Lawfulness
 +
1b int  G Sexiness
 +
26b char A Name</nowiki>
 +
===PARTICLE.CFG===
 +
====LCS====
 +
{{stub}}
 +
====VCS====
 +
<nowiki>
 +
4b int      ID
 +
20b int  A  Name
 +
4b float CR Create Range
 +
4b float E  Default Initial Radius
 +
4b float F  Expansion Rate
 +
2b int  H  Fade Time
 +
2b int  G  Initial Intensity
 +
2b int  I  Fade Amount
 +
2b int  GA Initial Intensity
 +
2b int  HA Fade Time
 +
2b int  IA Fade Amount
 +
1b int  K  Start Animation Frame
 +
1b int  L  Final Anim Frame
 +
1b int  J  Anim Speed
 +
1b -        Padding
 +
4b int  M  Rotation Speed
 +
4b float N  Gravitational Acceleration
 +
4b int  O  Friction Decceleration
 +
4b int  P  Default Life Span
 +
4b float Q  Position Random Error
 +
4b float R  Velocity Random Error
 +
4b float S  Expansion Rate Error
 +
4b int  T  Rotation Rate Error
 +
4b int  U  Life Soan Error Shape
 +
4b float V  Trail Length Multiplier
 +
4b int  Z  Flags
 +
1b int  B  Render Colouring R
 +
1b int  C  Render Colouring G
 +
1b int  D  Render Colouring B
 +
1b -        Padding
 +
4b int  CV Initial Color Variation
 +
1b int  B2 Fade Destination Colour R
 +
1b int  C2 Fade Destination Colour G
 +
1b int  D2 Fade Destination Colour B
 +
1b -        Padding
 +
4b int  FT Colour Fade Time
 +
4b float WX x-axis Stretch Value
 +
4b float WY y-axis Stretch Value
 +
4b float WI Wind Factor
 +
4b ?        ?
 +
4b ?        ?</nowiki>
 +
 
 
=== weapons data ===
 
=== weapons data ===
  
Line 645: Line 477:
  
 
==== Structure of VCS version ====
 
==== Structure of VCS version ====
 +
0xC0 points to the offset of a value, and that value is the offset of weapon data. Each "line" is given an ID starting from 0 (that ID is linked to weapon IDE). There are 40 weapon IDs in total.
 +
<nowiki>
 +
4b int a Flags
 +
4b int B Fire type
 +
4b float C Range
 +
4b int D Firing Rate
 +
4b int E Reload
 +
4b int F Amount of Ammunition
 +
4b int G Damage
 +
4b float H Speed
 +
4b float I Radius
 +
4b float J Life span
 +
4b float K Spread
 +
4b - Padding
 +
4b float L Fire offset X
 +
4b float M Fire offset Y
 +
4b float N Fire offset Z
 +
4b float Fire offset W
 +
4b int P Anim ID
 +
4b float R * animation loop start
 +
4b float S * animation loop end
 +
4b float T * point in animation where weapon is fired
 +
4b float U * animation2 loop start
 +
4b float V * animation2 loop end
 +
4b float W * point in animation2 where weapon is fired
 +
4b float X * point in anim where we can breakout of anim/attack and run away
 +
4b int Y model id (IDE)
 +
4b int Z model id 2 (IDE)
 +
4b int b Weapon Slot
 +
4b - Padding</nowiki>
 +
 +
Data marked with * needs to be multiplied by 30.0 to get original value
  
Total number of records: 40
+
===HANDLING.CFG===
 +
====LCS====
 +
{{stub}}
  
<source lang="cpp">
+
====VCS====
typedef struct vFireOffset{
+
HANDLING.CFG data is read from the IDE section of each vehicle. There are 6 types of handling (to be found). Type 1 (or the common one) is presented.
    float       f1;
+
''This is very likely to be wrong :) Need help!''
    float       f2;  
+
<nowiki>
    float      f3;       
+
4b float ?
};
+
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
4b float fEngineAcceleration
 +
4b float TransmissionData.fEngineInertia
 +
4b float ?
 +
4b float ?
 +
4b float ?
 +
1b char  TransmissionData.nDriveType
 +
1b char TransmissionData.nEngineType
 +
1b int  TransmissionData.nNumberOfGears
 +
1b int  Padding
 +
4b float fBrakeDeceleration
 +
4b float fBrakeBias
 +
4b float fSteeringLock
 +
4b float fTractionLoss
 +
4b float fTractionBias
 +
4b float fSuspensionForceLevel
 +
4b float fSuspensionDampingLevel
 +
4b float suspension upper limit
 +
4b float suspension lower limit
 +
4b float suspension bias between front and rear
 +
4b float suspension anti-dive multiplier
 +
4b float fSeatOffsetDistance
 +
4b int  nMonetaryValue
 +
1b int  front lights
 +
1b int  rear lights
 +
2b int  Padding
 +
4b float fDragMult
 +
4b       ? (Probably padding)
 +
4b float CentreOfMass.x (CVuVector X)
 +
4b float CentreOfMass.y (CVuVector Y)
 +
4b float CentreOfMass.z (CVuVector Z)
 +
4b float -              (CVuVector W)
 +
4b int  nPercentSubmerged
 +
4b float ?
 +
4b float TransmissionData.fMaxVelocity
 +
4b float fMass
 +
4b float fTurnMass
 +
4b float fTractionMultiplier
 +
4b float fCollisionDamageMultiplier
 +
4b int  ?
 +
4b int  ?
 +
12b ?</nowiki>
  
typedef struct weapondata{
+
Notes about actual values (what is expected to be in original file):
    DWORD      dwType;
+
<nowiki>
    int         iFireType;
+
fEngineAcceleration = fEngineAcceleration *12500(*2 for nDriveType = '4'))
    float      fRange;
+
fBrakeDeceleration = fBrakeDeceleration*2500)
    int         iFiringRate;
+
fCollisionDamageMultiplier = fMass/2000*fCollisionDamageMultiplier</nowiki>
    int         iReload;
+
===Font Data===
    int         iAmountOfAmmunition;
+
This section seems to be present only in VCS, and has info about spliting font textures to individual character sprites, as well as character spacing. 0xF4 points to an array of pointers, 3 on PSP and 4 on PS2 (PS2 has the additional PagerText font). Each pointer points to an info section for each fonts. This info section looks like this:
    int         iDamage;
+
<nowiki>
    float      fSpeed;
+
2b int Total number of characters
    float      fRadius;
+
2b int Number of Controller Button Characters
    float       fLifeSpan;
+
2b int ? (Number of some character types)
    float      fSpread;
+
2b int ? (Number of some character types)
    DWORD      dwPadding;  //padding (0xAA)
+
4b int Offset to Character Data 1
    vFireOffset m_vFireOffset;  //vector
+
4b int Offset to Character Data 2
    DWORD      _f3C;  //always zero
+
1b int Font ID
    DWORD      _f40;  //integer value
+
3b Uninitialised Data (??)
    DWORD      _f44;  //DWORD ? unknown
+
4b int ?
    vFireOffset m_vFireOffset;  //vector
+
4b int ?
    vFireOffset m_vFireOffset; //vector
+
4b int ?
    DWORD      dwModelID;
+
4b float ?
    DWORD      dwModel2ID;
+
4b int ?
    DWORD      dwWeaponSlot
+
4b int ?
    DWORD      _f6C;  //padding (0xAA)    
+
20b string Font Name
};
+
4b ? ?
</source>
+
4b ? ?
 +
4b ? ?
 +
4b int ?</nowiki>
 +
Character Data 1 has as many entries as there are characters for that specific font and has this format:
 +
  <nowiki>
 +
2b int ?
 +
2b int Bottom Right X (pixel)
 +
2b int ?
 +
2b int Bottom Right Y (pixel)
 +
2b string Character
 +
2b int Top Left X (pixel)
 +
2b int Top Left Y (pixel)</nowiki>
  
===handling data===
 
{{stub}}
 
 
==Sources==
 
==Sources==
 
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
 
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
  
[[Category: GTA_LCS]] [[Category: GTA_VCS]]
+
{{N|VCS|LCS}}

Latest revision as of 23:11, 12 January 2021

GAME.DTZ (DaTa Zlib) is a file in PS2 and PSP versions of GTA LCS and GTA VCS. It contains data files, as well as main textures and models analogue to existing 3D era games compiled in binary form. It is compressed using the zlib/deflate algorithm [1] (max compression). It can be decompressed by any zlib compression/decompression utility, such as offzip [2] and zdrop [3]. Data can be extracted by guard3's DTZpy [4], though textures and some data files can be manipulated with Dageron's DTZ Editor [5]. All info provided is about decompressed version

Header

The Header for both GTA LCS and GTA VCS versions is nothing but a standard Relocatable Chunk header, defined like so:

struct base::sChunkHeader
{
	uint32 ident;
	uint32 shrink;
	uint32 fileEnd;
	uint32 dataEnd;
	uint32 relocTab;
	uint32 numRelocs;
	uint32 globalTab;
	uint16 numClasses;
	uint16 numFuncs;
};

More info on Relocatable chunk

LCS Version

VCS Version

0x20  paths
0x24  offset to "Buildings" info
0x28  offset to "Treadables" info
0x2C  offset to "Dummys" info
0x30  offset to "EntryInfoNode" info
0x34  offset to "PtrNode" info
0x38  number of offsets in IDE table
0x3C  offset to IDE table
0x40  offset to car class table 1
0x44  offset to car class table 2
0x48  offset to GTA3.ZON
0x4C  0, ?
0x50  0, ?
0x54  number of 2dfx data "lines"
0x58  offset to 2dfx data
0x5C  ? (has to do with model indices)
0x60  offset to "Texlist" info
0x64  0, ?
0x68  ?
0x6C  0, ?
0x70  ?
0x74  offset to OBJECT.DAT
0x78  ?
0x7C  offset to GTA3PS2.DIR
0x80  offset to animation data
0x84  offset to FISTFITE.DAT
0x88  offset to PED.DAT offset table
0x8C  offset to PEDSTATS.DAT offset table
0x90  offset to car colours data
0x94  ?
0x98  number of CULL.IPL "lines"
0x9C  offset to CULL.IPL
0xA0  number of OCCLU.IPL �lines� (0 in VCS)
0xA4  offset to OCCLU.IPL (0 in VCS)
0xA8  offset to WATERPRO.DAT
0xAC  offset to weather types table
0xB0  offset to SURFACE.DAT
0xB4  offset to TIMECYC.DAT
0xB8  offset to PEDGRP.DAT
0xBC  offset to PARTICLE.CFG
0xC0  offset to WEAPON.DAT
0xC4  0, ?
0xC8  offset to models offset table
0xCC  offset to MOCAPPS2.DIR
0xD0  ?
0xD4  0, ?
0xD8  ?
0xDC  0, ?
0xE0  offset to MENU.XTX (zlib/deflate compressed)
0xE4  ?
0xE8  ?
0xEC  ?
0xF0  ?
0xF4  offset to font data
0xF8  size of decompressed FSFONTS.XTX
0xFC  offset to FSFONTS.XTX (zlib/deflate compressed)
0x100 offset to radar textures offset table

Data Formats

IPL

IPL Info

The header of GAME.DTZ points to 5 IPL info tables: Buildings, Treadables, Dummys, EntryInfoNode and PtrNode. The first 3 are 16 bytes in size and are defined like so:

4b int Offset to IPL data
4b int  ?
4b int  Number of IPL lines
4b int  ?
16 char Name of IPL info (Buildings, Treadables, etc...)

Need more info on EntryInfoNode and PtrNode

IPL Structure

The IPL data is structured like so:

4b float m00
4b float m10
4b float m20
4b float Unk1
4b float m01
4b float m11
4b float m21
4b float Unk2
4b float m02
4b float m12
4b float m22
4b float Unk3
4b float Position-X
4b float Position-Y
4b float Position-Z
4b float Unk4
24b ?
2b int   Corresponding Model ID
6b ?

The IPL is basically a matrix:

[m00,  m01,  m02,  Position-X]
[m10,  m11,  m12,  Position-Y]
[m20,  m21,  m22,  Position-Z]
[unk1, unk2, unk3, unk4      ]

The bottom row is Leeds Engine stuff, not useful for generating IPL. They only matter in memory. Someone may provide more info

Generating IPL in text format

In order to calculate the original rotation values, this algorythm comes in handy:

float tr = m00 + m11 + m22

if (tr > 0) { 
  float S = sqrt(tr+1.0) * 2; // S=4*qw 
  qw = 0.25 * S;
  qx = (m21 - m12) / S;
  qy = (m02 - m20) / S; 
  qz = (m10 - m01) / S; 
} else if ((m00 > m11)&(m00 > m22)) { 
  float S = sqrt(1.0 + m00 - m11 - m22) * 2; // S=4*qx 
  qw = (m21 - m12) / S;
  qx = 0.25 * S;
  qy = (m01 + m10) / S; 
  qz = (m02 + m20) / S; 
} else if (m11 > m22) { 
  float S = sqrt(1.0 + m11 - m00 - m22) * 2; // S=4*qy
  qw = (m02 - m20) / S;
  qx = (m01 + m10) / S; 
  qy = 0.25 * S;
  qz = (m12 + m21) / S; 
} else { 
  float S = sqrt(1.0 + m22 - m00 - m11) * 2; // S=4*qz
  qw = (m10 - m01) / S;
  qx = (m02 + m20) / S;
  qy = (m12 + m21) / S;
  qz = 0.25 * S;
}

And finally, since 3DS Max that originally created IPL negates X,Y,Z:

Rotation X = -qx
Rotation Y = -qy
Rotation Z = -qz
Rotation W = qw

IDE

On both LCS and VCS, 0x3C points to a table containing offsets to IDE lines and 0x38 specifies the number of values in the table. Each value-offset is assigned an ID, starting from 0. If it so happens and the value-offset is 0x00000000, then the ID isn't assigned to any object. The structure is like so:

LCS

8b -
4b int Name of the object (CRC32 Hash encryption)
4b -
1b int Type (1: objs, 3:tobj, 4:weap, 5:hier, 6:cars, 7:ped)
1b int Count 2dfx (ex. if 2dfxID=8 and Count2dfx=4, then the assigned IDs are 8, 9, 10, 11)
1b int Collision in .DTZ (boolean, 0:not in DTZ, 1:in DTZ)
1b -   Padding
4b int offset to collision (.col2)
2b int 2dfx ID
2b int Object.DAT ID
2b -
2b int Texture ID
4b int Type (CRC32 Hash encryprion)
4b int offset to model (if no .mdl exists in .DTZ, then it's 0)

Type 1 OBJS:

4b float Draw Distance 1
4b float Draw Distance 2
4b float Draw Distance 3 (if object is LOD, then disappearing distance)
1b int   Mesh Count
1b int   ?
2b int   Flags
4b int   if object is LOD, offset to IDE ID of original object, otherwise =0

Type 3 TOBJ:

4b float Draw Distance 1
4b float Draw Distance 2
4b float Draw Distance 3 (if object is LOD, then disappearing distance)
1b int   Mesh Count
1b int   ?
2b int   Flags
4b int   if object is LOD, offset to IDE ID of original object, otherwise =0
4b int   Time On
4b int   Time Off

Type 4 WEAP:

4b float Draw Distance 1
4b float Draw Distance 2
4b float Draw Distance 3 (if object is LOD, then disappearing distance)
1b int   Mesh Count
1b int   ?
2b int   Flags
4b int   Weapon.DAT ID
4b int   Animation ID

VCS

8b -
4b int Name of the object (CRC32 Hash encryption)
4b -
1b int Type (1: objs, 3:tobj, 4:weap, 5:hier, 6:cars, 7:ped)
1b int Count 2dfx (ex. if 2dfxID=8 and Count2dfx=4, then the assigned IDs are 8, 9, 10, 11)
1b int Collision in .DTZ (boolean, 0:not in DTZ, 1:in DTZ)
1b -   Padding
4b int offset to collision (.col2)
2b int 2dfx ID
2b int Object.DAT ID
2b -
2b int Texture ID
2b ?
2b -
4b int Type (CRC32 Hash encryprion)
4b int offset to model (if no .mdl exists in .DTZ, then it's 0)

Type 1 OBJS:

4b float Draw Distance 1
4b float Draw Distance 2
4b float Draw Distance 3 (if object is LOD, then disappearing distance)
1b int   Mesh Count
1b int   ?
2b int   Flags
4b int   if object is LOD, offset to IDE ID of original object, otherwise =0

Type 3 TOBJ:

4b float Draw Distance 1
4b float Draw Distance 2
4b float Draw Distance 3 (if object is LOD, then disappearing distance)
1b int   Mesh Count
1b int   ?
2b int   Flags
4b int   if object is LOD, offset to IDE ID of original object, otherwise =0
4b int   Time On
4b int   Time Off

More info soon

Car class tables

Each table has as many elements as there are vehicle classes: 11 for LCS and 13 for VCS. Each element is given an ID:

0: normal
1: poorfamily
2: richfamily
3: executive
4: worker
5: big
6: taxi
7: moped
8: motorbike
9: leisureboat
10: workerboat

VCS has 2 extra (they are used for some boats, their exact names are unknown since they're not present in other games)

Table 1

Each table element is an array of the IDs of the vehicle models in that class.

4b int ID of a vehicle

Each table element has 100 bytes allocated, thus the maximum number of vehicles per class is 25. If there are fewer than 25 vehicles in the class, the rest of the array is uninitialized. The format is the same for both LCS and VCS.

Table 2

Each table element is the number of vehicles in each class.

4b int Number of vehicles in the class

Again, same case for both LCS and VCS.

2DFX

2DFX data is read directly from DTZ header. Each line is 64 bytes (depending on the 2DFX type, padding is used at the end). 24 bytes are common for all types (only 0, 1 and 3 are used). Each line is assigned an ID, counting from 0.

4b float Position X (relative to centre of the object)
4b float Position Y (relative to centre of the object)
4b float Position Z (relative to centre of the object)
4b float Position W (relative to centre of the object)
1b int   Colour R
1b int   Colour G
1b int   Colour B
1b int   Unknown (usually 200.0, like in Vice City)
4b int   Type

Type 0 Lights:

4b float View Distance
4b float Outer Range
4b float Size
4b float Inner Range
1b int   Flash
1b int   Wet
1b int   Flare
1b int   Shadow Intensity
4b int   Flags
4b int   Offset to corona texture
4b int   Offset to shadow texture
8b -     Padding

Type 1 Particles:

4b int   Particle Type
4b float Strength X
4b float Strength Y
4b float Strength Z
4b float Scale
20b -    Padding

Type 2 Peds investigate:

4b float ?
4b float ?
4b float ?
1b int   ?
1b int   ?
26b -    Padding

Type 3 Peds:

4b float Rotation X
4b float Rotation Y
4b float Rotation Z
4b float Rotation X (again)
4b float Rotation Y (again)
4b float Rotation Z (again)
4b int   Behaviour
12b -    Padding

The format is the same as the plain text version of III and VC. More info can be found on: 2DFX

OBJECT.DAT

It's read directly from DTZ header. Each line is given an ID counting from 0.

LCS

116 entries

4b float B Mass
4b float C TurnMass
4b float D Air Resistance
4b float E Elasticity
4b float F Bouyance
4b float G Uproot Limit
4b float H Collision Damage Multiplier
1b int   I Collision Damage Effect
1b int   J Special Collision Response Cases
1b int   K Camera to avoid this object
1b -     Padding

Notes about actual values (what is expected to be in original file):

Bouyance = 0.8 * Mass / Bouyance

VCS

140 entries

4b float B Mass
4b float C TurnMass
4b float D Air Resistance
4b float E Elasticity
4b float F Bouyance
4b float G Uproot Limit
4b float H Collision Damage Multiplier
1b int   ?
1b int   ? (J Special Collision Response Cases?)
1b int   ? (K Camera to avoid this object?)
1b int   ?
1b int   ?
3b -     Padding

Notes about actual values (what is expected to be in original file):

Bouyance = 0.8 * Mass / Bouyance

PEDSTATS.DAT

The GAME.DTZ header redirects to a table which contains 4byte values, each one being an offset to each PEDSTATS.DAT line. Each line is defined as so:

LCS

VCS

4b int     ID
4b float B Flee Distance
4b float C Heading Change Rate
4b float H Attack Strength
4b float I Attack Weakness
2b int   J Flags
1b int   D Fear
1b int   E Temper
1b int   F Lawfulness
1b int   G Sexiness
26b char A Name

PARTICLE.CFG

LCS

VCS

4b int      ID
20b int  A  Name
4b float CR Create Range
4b float E  Default Initial Radius
4b float F  Expansion Rate
2b int   H  Fade Time
2b int   G  Initial Intensity
2b int   I  Fade Amount
2b int   GA Initial Intensity
2b int   HA Fade Time
2b int   IA Fade Amount	
1b int   K  Start Animation Frame
1b int   L  Final Anim Frame
1b int   J  Anim Speed
1b -        Padding
4b int   M  Rotation Speed
4b float N  Gravitational Acceleration
4b int   O  Friction Decceleration
4b int   P  Default Life Span
4b float Q  Position Random Error
4b float R  Velocity Random Error	
4b float S  Expansion Rate Error
4b int   T  Rotation Rate Error
4b int   U  Life Soan Error Shape
4b float V  Trail Length Multiplier
4b int   Z  Flags
1b int   B  Render Colouring R
1b int   C  Render Colouring G
1b int   D  Render Colouring B
1b -        Padding
4b int   CV Initial Color Variation
1b int   B2 Fade Destination Colour R
1b int   C2 Fade Destination Colour G
1b int   D2 Fade Destination Colour B
1b -        Padding
4b int   FT Colour Fade Time
4b float WX x-axis Stretch Value
4b float WY y-axis Stretch Value
4b float WI Wind Factor	
4b ?        ?
4b ?        ?

weapons data

Analog of weapons.dat

Structure of LCS version

Total number of records: 38


typedef struct vFireOffset{
    float       x;
    float       y;  
    float       z;        
};

typedef struct vTimeStrc{
    float       a;
    float       b;  
    float       c;        
};

typedef struct weapondata{
    int		FireType;
    float	Range;
    int		FiringRate;
    int		Reload;
    int		AmountOfAmmunition;
    int		Damage;
    float	Speed;
    float	Radius;
    float	LifeSpan;
    float	Spread;
    DWORD	padding1;
    DWORD	padding2;
    vFireOffset	FireOffset;
    DWORD	zero;
    DWORD	anim_id;
    vTimeStrc	time1;
    vTimeStrc	time2;
    float	unk;
    DWORD	ModelID;
    DWORD	ModelID2;
    DWORD	weapon_slot;
    DWORD	Flags <format=hex>;
};

Structure of VCS version

0xC0 points to the offset of a value, and that value is the offset of weapon data. Each "line" is given an ID starting from 0 (that ID is linked to weapon IDE). There are 40 weapon IDs in total.

4b	int	a	Flags
4b	int	B	Fire type
4b	float	C	Range
4b	int	D	Firing Rate
4b	int	E	Reload
4b	int	F	Amount of Ammunition
4b	int	G	Damage
4b	float	H	Speed
4b	float	I	Radius
4b	float	J	Life span
4b	float	K	Spread
4b	-		Padding
4b	float	L	Fire offset X
4b	float	M	Fire offset Y
4b	float	N	Fire offset Z
4b	float		Fire offset W
4b	int	P	Anim ID
4b	float	R	* animation loop start
4b	float	S	* animation loop end
4b	float	T	* point in animation where weapon is fired
4b	float	U	* animation2 loop start
4b	float	V	* animation2 loop end
4b	float	W	* point in animation2 where weapon is fired
4b	float	X	* point in anim where we can breakout of anim/attack and run away
4b	int	Y	model id (IDE)
4b	int	Z	model id 2 (IDE)
4b	int	b	Weapon Slot
4b	-		Padding

Data marked with * needs to be multiplied by 30.0 to get original value

HANDLING.CFG

LCS

VCS

HANDLING.CFG data is read from the IDE section of each vehicle. There are 6 types of handling (to be found). Type 1 (or the common one) is presented. This is very likely to be wrong :) Need help!

4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float ?
4b float fEngineAcceleration
4b float TransmissionData.fEngineInertia
4b float ?
4b float ?
4b float ?
1b char  TransmissionData.nDriveType
1b char  TransmissionData.nEngineType
1b int   TransmissionData.nNumberOfGears
1b int   Padding
4b float fBrakeDeceleration
4b float fBrakeBias
4b float fSteeringLock
4b float fTractionLoss
4b float fTractionBias
4b float fSuspensionForceLevel
4b float fSuspensionDampingLevel
4b float suspension upper limit
4b float suspension lower limit
4b float suspension bias between front and rear
4b float suspension anti-dive multiplier
4b float fSeatOffsetDistance
4b int   nMonetaryValue
1b int   front lights
1b int   rear lights
2b int   Padding
4b float fDragMult
4b       ? (Probably padding)
4b float CentreOfMass.x (CVuVector X)
4b float CentreOfMass.y (CVuVector Y)
4b float CentreOfMass.z (CVuVector Z)
4b float -              (CVuVector W)
4b int   nPercentSubmerged
4b float ?
4b float TransmissionData.fMaxVelocity
4b float fMass
4b float fTurnMass
4b float fTractionMultiplier
4b float fCollisionDamageMultiplier
4b int   ?
4b int   ?
12b ?

Notes about actual values (what is expected to be in original file):

fEngineAcceleration = fEngineAcceleration *12500(*2 for nDriveType = '4'))
fBrakeDeceleration = fBrakeDeceleration*2500)
fCollisionDamageMultiplier = fMass/2000*fCollisionDamageMultiplier

Font Data

This section seems to be present only in VCS, and has info about spliting font textures to individual character sprites, as well as character spacing. 0xF4 points to an array of pointers, 3 on PSP and 4 on PS2 (PS2 has the additional PagerText font). Each pointer points to an info section for each fonts. This info section looks like this:

2b	int	Total number of characters
2b	int	Number of Controller Button Characters
2b	int	? (Number of some character types)
2b	int	? (Number of some character types)
4b	int	Offset to Character Data 1
4b	int 	Offset to Character Data 2
1b	int	Font ID
3b		Uninitialised Data (??)
4b	int	?
4b	int	?
4b	int	?
4b	float	?
4b	int	?
4b	int	?
20b	string	Font Name
4b	?	?
4b	?	?
4b	?	?
4b	int	?

Character Data 1 has as many entries as there are characters for that specific font and has this format:

2b	int	?
2b	int	Bottom Right X (pixel)
2b	int	?
2b	int	Bottom Right Y (pixel)
2b	string	Character
2b	int 	Top Left X (pixel)
2b	int	Top Left Y (pixel)

Sources

http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm