diff --git a/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTappingPatch.kt index 64be3dc0..f42516ec 100644 --- a/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTappingPatch.kt @@ -154,14 +154,14 @@ class EnableSeekbarTappingPatch : Patch( val oMethod = tapSeekMethods["O"]!! // get the required register - val instruction = implementation.instructions[result.scanData.endIndex - 1] + val instruction = implementation.instructions[result.scanData.endIndex] if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register") val register = (instruction as Instruction35c).registerC // the instructions are written in reverse order. implementation.addInstructions( - result.scanData.endIndex, + result.scanData.endIndex + 1, """ invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V @@ -169,13 +169,13 @@ class EnableSeekbarTappingPatch : Patch( ) // if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label - val elseLabel = implementation.newLabelForIndex(result.scanData.endIndex) + val elseLabel = implementation.newLabelForIndex(result.scanData.endIndex + 1) implementation.addInstruction( - result.scanData.endIndex, + result.scanData.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel) ) implementation.addInstructions( - result.scanData.endIndex, + result.scanData.endIndex + 1, """ invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z move-result v0 diff --git a/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemoverPatch.kt index d03e1b21..1b014b16 100644 --- a/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemoverPatch.kt @@ -76,14 +76,14 @@ class CreateButtonRemoverPatch : Patch( // Get the required register which holds the view object we need to pass to the method hideCreateButton val implementation = result.method.implementation!! - val instruction = implementation.instructions[result.scanData.endIndex] + val instruction = implementation.instructions[result.scanData.endIndex + 1] if (instruction.opcode != Opcode.INVOKE_STATIC) return PatchResultError("Could not find the correct register") val register = (instruction as Instruction35c).registerC // Hide the button view via proxy by passing it to the hideCreateButton method implementation.addInstruction( - result.scanData.endIndex, + result.scanData.endIndex + 1, "invoke-static { v$register }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".toInstruction() ) diff --git a/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt b/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt index 9919ef03..a8ae7e9a 100644 --- a/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt @@ -101,7 +101,7 @@ class HideReelsPatch : Patch( // HideReel will hide the reel view before it is being used, // so we pass the view to the HideReel method implementation.addInstruction( - result.scanData.endIndex - 1, + result.scanData.endIndex, "invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction() ) diff --git a/src/main/kotlin/app/revanced/patches/layout/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/layout/OldQualityLayoutPatch.kt index 88bfc217..6fb2e40e 100644 --- a/src/main/kotlin/app/revanced/patches/layout/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/layout/OldQualityLayoutPatch.kt @@ -98,7 +98,7 @@ class OldQualityLayoutPatch : Patch( // if useOldStyleQualitySettings == true, jump over all instructions val jmpInstruction = - BuilderInstruction21t(Opcode.IF_NEZ, 0, implementation.instructions[result.scanData.endIndex - 1].location.labels.first()) + BuilderInstruction21t(Opcode.IF_NEZ, 0, implementation.instructions[result.scanData.endIndex].location.labels.first()) implementation.addInstruction(5, jmpInstruction) implementation.addInstructions( 0, diff --git a/src/main/kotlin/app/revanced/patches/misc/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/misc/IntegrationsPatch.kt index f16d05db..5e2cfe61 100644 --- a/src/main/kotlin/app/revanced/patches/misc/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/misc/IntegrationsPatch.kt @@ -85,7 +85,7 @@ class IntegrationsPatch : Patch( val count = implementation.registerCount - 1 implementation.addInstructions( - result.scanData.endIndex, + result.scanData.endIndex + 1, """ invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context;