Skip to content

Commit

Permalink
fix(YouTube - Video playback): Applying default video quality to Shor…
Browse files Browse the repository at this point in the history
…ts causes the beginning of the shorts to get stuck in a loop
  • Loading branch information
inotia00 authored and anddea committed Dec 21, 2024
1 parent 93c4bf8 commit 9c4c56e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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),
)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)
}
Expand Down

0 comments on commit 9c4c56e

Please sign in to comment.