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.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
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.TextComponentSpecFingerprint
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.integrations.Constants.UTILS_PATH
import com.android.tools.smali.dexlib2.Opcode
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.TwoRegisterInstruction
@Patch(dependencies = [SettingsPatch::class])
object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
setOf(
ShortsTextViewFingerprint,
@ -59,12 +62,12 @@ object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
}
} ?: throw ShortsTextViewFingerprint.exception
if (SettingsPatch.upward1834) {
TextComponentSpecFingerprint.result?.let {
it.mutableMethod.apply {
val insertIndex = it.scanResult.patternScanResult!!.startIndex
val charSequenceRegister =
getInstruction<FiveRegisterInstruction>(insertIndex).registerC
val charSequenceRegister = getInstruction<FiveRegisterInstruction>(insertIndex).registerC
val conversionContextRegister = getInstruction<TwoRegisterInstruction>(0).registerA
val replaceReference = getInstruction<ReferenceInstruction>(insertIndex).reference
@ -80,6 +83,7 @@ object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
}
} ?: throw TextComponentSpecFingerprint.exception
}
}
private const val INTEGRATIONS_RYD_CLASS_DESCRIPTOR =
"$UTILS_PATH/ReturnYouTubeDislikePatch;"