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
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.Package
import app.revanced.patcher.patch.bytecodePatch
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.builder.instruction.BuilderInstruction21c
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")))
execute {
val inst = versionInfoFingerprint.method.instructions
.filterIsInstance<BuilderInstruction21c>()
.first {
it.opcode == Opcode.CONST_STRING
}
val runPatch: (Fingerprint) -> Unit = {
val versionInfo = it.method.instructions
.filterIsInstance<BuilderInstruction21c>()
.first {
it.opcode == Opcode.CONST_STRING
}
val versionString = (inst.reference as StringReference).string
val versionString = (versionInfo.reference as StringReference).string
versionInfoFingerprint.method
.replaceInstruction(
inst.location.index,
BuilderInstruction21c(
Opcode.CONST_STRING,
inst.registerA,
ImmutableStringReference(
"$versionString (ReVanced)"
it.method
.replaceInstruction(
versionInfo.location.index,
BuilderInstruction21c(
Opcode.CONST_STRING,
versionInfo.registerA,
ImmutableStringReference(
"$versionString (ReVanced)"
)
)
)
)
}
runPatch(versionInfoFingerprint)
runPatch(versionInfoPreviewFingerprint)
}
}

View File

@ -15,4 +15,23 @@ internal val versionInfoFingerprint = fingerprint {
Opcode.IPUT_OBJECT,
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,
)
}