0

So recently decided to really knuckle down and try to figure out how to mod KOF XIII. The game utilizes Lua files, which are XOR encrypted with the key 0x66, and compiled. Made a Python Script to quickly decrypt them, as well as generate a ,bat that can be used in conjunction with Unluac to view/edit them My problem is for the life of me I can't compile them back. I've tried compiling loads of Lua builds and LuaTools but no matter what I try, the compiled file is scuffed. I'm not familiar enough with Lua to diagnose the problem, so any insight would be massively appreciated Here's a ZIP with the script so far, plus any file I think could help. The real problem is Luac, but as stated, I truly have no idea how to fix it https://cdn.discordapp.com/attachments/587805889331855470/1091406803436314665/KOF_XIII_LUA_ENCODER_stuff.zip

So the skinny is that I expected, upon putting the decompiled file in to luac.exe, for the luac.out to resemble the decrypted file before decompilation. However no matter what parameters i mess with, it seems I lack the knowhow to properly diagnose what part of the process specifically is messing up the output EXAMPLE (https://i.stack.imgur.com/1UXfi.png) (https://i.stack.imgur.com/pa3fl.png)

Oh and one more thing, probably visible from the images but it seems KOF XIII Luas were compiled with 5.1 with int_size of 32-bit if that helps at all

  • The original bytecode file seems to have debug info stripped. Use `-s` command line option of `luac` to strip it. – ESkri Mar 31 '23 at 18:37
  • Oh that is beautiful! That definitely helps, but it seems the output is still drastically different. Tried compiling to every platform and no luck. The decrypted file is 3,413,014 bytes whereas the recompiled one is 3,479,138. What could be causing the balloon in size? – Yoshin Pixels Mar 31 '23 at 19:13
  • A Lua decompiler does not guarantee exact compilation result. So, it is OK to have a difference. – ESkri Apr 03 '23 at 03:14
  • I get that, my problem isn't that it's different, it's that it's not even remotely the same – Yoshin Pixels Apr 04 '23 at 18:33
  • Does it work the same? – ESkri Apr 05 '23 at 00:06
  • Sadly no, that's why I'm wondering if I'm missing something, like what parameters can affect the output? – Yoshin Pixels Apr 11 '23 at 17:55
  • A Lua deobfuscator frequently gives wrong result. – ESkri Apr 12 '23 at 07:10

0 Answers0