From 7a075074af5a923bb9af447a5152dc75053a2e01 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:18:22 +0300 Subject: [PATCH] fix(YouTube - Minimized playback): Fix pip incorrectly showing for Short playback (#3170) --- .../MinimizedPlaybackPatch.kt | 10 ++--- .../MinimizedPlaybackManagerFingerprint.kt | 39 ------------------- ...ybackPlayerResponseProcessorFingerprint.kt | 29 ++++++++++++++ 3 files changed, 34 insertions(+), 44 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt create mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackPlayerResponseProcessorFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt index 31b5c9af..c8f81833 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt @@ -13,7 +13,7 @@ import app.revanced.patches.shared.settings.preference.impl.NonInteractivePrefer import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint -import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint +import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackPlayerResponseProcessorFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsParentFingerprint import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch @@ -44,7 +44,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference @Suppress("unused") object MinimizedPlaybackPatch : BytecodePatch( setOf( - MinimizedPlaybackManagerFingerprint, + MinimizedPlaybackPlayerResponseProcessorFingerprint, MinimizedPlaybackSettingsParentFingerprint, KidsMinimizedPlaybackPolicyControllerFingerprint ) @@ -63,16 +63,16 @@ object MinimizedPlaybackPatch : BytecodePatch( ) ) - MinimizedPlaybackManagerFingerprint.result?.apply { + MinimizedPlaybackPlayerResponseProcessorFingerprint.result?.apply { mutableMethod.addInstructions( 0, """ - invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->isPlaybackNotShort()Z + invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->videoSupportsMinimizedPlayback()Z move-result v0 return v0 """ ) - } ?: throw MinimizedPlaybackManagerFingerprint.exception + } ?: throw MinimizedPlaybackPlayerResponseProcessorFingerprint.exception // Enable minimized playback option in YouTube settings MinimizedPlaybackSettingsParentFingerprint.result ?: throw MinimizedPlaybackSettingsParentFingerprint.exception diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt deleted file mode 100644 index c72bc233..00000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackManagerFingerprint.kt +++ /dev/null @@ -1,39 +0,0 @@ -package app.revanced.patches.youtube.misc.minimizedplayback.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.Opcode - -object MinimizedPlaybackManagerFingerprint : MethodFingerprint( - "Z", - AccessFlags.PUBLIC or AccessFlags.STATIC, - listOf("L"), - listOf( - Opcode.CONST_4, - Opcode.IF_EQZ, - Opcode.IGET, - Opcode.AND_INT_LIT16, - Opcode.IF_EQZ, - Opcode.IGET_OBJECT, - Opcode.IF_NEZ, - Opcode.SGET_OBJECT, - Opcode.IGET, - Opcode.CONST, - Opcode.IF_NE, - Opcode.IGET_OBJECT, - Opcode.IF_NEZ, - Opcode.SGET_OBJECT, - Opcode.IGET, - Opcode.IF_NE, - Opcode.IGET_OBJECT, - Opcode.CHECK_CAST, - Opcode.GOTO, - Opcode.SGET_OBJECT, - Opcode.GOTO, - Opcode.CONST_4, - Opcode.IF_EQZ, - Opcode.IGET_BOOLEAN, - Opcode.IF_EQZ - ) -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackPlayerResponseProcessorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackPlayerResponseProcessorFingerprint.kt new file mode 100644 index 00000000..9e468661 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/fingerprints/MinimizedPlaybackPlayerResponseProcessorFingerprint.kt @@ -0,0 +1,29 @@ +package app.revanced.patches.youtube.misc.minimizedplayback.fingerprints + +import app.revanced.patcher.extensions.or +import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode + +object MinimizedPlaybackPlayerResponseProcessorFingerprint : MethodFingerprint( + "Z", + AccessFlags.PUBLIC or AccessFlags.FINAL, + listOf("Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;", "I"), + listOf( + Opcode.IGET_OBJECT, + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT, + Opcode.CONST_4, + Opcode.IF_EQZ, + Opcode.INVOKE_STATIC, + Opcode.MOVE_RESULT, + Opcode.CONST_4, + Opcode.IF_NEZ, + Opcode.CONST_4, + Opcode.IF_EQ, + Opcode.GOTO, + Opcode.RETURN, + Opcode.CONST_4, + Opcode.RETURN + ) +) \ No newline at end of file