From 049e6989992714b1cb284b46bcca272dfa882581 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Wed, 28 Jun 2023 13:39:09 +0900 Subject: [PATCH] feat(youtube): remove `custom-speed-overlay` patch (dropped from server side) --- .../SpeedOverlayHookFingerprint.kt | 16 ---- .../YouTubeTextViewFingerprint.kt | 10 --- .../patch/CustomSpeedOverlayPatch.kt | 85 ------------------- .../youtube/settings/host/values/strings.xml | 3 - .../youtube/settings/xml/revanced_prefs.xml | 4 - 5 files changed, 118 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt deleted file mode 100644 index 0f2caeb0d..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/SpeedOverlayHookFingerprint.kt +++ /dev/null @@ -1,16 +0,0 @@ -package app.revanced.patches.youtube.player.customspeedoverlay.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.Opcode - -object SpeedOverlayHookFingerprint : MethodFingerprint( - returnType = "V", - opcodes = listOf( - Opcode.CMPL_FLOAT, - Opcode.IF_GEZ, - Opcode.IGET_OBJECT, - Opcode.INVOKE_VIRTUAL - ), - strings = listOf("Failed to easy seek haptics vibrate."), - customFingerprint = { methodDef, _ -> methodDef.name == "run" } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt deleted file mode 100644 index 2296506af..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/fingerprints/YouTubeTextViewFingerprint.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.patches.youtube.player.customspeedoverlay.fingerprints - -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import org.jf.dexlib2.Opcode - -object YouTubeTextViewFingerprint : MethodFingerprint( - returnType = "V", - opcodes = listOf(Opcode.INVOKE_SUPER), - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("YouTubeTextView;") && methodDef.name == "setText" } -) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt deleted file mode 100644 index 63a96d76e..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/player/customspeedoverlay/patch/CustomSpeedOverlayPatch.kt +++ /dev/null @@ -1,85 +0,0 @@ -package app.revanced.patches.youtube.player.customspeedoverlay.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.extensions.InstructionExtensions.addInstructions -import app.revanced.patcher.extensions.InstructionExtensions.getInstruction -import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction -import app.revanced.patcher.patch.BytecodePatch -import app.revanced.patcher.patch.PatchResult -import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patcher.patch.annotations.Patch -import app.revanced.patches.youtube.player.customspeedoverlay.fingerprints.SpeedOverlayHookFingerprint -import app.revanced.patches.youtube.player.customspeedoverlay.fingerprints.YouTubeTextViewFingerprint -import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility -import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch -import app.revanced.util.integrations.Constants.PLAYER -import org.jf.dexlib2.iface.instruction.ReferenceInstruction -import org.jf.dexlib2.iface.instruction.formats.Instruction35c - -@Patch -@Name("custom-speed-overlay") -@Description("Customize the video speed that changes when pressing and holding the player.") -@DependsOn([SettingsPatch::class]) -@YouTubeCompatibility -@Version("0.0.1") -class CustomSpeedOverlayPatch : BytecodePatch( - listOf( - SpeedOverlayHookFingerprint, - YouTubeTextViewFingerprint - ) -) { - override fun execute(context: BytecodeContext): PatchResult { - - SpeedOverlayHookFingerprint.result?.let { - it.mutableMethod.apply { - val insertIndex = it.scanResult.patternScanResult!!.endIndex - val insertRegister = getInstruction(insertIndex).registerD - - addInstructions( - insertIndex, """ - invoke-static {v$insertRegister}, $PLAYER->customSpeedOverlay(F)F - move-result v$insertRegister - """ - ) - } - } ?: return SpeedOverlayHookFingerprint.toErrorResult() - - YouTubeTextViewFingerprint.result?.let { - it.mutableMethod.apply { - val targetIndex = it.scanResult.patternScanResult!!.startIndex - val targetInstruction = getInstruction(targetIndex) - val targetReference = getInstruction(targetIndex).reference - - replaceInstruction( - targetIndex, - "invoke-static {v${targetInstruction.registerC}, v${targetInstruction.registerD}}, $PLAYER->customSpeedOverlay(Landroid/widget/TextView;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;" - ) - addInstructions( - targetIndex + 1, """ - move-result-object v${targetInstruction.registerD} - invoke-super {v${targetInstruction.registerC}, v${targetInstruction.registerD}, v${targetInstruction.registerE}}, $targetReference - """ - ) - } - } ?: return YouTubeTextViewFingerprint.toErrorResult() - - /** - * Add settings - */ - SettingsPatch.addPreference( - arrayOf( - "PREFERENCE: PLAYER_SETTINGS", - "SETTINGS: CUSTOM_SPEED_OVERLAY" - ) - ) - - SettingsPatch.updatePatchStatus("custom-speed-overlay") - - return PatchResultSuccess() - } -} diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index a30b29204..3727f9b1e 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -24,9 +24,6 @@ Enable custom filter Type the hex code of the seekbar color Custom seekbar color value - Type the video speed to change when pressing and holding the player - Custom speed overlay value - Playing at %sx speed Add or change the video speeds available Edit custom video speeds To open RVX in an external browser, turn on \'Open supported links\' and enable supported web addresses diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml index 4b583bf08..2759714bd 100644 --- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml +++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml @@ -279,7 +279,6 @@ - @@ -431,9 +430,6 @@ PREFERENCE: PLAYER_SETTINGS --> - -