Help! Need help with IL2Cpp Method Patching crashing the game (armeabi-v7a)

MDT3CH

Platinian
Hello everyone,
I'm trying to create a simple script for a Unity IL2Cpp game (32-bit armeabi-v7a), but I've hit a roadblock and could use some advice from experienced modders.
Device: Samsung SM-A566B (Android 16, SDK 36, 32-bit architecture)
GAME MLBB
Framework: ELGG 1.2.6
Target: Trying to hook/patch a method (e.g., ShowEntity or similar visibility functions).
The Problem:
I used an auto-offset finder script to locate the target method's pointer/offset in the library (libcsharp.so / libil2cpp.so).
When I apply a standard ARM 32-bit return patch (01 00 00 E3 1E FF 2F E1 / mov r0, #1; bx lr) to that offset using GameGuardian, the script says "Activated".
However, a few seconds later, the game instantly crashes.
I suspect that either I'm patching a method pointer instead of the actual function instructions, or the game has an integrity check / signature validation that triggers a crash when the library bytes are modified.
If anyone has experience bypassing this or can point me in the right direction on how to properly hook/patch IL2Cpp methods on 32-bit games without crashing, I would greatly appreciate it!
Thanks in advance.
 
What's the actual crash reason? Without crashlogs you will be just blindly stumbling around.
Afaik Samsung SM-A566B Android 16 doesn't have support for armeabi-v7a, but maybe I'm wrong.
 
Last edited:
What's the actual crash reason? Without crashlogs you will be just blindly stumbling around.
Afaik Samsung SM-A566B Android 16 doesn't have support for armeabi-v7a, but maybe I'm wrong.
Do you know how to Decrypt file .DJB ?

1000053514.jpg
 
1. Your device cannot run armeabi-v7a
SM-A566B is a Galaxy A56 5G - Exynos 1580, Android 16. That SoC is 64-bit only, it has no AArch32 execution state at all. There is no v7a process on that phone, so any offset you pull out of an armeabi-v7a libcsharp.so is an offset into a library that is never loaded. Offsets also differ between the v7a and arm64 builds of the same lib, so cross-referencing one against the other gives you garbage addresses - which is a textbook "script says Activated, game dies 2 seconds later".

And look at your own screenshot: x29, x9, w8, adrp, stur. That's aarch64. So dump the arm64-v8a lib, use the arm64 GameGuardian build, and filter your ranges to the 64-bit ones (Cb, Cd, Xa, Xs).

2. Your patch bytes are ARM32
What you're writing:

Code:
01 00 00 E3    mov r0, #1
1E FF 2F E1    bx lr

On arm64 that decodes to nothing valid, so the CPU hits an undefined instruction as soon as the method is called. The equivalent you want is:

Code:
20 00 80 52    mov w0, #1
C0 03 5F D6    ret

If the target returns float instead of bool, w0 is irrelevant - you need fmov s0, #1.0 then ret. If it returns a struct, a bare mov w0,#1; ret leaves x0 as an out-pointer to uninitialised stack and the caller reads whatever was there.

3. ShowEntity is a bad patch target
Two separate failure modes, and both of them are on you, not on the game's "integrity check":

  • It's probably not a getter. A method named ShowEntity does setup work - binds a renderer, pushes a transform, allocates/initialises state, kicks a coroutine. Returning early skips all of it, so nothing crashes at the call site. It crashes a few frames later when something dereferences what ShowEntity was supposed to have built. That matches your "Activated, then instant crash" timing exactly.
  • It may not be the code you think it is. If your offset finder walks the methodPointerTable instead of giving you a real Address(RVA) from dump.cs, shared generic methods resolve to one shared body. Patch that and you've just corrupted every generic instantiation that shares it - which again crashes seconds later, in a totally unrelated place.

So: start with a pure read-only getter that has no side effects (get_IsVisible, get_Visible, get_Active, get_HP) and confirm your address/base math works before touching anything with Show/Init/Setup in the name.

4. Address math, properly
Code:
target = base_of_libil2cpp_in_GG + RVA_from_dump_cs

In GG: search the lib, take the start of the mapped region (first result of the range), add the RVA. Before writing anything, read 4-8 bytes at the target and eyeball them - a normal arm64 prologue is stp x29, x30, [sp, #-N]! / sub sp, sp, #N / str chains. If you see ?? ?? ?? ?? or obviously misaligned data, your base is wrong.

Also, patch in memory after the lib is loaded, not on disk. MLBB ships split APKs, so the lib on disk is rarely the one in use, and a repacked lib trips the file-level checks. If in-memory patching still dies, hook with a trampoline instead of overwriting in place - that way the original prologue still runs and only the return value is forced.

5. Get the actual crash reason
Code:
adb logcat -b crash -d

Then read the tombstone. SIGILL = wrong bytes / wrong arch / wrong offset. SIGSEGV with a low or zero address = you returned a value the caller dereferenced. SIGSEGV inside a lib you never touched = shared generic. That single line of output replaces all the guessing above.

6. About the .DJB file
[DJB is not an MLBB format - the screenshot is from a Cookie Run build. So if you're mixing both games in one thread, keep the offsets separate.]

.djb is a DJBF container used by Devsisters' Cookie Run titles. Header layout, from the top of the file:

  • 0x00 - magic DJBF
  • 0x04 - generation byte: 0x01xx = Gen1, 0x02xx = Gen2
  • 0x0C - plaintext size, 64-bit LE (sanity cap ~512 MiB)
  • payload - AES-256, ECB on Gen1, CBC on Gen2
  • trailer - CRC-32, plus BLAKE3 on Gen2
  • after decryption - FastLZ L1/L2 block

file/hex-editor it first: if the first four bytes aren't DJBF, you don't have a DJBF container and everything below is irrelevant.

Do not go hunting for a hardcoded key to paste into a script. The key material is embedded in the native lib and rotates between builds, so a key you extract today is dead after the next update. Hook instead:

  • Frida - attach to the process, hook the file-read path (open/read, or the mbedtls/OpenSSL AES entry point) and dump the buffer after decryption. You get plaintext per file with no format reimplementation at all.
  • GameGuardian - same idea, breakpoint on the read call, dump the region once it's decrypted.

If you want the format reimplemented rather than hooked, the cookierun-djb-decryptor project handles Gen1/Gen2 header detection, AES-256 ECB/CBC, FastLZ and CRC/BLAKE3 verification - its own README admits Gen1 is only partially solved and that it can't rebuild files the loader will accept, so treat it as a reference, not a magic button:


Format notes and background:


TL;DR
Dump the arm64 lib, use arm64 GG, patch 20 00 80 52 C0 03 5F D6[/CODE] - wait, keep the [ICODE] tags - at [ICODE]base + RVA, verify the prologue bytes first, and start on a side-effect-free getter instead of ShowEntity. Read the tombstone before changing anything else.

For the .djb: hook the decryptor and dump plaintext, don't chase a static key.
 
Back
Top Bottom