mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
build: bump patcher dependency version to v5.0.0
This commit is contained in:
@ -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"
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user