Skip to content

Commit

Permalink
fix(TikTok - Show seekbar): fix seekbar not always showing (#2660)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkk3y committed Jul 19, 2023
1 parent 2edb923 commit f2742f1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.revanced.patches.tiktok.interaction.seekbar.fingerprints

import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

object SetSeekBarShowTypeFingerprint : MethodFingerprint(
strings = listOf(
"seekbar show type change, change to:"
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
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.PatchResultError
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.AwemeGetVideoControlFingerprint
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint
import org.jf.dexlib2.iface.instruction.formats.Instruction22t

@Patch
@Name("Show seekbar")
Expand All @@ -25,27 +22,20 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
@Version("0.0.1")
class ShowSeekbarPatch : BytecodePatch(
listOf(
AwemeGetVideoControlFingerprint
SetSeekBarShowTypeFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
//Get VideoControl FieldReference
val videoControl = context.findClass { it.type.endsWith("/VideoControl;") }
?: return PatchResultError("Can not find target class")
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }
SetSeekBarShowTypeFingerprint.result?.mutableMethod?.apply {
val typeRegister = getInstruction<Instruction22t>(1).registerB

AwemeGetVideoControlFingerprint.result?.mutableMethod?.implementation?.apply {
val ifNullLabel = newLabelForIndex(1)
addInstructions(
1,
listOf(
BuilderInstruction11n(Opcode.CONST_4, 1, 1),
BuilderInstruction21t(Opcode.IF_EQZ, 0, ifNullLabel),
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!),
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!)
)
0,
"""
const/16 v$typeRegister, 0x64
"""
)
} ?: return AwemeGetVideoControlFingerprint.toErrorResult()
} ?: return SetSeekBarShowTypeFingerprint.toErrorResult()
return PatchResultSuccess()
}

Expand Down

0 comments on commit f2742f1

Please sign in to comment.