mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 23:54:33 +02:00
feat(YouTube): add support version 19.25.39
, drop support version 19.23.40
This commit is contained in:
parent
4866308321
commit
00cc6d0945
@ -18,6 +18,7 @@ abstract class BaseMainActivityResolvePatch(
|
||||
setOf(mainActivityOnCreateFingerprint)
|
||||
) {
|
||||
lateinit var mainActivityMutableClass: MutableClass
|
||||
lateinit var onConfigurationChangedMethod: MutableMethod
|
||||
|
||||
private lateinit var constructorMethod: MutableMethod
|
||||
private lateinit var onBackPressedMethod: MutableMethod
|
||||
@ -38,6 +39,9 @@ abstract class BaseMainActivityResolvePatch(
|
||||
// set onBackPressed method
|
||||
onBackPressedMethod = getMethod("onBackPressed")
|
||||
onBackPressedMethodIndex = onBackPressedMethod.getTargetIndexOrThrow(Opcode.RETURN_VOID)
|
||||
|
||||
// set onConfigurationChanged method
|
||||
onConfigurationChangedMethod = getMethod("onConfigurationChanged")
|
||||
}
|
||||
|
||||
fun injectConstructorMethodCall(classDescriptor: String, methodDescriptor: String) =
|
||||
|
@ -3,16 +3,20 @@ package app.revanced.patches.youtube.general.miniplayer
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerDimensionsCalculatorParentFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernAddViewListenerFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernCloseButtonFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernConstructorFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernConstructorFingerprint.isMultiConstructorMethod
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernDragAndDropFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernEnabledFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernExpandButtonFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernExpandCloseDrawablesFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernForwardButtonFingerprint
|
||||
@ -26,7 +30,6 @@ import app.revanced.patches.youtube.general.miniplayer.fingerprints.YouTubePlaye
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.YouTubePlayerOverlaysLayoutFingerprint.YOUTUBE_PLAYER_OVERLAYS_LAYOUT_CLASS_NAME
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.GENERAL_PATH
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ModernMiniPlayerClose
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ModernMiniPlayerExpand
|
||||
@ -45,7 +48,6 @@ import app.revanced.util.indexOfWideLiteralInstructionOrThrow
|
||||
import app.revanced.util.literalInstructionBooleanHook
|
||||
import app.revanced.util.patch.BaseBytecodePatch
|
||||
import app.revanced.util.resultOrThrow
|
||||
import app.revanced.util.updatePatchStatus
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||
@ -57,6 +59,7 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
import com.android.tools.smali.dexlib2.iface.reference.TypeReference
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
// YT uses "Miniplayer" without a space between 'mini' and 'player: https://support.google.com/youtube/answer/9162927.
|
||||
@Suppress("unused", "SpellCheckingInspection")
|
||||
@ -75,6 +78,7 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
MiniplayerOverrideFingerprint,
|
||||
MiniplayerModernConstructorFingerprint,
|
||||
MiniplayerModernDragAndDropFingerprint,
|
||||
MiniplayerModernEnabledFingerprint,
|
||||
MiniplayerModernViewParentFingerprint,
|
||||
YouTubePlayerOverlaysLayoutFingerprint,
|
||||
)
|
||||
@ -149,13 +153,13 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
|
||||
MiniplayerModernConstructorFingerprint.resultOrThrow().mutableClass.methods.forEach {
|
||||
it.apply {
|
||||
if (AccessFlags.CONSTRUCTOR.isSet(accessFlags)) {
|
||||
if (MethodUtil.isConstructor(it)) {
|
||||
val iPutIndex = indexOfFirstInstructionOrThrow {
|
||||
this.opcode == Opcode.IPUT && this.getReference<FieldReference>()?.type == "I"
|
||||
}
|
||||
|
||||
insertModernMiniplayerTypeOverride(iPutIndex)
|
||||
} else {
|
||||
} else if (isMultiConstructorMethod()) {
|
||||
findReturnIndicesReversed().forEach { index ->
|
||||
insertModernMiniplayerOverride(
|
||||
index
|
||||
@ -165,8 +169,17 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
if (SettingsPatch.upward1925) {
|
||||
MiniplayerModernEnabledFingerprint.literalInstructionBooleanHook(
|
||||
45622882,
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->getModernMiniplayerOverride(Z)Z"
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
val miniplayerModernViewParentClassDef = MiniplayerModernViewParentFingerprint.resultOrThrow().classDef
|
||||
|
||||
// region Fix 19.16 using mixed up drawables for tablet modern.
|
||||
// YT fixed this mistake in 19.17.
|
||||
// Fix this, by swapping the drawable resource values with each other.
|
||||
@ -174,7 +187,7 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
MiniplayerModernExpandCloseDrawablesFingerprint.apply {
|
||||
resolve(
|
||||
context,
|
||||
MiniplayerModernViewParentFingerprint.resultOrThrow().classDef
|
||||
miniplayerModernViewParentClassDef
|
||||
)
|
||||
}.resultOrThrow().mutableMethod.apply {
|
||||
listOf(
|
||||
@ -220,7 +233,7 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
).forEach { (fingerprint, literalValue, methodName) ->
|
||||
fingerprint.resolve(
|
||||
context,
|
||||
MiniplayerModernViewParentFingerprint.resultOrThrow().classDef
|
||||
miniplayerModernViewParentClassDef
|
||||
)
|
||||
|
||||
fingerprint.hookInflatedView(
|
||||
@ -233,13 +246,17 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
MiniplayerModernAddViewListenerFingerprint.apply {
|
||||
resolve(
|
||||
context,
|
||||
MiniplayerModernViewParentFingerprint.resultOrThrow().classDef
|
||||
miniplayerModernViewParentClassDef
|
||||
)
|
||||
}.resultOrThrow().mutableMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->" +
|
||||
"hideMiniplayerSubTexts(Landroid/view/View;)V"
|
||||
)
|
||||
}.resultOrThrow().mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideMiniplayerSubTexts(Landroid/view/View;)Z
|
||||
move-result v0
|
||||
if-nez v0, :hidden
|
||||
""", ExternalLabel("hidden", getInstruction(implementation!!.instructions.lastIndex))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// Modern 2 has a broken overlay subtitle view that is always present.
|
||||
@ -294,11 +311,6 @@ object MiniplayerPatch : BaseBytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
|
||||
if (SettingsPatch.upward1920) {
|
||||
context.updatePatchStatus(PATCH_STATUS_CLASS_DESCRIPTOR, "MiniplayerType1920")
|
||||
}
|
||||
|
||||
settingArray += "SETTINGS: MINIPLAYER_TYPE_MODERN"
|
||||
SettingsPatch.addPreference(settingArray)
|
||||
|
||||
|
@ -1,12 +1,29 @@
|
||||
package app.revanced.patches.youtube.general.miniplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.youtube.general.miniplayer.fingerprints.MiniplayerModernConstructorFingerprint.constructorMethodCount
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.containsWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
internal object MiniplayerModernConstructorFingerprint : LiteralValueFingerprint(
|
||||
internal object MiniplayerModernConstructorFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
parameters = listOf("L"),
|
||||
literalSupplier = { 45623000 } // Magic number found in the constructor.
|
||||
)
|
||||
customFingerprint = custom@{ methodDef, classDef ->
|
||||
if (!methodDef.containsWideLiteralInstructionIndex(45623000)) // Magic number found in the constructor.
|
||||
return@custom false
|
||||
|
||||
classDef.methods.forEach {
|
||||
if (MethodUtil.isConstructor(it)) constructorMethodCount += 1
|
||||
}
|
||||
|
||||
constructorMethodCount > 0
|
||||
}
|
||||
) {
|
||||
private var constructorMethodCount = 0
|
||||
|
||||
internal fun isMultiConstructorMethod() = constructorMethodCount > 1
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package app.revanced.patches.youtube.general.miniplayer.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
internal object MiniplayerModernEnabledFingerprint : LiteralValueFingerprint(
|
||||
literalSupplier = { 45622882 }
|
||||
)
|
@ -16,7 +16,7 @@ import app.revanced.patches.youtube.player.buttons.fingerprints.YouTubeControlsO
|
||||
import app.revanced.patches.youtube.utils.castbutton.CastButtonPatch
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.fingerprints.LayoutConstructorFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.fullscreen.FullscreenButtonViewStubPatch
|
||||
import app.revanced.patches.youtube.utils.fix.bottomui.CfBottomUIPatch
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.AutoNavToggle
|
||||
@ -39,7 +39,7 @@ object PlayerButtonsPatch : BaseBytecodePatch(
|
||||
description = "Adds options to hide buttons in the video player.",
|
||||
dependencies = setOf(
|
||||
CastButtonPatch::class,
|
||||
FullscreenButtonViewStubPatch::class,
|
||||
CfBottomUIPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
),
|
||||
|
@ -243,7 +243,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
addLiteralValues(insertIndex, jumpIndex - 1)
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex + 1, """
|
||||
insertIndex + 1, literalComponent + """
|
||||
const v$constRegister, $FadeDurationFast
|
||||
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->hideFilmstripOverlay()Z
|
||||
move-result v${replaceInstruction.registerA}
|
||||
@ -379,31 +379,16 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
) {
|
||||
for (index in startIndex..endIndex) {
|
||||
val opcode = getInstruction(index).opcode
|
||||
if (opcode != Opcode.CONST_16 && opcode != Opcode.CONST_4 && opcode != Opcode.CONST)
|
||||
if (opcode != Opcode.CONST_16 && opcode != Opcode.CONST_4)
|
||||
continue
|
||||
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
val value = getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
|
||||
|
||||
val line =
|
||||
when (opcode) {
|
||||
Opcode.CONST_16 -> """
|
||||
const/16 v$register, $value
|
||||
val line = """
|
||||
const/16 v$register, $value
|
||||
|
||||
""".trimIndent()
|
||||
|
||||
Opcode.CONST_4 -> """
|
||||
const/4 v$register, $value
|
||||
|
||||
""".trimIndent()
|
||||
|
||||
Opcode.CONST -> """
|
||||
const v$register, $value
|
||||
|
||||
""".trimIndent()
|
||||
|
||||
else -> ""
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
literalComponent += line
|
||||
}
|
||||
|
@ -13,9 +13,6 @@ import app.revanced.patches.youtube.player.fullscreen.fingerprints.BroadcastRece
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.ClientSettingEndpointFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.EngagementPanelFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.LandScapeModeConfigFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.OrientationParentFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.OrientationPrimaryFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.OrientationSecondaryFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.PlayerTitleViewFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.QuickActionsElementFingerprint
|
||||
import app.revanced.patches.youtube.player.fullscreen.fingerprints.RelatedEndScreenResultsFingerprint
|
||||
@ -26,16 +23,19 @@ import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFin
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.PATCH_STATUS_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.PLAYER_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.AutoNavPreviewStub
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.FullScreenEngagementPanel
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.QuickActionsElementContainer
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.getStringInstructionIndex
|
||||
import app.revanced.util.getTargetIndexOrThrow
|
||||
import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow
|
||||
import app.revanced.util.getWalkerMethod
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.patch.BaseBytecodePatch
|
||||
import app.revanced.util.resultOrThrow
|
||||
import app.revanced.util.updatePatchStatus
|
||||
@ -45,6 +45,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Suppress("unused")
|
||||
object FullscreenComponentsPatch : BaseBytecodePatch(
|
||||
@ -52,6 +53,7 @@ object FullscreenComponentsPatch : BaseBytecodePatch(
|
||||
description = "Adds options to hide or change components related to fullscreen.",
|
||||
dependencies = setOf(
|
||||
LithoFilterPatch::class,
|
||||
MainActivityResolvePatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
),
|
||||
@ -62,7 +64,6 @@ object FullscreenComponentsPatch : BaseBytecodePatch(
|
||||
EngagementPanelFingerprint,
|
||||
LandScapeModeConfigFingerprint,
|
||||
LayoutConstructorFingerprint,
|
||||
OrientationParentFingerprint,
|
||||
PlayerTitleViewFingerprint,
|
||||
QuickActionsElementFingerprint,
|
||||
RelatedEndScreenResultsFingerprint,
|
||||
@ -265,25 +266,42 @@ object FullscreenComponentsPatch : BaseBytecodePatch(
|
||||
|
||||
// region patch for disable landscape mode
|
||||
|
||||
OrientationParentFingerprint.resultOrThrow().classDef.let { classDef ->
|
||||
MainActivityResolvePatch.onConfigurationChangedMethod.apply {
|
||||
val walkerIndex = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.parameterTypes == listOf("Landroid/content/res/Configuration;")
|
||||
&& reference.returnType == "V"
|
||||
&& reference.name != "onConfigurationChanged"
|
||||
}
|
||||
|
||||
val walkerMethod = getWalkerMethod(context, walkerIndex)
|
||||
val targetClass =
|
||||
context.findClass(walkerMethod.definingClass)!!.mutableClass
|
||||
val constructorMethod = targetClass
|
||||
.methods
|
||||
.find { method ->
|
||||
method.name == "<init>"
|
||||
&& method.parameterTypes == listOf("Landroid/app/Activity;")
|
||||
} ?: throw PatchException("Constructor method not found!")
|
||||
|
||||
arrayOf(
|
||||
OrientationPrimaryFingerprint,
|
||||
OrientationSecondaryFingerprint
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.resolve(context, classDef)
|
||||
walkerMethod,
|
||||
constructorMethod
|
||||
).forEach { method ->
|
||||
method.apply {
|
||||
val index = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.parameterTypes == listOf("Landroid/content/Context;")
|
||||
&& reference.returnType == "Z"
|
||||
} + 1
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
fingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val index = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
|
||||
addInstructions(
|
||||
index + 1, """
|
||||
invoke-static {v$register}, $PLAYER_CLASS_DESCRIPTOR->disableLandScapeMode(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
addInstructions(
|
||||
index + 1, """
|
||||
invoke-static {v$register}, $PLAYER_CLASS_DESCRIPTOR->disableLandScapeMode(Z)Z
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.player.fullscreen.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object OrientationParentFingerprint : MethodFingerprint(
|
||||
returnType = "Z",
|
||||
strings = listOf("NoClassDefFoundError thrown while verifying stack trace.")
|
||||
)
|
@ -1,17 +0,0 @@
|
||||
package app.revanced.patches.youtube.player.fullscreen.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object OrientationPrimaryFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = { methodDef, _ -> methodDef.name == "<init>" }
|
||||
)
|
@ -1,16 +0,0 @@
|
||||
package app.revanced.patches.youtube.player.fullscreen.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object OrientationSecondaryFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT
|
||||
)
|
||||
)
|
@ -19,6 +19,7 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
import app.revanced.util.addFieldAndInstructions
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.getTargetIndexWithReferenceOrThrow
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.resultOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@ -84,11 +85,22 @@ object OverlayButtonsBytecodePatch : BytecodePatch(
|
||||
PlayerButtonConstructorFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
val registerResolver = implementation!!.registerCount - parameters.size - 1 + 6 // p6
|
||||
|
||||
val invokerObjectIndex = indexOfFirstInstructionOrThrow {
|
||||
var invokerObjectIndex = indexOfFirstInstruction {
|
||||
opcode == Opcode.IPUT_OBJECT
|
||||
&& getReference<FieldReference>()?.definingClass == definingClass
|
||||
&& (this as TwoRegisterInstruction).registerA == registerResolver
|
||||
}
|
||||
if (invokerObjectIndex < 0) {
|
||||
val moveObjectIndex = indexOfFirstInstructionOrThrow {
|
||||
(this as? TwoRegisterInstruction)?.registerB == registerResolver
|
||||
}
|
||||
val moveObjectRegister = getInstruction<TwoRegisterInstruction>(moveObjectIndex).registerA
|
||||
invokerObjectIndex = indexOfFirstInstructionOrThrow(moveObjectIndex) {
|
||||
opcode == Opcode.IPUT_OBJECT
|
||||
&& getReference<FieldReference>()?.definingClass == definingClass
|
||||
&& (this as TwoRegisterInstruction).registerA == moveObjectRegister
|
||||
}
|
||||
}
|
||||
val invokerObjectReference =
|
||||
getInstruction<ReferenceInstruction>(invokerObjectIndex).reference
|
||||
|
||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.player.overlaybuttons
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.fix.fullscreen.FullscreenButtonViewStubPatch
|
||||
import app.revanced.patches.youtube.utils.fix.bottomui.CfBottomUIPatch
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.OVERLAY_BUTTONS_PATH
|
||||
import app.revanced.patches.youtube.utils.playercontrols.PlayerControlsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
@ -27,7 +27,7 @@ object OverlayButtonsPatch : BaseResourcePatch(
|
||||
name = "Overlay buttons",
|
||||
description = "Adds options to display overlay buttons in the video player.",
|
||||
dependencies = setOf(
|
||||
FullscreenButtonViewStubPatch::class,
|
||||
CfBottomUIPatch::class,
|
||||
PlayerControlsPatch::class,
|
||||
SettingsPatch::class,
|
||||
OverlayButtonsBytecodePatch::class,
|
||||
|
@ -13,7 +13,7 @@ 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 that supports the 'Restore old seekbar thumbnails' setting.
|
||||
"19.23.40", // This is the latest version supported by the RVX patch.
|
||||
"19.25.39", // This is the latest version supported by the RVX patch.
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -1,12 +1,11 @@
|
||||
package app.revanced.patches.youtube.utils.fix.fullscreen
|
||||
package app.revanced.patches.youtube.utils.fix.bottomui
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.utils.fix.fullscreen.fingerprints.FullscreenButtonPositionFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.fullscreen.fingerprints.FullscreenButtonViewStubFingerprint
|
||||
import app.revanced.patches.youtube.utils.fix.bottomui.fingerprints.*
|
||||
import app.revanced.util.getTargetIndexOrThrow
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@ -15,8 +14,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Patch(
|
||||
description = "Fixes an issue where overlay button patches were broken by the new layout."
|
||||
)
|
||||
object FullscreenButtonViewStubPatch : BytecodePatch(
|
||||
object CfBottomUIPatch : BytecodePatch(
|
||||
setOf(
|
||||
BottomUIContainerBooleanFingerprint,
|
||||
BottomUIContainerIntegerFingerprint,
|
||||
FullscreenButtonPositionFingerprint,
|
||||
FullscreenButtonViewStubFingerprint
|
||||
)
|
||||
@ -28,6 +29,8 @@ object FullscreenButtonViewStubPatch : BytecodePatch(
|
||||
* Therefore, this patch only applies to versions that can resolve this fingerprint.
|
||||
*/
|
||||
mapOf(
|
||||
BottomUIContainerBooleanFingerprint to 45637647,
|
||||
BottomUIContainerIntegerFingerprint to 45637647,
|
||||
FullscreenButtonViewStubFingerprint to 45617294,
|
||||
FullscreenButtonPositionFingerprint to 45627640
|
||||
).forEach { (fingerprint, literalValue) ->
|
@ -0,0 +1,8 @@
|
||||
package app.revanced.patches.youtube.utils.fix.bottomui.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
internal object BottomUIContainerBooleanFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
literalSupplier = { 45637647 }
|
||||
)
|
@ -0,0 +1,8 @@
|
||||
package app.revanced.patches.youtube.utils.fix.bottomui.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
internal object BottomUIContainerIntegerFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
literalSupplier = { 45637647 }
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.utils.fix.fullscreen.fingerprints
|
||||
package app.revanced.patches.youtube.utils.fix.bottomui.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.utils.fix.fullscreen.fingerprints
|
||||
package app.revanced.patches.youtube.utils.fix.bottomui.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.youtube.utils.playercontrols.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.BottomUiContainerStub
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object BottomControlsInflateFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Ljava/lang/Object;",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL or AccessFlags.SYNTHETIC,
|
||||
parameters = emptyList(),
|
||||
opcodes = listOf(
|
||||
Opcode.CHECK_CAST,
|
||||
|
@ -97,8 +97,8 @@ object SettingsPatch : BaseResourcePatch(
|
||||
internal var upward1849 = false
|
||||
internal var upward1902 = false
|
||||
internal var upward1912 = false
|
||||
internal var upward1920 = false
|
||||
internal var upward1923 = false
|
||||
internal var upward1925 = false
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
@ -291,8 +291,8 @@ object SettingsPatch : BaseResourcePatch(
|
||||
upward1849 = 235000000 <= playServicesVersion
|
||||
upward1902 = 240204000 < playServicesVersion
|
||||
upward1912 = 241302000 <= playServicesVersion
|
||||
upward1920 = 242099000 <= playServicesVersion
|
||||
upward1923 = 242402000 <= playServicesVersion
|
||||
upward1925 = 242599000 <= playServicesVersion
|
||||
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user