fix: breaking changes of the patcher

This commit is contained in:
oSumAtrIX 2022-04-18 18:41:26 +02:00
parent 50b767314e
commit 1a49bbdbc4
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
10 changed files with 140 additions and 91 deletions

View file

@ -3,10 +3,7 @@ package app.revanced.patches.ad
import app.revanced.extensions.injectHideCall import app.revanced.extensions.injectHideCall
import app.revanced.patcher.PatcherData import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.signature.MethodMetadata import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.signature.MethodSignature
import app.revanced.patcher.signature.MethodSignatureMetadata import app.revanced.patcher.signature.MethodSignatureMetadata
@ -16,17 +13,26 @@ import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.formats.Instruction11x
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
private val compatiblePackages = listOf("com.google.android.youtube")
private val packageMetadata = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.03.38")
),
)
class HomeAdsPatch : Patch( private val patchMetadata = PatchMetadata(
PatchMetadata(
"home-ads", "home-ads",
"Home Ads Patch", "Home Ads Patch",
"Patch to remove ads in YouTube", "Patch to remove ads in YouTube",
compatiblePackages, packageMetadata,
"0.0.1" "0.0.1"
), )
private val signatureDescription = "Required signature for ${patchMetadata.name}. Discovered in version 17.03.38."
class HomeAdsPatch : Patch(
patchMetadata,
listOf( listOf(
MethodSignature( MethodSignature(
MethodSignatureMetadata( MethodSignatureMetadata(
@ -36,8 +42,8 @@ class HomeAdsPatch : Patch(
"k", "k",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"Z", "Z",
@ -86,8 +92,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -158,8 +164,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -229,8 +235,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -279,8 +285,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -332,8 +338,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -401,8 +407,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -460,8 +466,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -524,8 +530,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -586,8 +592,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -669,8 +675,8 @@ class HomeAdsPatch : Patch(
"lG", "lG",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -729,8 +735,8 @@ class HomeAdsPatch : Patch(
"b", "b",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -797,8 +803,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -832,8 +838,8 @@ class HomeAdsPatch : Patch(
"b", "b",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -896,8 +902,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -1042,8 +1048,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -1177,8 +1183,8 @@ class HomeAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",

View file

@ -14,16 +14,25 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.formats.Instruction11x
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.03.38", "17.14.35")
)
)
class HomePromoPatch : Patch( private val patchMetadata = PatchMetadata(
PatchMetadata(
"home-promo-ads", "home-promo-ads",
"Home Promo Ads Patch", "Home Promo Ads Patch",
"Patch to remove promoted ads in YouTube", "Patch to remove promoted ads in YouTube",
compatiblePackages, compatiblePackages,
"0.0.1" "0.0.1"
), )
private val signatureDescription = "Required signature for ${patchMetadata.name}. Discovered in version 17.03.38."
class HomePromoPatch : Patch(
patchMetadata,
listOf( listOf(
MethodSignature( MethodSignature(
MethodSignatureMetadata( MethodSignatureMetadata(
@ -34,7 +43,7 @@ class HomePromoPatch : Patch(
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, compatiblePackages,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -85,7 +94,7 @@ class HomePromoPatch : Patch(
), ),
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, compatiblePackages,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -140,7 +149,7 @@ class HomePromoPatch : Patch(
methodMetadata, methodMetadata,
PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2), // FIXME: Test this threshold and find the best value.
compatiblePackages, compatiblePackages,
"Found in YouTube version v17.03.38", signatureDescription,
"0.0.1" "0.0.1"
), ),
"V", "V",

View file

@ -12,16 +12,23 @@ import app.revanced.patcher.smali.toInstructions
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube") private val packageMetadata = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.14.35")
)
)
class VideoAdsPatch : Patch( private val patchMetadata = PatchMetadata(
PatchMetadata(
"video-ads", "video-ads",
"YouTube Video Ads Patch", "YouTube Video Ads Patch",
"Patch to remove ads in the YouTube video player.", "Patch to remove ads in the YouTube video player.",
compatiblePackages, packageMetadata,
"0.0.1" "0.0.1"
), )
class VideoAdsPatch : Patch(
patchMetadata,
listOf( listOf(
MethodSignature( MethodSignature(
MethodSignatureMetadata( MethodSignatureMetadata(
@ -31,10 +38,8 @@ class VideoAdsPatch : Patch(
"<init>", "<init>",
), ),
PatternScanMethod.Fuzzy(2),// FIXME: Test this threshold and find the best value. PatternScanMethod.Fuzzy(2),// FIXME: Test this threshold and find the best value.
compatiblePackages, packageMetadata,
"""Signature for the constructor of some class. "Required signature for ${patchMetadata.name}. Discovered in version 17.14.35.",
This signature is being used to find another method in the parent class
and was discovered in the YouTube version v17.03.38""".trimIndent(),
"0.0.1" "0.0.1"
), ),
"V", "V",
@ -72,8 +77,8 @@ class VideoAdsPatch : Patch(
null // unknown null // unknown
), ),
PatternScanMethod.Direct(), PatternScanMethod.Direct(),
compatiblePackages, packageMetadata,
"Signature to find the method, which is responsible for showing the video ads", "Signature to find the method, which is responsible for showing the video ads. Discovered in version 17.14.35",
"0.0.1" "0.0.1"
), ),
"V", "V",

View file

@ -16,7 +16,12 @@ import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.formats.Instruction11n import org.jf.dexlib2.iface.instruction.formats.Instruction11n
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.14.35")
)
)
class EnableSeekbarTappingPatch : Patch( class EnableSeekbarTappingPatch : Patch(
PatchMetadata( PatchMetadata(

View file

@ -12,7 +12,12 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.14.35")
)
)
class CreateButtonRemoverPatch : Patch( class CreateButtonRemoverPatch : Patch(
PatchMetadata( PatchMetadata(

View file

@ -2,10 +2,7 @@ package app.revanced.patches.layout
import app.revanced.patcher.PatcherData import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.signature.MethodMetadata import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.signature.MethodSignature
import app.revanced.patcher.signature.MethodSignatureMetadata import app.revanced.patcher.signature.MethodSignatureMetadata
@ -14,7 +11,12 @@ import app.revanced.patcher.smali.toInstruction
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.14.35")
)
)
class HideReelsPatch : Patch( class HideReelsPatch : Patch(
PatchMetadata( PatchMetadata(

View file

@ -3,10 +3,7 @@ package app.revanced.patches.layout
import app.revanced.patcher.PatcherData import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.signature.MethodMetadata import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.signature.MethodSignature
import app.revanced.patcher.signature.MethodSignatureMetadata import app.revanced.patcher.signature.MethodSignatureMetadata
@ -15,7 +12,12 @@ import app.revanced.patcher.smali.toInstructions
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.14.35")
)
)
class MinimizedPlaybackPatch : Patch( class MinimizedPlaybackPatch : Patch(
PatchMetadata( PatchMetadata(

View file

@ -13,7 +13,12 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.14.35")
)
)
class OldQualityLayoutPatch : Patch( class OldQualityLayoutPatch : Patch(
PatchMetadata( PatchMetadata(
@ -98,7 +103,11 @@ class OldQualityLayoutPatch : Patch(
// if useOldStyleQualitySettings == true, jump over all instructions // if useOldStyleQualitySettings == true, jump over all instructions
val jmpInstruction = val jmpInstruction =
BuilderInstruction21t(Opcode.IF_NEZ, 0, implementation.instructions[result.scanData.endIndex].location.labels.first()) BuilderInstruction21t(
Opcode.IF_NEZ,
0,
implementation.instructions[result.scanData.endIndex].location.labels.first()
)
implementation.addInstruction(5, jmpInstruction) implementation.addInstruction(5, jmpInstruction)
implementation.addInstructions( implementation.addInstructions(
0, 0,

View file

@ -3,10 +3,7 @@ package app.revanced.patches.misc
import app.revanced.patcher.PatcherData import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.signature.MethodMetadata import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.signature.MethodSignature
@ -18,7 +15,12 @@ import org.jf.dexlib2.Opcode
import org.jf.dexlib2.immutable.ImmutableMethod import org.jf.dexlib2.immutable.ImmutableMethod
import org.jf.dexlib2.immutable.ImmutableMethodImplementation import org.jf.dexlib2.immutable.ImmutableMethodImplementation
private val compatiblePackages = listOf("com.google.android.youtube") private val compatiblePackages = listOf(
PackageMetadata(
"com.google.android.youtube",
listOf("17.03.38", "17.14.35")
)
)
class IntegrationsPatch : Patch( class IntegrationsPatch : Patch(
PatchMetadata( PatchMetadata(

View file

@ -28,7 +28,11 @@ internal class SignatureChecker {
if (patternScanMethod is PatternScanMethod.Fuzzy) { if (patternScanMethod is PatternScanMethod.Fuzzy) {
val warnings = patternScanMethod.warnings!! val warnings = patternScanMethod.warnings!!
val method = signature.result!!.method val method = signature.result!!.method
val methodFromMetadata = if (signature.metadata.methodMetadata != null) signature.metadata.methodMetadata!! else MethodMetadata(null, null) val methodFromMetadata =
if (signature.metadata.methodMetadata != null) signature.metadata.methodMetadata!! else MethodMetadata(
null,
null
)
println("Signature: ${signature.metadata.name}.\nMethod: ${methodFromMetadata.definingClass}->${methodFromMetadata.name} (Signature matches: ${method.definingClass}->${method.toStr()})\nWarnings: ${warnings.count()}") println("Signature: ${signature.metadata.name}.\nMethod: ${methodFromMetadata.definingClass}->${methodFromMetadata.name} (Signature matches: ${method.definingClass}->${method.toStr()})\nWarnings: ${warnings.count()}")
for (warning in warnings) { for (warning in warnings) {