mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
add protobuf-spoof
patch
This commit is contained in:
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object ProtobufParameterBuilderFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL_RANGE, // target reference
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT
|
||||||
|
),
|
||||||
|
strings = listOf("Unexpected empty videoId.", "Prefetch request are disabled.")
|
||||||
|
)
|
@ -0,0 +1,46 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.fix.playback.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("protobuf-spoof")
|
||||||
|
@Description("Spoofs the protobuf to prevent playback issues.")
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ProtobufSpoofPatch : BytecodePatch(
|
||||||
|
listOf(ProtobufParameterBuilderFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
ProtobufParameterBuilderFingerprint.result?.let {
|
||||||
|
with (context
|
||||||
|
.toMethodWalker(it.method)
|
||||||
|
.nextMethod(it.scanResult.patternScanResult!!.startIndex, true)
|
||||||
|
.getMethod() as MutableMethod
|
||||||
|
) {
|
||||||
|
val protobufParam = 3
|
||||||
|
val protobufParameter = "8AEByAMTuAQP" /* Protobuf Parameter of shorts */
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
0,
|
||||||
|
"const-string p$protobufParam, \"$protobufParameter\""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return ProtobufParameterBuilderFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
|||||||
import app.revanced.patches.shared.patch.options.PatchOptions
|
import app.revanced.patches.shared.patch.options.PatchOptions
|
||||||
import app.revanced.patches.youtube.layout.player.castbutton.patch.HideCastButtonPatch
|
import app.revanced.patches.youtube.layout.player.castbutton.patch.HideCastButtonPatch
|
||||||
import app.revanced.patches.youtube.misc.clientspoof.patch.ClientSpoofPatch
|
import app.revanced.patches.youtube.misc.clientspoof.patch.ClientSpoofPatch
|
||||||
|
import app.revanced.patches.youtube.misc.fix.playback.patch.ProtobufSpoofPatch
|
||||||
import app.revanced.patches.youtube.misc.microg.bytecode.fingerprints.*
|
import app.revanced.patches.youtube.misc.microg.bytecode.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.injectInit
|
import app.revanced.util.bytecode.BytecodeHelper.injectInit
|
||||||
@ -21,7 +22,8 @@ import app.revanced.util.microg.MicroGBytecodeHelper
|
|||||||
[
|
[
|
||||||
ClientSpoofPatch::class,
|
ClientSpoofPatch::class,
|
||||||
HideCastButtonPatch::class,
|
HideCastButtonPatch::class,
|
||||||
PatchOptions::class
|
PatchOptions::class,
|
||||||
|
ProtobufSpoofPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
|
Reference in New Issue
Block a user