mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 09:04:34 +02:00
feat(YouTube): remove Custom speed overlay
patch (not suitable for maintenance)
This commit is contained in:
parent
855ab583c5
commit
c89df5554c
@ -1,117 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.player.speedoverlay
|
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
|
||||||
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.removeInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.youtube.player.speedoverlay.fingerprints.SpeedOverlayHookAlternativeFingerprint
|
|
||||||
import app.revanced.patches.youtube.player.speedoverlay.fingerprints.SpeedOverlayHookFingerprint
|
|
||||||
import app.revanced.patches.youtube.player.speedoverlay.fingerprints.YouTubeTextViewFingerprint
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SpeedOverlayText
|
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
|
||||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Custom speed overlay",
|
|
||||||
description = "Customize 'Play at 2x speed' while holding down.",
|
|
||||||
dependencies = [
|
|
||||||
SettingsPatch::class,
|
|
||||||
SharedResourceIdPatch::class
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
|
||||||
CompatiblePackage(
|
|
||||||
"com.google.android.youtube",
|
|
||||||
[
|
|
||||||
"18.24.37",
|
|
||||||
"18.25.40",
|
|
||||||
"18.27.36",
|
|
||||||
"18.29.38",
|
|
||||||
"18.30.37",
|
|
||||||
"18.31.40",
|
|
||||||
"18.32.39",
|
|
||||||
"18.33.40",
|
|
||||||
"18.34.38",
|
|
||||||
"18.35.36",
|
|
||||||
"18.36.39",
|
|
||||||
"18.37.36",
|
|
||||||
"18.38.44",
|
|
||||||
"18.39.41",
|
|
||||||
"18.40.34"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object SpeedOverlayPatch : BytecodePatch(
|
|
||||||
setOf(
|
|
||||||
SpeedOverlayHookAlternativeFingerprint,
|
|
||||||
SpeedOverlayHookFingerprint,
|
|
||||||
YouTubeTextViewFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
|
|
||||||
val speedOverlayHookResult =
|
|
||||||
SpeedOverlayHookFingerprint.result
|
|
||||||
?: SpeedOverlayHookAlternativeFingerprint.result
|
|
||||||
?: throw SpeedOverlayHookFingerprint.exception
|
|
||||||
|
|
||||||
speedOverlayHookResult.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val insertIndex = implementation!!.instructions.indexOfFirst { instruction ->
|
|
||||||
instruction.opcode == Opcode.CMPL_FLOAT
|
|
||||||
} + 3
|
|
||||||
val insertRegister = getInstruction<Instruction35c>(insertIndex).registerD
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
insertIndex, """
|
|
||||||
invoke-static {v$insertRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSpeed(F)F
|
|
||||||
move-result v$insertRegister
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
YouTubeTextViewFingerprint.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
|
||||||
val targetInstruction = getInstruction<Instruction35c>(targetIndex)
|
|
||||||
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
targetIndex + 1, """
|
|
||||||
const v0, $SpeedOverlayText
|
|
||||||
invoke-static {v${targetInstruction.registerC}, v${targetInstruction.registerD}, v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSpeedText(Landroid/widget/TextView;Ljava/lang/CharSequence;I)Ljava/lang/CharSequence;
|
|
||||||
move-result-object v${targetInstruction.registerD}
|
|
||||||
invoke-super {v${targetInstruction.registerC}, v${targetInstruction.registerD}, v${targetInstruction.registerE}}, $targetReference
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
removeInstruction(targetIndex)
|
|
||||||
}
|
|
||||||
} ?: throw YouTubeTextViewFingerprint.exception
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add settings
|
|
||||||
*/
|
|
||||||
SettingsPatch.addPreference(
|
|
||||||
arrayOf(
|
|
||||||
"PREFERENCE: PLAYER_SETTINGS",
|
|
||||||
"SETTINGS: CUSTOM_SPEED_OVERLAY"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
SettingsPatch.updatePatchStatus("Custom speed overlay")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
|
||||||
"$UTILS_PATH/SpeedOverlayPatch;"
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.player.speedoverlay.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
object SpeedOverlayHookAlternativeFingerprint : MethodFingerprint(
|
|
||||||
returnType = "V",
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.CMPL_FLOAT,
|
|
||||||
Opcode.IF_GEZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.RETURN_VOID
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef, _ -> methodDef.name == "run" }
|
|
||||||
)
|
|
@ -1,16 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.player.speedoverlay.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.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" }
|
|
||||||
)
|
|
@ -1,13 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.player.speedoverlay.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
object YouTubeTextViewFingerprint : MethodFingerprint(
|
|
||||||
returnType = "V",
|
|
||||||
opcodes = listOf(Opcode.INVOKE_SUPER),
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.definingClass.endsWith("/YouTubeTextView;")
|
|
||||||
&& methodDef.name == "setText"
|
|
||||||
}
|
|
||||||
)
|
|
@ -55,8 +55,6 @@
|
|||||||
<string name="revanced_custom_player_overlay_opacity_warning">Player overlay opacity must be between 0-100. Reset to default values.</string>
|
<string name="revanced_custom_player_overlay_opacity_warning">Player overlay opacity must be between 0-100. Reset to default values.</string>
|
||||||
<string name="revanced_custom_seekbar_color_value_summary">Type the hex code of the seekbar color</string>
|
<string name="revanced_custom_seekbar_color_value_summary">Type the hex code of the seekbar color</string>
|
||||||
<string name="revanced_custom_seekbar_color_value_title">Custom seekbar color value</string>
|
<string name="revanced_custom_seekbar_color_value_title">Custom seekbar color value</string>
|
||||||
<string name="revanced_custom_speed_overlay_summary">Speed value that changes while holding down</string>
|
|
||||||
<string name="revanced_custom_speed_overlay_title">Custom speed overlay</string>
|
|
||||||
<string name="revanced_default_app_settings_summary">To open RVX in an external browser, turn on \'Open supported links\' and enable supported web addresses</string>
|
<string name="revanced_default_app_settings_summary">To open RVX in an external browser, turn on \'Open supported links\' and enable supported web addresses</string>
|
||||||
<string name="revanced_default_app_settings_title">Open default app settings</string>
|
<string name="revanced_default_app_settings_title">Open default app settings</string>
|
||||||
<string name="revanced_default_playback_speed_title">Default playback speed</string>
|
<string name="revanced_default_playback_speed_title">Default playback speed</string>
|
||||||
|
@ -399,7 +399,6 @@
|
|||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_player" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_player" />
|
||||||
<Preference android:title="Custom player overlay opacity" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Custom player overlay opacity" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Custom speed overlay" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
|
||||||
<Preference android:title="Disable haptic feedback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Disable haptic feedback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Hide autoplay button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Hide autoplay button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Hide captions button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Hide captions button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
@ -501,10 +500,7 @@
|
|||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_player" />PREFERENCE: PLAYER_SETTINGS -->
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_player" />PREFERENCE: PLAYER_SETTINGS -->
|
||||||
|
|
||||||
<!-- SETTINGS: CUSTOM_PLAYER_OVERLAY_OPACITY
|
<!-- SETTINGS: CUSTOM_PLAYER_OVERLAY_OPACITY
|
||||||
<app.revanced.integrations.settingsmenu.ResettableEditTextPreference android:hint="100" android:defaultValue="100" android:title="@string/revanced_custom_player_overlay_opacity_title" android:key="revanced_custom_player_overlay_opacity" android:summary="@string/revanced_custom_player_overlay_opacity_summary" android:inputType="number" />SETTINGS: CUSTOM_SPEED_OVERLAY -->
|
<app.revanced.integrations.settingsmenu.ResettableEditTextPreference android:hint="100" android:defaultValue="100" android:title="@string/revanced_custom_player_overlay_opacity_title" android:key="revanced_custom_player_overlay_opacity" android:summary="@string/revanced_custom_player_overlay_opacity_summary" android:inputType="number" />SETTINGS: CUSTOM_PLAYER_OVERLAY_OPACITY -->
|
||||||
|
|
||||||
<!-- SETTINGS: CUSTOM_SPEED_OVERLAY
|
|
||||||
<app.revanced.integrations.settingsmenu.ResettableEditTextPreference android:hint="2.0" android:defaultValue="2.0" android:title="@string/revanced_custom_speed_overlay_title" android:key="revanced_custom_speed_overlay" android:summary="@string/revanced_custom_speed_overlay_summary" android:inputType="text" />SETTINGS: CUSTOM_SPEED_OVERLAY -->
|
|
||||||
|
|
||||||
<!-- SETTINGS: HIDE_AUDIO_TRACK_BUTTON
|
<!-- SETTINGS: HIDE_AUDIO_TRACK_BUTTON
|
||||||
<SwitchPreference android:title="@string/revanced_hide_audio_track_button_title" android:key="revanced_hide_audio_track_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_audio_track_button_summary_on" android:summaryOff="@string/revanced_hide_audio_track_button_summary_off" />SETTINGS: HIDE_AUDIO_TRACK_BUTTON -->
|
<SwitchPreference android:title="@string/revanced_hide_audio_track_button_title" android:key="revanced_hide_audio_track_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_audio_track_button_summary_on" android:summaryOff="@string/revanced_hide_audio_track_button_summary_off" />SETTINGS: HIDE_AUDIO_TRACK_BUTTON -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user