From 6756f80e3e0c09376a1fd613d28644bdaa24da57 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Fri, 23 Jun 2023 17:46:27 +0400 Subject: [PATCH] fix(youtube/client-spoof): update settings text for known side effects of spoof signature (#2476) --- ...tleWindowSettingsConstructorFingerprint.kt | 11 ------- .../patch/SpoofSignatureVerificationPatch.kt | 29 ++----------------- 2 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/SubtitleWindowSettingsConstructorFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/SubtitleWindowSettingsConstructorFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/SubtitleWindowSettingsConstructorFingerprint.kt deleted file mode 100644 index f37201f865..0000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/SubtitleWindowSettingsConstructorFingerprint.kt +++ /dev/null @@ -1,11 +0,0 @@ -package app.revanced.patches.youtube.misc.fix.playback.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint - -object SubtitleWindowSettingsConstructorFingerprint : MethodFingerprint( - parameters = listOf("I", "I", "I", "Z", "Z"), - customFingerprint = { methodDef, _ -> - methodDef.definingClass == "Lcom/google/android/libraries/youtube/player/subtitles/model/SubtitleWindowSettings;" - && methodDef.name == "" - } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt index 04d488ac20..4b5f74285c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt @@ -17,11 +17,9 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.SwitchPreference import app.revanced.patches.youtube.misc.fix.playback.fingerprints.OpenCronetDataSourceFingerprint import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint -import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SubtitleWindowSettingsConstructorFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Name("spoof-signature-verification") @@ -30,14 +28,12 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction IntegrationsPatch::class, SettingsPatch::class, PlayerTypeHookPatch::class, - VideoIdPatch::class ]) @Version("0.0.1") class SpoofSignatureVerificationPatch : BytecodePatch( listOf( ProtobufParameterBuilderFingerprint, OpenCronetDataSourceFingerprint, - SubtitleWindowSettingsConstructorFingerprint, ) ) { override fun execute(context: BytecodeContext): PatchResult { @@ -48,7 +44,8 @@ class SpoofSignatureVerificationPatch : BytecodePatch( StringResource("revanced_spoof_signature_verification_summary_on", "App signature spoofed\\n\\n" + "Side effects include:\\n" - + "• End screen cards are always hidden\\n" + + "• Ambient mode may not work\\n" + + "• Seekbar thumbnails are hidden\\n" + "• Downloading videos may not work"), StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"), StringResource("revanced_spoof_signature_verification_user_dialog_message", @@ -56,9 +53,6 @@ class SpoofSignatureVerificationPatch : BytecodePatch( ) ) - // Hook video id, required for subtitle fix. - VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V") - // hook parameter ProtobufParameterBuilderFingerprint.result?.let { val setParamMethod = context @@ -95,25 +89,6 @@ class SpoofSignatureVerificationPatch : BytecodePatch( } ?: return OpenCronetDataSourceFingerprint.toErrorResult() - // hook override subtitles - SubtitleWindowSettingsConstructorFingerprint.result?.let { - it.mutableMethod.apply { - addInstructions( - 0, - """ - invoke-static {p1, p2, p3, p4, p5}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSubtitleWindowSettingsOverride(IIIZZ)[I - move-result-object v0 - const/4 v1, 0x0 - aget p1, v0, v1 # ap, anchor position - const/4 v1, 0x1 - aget p2, v0, v1 # ah, horizontal anchor - const/4 v1, 0x2 - aget p3, v0, v1 # av, vertical anchor - """ - ) - } - } ?: return SubtitleWindowSettingsConstructorFingerprint.toErrorResult() - return PatchResultSuccess() }