Difference between revisions of "VTable"

From GTAMods Wiki
Jump to navigation Jump to search
m
(Added GTAIV specific info on why VTable pointer values are useful.)
Line 1: Line 1:
 
{{File-stub}}
 
{{File-stub}}
 
==VTable Description==
 
==VTable Description==
*At its simplest, a VTable is an array of pointers to functions. Any object with virtual methods contains an internal pointer to a VTable. The VTable layout is implementation dependent, and may frequently contain type metadata (to support DynamicCast) and correction factors needed to support MultipleInheritance
+
*At its simplest, a VTable is an array of pointers to functions. VTables are sometimes referred to as VFTables (or Virtual Function Tables) or VMTs (Virtual Method Tables). Any class/struct object with virtual methods contains an internal pointer to a VTable. The VTable layout is implementation dependent, and may frequently contain type metadata (to support DynamicCast) and correction factors needed to support MultipleInheritance.
 +
 
 +
GTA:IV's resource data files often contain structures that are a direct memory dump of a complete class/structure in memory. These classes are sometimes virtual classes and often contain a VTable pointer in them. When the data is loaded into memory, the data is relocated and VTable pointer is corrected to the proper one by the game. It is important to note that the VTable pointer value will change depending on the exact build/version of the resource compiler used. They are a helpful indicator to identify data structures in files. However, that's all they are -- indicators.
  
 
==Documentation==
 
==Documentation==

Revision as of 02:39, 12 August 2009

VTable Description

  • At its simplest, a VTable is an array of pointers to functions. VTables are sometimes referred to as VFTables (or Virtual Function Tables) or VMTs (Virtual Method Tables). Any class/struct object with virtual methods contains an internal pointer to a VTable. The VTable layout is implementation dependent, and may frequently contain type metadata (to support DynamicCast) and correction factors needed to support MultipleInheritance.

GTA:IV's resource data files often contain structures that are a direct memory dump of a complete class/structure in memory. These classes are sometimes virtual classes and often contain a VTable pointer in them. When the data is loaded into memory, the data is relocated and VTable pointer is corrected to the proper one by the game. It is important to note that the VTable pointer value will change depending on the exact build/version of the resource compiler used. They are a helpful indicator to identify data structures in files. However, that's all they are -- indicators.

Documentation

Possible values of a VTable

Name Decimal Hex Description
DrawableModel 6902356 0x54526900 WDR Header
DrawableDictionary 6902692 0xA4536900 WDD Header
Geometry 7031028 0xF4486B00 Start of Geometry
VertexBuffer 7060184 0xD8BA6B00 Start of VertexBuffer
IndexBuffer 7059568 0x70B86B00 Start of IndexBuffer
ShaderGroup 7018052 0x44166B00 Start of ShaderGroup
Shader 7021116 0x3C226B00 Start of Shader
Boundries 6902624 0x60536900 WBD Header
TextureDictionary 6949024 0xA0086A00 WTD Header

This section is incomplete. You can help by fixing and expanding it.