mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-01 04:52:57 +01:00
refactor: make patches compatible with breaking changes of the patcher
also commented HideSuggestionsPatch.kt so warnings suppressed
This commit is contained in:
parent
2d3d72009e
commit
0acdf89ae9
@ -1,14 +1,14 @@
|
||||
package app.revanced.patches.ad
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.*
|
||||
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.asInstructions
|
||||
import app.revanced.patcher.smali.toInstructions
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -94,7 +94,7 @@ class VideoAdsPatch : Patch(
|
||||
"""
|
||||
invoke-static { }, Lfi/vanced/libraries/youtube/whitelisting/Whitelist;->shouldShowAds()Z
|
||||
move-result v1
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.interaction
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.PatchMetadata
|
||||
@ -11,7 +11,7 @@ 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.asInstructions
|
||||
import app.revanced.patcher.smali.toInstructions
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||
@ -162,7 +162,7 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
"""
|
||||
invoke-virtual { v12, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
|
||||
invoke-virtual { v12, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
|
||||
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
|
||||
@ -176,7 +176,7 @@ class EnableSeekbarTappingPatch : Patch(
|
||||
"""
|
||||
invoke-static { }, Lfi/razerman/youtube/preferences/BooleanPreferences;->isTapSeekingEnabled()Z
|
||||
move-result v0
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.PatchMetadata
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -10,7 +10,7 @@ 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.asInstruction
|
||||
import app.revanced.patcher.smali.toInstruction
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -80,7 +80,7 @@ class CreateButtonRemoverPatch : Patch(
|
||||
// Hide the button view via proxy by passing it to the hideCreateButton method
|
||||
result.method.implementation!!.addInstruction(
|
||||
result.scanData.endIndex,
|
||||
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".asInstruction()
|
||||
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->hideCreateButton(Landroid/view/View;)V".toInstruction()
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.patch.PatchMetadata
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
@ -10,7 +10,7 @@ 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.asInstruction
|
||||
import app.revanced.patcher.smali.toInstruction
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -101,7 +101,7 @@ class HideReelsPatch : Patch(
|
||||
// so we pass the view to the HideReel method
|
||||
implementation.addInstruction(
|
||||
result.scanData.endIndex - 1,
|
||||
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".asInstruction()
|
||||
"invoke-static { v2 }, Lfi/razerman/youtube/XAdRemover;->HideReel(Landroid/view/View;)V".toInstruction()
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
|
@ -1,23 +1,14 @@
|
||||
package app.revanced.patches.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
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.asInstructions
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
|
||||
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
|
||||
|
||||
private val compatiblePackages = listOf("com.google.android.youtube")
|
||||
|
||||
@ -72,6 +63,8 @@ class HideSuggestionsPatch : Patch(
|
||||
)
|
||||
) {
|
||||
override fun execute(patcherData: PatcherData): PatchResult {
|
||||
return PatchResultSuccess() // FIXME: fix below
|
||||
/*
|
||||
val result = signatures.first().result!!.findParentMethod(
|
||||
MethodSignature(
|
||||
methodSignatureMetadata = MethodSignatureMetadata(
|
||||
@ -117,8 +110,6 @@ class HideSuggestionsPatch : Patch(
|
||||
|
||||
val clonedImplementation = clonedMethod.implementation!!
|
||||
|
||||
return PatchResultSuccess() // TODO: fix below
|
||||
|
||||
// fix the instructions registers
|
||||
clonedImplementation.instructions.forEachIndexed { index, it ->
|
||||
val opcode = it.opcode
|
||||
@ -166,8 +157,9 @@ class HideSuggestionsPatch : Patch(
|
||||
move-result-object v0
|
||||
invoke-virtual/range { v0 .. v0 }, Ljava/lang/Boolean;->booleanValue()Z
|
||||
move-result v2
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
package app.revanced.patches.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.*
|
||||
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.asInstructions
|
||||
import app.revanced.patcher.smali.toInstructions
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
@ -73,7 +73,7 @@ class MinimizedPlaybackPatch : Patch(
|
||||
"""
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package app.revanced.patches.layout
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.*
|
||||
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.asInstructions
|
||||
import app.revanced.patcher.smali.toInstructions
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction21t
|
||||
@ -110,7 +110,7 @@ class OldQualityLayoutPatch : Patch(
|
||||
"""
|
||||
invoke-static { }, Lfi/razerman/youtube/XGlobals;->useOldStyleQualitySettings()Z
|
||||
move-result v0
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.misc
|
||||
|
||||
import app.revanced.patcher.PatcherData
|
||||
import app.revanced.patcher.extensions.AccessFlagExtensions.Companion.or
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
@ -9,7 +9,7 @@ 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.asInstructions
|
||||
import app.revanced.patcher.smali.toInstructions
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||
@ -86,7 +86,7 @@ class IntegrationsPatch : Patch(
|
||||
"""
|
||||
invoke-static {v$count}, Lpl/jakubweg/StringRef;->setContext(Landroid/content/Context;)V
|
||||
sput-object v$count, Lapp/revanced/integrations/Globals;->context:Landroid/content/Context;
|
||||
""".trimIndent().asInstructions()
|
||||
""".trimIndent().toInstructions()
|
||||
)
|
||||
|
||||
val classDef = result.definingClassProxy.resolve()
|
||||
@ -105,7 +105,7 @@ class IntegrationsPatch : Patch(
|
||||
invoke-static { }, Lapp/revanced/integrations/Globals;->getAppContext()Landroid/content/Context;
|
||||
move-result-object v0
|
||||
return-object v0
|
||||
""".trimIndent().asInstructions(),
|
||||
""".trimIndent().toInstructions(),
|
||||
null,
|
||||
null
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user