build: bump patcher dependency version to v5.0.0

This commit is contained in:
oSumAtrIX 2022-09-21 04:11:16 +02:00
parent 4270525d00
commit 4f78f5c9bf
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
27 changed files with 76 additions and 63 deletions

View File

@ -20,7 +20,7 @@ repositories {
} }
dependencies { dependencies {
implementation("app.revanced:revanced-patcher:4.4.2") implementation("app.revanced:revanced-patcher:5.0.0")
implementation("app.revanced:multidexlib2:2.5.2.r2") implementation("app.revanced:multidexlib2:2.5.2.r2")
// Required for meta // Required for meta
implementation("com.google.code.gson:gson:2.9.1") implementation("com.google.code.gson:gson:2.9.1")

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
@ -30,7 +30,7 @@ class MusicVideoAdsPatch : BytecodePatch(
val result = ShowMusicVideoAdsFingerprint.result!! val result = ShowMusicVideoAdsFingerprint.result!!
result.mutableMethod.addInstructions( result.mutableMethod.addInstructions(
result.patternScanResult!!.startIndex, """ result.scanResult.patternScanResult!!.startIndex, """
const/4 p1, 0x0 const/4 p1, 0x0
""" """
) )

View File

@ -30,7 +30,7 @@ class CodecsUnlockPatch : BytecodePatch(
val implementation = codecsLockResult.mutableMethod.implementation!! val implementation = codecsLockResult.mutableMethod.implementation!!
val scanResultStartIndex = codecsLockResult.patternScanResult!!.startIndex val scanResultStartIndex = codecsLockResult.scanResult.patternScanResult!!.startIndex
val instructionIndex = scanResultStartIndex + val instructionIndex = scanResultStartIndex +
if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) { if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) {
// for 5.16.xx and lower // for 5.16.xx and lower
@ -43,7 +43,7 @@ class CodecsUnlockPatch : BytecodePatch(
val allCodecsResult = AllCodecsReferenceFingerprint.result!! val allCodecsResult = AllCodecsReferenceFingerprint.result!!
val allCodecsMethod = val allCodecsMethod =
data.toMethodWalker(allCodecsResult.method) data.toMethodWalker(allCodecsResult.method)
.nextMethod(allCodecsResult.patternScanResult!!.startIndex) .nextMethod(allCodecsResult.scanResult.patternScanResult!!.startIndex)
.getMethod() .getMethod()
implementation.replaceInstruction( implementation.replaceInstruction(

View File

@ -6,14 +6,12 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility import app.revanced.patches.music.audio.exclusiveaudio.annotations.ExclusiveAudioCompatibility
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.ExclusiveAudioFingerprint
@Patch @Patch
@Name("exclusive-audio-playback") @Name("exclusive-audio-playback")

View File

@ -27,7 +27,7 @@ class CompactHeaderPatch : BytecodePatch(
val result = CompactHeaderConstructorFingerprint.result!! val result = CompactHeaderConstructorFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod
val insertIndex = result.patternScanResult!!.endIndex val insertIndex = result.scanResult.patternScanResult!!.endIndex
val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA
method.addInstructions( method.addInstructions(
insertIndex, """ insertIndex, """

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
@ -29,9 +29,11 @@ class HideGetPremiumPatch : BytecodePatch(
val parentResult = HideGetPremiumParentFingerprint.result!! val parentResult = HideGetPremiumParentFingerprint.result!!
HideGetPremiumFingerprint.resolve(data, parentResult.classDef) HideGetPremiumFingerprint.resolve(data, parentResult.classDef)
val startIndex = parentResult.scanResult.patternScanResult!!.startIndex
val parentMethod = parentResult.mutableMethod val parentMethod = parentResult.mutableMethod
parentMethod.replaceInstruction( parentMethod.replaceInstruction(
parentResult.patternScanResult!!.startIndex, """ startIndex, """
const/4 v1, 0x0 const/4 v1, 0x0
""" """
) )
@ -39,7 +41,7 @@ class HideGetPremiumPatch : BytecodePatch(
val result = HideGetPremiumFingerprint.result!! val result = HideGetPremiumFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod
method.addInstructions( method.addInstructions(
result.patternScanResult!!.startIndex, """ startIndex, """
const/16 v0, 0x8 const/16 v0, 0x8
""" """
) )

View File

@ -27,7 +27,7 @@ class RemoveTasteBuilderPatch : BytecodePatch(
val result = TasteBuilderConstructorFingerprint.result!! val result = TasteBuilderConstructorFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod
val insertIndex = result.patternScanResult!!.endIndex - 8 val insertIndex = result.scanResult.patternScanResult!!.endIndex - 8
val register = (method.implementation!!.instructions[insertIndex] as Instruction22c).registerA val register = (method.implementation!!.instructions[insertIndex] as Instruction22c).registerA
method.addInstructions( method.addInstructions(
insertIndex, """ insertIndex, """

View File

@ -33,7 +33,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
val implementation = result.mutableMethod.implementation!! val implementation = result.mutableMethod.implementation!!
val pivotBarElementFieldRef = val pivotBarElementFieldRef =
(implementation.instructions[result.patternScanResult!!.endIndex - 1] as Instruction22c).reference (implementation.instructions[result.scanResult.patternScanResult!!.endIndex - 1] as Instruction22c).reference
val register = (implementation.instructions.first() as Instruction35c).registerC val register = (implementation.instructions.first() as Instruction35c).registerC
// first compile all the needed instructions // first compile all the needed instructions
@ -46,16 +46,18 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
""".toInstructions().toMutableList() """.toInstructions().toMutableList()
val endIndex = result.scanResult.patternScanResult!!.endIndex
// replace the instruction to retain the label at given index // replace the instruction to retain the label at given index
implementation.replaceInstruction( implementation.replaceInstruction(
result.patternScanResult!!.endIndex - 1, instructionList[0] // invoke-interface endIndex - 1, instructionList[0] // invoke-interface
) )
// do not forget to remove this instruction since we added it already // do not forget to remove this instruction since we added it already
instructionList.removeFirst() instructionList.removeFirst()
val exitInstruction = instructionList.last() // iput-object val exitInstruction = instructionList.last() // iput-object
implementation.addInstruction( implementation.addInstruction(
result.patternScanResult!!.endIndex, exitInstruction endIndex, exitInstruction
) )
// do not forget to remove this instruction since we added it already // do not forget to remove this instruction since we added it already
instructionList.removeLast() instructionList.removeLast()
@ -64,12 +66,12 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
instructionList.add( instructionList.add(
2, // if-le 2, // if-le
BuilderInstruction22t( BuilderInstruction22t(
Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.patternScanResult!!.endIndex) Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(endIndex)
) )
) )
implementation.addInstructions( implementation.addInstructions(
result.patternScanResult!!.endIndex, instructionList endIndex, instructionList
) )
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -58,7 +58,7 @@ class TimelineAdsPatch : BytecodePatch(
// Set the tweetId field to null // Set the tweetId field to null
// This will cause twitter to not show the promoted ads, because we set it to null, when the tweet is promoted // This will cause twitter to not show the promoted ads, because we set it to null, when the tweet is promoted
parserFingerprintResult.mutableMethod.addInstructions( parserFingerprintResult.mutableMethod.addInstructions(
parserFingerprintResult.patternScanResult!!.startIndex + 1, parserFingerprintResult.scanResult.patternScanResult!!.startIndex + 1,
""" """
const/4 v2, 0x0 const/4 v2, 0x0
iput-object v2, p0, Lcom/twitter/model/json/timeline/urt/JsonTimelineTweet;->${tweetIdFieldReference.name}:Ljava/lang/String; iput-object v2, p0, Lcom/twitter/model/json/timeline/urt/JsonTimelineTweet;->${tweetIdFieldReference.name}:Ljava/lang/String;

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn

View File

@ -79,15 +79,17 @@ class EnableSeekbarTappingPatch : BytecodePatch(
val pMethod = tapSeekMethods["P"]!! val pMethod = tapSeekMethods["P"]!!
val oMethod = tapSeekMethods["O"]!! val oMethod = tapSeekMethods["O"]!!
val insertIndex = result.scanResult.patternScanResult!!.endIndex + 1
// get the required register // get the required register
val instruction = implementation.instructions[result.patternScanResult!!.endIndex] val instruction = implementation.instructions[insertIndex - 1]
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register") if (instruction.opcode != Opcode.INVOKE_VIRTUAL) return PatchResultError("Could not find the correct register")
val register = (instruction as Instruction35c).registerC val register = (instruction as Instruction35c).registerC
val elseLabel = implementation.newLabelForIndex(result.patternScanResult!!.endIndex + 1) val elseLabel = implementation.newLabelForIndex(insertIndex)
// the instructions are written in reverse order. // the instructions are written in reverse order.
result.mutableMethod.addInstructions( result.mutableMethod.addInstructions(
result.patternScanResult!!.endIndex + 1, """ insertIndex, """
invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.name}(I)V
invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V invoke-virtual { v$register, v2 }, ${pMethod.definingClass}->${pMethod.name}(I)V
""" """
@ -95,10 +97,10 @@ class EnableSeekbarTappingPatch : BytecodePatch(
// if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label // if tap-seeking is disabled, do not invoke the two methods above by jumping to the else label
implementation.addInstruction( implementation.addInstruction(
result.patternScanResult!!.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel) insertIndex, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
) )
result.mutableMethod.addInstructions( result.mutableMethod.addInstructions(
result.patternScanResult!!.endIndex + 1, """ insertIndex, """
invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->isTapSeekingEnabled()Z invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->isTapSeekingEnabled()Z
move-result v0 move-result v0
""" """

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
@ -50,7 +50,7 @@ class FullscreenPanelsRemoverPatch : BytecodePatch(
val method = result.mutableMethod val method = result.mutableMethod
val ifIndex = result.patternScanResult!!.startIndex + 2 val ifIndex = result.scanResult.patternScanResult!!.startIndex + 2
method.removeInstruction(ifIndex) method.removeInstruction(ifIndex)
method.addInstructions( method.addInstructions(

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
@ -55,7 +55,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
return PatchResultError("${PivotBarCreateButtonViewFingerprint.name} failed") return PatchResultError("${PivotBarCreateButtonViewFingerprint.name} failed")
val createButtonResult = PivotBarCreateButtonViewFingerprint.result!! val createButtonResult = PivotBarCreateButtonViewFingerprint.result!!
val insertIndex = createButtonResult.patternScanResult!!.endIndex val insertIndex = createButtonResult.scanResult.patternScanResult!!.endIndex
/* /*
* Inject hooks * Inject hooks

View File

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
@ -58,7 +58,7 @@ class ShortsButtonRemoverPatch : BytecodePatch(
if (!resolutionSucceeded) return PatchResultError("${it.name} failed") if (!resolutionSucceeded) return PatchResultError("${it.name} failed")
} }
.map { it.result!!.patternScanResult!! } .map { it.result!!.scanResult.patternScanResult!! }
val enumScanResult = fingerprintResults[0] val enumScanResult = fingerprintResults[0]
val buttonViewResult = fingerprintResults[1] val buttonViewResult = fingerprintResults[1]

View File

@ -42,7 +42,7 @@ class HideReelsPatch : BytecodePatch(
// HideReel will hide the reel view before it is being used, // HideReel will hide the reel view before it is being used,
// so we pass the view to the HideReel method // so we pass the view to the HideReel method
result.mutableMethod.addInstruction( result.mutableMethod.addInstruction(
result.patternScanResult!!.endIndex, result.scanResult.patternScanResult!!.endIndex,
"invoke-static { v2 }, Lapp/revanced/integrations/patches/HideReelsPatch;->HideReel(Landroid/view/View;)V" "invoke-static { v2 }, Lapp/revanced/integrations/patches/HideReelsPatch;->HideReel(Landroid/view/View;)V"
) )

View File

@ -10,7 +10,7 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
@ -63,7 +63,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
*/ */
val referenceResult = PlayerControllerSetTimeReferenceFingerprint.result!! val referenceResult = PlayerControllerSetTimeReferenceFingerprint.result!!
val playerControllerSetTimeMethod = val playerControllerSetTimeMethod =
data.toMethodWalker(referenceResult.method).nextMethod(referenceResult.patternScanResult!!.startIndex, true) data.toMethodWalker(referenceResult.method).nextMethod(referenceResult.scanResult.patternScanResult!!.startIndex, true)
.getMethod() as MutableMethod .getMethod() as MutableMethod
playerControllerSetTimeMethod.addInstruction( playerControllerSetTimeMethod.addInstruction(
2, 2,
@ -163,11 +163,11 @@ class SponsorBlockBytecodePatch : BytecodePatch(
val videoLengthMethodInstructions = videoLengthMethod.implementation!!.instructions val videoLengthMethodInstructions = videoLengthMethod.implementation!!.instructions
val videoLengthRegister = val videoLengthRegister =
(videoLengthMethodInstructions[videoLengthMethodResult.patternScanResult!!.endIndex - 2] as OneRegisterInstruction).registerA (videoLengthMethodInstructions[videoLengthMethodResult.scanResult.patternScanResult!!.endIndex - 2] as OneRegisterInstruction).registerA
val dummyRegisterForLong = val dummyRegisterForLong =
videoLengthRegister + 1 // this is required for long values since they are 64 bit wide videoLengthRegister + 1 // this is required for long values since they are 64 bit wide
videoLengthMethod.addInstruction( videoLengthMethod.addInstruction(
videoLengthMethodResult.patternScanResult!!.endIndex, videoLengthMethodResult.scanResult.patternScanResult!!.endIndex,
"invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setVideoLength(J)V" "invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, Lapp/revanced/integrations/sponsorblock/PlayerController;->setVideoLength(J)V"
) )
@ -231,7 +231,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
// append the new time to the player layout // append the new time to the player layout
val appendTimeFingerprintResult = AppendTimeFingerprint.result!! val appendTimeFingerprintResult = AppendTimeFingerprint.result!!
val appendTimePatternScanStartIndex = appendTimeFingerprintResult.patternScanResult!!.startIndex val appendTimePatternScanStartIndex = appendTimeFingerprintResult.scanResult.patternScanResult!!.startIndex
val targetRegister = val targetRegister =
(appendTimeFingerprintResult.method.implementation!!.instructions.elementAt(appendTimePatternScanStartIndex + 1) as OneRegisterInstruction).registerA (appendTimeFingerprintResult.method.implementation!!.instructions.elementAt(appendTimePatternScanStartIndex + 1) as OneRegisterInstruction).registerA

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
@ -92,7 +92,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
fun MethodFingerprint.unwrap(): Triple<MutableMethod, Int, Int> { fun MethodFingerprint.unwrap(): Triple<MutableMethod, Int, Int> {
val result = this.result!! val result = this.result!!
val scanIndex = result.patternScanResult!!.endIndex val scanIndex = result.scanResult.patternScanResult!!.endIndex
val method = result.mutableMethod val method = result.mutableMethod
val instructions = method.implementation!!.instructions val instructions = method.implementation!!.instructions
val parameterRegister = (instructions[scanIndex] as OneRegisterInstruction).registerA val parameterRegister = (instructions[scanIndex] as OneRegisterInstruction).registerA

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.data.impl.toMethodWalker import app.revanced.patcher.data.impl.toMethodWalker
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
@ -52,7 +52,7 @@ class WideSearchbarPatch : BytecodePatch(
//This should be the method aF in class fbn //This should be the method aF in class fbn
val targetMethodOne = val targetMethodOne =
data.toMethodWalker(resultOne!!.method).nextMethod(resultOne.patternScanResult!!.endIndex, true).getMethod() as MutableMethod data.toMethodWalker(resultOne!!.method).nextMethod(resultOne.scanResult.patternScanResult!!.endIndex, true).getMethod() as MutableMethod
//Since both methods have the same smali code, inject instructions using a method. //Since both methods have the same smali code, inject instructions using a method.
addInstructions(targetMethodOne) addInstructions(targetMethodOne)
@ -61,7 +61,7 @@ class WideSearchbarPatch : BytecodePatch(
//This should be the method aB in class fbn //This should be the method aB in class fbn
val targetMethodTwo = val targetMethodTwo =
data.toMethodWalker(resultTwo!!.method).nextMethod(resultTwo.patternScanResult!!.startIndex, true).getMethod() as MutableMethod data.toMethodWalker(resultTwo!!.method).nextMethod(resultTwo.scanResult.patternScanResult!!.startIndex, true).getMethod() as MutableMethod
//Since both methods have the same smali code, inject instructions using a method. //Since both methods have the same smali code, inject instructions using a method.
addInstructions(targetMethodTwo) addInstructions(targetMethodTwo)

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.removeInstruction import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess

View File

@ -26,7 +26,7 @@ class ClientSpoofPatch : BytecodePatch(
val result = UserAgentHeaderBuilderFingerprint.result!! val result = UserAgentHeaderBuilderFingerprint.result!!
val method = result.mutableMethod val method = result.mutableMethod
val insertIndex = result.patternScanResult!!.endIndex val insertIndex = result.scanResult.patternScanResult!!.endIndex
val packageNameRegister = (method.instruction(insertIndex) as FiveRegisterInstruction).registerD val packageNameRegister = (method.instruction(insertIndex) as FiveRegisterInstruction).registerD
val originalPackageName = "com.google.android.youtube" val originalPackageName = "com.google.android.youtube"

View File

@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
@ -47,7 +47,7 @@ class PlayerControlsBytecodePatch : BytecodePatch(
private var inflateFingerprintResult: MethodFingerprintResult? = null private var inflateFingerprintResult: MethodFingerprintResult? = null
set(fingerprint) { set(fingerprint) {
field = fingerprint!!.also { field = fingerprint!!.also {
moveToRegisterInstructionIndex = it.patternScanResult!!.endIndex moveToRegisterInstructionIndex = it.scanResult.patternScanResult!!.endIndex
viewRegister = viewRegister =
(it.mutableMethod.implementation!!.instructions[moveToRegisterInstructionIndex] as OneRegisterInstruction).registerA (it.mutableMethod.implementation!!.instructions[moveToRegisterInstructionIndex] as OneRegisterInstruction).registerA
} }

View File

@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.fingerprint.method.utils.MethodFingerprintUtils.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn

View File

@ -61,7 +61,7 @@ class SettingsPatch : BytecodePatch(
// add instructions to set the theme of the settings activity // add instructions to set the theme of the settings activity
themeSetterResult.mutableMethod.implementation!!.let { themeSetterResult.mutableMethod.implementation!!.let {
it.addInstruction( it.addInstruction(
themeSetterResult.patternScanResult!!.startIndex, themeSetterResult.scanResult.patternScanResult!!.startIndex,
setThemeInstruction setThemeInstruction
) )

View File

@ -5,11 +5,14 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.impl.BytecodeData import app.revanced.patcher.data.impl.BytecodeData
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.impl.BytecodePatch import app.revanced.patcher.patch.impl.BytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.InputType import app.revanced.patches.youtube.misc.settings.framework.components.impl.InputType
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
@ -83,10 +86,9 @@ class CustomVideoBufferPatch : BytecodePatch(
} }
private fun execMaxBuffer() { private fun execMaxBuffer() {
val result = MaxBufferFingerprint.result!! val (method, result) = MaxBufferFingerprint.unwrap()
val method = result.mutableMethod val (index, register) = result
val index = result.patternScanResult!!.endIndex - 1
val register = (method.implementation!!.instructions[index] as OneRegisterInstruction).registerA
method.addInstructions( method.addInstructions(
index + 1, """ index + 1, """
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getMaxBuffer()I invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getMaxBuffer()I
@ -96,10 +98,9 @@ class CustomVideoBufferPatch : BytecodePatch(
} }
private fun execPlaybackBuffer() { private fun execPlaybackBuffer() {
val result = PlaybackBufferFingerprint.result!! val (method, result) = PlaybackBufferFingerprint.unwrap()
val method = result.mutableMethod val (index, register) = result
val index = result.patternScanResult!!.startIndex
val register = (method.implementation!!.instructions[index] as OneRegisterInstruction).registerA
method.addInstructions( method.addInstructions(
index + 1, """ index + 1, """
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getPlaybackBuffer()I invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getPlaybackBuffer()I
@ -109,10 +110,9 @@ class CustomVideoBufferPatch : BytecodePatch(
} }
private fun execReBuffer() { private fun execReBuffer() {
val result = ReBufferFingerprint.result!! val (method, result) = ReBufferFingerprint.unwrap()
val method = result.mutableMethod val (index, register) = result
val index = result.patternScanResult!!.startIndex
val register = (method.implementation!!.instructions.get(index) as OneRegisterInstruction).registerA
method.addInstructions( method.addInstructions(
index + 1, """ index + 1, """
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getReBuffer()I invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getReBuffer()I
@ -120,4 +120,13 @@ class CustomVideoBufferPatch : BytecodePatch(
""" """
) )
} }
private fun MethodFingerprint.unwrap(): Pair<MutableMethod, Pair<Int, Int>> {
val result = this.result!!
val method = result.mutableMethod
val index = result.scanResult.patternScanResult!!.startIndex
val register = (method.instruction(index) as OneRegisterInstruction).registerA
return method to (index to register)
}
} }

View File

@ -31,7 +31,7 @@ class VideoIdPatch : BytecodePatch(
insertMethod = result.mutableMethod insertMethod = result.mutableMethod
videoIdRegister = videoIdRegister =
(insertMethod.implementation!!.instructions[result.patternScanResult!!.endIndex + 1] as OneRegisterInstruction).registerA (insertMethod.implementation!!.instructions[result.scanResult.patternScanResult!!.endIndex + 1] as OneRegisterInstruction).registerA
injectCall("Lapp/revanced/integrations/videoplayer/VideoInformation;->setCurrentVideoId(Ljava/lang/String;)V") injectCall("Lapp/revanced/integrations/videoplayer/VideoInformation;->setCurrentVideoId(Ljava/lang/String;)V")
@ -55,7 +55,7 @@ class VideoIdPatch : BytecodePatch(
methodDescriptor: String methodDescriptor: String
) { ) {
insertMethod.addInstructions( insertMethod.addInstructions(
result.patternScanResult!!.endIndex + offset, // move-result-object offset result.scanResult.patternScanResult!!.endIndex + offset, // move-result-object offset
"invoke-static {v$videoIdRegister}, $methodDescriptor" "invoke-static {v$videoIdRegister}, $methodDescriptor"
) )
} }