Duke Grabowski LDT: Difference between revisions

From XentaxWiki
Jump to navigation Jump to search
imported>Multimedia Mike
(Created page with "* Return to the list of games == LDT == The game Duke Grabowski: Mighty Swashbuckler uses the LDT files to store subtitle data.")
 
imported>Ikskoks
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* [[GRAFs|Return to the list of games]]
* [[GRAFs|Return to the list of games]]


== LDT ==  
== LDT ==
The game Duke Grabowski: Mighty Swashbuckler uses the LDT files to store subtitle data.
The game Duke Grabowski: Mighty Swashbuckler uses the LDT files to store subtitle data. The files are actually just regular text encoded as little-endian UTF-16 (UTF-16-LE) but with no byte order mark (BOM). However, the files are also encrypted with a simple cipher, likely to thwart casual analysis or modification.
 
== Text Structure ==
The text inside of the file contains a sequence of subtitles with no line breaks but delimited with the marker <!>. Each subtitle is formatted as such:
 
Timestamp<!>Duration<!>Subtitle 1<!>Subtitle 2<!>
 
The timestamp and duration fields are floating point numbers representing seconds.
 
== Cipher ==
The LDT files are encrypted with a simple cipher. The key to decrypt all of the files is hardcoded in the game's C# binary.
 
To decrypt the file, process each byte by subtracting successive values from the key:
 
  For i in 0 .. length(encrypted_LDT)
    decrypted_LDT[i] = encrypted_LDT[i] - (key[i MOD length(key)])
 
== Recovering the Key ==
To recover the encryption key, either:
 
# Decompile the C# game binary.
# Perform cryptanalysis on an LDT file by exploiting the knowledge that many of the odd characters in the plaintext are 0 (since most of the characters are in the ASCII range) and that the delimiter "<!>" occurs frequently in the plaintext.
 
 
[[Category:File Format]]

Latest revision as of 12:18, 4 January 2021

LDT

The game Duke Grabowski: Mighty Swashbuckler uses the LDT files to store subtitle data. The files are actually just regular text encoded as little-endian UTF-16 (UTF-16-LE) but with no byte order mark (BOM). However, the files are also encrypted with a simple cipher, likely to thwart casual analysis or modification.

Text Structure

The text inside of the file contains a sequence of subtitles with no line breaks but delimited with the marker <!>. Each subtitle is formatted as such:

Timestamp<!>Duration<!>Subtitle 1<!>Subtitle 2<!>

The timestamp and duration fields are floating point numbers representing seconds.

Cipher

The LDT files are encrypted with a simple cipher. The key to decrypt all of the files is hardcoded in the game's C# binary.

To decrypt the file, process each byte by subtracting successive values from the key:

 For i in 0 .. length(encrypted_LDT)
   decrypted_LDT[i] = encrypted_LDT[i] - (key[i MOD length(key)])

Recovering the Key

To recover the encryption key, either:

  1. Decompile the C# game binary.
  2. Perform cryptanalysis on an LDT file by exploiting the knowledge that many of the odd characters in the plaintext are 0 (since most of the characters are in the ASCII range) and that the delimiter "<!>" occurs frequently in the plaintext.