From 08413bdc97aef892f7372c585d1d792eb95e30f4 Mon Sep 17 00:00:00 2001 From: d4rkk3y <43563783+d4rkk3y@users.noreply.github.com> Date: Thu, 3 Aug 2023 23:12:45 +0700 Subject: [PATCH] fix(Tiktok - Show seekbar): Bump compatibility (#2737) --- .../fingerprints/ShouldShowSeekBarFingerprint.kt | 9 +++++++++ .../interaction/seekbar/patch/ShowSeekbarPatch.kt | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt new file mode 100644 index 00000000..d13cfe33 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/fingerprints/ShouldShowSeekBarFingerprint.kt @@ -0,0 +1,9 @@ +package app.revanced.patches.tiktok.interaction.seekbar.fingerprints + +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint + +object ShouldShowSeekBarFingerprint : MethodFingerprint( + strings = listOf( + "can not show seekbar, state: 1, not in resume" + ), +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/patch/ShowSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/patch/ShowSeekbarPatch.kt index f0cf9435..713d4557 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/patch/ShowSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/patch/ShowSeekbarPatch.kt @@ -5,14 +5,13 @@ import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstructions -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint -import org.jf.dexlib2.iface.instruction.formats.Instruction22t +import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.ShouldShowSeekBarFingerprint @Patch @Name("Show seekbar") @@ -21,11 +20,21 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction22t class ShowSeekbarPatch : BytecodePatch( listOf( SetSeekBarShowTypeFingerprint, + ShouldShowSeekBarFingerprint, ) ) { override fun execute(context: BytecodeContext): PatchResult { + ShouldShowSeekBarFingerprint.result?.mutableMethod?.apply { + addInstructions( + 0, + """ + const/4 v0, 0x1 + return v0 + """ + ) + } SetSeekBarShowTypeFingerprint.result?.mutableMethod?.apply { - val typeRegister = getInstruction(1).registerB + val typeRegister = implementation!!.registerCount - 1 addInstructions( 0,