Update 4_apis.md

This commit is contained in:
oSumAtrIX 2024-10-27 05:31:11 +01:00 committed by GitHub
parent f338ebff6c
commit 242e244b18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ A handful of APIs are available to make patch development easier and more effici
#### 👹 `proxy(ClassDef)` #### 👹 `proxy(ClassDef)`
By default, the classes are immutable, meaning that they cannot be modified. By default, the classes are immutable, meaning they cannot be modified.
To make a class mutable, use the `proxy(ClassDef)` function. To make a class mutable, use the `proxy(ClassDef)` function.
This function creates a lazy mutable copy of the class definition. This function creates a lazy mutable copy of the class definition.
Accessing the property will replace the original class definition with the mutable copy, Accessing the property will replace the original class definition with the mutable copy,
@ -52,11 +52,11 @@ execute {
// stop() returns the mutable copy of the method. // stop() returns the mutable copy of the method.
val method = navigate(someMethod).at(2) { instruction -> instruction.opcode == Opcode.INVOKEVIRTUAL }.stop() val method = navigate(someMethod).at(2) { instruction -> instruction.opcode == Opcode.INVOKEVIRTUAL }.stop()
// Alternatively to stop(), you can delegeate the method to a variable. // Alternatively, to stop(), you can delegate the method to a variable.
val method by navigate(someMethod).at(1) val method by navigate(someMethod).at(1)
// You can chain multiple calls to at() to navigate deeper into the method. // You can chain multiple calls to at() to navigate deeper into the method.
val method = navigate(someMethod).at(1).at(2, 3, 4).at(5).stop() val method by navigate(someMethod).at(1).at(2, 3, 4).at(5)
} }
``` ```
@ -72,7 +72,7 @@ execute {
} }
``` ```
The `delete` function can be used to mark files for deletion when the APK is rebuilt. The `delete` function can mark files for deletion when the APK is rebuilt.
```kt ```kt
execute { execute {