Skip to content

Decompiled Lua source code for the 2012 game, The Darkness II

Notifications You must be signed in to change notification settings

FromDarkHell/TheDarknessIIDecompiled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Darkness 2 Decompiled

Decompiled Lua / ActionScript 2.0 source code for the 2012 game, The Darkness II

Extraction

This game (like other Evolution engine games) stores its files in gigantic files of two types:

  1. Gigantic .cache files storing all of the assets based off of that type like Script, Texture
    • These can be broken down further into H, B, F where:
      • 'H' caches contain file headers
      • 'B' caches contain the corresponding binary files (except for sounds, and maybe textures)
      • 'F' caches contain full sound files and textures
  2. .toc which is used to denote the offset, name, and size (among other data) about the sub files in the respective .cache files. Furthermore, these .cache sub-files are compressed using both oodle and lzf compression, of which oodle compression is proprietary. To get around the compression, you can use a QuickBMS script meant for use with QuickBMS

Decompilation

Once you've gotten around the compression / extracted all of the .lua (technically .luac since its compiled lua) from the game, you now get to decompile all of the compiled source! In this case, I used Unluac, tbh I've got no idea on how it works other than some weird techno magic but y'know it works. Then I made a Powershell script in Tools/DecompileLua.ps1 (it goes in a dir right above where your extracted assets are btw)

For the Cache.DLC updates, I imagine that it just overwrites the original file, and so I've extracted those and just thrown the modified decompiled code into /src_DLC

Modding

Quite honestly I very much doubt this could even recompile (and kinda don't care to mess with that right now because euuuugh)... In theory if it could compile, you could make something to redo the compression (probably best to just pick lzf throughout the .cache, I bet D2 could handle it) and reconstruct the .cache file, and then make something to reconstruct the respective .toc files

Other

If you want other info about this game that isn't just staring at the source code, check out the "write-up" I did on my Github Pages

About

Decompiled Lua source code for the 2012 game, The Darkness II

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages