Jump to content
Sign in to follow this  
v00d00

Payday 2 Lua Source (Latest: 27.1 - June 3, 2014)

Recommended Posts

v00d00

Here is all of the Lua source code for Payday 2 that I have written:

Latest Version: 1.9.1 (Update 27.1)

Please login or register to see this link. .zip]

Older Versions:

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Please login or register to see this link.

Share this post


Link to post
Share on other sites
PirateCaptain

Fantastic, thanks a lot v00d00

Your hard work is much appreciated :thumbsup: :thumbsup:

Share this post


Link to post
Share on other sites
Guest

Awesome work, v00d00, awesome work. Keep it up and keep making them fancy digits and symbols roll into town.

I'm kind of shocked that the source is a lot smaller then I expected... Guess it's possibly because I don't mess with sources (freely posted by the devs or gained via other means).

Share this post


Link to post
Share on other sites
Baddog-11

Awesome v00d00 thanks for the source code ^^

Share this post


Link to post
Share on other sites
v00d00

For those wondering how I write the code:

  • Extract the lua-package (acfc1d0890cec72e.bundle), and decrypt the ".lua" files inside, while renaming them to .luac
  • Run an MD5 scan on all old/new files, to find what has changed within the current patch
  • I then use "luadec -dis filename.luac", which generates a Lua "asm" dump. I do this on both the old/new files that have changed
  • Using WinMerge (a diff utility), I compare the old/new "asm" dumps, and then write out the new Lua code using Notepad++ (ie: by hand).

Once that is done, the raw Lua code will internally match. However, the MD5's do not match yet, because debugging is enabled on the original files (local variable names, and line #'s). So, for the final step I run ChunkSpy (again, modded with the new opcodes) on both the original and my .luac files. When I run a diff of the outputs, and I can see the original variable names compared to mine, and make the alterations required. Finally, I adjust line #'s to match the original code (also visible with ChunkSpy), and proceed to the next file.

Standard Luadec (without the -dis parameter) can only do so much, without a major overhaul. For instance:

. Make the name changes to the code, and I get this:

local temp = true

local asd = temp and true or false




Compile / decompile that, and you get:


local temp = true

 -- DECOMPILER ERROR: Confused while interpreting a jump as a 'while'



end

local asd = true



Which is wrong obviously.  However, run it through "luadec -dis", and you get:


  1 [-]: LOADBOOL  R0 1 0       ; R0 := true

  2 [-]: TEST      R0 0         ; if not R0 then PC := 5

  3 [-]: JMP       5            ; PC := 5

  4 [-]: JMP       8            ; PC := 8

  5 [-]: LOADBOOL  R1 0 0       ; R1 := false

  6 [-]: JMP       9            ; PC := 9

  7 [-]: LOADBOOL  R1 0 1       ; R1 := false; PC := %d

  8 [-]: LOADBOOL  R1 1 0       ; R1 := true

  9 [-]: RETURN    R0 1         ; return



Here, you can see the raw code.  Line 1 sets Register 0 (a temp/local variable) to true, which is easy code:


local var_a = true



Lines 2 through 8 can be identified as an in-line if, by lines 7-8 (which would not be present in a standard if/then statement).  Line 2-3 tests R0, and if it's false, jumps to line 5 setting R1 to false, and finally jumping to line 9 (the exit).  If that test fails however, it will reach line 4, which jumps to line 8, and sets R1 true.  This can only be written as:


local var_b = var_a and true or false



Doing it wrong, with for instance the following code:


local var_b = not var_a and false or true



Generates this internal code (lines 2-4):


  1 [-]: LOADBOOL  R0 1 0       ; R0 := true

  2 [-]: TEST      R0 1         ; if R0 then PC := 4

  3 [-]: JMP       4            ; PC := 4

  4 [-]: LOADBOOL  R1 1 0       ; R1 := true

  5 [-]: RETURN    R0 1         ; return



functionally, it is identical.  If R0 is true, R1 is set true.  Default state is false, so nothing needed if that is the case.  But, the code is different than the original (and, is in fact smaller and faster than the original), so although it functions the same, it will not generate identical MD5 hashes.  This leaves me with the following code:




local var_a = true

local var_b = var_a and true or false



It now compiles to the same code as the original, however the MD5 still fails because the variable names are different.  Running both .luac's through ChunkSpy, and comparing shows the following:

local temp = true

local asd = temp and true or false

And now it's a 100% match to the original. In this example the decompile (which had errors), did reveal the variable names (which could bypass the ChunkSpy steps). Most of the time there are variables which will not be made apparent by the decompile, and so the ChunkSpy compare is still required.

When I started out, much was trial and error - continuously compiling/disassembling my code, until it matched. As time passed however, I have learned to recognize specific lines, and know how they function. Now when I write the code, it requires very little re-checking, but I still do the occasional compile/disassemble just to update the WinMerge diff outputs (easier to track progress / current line). After staring at similar code for hours, it can be very easy to lose track of where you are :)

Share this post


Link to post
Share on other sites
PirateCaptain

Thank you V00d00 for yet another fine update :crew:

Share this post


Link to post
Share on other sites
sannas

Thank you man... since I am new here can you explain to me what to do? how to decryp and stuff I dont know...I extracted the files form zip..and I have many folders with .lua files...what are the next steps?

Sorry for being an idiot:(

Share this post


Link to post
Share on other sites
PirateCaptain

Thank you man... since I am new here can you explain to me what to do? how to decryp and stuff I dont know...I extracted the files form zip..and I have many folders with .lua files...what are the next steps?

Sorry for being an idiot:(

You just open those luas and read them, find what you want to change and do it in a new lua file.

Share this post


Link to post
Share on other sites
MitchellFarted

Thank you man... since I am new here can you explain to me what to do? how to decryp and stuff I dont know...I extracted the files form zip..and I have many folders with .lua files...what are the next steps?

Sorry for being an idiot:(

If you're trying to install cheats, this isn't the place to be. These are the source files, from which are used to MAKE the cheats. If you don't know what to do with these files, I don't think you should be trying to code your own cheats. Especially when these same forums host numerous premade trainers.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×