fix: enable-seekbar-tapping patch

This commit is contained in:
oSumAtrIX 2022-04-13 05:18:12 +02:00
parent 55677a44ff
commit 52fd726d9b
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 12 additions and 38 deletions

View File

@ -16,13 +16,13 @@ object Index {
* New patches should be added to the array. * New patches should be added to the array.
*/ */
val patches: Array<() -> Patch> = arrayOf( val patches: Array<() -> Patch> = arrayOf(
::Integrations,
::VideoAds, ::VideoAds,
::MinimizedPlayback, ::MinimizedPlayback,
::CreateButtonRemover, ::CreateButtonRemover,
::HideReels, ::HideReels,
::HideSuggestions, ::HideSuggestions,
::OldQualityLayout, ::OldQualityLayout,
::EnableSeekbarTapping, ::EnableSeekbarTapping
::Integrations
) )
} }

View File

@ -8,14 +8,12 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.smali.asInstructions import app.revanced.patcher.smali.asInstructions
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.Method import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.formats.Instruction11n import org.jf.dexlib2.iface.instruction.formats.Instruction11n
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference
class EnableSeekbarTapping : Patch("enable-seekbar-tapping") { class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
override fun execute(cache: Cache): PatchResult { override fun execute(cache: Cache): PatchResult {
val map = cache.methodMap["tap-seekbar-parent-method"] var map = cache.methodMap["tap-seekbar-parent-method"]
val tapSeekMethods = mutableMapOf<String, Method>() val tapSeekMethods = mutableMapOf<String, Method>()
@ -39,45 +37,21 @@ class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
if (literal == 2) tapSeekMethods["O"] = it if (literal == 2) tapSeekMethods["O"] = it
} }
val implementation = cache.methodMap["enable-seekbar-tapping"].method.implementation!! // replace map because we dont need the upper one anymore
map = cache.methodMap["enable-seekbar-tapping"]
val implementation = map.method.implementation!!
// if tap-seeking is enabled, do not invoke the two methods below // if tap-seeking is enabled, do not invoke the two methods below
val pMethod = tapSeekMethods["P"]!! val pMethod = tapSeekMethods["P"]!!
val oMethod = tapSeekMethods["O"]!! val oMethod = tapSeekMethods["O"]!!
implementation.addInstructions( implementation.addInstructions(
map.scanData.endIndex, map.scanData.endIndex,
listOf( """
BuilderInstruction35c( invoke-virtual { v12, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
Opcode.INVOKE_VIRTUAL, invoke-virtual { v12, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
0, """.trimIndent().asInstructions()
3,
0,
0,
0,
0,
ImmutableMethodReference(
oMethod.definingClass,
oMethod.name,
setOf("I"),
"V"
)
),
BuilderInstruction35c(
Opcode.INVOKE_VIRTUAL,
0,
3,
0,
0,
0,
0,
ImmutableMethodReference(
pMethod.definingClass,
pMethod.name,
setOf("I"),
"V"
)
)
)
) )
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label // if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label