mirror of
https://github.com/revanced/revanced-patches
synced 2025-01-06 00:15:50 +01:00
refactor: make patches compatible with the newest patcher
This commit is contained in:
parent
99099ea0bc
commit
bc56555d9e
11
src/main/kotlin/app/revanced/patches/Shared.kt
Normal file
11
src/main/kotlin/app/revanced/patches/Shared.kt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches
|
||||||
|
|
||||||
|
import app.revanced.patcher.signature.MethodMetadata
|
||||||
|
import app.revanced.patcher.signature.PatcherMetadata
|
||||||
|
import app.revanced.patcher.signature.ResolverMethod
|
||||||
|
import app.revanced.patcher.signature.SignatureMetadata
|
||||||
|
|
||||||
|
val SHARED_METADATA = SignatureMetadata(
|
||||||
|
MethodMetadata(null, null, ""),
|
||||||
|
PatcherMetadata(ResolverMethod.Direct())
|
||||||
|
)
|
@ -1,21 +1,26 @@
|
|||||||
package app.revanced.patches.ad
|
package app.revanced.patches.ad
|
||||||
|
|
||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
|
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.signature.MethodSignature
|
import app.revanced.patcher.signature.MethodSignature
|
||||||
import app.revanced.patcher.smali.asInstructions
|
import app.revanced.patcher.smali.asInstructions
|
||||||
|
import app.revanced.patches.SHARED_METADATA
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
class VideoAds : Patch("video-ads") {
|
class VideoAds : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"video-ads",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
val map = cache.methodMap["show-video-ads-constructor"].findParentMethod(
|
val map = cache.methodMap["show-video-ads-constructor"].findParentMethod(
|
||||||
MethodSignature(
|
MethodSignature(
|
||||||
"show-video-ads-method",
|
"show-video-ads-method",
|
||||||
|
SHARED_METADATA,
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
listOf("Z"),
|
listOf("Z"),
|
||||||
|
@ -3,6 +3,7 @@ package app.revanced.patches.interaction
|
|||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patcher.patch.PatchMetadata
|
||||||
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.smali.asInstructions
|
import app.revanced.patcher.smali.asInstructions
|
||||||
@ -11,7 +12,13 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
|||||||
import org.jf.dexlib2.iface.Method
|
import org.jf.dexlib2.iface.Method
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
import org.jf.dexlib2.iface.instruction.formats.Instruction11n
|
||||||
|
|
||||||
class EnableSeekbarTapping : Patch("enable-seekbar-tapping") {
|
class EnableSeekbarTapping : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"enable-seekbar-tapping",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
var map = cache.methodMap["tap-seekbar-parent-method"]
|
var map = cache.methodMap["tap-seekbar-parent-method"]
|
||||||
|
|
||||||
|
@ -2,11 +2,18 @@ package app.revanced.patches.layout
|
|||||||
|
|
||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patcher.patch.PatchMetadata
|
||||||
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.smali.asInstruction
|
import app.revanced.patcher.smali.asInstruction
|
||||||
|
|
||||||
class CreateButtonRemover : Patch("create-button-remover") {
|
class CreateButtonRemover : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"create-button-remover",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
val map = cache.methodMap["create-button-patch"]
|
val map = cache.methodMap["create-button-patch"]
|
||||||
|
|
||||||
|
@ -2,11 +2,18 @@ package app.revanced.patches.layout
|
|||||||
|
|
||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patcher.patch.PatchMetadata
|
||||||
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.smali.asInstruction
|
import app.revanced.patcher.smali.asInstruction
|
||||||
|
|
||||||
class HideReels : Patch("hide-reels") {
|
class HideReels : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"hide-reels",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
val map = cache.methodMap["hide-reel-patch"]
|
val map = cache.methodMap["hide-reel-patch"]
|
||||||
val implementation = map.method.implementation!!
|
val implementation = map.method.implementation!!
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package app.revanced.patches.layout
|
package app.revanced.patches.layout
|
||||||
|
|
||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
|
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patcher.signature.MethodSignature
|
import app.revanced.patcher.signature.MethodSignature
|
||||||
import app.revanced.patcher.smali.asInstructions
|
import app.revanced.patcher.smali.asInstructions
|
||||||
|
import app.revanced.patches.SHARED_METADATA
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
||||||
@ -19,11 +17,18 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
|||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||||
|
|
||||||
class HideSuggestions : Patch("hide-suggestions") {
|
class HideSuggestions : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"hide-suggestions",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
val map = cache.methodMap["hide-suggestions-patch"].findParentMethod(
|
val map = cache.methodMap["hide-suggestions-patch"].findParentMethod(
|
||||||
MethodSignature(
|
MethodSignature(
|
||||||
"hide-suggestions-method",
|
"hide-suggestions-method",
|
||||||
|
SHARED_METADATA,
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
listOf("Z"),
|
listOf("Z"),
|
||||||
|
@ -3,11 +3,18 @@ package app.revanced.patches.layout
|
|||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patcher.patch.PatchMetadata
|
||||||
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.smali.asInstructions
|
import app.revanced.patcher.smali.asInstructions
|
||||||
|
|
||||||
class MinimizedPlayback : Patch("minimized-playback") {
|
class MinimizedPlayback : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"minimized-playback",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
// Instead of removing all instructions like Vanced,
|
// Instead of removing all instructions like Vanced,
|
||||||
// we return the method at the beginning instead
|
// we return the method at the beginning instead
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
package app.revanced.patches.layout
|
package app.revanced.patches.layout
|
||||||
|
|
||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
|
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.patch.*
|
||||||
import app.revanced.patcher.patch.Patch
|
|
||||||
import app.revanced.patcher.patch.PatchResult
|
|
||||||
import app.revanced.patcher.patch.PatchResultError
|
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
import app.revanced.patcher.signature.MethodSignature
|
import app.revanced.patcher.signature.MethodSignature
|
||||||
import app.revanced.patcher.smali.asInstructions
|
import app.revanced.patcher.smali.asInstructions
|
||||||
|
import app.revanced.patches.SHARED_METADATA
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
|
|
||||||
class OldQualityLayout : Patch("old-quality-restore") {
|
class OldQualityLayout : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"old-quality-layout",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
val map = cache.methodMap["old-quality-patch"].findParentMethod(
|
val map = cache.methodMap["old-quality-patch"].findParentMethod(
|
||||||
MethodSignature(
|
MethodSignature(
|
||||||
"old-quality-patch-method",
|
"old-quality-patch-method",
|
||||||
|
SHARED_METADATA,
|
||||||
"L",
|
"L",
|
||||||
AccessFlags.FINAL or AccessFlags.PUBLIC,
|
AccessFlags.FINAL or AccessFlags.PUBLIC,
|
||||||
emptyList(),
|
emptyList(),
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package app.revanced.patches.misc
|
package app.revanced.patches.misc
|
||||||
|
|
||||||
import app.revanced.patcher.cache.Cache
|
import app.revanced.patcher.cache.Cache
|
||||||
|
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
|
import app.revanced.patcher.patch.PatchMetadata
|
||||||
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.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
@ -12,7 +13,13 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||||
|
|
||||||
class Integrations : Patch("integrations-patch") {
|
class Integrations : Patch(
|
||||||
|
PatchMetadata(
|
||||||
|
"integrations",
|
||||||
|
"TODO",
|
||||||
|
"TODO"
|
||||||
|
)
|
||||||
|
) {
|
||||||
override fun execute(cache: Cache): PatchResult {
|
override fun execute(cache: Cache): PatchResult {
|
||||||
val map = cache.methodMap["integrations-patch"]
|
val map = cache.methodMap["integrations-patch"]
|
||||||
val implementation = map.method.implementation!!
|
val implementation = map.method.implementation!!
|
||||||
|
Loading…
Reference in New Issue
Block a user