feat(YouTube): Bump compatibility to 18.37.36 (#3028)

Co-authored-by: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com>
This commit is contained in:
oSumAtrIX 2023-09-28 01:28:25 +02:00 committed by GitHub
parent 04cb04bdb4
commit eda28e507e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 197 additions and 145 deletions

View file

@ -12,8 +12,8 @@ import app.revanced.util.microg.MicroGBytecodeHelper
@Patch( @Patch(
name = "MicroG support", name = "Vanced MicroG support",
description = "Allows YouTube Music ReVanced to run without root and under a different package name.", description = "Allows YouTube Music to run without root and under a different package name.",
dependencies = [MicroGResourcePatch::class], dependencies = [MicroGResourcePatch::class],
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")] compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
) )

View file

@ -31,7 +31,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -18,7 +18,17 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
name = "Hide get premium", name = "Hide get premium",
dependencies = [IntegrationsPatch::class, SettingsPatch::class], dependencies = [IntegrationsPatch::class, SettingsPatch::class],
compatiblePackages = [ compatiblePackages = [
CompatiblePackage("com.google.android.youtube", ["18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"]) CompatiblePackage(
"com.google.android.youtube", [
"18.16.37",
"18.19.35",
"18.20.39",
"18.23.35",
"18.29.38",
"18.32.39",
"18.37.36"
]
)
] ]
) )
object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) { object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {

View file

@ -29,7 +29,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -24,7 +24,8 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -24,7 +24,8 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
), ),
] ]

View file

@ -31,7 +31,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -31,7 +31,8 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -1,5 +1,6 @@
package app.revanced.patches.youtube.layout.autocaptions package app.revanced.patches.youtube.layout.autocaptions
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
@ -28,7 +29,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
], ],
@ -47,38 +49,32 @@ object AutoCaptionsPatch : BytecodePatch(
) )
) )
val startVideoInformerMethod = StartVideoInformerFingerprint.result!!.mutableMethod mapOf(
StartVideoInformerFingerprint to 0,
SubtitleButtonControllerFingerprint to 1
).forEach { (fingerprint, enabled) ->
fingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x$enabled
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
"""
) ?: throw fingerprint.exception
}
startVideoInformerMethod.addInstructions( SubtitleTrackFingerprint.result?.mutableMethod?.addInstructionsWithLabels(
0, """ 0,
const/4 v0, 0x0 """
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z invoke-static {}, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->autoCaptionsEnabled()Z
""" move-result v0
) if-eqz v0, :auto_captions_enabled
sget-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
val subtitleButtonControllerMethod = SubtitleButtonControllerFingerprint.result!!.mutableMethod if-nez v0, :auto_captions_enabled
const/4 v0, 0x1
subtitleButtonControllerMethod.addInstructions( return v0
0, """ :auto_captions_enabled
const/4 v0, 0x1 nop
sput-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z """
"""
)
val subtitleTrackMethod = SubtitleTrackFingerprint.result!!.mutableMethod
subtitleTrackMethod.addInstructionsWithLabels(
0, """
invoke-static {}, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->autoCaptionsEnabled()Z
move-result v0
if-eqz v0, :auto_captions_enabled
sget-boolean v0, Lapp/revanced/integrations/patches/DisableAutoCaptionsPatch;->captionsButtonDisabled:Z
if-nez v0, :auto_captions_enabled
const/4 v0, 0x1
return v0
:auto_captions_enabled
nop
"""
) )
} }
} }

View file

@ -6,25 +6,11 @@ import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object StartVideoInformerFingerprint : MethodFingerprint( object StartVideoInformerFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L", "L", "L"), listOf( returnType = "V",
Opcode.INVOKE_STATIC, accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
Opcode.IGET_OBJECT, opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_INTERFACE, Opcode.INVOKE_INTERFACE,
Opcode.IF_EQZ, Opcode.RETURN_VOID
Opcode.CONST_STRING, ),
Opcode.INVOKE_INTERFACE, strings = listOf("pc")
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IF_EQZ,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.CONST_4,
Opcode.IF_EQ,
Opcode.GOTO,
)
) )

View file

@ -27,7 +27,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -37,7 +37,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -28,7 +28,8 @@ import com.android.tools.smali.dexlib2.Opcode
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -36,7 +36,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -32,7 +32,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -26,7 +26,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -30,7 +30,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -7,8 +7,6 @@ import com.android.tools.smali.dexlib2.Opcode
object LayoutIconFingerprint : LiteralValueFingerprint( object LayoutIconFingerprint : LiteralValueFingerprint(
returnType = "Landroid/view/View;", returnType = "Landroid/view/View;",
opcodes = listOf( opcodes = listOf(
Opcode.CONST_4,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST,

View file

@ -27,7 +27,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -27,7 +27,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
LithoFilterPatch::class, LithoFilterPatch::class,
SettingsPatch::class SettingsPatch::class
], ],
compatiblePackages = [CompatiblePackage("com.google.android.youtube", ["18.32.39"])] compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube", [
"18.32.39",
"18.37.36"
]
)
]
) )
@Suppress("unused") @Suppress("unused")
object HideLayoutComponentsPatch : BytecodePatch( object HideLayoutComponentsPatch : BytecodePatch(

View file

@ -35,7 +35,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -23,7 +23,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -32,7 +32,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -36,7 +36,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]
@ -54,8 +55,6 @@ object HideShortsComponentsPatch : BytecodePatch(
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;" private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
// region Hide the Shorts shelf. // region Hide the Shorts shelf.
ReelConstructorFingerprint.result?.let { ReelConstructorFingerprint.result?.let {
@ -74,13 +73,20 @@ object HideShortsComponentsPatch : BytecodePatch(
// endregion // endregion
// region Hide the Shorts buttons. // region Hide the Shorts buttons in older versions of YouTube.
// Some Shorts buttons are views, hide them by setting their visibility to GONE. // Some Shorts buttons are views, hide them by setting their visibility to GONE.
CreateShortsButtonsFingerprint.result?.let { CreateShortsButtonsFingerprint.result?.let {
ShortsButtons.values().forEach { button -> button.injectHideCall(it.mutableMethod) } ShortsButtons.entries.forEach { button -> button.injectHideCall(it.mutableMethod) }
} ?: throw CreateShortsButtonsFingerprint.exception } ?: throw CreateShortsButtonsFingerprint.exception
// endregion
// region Hide the Shorts buttons in newer versions of YouTube.
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
// endregion // endregion
// region Hide the navigation bar. // region Hide the navigation bar.

View file

@ -24,7 +24,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -28,7 +28,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -24,7 +24,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -18,7 +18,8 @@ import org.w3c.dom.Element
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
], ],

View file

@ -31,7 +31,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
PlayerTypeHookPatch::class, PlayerTypeHookPatch::class,
], ],
compatiblePackages = [ compatiblePackages = [
CompatiblePackage("com.google.android.youtube", ["18.32.39"]) CompatiblePackage("com.google.android.youtube", ["18.37.36"])
] ]
) )
@Suppress("unused") @Suppress("unused")
@ -91,49 +91,40 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
throw TextComponentAtomicReferenceFingerprint.exception throw TextComponentAtomicReferenceFingerprint.exception
}?.let { textComponentContextFingerprintResult -> }?.let { textComponentContextFingerprintResult ->
val conversionContextIndex = textComponentContextFingerprintResult val conversionContextIndex = textComponentContextFingerprintResult
.scanResult.patternScanResult!!.startIndex .scanResult.patternScanResult!!.endIndex
val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!! val atomicReferenceStartIndex = TextComponentAtomicReferenceFingerprint.result!!
.scanResult.patternScanResult!!.startIndex .scanResult.patternScanResult!!.startIndex
val insertIndex = atomicReferenceStartIndex + 6 val insertIndex = atomicReferenceStartIndex + 9
textComponentContextFingerprintResult.mutableMethod.apply { textComponentContextFingerprintResult.mutableMethod.apply {
// Get the conversion context obfuscated field name, and the registers for the AtomicReference and CharSequence // Get the conversion context obfuscated field name
val conversionContextFieldReference = val conversionContextFieldReference =
getInstruction<ReferenceInstruction>(conversionContextIndex).reference getInstruction<ReferenceInstruction>(conversionContextIndex).reference
// Reuse the free register to make room for the atomic reference register. // Free register to hold the conversion context
val freeRegister = val freeRegister =
getInstruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB getInstruction<TwoRegisterInstruction>(atomicReferenceStartIndex).registerB
val atomicReferenceRegister = val atomicReferenceRegister =
getInstruction<FiveRegisterInstruction>(atomicReferenceStartIndex + 1).registerC getInstruction<FiveRegisterInstruction>(atomicReferenceStartIndex + 6).registerC
val moveCharSequenceInstruction = getInstruction<TwoRegisterInstruction>(insertIndex - 1) // Instruction that is replaced, and also has the CharacterSequence register.
val moveCharSequenceInstruction = getInstruction<TwoRegisterInstruction>(insertIndex)
val charSequenceSourceRegister = moveCharSequenceInstruction.registerB val charSequenceSourceRegister = moveCharSequenceInstruction.registerB
val charSequenceTargetRegister = moveCharSequenceInstruction.registerA val charSequenceTargetRegister = moveCharSequenceInstruction.registerA
// In order to preserve the atomic reference register, because it is overwritten,
// use another free register to store it.
replaceInstruction(
atomicReferenceStartIndex + 2,
"move-result-object v$freeRegister"
)
replaceInstruction(
atomicReferenceStartIndex + 3,
"move-object v$charSequenceSourceRegister, v$freeRegister"
)
// Move the current instance to the free register, and get the conversion context from it. // Move the current instance to the free register, and get the conversion context from it.
replaceInstruction(insertIndex - 1, "move-object/from16 v$freeRegister, p0") // Must replace the instruction to preserve the control flow label.
replaceInstruction(insertIndex, "move-object/from16 v$freeRegister, p0")
addInstructions( addInstructions(
insertIndex, insertIndex + 1,
""" """
# Move context to free register # Move context to free register
iget-object v$freeRegister, v$freeRegister, $conversionContextFieldReference iget-object v$freeRegister, v$freeRegister, $conversionContextFieldReference
invoke-static {v$freeRegister, v$atomicReferenceRegister, v$charSequenceSourceRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence; invoke-static {v$freeRegister, v$atomicReferenceRegister, v$charSequenceSourceRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
move-result-object v$freeRegister move-result-object v$freeRegister
# Replace the original char sequence with the modified one. # Replace the original instruction
move-object v${charSequenceTargetRegister}, v${freeRegister} move-object v${charSequenceTargetRegister}, v${freeRegister}
""" """
) )
@ -152,7 +143,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
val isDisLikesBooleanReference = getInstruction<ReferenceInstruction>(patternResult.endIndex).reference val isDisLikesBooleanReference = getInstruction<ReferenceInstruction>(patternResult.endIndex).reference
val textViewFieldReference = // Like/Dislike button TextView field val textViewFieldReference = // Like/Dislike button TextView field
getInstruction<ReferenceInstruction>(patternResult.endIndex - 2).reference getInstruction<ReferenceInstruction>(patternResult.endIndex - 1).reference
// Check if the hooked TextView object is that of the dislike button. // Check if the hooked TextView object is that of the dislike button.
// If RYD is disabled, or the TextView object is not that of the dislike button, the execution flow is not interrupted. // If RYD is disabled, or the TextView object is not that of the dislike button, the execution flow is not interrupted.

View file

@ -1,12 +1,12 @@
package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object ShortsTextViewFingerprint : MethodFingerprint( object ShortsTextViewFingerprint : MethodFingerprint(
// 18.29.38 method is public final visibility, but in 18.23.35 and older it's protected final. accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
// If 18.23.35 is dropped then accessFlags should be specified here.
returnType = "V", returnType = "V",
parameters = listOf("L", "L"), parameters = listOf("L", "L"),
opcodes = listOf( opcodes = listOf(
@ -27,7 +27,6 @@ object ShortsTextViewFingerprint : MethodFingerprint(
Opcode.IF_EQ, Opcode.IF_EQ,
Opcode.RETURN_VOID, Opcode.RETURN_VOID,
Opcode.IGET_OBJECT, // TextView field Opcode.IGET_OBJECT, // TextView field
Opcode.CHECK_CAST,
Opcode.IGET_BOOLEAN, // boolean field Opcode.IGET_BOOLEAN, // boolean field
) )
) )

View file

@ -13,13 +13,17 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL, accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"), parameters = listOf("L"),
opcodes = listOf( opcodes = listOf(
Opcode.MOVE_OBJECT, // Register A and B is context, use B as context, reuse A as free register Opcode.MOVE_OBJECT, // Register B is free register
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.INVOKE_VIRTUAL, // Register C is atomic reference Opcode.INVOKE_VIRTUAL, // Register C is atomic reference
Opcode.MOVE_RESULT_OBJECT, // Register A is char sequence Opcode.MOVE_RESULT_OBJECT, // Register A is char sequence
Opcode.MOVE_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST,
Opcode.MOVE_OBJECT, Opcode.MOVE_OBJECT, // Replace this instruction with patch code
Opcode.INVOKE_INTERFACE, // Insert hook here Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT, Opcode.MOVE_RESULT,
Opcode.IF_EQZ, Opcode.IF_EQZ,
Opcode.INVOKE_INTERFACE, Opcode.INVOKE_INTERFACE,

View file

@ -13,12 +13,14 @@ object TextComponentContextFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL, accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"), parameters = listOf("L"),
opcodes = listOf( opcodes = listOf(
Opcode.MOVE_OBJECT_FROM16,
Opcode.MOVE_OBJECT_FROM16,
Opcode.INVOKE_STATIC_RANGE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT, // conversion context field name Opcode.IGET_OBJECT, // conversion context field name
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IGET_BOOLEAN,
Opcode.IGET,
Opcode.IGET,
Opcode.IGET,
) )
) )

View file

@ -27,7 +27,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -44,7 +44,8 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
], ],

View file

@ -28,7 +28,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -23,7 +23,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -33,7 +33,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
) )
) )
] ]

View file

@ -25,7 +25,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -29,7 +29,8 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -24,7 +24,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -19,7 +19,20 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
@Patch( @Patch(
name = "Open links externally", name = "Open links externally",
description = "Open links outside of the app directly in your browser.", description = "Open links outside of the app directly in your browser.",
compatiblePackages = [CompatiblePackage("com.google.android.youtube", ["18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"])] compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
[
"18.16.37",
"18.19.35",
"18.20.39",
"18.23.35",
"18.29.38",
"18.32.39",
"18.37.36"
]
)
]
) )
@Suppress("unused") @Suppress("unused")
object OpenLinksExternallyPatch : AbstractTransformInstructionsPatch<Pair<Int, Int>>( object OpenLinksExternallyPatch : AbstractTransformInstructionsPatch<Pair<Int, Int>>(

View file

@ -103,7 +103,7 @@ object LithoFilterPatch : BytecodePatch(
val emptyComponentFieldIndex = builderMethodIndex + 2 val emptyComponentFieldIndex = builderMethodIndex + 2
bytesToComponentContextMethod.mutableMethod.apply { bytesToComponentContextMethod.mutableMethod.apply {
val insertHookIndex = bytesToComponentContextMethod.scanResult.patternScanResult!!.endIndex val insertHookIndex = bytesToComponentContextMethod.scanResult.patternScanResult!!.endIndex + 1
// region Get free registers that this patch uses. // region Get free registers that this patch uses.
// Registers are overwritten right after they are used in this patch, therefore free to clobber. // Registers are overwritten right after they are used in this patch, therefore free to clobber.

View file

@ -5,9 +5,9 @@ import com.android.tools.smali.dexlib2.Opcode
object ComponentContextParserFingerprint : MethodFingerprint( object ComponentContextParserFingerprint : MethodFingerprint(
opcodes = listOf( opcodes = listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.IPUT_OBJECT, Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE
), ),
strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings.") strings = listOf("Component was not found %s because it was removed due to duplicate converter bindings.")
) )

View file

@ -14,7 +14,7 @@ import app.revanced.util.microg.MicroGBytecodeHelper
@Patch( @Patch(
name = "Vanced MicroG support", name = "Vanced MicroG support",
description = "Allows YouTube ReVanced to run without root and under a different package name with Vanced MicroG.", description = "Allows YouTube to run without root and under a different package name with Vanced MicroG.",
dependencies = [ dependencies = [
MicroGResourcePatch::class, MicroGResourcePatch::class,
HideCastButtonPatch::class, HideCastButtonPatch::class,
@ -28,7 +28,8 @@ import app.revanced.util.microg.MicroGBytecodeHelper
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -34,7 +34,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -26,7 +26,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -36,7 +36,8 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -11,7 +11,7 @@ object SetQualityByIndexMethodClassFieldReferenceFingerprint : MethodFingerprint
parameters = listOf("L"), parameters = listOf("L"),
opcodes = listOf( opcodes = listOf(
Opcode.IGET_OBJECT, Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE, Opcode.IPUT_OBJECT,
Opcode.RETURN_VOID Opcode.IGET_OBJECT,
) )
) )

View file

@ -18,7 +18,8 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]

View file

@ -28,7 +28,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
"18.20.39", "18.20.39",
"18.23.35", "18.23.35",
"18.29.38", "18.29.38",
"18.32.39" "18.32.39",
"18.37.36"
] ]
) )
] ]