diff --git a/src/main/kotlin/app/revanced/patches/Shared.kt b/src/main/kotlin/app/revanced/patches/Shared.kt new file mode 100644 index 000000000..ef412ddd1 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/Shared.kt @@ -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()) +) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/ad/VideoAds.kt b/src/main/kotlin/app/revanced/patches/ad/VideoAds.kt index 21b59eda2..cefd0674c 100644 --- a/src/main/kotlin/app/revanced/patches/ad/VideoAds.kt +++ b/src/main/kotlin/app/revanced/patches/ad/VideoAds.kt @@ -1,21 +1,26 @@ package app.revanced.patches.ad 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.or -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.patch.* import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.smali.asInstructions +import app.revanced.patches.SHARED_METADATA import org.jf.dexlib2.AccessFlags -class VideoAds : Patch("video-ads") { +class VideoAds : Patch( + PatchMetadata( + "video-ads", + "TODO", + "TODO" + ) +) { override fun execute(cache: Cache): PatchResult { val map = cache.methodMap["show-video-ads-constructor"].findParentMethod( MethodSignature( "show-video-ads-method", + SHARED_METADATA, "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), diff --git a/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTapping.kt b/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTapping.kt index 386f1b026..1b21d3785 100644 --- a/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTapping.kt +++ b/src/main/kotlin/app/revanced/patches/interaction/EnableSeekbarTapping.kt @@ -3,6 +3,7 @@ package app.revanced.patches.interaction import app.revanced.patcher.cache.Cache import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.Patch +import app.revanced.patcher.patch.PatchMetadata import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.smali.asInstructions @@ -11,7 +12,13 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.iface.Method 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 { var map = cache.methodMap["tap-seekbar-parent-method"] diff --git a/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemover.kt b/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemover.kt index 5a0c6ae73..e39cae248 100644 --- a/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemover.kt +++ b/src/main/kotlin/app/revanced/patches/layout/CreateButtonRemover.kt @@ -2,11 +2,18 @@ package app.revanced.patches.layout import app.revanced.patcher.cache.Cache import app.revanced.patcher.patch.Patch +import app.revanced.patcher.patch.PatchMetadata import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.smali.asInstruction -class CreateButtonRemover : Patch("create-button-remover") { +class CreateButtonRemover : Patch( + PatchMetadata( + "create-button-remover", + "TODO", + "TODO" + ) +) { override fun execute(cache: Cache): PatchResult { val map = cache.methodMap["create-button-patch"] diff --git a/src/main/kotlin/app/revanced/patches/layout/HideReels.kt b/src/main/kotlin/app/revanced/patches/layout/HideReels.kt index 6e1242884..9e28f5359 100644 --- a/src/main/kotlin/app/revanced/patches/layout/HideReels.kt +++ b/src/main/kotlin/app/revanced/patches/layout/HideReels.kt @@ -2,11 +2,18 @@ package app.revanced.patches.layout import app.revanced.patcher.cache.Cache import app.revanced.patcher.patch.Patch +import app.revanced.patcher.patch.PatchMetadata import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.smali.asInstruction -class HideReels : Patch("hide-reels") { +class HideReels : Patch( + PatchMetadata( + "hide-reels", + "TODO", + "TODO" + ) +) { override fun execute(cache: Cache): PatchResult { val map = cache.methodMap["hide-reel-patch"] val implementation = map.method.implementation!! diff --git a/src/main/kotlin/app/revanced/patches/layout/HideSuggestions.kt b/src/main/kotlin/app/revanced/patches/layout/HideSuggestions.kt index d6870ff95..005a9c7a6 100644 --- a/src/main/kotlin/app/revanced/patches/layout/HideSuggestions.kt +++ b/src/main/kotlin/app/revanced/patches/layout/HideSuggestions.kt @@ -1,15 +1,13 @@ package app.revanced.patches.layout 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.or -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.patch.* import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.smali.asInstructions +import app.revanced.patches.SHARED_METADATA import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode 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.ImmutableMethodImplementation -class HideSuggestions : Patch("hide-suggestions") { +class HideSuggestions : Patch( + PatchMetadata( + "hide-suggestions", + "TODO", + "TODO" + ) +) { override fun execute(cache: Cache): PatchResult { val map = cache.methodMap["hide-suggestions-patch"].findParentMethod( MethodSignature( "hide-suggestions-method", + SHARED_METADATA, "V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), diff --git a/src/main/kotlin/app/revanced/patches/layout/MinimizedPlayback.kt b/src/main/kotlin/app/revanced/patches/layout/MinimizedPlayback.kt index 72d84c3ae..5573bc13b 100644 --- a/src/main/kotlin/app/revanced/patches/layout/MinimizedPlayback.kt +++ b/src/main/kotlin/app/revanced/patches/layout/MinimizedPlayback.kt @@ -3,11 +3,18 @@ package app.revanced.patches.layout import app.revanced.patcher.cache.Cache import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.Patch +import app.revanced.patcher.patch.PatchMetadata import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.smali.asInstructions -class MinimizedPlayback : Patch("minimized-playback") { +class MinimizedPlayback : Patch( + PatchMetadata( + "minimized-playback", + "TODO", + "TODO" + ) +) { override fun execute(cache: Cache): PatchResult { // Instead of removing all instructions like Vanced, // we return the method at the beginning instead diff --git a/src/main/kotlin/app/revanced/patches/layout/OldQualityLayout.kt b/src/main/kotlin/app/revanced/patches/layout/OldQualityLayout.kt index ab52b323b..59d684985 100644 --- a/src/main/kotlin/app/revanced/patches/layout/OldQualityLayout.kt +++ b/src/main/kotlin/app/revanced/patches/layout/OldQualityLayout.kt @@ -1,23 +1,28 @@ package app.revanced.patches.layout 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.or -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.patch.* import app.revanced.patcher.signature.MethodSignature import app.revanced.patcher.smali.asInstructions +import app.revanced.patches.SHARED_METADATA import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.Opcode 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 { val map = cache.methodMap["old-quality-patch"].findParentMethod( MethodSignature( "old-quality-patch-method", + SHARED_METADATA, "L", AccessFlags.FINAL or AccessFlags.PUBLIC, emptyList(), diff --git a/src/main/kotlin/app/revanced/patches/misc/Integrations.kt b/src/main/kotlin/app/revanced/patches/misc/Integrations.kt index 1b4c66e6a..5b663426d 100644 --- a/src/main/kotlin/app/revanced/patches/misc/Integrations.kt +++ b/src/main/kotlin/app/revanced/patches/misc/Integrations.kt @@ -1,9 +1,10 @@ package app.revanced.patches.misc 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.or import app.revanced.patcher.patch.Patch +import app.revanced.patcher.patch.PatchMetadata import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.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.ImmutableMethodImplementation -class Integrations : Patch("integrations-patch") { +class Integrations : Patch( + PatchMetadata( + "integrations", + "TODO", + "TODO" + ) +) { override fun execute(cache: Cache): PatchResult { val map = cache.methodMap["integrations-patch"] val implementation = map.method.implementation!!