feat: Dependencies annotation

This commit is contained in:
oSumAtrIX 2022-06-03 17:52:05 +02:00
parent 52f9147ee8
commit 85806bb355
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
6 changed files with 19 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
@ -20,7 +21,8 @@ import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorS
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
@Patch(dependencies = [IntegrationsPatch::class]) @Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("video-ads") @Name("video-ads")
@Description("Patch to remove ads in the YouTube video player.") @Description("Patch to remove ads in the YouTube video player.")
@VideoAdsCompatibility @VideoAdsCompatibility

View File

@ -5,6 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
@ -21,8 +22,8 @@ import org.jf.dexlib2.iface.Method
import org.jf.dexlib2.iface.instruction.formats.Instruction11n import org.jf.dexlib2.iface.instruction.formats.Instruction11n
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch
@Patch(dependencies = [IntegrationsPatch::class]) @Dependencies(dependencies = [IntegrationsPatch::class])
@Name("seekbar-tapping") @Name("seekbar-tapping")
@Description("Enable tapping on the seekbar of the YouTube player.") @Description("Enable tapping on the seekbar of the YouTube player.")
@SeekbarTappingCompatibility @SeekbarTappingCompatibility

View File

@ -4,6 +4,7 @@ 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.implementation.ResourceData import app.revanced.patcher.data.implementation.ResourceData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.ResourcePatch import app.revanced.patcher.patch.implementation.ResourcePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
@ -13,7 +14,8 @@ import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatc
import org.w3c.dom.Element import org.w3c.dom.Element
import java.io.File import java.io.File
@Patch( @Patch
@Dependencies(
dependencies = [ dependencies = [
FixLocaleConfigErrorPatch::class FixLocaleConfigErrorPatch::class
] ]

View File

@ -4,6 +4,7 @@ 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.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
@ -16,7 +17,8 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch(dependencies = [IntegrationsPatch::class]) @Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("disable-create-button") @Name("disable-create-button")
@Description("Disable the create button.") @Description("Disable the create button.")
@CreateButtonCompatibility @CreateButtonCompatibility
@ -32,8 +34,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
// Get the required register which holds the view object we need to pass to the method hideCreateButton // Get the required register which holds the view object we need to pass to the method hideCreateButton
val implementation = result.method.implementation!! val implementation = result.method.implementation!!
val instruction = implementation.instructions[result.scanResult.endIndex + 1] val instruction = implementation.instructions[result.scanResult.endIndex + 1]
if (instruction.opcode != Opcode.INVOKE_STATIC) if (instruction.opcode != Opcode.INVOKE_STATIC) return PatchResultError("Could not find the correct register")
return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC val register = (instruction as Instruction35c).registerC
// Hide the button view via proxy by passing it to the hideCreateButton method // Hide the button view via proxy by passing it to the hideCreateButton method

View File

@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
@ -22,7 +23,8 @@ 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
@Patch(dependencies = [IntegrationsPatch::class]) @Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("old-quality-layout") @Name("old-quality-layout")
@Description("Enable the original quality flyout menu.") @Description("Enable the original quality flyout menu.")
@OldQualityLayoutCompatibility @OldQualityLayoutCompatibility

View File

@ -4,6 +4,7 @@ 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.implementation.BytecodeData import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult import app.revanced.patcher.patch.implementation.misc.PatchResult
@ -15,7 +16,8 @@ import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButt
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.formats.Instruction11x
@Patch(dependencies = [IntegrationsPatch::class]) @Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("shorts-button") @Name("shorts-button")
@Description("Hide the shorts button.") @Description("Hide the shorts button.")
@ShortsButtonCompatibility @ShortsButtonCompatibility