Smali Code Patching Guide
Changing the Return Value in Methods
Example: checkDebugger() Function
checkDebugger() FunctionOriginal Code
.method public checkDebugger()Z
.locals 1
.line 30
invoke-static {}, Landroid/os/Debug;->isDebuggerConnected()Z
move-result v0
return v0
.end methodModified Code
.method public checkDebugger()Z
.locals 1
.line 30
invoke-static {}, Landroid/os/Debug;->isDebuggerConnected()Z
move-result v0
const v0, 0x0 # Overwrite the result to always be false
return v0
.end methodFlipping the Logic in Conditionals (IF-ELSE-GOTO Patching)
Example: Processing getHit() Method in a Game
getHit() Method in a GameOriginal Code
Modified Code
Deleting Code to Alter Game Logic
Example: processGame() Method in Java
processGame() Method in JavaOriginal Smali Code
Modified Code
Changing Jump Instructions
Example: Modifying GOTO
Original Code
Modified Code
Additional Method: Manipulating Currency in a Game
New Method: increaseCurrency()
increaseCurrency()Last updated