Jump to content

Difference between 0x24 and 0x2C tokens


Amineri

Recommended Posts

Up to now I'd never found an instance where declaring an integer constant using 24 or 2C made an noticeable difference, but I finally ran across one.

 

I had been the habit of using 2C tokens as visually for me somehow they seem easier to pick out than the 24 tokens.

 

The original construction was:

if(eItem == 3)
07 88 00 9A 38 3A 00 77 40 00 00 38 3A 24 03 16  

I did some digging on the == operator and it turns out that it is only valid for integers, not for bytes, which is why eItem has a 38 3A byte-to-int token pair in front of it.

 

Interestingly, the 3 value 24 03 also had a 38 3A byte-to-int token pair.

 

When I changed the hex to:

if(eItem == 3)
07 88 00 9A 38 3A 00 77 40 00 00 38 3A 2C 03 16  

the game would crash-to-desktop when the code was executed. Reverting it back to 24 03 solved the issue.

 

Thought I would mention it so if anyone runs across similar crashing issues it might be a little easier to figure out :D

Link to comment
Share on other sites

I seem to recall there are several possible hex values for == and some mathematical operators. Can it be that each one is meant to be used with a specific data type? And is some of them more flexible than others?

I can tell you I once had to change the + hex, I don't remember the exact value, maybe it was 78 and then I changed it to a 90 or 92, don't recall right now, and after the change it worked, when before I was getting ctd's. So maybe the same is true for comparison tokens, and instead of converting the values you can just use the right operator, if there is a "right" operator for each data type.

Link to comment
Share on other sites

When I was trying to sort out what was going on I found this interesting article about typecasting : http://wiki.beyondunreal.com/Typecasting

 

It's definitely true that different operators are used for different types. Some operator types only support certain types of variable types, too.

 

Apparently there is no "==" operator for comparing byte/enum values.

 

To compare a class to none, (e.g. m_kUnit == none) you have to use the 0x72 token (or 0x77 for "!=").

For integer comparison it's 0x9A

For float comparisons it's 0xB4

 

There's no integer version of ABS -- it only works on floats.

 

The "*=" operator has a version for integer on left side (0x9F), and for float on left side (I think 0xB6), but all version require a float on the right side. Using an integer on right side causes CTD.

 

-----------------------

 

As for the conversion tokens, I've been taking notes as to the ones I've found (most weren't defined in the list included with the modding package), and here's what I have so far:

 

Always a 38 ## byte pair:

EX_PrimitiveCast = 0x38
Second bytes I know of:
 EX_RotatorToVector = 0x39
 EX_ByteToInt = 0x3A;  
 EX_IntToByte = 0x3D
 EX_IntToFloat = 0x3F
 EX_FloatToInt = 0x44
 EX_StringToInt = 0x4A

Link to comment
Share on other sites

 

Always a 38 ## byte pair:
EX_PrimitiveCast = 0x38
Second bytes I know of:
 EX_RotatorToVector = 0x39
 EX_ByteToInt = 0x3A;  
 EX_IntToByte = 0x3D
 EX_IntToFloat = 0x3F
 EX_FloatToInt = 0x44
 EX_StringToInt = 0x4A

 

 

These are the ones I've come across:

EX_PrimitiveCast = 0x38;

string(int) 	= 	0x53	(int to string)
int(string) 	= 	0x4A	(string to int)
string(object) 	= 	0x56	(object to string)
float(int)	=	0x3F	(int to float)
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...