chore: migrate to new changes from the patcher

This commit is contained in:
oSumAtrIX 2022-10-05 04:03:10 +02:00
parent 06e1b44ba2
commit 2471f0363d
212 changed files with 513 additions and 1021 deletions

View file

@ -20,7 +20,7 @@ repositories {
} }
dependencies { dependencies {
implementation("app.revanced:revanced-patcher:5.1.2") implementation("app.revanced:revanced-patcher:6.0.0")
implementation("app.revanced:multidexlib2:2.5.2.r2") implementation("app.revanced:multidexlib2:2.5.2.r2")
// Required for meta // Required for meta
implementation("com.google.code.gson:gson:2.9.1") implementation("com.google.code.gson:gson:2.9.1")

View file

@ -1,7 +1,7 @@
package app.revanced.extensions package app.revanced.extensions
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
@ -35,9 +35,9 @@ internal fun MutableMethodImplementation.injectHideCall(
* @param targetClass the class to start traversing the class hierarchy from * @param targetClass the class to start traversing the class hierarchy from
* @param callback function that is called for every class in the hierarchy * @param callback function that is called for every class in the hierarchy
*/ */
fun BytecodeData.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) { fun BytecodeContext.traverseClassHierarchy(targetClass: MutableClass, callback: MutableClass.() -> Unit) {
callback(targetClass) callback(targetClass)
this.findClass(targetClass.superclass ?: return)?.resolve()?.let { this.findClass(targetClass.superclass ?: return)?.mutableClass?.let {
traverseClassHierarchy(it, callback) traverseClassHierarchy(it, callback)
} }
} }
@ -135,7 +135,7 @@ internal fun MutableMethod.injectConsumableEventHook(hookRef: ImmutableMethodRef
* @param resourceType the resource type, for example 'drawable'. this has to match both the source and the target * @param resourceType the resource type, for example 'drawable'. this has to match both the source and the target
* @param resourceFileNames names of all resources of this type to inject * @param resourceFileNames names of all resources of this type to inject
*/ */
fun ResourceData.injectResources( fun ResourceContext.injectResources(
classLoader: ClassLoader, classLoader: ClassLoader,
patchDirectoryPath: String, patchDirectoryPath: String,
resourceType: String, resourceType: String,
@ -160,7 +160,7 @@ fun ResourceData.injectResources(
* @param patchDirectoryPath path to the files. this will be the directory you created under the 'resources' source folder * @param patchDirectoryPath path to the files. this will be the directory you created under the 'resources' source folder
* @param languageIdentifier ISO 639-2 two- letter language code identifier (aka the one android uses for values directory) * @param languageIdentifier ISO 639-2 two- letter language code identifier (aka the one android uses for values directory)
*/ */
fun ResourceData.injectStrings( fun ResourceContext.injectStrings(
classLoader: ClassLoader, classLoader: ClassLoader,
patchDirectoryPath: String, patchDirectoryPath: String,
languageIdentifier: String? = null, languageIdentifier: String? = null,

View file

@ -2,12 +2,12 @@ package app.revanced.meta
import app.revanced.meta.json.generateJson import app.revanced.meta.json.generateJson
import app.revanced.meta.readme.generateText import app.revanced.meta.readme.generateText
import app.revanced.patcher.data.Data import app.revanced.patcher.data.Context
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.Patch
import app.revanced.patcher.util.patch.impl.JarPatchBundle import app.revanced.patcher.util.patch.PatchBundle
import java.io.File import java.io.File
typealias Bundle = List<Class<out Patch<Data>>> typealias Bundle = List<Class<out Patch<Context>>>
object Meta { object Meta {
@JvmStatic @JvmStatic
@ -20,7 +20,7 @@ object Meta {
} }
} }
fun accumulatePatches() = JarPatchBundle( fun accumulatePatches() = PatchBundle.Jar(
File("build/libs/").listFiles()!!.first { File("build/libs/").listFiles()!!.first {
it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar") it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar")
}.absolutePath }.absolutePath

View file

@ -1,10 +1,10 @@
package app.revanced.meta.readme package app.revanced.meta.readme
import app.revanced.patcher.data.Data import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.Patch
internal fun Class<out Patch<Data>>.getLatestVersion() = internal fun Class<out Patch<Context>>.getLatestVersion() =
this.compatiblePackages?.first()?.versions?.map { this.compatiblePackages?.first()?.versions?.map {
SemanticVersion.fromString(it) SemanticVersion.fromString(it)
}?.maxWithOrNull(SemanticVersionComparator) }?.maxWithOrNull(SemanticVersionComparator)

View file

@ -1,7 +1,7 @@
package app.revanced.meta.readme package app.revanced.meta.readme
import app.revanced.meta.Bundle import app.revanced.meta.Bundle
import app.revanced.patcher.data.Data import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.description import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.patchName import app.revanced.patcher.extensions.PatchExtensions.patchName
@ -15,7 +15,7 @@ private val TABLE_REGEX = Regex("\\{\\{\\s?table\\s?}}")
fun generateText(bundle: Bundle) { fun generateText(bundle: Bundle) {
val output = StringBuilder() val output = StringBuilder()
val packages = mutableMapOf<String, MutableList<Class<out Patch<Data>>>>() val packages = mutableMapOf<String, MutableList<Class<out Patch<Context>>>>()
for (patch in bundle) { for (patch in bundle) {
patch.compatiblePackages?.forEach { pkg -> patch.compatiblePackages?.forEach { pkg ->

View file

@ -3,18 +3,13 @@ package app.revanced.patches.music.ad.video.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("show-video-ads-constructor-fingerprint") @Name("show-video-ads-constructor-fingerprint")
@MatchingMethod(
"Laghd;",
"<init>",
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MusicVideoAdsCompatibility @MusicVideoAdsCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -4,16 +4,12 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("show-video-ads-method-fingerprint") @Name("show-video-ads-method-fingerprint")
@MatchingMethod(
"Laghd;", "d"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MusicVideoAdsCompatibility @MusicVideoAdsCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,13 +3,13 @@ package app.revanced.patches.music.ad.video.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility import app.revanced.patches.music.ad.video.annotations.MusicVideoAdsCompatibility
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint
@ -24,8 +24,8 @@ class MusicVideoAdsPatch : BytecodePatch(
ShowMusicVideoAdsConstructorFingerprint ShowMusicVideoAdsConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
ShowMusicVideoAdsFingerprint.resolve(data, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef) ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef)
val result = ShowMusicVideoAdsFingerprint.result!! val result = ShowMusicVideoAdsFingerprint.result!!

View file

@ -3,18 +3,13 @@ package app.revanced.patches.music.audio.codecs.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher. fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("all-codecs-reference-fingerprint") @Name("all-codecs-reference-fingerprint")
@MatchingMethod(
"Laari;",
"b",
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@CodecsUnlockCompatibility @CodecsUnlockCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -4,17 +4,12 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("codec-lock-fingerprint") @Name("codec-lock-fingerprint")
@MatchingMethod(
"Lacfr;",
"a",
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@CodecsUnlockCompatibility @CodecsUnlockCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,12 +3,12 @@ package app.revanced.patches.music.audio.codecs.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.impl.toMethodWalker import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.toInstruction import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility import app.revanced.patches.music.audio.codecs.annotations.CodecsUnlockCompatibility
import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint
@ -25,7 +25,7 @@ class CodecsUnlockPatch : BytecodePatch(
CodecsLockFingerprint, AllCodecsReferenceFingerprint CodecsLockFingerprint, AllCodecsReferenceFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val codecsLockResult = CodecsLockFingerprint.result!! val codecsLockResult = CodecsLockFingerprint.result!!
val implementation = codecsLockResult.mutableMethod.implementation!! val implementation = codecsLockResult.mutableMethod.implementation!!
@ -42,7 +42,7 @@ class CodecsUnlockPatch : BytecodePatch(
val allCodecsResult = AllCodecsReferenceFingerprint.result!! val allCodecsResult = AllCodecsReferenceFingerprint.result!!
val allCodecsMethod = val allCodecsMethod =
data.toMethodWalker(allCodecsResult.method) context.toMethodWalker(allCodecsResult.method)
.nextMethod(allCodecsResult.scanResult.patternScanResult!!.startIndex) .nextMethod(allCodecsResult.scanResult.patternScanResult!!.startIndex)
.getMethod() .getMethod()

View file

@ -3,19 +3,14 @@ package app.revanced.patches.music.audio.exclusiveaudio.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("audio-only-enabler-fingerprint") @Name("audio-only-enabler-fingerprint")
@MatchingMethod(
"Lgmd;",
"d"
)
@DirectPatternScanMethod
@ExclusiveAudioCompatibility @ExclusiveAudioCompatibility
@Version( @Version(
"0.0.1" "0.0.1"

View file

@ -3,17 +3,13 @@ package app.revanced.patches.music.audio.exclusiveaudio.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("exclusive-audio-fingerprints") @Name("exclusive-audio-fingerprints")
@MatchingMethod(
"Lgmd;", "c"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@ExclusiveAudioCompatibility @ExclusiveAudioCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,13 +3,13 @@ package app.revanced.patches.music.audio.exclusiveaudio.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
@ -23,7 +23,7 @@ class ExclusiveAudioPatch : BytecodePatch(
AudioOnlyEnablerFingerprint AudioOnlyEnablerFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1") method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
method.addInstruction("return v0") method.addInstruction("return v0")

View file

@ -4,15 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("compact-header-constructor-fingerprint") @Name("compact-header-constructor-fingerprint")
@MatchingMethod(
"Llcz;", "<init>"
)
@CompactHeaderCompatibility @CompactHeaderCompatibility
@Version("0.0.1") @Version("0.0.1")
object CompactHeaderConstructorFingerprint : MethodFingerprint( object CompactHeaderConstructorFingerprint : MethodFingerprint(

View file

@ -3,12 +3,12 @@ package app.revanced.patches.music.layout.compactheader.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility import app.revanced.patches.music.layout.compactheader.annotations.CompactHeaderCompatibility
import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint
import org.jf.dexlib2.builder.instruction.BuilderInstruction11x import org.jf.dexlib2.builder.instruction.BuilderInstruction11x
@ -23,7 +23,7 @@ class CompactHeaderPatch : BytecodePatch(
CompactHeaderConstructorFingerprint CompactHeaderConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val result = CompactHeaderConstructorFingerprint.result!! val result = CompactHeaderConstructorFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod

View file

@ -4,15 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import app.revanced.patches.music.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("minimized-playback-manager-fingerprint") @Name("minimized-playback-manager-fingerprint")
@MatchingMethod(
"Llxw;", "c"
)
@MinimizedPlaybackCompatibility @MinimizedPlaybackCompatibility
@Version("0.0.1") @Version("0.0.1")
object MinimizedPlaybackManagerFingerprint : MethodFingerprint( object MinimizedPlaybackManagerFingerprint : MethodFingerprint(

View file

@ -3,18 +3,14 @@ package app.revanced.patches.music.layout.minimizedplayback.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.impl.toMethodWalker
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility import app.revanced.patches.music.layout.minimizedplayback.annotations.MinimizedPlaybackCompatibility
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.MethodReference
@Patch @Patch
@Name("minimized-playback-music") @Name("minimized-playback-music")
@ -26,7 +22,7 @@ class MinimizedPlaybackPatch : BytecodePatch(
MinimizedPlaybackManagerFingerprint MinimizedPlaybackManagerFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstructions( MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstructions(
0, """ 0, """
return-void return-void

View file

@ -4,15 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("hide-get-premium-fingerprint") @Name("hide-get-premium-fingerprint")
@MatchingMethod(
"Lktn;", "k"
)
@HideGetPremiumCompatibility @HideGetPremiumCompatibility
@Version("0.0.1") @Version("0.0.1")
object HideGetPremiumFingerprint : MethodFingerprint( object HideGetPremiumFingerprint : MethodFingerprint(

View file

@ -4,15 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("hide-get-premium-parent-fingerprint") @Name("hide-get-premium-parent-fingerprint")
@MatchingMethod(
"Lktn;", "k"
)
@HideGetPremiumCompatibility @HideGetPremiumCompatibility
@Version("0.0.1") @Version("0.0.1")
object HideGetPremiumParentFingerprint : MethodFingerprint( object HideGetPremiumParentFingerprint : MethodFingerprint(

View file

@ -3,14 +3,14 @@ package app.revanced.patches.music.layout.premium.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility import app.revanced.patches.music.layout.premium.annotations.HideGetPremiumCompatibility
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumParentFingerprint import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumParentFingerprint
@ -25,9 +25,9 @@ class HideGetPremiumPatch : BytecodePatch(
HideGetPremiumParentFingerprint HideGetPremiumParentFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val parentResult = HideGetPremiumParentFingerprint.result!! val parentResult = HideGetPremiumParentFingerprint.result!!
HideGetPremiumFingerprint.resolve(data, parentResult.classDef) HideGetPremiumFingerprint.resolve(context, parentResult.classDef)
val startIndex = parentResult.scanResult.patternScanResult!!.startIndex val startIndex = parentResult.scanResult.patternScanResult!!.startIndex

View file

@ -3,17 +3,13 @@ package app.revanced.patches.music.layout.tastebuilder.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("taste-builder-constructor-fingerprint") @Name("taste-builder-constructor-fingerprint")
@MatchingMethod(
"Lkyu;", "<init>"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@RemoveTasteBuilderCompatibility @RemoveTasteBuilderCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,12 +3,12 @@ package app.revanced.patches.music.layout.tastebuilder.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility import app.revanced.patches.music.layout.tastebuilder.annotations.RemoveTasteBuilderCompatibility
import app.revanced.patches.music.layout.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint import app.revanced.patches.music.layout.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction22c
@ -23,7 +23,7 @@ class RemoveTasteBuilderPatch : BytecodePatch(
TasteBuilderConstructorFingerprint TasteBuilderConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val result = TasteBuilderConstructorFingerprint.result!! val result = TasteBuilderConstructorFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod

View file

@ -3,17 +3,13 @@ package app.revanced.patches.music.layout.upgradebutton.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("pivot-bar-constructor-fingerprint") @Name("pivot-bar-constructor-fingerprint")
@MatchingMethod(
"Lhfu;", "<init2>"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@RemoveUpgradeButtonCompatibility @RemoveUpgradeButtonCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,12 +3,12 @@ package app.revanced.patches.music.layout.upgradebutton.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility import app.revanced.patches.music.layout.upgradebutton.annotations.RemoveUpgradeButtonCompatibility
import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
@ -28,7 +28,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
PivotBarConstructorFingerprint PivotBarConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val result = PivotBarConstructorFingerprint.result!! val result = PivotBarConstructorFingerprint.result!!
val implementation = result.mutableMethod.implementation!! val implementation = result.mutableMethod.implementation!!

View file

@ -2,16 +2,12 @@ package app.revanced.patches.music.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-context-fetch-fingerprint") @Name("cast-context-fetch-fingerprint")
@MatchingMethod(
"Lvvz;", "a"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility @MicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object CastContextFetchFingerprint : MethodFingerprint( object CastContextFetchFingerprint : MethodFingerprint(

View file

@ -2,16 +2,12 @@ package app.revanced.patches.music.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-module-fingerprint") @Name("cast-module-fingerprint")
@MatchingMethod(
"Llqh;", "c"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility @MicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object CastDynamiteModuleFingerprint : MethodFingerprint( object CastDynamiteModuleFingerprint : MethodFingerprint(

View file

@ -2,16 +2,12 @@ package app.revanced.patches.music.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
@Name("cast-context-fetch-fingerprint") @Name("cast-context-fetch-fingerprint")
@MatchingMethod(
"Lmcf;", "c"
)
@DirectPatternScanMethod
@MicroGPatchCompatibility @MicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object CastDynamiteModuleV2Fingerprint : MethodFingerprint( object CastDynamiteModuleV2Fingerprint : MethodFingerprint(

View file

@ -3,17 +3,13 @@ package app.revanced.patches.music.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("google-play-utility-fingerprint") @Name("google-play-utility-fingerprint")
@MatchingMethod(
"Lnuv;", "b"
)
@DirectPatternScanMethod
@MusicMicroGPatchCompatibility @MusicMicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object GooglePlayUtilityFingerprint : MethodFingerprint( object GooglePlayUtilityFingerprint : MethodFingerprint(

View file

@ -2,16 +2,12 @@ package app.revanced.patches.music.misc.microg.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
@Name("google-play-prime-fingerprint") @Name("google-play-prime-fingerprint")
@MatchingMethod(
"Lrwi;", "a"
)
@DirectPatternScanMethod
@MusicMicroGPatchCompatibility @MusicMicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object PrimeFingerprint : MethodFingerprint( object PrimeFingerprint : MethodFingerprint(

View file

@ -4,15 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("google-play-service-checker-fingerprint") @Name("google-play-service-checker-fingerprint")
@MatchingMethod(
"Lnuv;", "d"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@MusicMicroGPatchCompatibility @MusicMicroGPatchCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,11 +3,11 @@ package app.revanced.patches.music.misc.microg.patch.bytecode
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
import app.revanced.patches.music.misc.microg.fingerprints.* import app.revanced.patches.music.misc.microg.fingerprints.*
import app.revanced.patches.music.misc.microg.patch.resource.MusicMicroGResourcePatch import app.revanced.patches.music.misc.microg.patch.resource.MusicMicroGResourcePatch
@ -39,10 +39,10 @@ class MusicMicroGBytecodePatch : BytecodePatch(
// - "com.google.android.gms.phenotype.PACKAGE_NAME", // - "com.google.android.gms.phenotype.PACKAGE_NAME",
// - "com.google.android.gms.phenotype.UPDATE", // - "com.google.android.gms.phenotype.UPDATE",
// - "com.google.android.gms.phenotype", // - "com.google.android.gms.phenotype",
override fun execute(data: BytecodeData) = override fun execute(context: BytecodeContext) =
// apply common microG patch // apply common microG patch
MicroGBytecodeHelper.patchBytecode( MicroGBytecodeHelper.patchBytecode(
data, context,
arrayOf( arrayOf(
MicroGBytecodeHelper.packageNameTransform( MicroGBytecodeHelper.packageNameTransform(
Constants.PACKAGE_NAME, Constants.PACKAGE_NAME,

View file

@ -3,10 +3,10 @@ package app.revanced.patches.music.misc.microg.patch.resource
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.impl.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility import app.revanced.patches.music.misc.microg.annotations.MusicMicroGPatchCompatibility
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME
@ -20,11 +20,11 @@ import app.revanced.util.microg.MicroGResourceHelper
@Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.") @Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.")
@MusicMicroGPatchCompatibility @MusicMicroGPatchCompatibility
@Version("0.0.2") @Version("0.0.2")
class MusicMicroGResourcePatch : ResourcePatch() { class MusicMicroGResourcePatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
// update manifest // update manifest
MicroGResourceHelper.patchManifest( MicroGResourceHelper.patchManifest(
data, context,
MUSIC_PACKAGE_NAME, MUSIC_PACKAGE_NAME,
REVANCED_MUSIC_PACKAGE_NAME, REVANCED_MUSIC_PACKAGE_NAME,
REVANCED_MUSIC_APP_NAME REVANCED_MUSIC_APP_NAME
@ -32,7 +32,7 @@ class MusicMicroGResourcePatch : ResourcePatch() {
// add metadata to the manifest // add metadata to the manifest
MicroGManifestHelper.addSpoofingMetadata( MicroGManifestHelper.addSpoofingMetadata(
data, context,
SPOOFED_PACKAGE_NAME, SPOOFED_PACKAGE_NAME,
SPOOFED_PACKAGE_SIGNATURE SPOOFED_PACKAGE_SIGNATURE
) )

View file

@ -3,17 +3,13 @@ package app.revanced.patches.music.premium.backgroundplay.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("background-playback-disabler-fingerprint") @Name("background-playback-disabler-fingerprint")
@MatchingMethod(
"Lafgf;", "e"
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@BackgroundPlayCompatibility @BackgroundPlayCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,12 +3,12 @@ package app.revanced.patches.music.premium.backgroundplay.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility import app.revanced.patches.music.premium.backgroundplay.annotations.BackgroundPlayCompatibility
import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
@ -22,7 +22,7 @@ class BackgroundPlayPatch : BytecodePatch(
BackgroundPlaybackDisableFingerprint BackgroundPlaybackDisableFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions( BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions(
0, 0,
""" """

View file

@ -3,12 +3,11 @@ package app.revanced.patches.reddit.ad.general.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.ad.general.annotations.GeneralAdsCompatibility import app.revanced.patches.reddit.ad.general.annotations.GeneralAdsCompatibility
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
@ -22,8 +21,8 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@GeneralAdsCompatibility @GeneralAdsCompatibility
@Version("0.0.1") @Version("0.0.1")
class GeneralAdsPatch : BytecodePatch() { class GeneralAdsPatch : BytecodePatch() {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
data.classes.forEach { classDef -> context.classes.forEach { classDef ->
classDef.methods.forEach methodLoop@{ method -> classDef.methods.forEach methodLoop@{ method ->
val implementation = method.implementation ?: return@methodLoop val implementation = method.implementation ?: return@methodLoop
@ -31,7 +30,7 @@ class GeneralAdsPatch : BytecodePatch() {
if (instruction.opcode != Opcode.CONST_STRING) return@forEachIndexed if (instruction.opcode != Opcode.CONST_STRING) return@forEachIndexed
if (((instruction as ReferenceInstruction).reference as StringReference).string != "AdPost") return@forEachIndexed if (((instruction as ReferenceInstruction).reference as StringReference).string != "AdPost") return@forEachIndexed
val proxiedClass = data.proxy(classDef).resolve() val proxiedClass = context.proxy(classDef).mutableClass
val proxiedImplementation = proxiedClass.methods.first { val proxiedImplementation = proxiedClass.methods.first {
it.name == method.name && it.parameterTypes.containsAll(method.parameterTypes) it.name == method.name && it.parameterTypes.containsAll(method.parameterTypes)

View file

@ -2,14 +2,10 @@ package app.revanced.patches.reddit.layout.premiumicon.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
@Name("premium-icon-fingerprint") @Name("premium-icon-fingerprint")
@MatchingMethod(
"Lcom/reddit/domain/model/MyAccount;", "isPremiumSubscriber"
)
@PremiumIconCompatibility @PremiumIconCompatibility
@Version("0.0.1") @Version("0.0.1")
object PremiumIconFingerprint : MethodFingerprint( object PremiumIconFingerprint : MethodFingerprint(

View file

@ -3,12 +3,12 @@ package app.revanced.patches.reddit.layout.premiumicon.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility import app.revanced.patches.reddit.layout.premiumicon.annotations.PremiumIconCompatibility
import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint
@ -22,7 +22,7 @@ class PremiumIconPatch : BytecodePatch(
PremiumIconFingerprint PremiumIconFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val method = PremiumIconFingerprint.result!!.mutableMethod val method = PremiumIconFingerprint.result!!.mutableMethod
method.addInstructions( method.addInstructions(
0, 0,

View file

@ -3,14 +3,14 @@ package app.revanced.patches.spotify.audio.bytecode.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.instruction import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint import app.revanced.patches.spotify.audio.fingerprints.DisableCaptureRestrictionAudioDriverFingerprint
@ -36,7 +36,7 @@ class DisableCaptureRestrictionBytecodePatch : BytecodePatch(
) )
} }
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod val method = DisableCaptureRestrictionAudioDriverFingerprint.result!!.mutableMethod
// Replace constant that contains the capture policy parameter for AudioAttributesBuilder.setAllowedCapturePolicy() // Replace constant that contains the capture policy parameter for AudioAttributesBuilder.setAllowedCapturePolicy()

View file

@ -2,16 +2,12 @@ package app.revanced.patches.spotify.audio.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
@Name("disable-capture-restriction-audio-driver-fingerprint") @Name("disable-capture-restriction-audio-driver-fingerprint")
@MatchingMethod(
"Lcom/spotify/playback/playbacknative/AudioDriver;", "constructAudioAttributes"
)
@DirectPatternScanMethod
@DisableCaptureRestrictionCompatibility @DisableCaptureRestrictionCompatibility
@Version("0.0.1") @Version("0.0.1")
object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint( object DisableCaptureRestrictionAudioDriverFingerprint : MethodFingerprint(

View file

@ -3,23 +3,21 @@ package app.revanced.patches.spotify.audio.resource.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility import app.revanced.patches.spotify.audio.annotation.DisableCaptureRestrictionCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import org.w3c.dom.Element import org.w3c.dom.Element
@Name("disable-capture-restriction-resource-patch") @Name("disable-capture-restriction-resource-patch")
@Description("Sets allowAudioPlaybackCapture in manifest to true.") @Description("Sets allowAudioPlaybackCapture in manifest to true.")
@DisableCaptureRestrictionCompatibility @DisableCaptureRestrictionCompatibility
@Version("0.0.1") @Version("0.0.1")
class DisableCaptureRestrictionResourcePatch : ResourcePatch() { class DisableCaptureRestrictionResourcePatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
// create an xml editor instance // create an xml editor instance
data.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->
// get the application node // get the application node
val applicationNode = dom val applicationNode = dom
.file .file

View file

@ -3,14 +3,10 @@ package app.revanced.patches.spotify.layout.theme.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.OptionsContainer import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchOption
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.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.spotify.layout.theme.annotations.ThemeCompatibility import app.revanced.patches.spotify.layout.theme.annotations.ThemeCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import org.w3c.dom.Element import org.w3c.dom.Element
@ -21,9 +17,9 @@ import org.w3c.dom.Element
@Description("Applies a custom theme.") @Description("Applies a custom theme.")
@ThemeCompatibility @ThemeCompatibility
@Version("0.0.1") @Version("0.0.1")
class ThemePatch : ResourcePatch() { class ThemePatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
data.xmlEditor["res/values/colors.xml"].use { editor -> context.xmlEditor["res/values/colors.xml"].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
for (i in 0 until resourcesNode.childNodes.length) { for (i in 0 until resourcesNode.childNodes.length) {

View file

@ -3,14 +3,14 @@ package app.revanced.patches.spotify.premium_navbar_tab.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.removeInstruction import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility
import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabFingerprint import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabFingerprint
import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabParentFingerprint import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabParentFingerprint
@ -29,9 +29,9 @@ class PremiumNavbarTabPatch : BytecodePatch(
AddPremiumNavbarTabParentFingerprint AddPremiumNavbarTabParentFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val parentResult = AddPremiumNavbarTabParentFingerprint.result!! val parentResult = AddPremiumNavbarTabParentFingerprint.result!!
AddPremiumNavbarTabFingerprint.resolve(data, parentResult.classDef) AddPremiumNavbarTabFingerprint.resolve(context, parentResult.classDef)
val result = AddPremiumNavbarTabFingerprint.result!! val result = AddPremiumNavbarTabFingerprint.result!!
@ -39,7 +39,8 @@ class PremiumNavbarTabPatch : BytecodePatch(
val methodInstructions = method.implementation!!.instructions val methodInstructions = method.implementation!!.instructions
val lastInstructionIdx = methodInstructions.size - 1 val lastInstructionIdx = methodInstructions.size - 1
val premiumTabId = ResourceMappingResourcePatch.resourceMappings.single{it.type == "id" && it.name == "premium_tab"}.id val premiumTabId =
ResourceMappingResourcePatch.resourceMappings.single { it.type == "id" && it.name == "premium_tab" }.id
var removeAmount = 2 var removeAmount = 2
// 2nd const remove method // 2nd const remove method

View file

@ -2,15 +2,10 @@ package app.revanced.patches.tiktok.ad.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
@Name("convert-help-v2-feeditemlist-fingerprint") @Name("convert-help-v2-feeditemlist-fingerprint")
@MatchingMethod(
"Lbeancopy/ConvertHelp;",
"com${'$'}ss${'$'}ugc${'$'}aweme${'$'}proto${'$'}aweme_v2_feed_response${'$'}${'$'}com${'$'}ss${'$'}android${'$'}ugc${'$'}aweme${'$'}feed${'$'}model${'$'}FeedItemList",
)
@TiktokAdsCompatibility @TiktokAdsCompatibility
@Version("0.0.1") @Version("0.0.1")
object ConvertHelpFeedItemListFingerprint : MethodFingerprint( object ConvertHelpFeedItemListFingerprint : MethodFingerprint(

View file

@ -2,15 +2,10 @@ package app.revanced.patches.tiktok.ad.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
@Name("feed-item-clone-fingerprint") @Name("feed-item-clone-fingerprint")
@MatchingMethod(
"Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;",
"clone",
)
@TiktokAdsCompatibility @TiktokAdsCompatibility
@Version("0.0.1") @Version("0.0.1")
object FeedItemListCloneFingerprint : MethodFingerprint( object FeedItemListCloneFingerprint : MethodFingerprint(

View file

@ -3,13 +3,13 @@ package app.revanced.patches.tiktok.ad.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
import app.revanced.patches.tiktok.ad.fingerprints.ConvertHelpFeedItemListFingerprint import app.revanced.patches.tiktok.ad.fingerprints.ConvertHelpFeedItemListFingerprint
import app.revanced.patches.tiktok.ad.fingerprints.FeedItemListCloneFingerprint import app.revanced.patches.tiktok.ad.fingerprints.FeedItemListCloneFingerprint
@ -29,7 +29,7 @@ class TiktokAdsPatch : BytecodePatch(
ConvertHelpFeedItemListFingerprint ConvertHelpFeedItemListFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
listOf( listOf(
FeedItemListCloneFingerprint, FeedItemListCloneFingerprint,
ConvertHelpFeedItemListFingerprint ConvertHelpFeedItemListFingerprint

View file

@ -3,16 +3,11 @@ package app.revanced.patches.tiktok.feedfilter.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.feedfilter.annotations.FeedFilterCompatibility import app.revanced.patches.tiktok.feedfilter.annotations.FeedFilterCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("feed-api-service-fingerprint") @Name("feed-api-service-fingerprint")
@MatchingMethod(
"Lcom/ss/android/ugc/aweme/feed/FeedApiService;",
"LIZ",
)
@FeedFilterCompatibility @FeedFilterCompatibility
@Version("0.0.1") @Version("0.0.1")
object FeedApiServiceLIZFingerprint : MethodFingerprint( object FeedApiServiceLIZFingerprint : MethodFingerprint(

View file

@ -3,13 +3,13 @@ package app.revanced.patches.tiktok.feedfilter.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.tiktok.feedfilter.annotations.FeedFilterCompatibility import app.revanced.patches.tiktok.feedfilter.annotations.FeedFilterCompatibility
import app.revanced.patches.tiktok.feedfilter.fingerprints.FeedApiServiceLIZFingerprint import app.revanced.patches.tiktok.feedfilter.fingerprints.FeedApiServiceLIZFingerprint
import app.revanced.patches.tiktok.misc.integrations.patch.TikTokIntegrationsPatch import app.revanced.patches.tiktok.misc.integrations.patch.TikTokIntegrationsPatch
@ -30,7 +30,7 @@ class TiktokFeedFilter : BytecodePatch(
SettingsStatusLoadFingerprint SettingsStatusLoadFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val method = FeedApiServiceLIZFingerprint.result!!.mutableMethod val method = FeedApiServiceLIZFingerprint.result!!.mutableMethod
for ((index, instruction) in method.implementation!!.instructions.withIndex()) { for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
if (instruction.opcode != Opcode.RETURN_OBJECT) continue if (instruction.opcode != Opcode.RETURN_OBJECT) continue

View file

@ -3,13 +3,11 @@ package app.revanced.patches.tiktok.interaction.downloads.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("acl-common-share-get-code") @Name("acl-common-share-get-code")
@MatchingMethod("ACLCommonShare", "getCode")
@DownloadsCompatibility @DownloadsCompatibility
@Version("0.0.1") @Version("0.0.1")
object ACLCommonShareFingerprint : MethodFingerprint( object ACLCommonShareFingerprint : MethodFingerprint(

View file

@ -3,13 +3,11 @@ package app.revanced.patches.tiktok.interaction.downloads.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("acl-common-share-get-show-type") @Name("acl-common-share-get-show-type")
@MatchingMethod("ACLCommonShare", "getShowType")
@DownloadsCompatibility @DownloadsCompatibility
@Version("0.0.1") @Version("0.0.1")
object ACLCommonShareFingerprint2 : MethodFingerprint( object ACLCommonShareFingerprint2 : MethodFingerprint(

View file

@ -3,13 +3,11 @@ package app.revanced.patches.tiktok.interaction.downloads.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("acl-common-share-get-transcode") @Name("acl-common-share-get-transcode")
@MatchingMethod("ACLCommonShare", "getTranscode")
@DownloadsCompatibility @DownloadsCompatibility
@Version("0.0.1") @Version("0.0.1")
object ACLCommonShareFingerprint3 : MethodFingerprint( object ACLCommonShareFingerprint3 : MethodFingerprint(

View file

@ -3,13 +3,11 @@ package app.revanced.patches.tiktok.interaction.downloads.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("download-path-parent-fingerprint") @Name("download-path-parent-fingerprint")
@MatchingMethod("LX/4bF;", "LIZ")
@DownloadsCompatibility @DownloadsCompatibility
@Version("0.0.1") @Version("0.0.1")
object DownloadPathParentFingerprint : MethodFingerprint( object DownloadPathParentFingerprint : MethodFingerprint(

View file

@ -3,18 +3,18 @@ package app.revanced.patches.tiktok.interaction.downloads.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.impl.toMethodWalker import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.extensions.replaceInstructions import app.revanced.patcher.extensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
import app.revanced.patches.tiktok.interaction.downloads.fingerprints.ACLCommonShareFingerprint import app.revanced.patches.tiktok.interaction.downloads.fingerprints.ACLCommonShareFingerprint
@ -44,7 +44,7 @@ class DownloadsPatch : BytecodePatch(
SettingsStatusLoadFingerprint SettingsStatusLoadFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val method1 = ACLCommonShareFingerprint.result!!.mutableMethod val method1 = ACLCommonShareFingerprint.result!!.mutableMethod
method1.replaceInstructions( method1.replaceInstructions(
0, 0,
@ -92,7 +92,7 @@ class DownloadsPatch : BytecodePatch(
} }
if (targetOffset == -1) return PatchResultError("Can not find download path uri method.") if (targetOffset == -1) return PatchResultError("Can not find download path uri method.")
//Change videos' download path. //Change videos' download path.
val downloadUriMethod = data val downloadUriMethod = context
.toMethodWalker(DownloadPathParentFingerprint.result!!.method) .toMethodWalker(DownloadPathParentFingerprint.result!!.method)
.nextMethod(targetOffset, true) .nextMethod(targetOffset, true)
.getMethod() as MutableMethod .getMethod() as MutableMethod

View file

@ -2,13 +2,11 @@ package app.revanced.patches.tiktok.interaction.seekbar.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("aweme-get-video-control") @Name("aweme-get-video-control")
@MatchingMethod("Aweme", "getVideoControl")
@SeekbarCompatibility @SeekbarCompatibility
@Version("0.0.1") @Version("0.0.1")
object AwemeGetVideoControlFingerprint : MethodFingerprint( object AwemeGetVideoControlFingerprint : MethodFingerprint(

View file

@ -3,15 +3,15 @@ package app.revanced.patches.tiktok.interaction.seekbar.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.* import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.AwemeGetVideoControlFingerprint
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
@ -26,9 +26,9 @@ class TiktokSeekbarPatch : BytecodePatch(
AwemeGetVideoControlFingerprint AwemeGetVideoControlFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
//Get VideoControl FieldReference //Get VideoControl FieldReference
val videoControl = data.findClass { it.type.endsWith("/VideoControl;") } val videoControl = context.findClass { it.type.endsWith("/VideoControl;") }
?: return PatchResultError("Can not find target class") ?: return PatchResultError("Can not find target class")
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name } val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }

View file

@ -3,13 +3,11 @@ package app.revanced.patches.tiktok.interaction.speed.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.interaction.speed.annotations.SpeedCompatibility import app.revanced.patches.tiktok.interaction.speed.annotations.SpeedCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("speed-control-parent-fingerprint") @Name("speed-control-parent-fingerprint")
@MatchingMethod("LX/4cP;", "LJIILL")
@SpeedCompatibility @SpeedCompatibility
@Version("0.0.1") @Version("0.0.1")
object SpeedControlParentFingerprint : MethodFingerprint( object SpeedControlParentFingerprint : MethodFingerprint(

View file

@ -3,13 +3,13 @@ package app.revanced.patches.tiktok.interaction.speed.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.impl.toMethodWalker import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.tiktok.interaction.speed.annotations.SpeedCompatibility import app.revanced.patches.tiktok.interaction.speed.annotations.SpeedCompatibility
import app.revanced.patches.tiktok.interaction.speed.fingerprints.SpeedControlParentFingerprint import app.revanced.patches.tiktok.interaction.speed.fingerprints.SpeedControlParentFingerprint
@ -25,12 +25,12 @@ class SpeedPatch : BytecodePatch(
SpeedControlParentFingerprint SpeedControlParentFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val parentMethod = SpeedControlParentFingerprint.result!!.mutableMethod val parentMethod = SpeedControlParentFingerprint.result!!.mutableMethod
val parentMethodInstructions = parentMethod.implementation!!.instructions val parentMethodInstructions = parentMethod.implementation!!.instructions
for ((index, instruction) in parentMethodInstructions.withIndex()) { for ((index, instruction) in parentMethodInstructions.withIndex()) {
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) continue if (instruction.opcode != Opcode.INVOKE_VIRTUAL) continue
val isSpeedEnableMethod = data val isSpeedEnableMethod = context
.toMethodWalker(parentMethod) .toMethodWalker(parentMethod)
.nextMethod(index, true) .nextMethod(index, true)
.getMethod() as MutableMethod .getMethod() as MutableMethod

View file

@ -2,12 +2,10 @@ package app.revanced.patches.tiktok.misc.forcelogin.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.misc.forcelogin.annotations.DisableForceLoginCompatibility import app.revanced.patches.tiktok.misc.forcelogin.annotations.DisableForceLoginCompatibility
@Name("mandatory-login-service-fingerprint") @Name("mandatory-login-service-fingerprint")
@MatchingMethod("/MandatoryLoginService;", "enableForcedLogin")
@DisableForceLoginCompatibility @DisableForceLoginCompatibility
@Version("0.0.1") @Version("0.0.1")
object MandatoryLoginServiceFingerprint : MethodFingerprint( object MandatoryLoginServiceFingerprint : MethodFingerprint(

View file

@ -2,12 +2,10 @@ package app.revanced.patches.tiktok.misc.forcelogin.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.misc.forcelogin.annotations.DisableForceLoginCompatibility import app.revanced.patches.tiktok.misc.forcelogin.annotations.DisableForceLoginCompatibility
@Name("mandatory-login-service-fingerprint2") @Name("mandatory-login-service-fingerprint2")
@MatchingMethod("/MandatoryLoginService;", "shouldShowForcedLogin")
@DisableForceLoginCompatibility @DisableForceLoginCompatibility
@Version("0.0.1") @Version("0.0.1")
object MandatoryLoginServiceFingerprint2 : MethodFingerprint( object MandatoryLoginServiceFingerprint2 : MethodFingerprint(

View file

@ -3,12 +3,12 @@ package app.revanced.patches.tiktok.misc.forcelogin.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.tiktok.misc.forcelogin.annotations.DisableForceLoginCompatibility import app.revanced.patches.tiktok.misc.forcelogin.annotations.DisableForceLoginCompatibility
import app.revanced.patches.tiktok.misc.forcelogin.fingerprints.MandatoryLoginServiceFingerprint import app.revanced.patches.tiktok.misc.forcelogin.fingerprints.MandatoryLoginServiceFingerprint
import app.revanced.patches.tiktok.misc.forcelogin.fingerprints.MandatoryLoginServiceFingerprint2 import app.revanced.patches.tiktok.misc.forcelogin.fingerprints.MandatoryLoginServiceFingerprint2
@ -24,7 +24,7 @@ class DisableForceLoginPatch : BytecodePatch(
MandatoryLoginServiceFingerprint2 MandatoryLoginServiceFingerprint2
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
listOf( listOf(
MandatoryLoginServiceFingerprint, MandatoryLoginServiceFingerprint,
MandatoryLoginServiceFingerprint2 MandatoryLoginServiceFingerprint2

View file

@ -2,14 +2,10 @@ package app.revanced.patches.tiktok.misc.integrations.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.misc.integrations.annotations.TikTokIntegrationsCompatibility import app.revanced.patches.tiktok.misc.integrations.annotations.TikTokIntegrationsCompatibility
@Name("init-fingerprint") @Name("init-fingerprint")
@MatchingMethod(
"Lcom/ss/android/ugc/aweme/app/host/AwemeHostApplication;", "onCreate"
)
@TikTokIntegrationsCompatibility @TikTokIntegrationsCompatibility
@Version("0.0.1") @Version("0.0.1")
object InitFingerprint : MethodFingerprint( object InitFingerprint : MethodFingerprint(

View file

@ -3,12 +3,12 @@ package app.revanced.patches.tiktok.misc.integrations.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.tiktok.misc.integrations.annotations.TikTokIntegrationsCompatibility import app.revanced.patches.tiktok.misc.integrations.annotations.TikTokIntegrationsCompatibility
import app.revanced.patches.tiktok.misc.integrations.fingerprints.InitFingerprint import app.revanced.patches.tiktok.misc.integrations.fingerprints.InitFingerprint
@ -21,8 +21,8 @@ class TikTokIntegrationsPatch : BytecodePatch(
InitFingerprint InitFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
if (data.findClass("Lapp/revanced/tiktok/utils/ReVancedUtils") == null) if (context.findClass("Lapp/revanced/tiktok/utils/ReVancedUtils") == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.") return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
val result = InitFingerprint.result!! val result = InitFingerprint.result!!

View file

@ -2,15 +2,10 @@ package app.revanced.patches.tiktok.misc.settings.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility
@Name("ad-personalization-activity-fingerprint") @Name("ad-personalization-activity-fingerprint")
@MatchingMethod(
"Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;",
"onCreate"
)
@TikTokSettingsCompatibility @TikTokSettingsCompatibility
@Version("0.0.1") @Version("0.0.1")
object AdPersonalizationActivityFingerprint : MethodFingerprint( object AdPersonalizationActivityFingerprint : MethodFingerprint(

View file

@ -2,15 +2,10 @@ package app.revanced.patches.tiktok.misc.settings.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility
@Name("copyright-settings-string-fingerprint") @Name("copyright-settings-string-fingerprint")
@MatchingMethod(
"Lcom/ss/android/ugc/aweme/setting/ui/SettingNewVersionFragment;",
"onViewCreated"
)
@TikTokSettingsCompatibility @TikTokSettingsCompatibility
@Version("0.0.1") @Version("0.0.1")
object CopyRightSettingsStringFingerprint : MethodFingerprint( object CopyRightSettingsStringFingerprint : MethodFingerprint(

View file

@ -2,15 +2,10 @@ package app.revanced.patches.tiktok.misc.settings.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility
@Name("settings-status-load-fingerprint") @Name("settings-status-load-fingerprint")
@MatchingMethod(
"Lapp/revanced/tiktok/settingsmenu/SettingsStatus;",
"load"
)
@TikTokSettingsCompatibility @TikTokSettingsCompatibility
@Version("0.0.1") @Version("0.0.1")
object SettingsStatusLoadFingerprint : MethodFingerprint( object SettingsStatusLoadFingerprint : MethodFingerprint(

View file

@ -3,15 +3,15 @@ package app.revanced.patches.tiktok.misc.settings.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.tiktok.misc.integrations.patch.TikTokIntegrationsPatch import app.revanced.patches.tiktok.misc.integrations.patch.TikTokIntegrationsPatch
import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility import app.revanced.patches.tiktok.misc.settings.annotations.TikTokSettingsCompatibility
import app.revanced.patches.tiktok.misc.settings.fingerprints.AdPersonalizationActivityFingerprint import app.revanced.patches.tiktok.misc.settings.fingerprints.AdPersonalizationActivityFingerprint
@ -35,7 +35,7 @@ class TikTokSettingsPatch : BytecodePatch(
CopyRightSettingsStringFingerprint CopyRightSettingsStringFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
//Replace string `Copyright Policy` to 'Revanced Settings` in TikTok settings. //Replace string `Copyright Policy` to 'Revanced Settings` in TikTok settings.
val method1 = CopyRightSettingsStringFingerprint.result!!.mutableMethod val method1 = CopyRightSettingsStringFingerprint.result!!.mutableMethod
val implementation1 = method1.implementation!! val implementation1 = method1.implementation!!
@ -66,7 +66,7 @@ class TikTokSettingsPatch : BytecodePatch(
if (clickInstruction.opcode != Opcode.INVOKE_DIRECT) if (clickInstruction.opcode != Opcode.INVOKE_DIRECT)
return PatchResultError("Can not find click listener.") return PatchResultError("Can not find click listener.")
val clickClass = ((clickInstruction as ReferenceInstruction).reference as MethodReference).definingClass val clickClass = ((clickInstruction as ReferenceInstruction).reference as MethodReference).definingClass
val mutableClickClass = data.findClass(clickClass)!!.resolve() val mutableClickClass = context.findClass(clickClass)!!.mutableClass
val mutableOnClickMethod = mutableClickClass.methods.first { val mutableOnClickMethod = mutableClickClass.methods.first {
it.name == "onClick" it.name == "onClick"
} }

View file

@ -2,13 +2,11 @@ package app.revanced.patches.twitter.ad.timeline.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.twitter.ad.timeline.annotations.TimelineAdsCompatibility import app.revanced.patches.twitter.ad.timeline.annotations.TimelineAdsCompatibility
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("timeline-tweet-json-parser-fingerprint") @Name("timeline-tweet-json-parser-fingerprint")
@MatchingMethod("LJsonTimelineTweet\$\$JsonObjectMapper;", "parseField")
@TimelineAdsCompatibility @TimelineAdsCompatibility
@Version("0.0.1") @Version("0.0.1")
object TimelineTweetJsonParserFingerprint : MethodFingerprint( object TimelineTweetJsonParserFingerprint : MethodFingerprint(

View file

@ -3,16 +3,16 @@ package app.revanced.patches.twitter.ad.timeline.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.twitter.ad.timeline.annotations.TimelineAdsCompatibility import app.revanced.patches.twitter.ad.timeline.annotations.TimelineAdsCompatibility
import app.revanced.patches.twitter.ad.timeline.fingerprints.TimelineTweetJsonParserFingerprint import app.revanced.patches.twitter.ad.timeline.fingerprints.TimelineTweetJsonParserFingerprint
@ -31,7 +31,7 @@ import org.jf.dexlib2.iface.reference.StringReference
class TimelineAdsPatch : BytecodePatch( class TimelineAdsPatch : BytecodePatch(
listOf(TimelineTweetJsonParserFingerprint) listOf(TimelineTweetJsonParserFingerprint)
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
if (removePromotedAds()) if (removePromotedAds())
return PatchResultError("The instruction for the tweet id field could not be found") return PatchResultError("The instruction for the tweet id field could not be found")

View file

@ -3,12 +3,12 @@ package app.revanced.patches.twitter.misc.dynamiccolor.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.twitter.misc.dynamiccolor.annotations.DynamicColorCompatibility import app.revanced.patches.twitter.misc.dynamiccolor.annotations.DynamicColorCompatibility
import java.io.FileWriter import java.io.FileWriter
import java.nio.file.Files import java.nio.file.Files
@ -18,9 +18,9 @@ import java.nio.file.Files
@Description("Replaces the default Twitter Blue with the users Material You palette.") @Description("Replaces the default Twitter Blue with the users Material You palette.")
@DynamicColorCompatibility @DynamicColorCompatibility
@Version("0.0.1") @Version("0.0.1")
class DynamicColorPatch : ResourcePatch() { class DynamicColorPatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val resDirectory = data["res"] val resDirectory = context["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.") if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val valuesV31Directory = resDirectory.resolve("values-v31") val valuesV31Directory = resDirectory.resolve("values-v31")
@ -39,7 +39,7 @@ class DynamicColorPatch : ResourcePatch() {
} }
} }
data.xmlEditor["res/values-v31/colors.xml"].use { editor -> context.xmlEditor["res/values-v31/colors.xml"].use { editor ->
val document = editor.file val document = editor.file
mapOf( mapOf(
@ -62,7 +62,7 @@ class DynamicColorPatch : ResourcePatch() {
} }
} }
data.xmlEditor["res/values-night-v31/colors.xml"].use { editor -> context.xmlEditor["res/values-night-v31/colors.xml"].use { editor ->
val document = editor.file val document = editor.file
mapOf( mapOf(

View file

@ -3,12 +3,12 @@ package app.revanced.patches.twitter.misc.monochrome.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.twitter.misc.monochrome.annotations.MonochromeIconCompatibility import app.revanced.patches.twitter.misc.monochrome.annotations.MonochromeIconCompatibility
import java.io.FileWriter import java.io.FileWriter
import java.nio.file.Files import java.nio.file.Files
@ -18,9 +18,9 @@ import java.nio.file.Files
@Description("Adds a monochrome icon.") @Description("Adds a monochrome icon.")
@MonochromeIconCompatibility @MonochromeIconCompatibility
@Version("0.0.1") @Version("0.0.1")
class MonochromeIconPatch : ResourcePatch() { class MonochromeIconPatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val resDirectory = data["res"] val resDirectory = context["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.") if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val mipmapV33Directory = resDirectory.resolve("mipmap-anydpi-v33") val mipmapV33Directory = resDirectory.resolve("mipmap-anydpi-v33")

View file

@ -2,14 +2,10 @@ package app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility
@Name("messaging-app-certificate-fingerprint") @Name("messaging-app-certificate-fingerprint")
@MatchingMethod(
"Lcom/google/firebase/installations/remote/c;", "f"
)
@FirebaseGetCertPatchCompatibility @FirebaseGetCertPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object GetMessagingCertFingerprint : MethodFingerprint( object GetMessagingCertFingerprint : MethodFingerprint(

View file

@ -2,14 +2,10 @@ package app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility
@Name("registration-app-certificate-fingerprint") @Name("registration-app-certificate-fingerprint")
@MatchingMethod(
"Lcom/google/firebase/remoteconfig/internal/ConfigFetchHttpClient;", "f"
)
@FirebaseGetCertPatchCompatibility @FirebaseGetCertPatchCompatibility
@Version("0.0.1") @Version("0.0.1")
object GetReqistrationCertFingerprint : MethodFingerprint( object GetReqistrationCertFingerprint : MethodFingerprint(

View file

@ -3,13 +3,14 @@ package app.revanced.patches.warnwetter.misc.firebasegetcert.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.*
import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility import app.revanced.patches.warnwetter.misc.firebasegetcert.annotations.FirebaseGetCertPatchCompatibility
import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.GetMessagingCertFingerprint
import app.revanced.patches.warnwetter.misc.firebasegetcert.fingerprints.GetReqistrationCertFingerprint
@Name("spoof-cert-patch") @Name("spoof-cert-patch")
@Description("Spoofs the X-Android-Cert header.") @Description("Spoofs the X-Android-Cert header.")
@ -21,7 +22,7 @@ class FirebaseGetCertPatch : BytecodePatch(
GetMessagingCertFingerprint GetMessagingCertFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val spoofedInstruction = val spoofedInstruction =
""" """
const-string v0, "0799DDF0414D3B3475E88743C91C0676793ED450" const-string v0, "0799DDF0414D3B3475E88743C91C0676793ED450"

View file

@ -2,14 +2,10 @@ package app.revanced.patches.warnwetter.misc.promocode.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility
@Name("promo-code-unlock-fingerprint") @Name("promo-code-unlock-fingerprint")
@MatchingMethod(
"Lde/dwd/warnapp/model/PromoTokenVerification;", "isValid"
)
@PromoCodeUnlockCompatibility @PromoCodeUnlockCompatibility
@Version("0.0.1") @Version("0.0.1")
object PromoCodeUnlockFingerprint : MethodFingerprint( object PromoCodeUnlockFingerprint : MethodFingerprint(

View file

@ -3,13 +3,13 @@ package app.revanced.patches.warnwetter.misc.promocode.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.warnwetter.misc.firebasegetcert.patch.FirebaseGetCertPatch import app.revanced.patches.warnwetter.misc.firebasegetcert.patch.FirebaseGetCertPatch
import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility import app.revanced.patches.warnwetter.misc.promocode.annotations.PromoCodeUnlockCompatibility
import app.revanced.patches.warnwetter.misc.promocode.fingerprints.PromoCodeUnlockFingerprint import app.revanced.patches.warnwetter.misc.promocode.fingerprints.PromoCodeUnlockFingerprint
@ -30,7 +30,7 @@ class PromoCodeUnlockPatch : BytecodePatch(
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val method = PromoCodeUnlockFingerprint.result!!.mutableMethod val method = PromoCodeUnlockFingerprint.result!!.mutableMethod
method.addInstructions( method.addInstructions(
0, 0,

View file

@ -4,17 +4,17 @@ import app.revanced.extensions.injectHideCall
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
@ -67,7 +67,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
"LoggingProperties are not in proto format" "LoggingProperties are not in proto format"
) )
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.ADS.addPreferences( SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_home_ads_removal", "revanced_home_ads_removal",
@ -191,7 +191,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
) )
// iterating through all classes is expensive // iterating through all classes is expensive
for (classDef in data.classes) { for (classDef in context.classes) {
var mutableClass: MutableClass? = null var mutableClass: MutableClass? = null
method@ for (method in classDef.methods) { method@ for (method in classDef.methods) {
@ -213,7 +213,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
if (invokeInstruction.opcode != Opcode.INVOKE_VIRTUAL) return@forEachIndexed if (invokeInstruction.opcode != Opcode.INVOKE_VIRTUAL) return@forEachIndexed
// create proxied method, make sure to not re-resolve() the current class // create proxied method, make sure to not re-resolve() the current class
if (mutableClass == null) mutableClass = data.proxy(classDef).resolve() if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
if (mutableMethod == null) mutableMethod = if (mutableMethod == null) mutableMethod =
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
@ -230,7 +230,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
if (iPutInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed if (iPutInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed
// create proxied method, make sure to not re-resolve() the current class // create proxied method, make sure to not re-resolve() the current class
if (mutableClass == null) mutableClass = data.proxy(classDef).resolve() if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
if (mutableMethod == null) mutableMethod = if (mutableMethod == null) mutableMethod =
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
@ -245,7 +245,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
if (invokeInstruction.opcode != Opcode.INVOKE_VIRTUAL) return@forEachIndexed if (invokeInstruction.opcode != Opcode.INVOKE_VIRTUAL) return@forEachIndexed
// create proxied method, make sure to not re-resolve() the current class // create proxied method, make sure to not re-resolve() the current class
if (mutableClass == null) mutableClass = data.proxy(classDef).resolve() if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
if (mutableMethod == null) mutableMethod = if (mutableMethod == null) mutableMethod =
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
@ -260,7 +260,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
if (invokeInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed if (invokeInstruction.opcode != Opcode.IPUT_OBJECT) return@forEachIndexed
// create proxied method, make sure to not re-resolve() the current class // create proxied method, make sure to not re-resolve() the current class
if (mutableClass == null) mutableClass = data.proxy(classDef).resolve() if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
if (mutableMethod == null) mutableMethod = if (mutableMethod == null) mutableMethod =
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
@ -280,7 +280,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
if (invokeInstruction.opcode != Opcode.INVOKE_DIRECT) return@forEachIndexed if (invokeInstruction.opcode != Opcode.INVOKE_DIRECT) return@forEachIndexed
// create proxied method, make sure to not re-resolve() the current class // create proxied method, make sure to not re-resolve() the current class
if (mutableClass == null) mutableClass = data.proxy(classDef).resolve() if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
if (mutableMethod == null) mutableMethod = if (mutableMethod == null) mutableMethod =
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
@ -302,7 +302,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
if (stringInstruction.opcode == Opcode.CONST_STRING) return@forEachIndexed if (stringInstruction.opcode == Opcode.CONST_STRING) return@forEachIndexed
// create proxied method, make sure to not re-resolve() the current class // create proxied method, make sure to not re-resolve() the current class
if (mutableClass == null) mutableClass = data.proxy(classDef).resolve() if (mutableClass == null) mutableClass = context.proxy(classDef).mutableClass
if (mutableMethod == null) mutableMethod = if (mutableMethod == null) mutableMethod =
mutableClass!!.findMutableMethodOf(method) mutableClass!!.findMutableMethodOf(method)
@ -319,8 +319,8 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
} }
stringReferences[2] -> { // Litho ads stringReferences[2] -> { // Litho ads
val proxy = data.proxy(classDef) val proxy = context.proxy(classDef)
val proxiedClass = proxy.resolve() val proxiedClass = proxy.mutableClass
val lithoMethod = getLithoMethod(proxiedClass) val lithoMethod = getLithoMethod(proxiedClass)
?: return PatchResultError("Could not find required Litho method to patch.") ?: return PatchResultError("Could not find required Litho method to patch.")
@ -347,7 +347,7 @@ class GeneralBytecodeAdsPatch : BytecodePatch() {
) {} ) {}
val pathBuilderScanResult = pathBuilderAnchorFingerprint.also { val pathBuilderScanResult = pathBuilderAnchorFingerprint.also {
it.resolve(data, lithoMethod, classDef) it.resolve(context, lithoMethod, classDef)
}.result!!.scanResult.patternScanResult!! }.result!!.scanResult.patternScanResult!!
val clobberedRegister = val clobberedRegister =

View file

@ -4,13 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("hide-infocard-suggestions-fingerprint") @Name("hide-infocard-suggestions-fingerprint")
@MatchingMethod("Liff;", "i")
@FuzzyPatternScanMethod(2) @FuzzyPatternScanMethod(2)
@HideInfocardSuggestionsCompatibility @HideInfocardSuggestionsCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -4,13 +4,11 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("hide-infocard-suggestions-parent-fingerprint") @Name("hide-infocard-suggestions-parent-fingerprint")
@MatchingMethod("Liff;", "lE")
@FuzzyPatternScanMethod(2) @FuzzyPatternScanMethod(2)
@HideInfocardSuggestionsCompatibility @HideInfocardSuggestionsCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,15 +3,15 @@ package app.revanced.patches.youtube.ad.infocardsuggestions.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility import app.revanced.patches.youtube.ad.infocardsuggestions.annotations.HideInfocardSuggestionsCompatibility
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsFingerprint import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsFingerprint
import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsParentFingerprint import app.revanced.patches.youtube.ad.infocardsuggestions.fingerprints.HideInfocardSuggestionsParentFingerprint
@ -32,7 +32,7 @@ class HideInfocardSuggestionsPatch : BytecodePatch(
HideInfocardSuggestionsParentFingerprint HideInfocardSuggestionsParentFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.ADS.addPreferences( SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_info_cards_enabled", "revanced_info_cards_enabled",
@ -47,7 +47,7 @@ class HideInfocardSuggestionsPatch : BytecodePatch(
?: return PatchResultError("Parent fingerprint not resolved!") ?: return PatchResultError("Parent fingerprint not resolved!")
HideInfocardSuggestionsFingerprint.resolve(data, parentResult.classDef) HideInfocardSuggestionsFingerprint.resolve(context, parentResult.classDef)
val result = HideInfocardSuggestionsFingerprint.result val result = HideInfocardSuggestionsFingerprint.result
?: return PatchResultError("Required parent method could not be found.") ?: return PatchResultError("Required parent method could not be found.")

View file

@ -3,18 +3,13 @@ package app.revanced.patches.youtube.ad.video.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("show-video-ads-constructor-fingerprint") @Name("show-video-ads-constructor-fingerprint")
@MatchingMethod(
"Laair",
"<init>",
)
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@VideoAdsCompatibility @VideoAdsCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,17 +3,13 @@ package app.revanced.patches.youtube.ad.video.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Name("show-video-ads-method-fingerprint") @Name("show-video-ads-method-fingerprint")
@MatchingMethod(
definingClass = "zai"
)
@DirectPatternScanMethod
@VideoAdsCompatibility @VideoAdsCompatibility
@Version("0.0.1") @Version("0.0.1")
object ShowVideoAdsFingerprint : MethodFingerprint( object ShowVideoAdsFingerprint : MethodFingerprint(

View file

@ -3,14 +3,14 @@ package app.revanced.patches.youtube.ad.video.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility import app.revanced.patches.youtube.ad.video.annotations.VideoAdsCompatibility
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsConstructorFingerprint import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsConstructorFingerprint
import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprint import app.revanced.patches.youtube.ad.video.fingerprints.ShowVideoAdsFingerprint
@ -30,7 +30,7 @@ class VideoAdsPatch : BytecodePatch(
ShowVideoAdsConstructorFingerprint ShowVideoAdsConstructorFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.ADS.addPreferences( SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_video_ads_removal", "revanced_video_ads_removal",
@ -42,7 +42,7 @@ class VideoAdsPatch : BytecodePatch(
) )
ShowVideoAdsFingerprint.resolve( ShowVideoAdsFingerprint.resolve(
data, ShowVideoAdsConstructorFingerprint.result!!.classDef context, ShowVideoAdsConstructorFingerprint.result!!.classDef
) )
// Override the parameter by calling shouldShowAds and setting the parameter to the result // Override the parameter by calling shouldShowAds and setting the parameter to the result

View file

@ -3,12 +3,12 @@ package app.revanced.patches.youtube.interaction.downloads.bytecode.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch import app.revanced.patches.youtube.interaction.downloads.resource.patch.DownloadsResourcePatch
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
@ -21,7 +21,7 @@ import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
@DownloadsCompatibility @DownloadsCompatibility
@Version("0.0.1") @Version("0.0.1")
class DownloadsBytecodePatch : BytecodePatch() { class DownloadsBytecodePatch : BytecodePatch() {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val integrationsPackage = "app/revanced/integrations" val integrationsPackage = "app/revanced/integrations"
val classDescriptor = "L$integrationsPackage/videoplayer/DownloadButton;" val classDescriptor = "L$integrationsPackage/videoplayer/DownloadButton;"

View file

@ -3,11 +3,11 @@ package app.revanced.patches.youtube.interaction.downloads.resource.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch
@ -22,8 +22,8 @@ import app.revanced.util.resources.ResourceUtils.copyResources
@Description("Makes necessary changes to resources for the download button.") @Description("Makes necessary changes to resources for the download button.")
@DownloadsCompatibility @DownloadsCompatibility
@Version("0.0.1") @Version("0.0.1")
class DownloadsResourcePatch : ResourcePatch() { class DownloadsResourcePatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_downloads", "revanced_downloads",
@ -53,13 +53,13 @@ class DownloadsResourcePatch : ResourcePatch() {
* Copy strings * Copy strings
*/ */
data.mergeStrings("downloads/host/values/strings.xml") context.mergeStrings("downloads/host/values/strings.xml")
/* /*
* Copy resources * Copy resources
*/ */
data.copyResources("downloads", ResourceUtils.ResourceGroup("drawable", "revanced_yt_download_button.xml")) context.copyResources("downloads", ResourceUtils.ResourceGroup("drawable", "revanced_yt_download_button.xml"))
/* /*
* Add download button node * Add download button node

View file

@ -3,15 +3,13 @@ package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("enable-seekbar-tapping-fingerprint") @Name("enable-seekbar-tapping-fingerprint")
@MatchingMethod("Lfbl;", "onTouchEvent")
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@SeekbarTappingCompatibility @SeekbarTappingCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,15 +3,13 @@ package app.revanced.patches.youtube.interaction.seekbar.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("enable-seekbar-tapping-parent-fingerprint") @Name("enable-seekbar-tapping-parent-fingerprint")
@MatchingMethod("Lzmx;", "I")
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value. @FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
@SeekbarTappingCompatibility @SeekbarTappingCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,14 +3,14 @@ package app.revanced.patches.youtube.interaction.seekbar.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility import app.revanced.patches.youtube.interaction.seekbar.annotation.SeekbarTappingCompatibility
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingFingerprint
import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingParentFingerprint import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingParentFingerprint
@ -35,7 +35,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
SeekbarTappingParentFingerprint, SeekbarTappingFingerprint SeekbarTappingParentFingerprint, SeekbarTappingFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_enable_tap_seeking", "revanced_enable_tap_seeking",

View file

@ -2,16 +2,12 @@ package app.revanced.patches.youtube.interaction.swipecontrols.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
@Name("swipe-controls-host-activity-fingerprint") @Name("swipe-controls-host-activity-fingerprint")
@MatchingMethod(
"Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;", "<init>"
)
@DirectPatternScanMethod
@SwipeControlsCompatibility @SwipeControlsCompatibility
@Version("0.0.1") @Version("0.0.1")
object SwipeControlsHostActivityFingerprint : MethodFingerprint( object SwipeControlsHostActivityFingerprint : MethodFingerprint(

View file

@ -2,16 +2,12 @@ package app.revanced.patches.youtube.interaction.swipecontrols.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.DirectPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
@Name("watch-while-activity-fingerprint") @Name("watch-while-activity-fingerprint")
@MatchingMethod(
"LWatchWhileActivity;", "<init>"
)
@DirectPatternScanMethod
@SwipeControlsCompatibility @SwipeControlsCompatibility
@Version("0.0.1") @Version("0.0.1")
object WatchWhileActivityFingerprint : MethodFingerprint( object WatchWhileActivityFingerprint : MethodFingerprint(

View file

@ -5,12 +5,12 @@ import app.revanced.extensions.traverseClassHierarchy
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint
@ -39,7 +39,7 @@ class SwipeControlsBytecodePatch : BytecodePatch(
SwipeControlsHostActivityFingerprint SwipeControlsHostActivityFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass
val targetClass = WatchWhileActivityFingerprint.result!!.mutableClass val targetClass = WatchWhileActivityFingerprint.result!!.mutableClass
@ -48,7 +48,7 @@ class SwipeControlsBytecodePatch : BytecodePatch(
targetClass.setSuperClass(wrapperClass.type) targetClass.setSuperClass(wrapperClass.type)
// ensure all classes and methods in the hierarchy are non-final, so we can override them in integrations // ensure all classes and methods in the hierarchy are non-final, so we can override them in integrations
data.traverseClassHierarchy(targetClass) { context.traverseClassHierarchy(targetClass) {
accessFlags = accessFlags and AccessFlags.FINAL.value.inv() accessFlags = accessFlags and AccessFlags.FINAL.value.inv()
transformMethods { transformMethods {
ImmutableMethod( ImmutableMethod(

View file

@ -2,11 +2,11 @@ package app.revanced.patches.youtube.interaction.swipecontrols.patch.resource
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.* import app.revanced.patches.youtube.misc.settings.framework.components.impl.*
@ -17,8 +17,8 @@ import app.revanced.util.resources.ResourceUtils.copyResources
@DependsOn([SettingsPatch::class]) @DependsOn([SettingsPatch::class])
@SwipeControlsCompatibility @SwipeControlsCompatibility
@Version("0.0.1") @Version("0.0.1")
class SwipeControlsResourcePatch : ResourcePatch() { class SwipeControlsResourcePatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences( SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen( PreferenceScreen(
"revanced_swipe_controls", StringResource("revanced_swipe_controls_title", "Swipe controls"), listOf( "revanced_swipe_controls", StringResource("revanced_swipe_controls_title", "Swipe controls"), listOf(
@ -92,7 +92,7 @@ class SwipeControlsResourcePatch : ResourcePatch() {
) )
) )
data.copyResources( context.copyResources(
"swipecontrols", "swipecontrols",
ResourceUtils.ResourceGroup( ResourceUtils.ResourceGroup(
"drawable", "drawable",

View file

@ -4,14 +4,12 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("start-video-informer-fingerprint") @Name("start-video-informer-fingerprint")
@MatchingMethod("Laaxf;", "d")
@FuzzyPatternScanMethod(3) @FuzzyPatternScanMethod(3)
@AutoCaptionsCompatibility @AutoCaptionsCompatibility
@Version("0.0.1") @Version("0.0.1")

View file

@ -3,14 +3,12 @@ package app.revanced.patches.youtube.layout.autocaptions.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("subtitle-button-controller-fingerprint") @Name("subtitle-button-controller-fingerprint")
@MatchingMethod("Lcom/google/android/apps/youtube/app/player/overlay/SubtitleButtonController;", "E")
@AutoCaptionsCompatibility @AutoCaptionsCompatibility
@Version("0.0.1") @Version("0.0.1")
object SubtitleButtonControllerFingerprint : MethodFingerprint( object SubtitleButtonControllerFingerprint : MethodFingerprint(

View file

@ -3,14 +3,12 @@ package app.revanced.patches.youtube.layout.autocaptions.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("subtitle-track-fingerprint") @Name("subtitle-track-fingerprint")
@MatchingMethod("Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleTrack;", "t")
@AutoCaptionsCompatibility @AutoCaptionsCompatibility
@Version("0.0.1") @Version("0.0.1")
object SubtitleTrackFingerprint : MethodFingerprint( object SubtitleTrackFingerprint : MethodFingerprint(

View file

@ -3,13 +3,13 @@ package app.revanced.patches.youtube.layout.autocaptions.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.StartVideoInformerFingerprint import app.revanced.patches.youtube.layout.autocaptions.fingerprints.StartVideoInformerFingerprint
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
@ -30,7 +30,7 @@ class AutoCaptionsPatch : BytecodePatch(
StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_autocaptions_enabled", "revanced_autocaptions_enabled",

View file

@ -3,16 +3,12 @@ package app.revanced.patches.youtube.layout.autoplaybutton.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
@Name("autonav-informer-fingerprint") @Name("autonav-informer-fingerprint")
@MatchingMethod(
"LWillAutonavInformer;", "k"
)
@AutoplayButtonCompatibility @AutoplayButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object AutoNavInformerFingerprint : MethodFingerprint( object AutoNavInformerFingerprint : MethodFingerprint(

View file

@ -2,14 +2,10 @@ package app.revanced.patches.youtube.layout.autoplaybutton.fingerprints
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
@Name("layout-constructor-fingerprint") @Name("layout-constructor-fingerprint")
@MatchingMethod(
"LYouTubeControlsOverlay;", "F"
)
@AutoplayButtonCompatibility @AutoplayButtonCompatibility
@Version("0.0.1") @Version("0.0.1")
object LayoutConstructorFingerprint : MethodFingerprint( object LayoutConstructorFingerprint : MethodFingerprint(

View file

@ -3,13 +3,13 @@ package app.revanced.patches.youtube.layout.autoplaybutton.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayButtonCompatibility
import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutoNavInformerFingerprint import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutoNavInformerFingerprint
@ -35,7 +35,7 @@ class HideAutoplayButtonPatch : BytecodePatch(
LayoutConstructorFingerprint, AutoNavInformerFingerprint LayoutConstructorFingerprint, AutoNavInformerFingerprint
) )
) { ) {
override fun execute(data: BytecodeData): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference( SwitchPreference(
"revanced_autoplay_button_enabled", "revanced_autoplay_button_enabled",

View file

@ -3,13 +3,13 @@ package app.revanced.patches.youtube.layout.branding.header.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import java.nio.file.Files import java.nio.file.Files
@ -22,9 +22,9 @@ import kotlin.io.path.exists
@Description("Shows premium branding on the home screen.") @Description("Shows premium branding on the home screen.")
@PremiumHeadingCompatibility @PremiumHeadingCompatibility
@Version("0.0.1") @Version("0.0.1")
class PremiumHeadingPatch : ResourcePatch() { class PremiumHeadingPatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val resDirectory = data["res"] val resDirectory = context["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.") if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header" val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header"

View file

@ -3,11 +3,10 @@ package app.revanced.patches.youtube.layout.branding.icon.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.ResourceData import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.ResourcePatch
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import java.io.File import java.io.File
@ -21,9 +20,9 @@ import java.nio.file.Files
@Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).") @Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).")
@CustomBrandingCompatibility @CustomBrandingCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingPatch : ResourcePatch() { class CustomBrandingPatch : ResourcePatch {
override fun execute(data: ResourceData): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val resDirectory = data["res"] val resDirectory = context["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.") if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
// Icon branding // Icon branding
@ -53,7 +52,7 @@ class CustomBrandingPatch : ResourcePatch() {
} }
// Name branding // Name branding
val manifest = data["AndroidManifest.xml"] val manifest = context["AndroidManifest.xml"]
manifest.writeText( manifest.writeText(
manifest.readText() manifest.readText()
.replace( .replace(

Some files were not shown because too many files have changed in this diff Show more