feat(YouTube): Support version 19.38.41

This commit is contained in:
inotia00 2024-12-17 13:38:32 +09:00
parent 4081263160
commit 2def0d4cc7
10 changed files with 58 additions and 19 deletions

View File

@ -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));

View File

@ -119,4 +119,11 @@ public class PlayerControlsPatch {
// CreateSegmentButtonController.changeVisibilityNegatedImmediate();
// VotingButtonController.changeVisibilityNegatedImmediate();
}
/**
* Injection point.
*/
public static String getPlayerTopControlsLayoutResourceName(String original) {
return "default";
}
}

View File

@ -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

View File

@ -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

View File

@ -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.
)
)
}

View File

@ -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(
)
}
}
}
}

View File

@ -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),
)

View File

@ -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

View File

@ -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;",
@ -70,3 +69,11 @@ internal val playerControlsVisibilityFingerprint = legacyFingerprint(
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),
)

View File

@ -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<OneRegisterInstruction>(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
""",
)
}
}
}
}