fix(protobuf-spoof): subtitles in wrong location

This commit is contained in:
inotia00 2023-04-02 18:37:59 +09:00
parent 805e57b049
commit 6a7bc363cb
4 changed files with 24 additions and 16 deletions

View File

@ -0,0 +1,10 @@
package app.revanced.patches.youtube.misc.protobufpoof.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SubtitleWindowFingerprint : MethodFingerprint(
parameters = listOf("I", "I", "I", "Z", "Z"),
customFingerprint = { it.definingClass == "Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleWindowSettings;"
&& it.name == "<init>"
}
)

View File

@ -34,7 +34,8 @@ import app.revanced.util.integrations.Constants.MISC_PATH
class ProtobufSpoofPatch : BytecodePatch( class ProtobufSpoofPatch : BytecodePatch(
listOf( listOf(
BadResponseFingerprint, BadResponseFingerprint,
ProtobufParameterBuilderFingerprint ProtobufParameterBuilderFingerprint,
SubtitleWindowFingerprint
) )
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
@ -51,7 +52,7 @@ class ProtobufSpoofPatch : BytecodePatch(
addInstructions( addInstructions(
0, 0,
""" """
invoke-static {p$protobufParam}, $MISC_PATH/ProtobufSpoofPatch;->getProtobufOverride(Ljava/lang/String;)Ljava/lang/String; invoke-static {p$protobufParam}, $MISC_PATH/ProtobufSpoofPatch;->overrideProtobufParameter(Ljava/lang/String;)Ljava/lang/String;
move-result-object p$protobufParam move-result-object p$protobufParam
""" """
) )
@ -64,6 +65,16 @@ class ProtobufSpoofPatch : BytecodePatch(
"invoke-static {}, $MISC_PATH/ProtobufSpoofPatch;->switchProtobufSpoof()V" "invoke-static {}, $MISC_PATH/ProtobufSpoofPatch;->switchProtobufSpoof()V"
) ?: return BadResponseFingerprint.toErrorResult() ) ?: return BadResponseFingerprint.toErrorResult()
// fix protobuf spoof side issue
SubtitleWindowFingerprint.result?.mutableMethod?.addInstructions(
1, """
invoke-static {p1, p2, p3}, $MISC_PATH/ProtobufSpoofPatch;->overrideAnchorPosition(III)I
move-result p1
invoke-static {p2, p3}, $MISC_PATH/ProtobufSpoofPatch;->overrideAnchorVerticalPosition(II)I
move-result p3
"""
) ?: return SubtitleWindowFingerprint.toErrorResult()
/* /*
* Add settings * Add settings
*/ */

View File

@ -519,15 +519,6 @@ Are you sure you want to continue though?"</string>
If you enable this setting, the following features are available: If you enable this setting, the following features are available:
- Community Posts - Community Posts
- Hide Mix playlist"</string> - Hide Mix playlist"</string>
<string name="revanced_reboot_warning_protobuf">"Spoof protobuf to bypass playback issues
If you enable this setting, the following features are not available:
When spoofing general video
- Do not display thumbnails when pressing the seekbar
When spoofing shorts videos
- Captions are positioned above the player"</string>
<string name="revanced_reboot_warning_quic">It is recommended not to use it if your internet speed is not fast enough</string> <string name="revanced_reboot_warning_quic">It is recommended not to use it if your internet speed is not fast enough</string>
<string name="revanced_reboot_warning_switch">"If you enable this setting, the following features are not available: <string name="revanced_reboot_warning_switch">"If you enable this setting, the following features are not available:
- Ambient mode"</string> - Ambient mode"</string>
@ -558,9 +549,6 @@ Since these setting is quite outdated, it may not be valid"</string>
<string name="revanced_seekbar">Seekbar</string> <string name="revanced_seekbar">Seekbar</string>
<string name="revanced_show_fullscreen_title_summary">Known issue: Title disappears when clicked</string> <string name="revanced_show_fullscreen_title_summary">Known issue: Title disappears when clicked</string>
<string name="revanced_show_fullscreen_title_title">Show fullscreen title</string> <string name="revanced_show_fullscreen_title_title">Show fullscreen title</string>
<string name="revanced_spoofing_type_general">Spoof to general video</string>
<string name="revanced_spoofing_type_shorts">Spoof to shorts video</string>
<string name="revanced_spoofing_type_title">Select protobuf to spoof</string>
<string name="revanced_sponsorblock_settings_summary">SponsorBlock related settings</string> <string name="revanced_sponsorblock_settings_summary">SponsorBlock related settings</string>
<string name="revanced_swipe_controls">Swipe controls</string> <string name="revanced_swipe_controls">Swipe controls</string>
<string name="revanced_swipe_magnitude_threshold_summary">The amount of threshold for swipe to occur</string> <string name="revanced_swipe_magnitude_threshold_summary">The amount of threshold for swipe to occur</string>

View File

@ -413,8 +413,7 @@
<!-- SETTINGS: DISABLE_QUIC_PROTOCOL <!-- SETTINGS: DISABLE_QUIC_PROTOCOL
<SwitchPreference android:title="@string/revanced_disable_quic_protocol_title" android:key="revanced_disable_quic_protocol" android:defaultValue="false" android:summary="@string/revanced_disable_quic_protocol_summary" />SETTINGS: DISABLE_QUIC_PROTOCOL --> <SwitchPreference android:title="@string/revanced_disable_quic_protocol_title" android:key="revanced_disable_quic_protocol" android:defaultValue="false" android:summary="@string/revanced_disable_quic_protocol_summary" />SETTINGS: DISABLE_QUIC_PROTOCOL -->
<!-- SETTINGS: ENABLE_PROTOBUF_SPOOF <!-- SETTINGS: ENABLE_PROTOBUF_SPOOF
<SwitchPreference android:title="@string/revanced_enable_protobuf_spoof_title" android:key="revanced_enable_protobuf_spoof" android:defaultValue="false" android:summary="@string/revanced_enable_protobuf_spoof_summary" /> <SwitchPreference android:title="@string/revanced_enable_protobuf_spoof_title" android:key="revanced_enable_protobuf_spoof" android:defaultValue="false" android:summary="@string/revanced_enable_protobuf_spoof_summary" />SETTINGS: ENABLE_PROTOBUF_SPOOF -->
<SwitchPreference android:title="@string/revanced_spoofing_type_title" android:key="revanced_spoofing_type" android:defaultValue="false" android:summaryOn="@string/revanced_spoofing_type_shorts" android:summaryOff="@string/revanced_spoofing_type_general" android:dependency="revanced_enable_protobuf_spoof" />SETTINGS: ENABLE_PROTOBUF_SPOOF -->
<PreferenceScreen android:title="@string/revanced_backup_title" android:key="backup" android:summary="@string/revanced_backup_summary"> <PreferenceScreen android:title="@string/revanced_backup_title" android:key="backup" android:summary="@string/revanced_backup_summary">
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_backup_title" /> <Preference android:title=" " android:selectable="false" android:summary="@string/revanced_backup_title" />
</PreferenceScreen> </PreferenceScreen>