mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 01:01:56 +01:00
fix(TikTok - Show seekbar): fix seekbar not always showing (#2660)
This commit is contained in:
parent
2edb923548
commit
f2742f1ba1
3 changed files with 20 additions and 33 deletions
|
@ -1,12 +0,0 @@
|
|||
package app.revanced.patches.tiktok.interaction.seekbar.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object AwemeGetVideoControlFingerprint : MethodFingerprint(
|
||||
"L",
|
||||
AccessFlags.PUBLIC.value,
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/Aweme;") && methodDef.name == "getVideoControl"
|
||||
}
|
||||
)
|
|
@ -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:"
|
||||
),
|
||||
)
|
|
@ -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")
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue