From 57dda609de8111ec1b54da88b54b86a0f8238f00 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:52:11 +0900 Subject: [PATCH] fix(YouTube - Shorts components): When `Shorts repeat state` is `AutoPlay`, HUD is hidden (YouTube 19.34+) https://github.com/ReVanced/revanced-patches/issues/4426 --- .../youtube/shorts/components/Fingerprints.kt | 13 +++++++++++++ .../shorts/components/ShortsComponentPatch.kt | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt index c6cdc6329..00f4cc521 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt @@ -71,6 +71,19 @@ internal val reelEnumStaticFingerprint = legacyFingerprint( returnType = "L" ) +internal const val SHORTS_HUD_FEATURE_FLAG = 45644023L + +/** + * Fix [HUD is hidden](https://github.com/ReVanced/revanced-patches/issues/4426) + */ +internal val shortsHUDFeatureFingerprint = legacyFingerprint( + name = "shortsHUDFeatureFingerprint", + returnType = "Z", + parameters = emptyList(), + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, + literals = listOf(SHORTS_HUD_FEATURE_FLAG), +) + internal val reelFeedbackFingerprint = legacyFingerprint( name = "reelFeedbackFingerprint", returnType = "V", diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt index 09cb57cac..e327d3e75 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt @@ -393,7 +393,10 @@ private val shortsRepeatPatch = bytecodePatch( description = "shortsRepeatPatch" ) { execute { - dependsOn(mainActivityResolvePatch) + dependsOn( + mainActivityResolvePatch, + versionCheckPatch, + ) injectOnCreateMethodCall( EXTENSION_REPEAT_STATE_CLASS_DESCRIPTOR, @@ -462,6 +465,13 @@ private val shortsRepeatPatch = bytecodePatch( } } } + + if (is_19_34_or_greater) { + shortsHUDFeatureFingerprint.injectLiteralInstructionBooleanCall( + SHORTS_HUD_FEATURE_FLAG, + "0x0" + ) + } } }