LuaDec
This application is using luadec (http://luadec.luaforge.net/) as a base, but it's compiled with 5.1. Of course 5.0 and 5.1 are a bit different, so it has a lot of erros atm, but at least it prints some output. It will also supress any errors, so instead of quitting, it will continue decompiling (and might crash). If you want to know how many errors it got use the "-d" option to get the debug information.
Luadec will output a "-- Lua5.1" or "-- Warning" or "-- DECOMPILER ERROR" comment to lines, where you should check the output.
Simpler scripts decompiled with luadec are semantically identical to their original counterparts (usually only the line numberings are changed)
Installation
Simply download and extract to a directory. You'll need to have the MS VC++ 2008 redistributables for the application to work. The input lua files must be ANSI encoded too.
The binaries that are provided here are meant for TouchFlo3D, because they use Q16 numeric formats. If you need a generic lua 5.1 decompiler, then get the source code, and copy over the lua directory with the files from a generic lua before compilation
Known bugs
- Luadec sometimes can't determine block endings
- Unassigned local variables might hide useful assignment blocks
ExtLua
ExtLua is a DLL Proxy for lua.dll, that will load user made lua functions into the interpreter that can be used for M3D programming
Unfortunately my attempts to implement this DLL proxy as "lua.dll" failed, so mode9.dll and manila2.exe must be patched to use this dll
To use LuaExt one have to create a loadable dll using the LuaExt SDK
LuaExt will load up the DLL files stored in "HKLM\Software\SztupY\LuaExt" and will run their "lua_addawesomestuff" function whenever M3D tries to create a new lua context using luaL_newstate
Installation
- If you have an M3D version 1.8.5c (for example from xboxmod) then download the cab and install that
- If you have an other version of M3D, you have to patch it. The manual way is the following:
- Copy manila.exe (Raphael), manila2.exe (Patched HD manila) and mode9.dll from your device to your computer
- Open a HEX editor (like HxD)
- Search for the string "lua.dll" and replace it to "aul.dll"
- Re-sign both files with signtool (for example to sign mode9.dll run: signtool sign /f SamplePrivDeveloper.pfx mode9.dll)
- Copy these files back to your device (M3D should be disabled)
- Copy aul.dll and lua.dll to your device's \Windows directory
- Soft reset
Changelog
LuaDec 2.0
- LuaDec has now a built-in heuristic do teremine local declaration and releases
- Luac no longer has the option to output the LDS2 string of the file. Instead luadec has this option
LuaDec 1.9
- Some changes regarding LDS(2) strings and for loops (it's still a bit unstable)
- LuaDec has a new option to disassemble instead of decompile
- The provided lua package (lua, luac and luadec) is now unicode compilant, it will read and write the unicode variants of the scripts instead of the ascii variants.
LuaDec 1.0
- fixed OP_TFORLOOP handling
- added LDS2 functionality to both luadec and luac
LuaDec beta 6
- fixed a crash where luadec encounters unhandled boolean constructs
- luadecguess has now a new heuristic called "fast guess" for large scripts
LuaDec beta 5
- luadecguess can now be parameterized, and is more powerful
LuaDec beta 4
- fixed upvalue handling
- fixed some local variable handlings
- added luadecguess: a local variable declaration place guesser
LuaDec beta 3
- fixed OP_TFORLOOP
- fixed loop variable handings
- added command line options to handle local variable declarations
ExtLua 0.1
- includes lua.dll from ManilaHD
- mode9.dll and manila2.exe must be patched to use this
- Initial release
LuaDec beta 2
- added some workarounds for the crashes. Luadec might output lots of garbage lua code, but it tries not crashing
- fixed OP_TEST (hopefully)
LuaDec beta 1
- Changed to TF3D's strange fixed point numeric encoding format
- Added a lua compiler
- Corrected OP_FORPREP - OP_FORLOOP
- Added some more warnings
- Added automatic local variable declarations where possible
alpha 2
- Fixed constant loading errors
- fixed function variables
- Added handlers to the new opcodes
- Some changes to OP_TEST
alpha 1
- Initial Version