feat(kakaotalk): Add KotlinUnitInstanceFingerprint for ghost mode patch

This commit is contained in:
2025-05-14 17:47:36 +09:00
parent 8ade9e8802
commit b9838f80fd
2 changed files with 26 additions and 1 deletions

View File

@ -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"
}
}

View File

@ -2,6 +2,7 @@ package app.revanced.patches.kakaotalk.ghost
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.kakaotalk.common.fingerprints.kotlinUnitInstanceFingerprint
import app.revanced.patches.kakaotalk.ghost.fingerprints.ghostModeFingerprint
@Suppress("unused")
@ -12,12 +13,17 @@ val ghostMode = bytecodePatch(
compatibleWith("com.kakao.talk"("25.4.0"))
execute {
val findUnit = kotlinUnitInstanceFingerprint.method
val unitClass = findUnit.definingClass
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(
0,
"""
sget-object v0, Lnk0/C;->a:Lnk0/C;
sget-object v0, $unitClass->a:$unitClass;
return-object v0
""".trimIndent()
)