mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 16:44:29 +02:00
fix(YouTube/Return YouTube Dislike): remove support for old layout (~YouTube v17.30.xx)
This commit is contained in:
parent
b440417246
commit
22e0afd4eb
@ -33,7 +33,6 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
var ControlsLayoutStub: Long = -1
|
var ControlsLayoutStub: Long = -1
|
||||||
var CoreContainer: Long = -1
|
var CoreContainer: Long = -1
|
||||||
var DarkSplashAnimation: Long = -1
|
var DarkSplashAnimation: Long = -1
|
||||||
var DislikeButton: Long = -1
|
|
||||||
var DonationCompanion: Long = -1
|
var DonationCompanion: Long = -1
|
||||||
var EasySeekEduContainer: Long = -1
|
var EasySeekEduContainer: Long = -1
|
||||||
var EditSettingsAction: Long = -1
|
var EditSettingsAction: Long = -1
|
||||||
@ -118,7 +117,6 @@ object SharedResourceIdPatch : ResourcePatch() {
|
|||||||
ControlsLayoutStub = find(ID, "controls_layout_stub")
|
ControlsLayoutStub = find(ID, "controls_layout_stub")
|
||||||
CoreContainer = find(ID, "core_container")
|
CoreContainer = find(ID, "core_container")
|
||||||
DarkSplashAnimation = find(ID, "dark_splash_animation")
|
DarkSplashAnimation = find(ID, "dark_splash_animation")
|
||||||
DislikeButton = find(ID, "dislike_button")
|
|
||||||
DonationCompanion = find(LAYOUT, "donation_companion")
|
DonationCompanion = find(LAYOUT, "donation_companion")
|
||||||
EasySeekEduContainer = find(ID, "easy_seek_edu_container")
|
EasySeekEduContainer = find(ID, "easy_seek_edu_container")
|
||||||
EditSettingsAction = find(STRING, "edit_settings_action")
|
EditSettingsAction = find(STRING, "edit_settings_action")
|
||||||
|
@ -16,17 +16,14 @@ import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerpri
|
|||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.RemoveLikeFingerprint
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.RemoveLikeFingerprint
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentConstructorFingerprint
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentConstructorFingerprint
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentContextFingerprint
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentContextFingerprint
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.oldlayout.ReturnYouTubeDislikeOldLayoutPatch
|
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.rollingnumber.ReturnYouTubeDislikeRollingNumberPatch
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.rollingnumber.ReturnYouTubeDislikeRollingNumberPatch
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.ReturnYouTubeDislikeShortsPatch
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.ReturnYouTubeDislikeShortsPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.general.VideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.general.VideoIdPatch
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getTargetIndexWithFieldReferenceType
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
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.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Return YouTube Dislike",
|
name = "Return YouTube Dislike",
|
||||||
@ -34,7 +31,6 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
LithoFilterPatch::class,
|
LithoFilterPatch::class,
|
||||||
PlayerResponsePatch::class,
|
PlayerResponsePatch::class,
|
||||||
ReturnYouTubeDislikeOldLayoutPatch::class,
|
|
||||||
ReturnYouTubeDislikeRollingNumberPatch::class,
|
ReturnYouTubeDislikeRollingNumberPatch::class,
|
||||||
ReturnYouTubeDislikeShortsPatch::class,
|
ReturnYouTubeDislikeShortsPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
@ -79,6 +75,12 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
TextComponentConstructorFingerprint
|
TextComponentConstructorFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
private const val INTEGRATIONS_RYD_CLASS_DESCRIPTOR =
|
||||||
|
"$UTILS_PATH/ReturnYouTubeDislikePatch;"
|
||||||
|
|
||||||
|
private const val FILTER_CLASS_DESCRIPTOR =
|
||||||
|
"$COMPONENTS_PATH/ReturnYouTubeDislikeFilterPatch;"
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
listOf(
|
listOf(
|
||||||
LikeFingerprint.toPatch(Vote.LIKE),
|
LikeFingerprint.toPatch(Vote.LIKE),
|
||||||
@ -103,17 +105,11 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
|
|
||||||
TextComponentContextFingerprint.result?.let {
|
TextComponentContextFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val conversionContextFieldIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
val conversionContextFieldIndex = getTargetIndexWithFieldReferenceType("Ljava/util/Map;") - 1
|
||||||
instruction.opcode == Opcode.IGET_OBJECT
|
|
||||||
&& instruction.getReference<FieldReference>()?.type == "Ljava/util/Map;"
|
|
||||||
} - 1
|
|
||||||
val conversionContextFieldReference =
|
val conversionContextFieldReference =
|
||||||
getInstruction<ReferenceInstruction>(conversionContextFieldIndex).reference
|
getInstruction<ReferenceInstruction>(conversionContextFieldIndex).reference
|
||||||
|
|
||||||
val charSequenceIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
val charSequenceIndex = getTargetIndexWithFieldReferenceType("Ljava/util/BitSet;") - 1
|
||||||
instruction.opcode == Opcode.IGET_OBJECT
|
|
||||||
&& instruction.getReference<FieldReference>()?.type == "Ljava/util/BitSet;"
|
|
||||||
} - 1
|
|
||||||
val charSequenceRegister = getInstruction<TwoRegisterInstruction>(charSequenceIndex).registerA
|
val charSequenceRegister = getInstruction<TwoRegisterInstruction>(charSequenceIndex).registerA
|
||||||
val freeRegister = getInstruction<TwoRegisterInstruction>(charSequenceIndex).registerB
|
val freeRegister = getInstruction<TwoRegisterInstruction>(charSequenceIndex).registerB
|
||||||
|
|
||||||
@ -146,12 +142,6 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val INTEGRATIONS_RYD_CLASS_DESCRIPTOR =
|
|
||||||
"$UTILS_PATH/ReturnYouTubeDislikePatch;"
|
|
||||||
|
|
||||||
private const val FILTER_CLASS_DESCRIPTOR =
|
|
||||||
"$COMPONENTS_PATH/ReturnYouTubeDislikeFilterPatch;"
|
|
||||||
|
|
||||||
private fun MethodFingerprint.toPatch(voteKind: Vote) = VotePatch(this, voteKind)
|
private fun MethodFingerprint.toPatch(voteKind: Vote) = VotePatch(this, voteKind)
|
||||||
|
|
||||||
private data class VotePatch(val fingerprint: MethodFingerprint, val voteKind: Vote)
|
private data class VotePatch(val fingerprint: MethodFingerprint, val voteKind: Vote)
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.utils.returnyoutubedislike.oldlayout
|
|
||||||
|
|
||||||
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.integrations.Constants.UTILS_PATH
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DislikeButton
|
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.oldlayout.fingerprints.ButtonTagFingerprint
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.util.getWideLiteralInstructionIndex
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(dependencies = [SharedResourceIdPatch::class])
|
|
||||||
object ReturnYouTubeDislikeOldLayoutPatch : BytecodePatch(
|
|
||||||
setOf(ButtonTagFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
|
|
||||||
ButtonTagFingerprint.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val dislikeButtonIndex = getWideLiteralInstructionIndex(DislikeButton)
|
|
||||||
|
|
||||||
val resourceIdentifierRegister =
|
|
||||||
getInstruction<OneRegisterInstruction>(dislikeButtonIndex).registerA
|
|
||||||
val textViewRegister =
|
|
||||||
getInstruction<OneRegisterInstruction>(dislikeButtonIndex + 4).registerA
|
|
||||||
|
|
||||||
addInstruction(
|
|
||||||
dislikeButtonIndex + 4,
|
|
||||||
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_RYD_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw ButtonTagFingerprint.exception
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private const val INTEGRATIONS_RYD_CLASS_DESCRIPTOR =
|
|
||||||
"$UTILS_PATH/ReturnYouTubeDislikePatch;"
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.utils.returnyoutubedislike.oldlayout.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.DislikeButton
|
|
||||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
object ButtonTagFingerprint : LiteralValueFingerprint(
|
|
||||||
returnType = "V",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
parameters = listOf("L"),
|
|
||||||
literalSupplier = { DislikeButton }
|
|
||||||
)
|
|
@ -18,13 +18,13 @@ import app.revanced.patches.youtube.utils.returnyoutubedislike.rollingnumber.fin
|
|||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.rollingnumber.fingerprints.RollingNumberTextViewFingerprint
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.rollingnumber.fingerprints.RollingNumberTextViewFingerprint
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
|
import app.revanced.util.getTargetIndexWithMethodReferenceName
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
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.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||||
|
|
||||||
@Patch(dependencies = [SettingsPatch::class])
|
@Patch(dependencies = [SettingsPatch::class])
|
||||||
@ -158,10 +158,7 @@ object ReturnYouTubeDislikeRollingNumberPatch : BytecodePatch(
|
|||||||
realTimeUpdateTextViewMethod
|
realTimeUpdateTextViewMethod
|
||||||
).forEach { insertMethod ->
|
).forEach { insertMethod ->
|
||||||
insertMethod.apply {
|
insertMethod.apply {
|
||||||
val setTextIndex =
|
val setTextIndex = getTargetIndexWithMethodReferenceName("setText")
|
||||||
implementation!!.instructions.indexOfFirst { instruction ->
|
|
||||||
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == "setText"
|
|
||||||
}
|
|
||||||
val textViewRegister =
|
val textViewRegister =
|
||||||
getInstruction<FiveRegisterInstruction>(setTextIndex).registerC
|
getInstruction<FiveRegisterInstruction>(setTextIndex).registerC
|
||||||
val textSpanRegister =
|
val textSpanRegister =
|
||||||
|
@ -15,6 +15,7 @@ import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.fingerprin
|
|||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.fingerprints.TextComponentSpecFingerprint
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.fingerprints.TextComponentSpecFingerprint
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
|
import app.revanced.util.getTargetIndex
|
||||||
import app.revanced.util.getTargetIndexReversed
|
import app.revanced.util.getTargetIndexReversed
|
||||||
import app.revanced.util.getTargetIndexWithReference
|
import app.revanced.util.getTargetIndexWithReference
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
@ -51,9 +52,7 @@ object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
|
|||||||
// 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.
|
||||||
// Otherwise, the TextView object is modified, and the execution flow is interrupted to prevent it from being changed afterward.
|
// Otherwise, the TextView object is modified, and the execution flow is interrupted to prevent it from being changed afterward.
|
||||||
val insertIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
val insertIndex = getTargetIndex(Opcode.CHECK_CAST) + 1
|
||||||
instruction.opcode == Opcode.CHECK_CAST
|
|
||||||
} + 1
|
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
insertIndex, """
|
insertIndex, """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user