feat(YouTube): Add experimental support for 21.20.493

Co-Authored-By: LisoUseInAIKyrios <118716522+lisouseinaikyrios@users.noreply.github.com>
This commit is contained in:
oSumAtrIX 2026-03-11 10:44:18 +01:00
parent 20079d267a
commit 7f52ec2cea
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
4 changed files with 37 additions and 8 deletions

View file

@ -15,6 +15,8 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater
import app.revanced.patches.youtube.misc.playservice.is_20_09_or_greater
import app.revanced.patcher.method
import app.revanced.patches.youtube.misc.playservice.is_21_10_or_greater
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
@ -99,12 +101,23 @@ val shortsAutoplayPatch = bytecodePatch(
reelPlaybackRepeatMethod.apply {
// The behavior enums are looked up from an ordinal value to an enum type.
findInstructionIndicesReversedOrThrow {
val reference = getReference<MethodReference>()
reference?.definingClass == reelEnumClass &&
reference.parameterTypes.firstOrNull() == "I" &&
reference.returnType == reelEnumClass
}.forEach { index ->
val match = if (is_21_10_or_greater) {
method {
returnType == reelEnumClass &&
parameterTypes.size == 1 &&
parameterTypes[0].startsWith("L")
}
} else {
method {
definingClass == "reelEnumClass" &&
returnType == reelEnumClass &&
parameterTypes.size == 1 &&
parameterTypes[0].startsWith("L")
}
}
findInstructionIndicesReversedOrThrow { match(0, 0) {} }.forEach { index ->
val register = getInstruction<OneRegisterInstruction>(index + 1).registerA
addInstructions(

View file

@ -127,6 +127,8 @@ var is_21_07_or_greater : Boolean by Delegates.notNull()
private set
var is_21_08_or_greater : Boolean by Delegates.notNull()
private set
var is_21_10_or_greater : Boolean by Delegates.notNull()
private set
val versionCheckPatch = resourcePatch(
description = "Uses the Play Store service version to find the major/minor version of the YouTube target app.",
@ -184,5 +186,6 @@ val versionCheckPatch = resourcePatch(
is_21_06_or_greater = 260705000 <= playStoreServicesVersion
is_21_07_or_greater = 260805000 <= playStoreServicesVersion
is_21_08_or_greater = 260905000 <= playStoreServicesVersion
is_21_10_or_greater = 261080000 <= playStoreServicesVersion
}
}