GTAMP.com

Grand Theft Auto Media Press
It is currently Sat May 26, 2018 5:58 am

All times are UTC




Post new topic Reply to topic  [ 148 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
PostPosted: Thu Sep 26, 2013 9:12 am 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 513
Location: Estonia
Does your decompiler decompiles WHILE_EXEC ENDWHILE commands?

Do you know what these means: S_PLUS_S, S_MINUS_I, i know they are operators but whats the I and S?
Integer and String?

I did my own small mini decompiler few months ago, just very small, yesterday i was in a mood to decompile WHILE_EXEC ENDWHILE commands but its not complete because of these S_MINUS_I etc things. But it was alot easier to write new one from scratch than integrate something into C++ code of yours. I did it in Delphi. It decompiles simple WHILE_EXEC ENDWHILE loops. Also "++" and "--" for correct variables.

I added other commands as needed for my small test scripts. I only focused atm on loops and IF_ENDIFs.
By writing my own code i know how all works and how i could make different things.

Again, i repeat: im focused on loops and IF_ENDIFs. Nothing fancy, so its small and clean. For very specific tasks only.

Must finish that before trying IF_ENDIF. Especially nested things.

WHILE_EXEC could be also nested?

I must understand whats the difference between the S and I

Edit!
For ex. my simple script:
Code:
PLAYER_PED player = (49.5, 46.5, 1.0) 25 0


COUNTER loop = 321

LEVELSTART
WHILE_EXEC ( loop< 5621 )
do_nowt
endwhile

LEVELEND


It used ID: 86 which is "S_LESS_I"
"loop" is string in his own way, but what difference it makes to miss2?
Its just variable.

I dont get it.

TM or anybody, do you have a complete list what kind of types and operators can be used to compare/add/ divide different things? Are they all documented correctly in dma docs?

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Thu Sep 26, 2013 10:12 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1329
Location: GTAMP.com
S might be Signed Integer.


Top
 Profile  
 
PostPosted: Thu Sep 26, 2013 8:14 pm 
Offline
User avatar

Joined: Fri Apr 24, 2009 9:43 pm
Posts: 513
Location: Estonia
That makes sense. Thanks.

_________________
Always wear safety glasses while programming.


Top
 Profile  
 
PostPosted: Sat Sep 28, 2013 8:14 am 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:00 pm
Posts: 953
Location: F21B3EED
Sektor wrote:
S might be Signed Integer.

Not in this case.

Sint32 = Signed Integer (32 bits)

B-$hep wrote:
It used ID: 86 which is "S_LESS_I"
"loop" is string in his own way, but what difference it makes to miss2?
Its just variable.

I dont get it.

Read the source dude... its all there. Just look at the functions... it cant be that hard.

S_EQUAL_I = String Equal Integer (= checks if variable value equals integer)

B-$hep wrote:
TM or anybody, do you have a complete list what kind of types and operators can be used to compare/add/ divide different things? Are they all documented correctly in dma docs?

The complete list is in the source code of Epic GTA2 Script Decompiler.

DMA docs, dont trust them at all. I Went through them all, and corrected billions of incorrect information. The correct information is encoded into the sources, once again.

Syntax: [ Download ] [ Hide ]
Using GTA2 Script Syntax Highlighting
// math functions: (note: S_MINUS_I wont compile!)
TWO_PARAMS_LAYOUT(S_PLUS_I,  sprintf_str("%s + %d", getname(data.var1).c_str(), data.sintvar2));
TWO_PARAMS_LAYOUT(I_PLUS_S,  sprintf_str("%d + %s", data.sintvar1, getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT(I_MINUS_S, sprintf_str("%d - %s", data.sintvar1, getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT(S_PLUS_S,  sprintf_str("%s + %s", getname(data.var1).c_str(), getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT(S_MINUS_S, sprintf_str("%s - %s", getname(data.var1).c_str(), getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT(DECREMENT, sprintf_str("--%s",    getname(data.var1).c_str()));
TWO_PARAMS_LAYOUT(INCREMENT, sprintf_str("++%s",    getname(data.var1).c_str()));

FOUR_PARAMS_LAYOUT(S_IS_S_MINUS_I,  sprintf_str("SET %s = (%s - %d)",   getname(data.var1).c_str(), getname(data.var2).c_str(), data.sintvar3));
FOUR_PARAMS_LAYOUT(S_IS_S_PLUS_I,   sprintf_str("SET %s = (%s + %d)",   getname(data.var1).c_str(), getname(data.var2).c_str(), data.sintvar3));
FOUR_PARAMS_LAYOUT(S_IS_S_DIV_I,    sprintf_str("SET %s = (%s / %d)",   getname(data.var1).c_str(), getname(data.var2).c_str(), data.sintvar3));
FOUR_PARAMS_LAYOUT(S_IS_S_MULT_I,   sprintf_str("SET %s = (%s * %d)",   getname(data.var1).c_str(), getname(data.var2).c_str(), data.sintvar3));
FOUR_PARAMS_LAYOUT(S_IS_S_MOD_I,    sprintf_str("SET %s = (%s MOD %d)", getname(data.var1).c_str(), getname(data.var2).c_str(), data.sintvar3));
FOUR_PARAMS_LAYOUT(S_IS_S_MINUS_S,  sprintf_str("SET %s = (%s - %s)",   getname(data.var1).c_str(), getname(data.var2).c_str(), getname(data.var3).c_str()));
FOUR_PARAMS_LAYOUT(S_IS_S_PLUS_S,   sprintf_str("SET %s = (%s + %s)",   getname(data.var1).c_str(), getname(data.var2).c_str(), getname(data.var3).c_str()));
FOUR_PARAMS_LAYOUT(S_IS_S_DIV_S,    sprintf_str("SET %s = (%s / %s)",   getname(data.var1).c_str(), getname(data.var2).c_str(), getname(data.var3).c_str()));
FOUR_PARAMS_LAYOUT(S_IS_S_MULT_S,   sprintf_str("SET %s = (%s * %s)",   getname(data.var1).c_str(), getname(data.var2).c_str(), getname(data.var3).c_str()));
FOUR_PARAMS_LAYOUT(S_IS_S_MOD_S,    sprintf_str("SET %s = (%s MOD %s)", getname(data.var1).c_str(), getname(data.var2).c_str(), getname(data.var3).c_str()));

// boolean comparison functions with max 2 params:
TWO_PARAMS_LAYOUT_BOOL(S_EQUAL_I,           sprintf_str("%s = %d",  getname(data.var1).c_str(), data.sintvar2));
TWO_PARAMS_LAYOUT_BOOL(S_GEQUAL_I,          sprintf_str("%s >= %d", getname(data.var1).c_str(), data.sintvar2));
TWO_PARAMS_LAYOUT_BOOL(S_GREATER_I,         sprintf_str("%s > %d",  getname(data.var1).c_str(), data.sintvar2));
TWO_PARAMS_LAYOUT_BOOL(S_LESS_I,            sprintf_str("%s < %d",  getname(data.var1).c_str(), data.sintvar2));
TWO_PARAMS_LAYOUT_BOOL(S_LEQUAL_I,          sprintf_str("%s <= %d", getname(data.var1).c_str(), data.sintvar2));
TWO_PARAMS_LAYOUT_BOOL(S_EQUAL_S,           sprintf_str("%s = %s",  getname(data.var1).c_str(), getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT_BOOL(S_GEQUAL_S,          sprintf_str("%s >= %s", getname(data.var1).c_str(), getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT_BOOL(S_GREATER_S,         sprintf_str("%s > %s",  getname(data.var1).c_str(), getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT_BOOL(S_LESS_S,            sprintf_str("%s < %s",  getname(data.var1).c_str(), getname(data.var2).c_str()));
TWO_PARAMS_LAYOUT_BOOL(S_LEQUAL_S,          sprintf_str("%s <= %s", getname(data.var1).c_str(), getname(data.var2).c_str()));
Parsed in 0.013 seconds, using GeSHi 1.0.8.10


How hard it really is, to figure out that %s means string and %d means integer? Note that "sintvar" means signed integer variable. Check sources for more information.

_________________
My GTA2 related projects:


Top
 Profile  
 
PostPosted: Wed Feb 21, 2018 9:23 pm 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1329
Location: GTAMP.com
I tried compiling this in VS2013. I needed to add #include <functional> to get it to compile.

When I tried to use it in Epic Map Editor, I got "Error: File not found or cannot be read". Does the map editor use a different version of the decompiler or did VS2013 break something?

I mostly just want to enable SCR_debug_all_lines.


Top
 Profile  
 
PostPosted: Thu Feb 22, 2018 11:28 am 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:00 pm
Posts: 953
Location: F21B3EED
Sektor wrote:
I tried compiling this in VS2013. I needed to add #include <functional> to get it to compile.

When I tried to use it in Epic Map Editor, I got "Error: File not found or cannot be read". Does the map editor use a different version of the decompiler or did VS2013 break something?

I mostly just want to enable SCR_debug_all_lines.

I think there is some problem with the way you compiled the DLL. Looking at my sources comments, my issue was:
Quote:
// Note: To be able to use this as a DLL, you must set both projects to use the
// same setting: "Multi-threaded DLL (/MD)" or it will crash!

_________________
My GTA2 related projects:


Top
 Profile  
 
PostPosted: Thu Feb 22, 2018 11:59 am 
Offline
Boss
User avatar

Joined: Tue Mar 04, 2008 6:51 am
Posts: 1329
Location: GTAMP.com
It was already set to that. It’s not crashing, it’s returning an error code when trying to read the SCR. Probably some IO works different on VS2013.


Top
 Profile  
 
PostPosted: Thu Feb 22, 2018 5:56 pm 
Offline
User avatar

Joined: Fri Jan 29, 2010 3:00 pm
Posts: 953
Location: F21B3EED
Sektor wrote:
It was already set to that. It’s not crashing, it’s returning an error code when trying to read the SCR. Probably some IO works different on VS2013.

Ah i see. The file pointer is returning NULL. Seems like your SCR file does not have sufficient rights for reading, or your compiled DLL does not have those rights.

_________________
My GTA2 related projects:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 148 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group