Changes

Jump to navigation Jump to search
104 bytes added ,  14:48, 5 June 2017
update info, add cat
Line 1: Line 1: −
Class IDs are a mechanism used internally in TrackMania, mainly in [[PAK|.pak]] and [[GBX|.gbx]] files. A class ID is a 32-bit integer that references a class which can interpret a given piece of data.
+
'''Class IDs''' are a mechanism used internally in the [[GameBox]] engine, mainly in [[GBX|.gbx]] and [[PAK|.pak]] files. A class ID is a 32-bit unsigned integer that references a class which can interpret a given piece of data.
    
For example, a .gbx file could have as class ID 0x03043000, which corresponds to the class "CGameCtnChallenge". This shows that the file contains a track definition. Another example is a file in a .pak archive with class ID 0x09022000: this is CPlugFileJpg, so the file is a JPEG image.
 
For example, a .gbx file could have as class ID 0x03043000, which corresponds to the class "CGameCtnChallenge". This shows that the file contains a track definition. Another example is a file in a .pak archive with class ID 0x09022000: this is CPlugFileJpg, so the file is a JPEG image.
   −
Classes are organized into 16 groups called ''engines''. Each class can also be subdivided into a number of ''chunks''. These three indices are laid out in the class ID as follows:
+
== Organisation ==
 +
 
 +
Classes are organised into 16 groups called ''engines''. Each class can also be subdivided into a number of ''chunks''. These three indices are laid out in the class ID as follows:
    
  engine class chunk
 
  engine class chunk
Line 10: Line 12:  
Each class also includes publicly accessible fields and methods. For details on this, see [[Scripting]].
 
Each class also includes publicly accessible fields and methods. For details on this, see [[Scripting]].
   −
==Engine and class IDs==
+
== Engine and class IDs ==
These are all the existing engines and classes as found in TMF.
+
 
 +
These are all the existing engines and classes as found in TrackMania Forever.
    
  engine
 
  engine
Line 1,008: Line 1,011:  
     008 CGameCtnPlaygroundActionModel
 
     008 CGameCtnPlaygroundActionModel
   −
==Class ID mappings==
+
== Class ID mappings ==
 +
 
 
The last engine in the list of engines is 0x24, "TrackMania". It used to contain a lot of classes which have now been moved to more generic engines, like 0x03 (Game). This is the case for e.g. challenges, which used to be 24 003 000 but are now 03 043 000.
 
The last engine in the list of engines is 0x24, "TrackMania". It used to contain a lot of classes which have now been moved to more generic engines, like 0x03 (Game). This is the case for e.g. challenges, which used to be 24 003 000 but are now 03 043 000.
   −
Since TrackMania needs to stay compatible with older gbx files, it maps old class IDs to new ones when loading the file. This only happens up to the class level; chunk indices stay the same.
+
Since the GameBox engine needs to stay compatible with older .gbx files, it maps old class IDs to new ones when loading the file. This only happens up to the class level; chunk indices stay the same.
    
  24003000 -> 03043000
 
  24003000 -> 03043000
Line 1,162: Line 1,166:  
  0301C000 -> 2E002000
 
  0301C000 -> 2E002000
   −
==Class IDs by file extension==
+
== Class IDs by file extension ==
 +
 
 
When loading a file, TrackMania determines the class to parse it with by querying a table with the file's extension. The exception is .gbx files, where extension detection is hardcoded (and so .gbx is not found in the table).
 
When loading a file, TrackMania determines the class to parse it with by querying a table with the file's extension. The exception is .gbx files, where extension detection is hardcoded (and so .gbx is not found in the table).
   Line 1,202: Line 1,207:  
  .wav        09031000 (CPlugFileWav)
 
  .wav        09031000 (CPlugFileWav)
 
  .zip        09084000 (CPlugFileZip)
 
  .zip        09084000 (CPlugFileZip)
 +
 +
[[Category:Internals]]

Navigation menu