mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 00:24:34 +02:00
fix: some fingerprints are broken
This commit is contained in:
parent
3bdb182b03
commit
f0dba52004
@ -0,0 +1,26 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.customvideobuffer.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object MaxBufferAltFingerprint : MethodFingerprint(
|
||||||
|
returnType = "I",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.RETURN
|
||||||
|
),
|
||||||
|
customFingerprint = {
|
||||||
|
it.definingClass == "Lcom/google/android/libraries/youtube/innertube/model/media/PlayerConfigModel;"
|
||||||
|
&& it.implementation!!.instructions.any { instruction ->
|
||||||
|
((instruction as? NarrowLiteralInstruction)?.narrowLiteral == 120000)
|
||||||
|
&& it.name == "t"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
@ -20,13 +20,24 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CustomVideoBufferBytecodePatch : BytecodePatch(
|
class CustomVideoBufferBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
|
MaxBufferAltFingerprint,
|
||||||
MaxBufferFingerprint,
|
MaxBufferFingerprint,
|
||||||
PlaybackBufferFingerprint,
|
PlaybackBufferFingerprint,
|
||||||
ReBufferFingerprint
|
ReBufferFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
execMaxBuffer()
|
|
||||||
|
/**
|
||||||
|
* Temporary try .. catch is used because priority of fingerprint properties are not implemented yet
|
||||||
|
* But it's not an ideal method
|
||||||
|
* see https://github.com/revanced/revanced-patcher/issues/148
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
execMaxBuffer()
|
||||||
|
} catch (_: Exception) {
|
||||||
|
execMaxBufferAlt()
|
||||||
|
}
|
||||||
execPlaybackBuffer()
|
execPlaybackBuffer()
|
||||||
execReBuffer()
|
execReBuffer()
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
@ -36,6 +47,18 @@ class CustomVideoBufferBytecodePatch : BytecodePatch(
|
|||||||
const val INTEGRATIONS_BUFFER_CLASS_DESCRIPTOR =
|
const val INTEGRATIONS_BUFFER_CLASS_DESCRIPTOR =
|
||||||
"$MISC_PATH/CustomVideoBufferPatch;"
|
"$MISC_PATH/CustomVideoBufferPatch;"
|
||||||
}
|
}
|
||||||
|
private fun execMaxBufferAlt() {
|
||||||
|
val (method, result) = MaxBufferAltFingerprint.unwrap(true, -1)
|
||||||
|
val (index, register) = result
|
||||||
|
|
||||||
|
method.addInstructions(
|
||||||
|
index + 1, """
|
||||||
|
invoke-static {}, $INTEGRATIONS_BUFFER_CLASS_DESCRIPTOR->setMaxBuffer()I
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun execMaxBuffer() {
|
private fun execMaxBuffer() {
|
||||||
val (method, result) = MaxBufferFingerprint.unwrap(true, -1)
|
val (method, result) = MaxBufferFingerprint.unwrap(true, -1)
|
||||||
val (index, register) = result
|
val (index, register) = result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user