From 5f6a6d2b7d6595e28aa9c61da57951ab294a6733 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Fri, 15 Apr 2022 21:31:44 +0200 Subject: [PATCH 1/2] revert: "fix: wrong signature for `hide-reels-signature`" This reverts commit c369899493f33c7e6e052f070ee173dd3d9d7d48. --- src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt b/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt index aaf660e93..9919ef036 100644 --- a/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/layout/HideReelsPatch.kt @@ -53,6 +53,7 @@ class HideReelsPatch : Patch( "[B", "[B", "[B", + "[B", "[B" ), listOf( From 424788edd777110cdaff97500556d18628f33385 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Sat, 16 Apr 2022 21:42:02 +0200 Subject: [PATCH 2/2] fix: incorrect endIndex (fixed in Patcher) --- .../patches/interaction/EnableSeekbarTappingPatch.kt | 10 +++++----- .../patches/layout/CreateButtonRemoverPatch.kt | 4 ++-- .../app/revanced/patches/layout/HideReelsPatch.kt | 2 +- .../revanced/patches/layout/OldQualityLayoutPatch.kt | 2 +- .../app/revanced/patches/misc/IntegrationsPatch.kt | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTappingPatch.kt index 64be3dc05..f42516ec4 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 d03e1b210..1b014b16e 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 9919ef036..a8ae7e9aa 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 88bfc2171..6fb2e40ea 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 f16d05db2..5e2cfe613 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;