SA-MP Forum
November 20, 2009, 02:26:41 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Hosted tab listings available from serverFFS
 
   Home   Help Login Register  
Pages: [1] 2 3 ... 21
  Print  
Author Topic: [RELEASE] DeAMX 0.3: .amx -> .pwn decompiler  (Read 52361 times)
trc_
Little Clucker
*
Posts: 41


View Profile
« on: January 30, 2008, 06:50:48 am »

DeAMX v0.3

Lost your gamemode source code and don't want to rewrite all of it? Want to take a look at how other gamemodes implement those interesting features? Now you can!

New release
0.3 is out now. Main new feature is propagation of argument types of functions: if DeAMX found out that one of the arguments of a function is a float, and another function passes one of its local variables to it, it will mark that local variable as a float also. The calling function may also pass one of its own arguments, so that we in turn know more about other functions calling this function.

Also, return types of functions are recognized now.

Features
  • Takes any .amx file that was generated by the Pawn compiler and turns it back into a .pwn file
  • Recognizes functions, if, if/else, for, while, and switch/case constructs, and ternary operators.
  • Uses public function names if available.
  • Recognizes type of most local and global variables. Finds array dimensions.
  • Contains signatures for all SA-MP native functions and callbacks.
  • Finds out the types of arguments and return values of script defined functions.
  • Recognizes what arguments of script-defined functions are used for (e.g. player id, object id) and gives them sensible names.

Notes
  • This is an early release. It may not correctly decompile all scripts.
  • Known issue: prototypes of script-defined functions are not applied to calls of those functions before the function definition. This means that e.g. a constant float argument will be interpreted as an int.
Usage
DeAMX is a Lua script: you need Lua to run it. For detailed usage instructions and the licence, see readme.txt in the .zip.


>> Download v0.3 here! <<
(Download link updated as Filefront will be going down soon)

Disclaimer
The author is in no way responsible for what you do with this decompiler. You are not allowed to decompile someone else's script and re-release it as your own script, unless explicitely approved by the script's author.
« Last Edit: March 30, 2009, 08:12:31 am by trc_ » Logged
Scott[LT]
Huge Clucker
***
Posts: 335


View Profile
« Reply #1 on: January 30, 2008, 07:14:29 am »

if it works then this will be cool i tried to decompile but dont works for me something i do wrong
Logged

trc_
Little Clucker
*
Posts: 41


View Profile
« Reply #2 on: January 30, 2008, 07:19:44 am »

If you get an error message from deamx ("error in deamx_blah.lua line blah") there's not much you can do. Tell me where I can get the .amx file you're trying to decompile and I'll take a look at it for the next version. Same goes for any other files that people have errors with btw.

If you got a different error message (one that doesn't state a .lua file where the error occured), you may be doing something wrong. If your error doesn't name a .lua file please explain what you did exactly.
Logged
DragSta
High-roller
*****
Posts: 1237



View Profile
« Reply #3 on: January 30, 2008, 07:42:54 am »

Wow this is great! I didnt think this was possible from what soem people have said Cheesy Great work!
Logged


Luxeon
Gangsta
****
Posts: 543



View Profile
« Reply #4 on: January 30, 2008, 07:43:25 am »

wow ,you rock !  afro
Logged

SAMP isn't giving their source availible on the download page.
Why should I do?
Jashugan
Huge Clucker
***
Posts: 408


View Profile WWW
« Reply #5 on: January 30, 2008, 07:43:51 am »

Very nice!!
Logged


LOS SANTOS - SAN FIERRO - LAS VENTURAS ALL IN ONE PUBLIC ENEMY
NEW MISSIONS, BIZ, HOUSES, UPGRADES AND MORE! VISIT PEN1 ULTIMATE SERVER:
IP: 85.17.200.135:7777
TheMaTrIx4057
High-roller
*****
Posts: 1502



View Profile
« Reply #6 on: January 30, 2008, 07:45:01 am »

Awesome Thx!
Logged

Antironix
High-roller
*****
Posts: 2051


View Profile
« Reply #7 on: January 30, 2008, 07:45:21 am »

There goes the .amx security xD But good job!
Logged
John.
Big Clucker
**
Posts: 80


View Profile
« Reply #8 on: January 30, 2008, 07:46:08 am »

Please can someone upload it somewhere else cause i have probs with filefront  confused, thnx in advance...
Logged
trc_
Little Clucker
*
Posts: 41


View Profile
« Reply #9 on: January 30, 2008, 07:55:21 am »

File size is not a problem, it has decompiled a 5000+ line script without problems (TaXi FR). I'll take a look at it.
Logged
Packie 
Gangsta
****
Posts: 847


View Profile
« Reply #10 on: January 30, 2008, 07:56:53 am »

Excellent.   Shocked
Logged

psn id: Peasantslayer
Killerkid.
Gangsta
****
Posts: 864



View Profile
« Reply #11 on: January 30, 2008, 08:00:04 am »

Can you upload to a new host.
i cant download.
Logged

Killerkid.
Gangsta
****
Posts: 864



View Profile
« Reply #12 on: January 30, 2008, 08:21:34 am »

It makes a blank gamemode have 5 errors (new.pwn)

Code:
error 025: function heading differs from prototype
error 025: function heading differs from prototype
error 025: function heading differs from prototype
error 035: argument type mismatch (argument 2)
error 025: function heading differs from prototype

Anyway nice  Smiley
Logged

trc_
Little Clucker
*
Posts: 41


View Profile
« Reply #13 on: January 30, 2008, 08:30:30 am »

Also, I compiled and decompiled the original LVDM.  This:

PAWN Code:
static
g_sModelUse[(611 - 400) + 1];

Became:

PAWN Code:
new glob8[212][1];
611 - 400 + 1 = 212. The [1] means g_sModelUse[value][0] is used somewhere.

Quote from: Alex
And:

PAWN Code:
public SendPlayerFormattedText(playerid, const str[], define)

Became:

PAWN Code:
public SendPlayerFormattedText(playerid, arg1[], arg2[])
There's no way to determine if an argument is "const" from the amx file. And function prototypes aren't perfect yet.

Quote from: Alex
Both of which meant the script didn't compile.
It's not the goal of this decompiler to create perfectly compileable pwn files. The goal is to be able to look at the code and eventually recover parts of it.

Quote from: Alex
And it doesn't forward custom public functions.
I can add that in a later release I guess.


Edit: your YSI crash is because of a ternary operator btw. Totally forgot about those, heh.
Logged
Felle
Huge Clucker
***
Posts: 354


View Profile
« Reply #14 on: January 30, 2008, 08:31:53 am »

I must say this looks very nice!
Good job and good luck with it in the future! Smiley
Logged
Pages: [1] 2 3 ... 21
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF one | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!