mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-08 10:34:33 +02:00
drop support for old YouTube versions
This commit is contained in:
parent
bd1428fc34
commit
b086822adb
@ -6,17 +6,10 @@ import app.revanced.patcher.annotation.Package
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf(
|
||||
"18.06.41",
|
||||
"18.07.35",
|
||||
"18.08.39",
|
||||
"18.09.39",
|
||||
"18.10.37",
|
||||
"18.11.36",
|
||||
"18.12.35",
|
||||
"18.13.38",
|
||||
"18.14.41",
|
||||
"18.15.40",
|
||||
"18.16.37",
|
||||
"18.16.39"
|
||||
)
|
||||
)]
|
||||
|
@ -47,26 +47,15 @@ class ButtonContainerPatch : ResourcePatch {
|
||||
"""
|
||||
|
||||
with(LithoFilterPatch.lithoMethod) {
|
||||
if (LithoFilterPatch.bufferFingerprintResolved) {
|
||||
// 18.11.36+
|
||||
addInstructions(
|
||||
0, """
|
||||
addInstructions(
|
||||
0, """
|
||||
move-object/from16 v10, p3
|
||||
iget-object v10, v10, ${LithoFilterPatch.objectReference.definingClass}->${LithoFilterPatch.objectReference.name}:${LithoFilterPatch.objectReference.type}
|
||||
if-eqz v10, :do_not_block
|
||||
check-cast v10, ${LithoFilterPatch.bufferReference}
|
||||
iget-object v10, v10, ${LithoFilterPatch.bufferReference}->b:Ljava/nio/ByteBuffer;
|
||||
""" + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
|
||||
)
|
||||
} else {
|
||||
val secondParameter = LithoFilterPatch.lithoMethod.parameters[2]
|
||||
LithoFilterPatch.lithoMethod.addInstructions(
|
||||
0, """
|
||||
move-object/from16 v10, p3
|
||||
iget-object v10, v10, $secondParameter->b:Ljava/nio/ByteBuffer;
|
||||
""" + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -47,26 +47,15 @@ class QuickActionsPatch : ResourcePatch {
|
||||
"""
|
||||
|
||||
with(LithoFilterPatch.lithoMethod) {
|
||||
if (LithoFilterPatch.bufferFingerprintResolved) {
|
||||
// 18.11.36+
|
||||
addInstructions(
|
||||
0, """
|
||||
addInstructions(
|
||||
0, """
|
||||
move-object/from16 v10, p3
|
||||
iget-object v10, v10, ${LithoFilterPatch.objectReference.definingClass}->${LithoFilterPatch.objectReference.name}:${LithoFilterPatch.objectReference.type}
|
||||
if-eqz v10, :do_not_block
|
||||
check-cast v10, ${LithoFilterPatch.bufferReference}
|
||||
iget-object v10, v10, ${LithoFilterPatch.bufferReference}->b:Ljava/nio/ByteBuffer;
|
||||
""" + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
|
||||
)
|
||||
} else {
|
||||
val secondParameter = LithoFilterPatch.lithoMethod.parameters[2]
|
||||
LithoFilterPatch.lithoMethod.addInstructions(
|
||||
0, """
|
||||
move-object/from16 v10, p3
|
||||
iget-object v10, v10, $secondParameter->b:Ljava/nio/ByteBuffer;
|
||||
""" + instructionList,listOf(ExternalLabel("do_not_block", LithoFilterPatch.lithoMethod.instruction(0)))
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -47,14 +47,9 @@ class LithoFilterPatch : BytecodePatch(
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
try {
|
||||
with (LithoBufferFingerprint.result!!) {
|
||||
val startIndex = this.scanResult.patternScanResult!!.startIndex
|
||||
bufferReference = (this.mutableMethod.instruction(startIndex) as BuilderInstruction21c).reference.toString()
|
||||
}
|
||||
bufferFingerprintResolved = true
|
||||
} catch (_: Exception) {
|
||||
bufferFingerprintResolved = false
|
||||
with (LithoBufferFingerprint.result!!) {
|
||||
val startIndex = this.scanResult.patternScanResult!!.startIndex
|
||||
bufferReference = (this.mutableMethod.instruction(startIndex) as BuilderInstruction21c).reference.toString()
|
||||
}
|
||||
|
||||
LithoObjectFingerprint.result?.let {
|
||||
@ -67,14 +62,12 @@ class LithoFilterPatch : BytecodePatch(
|
||||
lithoMethod = result.mutableMethod
|
||||
|
||||
with (lithoMethod.implementation!!.instructions) {
|
||||
// 18.06.41+
|
||||
val bufferIndex = indexOfFirst {
|
||||
it.opcode == Opcode.CONST &&
|
||||
(it as Instruction31i).narrowLiteral == 168777401
|
||||
}
|
||||
val bufferRegister = (lithoMethod.instruction(bufferIndex) as Instruction31i).registerA
|
||||
|
||||
// 18.06.41+
|
||||
val targetIndex = indexOfFirst {
|
||||
it.opcode == Opcode.CONST_STRING &&
|
||||
(it as BuilderInstruction21c).reference.toString() == "Element missing type extension"
|
||||
@ -103,33 +96,21 @@ class LithoFilterPatch : BytecodePatch(
|
||||
return-object v0
|
||||
"""
|
||||
|
||||
if (bufferFingerprintResolved) {
|
||||
// 18.11.36+
|
||||
val objectIndex = indexOfFirst {
|
||||
it.opcode == Opcode.CONST_STRING &&
|
||||
(it as BuilderInstruction21c).reference.toString() == ""
|
||||
} - 2
|
||||
objectReference = (elementAt(objectIndex) as ReferenceInstruction).reference as FieldReference
|
||||
lithoMethod.addInstructions(
|
||||
insertIndex + 1,
|
||||
"""
|
||||
val objectIndex = indexOfFirst {
|
||||
it.opcode == Opcode.CONST_STRING &&
|
||||
(it as BuilderInstruction21c).reference.toString() == ""
|
||||
} - 2
|
||||
objectReference = (elementAt(objectIndex) as ReferenceInstruction).reference as FieldReference
|
||||
lithoMethod.addInstructions(
|
||||
insertIndex + 1,
|
||||
"""
|
||||
move-object/from16 v$bufferRegister, p3
|
||||
iget-object v$bufferRegister, v$bufferRegister, ${objectReference.definingClass}->${objectReference.name}:${objectReference.type}
|
||||
if-eqz v$bufferRegister, :not_an_ad
|
||||
check-cast v$bufferRegister, $bufferReference
|
||||
iget-object v$bufferRegister, v$bufferRegister, $bufferReference->b:Ljava/nio/ByteBuffer;
|
||||
""" + instructionList,listOf(ExternalLabel("not_an_ad", lithoMethod.instruction(insertIndex + 1)))
|
||||
)
|
||||
} else {
|
||||
val secondParameter = lithoMethod.parameters[2]
|
||||
lithoMethod.addInstructions(
|
||||
insertIndex + 1,
|
||||
"""
|
||||
move-object/from16 v$bufferRegister, p3
|
||||
iget-object v$bufferRegister, v$bufferRegister, $secondParameter->b:Ljava/nio/ByteBuffer;
|
||||
""" + instructionList,listOf(ExternalLabel("not_an_ad", lithoMethod.instruction(insertIndex + 1)))
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: return LithoFingerprint.toErrorResult()
|
||||
@ -140,7 +121,6 @@ class LithoFilterPatch : BytecodePatch(
|
||||
}
|
||||
internal companion object {
|
||||
var objectRegister by Delegates.notNull<Int>()
|
||||
var bufferFingerprintResolved by Delegates.notNull<Boolean>()
|
||||
|
||||
lateinit var lithoMethod: MutableMethod
|
||||
lateinit var bufferReference: String
|
||||
|
Loading…
x
Reference in New Issue
Block a user