fix: migrate to breaking changes from patcher
This commit is contained in:
parent
8e86d9e6cb
commit
2c0a4196fe
|
@ -18,7 +18,7 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:1.2.8")
|
implementation("app.revanced:revanced-patcher:1.3.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
|
@ -25,13 +25,13 @@ class CodecsUnlockPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
var result = signatures.first().result!!
|
var result = CodecsLockSignature.result!!
|
||||||
|
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
|
|
||||||
val instructionIndex = result.scanResult.startIndex
|
val instructionIndex = result.scanResult.startIndex
|
||||||
|
|
||||||
result = signatures.last().result!!
|
result = AllCodecsReferenceSignature.result!!
|
||||||
val codecMethod =
|
val codecMethod =
|
||||||
data.toMethodWalker(result.immutableMethod).nextMethod(result.scanResult.startIndex).getMethod()
|
data.toMethodWalker(result.immutableMethod).nextMethod(result.scanResult.startIndex).getMethod()
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class ExclusiveAudioPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = signatures.first().result!!.findParentMethod(@Name("audio-only-enabler-method") @MatchingMethod(
|
val result = ExclusiveAudioSignature.result!!.findParentMethod(@Name("audio-only-enabler-method") @MatchingMethod(
|
||||||
"Lgmd;",
|
"Lgmd;",
|
||||||
"d"
|
"d"
|
||||||
) @DirectPatternScanMethod @ExclusiveAudioCompatibility @Version(
|
) @DirectPatternScanMethod @ExclusiveAudioCompatibility @Version(
|
||||||
|
|
|
@ -25,20 +25,18 @@ class RemoveTasteBuilderPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = signatures.first().result!!
|
val result = TasteBuilderConstructorSignature.result!!
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
|
|
||||||
val insertIndex = result.scanResult.endIndex - 8
|
val insertIndex = result.scanResult.endIndex - 8
|
||||||
|
|
||||||
val register = (implementation.instructions[insertIndex] as Instruction22c).registerA
|
val register = (implementation.instructions[insertIndex] as Instruction22c).registerA
|
||||||
|
|
||||||
val instructionList = """
|
result.method.addInstructions(
|
||||||
|
insertIndex, """
|
||||||
const/16 v1, 0x8
|
const/16 v1, 0x8
|
||||||
invoke-virtual {v${register}, v1}, Landroid/view/View;->setVisibility(I)V
|
invoke-virtual {v${register}, v1}, Landroid/view/View;->setVisibility(I)V
|
||||||
""".trimIndent().toInstructions().toMutableList()
|
"""
|
||||||
|
|
||||||
implementation.addInstructions(
|
|
||||||
insertIndex, instructionList
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|
|
@ -29,7 +29,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = signatures.first().result!!
|
val result = PivotBarConstructorSignature.result!!
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
|
|
||||||
val pivotBarElementFieldRef =
|
val pivotBarElementFieldRef =
|
||||||
|
|
|
@ -24,7 +24,7 @@ class BackgroundPlayPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
signatures.first().result!!.method.implementation!!.addInstructions(
|
BackgroundPlaybackDisableSignature.result!!.method.implementation!!.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
const/4 v0, 0x1
|
const/4 v0, 0x1
|
||||||
|
|
|
@ -242,25 +242,23 @@ class GeneralBytecodeAdsPatch : BytecodePatch(
|
||||||
BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel)
|
BuilderInstruction21t(Opcode.IF_EQZ, 1, lithoRemoveLabel)
|
||||||
|
|
||||||
// create blocks
|
// create blocks
|
||||||
val parameters = lithoMethod.parameterTypes.joinToString("") { it }
|
|
||||||
val registers = lithoMethodImplementation.registerCount
|
|
||||||
val block1 = """
|
val block1 = """
|
||||||
invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String;
|
invoke-static/range {p3}, $thisType->getTemplateName($templateNameParameterType)Ljava/lang/String;
|
||||||
move-result-object v0
|
move-result-object v0
|
||||||
""".trimIndent().toInstructions(parameters, registers, false)
|
""".trimIndent().toInstructions(lithoMethod)
|
||||||
val block2 = """
|
val block2 = """
|
||||||
move-object/from16 v1, p3
|
move-object/from16 v1, p3
|
||||||
iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer;
|
iget-object v2, v1, $templateNameParameterType->b:Ljava/nio/ByteBuffer;
|
||||||
invoke-static {v0, v2}, Lfi/razerman/youtube/litho/LithoAdRemoval;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
|
invoke-static {v0, v2}, Lfi/razerman/youtube/litho/LithoAdRemoval;->containsAd(Ljava/lang/String;Ljava/nio/ByteBuffer;)Z
|
||||||
move-result v1
|
move-result v1
|
||||||
""".trimIndent().toInstructions(parameters, registers, false)
|
""".trimIndent().toInstructions(lithoMethod)
|
||||||
val block3 = """
|
val block3 = """
|
||||||
move-object/from16 v2, p1
|
move-object/from16 v2, p1
|
||||||
invoke-static {v2}, $descriptor1
|
invoke-static {v2}, $descriptor1
|
||||||
move-result-object v0
|
move-result-object v0
|
||||||
iget-object v0, v0, $descriptor2
|
iget-object v0, v0, $descriptor2
|
||||||
return-object v0
|
return-object v0
|
||||||
""".trimIndent().toInstructions(parameters, registers, false)
|
""".trimIndent().toInstructions(lithoMethod)
|
||||||
|
|
||||||
// insert blocks and branch instructions
|
// insert blocks and branch instructions
|
||||||
lithoMethodImplementation.insertBlocks(
|
lithoMethodImplementation.insertBlocks(
|
||||||
|
|
|
@ -34,7 +34,7 @@ class VideoAdsPatch : BytecodePatch(
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result =
|
val result =
|
||||||
signatures.first().result!!.findParentMethod(@Name("show-video-ads-method-signature") @MatchingMethod(
|
ShowVideoAdsConstructorSignature.result!!.findParentMethod(@Name("show-video-ads-method-signature") @MatchingMethod(
|
||||||
definingClass = "zai"
|
definingClass = "zai"
|
||||||
) @DirectPatternScanMethod @VideoAdsCompatibility @Version("0.0.1") object : MethodSignature(
|
) @DirectPatternScanMethod @VideoAdsCompatibility @Version("0.0.1") object : MethodSignature(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), null
|
||||||
|
|
|
@ -34,7 +34,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
var result = signatures.first().result!!
|
var result = SeekbarTappingParentSignature.result!!
|
||||||
|
|
||||||
val tapSeekMethods = mutableMapOf<String, Method>()
|
val tapSeekMethods = mutableMapOf<String, Method>()
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace map because we dont need the upper one anymore
|
// replace map because we dont need the upper one anymore
|
||||||
result = signatures.last().result!!
|
result = SeekbarTappingSignature.result!!
|
||||||
|
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ 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
|
||||||
import app.revanced.patcher.util.smali.toInstructions
|
|
||||||
import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
|
import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
|
||||||
|
@ -26,14 +25,14 @@ class HideCastButtonPatch : BytecodePatch(listOf()) {
|
||||||
data.classes.forEach { classDef ->
|
data.classes.forEach { classDef ->
|
||||||
classDef.methods.forEach { method ->
|
classDef.methods.forEach { method ->
|
||||||
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
|
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
|
||||||
val implementation =
|
val setVisibilityMethod =
|
||||||
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }.implementation!!
|
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }
|
||||||
|
|
||||||
implementation.addInstructions(
|
setVisibilityMethod.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
|
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
|
||||||
move-result p1
|
move-result p1
|
||||||
""".trimIndent().toInstructions("I", 2, false)
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = signatures.first().result!!
|
val result = CreateButtonSignature.result!!
|
||||||
|
|
||||||
// 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!!
|
||||||
|
|
|
@ -27,7 +27,7 @@ class MinimizedPlaybackPatch : BytecodePatch(
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): 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
|
||||||
signatures.first().result!!.method.implementation!!.addInstructions(
|
MinimizedPlaybackManagerSignature.result!!.method.implementation!!.addInstructions(
|
||||||
0, """
|
0, """
|
||||||
const/4 v0, 0x1
|
const/4 v0, 0x1
|
||||||
return v0
|
return v0
|
||||||
|
|
|
@ -35,7 +35,7 @@ class OldQualityLayoutPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = signatures.first().result!!.findParentMethod(@Name("old-quality-signature") @MatchingMethod(
|
val result = OldQualityParentSignature.result!!.findParentMethod(@Name("old-quality-signature") @MatchingMethod(
|
||||||
definingClass = "Libh"
|
definingClass = "Libh"
|
||||||
) @FuzzyPatternScanMethod(2) @OldQualityLayoutCompatibility @Version("0.0.1") object : MethodSignature(
|
) @FuzzyPatternScanMethod(2) @OldQualityLayoutCompatibility @Version("0.0.1") object : MethodSignature(
|
||||||
"L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf(
|
"L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf(
|
||||||
|
|
|
@ -22,7 +22,7 @@ class HideReelsPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result = signatures.first().result!!
|
val result = HideReelsSignature.result!!
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
|
|
||||||
// HideReel will hide the reel view before it is being used,
|
// HideReel will hide the reel view before it is being used,
|
||||||
|
|
|
@ -28,12 +28,12 @@ class ShortsButtonRemoverPatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val result1 = signatures.first().result!!
|
val result1 = PivotBarButtonTabenumSignature.result!!
|
||||||
val implementation1 = result1.method.implementation!!
|
val implementation1 = result1.method.implementation!!
|
||||||
val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex]
|
val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex]
|
||||||
val enumRegister = (moveEnumInstruction as Instruction11x).registerA
|
val enumRegister = (moveEnumInstruction as Instruction11x).registerA
|
||||||
|
|
||||||
val result2 = signatures.last().result!!
|
val result2 = PivotBarButtonsViewSignature.result!!
|
||||||
val implementation2 = result2.method.implementation!!
|
val implementation2 = result2.method.implementation!!
|
||||||
val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex]
|
val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex]
|
||||||
val viewRegister = (moveViewInstruction as Instruction11x).registerA
|
val viewRegister = (moveViewInstruction as Instruction11x).registerA
|
||||||
|
|
|
@ -31,7 +31,7 @@ class IntegrationsPatch : BytecodePatch(
|
||||||
if (data.findClass("Lapp/revanced/integrations/Globals") == null)
|
if (data.findClass("Lapp/revanced/integrations/Globals") == null)
|
||||||
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
|
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
|
||||||
|
|
||||||
val result = signatures.first().result!!
|
val result = InitSignature.result!!
|
||||||
|
|
||||||
val implementation = result.method.implementation!!
|
val implementation = result.method.implementation!!
|
||||||
val count = implementation.registerCount - 1
|
val count = implementation.registerCount - 1
|
||||||
|
|
|
@ -16,6 +16,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||||
import app.revanced.patcher.util.smali.toInstruction
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import app.revanced.patcher.util.smali.toInstructions
|
import app.revanced.patcher.util.smali.toInstructions
|
||||||
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
|
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||||
import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch
|
import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
|
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
|
||||||
|
@ -31,7 +32,11 @@ import org.jf.dexlib2.immutable.reference.ImmutableStringReference
|
||||||
|
|
||||||
@Patch(include = false)
|
@Patch(include = false)
|
||||||
@Dependencies(
|
@Dependencies(
|
||||||
dependencies = [MicroGResourcePatch::class, HideCastButtonPatch::class]
|
dependencies = [
|
||||||
|
MicroGResourcePatch::class,
|
||||||
|
HideCastButtonPatch::class,
|
||||||
|
FixLocaleConfigErrorPatch::class
|
||||||
|
]
|
||||||
)
|
)
|
||||||
@Name("microg-support")
|
@Name("microg-support")
|
||||||
@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.")
|
||||||
|
@ -115,13 +120,19 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signatures.last()
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun disablePlayServiceChecksAndFixCastIssues() {
|
private fun disablePlayServiceChecksAndFixCastIssues() {
|
||||||
for (i in 0 until signatures.count() - 1) {
|
listOf(
|
||||||
val result = signatures.elementAt(i).result!!
|
IntegrityCheckSignature,
|
||||||
|
ServiceCheckSignature,
|
||||||
|
GooglePlayUtilitySignature,
|
||||||
|
CastDynamiteModuleSignature,
|
||||||
|
CastDynamiteModuleV2Signature,
|
||||||
|
CastContextFetchSignature
|
||||||
|
).forEach { signature ->
|
||||||
|
val result = signature.result!!
|
||||||
val stringInstructions = when (result.immutableMethod.returnType.first()) {
|
val stringInstructions = when (result.immutableMethod.returnType.first()) {
|
||||||
'L' -> """
|
'L' -> """
|
||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
|
@ -141,7 +152,7 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val implementation = signatures.last().result!!.method.implementation!!
|
val implementation = PrimeSignature.result!!.method.implementation!!
|
||||||
|
|
||||||
var register = 2
|
var register = 2
|
||||||
val index = implementation.instructions.indexOfFirst {
|
val index = implementation.instructions.indexOfFirst {
|
||||||
|
|
|
@ -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.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
|
||||||
|
|
Loading…
Reference in a new issue