diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt index 89ee04ffa..eb9b98a3d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt @@ -219,7 +219,11 @@ object PlayerComponentsPatch : BaseBytecodePatch( val constIndex = getWideLiteralInstructionIndex(FadeDurationFast) val constRegister = getInstruction(constIndex).registerA val insertIndex = getTargetIndexReversed(constIndex, Opcode.INVOKE_VIRTUAL) + 1 - val jumpIndex = getTargetIndex(insertIndex, Opcode.GOTO).coerceAtMost(getTargetIndex(insertIndex, Opcode.GOTO_16)) + val jumpIndex = implementation!!.instructions.let { instruction -> + insertIndex + instruction.subList(insertIndex, instruction.size - 1).indexOfFirst { instructions -> + instructions.opcode == Opcode.GOTO || instructions.opcode == Opcode.GOTO_16 + } + } val replaceInstruction = getInstruction(insertIndex) val replaceReference = @@ -284,8 +288,14 @@ object PlayerComponentsPatch : BaseBytecodePatch( val onClickListenerIndex = getTargetIndexWithMethodReferenceName(insertIndex, "setOnClickListener") val constComponent = getConstComponent(insertIndex, onClickListenerIndex - 1) + if (constComponent.isNotEmpty()) { + addInstruction( + onClickListenerIndex + 2, + constComponent + ) + } addInstructionsWithLabels( - insertIndex, constComponent + """ + insertIndex, """ invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->hideSeekUndoMessage()Z move-result v$insertRegister if-nez v$insertRegister, :default @@ -387,7 +397,7 @@ object PlayerComponentsPatch : BaseBytecodePatch( for (index in endIndex downTo startIndex) { val instruction = getInstruction(index) - if (instruction !is WideLiteralInstruction) + if (instruction.opcode != Opcode.CONST_16 && instruction.opcode != Opcode.CONST_4) continue if ((instruction as OneRegisterInstruction).registerA != constRegister) diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/flyoutmenu/hide/PlayerFlyoutMenuPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/flyoutmenu/hide/PlayerFlyoutMenuPatch.kt index 717aeffc1..c4d44f44e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/player/flyoutmenu/hide/PlayerFlyoutMenuPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/player/flyoutmenu/hide/PlayerFlyoutMenuPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.BottomSheetFooterText import app.revanced.patches.youtube.utils.settings.SettingsPatch import app.revanced.util.literalInstructionBooleanHook -import app.revanced.util.literalInstructionViewHook +import app.revanced.util.literalInstructionHook import app.revanced.util.patch.BaseBytecodePatch @Suppress("unused") @@ -45,7 +45,7 @@ object PlayerFlyoutMenuPatch : BaseBytecodePatch( CaptionsBottomSheetFingerprint to "hideFooterCaptions", QualityMenuViewInflateFingerprint to "hideFooterQuality" ).map { (fingerprint, name) -> - fingerprint.literalInstructionViewHook(BottomSheetFooterText, "$PLAYER_CLASS_DESCRIPTOR->$name(Landroid/view/View;)V") + fingerprint.literalInstructionHook(BottomSheetFooterText, "$PLAYER_CLASS_DESCRIPTOR->$name(Landroid/view/View;)V") } LithoFilterPatch.addFilter(PANELS_FILTER_CLASS_DESCRIPTOR) diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/rollingnumber/fingerprints/RollingNumberSetterFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/rollingnumber/fingerprints/RollingNumberSetterFingerprint.kt index 345a690c8..0c38f5612 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/rollingnumber/fingerprints/RollingNumberSetterFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/utils/returnyoutubedislike/rollingnumber/fingerprints/RollingNumberSetterFingerprint.kt @@ -8,5 +8,5 @@ import com.android.tools.smali.dexlib2.Opcode */ internal object RollingNumberSetterFingerprint : LiteralValueFingerprint( opcodes = listOf(Opcode.CHECK_CAST), - literalSupplier = { 45427773 } + literalSupplier = { 45427773 } ) \ No newline at end of file