Skip to content

FileDBReader: Writing Interpreters

taubenangriff edited this page Mar 13, 2024 · 1 revision

Sample Interpreter

<Converts>
    <Default Type ="Int32" /> <!-- If a node isn't covered by any other conversions, the tool converts to this default type. It's not nessecary to have this -->
    <InternalCompression>
        <Element Path="//AreaManagerData/None/Data" CompressionVersion="2">
            <ReplaceTagNames>
                <!-- ensure that Original and Replacement are both unique! -->
                <Entry Original="Delayed Construction" Replacement="DelayedConstruction"/>
            </ReplaceTagNames>
        <Element>
    </InternalCompression>
    <Converts>
        <Convert Path ="//VegetationPropSetName" Type="String" Encoding="UTF-8" />
        <Convert Path ="//GlobalAmbientName" Type="String" />
        <Convert Path ="//HeightMap/HeightMap" Type="UInt16" Structure="List" />
        <Convert Path ="//GuidVariationList" Type="Int32" Structure="Cdata" />
        <Convert Path="//MapTemplate/TemplateElement/Element/Size" Type="Int16">
            <!-- This Enum will map the converted value 0 to Small, 1 to Medium and 2 to Large. Ensure that Name and Value are both unique -->
            <Enum>
                <Entry Value="0" Name="Small" />
                <Entry Value="1" Name="Medium" />
                <Entry Value="2" Name="Large" />
            </Enum>
        </Convert>
    </Converts>
</Converts>

Internal Compression

Be aware that Ubisoft's files can contain other files, which you have to decompress while interpreting.

When looking at the initial decompress, the xml node structure normally looks like this, in which case the bytesize is stored along with the file:

<None>
    <ByteCount />
    <Data />
</None>

When using the internal decompression in your interpreter file, the ByteCount is automatically overwritten if it exists

notable examples of this are AreaManagerData and SessionData/BinaryData

Documentation

InternalCompression Arguments

  • Path: Path that contains the filedb file
  • CompressionVersion: Compression Version of the inner file

Convert Arguments

  • Path: Xpath that selects nodes to be converted.
  • Type: primitive as it occurs in .NET system
  • Encoding: Encoding as in .NET encoding
  • Structure: Can be either Default, List or Cdata. If empty, Default is used.
  • Enum: Define your own mapping for IDs as seen in the sample interpreter. Every

Type, Encoding and Structure can also be used for Default.