mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-07 11:25:49 +01:00
fix(TikTok - Show seekbar): fix seekbar not always showing (#2660)
This commit is contained in:
parent
2edb923548
commit
f2742f1ba1
@ -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.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
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.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility
|
import app.revanced.patches.tiktok.interaction.seekbar.annotations.ShowSeekbarCompatibility
|
||||||
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.AwemeGetVideoControlFingerprint
|
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.SetSeekBarShowTypeFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.iface.instruction.formats.Instruction22t
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("Show seekbar")
|
@Name("Show seekbar")
|
||||||
@ -25,27 +22,20 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ShowSeekbarPatch : BytecodePatch(
|
class ShowSeekbarPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
AwemeGetVideoControlFingerprint
|
SetSeekBarShowTypeFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
//Get VideoControl FieldReference
|
SetSeekBarShowTypeFingerprint.result?.mutableMethod?.apply {
|
||||||
val videoControl = context.findClass { it.type.endsWith("/VideoControl;") }
|
val typeRegister = getInstruction<Instruction22t>(1).registerB
|
||||||
?: return PatchResultError("Can not find target class")
|
|
||||||
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }
|
|
||||||
|
|
||||||
AwemeGetVideoControlFingerprint.result?.mutableMethod?.implementation?.apply {
|
|
||||||
val ifNullLabel = newLabelForIndex(1)
|
|
||||||
addInstructions(
|
addInstructions(
|
||||||
1,
|
0,
|
||||||
listOf(
|
"""
|
||||||
BuilderInstruction11n(Opcode.CONST_4, 1, 1),
|
const/16 v$typeRegister, 0x64
|
||||||
BuilderInstruction21t(Opcode.IF_EQZ, 0, ifNullLabel),
|
"""
|
||||||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!),
|
|
||||||
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
} ?: return AwemeGetVideoControlFingerprint.toErrorResult()
|
} ?: return SetSeekBarShowTypeFingerprint.toErrorResult()
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user