mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-12 12:23:56 +01:00
Compare commits
5 Commits
v1.0.0-dev
...
v1.0.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d99df6f31 | ||
|
|
62c6543485 | ||
|
|
39cf505d84 | ||
|
|
f55ad46322 | ||
|
|
a91432f6ca |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
|||||||
|
# [1.0.0-dev.13](https://github.com/revanced/revanced-patches/compare/v1.0.0-dev.12...v1.0.0-dev.13) (2022-05-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* migrate patches to latest patcher api changes ([8a0ee03](https://github.com/revanced/revanced-patches/commit/8a0ee03a71cf4a000c9a7246d0e64ed8291a5127))
|
||||||
|
* missing extension method `doRecursively` ([e9c9460](https://github.com/revanced/revanced-patches/commit/e9c946008ee912652d288e515b83b52ae2d239d8))
|
||||||
|
|
||||||
|
# [1.0.0-dev.12](https://github.com/revanced/revanced-patches/compare/v1.0.0-dev.11...v1.0.0-dev.12) (2022-05-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* wrong annotation and signature in patches ([a0fdee8](https://github.com/revanced/revanced-patches/commit/a0fdee81a6d6773603520e7c3040ae8637642d58))
|
||||||
|
|
||||||
# [1.0.0-dev.11](https://github.com/revanced/revanced-patches/compare/v1.0.0-dev.10...v1.0.0-dev.11) (2022-05-26)
|
# [1.0.0-dev.11](https://github.com/revanced/revanced-patches/compare/v1.0.0-dev.10...v1.0.0-dev.11) (2022-05-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:1.0.0-dev.16")
|
implementation("app.revanced:revanced-patcher:1.0.0-dev.17")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.21")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.21")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 1.0.0-dev.11
|
version = 1.0.0-dev.13
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package app.revanced.extensions
|
|||||||
|
|
||||||
import app.revanced.patcher.util.smali.toInstruction
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||||
|
import org.w3c.dom.Node
|
||||||
|
|
||||||
internal fun MutableMethodImplementation.injectHideCall(
|
internal fun MutableMethodImplementation.injectHideCall(
|
||||||
index: Int,
|
index: Int,
|
||||||
@@ -13,6 +14,11 @@ internal fun MutableMethodImplementation.injectHideCall(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun Node.doRecursively(action: (Node) -> Unit) {
|
||||||
|
action(this)
|
||||||
|
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
|
||||||
|
}
|
||||||
|
|
||||||
internal fun String.startsWithAny(vararg prefix: String): Boolean {
|
internal fun String.startsWithAny(vararg prefix: String): Boolean {
|
||||||
for (_prefix in prefix)
|
for (_prefix in prefix)
|
||||||
if (this.startsWith(_prefix))
|
if (this.startsWith(_prefix))
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ class CodecsUnlockPatch : BytecodePatch(
|
|||||||
val instructionIndex = result.scanResult.startIndex
|
val instructionIndex = result.scanResult.startIndex
|
||||||
|
|
||||||
result = signatures.last().result!!
|
result = signatures.last().result!!
|
||||||
val codecMethod = data.toMethodWalker(result.immutableMethod).walk(result.scanResult.startIndex).getMethod()
|
val codecMethod =
|
||||||
|
data.toMethodWalker(result.immutableMethod).nextMethod(result.scanResult.startIndex).getMethod()
|
||||||
|
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
instructionIndex,
|
instructionIndex,
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ 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.data.implementation.toMethodWalker
|
import app.revanced.patcher.data.implementation.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
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
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||||
@@ -23,7 +23,7 @@ import org.jf.dexlib2.AccessFlags
|
|||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.formats.Instruction11x
|
import org.jf.dexlib2.iface.instruction.formats.Instruction11x
|
||||||
|
|
||||||
@Patch
|
//@Patch(dependencies = [IntegrationsPatch::class])
|
||||||
@Name("home-promo-ads")
|
@Name("home-promo-ads")
|
||||||
@Description("Patch to remove promoted ads in YouTube.")
|
@Description("Patch to remove promoted ads in YouTube.")
|
||||||
@PromotionsCompatibility
|
@PromotionsCompatibility
|
||||||
@@ -47,14 +47,14 @@ class PromotionsPatch : BytecodePatch(
|
|||||||
val toBePatchedInvokeOffset =
|
val toBePatchedInvokeOffset =
|
||||||
requiredMethod.immutableMethod.implementation!!.instructions.indexOfFirst { it.opcode == Opcode.INVOKE_DIRECT }
|
requiredMethod.immutableMethod.implementation!!.instructions.indexOfFirst { it.opcode == Opcode.INVOKE_DIRECT }
|
||||||
val toBePatchedMethod =
|
val toBePatchedMethod =
|
||||||
data.toMethodWalker(requiredMethod.immutableMethod).walk(toBePatchedInvokeOffset, true)
|
data.toMethodWalker(requiredMethod.immutableMethod).nextMethod(toBePatchedInvokeOffset, true)
|
||||||
.getMethod() as MutableMethod
|
.getMethod() as MutableMethod
|
||||||
|
|
||||||
val implementation = toBePatchedMethod.implementation!!
|
val implementation = toBePatchedMethod.implementation!!
|
||||||
val invokeVirtualOffset = implementation.instructions.indexOfFirst { it.opcode == Opcode.INVOKE_VIRTUAL }
|
val invokeVirtualOffset = implementation.instructions.indexOfFirst { it.opcode == Opcode.INVOKE_VIRTUAL }
|
||||||
|
|
||||||
val moveResultInstruction = implementation.instructions[invokeVirtualOffset + 1]
|
val moveResultInstruction = implementation.instructions[invokeVirtualOffset + 1]
|
||||||
if (moveResultInstruction.opcode != Opcode.MOVE_RESULT_OBJECT) return PatchResultError("The toBePatchedInvokeOffset offset was wrong in ${(this::class.annotations.find { it is Name } as Name).name}")
|
if (moveResultInstruction.opcode != Opcode.MOVE_RESULT_OBJECT) return PatchResultError("The toBePatchedInvokeOffset offset was wrong in ${this.javaClass.patchName}")
|
||||||
|
|
||||||
val register = (moveResultInstruction as Instruction11x).registerA
|
val register = (moveResultInstruction as Instruction11x).registerA
|
||||||
implementation.injectHideCall(invokeVirtualOffset + 2, register)
|
implementation.injectHideCall(invokeVirtualOffset + 2, register)
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ import app.revanced.patcher.signature.implementation.method.annotation.MatchingM
|
|||||||
import app.revanced.patcher.util.smali.toInstructions
|
import app.revanced.patcher.util.smali.toInstructions
|
||||||
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.signatures.ShowVideoAdsConstructorSignature
|
import app.revanced.patches.youtube.ad.video.signatures.ShowVideoAdsConstructorSignature
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
@Patch
|
@Patch(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
|
||||||
@@ -37,7 +38,6 @@ class VideoAdsPatch : BytecodePatch(
|
|||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
|
||||||
) {}) ?: return PatchResultError("Required parent method could not be found.")
|
) {}) ?: return PatchResultError("Required parent method could not be found.")
|
||||||
|
|
||||||
|
|
||||||
// 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
|
||||||
result.method.implementation!!.addInstructions(
|
result.method.implementation!!.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import app.revanced.patcher.util.smali.toInstructions
|
|||||||
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.signatures.SeekbarTappingParentSignature
|
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingParentSignature
|
||||||
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingSignature
|
import app.revanced.patches.youtube.interaction.seekbar.signatures.SeekbarTappingSignature
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
import org.jf.dexlib2.iface.Method
|
import org.jf.dexlib2.iface.Method
|
||||||
@@ -21,7 +22,7 @@ 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])
|
||||||
@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
|
||||||
|
|||||||
@@ -9,10 +9,15 @@ import app.revanced.patcher.patch.implementation.ResourcePatch
|
|||||||
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
|
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Patch
|
@Patch(
|
||||||
|
dependencies = [
|
||||||
|
FixLocaleConfigErrorPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
@Name("amoled")
|
@Name("amoled")
|
||||||
@Description("Enables pure black theme.")
|
@Description("Enables pure black theme.")
|
||||||
@AmoledCompatibility
|
@AmoledCompatibility
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
|||||||
import app.revanced.patcher.util.smali.toInstruction
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility
|
import app.revanced.patches.youtube.layout.createbutton.annotations.CreateButtonCompatibility
|
||||||
import app.revanced.patches.youtube.layout.createbutton.signatures.CreateButtonSignature
|
import app.revanced.patches.youtube.layout.createbutton.signatures.CreateButtonSignature
|
||||||
|
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
|
@Patch(dependencies = [IntegrationsPatch::class])
|
||||||
@Name("disable-create-button")
|
@Name("disable-create-button")
|
||||||
@Description("Disable the create button.")
|
@Description("Disable the create button.")
|
||||||
@CreateButtonCompatibility
|
@CreateButtonCompatibility
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import app.revanced.patches.youtube.layout.minimizedplayback.signatures.Minimize
|
|||||||
@Description("Enable minimized and background playback.")
|
@Description("Enable minimized and background playback.")
|
||||||
@MinimizedPlaybackCompatibility
|
@MinimizedPlaybackCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
|
|
||||||
class MinimizedPlaybackPatch : BytecodePatch(
|
class MinimizedPlaybackPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
MinimizedPlaybackManagerSignature
|
MinimizedPlaybackManagerSignature
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ import app.revanced.patcher.signature.implementation.method.annotation.MatchingM
|
|||||||
import app.revanced.patcher.util.smali.toInstructions
|
import app.revanced.patcher.util.smali.toInstructions
|
||||||
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
|
import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQualityLayoutCompatibility
|
||||||
import app.revanced.patches.youtube.layout.oldqualitylayout.signatures.OldQualityParentSignature
|
import app.revanced.patches.youtube.layout.oldqualitylayout.signatures.OldQualityParentSignature
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
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
|
||||||
|
|
||||||
@Patch
|
@Patch(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
|
||||||
|
|||||||
@@ -12,9 +12,10 @@ import app.revanced.patcher.util.smali.toInstruction
|
|||||||
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
|
import app.revanced.patches.youtube.layout.shorts.button.annotations.ShortsButtonCompatibility
|
||||||
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonTabenumSignature
|
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonTabenumSignature
|
||||||
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonsViewSignature
|
import app.revanced.patches.youtube.layout.shorts.button.signatures.PivotBarButtonsViewSignature
|
||||||
|
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
|
@Patch(dependencies = [IntegrationsPatch::class])
|
||||||
@Name("shorts-button")
|
@Name("shorts-button")
|
||||||
@Description("Hide the shorts button.")
|
@Description("Hide the shorts button.")
|
||||||
@ShortsButtonCompatibility
|
@ShortsButtonCompatibility
|
||||||
|
|||||||
@@ -6,29 +6,31 @@ 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.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
|
||||||
|
import app.revanced.patcher.patch.implementation.misc.PatchResultError
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patcher.util.smali.toInstructions
|
import app.revanced.patcher.util.smali.toInstructions
|
||||||
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.microg.signatures.IntegrityCheckSignature
|
import app.revanced.patches.youtube.misc.integrations.signatures.InitSignature
|
||||||
import org.jf.dexlib2.AccessFlags
|
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
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("integrations")
|
@Name("integrations")
|
||||||
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
||||||
@IntegrationsCompatibility
|
@IntegrationsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class IntegrationsPatch : BytecodePatch(
|
class IntegrationsPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
IntegrityCheckSignature
|
InitSignature
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
if (data.findClass("Lapp/revanced/integrations/Globals") == null)
|
||||||
|
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
|
||||||
|
|
||||||
val result = signatures.first().result!!
|
val result = signatures.first().result!!
|
||||||
|
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
|
|||||||
@@ -4,17 +4,15 @@ 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.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
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
import app.revanced.patches.youtube.misc.manifest.annotations.FixLocaleConfigErrorCompatibility
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("locale-config-fix")
|
@Name("locale-config-fix")
|
||||||
@Description("Fix an error when building the resources by patching the manifest file.")
|
@Description("Fix an error when building the resources by patching the manifest file.")
|
||||||
@MicroGPatchCompatibility
|
@FixLocaleConfigErrorCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class FixLocaleConfigErrorPatch : ResourcePatch() {
|
class FixLocaleConfigErrorPatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.mapping.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.doRecursively
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.implementation.ResourceData
|
||||||
|
import app.revanced.patcher.patch.implementation.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||||
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Name("resource-id-mapping-provider-resource-patch-dependency")
|
||||||
|
@Description("This patch works as a acts as a provider for resources mapped to their ids.")
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ResourceIdMappingProviderResourcePatch : ResourcePatch() {
|
||||||
|
companion object {
|
||||||
|
internal lateinit var resourceMappings: Map<String, Long>
|
||||||
|
private set
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
data.getXmlEditor("res/values/public.xml").use { editor ->
|
||||||
|
resourceMappings = buildMap {
|
||||||
|
editor.file.documentElement.doRecursively { node ->
|
||||||
|
if (node !is Element) return@doRecursively
|
||||||
|
val nameAttribute = node.getAttribute("name")
|
||||||
|
if (node.nodeName != "public" || nameAttribute.startsWith("APKTOOL")) return@doRecursively
|
||||||
|
this[nameAttribute] = node.getAttribute("id").substring(2).toLong(16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import app.revanced.patcher.data.implementation.BytecodeData
|
|||||||
import app.revanced.patcher.data.implementation.proxy
|
import app.revanced.patcher.data.implementation.proxy
|
||||||
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.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
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
@@ -35,7 +34,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction21c
|
|||||||
import org.jf.dexlib2.iface.reference.StringReference
|
import org.jf.dexlib2.iface.reference.StringReference
|
||||||
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
||||||
|
|
||||||
@Patch
|
// @Patch TODO: finish patch
|
||||||
@Name("microg-bytecode-patch")
|
@Name("microg-bytecode-patch")
|
||||||
@Description("Patch to allow YouTube ReVanced to run without root and under a different package name.")
|
@Description("Patch to allow YouTube ReVanced to run without root and under a different package name.")
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
@@ -136,11 +135,13 @@ class MicroGBytecodePatch : BytecodePatch(
|
|||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
return-object v0
|
return-object v0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
'V' -> "return-void"
|
'V' -> "return-void"
|
||||||
'I' -> """
|
'I' -> """
|
||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
return v0
|
return v0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
else -> throw Exception("This case should never happen.")
|
else -> throw Exception("This case should never happen.")
|
||||||
}
|
}
|
||||||
result.method.implementation!!.addInstructions(
|
result.method.implementation!!.addInstructions(
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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.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
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
@@ -12,7 +11,7 @@ import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibi
|
|||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
|
||||||
|
|
||||||
@Patch
|
// @Patch TODO: finish patch
|
||||||
@Name("microg-resource-patch")
|
@Name("microg-resource-patch")
|
||||||
@Description("Resource patch to allow YouTube ReVanced to run without root and under a different package name.")
|
@Description("Resource patch to allow YouTube ReVanced to run without root and under a different package name.")
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
|
|||||||
Reference in New Issue
Block a user