0danny / AssettoTools

Assetto Corsa car modifier.
8 stars 0 forks source link

Assetto Tools


Assetto Corsa car modifier.

Release 0.1 is available in the release section of this repository.

Pictures

image

TODO

ACD Extractor

Below is an explanation on how the CreateKey & Decryption functions work. Assetto utilises a simple ROT algorithim for the encryption/decryption.

Helper Functions

Int To Byte

(byte)((value % 256 + 256) % 256);

CreateKey()

Params

Assetto uses the folder name of the car to create an encryption/decryption key. Once the .acd is packed with the key, if the folder name is changed it will no longer be decryptable. In the example below the folder name we are using is:

ks_audi_sport_quattro

Key Structure

The key is structured as follows:

000-000-000-000-000-000-000-000

Each octet is concatenated with a "-" delimiter.


Octet 1

     folderName = folderName.ToLower();

     int aggregateSeed = folderName.Aggregate(0, (int current, char t) =>
     {
        return current + t;
     });

Firstly the folderName is converted to lower case and its characters represented as its unicode counterpart are summed together, this gives:

2278

The process of aggregation is shown below.

Current: 0, T: k, T(NUM): 107
Current: 107, T: s, T(NUM): 115
Current: 222, T: _, T(NUM): 95
Current: 317, T: a, T(NUM): 97
Current: 414, T: u, T(NUM): 117
Current: 531, T: d, T(NUM): 100
Current: 631, T: i, T(NUM): 105
Current: 736, T: _, T(NUM): 95
Current: 831, T: s, T(NUM): 115
Current: 946, T: p, T(NUM): 112
Current: 1058, T: o, T(NUM): 111
Current: 1169, T: r, T(NUM): 114
Current: 1283, T: t, T(NUM): 116
Current: 1399, T: _, T(NUM): 95
Current: 1494, T: q, T(NUM): 113
Current: 1607, T: u, T(NUM): 117
Current: 1724, T: a, T(NUM): 97
Current: 1821, T: t, T(NUM): 116
Current: 1937, T: t, T(NUM): 116
Current: 2053, T: r, T(NUM): 114
Current: 2167, T: o, T(NUM): 111

The result of 2278 is then converted to a single byte represention using the helper function intToByte shown above which yields:

230

This is the first octet of the key.


Global Variables

a = folderName Length

b = folderName Array

Octet 2

For convenience the rest of the calculations will be represented as a math/programming expression. Treat summation as a simple loop.

temp = 0

image

Octet 3

temp = 0

image

Octet 4

temp = 5763

image

Octet 5

temp = 66

image

Octet 6

temp = 101

image

Octet 7

temp = 171

image

Octet 8

temp = 171

image

Touches

All octets are ran through the IntToByte function and their product is concatenated using a "-" delimiter as seen below.

key = string.Join("-", new object[]
{
  octet1,
  octet2,
  octet3,
  octet4,
  octet5,
  octet6,
  octet7,
  octet8
});

I understand the above probably looks like gibberish and it's most likely easier to just read the code, however I thought I might aswell include it anyways.

Decrypt()

Params

The decrypt & encrypt functions both make use of the key created above to decrypt the values within the ACD file.

Encrypt()

Params