From e5cc1dd5b52ca3671e522ce89d9f5f4307ddbd30 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 21 Dec 2024 13:54:36 +0900 Subject: [PATCH] fix(YouTube - Video playback): Applying default video quality to Shorts causes the beginning of the shorts to get stuck in a loop --- .../utils/fix/shortsplayback/Fingerprints.kt | 19 +++++++++++++------ .../fix/shortsplayback/ShortsPlaybackPatch.kt | 10 ++++++---- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/Fingerprints.kt index 0abb3acf2..59772d028 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/Fingerprints.kt @@ -1,12 +1,19 @@ package app.revanced.patches.youtube.utils.fix.shortsplayback import app.revanced.util.fingerprint.legacyFingerprint -import app.revanced.util.or -import com.android.tools.smali.dexlib2.AccessFlags -internal val shortsPlaybackFingerprint = legacyFingerprint( - name = "shortsPlaybackFingerprint", +internal const val SHORTS_PLAYBACK_PRIMARY_FEATURE_FLAG = 45387052L + +internal val shortsPlaybackPrimaryFingerprint = legacyFingerprint( + name = "shortsPlaybackPrimaryFingerprint", returnType = "Z", - accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, - literals = listOf(45387052L), + literals = listOf(SHORTS_PLAYBACK_PRIMARY_FEATURE_FLAG), ) + +internal const val SHORTS_PLAYBACK_SECONDARY_FEATURE_FLAG = 45378771L + +internal val shortsPlaybackSecondaryFingerprint = legacyFingerprint( + name = "shortsPlaybackSecondaryFingerprint", + returnType = "L", + literals = listOf(SHORTS_PLAYBACK_SECONDARY_FEATURE_FLAG), +) \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/ShortsPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/ShortsPlaybackPatch.kt index 12255cd7d..a2d39d5d9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/ShortsPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/shortsplayback/ShortsPlaybackPatch.kt @@ -2,7 +2,6 @@ package app.revanced.patches.youtube.utils.fix.shortsplayback import app.revanced.patcher.patch.bytecodePatch import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall -import app.revanced.util.fingerprint.resolvable val shortsPlaybackPatch = bytecodePatch( description = "shortsPlaybackPatch" @@ -15,9 +14,12 @@ val shortsPlaybackPatch = bytecodePatch( * * RVX applies default video quality to Shorts as well, so this patch is required. */ - if (shortsPlaybackFingerprint.resolvable()) { - shortsPlaybackFingerprint.injectLiteralInstructionBooleanCall( - 45387052L, + mapOf( + shortsPlaybackPrimaryFingerprint to SHORTS_PLAYBACK_PRIMARY_FEATURE_FLAG, + shortsPlaybackSecondaryFingerprint to SHORTS_PLAYBACK_SECONDARY_FEATURE_FLAG + ).forEach { (fingerprint, literal) -> + fingerprint.injectLiteralInstructionBooleanCall( + literal, "0x0" ) }