Skip to content

Commit

Permalink
fix: breaking changes of the patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Apr 18, 2022
1 parent 50b7673 commit 1a49bbd
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 91 deletions.
98 changes: 52 additions & 46 deletions src/main/kotlin/app/revanced/patches/ad/HomeAdsPatch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
31 changes: 20 additions & 11 deletions src/main/kotlin/app/revanced/patches/ad/HomePromoPatch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
33 changes: 19 additions & 14 deletions src/main/kotlin/app/revanced/patches/ad/VideoAdsPatch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading

0 comments on commit 1a49bbd

Please sign in to comment.