fix: migrate to breaking changes from patcher

This commit is contained in:
oSumAtrIX
2022-06-20 21:29:19 +02:00
parent 8e86d9e6cb
commit 2c0a4196fe
18 changed files with 46 additions and 39 deletions

View File

@ -11,7 +11,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
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.misc.integrations.patch.IntegrationsPatch
@ -26,14 +25,14 @@ class HideCastButtonPatch : BytecodePatch(listOf()) {
data.classes.forEach { classDef ->
classDef.methods.forEach { method ->
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
val implementation =
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }.implementation!!
val setVisibilityMethod =
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }
implementation.addInstructions(
setVisibilityMethod.addInstructions(
0, """
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
move-result p1
""".trimIndent().toInstructions("I", 2, false)
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
move-result p1
"""
)
}
}

View File

@ -29,7 +29,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
)
) {
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
val implementation = result.method.implementation!!

View File

@ -27,7 +27,7 @@ class MinimizedPlaybackPatch : BytecodePatch(
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(
MinimizedPlaybackManagerSignature.result!!.method.implementation!!.addInstructions(
0, """
const/4 v0, 0x1
return v0

View File

@ -35,7 +35,7 @@ class OldQualityLayoutPatch : BytecodePatch(
)
) {
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"
) @FuzzyPatternScanMethod(2) @OldQualityLayoutCompatibility @Version("0.0.1") object : MethodSignature(
"L", AccessFlags.FINAL or AccessFlags.PRIVATE, listOf("Z"), listOf(

View File

@ -22,7 +22,7 @@ class HideReelsPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
val result = signatures.first().result!!
val result = HideReelsSignature.result!!
val implementation = result.method.implementation!!
// HideReel will hide the reel view before it is being used,

View File

@ -28,12 +28,12 @@ class ShortsButtonRemoverPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
val result1 = signatures.first().result!!
val result1 = PivotBarButtonTabenumSignature.result!!
val implementation1 = result1.method.implementation!!
val moveEnumInstruction = implementation1.instructions[result1.scanResult.endIndex]
val enumRegister = (moveEnumInstruction as Instruction11x).registerA
val result2 = signatures.last().result!!
val result2 = PivotBarButtonsViewSignature.result!!
val implementation2 = result2.method.implementation!!
val moveViewInstruction = implementation2.instructions[result2.scanResult.endIndex]
val viewRegister = (moveViewInstruction as Instruction11x).registerA