mirror of
https://github.com/revanced/revanced-patches
synced 2024-08-29 02:25:15 +02:00
fix(custom-video-buffer): use correct offset for getMaxBuffer
call injection
This commit is contained in:
parent
54f947d3d6
commit
6773122d0b
@ -86,7 +86,7 @@ class CustomVideoBufferPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
private fun execMaxBuffer() {
|
||||
val (method, result) = MaxBufferFingerprint.unwrap()
|
||||
val (method, result) = MaxBufferFingerprint.unwrap(true, -1)
|
||||
val (index, register) = result
|
||||
|
||||
method.addInstructions(
|
||||
@ -121,10 +121,15 @@ class CustomVideoBufferPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
|
||||
private fun MethodFingerprint.unwrap(): Pair<MutableMethod, Pair<Int, Int>> {
|
||||
private fun MethodFingerprint.unwrap(
|
||||
forEndIndex: Boolean = false,
|
||||
offset: Int = 0
|
||||
): Pair<MutableMethod, Pair<Int, Int>> {
|
||||
val result = this.result!!
|
||||
val method = result.mutableMethod
|
||||
val index = result.scanResult.patternScanResult!!.startIndex
|
||||
val scanResult = result.scanResult.patternScanResult!!
|
||||
val index = (if (forEndIndex) scanResult.endIndex else scanResult.startIndex) + offset
|
||||
|
||||
val register = (method.instruction(index) as OneRegisterInstruction).registerA
|
||||
|
||||
return method to (index to register)
|
||||
|
Loading…
Reference in New Issue
Block a user