From 586eed515fc7ff8e3b1b150b0d34610b39480bb5 Mon Sep 17 00:00:00 2001 From: TheJeterLP Date: Wed, 20 Jul 2022 22:47:27 +0200 Subject: [PATCH] fix: autoplay not working. --- .../layout/autoplaybutton/patch/HideAutoplayButton.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt index 2328daf55..54d2d5669 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButton.kt @@ -6,7 +6,6 @@ import app.revanced.patcher.annotation.Version import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.removeInstruction -import app.revanced.patcher.extensions.replaceInstructions import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.Dependencies @@ -53,11 +52,15 @@ class HideAutoplayButton : BytecodePatch( val autonavInformerMethod = AutonavInformerFingerprint.result!!.mutableMethod //force disable autoplay since it's hard to do without the button - autonavInformerMethod.replaceInstructions( + autonavInformerMethod.addInstructions( 0, """ invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonHidden()Z - move-result v0 + move-result v0 + if-eqz v0, :hidden + const/4 v0, 0x0 return v0 + :hidden + nop """ ) @@ -73,7 +76,7 @@ class HideAutoplayButton : BytecodePatch( method.removeInstruction(index) method.addInstructions( index, """ - invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonHidden()Z + invoke-static {}, Lapp/revanced/integrations/patches/HideAutoplayButtonPatch;->isButtonShown()Z move-result v11 if-eqz v11, :hidebutton invoke-virtual {v${insn.registerC}, v${insn.registerD}, v${insn.registerE}}, $methodToCall