Difference between revisions of "Game.dtz"

From GTAMods Wiki
Jump to navigation Jump to search
(IDE)
m (VCS)
Line 449: Line 449:
 
2b -
 
2b -
 
2b int Texture ID
 
2b int Texture ID
4b ?
+
2b ?
 +
2b -
 
4b int Type (CRC32 Hash encryprion)
 
4b int Type (CRC32 Hash encryprion)
 
4b int offset to model (if no .mdl exists in .DTZ, then it's 0)</nowiki>
 
4b int offset to model (if no .mdl exists in .DTZ, then it's 0)</nowiki>

Revision as of 17:02, 11 September 2017

GAME.DTZ (DaTa Zlib) 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 [1] (max compression). Its contents can be viewed using any zlib compression/decompression utility, such as offzip [2] and zdrop, though some can be viewed with DTZ Editor [3], a tool made by Dageron. All info provided is about decompressed version

Header

The Header for both GTA LCS and GTA VCS versions is defined like so:

0x0   [4b] "GTAG" signature
0x4   [4b] 1, unknown
0x8   [4b] size of decompressed file
0xC   [4b] ?
0x10  [4b] offset to global table of offsets 
0x14  [4b] number of offsets in global table
0x18  [4b] same as 0xC
0x1C  [2b] ?
0x1E  [2b] ?

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  car class table (poorfamily, etc.)
0x44  number of cars in each class
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  0, ?
0xA4  0, ?
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 FRONTENT.TEX (zlib/deflate compressed)
0xE4  ?
0xE8  ?
0xEC  ?
0xF0  ?
0xF4  ?
0xF8  size of decompressed FONTS.TEX
0xFC  offset to FONTS.TEX (zlib/deflate compressed)
0x100 offset to radar textures offset table

Table of Analogy

Needs some serious editing

Description Analogy Offset Notes
Textures
textures of menu frontend.txd LCS PS2: 0x4E4A30

LCS PSP: 0x4DA830

VCS PS2: 0x581330

VCS PSP: 0x51D95C

contain texture of menu, packed deflate/zlib algorithm (*)
texture of fonts fonts.txd LCS PS2: 0x4EF4D8

LCS PSP: 0x4E2B1C

VCS PS2: 0x57BE4C

VCS PSP: 0x530AFC

also packed deflate/zlib algorithm (*)
particle effects particle.txd LCS PS2: 0x4A1C28

LCS PSP: 0x38AB90

VCS PS2: 0x761F0

VCS PSP: 0x3F7FB0

contain all textures of particle effect (*)
generic-textures generic.txd, wheels.txd, vehicle.txd LCS PS2: 0x4A1BFC

LCS PSP: 0x392B04

VCS PS2: 0x539E0

VCS PSP: 0x3D60B4

contains general textures for cars and all the textures of wheels (*)
radar icons hud.txd LCS PS2: 0x4A1BE4

LCS PSP: 0x38AD30

VCS PS2: 0x287B0

VCS PSP: 0x3B4678

contain icons for hud (*)
texture of radar radarNN.txd Contain textures for radar
Animation
? ped.ifp
? swim.ifp only in GTA VCS
? fight.ifp only in GTA VCS
? driveby.ifp only in GTA VCS
DIR-files
for cuts.img cuts.dir not working
for GTA3PS2.IMG GTA3PS2.dir specific for stories, doesn't contain the names.
Collision
? peds.col peds.col2
? vehicles.col vehicles.col2
? weapons.col weapons.col2
Models
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
IDE / IPL / DAT
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 LCS PS2: 0x1647A0

LCS PSP: 0x50190

VCS PS2: 0x4C2A10

VCS PSP: 0x3AF30F

LCS and VCS have different structure of handling
info.zon
map.zon
object data object.dat
particle data particle.cfg LCS PS2: 0x3917D0 characteristics of special effects
pedstats data pedstats.dat LCS PS2:

part 1 - 0x49E820

part 2 - 0x49EB78

part 3 - 0x4A1A10

LCS PSP:

0x391DA0

VCS PS2:

part 1 - 0x4C8080

part 2 - 0x4C8428

VCS PSP:

0x3B1F10

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 VCS PS2: 0x3D7530

VCS PSP: 0x2E8B60

Other
SDT-files. only in PSP versions

Notes:

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:

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)
2b int Collision in .DTZ (boolean, 0:not in DTZ, 1:in DTZ)
4b off 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)

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)
2b int Collision in .DTZ (boolean, 0:not in DTZ, 1:in DTZ)
4b off 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)

More info soon

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

Type 1 Particles:

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

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 -

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

VCS

140 entries

4b float B Mass
4b float C TurnMass
4b float D Air Resistance
4b float E Elasticity
4b float ?
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 -

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

Total number of records: 40

typedef struct vFireOffset{
    float       f1;
    float       f2;  
    float       f3;        
};

typedef struct weapondata{
    DWORD       dwType; 
    int         iFireType;
    float       fRange;
    int         iFiringRate;
    int         iReload;
    int         iAmountOfAmmunition;
    int         iDamage;
    float       fSpeed;
    float       fRadius;
    float       fLifeSpan;
    float       fSpread;
    DWORD       dwPadding;   //padding (0xAA)
    vFireOffset m_vFireOffset;  //vector
    DWORD       _f3C;   //always zero
    DWORD       _f40;   //integer value
    DWORD       _f44;   //DWORD ? unknown
    vFireOffset m_vFireOffset;  //vector
    vFireOffset m_vFireOffset;  //vector
    DWORD       dwModelID; 
    DWORD       dwModel2ID;
    DWORD       dwWeaponSlot
    DWORD       _f6C;   //padding (0xAA)      
};

handling data

Sources

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