feat(kakaotalk): Add support for version info preview fingerprint patch

This commit is contained in:
2025-05-04 01:06:18 +09:00
parent b0d693e431
commit ea208b37cb
2 changed files with 41 additions and 15 deletions

View File

@ -1,10 +1,12 @@
package app.revanced.patches.kakaotalk.versioninfo package app.revanced.patches.kakaotalk.versioninfo
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.instructions import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.Package import app.revanced.patcher.patch.Package
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.kakaotalk.versioninfo.fingerprints.versionInfoFingerprint import app.revanced.patches.kakaotalk.versioninfo.fingerprints.versionInfoFingerprint
import app.revanced.patches.kakaotalk.versioninfo.fingerprints.versionInfoPreviewFingerprint
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
import com.android.tools.smali.dexlib2.iface.reference.StringReference import com.android.tools.smali.dexlib2.iface.reference.StringReference
@ -18,24 +20,29 @@ val versionInfoPatch = bytecodePatch(
compatibleWith(Package("com.kakao.talk", setOf("25.3.5"))) compatibleWith(Package("com.kakao.talk", setOf("25.3.5")))
execute { execute {
val inst = versionInfoFingerprint.method.instructions val runPatch: (Fingerprint) -> Unit = {
.filterIsInstance<BuilderInstruction21c>() val versionInfo = it.method.instructions
.first { .filterIsInstance<BuilderInstruction21c>()
it.opcode == Opcode.CONST_STRING .first {
} it.opcode == Opcode.CONST_STRING
}
val versionString = (inst.reference as StringReference).string val versionString = (versionInfo.reference as StringReference).string
versionInfoFingerprint.method it.method
.replaceInstruction( .replaceInstruction(
inst.location.index, versionInfo.location.index,
BuilderInstruction21c( BuilderInstruction21c(
Opcode.CONST_STRING, Opcode.CONST_STRING,
inst.registerA, versionInfo.registerA,
ImmutableStringReference( ImmutableStringReference(
"$versionString (ReVanced)" "$versionString (ReVanced)"
)
) )
) )
) }
runPatch(versionInfoFingerprint)
runPatch(versionInfoPreviewFingerprint)
} }
} }

View File

@ -16,3 +16,22 @@ internal val versionInfoFingerprint = fingerprint {
Opcode.RETURN_VOID, Opcode.RETURN_VOID,
) )
} }
internal val versionInfoPreviewFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
parameters()
returns("Ljava/lang/String;")
opcodes(
Opcode.CONST_STRING,
Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.NEW_INSTANCE,
Opcode.CONST_4,
Opcode.CONST_4,
Opcode.INVOKE_DIRECT,
Opcode.SGET_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
)
}