Useful C# to IL2CPP Hex Conversions

This has been heavily requested since I started doing IL2CPP hacking tutorials on my YouTube channel (found HERE). I figured, its long over do, time to post and explain different C# to IL2CPP Hex code conversions. Let’s start with the basics

Always Return True as a Boolean

What is a Boolean:
A Boolean is simply a True or False statement. Without realizing it, you think with bool’s in your day to day life, so these are easy to understand. They’re, in a sense, the same as a Yes or No question/answer. If someone asks you  “Can you please pass the butter?” at dinner, Yes would be the same as “true”, No would be the sale as “false!”

C# Code

public bool true() {
return true;
}

IDA/HEX Code

MOV R0,#1
BX LR
Hex: 01 00 A0 E3 1E FF 2F E1

Always Return False as a Boolean

What is a Boolean: See above

C# Code

public bool false() {
return false;
}

IDA/HEX Code

MOV R0,#0
BX LR
Hex: 00 00 A0 E3 1E FF 2F E1

Force Freeze a Number/Int

What is an Int:
Int stands for Integer which is just a fancy word for a basic number. These numbers can come in multiple “flavors” of Int8, Int16, Int32 and Int64. Depending on how high of a number the game needs to display will determine which Integer type is declared. In 90% of IL2CPP hacking I’ve personally done, the only time I see Int64 is when its used for Time. Other than that, I always see Int32 or Int16. Either should work with the code below.

C# Code

public int oInt() {
return 999;
}

IDA/HEX Code

MOV R0, #999
BX LR
Hex: E7 03 00 E3 1E FF 2F E1

Force Freeze a Float Number/Int

What is a Float Number/Int:
As stated above, an Int, aka an Integer, is a fancy word for a number. Although, a Float Int is far different from a boring old Int32. A Float is used in the situation of a number that is constantly changing. For example, in a game where you have a set amount of Race Boost but it depletes as you use it, the number from Max Boost to 0 would be set as a Float as its constantly changing as you earn it or use it. In C# programming, you can tell the simple difference between a Float and a basic Integer simply by if there is a lowercase “f” after the number like below.
You CAN NOT use Hexidecimal number values longer than 4 characters… for example, you could change this to 437B, but not 437BA.

C# Code

private float oFloat()
{
return 999f;
}

IDA/HEX Code

MOV R0, #0x447A
BX LR
hex -> 7A 04 04 E3 1E FF 2F E1