fix(YouTube/Return YouTube Dislike): new type of Shorts RYD patch has also been applied to YouTube versions below v18.33.40

This commit is contained in:
inotia00 2023-10-14 06:17:56 +09:00
parent 9aa45f55f7
commit 855ef3a21d

View File

@ -7,15 +7,18 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.fingerprints.ShortsTextViewFingerprint import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.fingerprints.ShortsTextViewFingerprint
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.util.integrations.Constants.UTILS_PATH import app.revanced.util.integrations.Constants.UTILS_PATH
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
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.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
@Patch(dependencies = [SettingsPatch::class])
object ReturnYouTubeDislikeShortsPatch : BytecodePatch( object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
setOf( setOf(
ShortsTextViewFingerprint, ShortsTextViewFingerprint,
@ -59,26 +62,27 @@ object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
} }
} ?: throw ShortsTextViewFingerprint.exception } ?: throw ShortsTextViewFingerprint.exception
TextComponentSpecFingerprint.result?.let { if (SettingsPatch.upward1834) {
it.mutableMethod.apply { TextComponentSpecFingerprint.result?.let {
val insertIndex = it.scanResult.patternScanResult!!.startIndex it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.startIndex
val charSequenceRegister = val charSequenceRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
getInstruction<FiveRegisterInstruction>(insertIndex).registerC val conversionContextRegister = getInstruction<TwoRegisterInstruction>(0).registerA
val conversionContextRegister = getInstruction<TwoRegisterInstruction>(0).registerA
val replaceReference = getInstruction<ReferenceInstruction>(insertIndex).reference val replaceReference = getInstruction<ReferenceInstruction>(insertIndex).reference
addInstructions( addInstructions(
insertIndex + 1, """ insertIndex + 1, """
invoke-static {v$conversionContextRegister, v$charSequenceRegister}, $INTEGRATIONS_RYD_CLASS_DESCRIPTOR->onCharSequenceLoaded(Ljava/lang/Object;Ljava/lang/CharSequence;)Ljava/lang/CharSequence; invoke-static {v$conversionContextRegister, v$charSequenceRegister}, $INTEGRATIONS_RYD_CLASS_DESCRIPTOR->onCharSequenceLoaded(Ljava/lang/Object;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
move-result-object v$charSequenceRegister move-result-object v$charSequenceRegister
invoke-static {v$charSequenceRegister}, $replaceReference invoke-static {v$charSequenceRegister}, $replaceReference
""" """
) )
removeInstruction(insertIndex) removeInstruction(insertIndex)
} }
} ?: throw TextComponentSpecFingerprint.exception } ?: throw TextComponentSpecFingerprint.exception
}
} }
private const val INTEGRATIONS_RYD_CLASS_DESCRIPTOR = private const val INTEGRATIONS_RYD_CLASS_DESCRIPTOR =