mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-19 07:39:25 +01:00
add: resource patcher
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
ec9618ed55
commit
86e0728e15
@ -1,16 +1,18 @@
|
||||
package app.revanced.patches
|
||||
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patches.music.audio.EnableAudioOnlyPatch
|
||||
import app.revanced.patches.music.layout.RemoveUpgradeTabPatch
|
||||
import app.revanced.patches.music.layout.RemoveTasteBuilderPatch
|
||||
import app.revanced.patches.music.premium.BackgroundPlayPatch
|
||||
import app.revanced.patcher.data.base.Data
|
||||
import app.revanced.patcher.patch.base.Patch
|
||||
import app.revanced.patches.music.audio.CodecsUnlockPatch
|
||||
import app.revanced.patches.music.audio.EnableAudioOnlyPatch
|
||||
import app.revanced.patches.music.layout.RemoveTasteBuilderPatch
|
||||
import app.revanced.patches.music.layout.RemoveUpgradeTabPatch
|
||||
import app.revanced.patches.music.premium.BackgroundPlayPatch
|
||||
import app.revanced.patches.youtube.ad.HomeAdsPatch
|
||||
import app.revanced.patches.youtube.ad.HomePromoPatch
|
||||
import app.revanced.patches.youtube.ad.VideoAdsPatch
|
||||
import app.revanced.patches.youtube.interaction.EnableSeekbarTappingPatch
|
||||
import app.revanced.patches.youtube.layout.*
|
||||
import app.revanced.patches.youtube.misc.FixLocaleConfigErrorPatch
|
||||
import app.revanced.patches.youtube.misc.IntegrationsPatch
|
||||
|
||||
/**
|
||||
@ -22,8 +24,9 @@ object Index {
|
||||
* Array of patches.
|
||||
* New patches should be added to the array.
|
||||
*/
|
||||
val patches: List<() -> Patch> = listOf(
|
||||
val patches: List<() -> Patch<Data>> = listOf(
|
||||
::IntegrationsPatch,
|
||||
::FixLocaleConfigErrorPatch,
|
||||
::HomeAdsPatch,
|
||||
::VideoAdsPatch,
|
||||
::HomePromoPatch,
|
||||
|
@ -1,14 +1,18 @@
|
||||
package app.revanced.patches.music.audio
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.data.implementation.toMethodWalker
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
import app.revanced.patcher.signature.PatternScanMethod
|
||||
import app.revanced.patcher.smali.toInstruction
|
||||
import app.revanced.patcher.toMethodWalker
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -27,7 +31,7 @@ private val patchMetadata = PatchMetadata(
|
||||
"0.0.1"
|
||||
)
|
||||
|
||||
class CodecsUnlockPatch : Patch(
|
||||
class CodecsUnlockPatch : BytecodePatch(
|
||||
patchMetadata,
|
||||
listOf(
|
||||
MethodSignature(
|
||||
@ -130,7 +134,7 @@ class CodecsUnlockPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
var result = signatures.first().result!!
|
||||
|
||||
val implementation = result.method.implementation!!
|
||||
@ -138,7 +142,7 @@ class CodecsUnlockPatch : Patch(
|
||||
val instructionIndex = result.scanData.startIndex
|
||||
|
||||
result = signatures.last().result!!
|
||||
val codecMethod = patcherData
|
||||
val codecMethod = data
|
||||
.toMethodWalker(result.immutableMethod)
|
||||
.walk(result.scanData.startIndex)
|
||||
.getMethod()
|
||||
|
@ -1,8 +1,13 @@
|
||||
package app.revanced.patches.music.audio
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -18,7 +23,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class EnableAudioOnlyPatch : Patch(
|
||||
class EnableAudioOnlyPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"audio-only-playback-patch",
|
||||
"Audio Only Mode Patch",
|
||||
@ -78,7 +83,7 @@ class EnableAudioOnlyPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = signatures.first().result!!.findParentMethod(
|
||||
MethodSignature(
|
||||
MethodSignatureMetadata(
|
||||
|
@ -1,9 +1,13 @@
|
||||
package app.revanced.patches.music.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -20,7 +24,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class RemoveTasteBuilderPatch : Patch(
|
||||
class RemoveTasteBuilderPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"tasteBuilder-remover",
|
||||
"Remove TasteBuilder Patch",
|
||||
@ -66,7 +70,7 @@ class RemoveTasteBuilderPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = signatures.first().result!!
|
||||
val implementation = result.method.implementation!!
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
package app.revanced.patches.music.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -22,7 +26,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class RemoveUpgradeTabPatch : Patch(
|
||||
class RemoveUpgradeTabPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"upgrade-tab-remover",
|
||||
"Remove Upgrade Tab Patch",
|
||||
@ -93,7 +97,7 @@ class RemoveUpgradeTabPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = signatures.first().result!!
|
||||
val implementation = result.method.implementation!!
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
package app.revanced.patches.music.premium
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -19,7 +23,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class BackgroundPlayPatch : Patch(
|
||||
class BackgroundPlayPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"background-play",
|
||||
"Enable Background Playback Patch",
|
||||
@ -74,7 +78,7 @@ class BackgroundPlayPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
signatures.first().result!!.method.implementation!!.addInstructions(
|
||||
0,
|
||||
"""
|
||||
|
@ -1,9 +1,13 @@
|
||||
package app.revanced.patches.youtube.ad
|
||||
|
||||
import app.revanced.extensions.injectHideCall
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -30,7 +34,7 @@ private val patchMetadata = PatchMetadata(
|
||||
|
||||
private val signatureDescription = "Required signature for ${patchMetadata.name}. Discovered in version 17.03.38."
|
||||
|
||||
class HomeAdsPatch : Patch(
|
||||
class HomeAdsPatch : BytecodePatch(
|
||||
patchMetadata,
|
||||
listOf(
|
||||
MethodSignature(
|
||||
@ -1685,7 +1689,7 @@ class HomeAdsPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
for (i in 0 until signatures.count()) {
|
||||
val signature = signatures.elementAt(i)
|
||||
val result = signature.result!!
|
||||
|
@ -1,15 +1,20 @@
|
||||
package app.revanced.patches.youtube.ad
|
||||
|
||||
import app.revanced.extensions.injectHideCall
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.data.implementation.toMethodWalker
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
import app.revanced.patcher.signature.PatternScanMethod
|
||||
import app.revanced.patcher.toMethodWalker
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction11x
|
||||
@ -31,7 +36,7 @@ private val patchMetadata = PatchMetadata(
|
||||
|
||||
private val signatureDescription = "Required signature for ${patchMetadata.name}. Discovered in version 17.03.38."
|
||||
|
||||
class HomePromoPatch : Patch(
|
||||
class HomePromoPatch : BytecodePatch(
|
||||
patchMetadata,
|
||||
listOf(
|
||||
MethodSignature(
|
||||
@ -137,7 +142,7 @@ class HomePromoPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
for (signature in signatures) {
|
||||
val result = signature.result!!
|
||||
|
||||
@ -162,7 +167,7 @@ class HomePromoPatch : Patch(
|
||||
|
||||
val toBePatchedInvokeOffset =
|
||||
requiredMethod.immutableMethod.implementation!!.instructions.indexOfFirst { it.opcode == Opcode.INVOKE_DIRECT }
|
||||
val toBePatchedMethod = patcherData
|
||||
val toBePatchedMethod = data
|
||||
.toMethodWalker(requiredMethod.immutableMethod)
|
||||
.walk(toBePatchedInvokeOffset, true)
|
||||
.getMethod() as MutableMethod
|
||||
|
@ -1,9 +1,14 @@
|
||||
package app.revanced.patches.youtube.ad
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -27,7 +32,7 @@ private val patchMetadata = PatchMetadata(
|
||||
"0.0.1"
|
||||
)
|
||||
|
||||
class VideoAdsPatch : Patch(
|
||||
class VideoAdsPatch : BytecodePatch(
|
||||
patchMetadata,
|
||||
listOf(
|
||||
MethodSignature(
|
||||
@ -66,7 +71,7 @@ class VideoAdsPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
var result = signatures.first().result!!
|
||||
|
||||
val responsibleMethodSignature = MethodSignature(
|
||||
@ -105,4 +110,3 @@ class VideoAdsPatch : Patch(
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,14 @@
|
||||
package app.revanced.patches.youtube.interaction
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -23,7 +28,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class EnableSeekbarTappingPatch : Patch(
|
||||
class EnableSeekbarTappingPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"seekbar-tapping",
|
||||
"Enable seekbar tapping patch",
|
||||
@ -124,7 +129,7 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
var result = signatures.first().result!!
|
||||
|
||||
val tapSeekMethods = mutableMapOf<String, Method>()
|
||||
|
@ -1,8 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -19,7 +24,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class CreateButtonRemoverPatch : Patch(
|
||||
class CreateButtonRemoverPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"create-button",
|
||||
"Create button patch",
|
||||
@ -76,7 +81,7 @@ class CreateButtonRemoverPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = signatures.first().result!!
|
||||
|
||||
// Get the required register which holds the view object we need to pass to the method hideCreateButton
|
||||
|
@ -1,8 +1,12 @@
|
||||
package app.revanced.patches.youtube.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -18,7 +22,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class HideReelsPatch : Patch(
|
||||
class HideReelsPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"hide-reels",
|
||||
"Hide reels patch",
|
||||
@ -96,7 +100,7 @@ class HideReelsPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = signatures.first().result!!
|
||||
val implementation = result.method.implementation!!
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
package app.revanced.patches.youtube.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -19,7 +23,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class MinimizedPlaybackPatch : Patch(
|
||||
class MinimizedPlaybackPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"minimized-playback",
|
||||
"Minimized Playback Patch",
|
||||
@ -70,7 +74,7 @@ class MinimizedPlaybackPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
// Instead of removing all instructions like Vanced,
|
||||
// we return the method at the beginning instead
|
||||
signatures.first().result!!.method.implementation!!.addInstructions(
|
||||
|
@ -1,9 +1,14 @@
|
||||
package app.revanced.patches.youtube.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -20,7 +25,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class OldQualityLayoutPatch : Patch(
|
||||
class OldQualityLayoutPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"old-quality-layout",
|
||||
"Old Quality Layout Patch",
|
||||
@ -70,7 +75,7 @@ class OldQualityLayoutPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
var result = signatures.first().result!!
|
||||
|
||||
result = result.findParentMethod(
|
||||
|
@ -1,8 +1,12 @@
|
||||
package app.revanced.patches.youtube.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||
@ -19,7 +23,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class ShortsButtonRemoverPatch : Patch(
|
||||
class ShortsButtonRemoverPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"shorts-button",
|
||||
"Shorts button patch",
|
||||
@ -102,7 +106,7 @@ class ShortsButtonRemoverPatch : Patch(
|
||||
),
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result1 = signatures.first().result!!
|
||||
val implementation1 = result1.method.implementation!!
|
||||
val moveEnumInstruction = implementation1.instructions[result1.scanData.endIndex]
|
||||
|
@ -0,0 +1,46 @@
|
||||
package app.revanced.patches.youtube.misc
|
||||
|
||||
import app.revanced.patcher.data.implementation.ResourceData
|
||||
import app.revanced.patcher.patch.implementation.ResourcePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import com.sun.org.apache.xerces.internal.dom.ElementImpl
|
||||
|
||||
private val compatiblePackages = listOf(
|
||||
PackageMetadata(
|
||||
"com.google.android.youtube",
|
||||
listOf("17.14.35")
|
||||
)
|
||||
)
|
||||
class FixLocaleConfigErrorPatch : ResourcePatch(
|
||||
PatchMetadata(
|
||||
"locale-config-fix",
|
||||
"Manifest attribute fix patch",
|
||||
"Fix an error when building the resources by patching the manifest file.",
|
||||
compatiblePackages,
|
||||
"0.0.1"
|
||||
),
|
||||
) {
|
||||
override fun execute(data: ResourceData): PatchResult {
|
||||
// create an xml editor instance
|
||||
val editor = data.getXmlEditor("AndroidManifest.xml")
|
||||
|
||||
// edit the application nodes attribute...
|
||||
val applicationNode = editor
|
||||
.file
|
||||
.getElementsByTagName("application")
|
||||
.item(0) as ElementImpl
|
||||
|
||||
// by replacing the attributes name
|
||||
val attribute = "android:localeConfig"
|
||||
applicationNode.setAttribute("localeConfig", applicationNode.getAttribute(attribute))
|
||||
applicationNode.removeAttribute("android:localeConfig")
|
||||
|
||||
// close & save the modified file
|
||||
editor.close()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package app.revanced.patches.youtube.misc
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.data.implementation.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.implementation.BytecodePatch
|
||||
import app.revanced.patcher.patch.implementation.metadata.PackageMetadata
|
||||
import app.revanced.patcher.patch.implementation.metadata.PatchMetadata
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patcher.signature.MethodMetadata
|
||||
import app.revanced.patcher.signature.MethodSignature
|
||||
@ -22,7 +26,7 @@ private val compatiblePackages = listOf(
|
||||
)
|
||||
)
|
||||
|
||||
class IntegrationsPatch : Patch(
|
||||
class IntegrationsPatch : BytecodePatch(
|
||||
PatchMetadata(
|
||||
"integrations",
|
||||
"Inject Integrations Patch",
|
||||
@ -80,7 +84,7 @@ class IntegrationsPatch : Patch(
|
||||
)
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
override fun execute(data: BytecodeData): PatchResult {
|
||||
val result = signatures.first().result!!
|
||||
|
||||
val implementation = result.method.implementation!!
|
||||
|
Loading…
Reference in New Issue
Block a user