Skip to content

TDUF Patching System

jerome edited this page Jan 28, 2017 · 12 revisions

Mini-patch concept is brought by TDUF, to replace TDUMT abilities (concerning database contents). Patch description is done via a different file format that is JSON.

You'll find more info about JSON format here.

Mini-patch reference

Sample file

A mini-patch file may contain one or more change actions.

{
    "changes" : [
      {
          "type" : "UPDATE",
          "topic" : "CAR_PHYSICS_DATA",
          "ref" : "63698541",
          "values" : [ "63698541", .... ]              
      },
      {
          "type" : "UPDATE_RES",
          "topic" : "CAR_PHYSICS_DATA",
          "ref" : "7856580",
          "value" : "Zagato"              
      }
    ]
}

Actions

Described by the type item:

          "type" : "UPDATE"
  • DELETE: removes an entry
  • MOVE: moves a line to N steps upwards or downwards
  • UPDATE: changes entry contents if it exists, creates it otherwise
  • DELETE_RES: removes a particular resource
  • UPDATE_RES: changes resource value if it exists, creates it otherwise.

Specifying line to delete / move / update

Use ONE of following items, according to your case:

  • If REF available (e.g in CAR_PHYSICS), a single line or resource can be found using this item:

      "ref" : "63698541"
    

^ Example above will affect single entry having 63698541 for REF.

  • Using filter, when REF is not available (e.g in CAR_RIMS), one or more entries can be found using this structure:

      "filter" : [
          {
              "rank" : 1,
              "value" : "63698541"
          },
          {
              "rank" : 2,
              "value" : "1000000215"
          }
      ]
    

^ Example above will affect any entry having 63698541 for first item AND 1000000215 for second item.

New/updated values

  • For resource, use value item:

            "value" : "Zagato"
    
  • For complete entry, use values item:

            "values" : [ "63698541", .... ]
    
  • For some parts of entry, use partialValues item:

      "partialValues" : [
          {
              "rank" : 103,
              "value" : "105"
          }
      ]
    

Strict mode

Available from TDUF 1.1.0

UPDATE and UPDATE_RES instruction types support optional onlyAdd item:

  • true means that only a line will be added if asked REF does not exist,

  • false (default value) acts as adding or replacing line.

        {
            "type" : "UPDATE",
            "onlyAdd" : true,
            "topic" : "CAR_PHYSICS_DATA",
            "ref" : "63698541",
            "values" : [ "63698541", .... ]              
        },
        {
            "type" : "UPDATE_RES",
            "onlyAdd" : true,
            "topic" : "CAR_PHYSICS_DATA",
            "ref" : "7856580",
            "value" : "Zagato"              
        }
    

Smart Patching System (SPS)

Available from TDUF 1.1.0

This feature allows you to use placeholders instead of real data in following items: ref, value, values.

A placeholder is a convenient way to provide data without knowing exact value at the time your patch is created. That exact value can be given later by a properties file, with name matching your mini patch one.

e.g a patch.mini.json file with placeholder,

{
    "changes" : [
      {
          "type" : "UPDATE_RES",
          "topic" : "CAR_PHYSICS_DATA",
          "ref" : "{MYREF}",
          "value" : "{MYNAME}"              
      }
    ]
}

Corresponding property file: patch.mini.json.properties,

MYREF=7856580
MYNAME=Zagato

When applying patch file above, contents of property file will be used to fill templates with provided values.

Special behaviour

  • When a placeholder does not have a value in property file:

    • If it's a ref item, it will be automatically generated. It will thus create a new resource or entry

    • If it's a particular placeholder (as CARID), it will be automatically generated

    • If it's a value item (or part of values, partialValues items), the patch can't be applied.

  • To watch generated values after applying patch, have a look at effective-patch.mini.json.properties file.

Applying mini-patch

Command line

  1. TDU database must be extracted to JSON format

  2. Execute:

     DatabaseTool apply-patch -j <preparedDatabaseDirectory> -p <patchFileName> 
    

DatabaseEditor

  1. Toolbar: Import>TDUF patch
  2. Choose patch file

Installer

Coming soon

Generating mini-patch from a database

Command line

  1. TDU database must be extracted to JSON format

  2. Execute:

     DatabaseTool gen-patch -j <extractedDirectory> -p <patchFileName> -t <topic> -r <REFs> -f <fields>
    

, where:

  • patchFileName is name and location to generated file
  • topic is one of the following: AFTERMARKET_PACKS, CAR_PHYSICS_DATA, CAR_COLORS, RIMS, etc.
  • REFs is a range of entry references to be included, e.g "632567900" or "632567900,652567900"
  • fields is a range of field numbers to be included in a partial patch, e.g "1" or "1,2,3,10"

DatabaseEditor

  1. Toolbar: Export>TDUF patch
  2. Choose entries to export (none selected = all exported)
  3. Choose fields to export (none selected = all exported)
  4. Choose patch file to be created.

Compatibility with first gen tools

Applying a TDUPE performance pack (.tdupk)

  1. TDU database must be extracted to JSON format

  2. Execute:

     DatabaseTool apply-tdupk -j <extractedDirectory> -p <packFileName> -r <REF> -f <fields>
    

, where:

  • packFileName is name and location to source TDUPE file
  • topic is one of the following: AFTERMARKET_PACKS, CAR_PHYSICS_DATA, CAR_COLORS, RIMS, etc.
  • REF is an entry reference to apply performance pack to. Not required, defaults to reference in tdupk file.

Generating mini-patch from/to TDUMT (.pch) files

If provided TDUF patch as source, a PCH file will be generated. And vice-versa.

Execute:

  DatabaseTool convert-patch -p <patchFileName>

, where patchFileName is name and location to source patch file.

You can’t perform that action at this time.