mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-24 02:42:11 +02:00
feat(YouTube/Disable speed overlay): Disable speed overlay
now restores the old Slide to seek
behavior 🥳
This commit is contained in:
parent
0cbf99a8fa
commit
0ede198754
@ -2,18 +2,16 @@ package app.revanced.patches.youtube.player.speedoverlay
|
|||||||
|
|
||||||
import app.revanced.extensions.exception
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
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.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.youtube.player.speedoverlay.fingerprints.RestoreSlideToSeekBehaviorFingerprint
|
||||||
import app.revanced.patches.youtube.player.speedoverlay.fingerprints.SpeedOverlayFingerprint
|
import app.revanced.patches.youtube.player.speedoverlay.fingerprints.SpeedOverlayFingerprint
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.PLAYER
|
import app.revanced.util.integrations.Constants.PLAYER
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Disable speed overlay",
|
name = "Disable speed overlay",
|
||||||
@ -43,43 +41,32 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpeedOverlayPatch : BytecodePatch(
|
object SpeedOverlayPatch : BytecodePatch(
|
||||||
setOf(SpeedOverlayFingerprint)
|
setOf(
|
||||||
|
RestoreSlideToSeekBehaviorFingerprint,
|
||||||
|
SpeedOverlayFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
SpeedOverlayFingerprint.result?.let {
|
arrayOf(
|
||||||
it.mutableMethod.apply {
|
RestoreSlideToSeekBehaviorFingerprint,
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
SpeedOverlayFingerprint
|
||||||
|
).forEach { fingerprint ->
|
||||||
|
fingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex + 1
|
||||||
|
val insertRegister =
|
||||||
|
getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
for (index in endIndex downTo 0) {
|
addInstructions(
|
||||||
if (getInstruction(index).opcode != Opcode.RETURN_VOID) continue
|
insertIndex, """
|
||||||
|
invoke-static {v$insertRegister}, $PLAYER->disableSpeedOverlay(Z)Z
|
||||||
val replaceIndex = index + 1
|
move-result v$insertRegister
|
||||||
|
|
||||||
val replaceReference =
|
|
||||||
getInstruction<ReferenceInstruction>(replaceIndex).reference
|
|
||||||
|
|
||||||
val replaceInstruction = getInstruction<TwoRegisterInstruction>(replaceIndex)
|
|
||||||
val registerA = replaceInstruction.registerA
|
|
||||||
val registerB = replaceInstruction.registerB
|
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
|
||||||
replaceIndex + 1, """
|
|
||||||
invoke-static { }, $PLAYER->disableSpeedOverlay()Z
|
|
||||||
move-result v$registerA
|
|
||||||
if-eqz v$registerA, :show
|
|
||||||
return-void
|
|
||||||
:show
|
|
||||||
iget-object v$registerA, v$registerB, $replaceReference
|
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
removeInstruction(replaceIndex)
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
} ?: throw fingerprint.exception
|
||||||
} ?: throw SpeedOverlayFingerprint.exception
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.player.speedoverlay.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value restores the 'Slide to seek' behavior.
|
||||||
|
*/
|
||||||
|
object RestoreSlideToSeekBehaviorFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
parameters = emptyList(),
|
||||||
|
opcodes = listOf(Opcode.MOVE_RESULT),
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45411329) }
|
||||||
|
)
|
@ -1,36 +1,15 @@
|
|||||||
package app.revanced.patches.youtube.player.speedoverlay.fingerprints
|
package app.revanced.patches.youtube.player.speedoverlay.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value disables 'Playing at 2x speed' while holding down.
|
||||||
|
*/
|
||||||
object SpeedOverlayFingerprint : MethodFingerprint(
|
object SpeedOverlayFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "Z",
|
||||||
opcodes = listOf(
|
parameters = emptyList(),
|
||||||
Opcode.INVOKE_VIRTUAL,
|
opcodes = listOf(Opcode.MOVE_RESULT),
|
||||||
Opcode.IGET_OBJECT,
|
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45411330) }
|
||||||
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
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef, _ -> methodDef.name == "run" }
|
|
||||||
)
|
)
|
@ -89,9 +89,7 @@
|
|||||||
<string name="revanced_disable_landscape_mode_title">Disable landscape mode</string>
|
<string name="revanced_disable_landscape_mode_title">Disable landscape mode</string>
|
||||||
<string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol."</string>
|
<string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol."</string>
|
||||||
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
|
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
|
||||||
<string name="revanced_disable_speed_overlay_summary">"Disable 'Playing at 2x speed' while holding down.
|
<string name="revanced_disable_speed_overlay_summary">"Disable 'Playing at 2x speed' while holding down."</string>
|
||||||
|
|
||||||
Note: Disabling the speed overlay does not restore the 'Slide to seek' behavior of the old layout."</string>
|
|
||||||
<string name="revanced_disable_speed_overlay_title">Disable speed overlay</string>
|
<string name="revanced_disable_speed_overlay_title">Disable speed overlay</string>
|
||||||
<string name="revanced_disable_startup_shorts_player_summary_off">Shorts player is enabled at app startup.</string>
|
<string name="revanced_disable_startup_shorts_player_summary_off">Shorts player is enabled at app startup.</string>
|
||||||
<string name="revanced_disable_startup_shorts_player_summary_on">Shorts player is disabled at app startup.</string>
|
<string name="revanced_disable_startup_shorts_player_summary_on">Shorts player is disabled at app startup.</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user