VS Code extension for compiling and decompiling Multi Theft Auto assets with the mta-tea package.
Features
- Right-click an uncompiled file in the Explorer and choose Compile MTA Asset.
- Right-click a file whose name ends with
_encrypted and choose Decompile MTA Asset.
- Select multiple files in the Explorer before running either command.
- Prompt for the TEA key every time a compile or decompile command runs.
- Move each original input file into a sibling
.backup_encoder folder before writing the converted output.
File Naming
The extension treats a file as compiled only when its filename ends with _encrypted.
- Compile:
asset.dff -> asset.dff_encrypted
- Decompile:
asset.dff_encrypted -> asset.dff
Usage in Client Script
Place your encrypted files and use the following pattern to decrypt and load them:
local credentials = {
key = 'your_key',
}
GetFile = function(path)
path = path .. '_encrypted'
local file = fileExists(path) and fileOpen(path, true)
if (not file) then
return false
end
local content = fileRead(file, fileGetSize(file))
content = content and decodeString('tea', content, credentials)
content = content and decodeString('base64', content)
fileClose(file)
return content
end
Call GetFile('asset_name') to retrieve and decrypt the asset file. The function handles TEA decryption and base64 decoding automatically.
Example usage:
local txd = engineLoadTXD(GetFile('files/my_texture'))
engineImportTXD(txd, 123)
local dff = engineLoadDFF(GetFile('files/my_model'))
engineReplaceModel(dff, 123)
local col = engineLoadCOL(GetFile('files/my_collision'))
engineReplaceCOL(col, 123)
This is just an example—adapt the engine functions to your specific asset types.
Development
Install dependencies:
npm install
Run the processor smoke test:
npm test
Open this folder in VS Code, press F5, and use the Extension Development Host to test the Explorer context menu.