Skip to content

Commit

Permalink
fix: enable-seekbar-tapping patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Apr 13, 2022
1 parent 55677a4 commit 52fd726
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/app/revanced/patches/Index.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ object Index {
* New patches should be added to the array.
*/
val patches: Array<() -> Patch> = arrayOf(
::Integrations,
::VideoAds,
::MinimizedPlayback,
::CreateButtonRemover,
::HideReels,
::HideSuggestions,
::OldQualityLayout,
::EnableSeekbarTapping,
::Integrations
::EnableSeekbarTapping
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.smali.asInstructions
import org.jf.dexlib2.Opcode
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.instruction.formats.Instruction11n
import org.jf.dexlib2.immutable.reference.ImmutableMethodReference

class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
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>()

Expand All @@ -39,45 +37,21 @@ class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
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
val pMethod = tapSeekMethods["P"]!!
val oMethod = tapSeekMethods["O"]!!

implementation.addInstructions(
map.scanData.endIndex,
listOf(
BuilderInstruction35c(
Opcode.INVOKE_VIRTUAL,
0,
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"
)
)
)
"""
invoke-virtual { v12, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
invoke-virtual { v12, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
""".trimIndent().asInstructions()
)

// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
Expand Down

0 comments on commit 52fd726

Please sign in to comment.