update to new api

This commit is contained in:
oSumAtrIX 2026-02-05 00:52:45 +01:00
parent 9c69244323
commit 1ff148d49f
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
7 changed files with 16 additions and 17 deletions

View file

@ -1,6 +1,6 @@
package app.revanced.patches.reddit.customclients.baconreader.api
import app.revanced.patcher.Match
import app.revanced.patcher.CompositeMatch
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patches.reddit.customclients.spoofClientPatch
@ -22,7 +22,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "http://baconreader.com/au
val clientId by clientIdOption
apply {
fun Match.patch(replacementString: String) {
fun CompositeMatch.patch(replacementString: String) {
val clientIdIndex = get(0)
val clientIdRegister = method.getInstruction<OneRegisterInstruction>(clientIdIndex).registerA

View file

@ -1,6 +1,6 @@
package app.revanced.patches.reddit.customclients.redditisfun.api
import app.revanced.patcher.Match
import app.revanced.patcher.CompositeMatch
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patches.reddit.customclients.spoofClientPatch
@ -28,9 +28,9 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { cl
*
* @param string The string to replace the instruction with.
* @param getReplacementIndex A function that returns the index of the instruction to replace
* using the [Match.indices] list from the [Match].
* using the [CompositeMatch.indices] list from the [CompositeMatch].
*/
fun Match.replaceWith(
fun CompositeMatch.replaceWith(
string: String,
getReplacementIndex: List<Int>.() -> Int,
) = method.apply {

View file

@ -1,7 +1,6 @@
package app.revanced.patches.shared.misc.privacy
import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod
import app.revanced.patcher.Match
import app.revanced.patcher.CompositeMatch
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.patch.BytecodePatchBuilder
@ -61,7 +60,7 @@ internal fun sanitizeSharingLinksPatch(
)
fun Match.hookUrlString(matchIndex: Int) {
fun CompositeMatch.hookUrlString(matchIndex: Int) {
val index = get(matchIndex)
val urlRegister = method.getInstruction<OneRegisterInstruction>(index).registerA
@ -74,7 +73,7 @@ internal fun sanitizeSharingLinksPatch(
)
}
fun Match.hookIntentPutExtra(matchIndex: Int) {
fun CompositeMatch.hookIntentPutExtra(matchIndex: Int) {
val index = get(matchIndex)
val urlRegister = method.getInstruction<FiveRegisterInstruction>(index).registerE

View file

@ -1,6 +1,6 @@
package app.revanced.patches.twitter.interaction.downloads
import app.revanced.patcher.Match
import app.revanced.patcher.CompositeMatch
import app.revanced.patcher.extensions.*
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.Opcode
@ -15,7 +15,7 @@ val unlockDownloadsPatch = bytecodePatch(
compatibleWith("com.twitter.android")
apply {
fun Match.patch(getRegisterAndIndex: Match.() -> Pair<Int, Int>) {
fun CompositeMatch.patch(getRegisterAndIndex: CompositeMatch.() -> Pair<Int, Int>) {
val (index, register) = getRegisterAndIndex()
method.addInstruction(index, "const/4 v$register, 0x1")
}

View file

@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.hide.general
import app.revanced.patcher.Match
import app.revanced.patcher.CompositeMatch
import app.revanced.patcher.extensions.*
import app.revanced.patcher.immutableClassDef
import app.revanced.patcher.patch.resourcePatch
@ -386,11 +386,11 @@ val hideLayoutComponentsPatch = hideLayoutComponentsPatch(
* Patch a [Method] with a given [instructions].
*
* @param RegisterInstruction The type of instruction to get the register from.
* @param insertIndexOffset The offset to add to the end index of the [Match.indices].
* @param insertIndexOffset The offset to add to the end index of the [CompositeMatch.indices].
* @param hookRegisterOffset The offset to add to the register of the hook.
* @param instructions The instructions to add with the register as a parameter.
*/
fun <RegisterInstruction : OneRegisterInstruction> Match.patch(
fun <RegisterInstruction : OneRegisterInstruction> CompositeMatch.patch(
insertIndexOffset: Int = 0,
hookRegisterOffset: Int = 0,
instructions: (Int) -> String,

View file

@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.player.fullscreen
import app.revanced.patcher.Match
import app.revanced.patcher.CompositeMatch
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
@ -25,7 +25,7 @@ internal val openVideosFullscreenHookPatch = bytecodePatch {
)
apply {
var match: Match
var match: CompositeMatch
var insertIndex: Int
if (is_19_46_or_greater) {

View file

@ -114,7 +114,7 @@ val seekbarColorPatch = bytecodePatch(
""",
)
val playerMatch: Match
val playerMatch: CompositeMatch
val checkGradientCoordinates: Boolean
if (is_19_49_or_greater) {
playerMatch = playerLinearGradientMethodMatch