feat(kakaotalk): Add KotlinUnitInstanceFingerprint for ghost mode patch
This commit is contained in:
@ -0,0 +1,19 @@
|
|||||||
|
package app.revanced.patches.kakaotalk.common.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal val kotlinUnitInstanceFingerprint = fingerprint {
|
||||||
|
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||||
|
parameters()
|
||||||
|
returns("Ljava/lang/String;")
|
||||||
|
strings("kotlin.Unit")
|
||||||
|
opcodes(
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.RETURN_OBJECT
|
||||||
|
)
|
||||||
|
custom { method, classDef ->
|
||||||
|
method.name == "toString"
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package app.revanced.patches.kakaotalk.ghost
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.kakaotalk.common.fingerprints.kotlinUnitInstanceFingerprint
|
||||||
import app.revanced.patches.kakaotalk.ghost.fingerprints.ghostModeFingerprint
|
import app.revanced.patches.kakaotalk.ghost.fingerprints.ghostModeFingerprint
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@ -12,12 +13,17 @@ val ghostMode = bytecodePatch(
|
|||||||
compatibleWith("com.kakao.talk"("25.4.0"))
|
compatibleWith("com.kakao.talk"("25.4.0"))
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
|
val findUnit = kotlinUnitInstanceFingerprint.method
|
||||||
|
val unitClass = findUnit.definingClass
|
||||||
|
|
||||||
val method = ghostModeFingerprint.method
|
val method = ghostModeFingerprint.method
|
||||||
|
|
||||||
|
// I tried to find the field name, but it's pretty obvious to me, so I hardcode it.
|
||||||
|
// If it changes, we need to fix it
|
||||||
method.addInstructions(
|
method.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
sget-object v0, Lnk0/C;->a:Lnk0/C;
|
sget-object v0, $unitClass->a:$unitClass;
|
||||||
return-object v0
|
return-object v0
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user