diff --git a/patches/api/patches.api b/patches/api/patches.api index 90a874dc8..871da0fd5 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -257,6 +257,10 @@ public final class app/revanced/patches/kakaotalk/signature/VerifyingSignaturePa public static final fun getVerifyingSignaturePatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/kakaotalk/versioninfo/VersionInfoPatchKt { + public static final fun getVersionInfoPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatchKt { public static final fun getDisableMandatoryLoginPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/kakaotalk/versioninfo/VersionInfoPatch.kt b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/versioninfo/VersionInfoPatch.kt new file mode 100644 index 000000000..435c88c78 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/versioninfo/VersionInfoPatch.kt @@ -0,0 +1,41 @@ +package app.revanced.patches.kakaotalk.versioninfo + +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 com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c +import com.android.tools.smali.dexlib2.iface.reference.StringReference +import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference + +@Suppress("unused") +val versionInfoPatch = bytecodePatch( + name = "Version info patch", + description = "Patches the version info to include '(ReVanced)' in the version string.", +) { + compatibleWith(Package("com.kakao.talk", setOf("25.3.5"))) + + execute { + val inst = versionInfoFingerprint.method.instructions + .filterIsInstance() + .first { + it.opcode == Opcode.CONST_STRING + } + + val versionString = (inst.reference as StringReference).string + + versionInfoFingerprint.method + .replaceInstruction( + inst.location.index, + BuilderInstruction21c( + Opcode.CONST_STRING, + inst.registerA, + ImmutableStringReference( + "$versionString (ReVanced)" + ) + ) + ) + } +} \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/kakaotalk/versioninfo/fingerprints/VersionInfoFingerprint.kt b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/versioninfo/fingerprints/VersionInfoFingerprint.kt new file mode 100644 index 000000000..713f6494d --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/kakaotalk/versioninfo/fingerprints/VersionInfoFingerprint.kt @@ -0,0 +1,18 @@ +package app.revanced.patches.kakaotalk.versioninfo.fingerprints + +import app.revanced.patcher.fingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode + +internal val versionInfoFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR) + returns("V") + opcodes( + Opcode.INVOKE_DIRECT, + Opcode.CONST_STRING, + Opcode.IPUT_OBJECT, + Opcode.IPUT_BOOLEAN, + Opcode.IPUT_OBJECT, + Opcode.RETURN_VOID, + ) +} \ No newline at end of file