mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
build: bump patcher dependency version to v5.0.0
This commit is contained in:
parent
4270525d00
commit
4f78f5c9bf
27 changed files with 76 additions and 63 deletions
|
@ -20,7 +20,7 @@ repositories {
|
|||
}
|
||||
|
||||
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")
|
||||
// Required for meta
|
||||
implementation("com.google.code.gson:gson:2.9.1")
|
||||
|
|
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
|
@ -30,7 +30,7 @@ class MusicVideoAdsPatch : BytecodePatch(
|
|||
val result = ShowMusicVideoAdsFingerprint.result!!
|
||||
|
||||
result.mutableMethod.addInstructions(
|
||||
result.patternScanResult!!.startIndex, """
|
||||
result.scanResult.patternScanResult!!.startIndex, """
|
||||
const/4 p1, 0x0
|
||||
"""
|
||||
)
|
||||
|
|
|
@ -30,7 +30,7 @@ class CodecsUnlockPatch : BytecodePatch(
|
|||
|
||||
val implementation = codecsLockResult.mutableMethod.implementation!!
|
||||
|
||||
val scanResultStartIndex = codecsLockResult.patternScanResult!!.startIndex
|
||||
val scanResultStartIndex = codecsLockResult.scanResult.patternScanResult!!.startIndex
|
||||
val instructionIndex = scanResultStartIndex +
|
||||
if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) {
|
||||
// for 5.16.xx and lower
|
||||
|
@ -43,7 +43,7 @@ class CodecsUnlockPatch : BytecodePatch(
|
|||
val allCodecsResult = AllCodecsReferenceFingerprint.result!!
|
||||
val allCodecsMethod =
|
||||
data.toMethodWalker(allCodecsResult.method)
|
||||
.nextMethod(allCodecsResult.patternScanResult!!.startIndex)
|
||||
.nextMethod(allCodecsResult.scanResult.patternScanResult!!.startIndex)
|
||||
.getMethod()
|
||||
|
||||
implementation.replaceInstruction(
|
||||
|
|
|
@ -6,14 +6,12 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||
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.ExclusiveAudioFingerprint
|
||||
|
||||
@Patch
|
||||
@Name("exclusive-audio-playback")
|
||||
|
|
|
@ -27,7 +27,7 @@ class CompactHeaderPatch : BytecodePatch(
|
|||
val result = CompactHeaderConstructorFingerprint.result!!
|
||||
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
|
||||
method.addInstructions(
|
||||
insertIndex, """
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
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.impl.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
|
@ -29,9 +29,11 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||
val parentResult = HideGetPremiumParentFingerprint.result!!
|
||||
HideGetPremiumFingerprint.resolve(data, parentResult.classDef)
|
||||
|
||||
val startIndex = parentResult.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
val parentMethod = parentResult.mutableMethod
|
||||
parentMethod.replaceInstruction(
|
||||
parentResult.patternScanResult!!.startIndex, """
|
||||
startIndex, """
|
||||
const/4 v1, 0x0
|
||||
"""
|
||||
)
|
||||
|
@ -39,7 +41,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
|||
val result = HideGetPremiumFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
method.addInstructions(
|
||||
result.patternScanResult!!.startIndex, """
|
||||
startIndex, """
|
||||
const/16 v0, 0x8
|
||||
"""
|
||||
)
|
||||
|
|
|
@ -27,7 +27,7 @@ class RemoveTasteBuilderPatch : BytecodePatch(
|
|||
val result = TasteBuilderConstructorFingerprint.result!!
|
||||
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
|
||||
method.addInstructions(
|
||||
insertIndex, """
|
||||
|
|
|
@ -33,7 +33,7 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||
val implementation = result.mutableMethod.implementation!!
|
||||
|
||||
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
|
||||
// first compile all the needed instructions
|
||||
|
@ -46,16 +46,18 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||
""".toInstructions().toMutableList()
|
||||
|
||||
|
||||
val endIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
// replace the instruction to retain the label at given index
|
||||
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
|
||||
instructionList.removeFirst()
|
||||
|
||||
val exitInstruction = instructionList.last() // iput-object
|
||||
implementation.addInstruction(
|
||||
result.patternScanResult!!.endIndex, exitInstruction
|
||||
endIndex, exitInstruction
|
||||
)
|
||||
// do not forget to remove this instruction since we added it already
|
||||
instructionList.removeLast()
|
||||
|
@ -64,12 +66,12 @@ class RemoveUpgradeButtonPatch : BytecodePatch(
|
|||
instructionList.add(
|
||||
2, // if-le
|
||||
BuilderInstruction22t(
|
||||
Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(result.patternScanResult!!.endIndex)
|
||||
Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(endIndex)
|
||||
)
|
||||
)
|
||||
|
||||
implementation.addInstructions(
|
||||
result.patternScanResult!!.endIndex, instructionList
|
||||
endIndex, instructionList
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class TimelineAdsPatch : BytecodePatch(
|
|||
// 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
|
||||
parserFingerprintResult.mutableMethod.addInstructions(
|
||||
parserFingerprintResult.patternScanResult!!.startIndex + 1,
|
||||
parserFingerprintResult.scanResult.patternScanResult!!.startIndex + 1,
|
||||
"""
|
||||
const/4 v2, 0x0
|
||||
iput-object v2, p0, Lcom/twitter/model/json/timeline/urt/JsonTimelineTweet;->${tweetIdFieldReference.name}:Ljava/lang/String;
|
||||
|
|
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
|
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
|
|
|
@ -79,15 +79,17 @@ class EnableSeekbarTappingPatch : BytecodePatch(
|
|||
val pMethod = tapSeekMethods["P"]!!
|
||||
val oMethod = tapSeekMethods["O"]!!
|
||||
|
||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex + 1
|
||||
|
||||
// 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")
|
||||
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.
|
||||
result.mutableMethod.addInstructions(
|
||||
result.patternScanResult!!.endIndex + 1, """
|
||||
insertIndex, """
|
||||
invoke-virtual { v$register, v2 }, ${oMethod.definingClass}->${oMethod.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
|
||||
implementation.addInstruction(
|
||||
result.patternScanResult!!.endIndex + 1, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
|
||||
insertIndex, BuilderInstruction21t(Opcode.IF_EQZ, 0, elseLabel)
|
||||
)
|
||||
result.mutableMethod.addInstructions(
|
||||
result.patternScanResult!!.endIndex + 1, """
|
||||
insertIndex, """
|
||||
invoke-static { }, Lapp/revanced/integrations/patches/SeekbarTappingPatch;->isTapSeekingEnabled()Z
|
||||
move-result v0
|
||||
"""
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
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.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -50,7 +50,7 @@ class FullscreenPanelsRemoverPatch : BytecodePatch(
|
|||
|
||||
val method = result.mutableMethod
|
||||
|
||||
val ifIndex = result.patternScanResult!!.startIndex + 2
|
||||
val ifIndex = result.scanResult.patternScanResult!!.startIndex + 2
|
||||
|
||||
method.removeInstruction(ifIndex)
|
||||
method.addInstructions(
|
||||
|
|
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -55,7 +55,7 @@ class CreateButtonRemoverPatch : BytecodePatch(
|
|||
return PatchResultError("${PivotBarCreateButtonViewFingerprint.name} failed")
|
||||
|
||||
val createButtonResult = PivotBarCreateButtonViewFingerprint.result!!
|
||||
val insertIndex = createButtonResult.patternScanResult!!.endIndex
|
||||
val insertIndex = createButtonResult.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
/*
|
||||
* Inject hooks
|
||||
|
|
|
@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -58,7 +58,7 @@ class ShortsButtonRemoverPatch : BytecodePatch(
|
|||
|
||||
if (!resolutionSucceeded) return PatchResultError("${it.name} failed")
|
||||
}
|
||||
.map { it.result!!.patternScanResult!! }
|
||||
.map { it.result!!.scanResult.patternScanResult!! }
|
||||
|
||||
val enumScanResult = fingerprintResults[0]
|
||||
val buttonViewResult = fingerprintResults[1]
|
||||
|
|
|
@ -42,7 +42,7 @@ class HideReelsPatch : BytecodePatch(
|
|||
// HideReel will hide the reel view before it is being used,
|
||||
// so we pass the view to the HideReel method
|
||||
result.mutableMethod.addInstruction(
|
||||
result.patternScanResult!!.endIndex,
|
||||
result.scanResult.patternScanResult!!.endIndex,
|
||||
"invoke-static { v2 }, Lapp/revanced/integrations/patches/HideReelsPatch;->HideReel(Landroid/view/View;)V"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import app.revanced.patcher.extensions.addInstructions
|
|||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.extensions.replaceInstruction
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
|
@ -63,7 +63,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||
*/
|
||||
val referenceResult = PlayerControllerSetTimeReferenceFingerprint.result!!
|
||||
val playerControllerSetTimeMethod =
|
||||
data.toMethodWalker(referenceResult.method).nextMethod(referenceResult.patternScanResult!!.startIndex, true)
|
||||
data.toMethodWalker(referenceResult.method).nextMethod(referenceResult.scanResult.patternScanResult!!.startIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
playerControllerSetTimeMethod.addInstruction(
|
||||
2,
|
||||
|
@ -163,11 +163,11 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||
val videoLengthMethodInstructions = videoLengthMethod.implementation!!.instructions
|
||||
|
||||
val videoLengthRegister =
|
||||
(videoLengthMethodInstructions[videoLengthMethodResult.patternScanResult!!.endIndex - 2] as OneRegisterInstruction).registerA
|
||||
(videoLengthMethodInstructions[videoLengthMethodResult.scanResult.patternScanResult!!.endIndex - 2] as OneRegisterInstruction).registerA
|
||||
val dummyRegisterForLong =
|
||||
videoLengthRegister + 1 // this is required for long values since they are 64 bit wide
|
||||
videoLengthMethod.addInstruction(
|
||||
videoLengthMethodResult.patternScanResult!!.endIndex,
|
||||
videoLengthMethodResult.scanResult.patternScanResult!!.endIndex,
|
||||
"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
|
||||
val appendTimeFingerprintResult = AppendTimeFingerprint.result!!
|
||||
val appendTimePatternScanStartIndex = appendTimeFingerprintResult.patternScanResult!!.startIndex
|
||||
val appendTimePatternScanStartIndex = appendTimeFingerprintResult.scanResult.patternScanResult!!.startIndex
|
||||
val targetRegister =
|
||||
(appendTimeFingerprintResult.method.implementation!!.instructions.elementAt(appendTimePatternScanStartIndex + 1) as OneRegisterInstruction).registerA
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
|
@ -92,7 +92,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
|||
|
||||
fun MethodFingerprint.unwrap(): Triple<MutableMethod, Int, Int> {
|
||||
val result = this.result!!
|
||||
val scanIndex = result.patternScanResult!!.endIndex
|
||||
val scanIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
val method = result.mutableMethod
|
||||
val instructions = method.implementation!!.instructions
|
||||
val parameterRegister = (instructions[scanIndex] as OneRegisterInstruction).registerA
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
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.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.data.impl.toMethodWalker
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
|
@ -52,7 +52,7 @@ class WideSearchbarPatch : BytecodePatch(
|
|||
|
||||
//This should be the method aF in class fbn
|
||||
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.
|
||||
addInstructions(targetMethodOne)
|
||||
|
@ -61,7 +61,7 @@ class WideSearchbarPatch : BytecodePatch(
|
|||
|
||||
//This should be the method aB in class fbn
|
||||
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.
|
||||
addInstructions(targetMethodTwo)
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
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.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
|
|
@ -26,7 +26,7 @@ class ClientSpoofPatch : BytecodePatch(
|
|||
val result = UserAgentHeaderBuilderFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
|
||||
val insertIndex = result.patternScanResult!!.endIndex
|
||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
val packageNameRegister = (method.instruction(insertIndex) as FiveRegisterInstruction).registerD
|
||||
|
||||
val originalPackageName = "com.google.android.youtube"
|
||||
|
|
|
@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.utils.MethodFingerprintUtils.resolve
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
|
@ -47,7 +47,7 @@ class PlayerControlsBytecodePatch : BytecodePatch(
|
|||
private var inflateFingerprintResult: MethodFingerprintResult? = null
|
||||
set(fingerprint) {
|
||||
field = fingerprint!!.also {
|
||||
moveToRegisterInstructionIndex = it.patternScanResult!!.endIndex
|
||||
moveToRegisterInstructionIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
viewRegister =
|
||||
(it.mutableMethod.implementation!!.instructions[moveToRegisterInstructionIndex] as OneRegisterInstruction).registerA
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
|
|
|
@ -61,7 +61,7 @@ class SettingsPatch : BytecodePatch(
|
|||
// add instructions to set the theme of the settings activity
|
||||
themeSetterResult.mutableMethod.implementation!!.let {
|
||||
it.addInstruction(
|
||||
themeSetterResult.patternScanResult!!.startIndex,
|
||||
themeSetterResult.scanResult.patternScanResult!!.startIndex,
|
||||
setThemeInstruction
|
||||
)
|
||||
|
||||
|
|
|
@ -5,11 +5,14 @@ import app.revanced.patcher.annotation.Name
|
|||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.impl.BytecodeData
|
||||
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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
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.framework.components.impl.InputType
|
||||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen
|
||||
|
@ -83,10 +86,9 @@ class CustomVideoBufferPatch : BytecodePatch(
|
|||
}
|
||||
|
||||
private fun execMaxBuffer() {
|
||||
val result = MaxBufferFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
val index = result.patternScanResult!!.endIndex - 1
|
||||
val register = (method.implementation!!.instructions[index] as OneRegisterInstruction).registerA
|
||||
val (method, result) = MaxBufferFingerprint.unwrap()
|
||||
val (index, register) = result
|
||||
|
||||
method.addInstructions(
|
||||
index + 1, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getMaxBuffer()I
|
||||
|
@ -96,10 +98,9 @@ class CustomVideoBufferPatch : BytecodePatch(
|
|||
}
|
||||
|
||||
private fun execPlaybackBuffer() {
|
||||
val result = PlaybackBufferFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
val index = result.patternScanResult!!.startIndex
|
||||
val register = (method.implementation!!.instructions[index] as OneRegisterInstruction).registerA
|
||||
val (method, result) = PlaybackBufferFingerprint.unwrap()
|
||||
val (index, register) = result
|
||||
|
||||
method.addInstructions(
|
||||
index + 1, """
|
||||
invoke-static {}, Lapp/revanced/integrations/patches/VideoBufferPatch;->getPlaybackBuffer()I
|
||||
|
@ -109,10 +110,9 @@ class CustomVideoBufferPatch : BytecodePatch(
|
|||
}
|
||||
|
||||
private fun execReBuffer() {
|
||||
val result = ReBufferFingerprint.result!!
|
||||
val method = result.mutableMethod
|
||||
val index = result.patternScanResult!!.startIndex
|
||||
val register = (method.implementation!!.instructions.get(index) as OneRegisterInstruction).registerA
|
||||
val (method, result) = ReBufferFingerprint.unwrap()
|
||||
val (index, register) = result
|
||||
|
||||
method.addInstructions(
|
||||
index + 1, """
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class VideoIdPatch : BytecodePatch(
|
|||
|
||||
insertMethod = result.mutableMethod
|
||||
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")
|
||||
|
||||
|
@ -55,7 +55,7 @@ class VideoIdPatch : BytecodePatch(
|
|||
methodDescriptor: String
|
||||
) {
|
||||
insertMethod.addInstructions(
|
||||
result.patternScanResult!!.endIndex + offset, // move-result-object offset
|
||||
result.scanResult.patternScanResult!!.endIndex + offset, // move-result-object offset
|
||||
"invoke-static {v$videoIdRegister}, $methodDescriptor"
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue