mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 15:14:34 +02:00
refactor(protobuf-spoof): automatic spoofing protobuf
This commit is contained in:
parent
f690160996
commit
805e57b049
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.protobufpoof.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object BadResponseFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST_16
|
||||||
|
),
|
||||||
|
strings = listOf("Response code: ")
|
||||||
|
)
|
@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Name
|
|||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -14,21 +15,31 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.misc.protobufpoof.fingerprints.ProtobufParameterBuilderFingerprint
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
|
import app.revanced.patches.youtube.misc.protobufpoof.fingerprints.*
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("protobuf-spoof")
|
@Name("protobuf-spoof")
|
||||||
@Description("Spoofs the protobuf to prevent playback issues.")
|
@Description("Spoofs the protobuf to prevent playback issues.")
|
||||||
@DependsOn([SettingsPatch::class])
|
@DependsOn(
|
||||||
|
[
|
||||||
|
PlayerTypeHookPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ProtobufSpoofPatch : BytecodePatch(
|
class ProtobufSpoofPatch : BytecodePatch(
|
||||||
listOf(ProtobufParameterBuilderFingerprint)
|
listOf(
|
||||||
|
BadResponseFingerprint,
|
||||||
|
ProtobufParameterBuilderFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
// hook parameter
|
||||||
ProtobufParameterBuilderFingerprint.result?.let {
|
ProtobufParameterBuilderFingerprint.result?.let {
|
||||||
with (context
|
with (context
|
||||||
.toMethodWalker(it.method)
|
.toMethodWalker(it.method)
|
||||||
@ -47,6 +58,12 @@ class ProtobufSpoofPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return ProtobufParameterBuilderFingerprint.toErrorResult()
|
} ?: return ProtobufParameterBuilderFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
// hook video playback result
|
||||||
|
BadResponseFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
|
0,
|
||||||
|
"invoke-static {}, $MISC_PATH/ProtobufSpoofPatch;->switchProtobufSpoof()V"
|
||||||
|
) ?: return BadResponseFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -511,6 +511,7 @@ Please do not report any issues you encounter while using this feature."</string
|
|||||||
<string name="revanced_patches_information_summary">Information about applied patches</string>
|
<string name="revanced_patches_information_summary">Information about applied patches</string>
|
||||||
<string name="revanced_player_flyout_panel_title">Player flyout panel</string>
|
<string name="revanced_player_flyout_panel_title">Player flyout panel</string>
|
||||||
<string name="revanced_player">Player</string>
|
<string name="revanced_player">Player</string>
|
||||||
|
<string name="revanced_protobuf_spoof_notice">Spoofing protobuf to prevent playback issues</string>
|
||||||
<string name="revanced_reboot_warning_general">"As this is still an experimental feature, there may be other unknown issues.
|
<string name="revanced_reboot_warning_general">"As this is still an experimental feature, there may be other unknown issues.
|
||||||
Are you sure you want to continue though?"</string>
|
Are you sure you want to continue though?"</string>
|
||||||
<string name="revanced_reboot_warning_phone">"Tricks the dpi to change some layouts to phone layouts.
|
<string name="revanced_reboot_warning_phone">"Tricks the dpi to change some layouts to phone layouts.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user