Changes

Jump to navigation Jump to search
2,982 bytes added ,  15:45, 4 November 2022
→‎Reading the body: Added Encapsulation
Line 172: Line 172:     
''Note'': In case of a text format .gbx file (marked by a 'T' in the header) all numbers and strings are stored as one line of ASCII text in each case. Every line ends with a carriage return-linefeed ({{c|<CR><LF>}}) combination (0x0D and 0x0A). A single {{c|<LF>}} is part of a string.
 
''Note'': In case of a text format .gbx file (marked by a 'T' in the header) all numbers and strings are stored as one line of ASCII text in each case. Every line ends with a carriage return-linefeed ({{c|<CR><LF>}}) combination (0x0D and 0x0A). A single {{c|<LF>}} is part of a string.
 +
 +
===Encapsulation===
 +
Encapsulation is a special kind of chunk behavior added in ManiaPlanet that handles lookbackstrings and noderefs differently.
 +
 +
* A new temporary lookbackstring list is created just for this chunk - the counting of strings starts from 1 again. However, the previous state of lookback strings is not reset.
 +
* An index of the noderef is not included and the node is not added to the node list. That list is not reset either.
 +
 +
It looks like this:
 +
 +
CSystemArchiveEncapsuledChunk::CSystemArchiveEncapsuledChunk();
 +
// ...
 +
CSystemArchiveEncapsuledChunk::~CSystemArchiveEncapsuledChunk();
 +
 +
In this range of code, you need to set up your binary reader to handle the two rules above.
 +
 +
Here is the list of chunks that use encapsulation:
 +
 +
* CGameCtnChallenge '''03043040''', '''03043041''', '''03043043''', '''03043044''', '''0304304E''', '''0304304F''' (version < 2), '''03043054''', '''03043058''' (version >= 1)
 +
* CGameCtnMacroBlockInfo '''0310D00B''', '''0310D011'''
 +
* CGamePlayerProfileChunk_GameScores '''03146000''', '''03146002''', '''03146004'''
 +
* CGamePlayerProfileChunk_ScriptPersistentTraits '''03170000'''
    
== Class descriptions ==
 
== Class descriptions ==
Line 401: Line 422:  
''Note:'' This chunk has its own lookback string state (is encapsulated with CSystemArchiveEncapsuledChunk).
 
''Note:'' This chunk has its own lookback string state (is encapsulated with CSystemArchiveEncapsuledChunk).
   −
''Note:'' Version 5+ can have data that is based on the count of certain types of items in the item array. If you want to modify items in TM2020, you can come across issues when modifying the item array. This can be fixed by downgrading the version to 4. This downgrade shouldn't break anything, except maybe some new TM2020 features of items.
+
''Note:'' Version 5+ can have data that is based on the count of certain types of items in the item array. If you want to modify items in TM2020, you can come across issues when modifying the item array and it becomes rather difficult. This can be resolved by downgrading the version to 4. This downgrade should only affect item snapping - which is "useful" only when deleting items in the map editor.
   −
''Note:'' Version 5+ was guessed by bruteforce, there's a chance something could be inaccurate.
+
''Note:'' The following information may not be 100% accurate.
 +
 
 +
* '''connectedItemPairs''': Array of AnchoredObjects index pairs where the first item (of pair) is the item that will delete the second item (of pair). Example: (87, 110) - item #87 will delete item #110, when #87 gets deleted.
 +
* '''snappedBlocks''': ''Values'' are ''indexes'' of the Blocks array (chunk 0x01F). -1 = snapped to an item and you should use the index of snappedItems.
 +
* '''snappedItems''': ''Values'' are ''indexes'' of the AnchoredObjects array (this chunk). -1 = snapped to a block and you should use the index of snappedBlocks.
 +
* '''snapItemGroups''': Separates item "deletion groups" via a simple number. Usual values are between 0 and 5. You can index these with itemSnapIndexes values.
 +
* '''itemSnapIndexes''': Uses the values above to connect them with the item list. ''Values'' are ''indexes'' of '''snappedBlocks'''/'''snappedItems''' arrays. Any index of this array corresponds to the same AnchoredObjects index, '''except -1''', which means the item is not snapped.
    
  uint32 version
 
  uint32 version
Line 412: Line 439:  
  for each item:
 
  for each item:
 
     node item (CGameCtnAnchoredObject, direct node)
 
     node item (CGameCtnAnchoredObject, direct node)
  if version >= 1:
+
  if version >= 1 && version != 5:
     uint32 size
+
     uint32 connectedItemPairCount
     uint2[size] // 2 uint32 per element
+
     uint2 connectedItemPairs[connectedItemPairCount] // 2 uint32 per element
    if version >= 5:
+
if version >= 5: // TM2020
        if version < 6:
+
    uint32 snappedBlockCount
            uint32
+
    uint32 snappedBlocks[snappedBlockCount]
         uint32 size1
+
    if version < 7:
         uint32[size1]
+
         uint32 snapItemGroupCount
         uint32 size2
+
         uint32 snapItemGroups[snapItemGroupCount]
         uint32[size2]
+
    if version >= 6:
        if version >= 6:
+
         uint32 snappedItemCount
            uint32 size3
+
         uint32 snappedItems[snappedItemCount]
            uint32[size3]
+
    if version >= 7:
            uint32 size4
+
        uint32 snapItemGroupCount
            uint32[size4]
+
        uint32 snapItemGroups[snapItemGroupCount]
            if version >= 7:
+
    if version != 6:
                uint32 size5
+
        uint32 size
                uint32[size5]
+
        uint32[size] // unknown atm
 +
    uint32 itemSnapIndexCount // should be the same as the item count itself
 +
    uint32 itemSnapIndexes[itemSnapIndexCount]
    
'''03043044''' (skippable)
 
'''03043044''' (skippable)
Line 760: Line 789:  
         if version >= 6:
 
         if version >= 6:
 
             float scale
 
             float scale
            if (flags & 4) == 4:
  −
                fileRef packDesc
   
             if version >= 7:
 
             if version >= 7:
 +
                if (flags & 4) == 4:
 +
                    fileRef packDesc
 
                 if version >= 8: // TM 2020
 
                 if version >= 8: // TM 2020
 
                     vec3
 
                     vec3
Line 1,548: Line 1,577:  
* [http://www.xaseco.org/tools.php Extract GBX data] - a PHP script to format and print data from all file types supported by the GBX Data Fetcher module.
 
* [http://www.xaseco.org/tools.php Extract GBX data] - a PHP script to format and print data from all file types supported by the GBX Data Fetcher module.
 
* [http://www.xaseco.org/tools.php Tally GBX versions] - a PHP script to tally some version data from all .Challenge|Map.Gbx files (includes sample challenges in all known versions).
 
* [http://www.xaseco.org/tools.php Tally GBX versions] - a PHP script to tally some version data from all .Challenge|Map.Gbx files (includes sample challenges in all known versions).
 +
* [https://github.com/BigBang1112/gbx-net GBX.NET] - a C#/.NET parser for .Gbx files.
 +
* [https://github.com/donadigo/pygbx pygbx] - a Python library to parse .Gbx files.
 +
* [https://github.com/ThaumicTom/gbx.js gbx.js] - a slim, fast and easy to set up Gamebox (GBX) parser written in vanilla JavaScript.
 +
* [https://github.com/stefan-baumann/ManiaPlanetSharp ManiaPlanetSharp] - a .NET library, written in C#, which provides easy-to-use, object-oriented ways to access data and services related to ManiaPlanet.
 
* [http://micolous.id.au/pages/disasm.html Trackmania Disassembler] - includes a library allowing you to write your own applications that can read the format.
 
* [http://micolous.id.au/pages/disasm.html Trackmania Disassembler] - includes a library allowing you to write your own applications that can read the format.
 
* {{ArchiveOrg|http://tossha.ru/trackstudio/|TrackStudio|https://web.archive.org/web/20160319194133/http://tossha.ru/trackstudio/}} - a Windows TrackMania Forever track editor with 3D interface.
 
* {{ArchiveOrg|http://tossha.ru/trackstudio/|TrackStudio|https://web.archive.org/web/20160319194133/http://tossha.ru/trackstudio/}} - a Windows TrackMania Forever track editor with 3D interface.
33

edits

Navigation menu