-
Notifications
You must be signed in to change notification settings - Fork 0
Patching Database
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.
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"
}
]
}
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.
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.
-
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" } ]
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" }
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.
-
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.
-
TDU database must be extracted to JSON format
-
Execute:
DatabaseTool apply-patch -j <preparedDatabaseDirectory> -p <patchFileName>
- Toolbar: Import>TDUF patch
- Choose patch file
Coming soon
-
TDU database must be extracted to JSON format
-
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"
- Toolbar: Export>TDUF patch
- Choose entries to export (none selected = all exported)
- Choose fields to export (none selected = all exported)
- Choose patch file to be created.
-
TDU database must be extracted to JSON format
-
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.
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.