mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
feat(youtube): add support version v18.30.37
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package app.revanced.patches.youtube.general.mixplaylists.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ElementParserFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.IGET_BOOLEAN,
|
||||
Opcode.IF_EQZ
|
||||
),
|
||||
strings = listOf("Failed to parse Element")
|
||||
)
|
@ -13,8 +13,10 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.BottomPanelOverlayTextFingerprint
|
||||
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.ElementParserFingerprint
|
||||
import app.revanced.patches.youtube.general.mixplaylists.fingerprints.EmptyFlatBufferFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@ -32,6 +34,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
class MixPlaylistsPatch : BytecodePatch(
|
||||
listOf(
|
||||
BottomPanelOverlayTextFingerprint,
|
||||
ElementParserFingerprint,
|
||||
EmptyFlatBufferFingerprint
|
||||
)
|
||||
) {
|
||||
@ -57,6 +60,14 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
* Separated from bytebuffer patch
|
||||
* Target method is only used for Hide MixPlaylists patch
|
||||
*/
|
||||
ElementParserFingerprint.result
|
||||
?: EmptyFlatBufferFingerprint.result
|
||||
?: throw EmptyFlatBufferFingerprint.toErrorResult()
|
||||
|
||||
|
||||
/**
|
||||
* ~YouTube v18.29.38
|
||||
*/
|
||||
EmptyFlatBufferFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
||||
@ -65,22 +76,34 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
val jumpIndex = getStringIndex("Failed to convert Element to Flatbuffers: %s") + 2
|
||||
|
||||
val freeIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
||||
val freeRegister = getInstruction<TwoRegisterInstruction>(freeIndex).registerA
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z
|
||||
move-result v$freeRegister
|
||||
if-nez v$freeRegister, :not_an_ad
|
||||
""", ExternalLabel("not_an_ad", getInstruction(jumpIndex))
|
||||
)
|
||||
|
||||
addInstruction(
|
||||
0,
|
||||
"move-object/from16 v$freeRegister, p3"
|
||||
)
|
||||
inject(freeIndex, insertIndex, jumpIndex)
|
||||
}
|
||||
} ?: return EmptyFlatBufferFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
/**
|
||||
* YouTube v18.30.xx~
|
||||
*/
|
||||
ElementParserFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val methodInstructions = implementation!!.instructions
|
||||
|
||||
val insertIndex = methodInstructions.indexOfFirst { instruction ->
|
||||
instruction.opcode == Opcode.INVOKE_INTERFACE
|
||||
}
|
||||
val freeIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
||||
|
||||
for (index in methodInstructions.size - 1 downTo 0) {
|
||||
if (getInstruction(index).opcode != Opcode.INVOKE_INTERFACE_RANGE) continue
|
||||
|
||||
val jumpIndex = index + 1
|
||||
|
||||
inject(freeIndex, insertIndex, jumpIndex)
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -96,4 +119,26 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
private companion object {
|
||||
fun MutableMethod.inject(
|
||||
freeIndex: Int,
|
||||
insertIndex: Int,
|
||||
jumpIndex: Int
|
||||
) {
|
||||
val freeRegister = getInstruction<TwoRegisterInstruction>(freeIndex).registerA
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {v$freeRegister}, $GENERAL->hideMixPlaylists([B)Z
|
||||
move-result v$freeRegister
|
||||
if-nez v$freeRegister, :not_an_ad
|
||||
""", ExternalLabel("not_an_ad", getInstruction(jumpIndex))
|
||||
)
|
||||
|
||||
addInstruction(
|
||||
0,
|
||||
"move-object/from16 v$freeRegister, p3"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,15 +3,9 @@ package app.revanced.patches.youtube.misc.externalbrowser.fingerprints
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object ExternalBrowserSecondaryFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
opcodes = listOf(
|
||||
Opcode.IPUT_OBJECT,
|
||||
Opcode.NEW_INSTANCE,
|
||||
Opcode.CONST_STRING
|
||||
),
|
||||
strings = listOf("android.support.customtabs.action.CustomTabsService")
|
||||
)
|
@ -17,6 +17,7 @@ import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBr
|
||||
import app.revanced.patches.youtube.misc.externalbrowser.fingerprints.ExternalBrowserTertiaryFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@ -42,11 +43,11 @@ class ExternalBrowserPatch : BytecodePatch(
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
||||
val targetIndex = getStringIndex("android.support.customtabs.action.CustomTabsService")
|
||||
val register = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
endIndex + 1, """
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$register}, $MISC_PATH/ExternalBrowserPatch;->enableExternalBrowser(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
"""
|
||||
|
@ -79,7 +79,10 @@ class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
|
||||
if (SettingsPatch.upward1828) {
|
||||
for (index in insertIndex .. initialIndex) {
|
||||
if (getInstruction(index).opcode != Opcode.CONST_16 && getInstruction(index).opcode != Opcode.CONST) continue
|
||||
if (getInstruction(index).opcode != Opcode.CONST_16 &&
|
||||
getInstruction(index).opcode != Opcode.CONST_4 &&
|
||||
getInstruction(index).opcode != Opcode.CONST)
|
||||
continue
|
||||
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
val value = getInstruction<WideLiteralInstruction>(index).wideLiteral.toInt()
|
||||
@ -89,6 +92,10 @@ class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
Opcode.CONST_16 -> """
|
||||
const/16 v$register, $value
|
||||
|
||||
""".trimIndent()
|
||||
Opcode.CONST_4 -> """
|
||||
const/4 v$register, $value
|
||||
|
||||
""".trimIndent()
|
||||
Opcode.CONST -> """
|
||||
const v$register, $value
|
||||
|
@ -41,6 +41,9 @@ class ShortsSubscriptionsButtonPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return ShortsSubscriptionsFingerprint.toErrorResult()
|
||||
|
||||
/**
|
||||
* Deprecated in YouTube v18.31.xx+
|
||||
*/
|
||||
ShortsSubscriptionsTabletParentFingerprint.result?.let { parentResult ->
|
||||
parentResult.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(ReelPlayerFooter) - 1
|
||||
|
@ -13,7 +13,8 @@ import app.revanced.patcher.annotation.Package
|
||||
"18.24.37",
|
||||
"18.25.40",
|
||||
"18.27.36",
|
||||
"18.29.38"
|
||||
"18.29.38",
|
||||
"18.30.37"
|
||||
)
|
||||
)]
|
||||
)
|
||||
|
@ -12,6 +12,7 @@ object TextComponentAtomicReferenceFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.MOVE_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.MOVE_OBJECT
|
||||
)
|
||||
|
@ -0,0 +1,18 @@
|
||||
package app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object TextComponentAtomicReferenceLegacyFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.MOVE_OBJECT
|
||||
)
|
||||
)
|
@ -8,6 +8,7 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
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.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@ -20,6 +21,7 @@ import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerpri
|
||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.LikeFingerprint
|
||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.RemoveLikeFingerprint
|
||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentAtomicReferenceFingerprint
|
||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerprints.TextComponentAtomicReferenceLegacyFingerprint
|
||||
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.TextComponentTmpFingerprint
|
||||
@ -101,12 +103,34 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
} ?: return TextComponentTmpFingerprint.toErrorResult()
|
||||
|
||||
|
||||
val textComponentAtomicReferenceResult =
|
||||
TextComponentAtomicReferenceFingerprint.also {
|
||||
it.resolve(context, parentResult.classDef)
|
||||
}.result
|
||||
?:TextComponentAtomicReferenceLegacyFingerprint.also {
|
||||
it.resolve(context, parentResult.classDef)
|
||||
}.result
|
||||
?: return TextComponentAtomicReferenceLegacyFingerprint.toErrorResult()
|
||||
|
||||
TextComponentAtomicReferenceFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
it.resolve(context, parentResult.classDef)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val originalRegisterA = getInstruction<TwoRegisterInstruction>(startIndex + 2).registerA
|
||||
|
||||
replaceInstruction(
|
||||
startIndex + 2,
|
||||
"move-object v$originalRegisterA, v$tmpRegister"
|
||||
)
|
||||
replaceInstruction(
|
||||
startIndex + 1,
|
||||
"move-result-object v$tmpRegister"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
textComponentAtomicReferenceResult.let {
|
||||
it.mutableMethod.apply {
|
||||
val atomicReferenceStartIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@ -130,7 +154,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
)
|
||||
removeInstruction(insertIndex)
|
||||
}
|
||||
} ?: return TextComponentAtomicReferenceFingerprint.toErrorResult()
|
||||
}
|
||||
} ?: return TextComponentConstructorFingerprint.toErrorResult()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user