Help! Assembly-CSharp.dll vs dump.cs

roflmao1337

Platinian
Original poster
Dec 26, 2018
14
2
3
36
Germany
Hello,

I have used a Il2CppDumper to create those files out of an apk.
Inspecting the .dll with dnSpy and the dump with Notepad++, they are both pretty much the same, apart from the way the code is written.

I have an understanding question because I want to modify a function.

the dump file has a function

// RVA: 0xBEFEDC Offset: 0xBEFEDC VA: 0xBEFEDC
public int get_gold() { }
// RVA: 0xBEFEE4 Offset: 0xBEFEE4 VA: 0xBEFEE4
public void set_gold(int value) { }

in the Assembly-CSharp.dll the same function reads:

// Token: 0x1700082E RID: 2094
// (get) Token: 0x06001140 RID: 4416 RVA: 0x0000A638 File Offset: 0x00008838
// (set) Token: 0x06001141 RID: 4417 RVA: 0x00002050 File Offset: 0x00000250

[Attribute(Name = "ProtoMemberAttribute", RVA = "0x68D2B0", Offset = "0x68D2B0")]
[Attribute(Name = "DefaultValueAttribute", RVA = "0x68D2B0", Offset = "0x68D2B0")]

public int gold
{
[Address(RVA = "0xBEFEDC", Offset = "0xBEFEDC", VA = "0xBEFEDC")]
get
{
return 0;
}
[Address(RVA = "0xBEFEE4", Offset = "0xBEFEE4", VA = "0xBEFEE4")]
set
{
}
}

Basically I want to modify the setter function to public void set_gold(9999) { }

How would I do that in the Hex editor of libil2cpp.so ?

And also can somebody maybe tell me what is purple and green stuff of the Assembly-CSharp.dll which is not in the dump file?

Thanks in advance!
 

TechX

Platinian
Oct 18, 2017
23
120
28
33
You never modify the set, always modify the get first off. Secondly, you need to learn ARM to Hex and the difference between armv7a (32bit) hex bytes and armv8a (64bit) hex bytes. They're very different.

Generally modifying an int is easy, so for the example you gave, its all just how people feel comfortable. Personally, I like going through the DLL in dnSpy to find the values to mod because I feel its faster and easier to find values since you can search more easily. While you can't modify code in dnSpy and compile BACK to IL2CPP, its the easiest route in my opinion

As far as the Int modding itself, you need the bytes. I don't personally know the armv8a bytes, but v7a, you'd do something like this
Find the offset for get_gold, in this case its "0xBEFEDC," search that in your hex editor with the libIL2CPP.so file open in the hex editor. From there, you need your bytes, v7a example below
01 00 A0 E3 1E FF 2F E1
Those first 2 bytes (the 01 00) can be modified for integers. Pull up your calculator on your computer, put it to Scientific, then in Decimal, for the example I know for sure, put in 69, then hit the Hexidecimal button. It'll change to 45, so you'd change your bytes to

45 00 A0 E3 1E FF 2F E1

if you wanted to do higher than 255, you need to modify the first 2 bytes, so you could do 32767 (I don't now how to do larger), it'd be

7F FF A0 E3 1E FF 2F E1

If you do 8F, for example for the first byte to try higher than 32767, you get negative numbers.
 
  • Like
Reactions: csj

roflmao1337

Platinian
Original poster
Dec 26, 2018
14
2
3
36
Germany
Can you say why never mod the setter method? so far modding the getter was just doing visual effects but didnt change any real values. I want to find and mod a place where something like a reward is actually created, instead of just overwriting a get function that shows me my resource in the inventory.

my game is armv7a, so I'll use that.
the trick with the calculator helps.
so 01 00 A0 E3 1E FF 2F E1 is always 1 or bool true and 00 00 00 E3 1E FF 2F E1 is always 0 or bool false, right?
 

kp7742

Platinian
Oct 3, 2017
11
9
3
India
Modifying Setter is possible but it little tough work for beginners, You can try to find where your setter function called(with xref) and change input parameter values there.
 

roflmao1337

Platinian
Original poster
Dec 26, 2018
14
2
3
36
Germany
what is meant by xref? is that something in IDA Pro?

in my file there are sometimes constants defined like
public const float playerMoveSpeed = 6; // 0x0

they have no getter or setter. How can I change these values? I tried dnSpy but the compile back doesnt work if its a libil2cpp.so based game?
 

reckid

1/3 Games Approved
Feb 26, 2020
23
3
3
Zero
Can you say why never mod the setter method? so far modding the getter was just doing visual effects but didnt change any real values. I want to find and mod a place where something like a reward is actually created, instead of just overwriting a get function that shows me my resource in the inventory.

my game is armv7a, so I'll use that.
the trick with the calculator helps.
so 01 00 A0 E3 1E FF 2F E1 is always 1 or bool true and 00 00 00 E3 1E FF 2F E1 is always 0 or bool false, right?
It depends on type of the method. If that method has type bool it will return to the boolean. E.g public bool attack() etc.
 

komik

Awesome Active Platinian
Jul 16, 2017
145
39
63
33
i never tried edit set, just edit from get becuase value set it's from get value