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

View file

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

View file

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

View file

@ -12,7 +12,12 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
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(
PatchMetadata(

View file

@ -2,10 +2,7 @@ package app.revanced.patches.layout
import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.*
import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature
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.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(
PatchMetadata(

View file

@ -3,10 +3,7 @@ package app.revanced.patches.layout
import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.*
import app.revanced.patcher.signature.MethodMetadata
import app.revanced.patcher.signature.MethodSignature
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.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(
PatchMetadata(

View file

@ -13,7 +13,12 @@ import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
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(
PatchMetadata(
@ -98,7 +103,11 @@ class OldQualityLayoutPatch : Patch(
// if useOldStyleQualitySettings == true, jump over all instructions
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.addInstructions(
0,

View file

@ -3,10 +3,7 @@ package app.revanced.patches.misc
import app.revanced.patcher.PatcherData
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.Patch
import app.revanced.patcher.patch.PatchMetadata
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.*
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.signature.MethodMetadata
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.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(
PatchMetadata(

View file

@ -28,7 +28,11 @@ internal class SignatureChecker {
if (patternScanMethod is PatternScanMethod.Fuzzy) {
val warnings = patternScanMethod.warnings!!
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()}")
for (warning in warnings) {