From 627f7d1914d488a7dd8ca0046486ad12047dd3d3 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Thu, 9 May 2024 05:37:38 +0900 Subject: [PATCH] fix(YouTube/Hide layout components): `Hide tooltip content` patch breaks `Zoom to fill` in fullscreen --- .../components/LayoutComponentsPatch.kt | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/youtube/general/components/LayoutComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/general/components/LayoutComponentsPatch.kt index 94654e28e..6624250db 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/general/components/LayoutComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/general/components/LayoutComponentsPatch.kt @@ -35,6 +35,7 @@ import app.revanced.util.patch.BaseBytecodePatch import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction +import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction import com.android.tools.smali.dexlib2.util.MethodUtil @@ -223,16 +224,22 @@ object LayoutComponentsPatch : BaseBytecodePatch( // region patch for hide tooltip content - arrayOf( - TooltipContentFullscreenFingerprint, - TooltipContentViewFingerprint - ).forEach { fingerprint -> - fingerprint.resultOrThrow().mutableMethod.addInstruction( - 0, - "return-void" + TooltipContentFullscreenFingerprint.resultOrThrow().mutableMethod.apply { + val literalIndex = getWideLiteralInstructionIndex(45384061) + val targetIndex = getTargetIndex(literalIndex, Opcode.MOVE_RESULT) + val targetRegister = getInstruction(targetIndex).registerA + + addInstruction( + targetIndex + 1, + "const/4 v$targetRegister, 0x0" ) } + TooltipContentViewFingerprint.resultOrThrow().mutableMethod.addInstruction( + 0, + "return-void" + ) + // endregion LithoFilterPatch.addFilter(CUSTOM_FILTER_CLASS_DESCRIPTOR)