diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/general/MiniplayerPatch.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/general/MiniplayerPatch.java index 44f845926..a7337ea39 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/general/MiniplayerPatch.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/general/MiniplayerPatch.java @@ -93,8 +93,9 @@ public final class MiniplayerPatch { int dipWidth = Settings.MINIPLAYER_WIDTH_DIP.get(); if (dipWidth < WIDTH_DIP_MIN || dipWidth > WIDTH_DIP_MAX) { - Utils.showToastLong(str("revanced_miniplayer_width_dip_invalid_toast", + Utils.showToastShort(str("revanced_miniplayer_width_dip_invalid_toast", WIDTH_DIP_MIN, WIDTH_DIP_MAX)); + Utils.showToastShort(str("revanced_extended_reset_to_default_toast")); // Instead of resetting, clamp the size at the bounds. dipWidth = Math.max(WIDTH_DIP_MIN, Math.min(dipWidth, WIDTH_DIP_MAX)); diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/utils/PlayerControlsPatch.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/utils/PlayerControlsPatch.java index 0fb6115e6..5a6e56f6a 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/utils/PlayerControlsPatch.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/utils/PlayerControlsPatch.java @@ -119,4 +119,11 @@ public class PlayerControlsPatch { // CreateSegmentButtonController.changeVisibilityNegatedImmediate(); // VotingButtonController.changeVisibilityNegatedImmediate(); } + + /** + * Injection point. + */ + public static String getPlayerTopControlsLayoutResourceName(String original) { + return "default"; + } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt index 536c51d9e..5e6a78868 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/general/toolbar/ToolBarComponentsPatch.kt @@ -14,9 +14,7 @@ import app.revanced.patches.youtube.utils.castbutton.castButtonPatch import app.revanced.patches.youtube.utils.castbutton.hookToolBarCastButton import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.youtube.utils.extension.Constants.GENERAL_CLASS_DESCRIPTOR -import app.revanced.patches.youtube.utils.extension.Constants.PATCH_STATUS_CLASS_DESCRIPTOR import app.revanced.patches.youtube.utils.patch.PatchList.TOOLBAR_COMPONENTS -import app.revanced.patches.youtube.utils.playservice.is_19_28_or_greater import app.revanced.patches.youtube.utils.playservice.versionCheckPatch import app.revanced.patches.youtube.utils.resourceid.actionBarRingoBackground import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch @@ -33,7 +31,6 @@ import app.revanced.util.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.util.doRecursively import app.revanced.util.findInstructionIndicesReversedOrThrow import app.revanced.util.findMethodOrThrow -import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall import app.revanced.util.fingerprint.matchOrThrow import app.revanced.util.fingerprint.methodOrThrow import app.revanced.util.fingerprint.mutableClassOrThrow @@ -43,7 +40,6 @@ import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfFirstInstructionReversedOrThrow import app.revanced.util.indexOfFirstLiteralInstructionOrThrow import app.revanced.util.replaceLiteralInstructionCall -import app.revanced.util.updatePatchStatus import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt index 2372a7df5..6d6b94963 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt @@ -454,7 +454,7 @@ val seekbarComponentsPatch = bytecodePatch( updatePatchStatus(PATCH_STATUS_CLASS_DESCRIPTOR, "OldSeekbarThumbnailsDefaultBoolean") } else { - println("WARNING: Restore old seekbar thumbnails setting is not supported in this version. Use YouTube 19.16.39 or earlier.") + println("WARNING: \"Restore old seekbar thumbnails\" is not supported in this version. Use YouTube 19.16.39 or earlier.") } // endregion diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt index 8aee32a6a..d59ecb8e7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/compatibility/Constants.kt @@ -15,7 +15,7 @@ internal object Constants { "18.48.39", // This is the last version that do not use Rolling Number. "19.05.36", // This is the last version with the least YouTube experimental flag. "19.16.39", // This is the last version where the 'Restore old seekbar thumbnails' setting works. - "19.34.42", // This is the latest version supported by the RVX patch. + "19.38.41", // This is the latest version supported by the RVX patch. ) ) } \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/CfBottomUIPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/CfBottomUIPatch.kt index 9729757cd..9e219e03c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/CfBottomUIPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/CfBottomUIPatch.kt @@ -7,15 +7,16 @@ import app.revanced.util.fingerprint.resolvable val cfBottomUIPatch = bytecodePatch( description = "cfBottomUIPatch" ) { + execute { /** * This issue only affects some versions of YouTube. * Therefore, this patch only applies to versions that can resolve this fingerprint. */ mapOf( - exploderControlsFingerprint to 45643739L, - fullscreenButtonViewStubFingerprint to 45617294L, - fullscreenButtonPositionFingerprint to 45627640L + fullscreenButtonPositionFingerprint to FULLSCREEN_BUTTON_POSITION_FEATURE_FLAG, + fullscreenButtonViewStubFingerprint to FULLSCREEN_BUTTON_VIEW_STUB_FEATURE_FLAG, + playerBottomControlsExploderFeatureFlagFingerprint to PLAYER_BOTTOM_CONTROLS_EXPLODER_FEATURE_FLAG, ).forEach { (fingerprint, literalValue) -> if (fingerprint.resolvable()) { fingerprint.injectLiteralInstructionBooleanCall( @@ -24,5 +25,7 @@ val cfBottomUIPatch = bytecodePatch( ) } } + + } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/Fingerprints.kt index 9f42e20ca..14d43d74c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/bottomui/Fingerprints.kt @@ -2,20 +2,24 @@ package app.revanced.patches.youtube.utils.fix.bottomui import app.revanced.util.fingerprint.legacyFingerprint -internal val exploderControlsFingerprint = legacyFingerprint( - name = "exploderControlsFingerprint", - returnType = "Z", - literals = listOf(45643739L), -) +internal const val FULLSCREEN_BUTTON_POSITION_FEATURE_FLAG = 45627640L +internal const val FULLSCREEN_BUTTON_VIEW_STUB_FEATURE_FLAG = 45617294L +internal const val PLAYER_BOTTOM_CONTROLS_EXPLODER_FEATURE_FLAG = 45643739L internal val fullscreenButtonPositionFingerprint = legacyFingerprint( name = "fullscreenButtonPositionFingerprint", returnType = "Z", - literals = listOf(45627640L), + literals = listOf(FULLSCREEN_BUTTON_POSITION_FEATURE_FLAG), ) internal val fullscreenButtonViewStubFingerprint = legacyFingerprint( name = "fullscreenButtonViewStubFingerprint", returnType = "Z", - literals = listOf(45617294L), + literals = listOf(FULLSCREEN_BUTTON_VIEW_STUB_FEATURE_FLAG), +) + +internal val playerBottomControlsExploderFeatureFlagFingerprint = legacyFingerprint( + name = "playerBottomControlsExploderFeatureFlagFingerprint", + returnType = "Z", + literals = listOf(PLAYER_BOTTOM_CONTROLS_EXPLODER_FEATURE_FLAG), ) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt index 751f987c8..9a35b4b3d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt @@ -1,6 +1,7 @@ package app.revanced.patches.youtube.utils.fix.cairo import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patches.youtube.misc.backgroundplayback.backgroundPlaybackPatch import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall import app.revanced.util.fingerprint.resolvable diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/Fingerprints.kt index 390a7d7b6..c788732e1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/Fingerprints.kt @@ -11,7 +11,6 @@ import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.reference.MethodReference - internal val bottomControlsInflateFingerprint = legacyFingerprint( name = "bottomControlsInflateFingerprint", returnType = "Ljava/lang/Object;", @@ -69,4 +68,12 @@ internal val playerControlsVisibilityFingerprint = legacyFingerprint( returnType = "V", accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, parameters = listOf("Z", "Z") +) + +internal const val PLAYER_TOP_CONTROLS_EXPERIMENTAL_LAYOUT_FEATURE_FLAG = 45629424L + +internal val playerTopControlsExperimentalLayoutFeatureFlagFingerprint = legacyFingerprint( + name = "playerTopControlsExperimentalLayoutFeatureFlagFingerprint", + returnType = "I", + literals = listOf(PLAYER_TOP_CONTROLS_EXPERIMENTAL_LAYOUT_FEATURE_FLAG), ) \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/PlayerControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/PlayerControlsPatch.kt index 4595a36c8..8a648f0f4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/PlayerControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playercontrols/PlayerControlsPatch.kt @@ -8,8 +8,11 @@ import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.resourcePatch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.utils.extension.Constants.UTILS_PATH +import app.revanced.patches.youtube.utils.extension.sharedExtensionPatch import app.revanced.patches.youtube.utils.playerButtonsResourcesFingerprint import app.revanced.patches.youtube.utils.playerButtonsVisibilityFingerprint +import app.revanced.patches.youtube.utils.playservice.is_19_25_or_greater +import app.revanced.patches.youtube.utils.playservice.versionCheckPatch import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch import app.revanced.patches.youtube.utils.youtubeControlsOverlayFingerprint import app.revanced.util.copyXmlNode @@ -40,7 +43,9 @@ private val playerControlsBytecodePatch = bytecodePatch( description = "playerControlsBytecodePatch" ) { dependsOn( - sharedResourceIdPatch + sharedExtensionPatch, + sharedResourceIdPatch, + versionCheckPatch, ) execute { @@ -154,6 +159,21 @@ private val playerControlsBytecodePatch = bytecodePatch( } // endregion + + if (is_19_25_or_greater) { + playerTopControlsExperimentalLayoutFeatureFlagFingerprint.methodOrThrow().apply { + val index = indexOfFirstInstructionOrThrow(Opcode.MOVE_RESULT_OBJECT) + val register = getInstruction(index).registerA + + addInstructions( + index + 1, + """ + invoke-static { v$register }, $EXTENSION_PLAYER_CONTROLS_CLASS_DESCRIPTOR->getPlayerTopControlsLayoutResourceName(Ljava/lang/String;)Ljava/lang/String; + move-result-object v$register + """, + ) + } + } } }