build: bump patcher dependency version to v5.0.0

This commit is contained in:
oSumAtrIX
2022-09-21 04:11:16 +02:00
parent a928fc1ffd
commit 193635d497
27 changed files with 76 additions and 63 deletions

View File

@ -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)
}
}