mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
change video speed
to playback speed
(#13)
* feat(youtube): `video-speed` renamed to `playback-speed` * Update revanced_prefs.xml * update missing text * more video speed
This commit is contained in:
@ -25,7 +25,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
|
||||
@Patch
|
||||
@Name("Enable time stamps speed")
|
||||
@Description("Add the current video speed in brackets next to the current time.")
|
||||
@Description("Add the current playback speed in brackets next to the current time.")
|
||||
@DependsOn(
|
||||
[
|
||||
OverrideSpeedHookPatch::class,
|
||||
|
@ -3,7 +3,7 @@ package app.revanced.patches.youtube.utils.overridespeed.fingerprints
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object VideoSpeedChangedFingerprint : MethodFingerprint(
|
||||
object PlaybackSpeedChangedFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IF_EQZ,
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object VideoSpeedParentFingerprint : MethodFingerprint(
|
||||
object PlaybackSpeedParentFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("L", "L", "[L", "I"),
|
@ -4,9 +4,9 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object VideoSpeedPatchFingerprint : MethodFingerprint(
|
||||
object PlaybackSpeedPatchFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
parameters = listOf("F"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/VideoSpeedPatch;") && methodDef.name == "overrideSpeed" }
|
||||
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/PlaybackSpeedPatch;") && methodDef.name == "overrideSpeed" }
|
||||
)
|
@ -18,9 +18,9 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.toInstructions
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.SpeedClassFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.VideoSpeedChangedFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.VideoSpeedParentFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.VideoSpeedPatchFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.PlaybackSpeedChangedFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.PlaybackSpeedParentFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridespeed.fingerprints.PlaybackSpeedPatchFingerprint
|
||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
@ -35,18 +35,18 @@ import org.jf.dexlib2.immutable.ImmutableMethodParameter
|
||||
class OverrideSpeedHookPatch : BytecodePatch(
|
||||
listOf(
|
||||
SpeedClassFingerprint,
|
||||
VideoSpeedPatchFingerprint,
|
||||
VideoSpeedParentFingerprint
|
||||
PlaybackSpeedPatchFingerprint,
|
||||
PlaybackSpeedParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
VideoSpeedParentFingerprint.result?.let { parentResult ->
|
||||
PlaybackSpeedParentFingerprint.result?.let { parentResult ->
|
||||
val parentClassDef = parentResult.classDef
|
||||
|
||||
VideoSpeedChangedFingerprint.also { it.resolve(context, parentClassDef) }.result?.let {
|
||||
PlaybackSpeedChangedFingerprint.also { it.resolve(context, parentClassDef) }.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
videoSpeedChangedResult = it
|
||||
playbackSpeedChangedResult = it
|
||||
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
@ -95,8 +95,8 @@ class OverrideSpeedHookPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
} ?: return VideoSpeedChangedFingerprint.toErrorResult()
|
||||
} ?: return VideoSpeedParentFingerprint.toErrorResult()
|
||||
} ?: return PlaybackSpeedChangedFingerprint.toErrorResult()
|
||||
} ?: return PlaybackSpeedParentFingerprint.toErrorResult()
|
||||
|
||||
|
||||
SpeedClassFingerprint.result?.let {
|
||||
@ -106,7 +106,7 @@ class OverrideSpeedHookPatch : BytecodePatch(
|
||||
SPEED_CLASS = this.returnType
|
||||
replaceInstruction(
|
||||
index,
|
||||
"sput-object v$register, $INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->speedClass:$SPEED_CLASS"
|
||||
"sput-object v$register, $INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR->speedClass:$SPEED_CLASS"
|
||||
)
|
||||
addInstruction(
|
||||
index + 1,
|
||||
@ -116,7 +116,7 @@ class OverrideSpeedHookPatch : BytecodePatch(
|
||||
|
||||
} ?: return SpeedClassFingerprint.toErrorResult()
|
||||
|
||||
VideoSpeedPatchFingerprint.result?.let {
|
||||
PlaybackSpeedPatchFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
it.mutableClass.staticFields.add(
|
||||
ImmutableField(
|
||||
@ -132,25 +132,25 @@ class OverrideSpeedHookPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
0, """
|
||||
sget-object v0, $INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->speedClass:$SPEED_CLASS
|
||||
sget-object v0, $INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR->speedClass:$SPEED_CLASS
|
||||
invoke-virtual {v0, p0}, $SPEED_CLASS->overrideSpeed(F)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
} ?: return VideoSpeedPatchFingerprint.toErrorResult()
|
||||
} ?: return PlaybackSpeedPatchFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
const val INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/VideoSpeedPatch;"
|
||||
const val INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/PlaybackSpeedPatch;"
|
||||
|
||||
const val INTEGRATIONS_VIDEO_HELPER_CLASS_DESCRIPTOR =
|
||||
"$INTEGRATIONS_PATH/utils/VideoHelpers;"
|
||||
|
||||
lateinit var videoSpeedChangedResult: MethodFingerprintResult
|
||||
lateinit var playbackSpeedChangedResult: MethodFingerprintResult
|
||||
|
||||
private lateinit var SPEED_CLASS: String
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import org.jf.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch
|
||||
@Name("Custom video speed")
|
||||
@Description("Adds more video speed options.")
|
||||
@Name("Custom playback speed")
|
||||
@Description("Adds more playback speed options.")
|
||||
@DependsOn(
|
||||
[
|
||||
OldSpeedLayoutPatch::class,
|
||||
@ -38,7 +38,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomVideoSpeedPatch : BytecodePatch(
|
||||
class CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
listOf(
|
||||
SpeedArrayGeneratorFingerprint,
|
||||
SpeedLimiterFallBackFingerprint,
|
||||
@ -53,7 +53,7 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $VIDEO_PATH/CustomVideoSpeedPatch;->getLength(I)I
|
||||
invoke-static {v$targetRegister}, $VIDEO_PATH/CustomPlaybackSpeedPatch;->getLength(I)I
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -70,7 +70,7 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
index + 2, """
|
||||
invoke-static {v$register}, $VIDEO_PATH/CustomVideoSpeedPatch;->getSize(I)I
|
||||
invoke-static {v$register}, $VIDEO_PATH/CustomPlaybackSpeedPatch;->getSize(I)I
|
||||
move-result v$register
|
||||
"""
|
||||
)
|
||||
@ -89,7 +89,7 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
index + 1, """
|
||||
invoke-static {v$register}, $VIDEO_PATH/CustomVideoSpeedPatch;->getArray([F)[F
|
||||
invoke-static {v$register}, $VIDEO_PATH/CustomPlaybackSpeedPatch;->getArray([F)[F
|
||||
move-result-object v$register
|
||||
"""
|
||||
)
|
||||
@ -133,11 +133,11 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: CUSTOM_VIDEO_SPEED"
|
||||
"SETTINGS: CUSTOM_PLAYBACK_SPEED"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("custom-video-speed")
|
||||
SettingsPatch.updatePatchStatus("custom-playback-speed")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object NewVideoSpeedChangedFingerprint : MethodFingerprint(
|
||||
object NewPlaybackSpeedChangedFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
@ -18,13 +18,13 @@ import app.revanced.patches.youtube.utils.fingerprints.NewFlyoutPanelOnClickList
|
||||
import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.videocpn.patch.VideoCpnPatch
|
||||
import app.revanced.patches.youtube.video.speed.fingerprints.NewVideoSpeedChangedFingerprint
|
||||
import app.revanced.patches.youtube.video.speed.fingerprints.NewPlaybackSpeedChangedFingerprint
|
||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Default video speed")
|
||||
@Description("Adds ability to set default video speed settings.")
|
||||
@Name("Default playback speed")
|
||||
@Description("Adds ability to set default playback speed settings.")
|
||||
@DependsOn(
|
||||
[
|
||||
OverrideSpeedHookPatch::class,
|
||||
@ -33,33 +33,33 @@ import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoSpeedPatch : BytecodePatch(
|
||||
class PlaybackSpeedPatch : BytecodePatch(
|
||||
listOf(NewFlyoutPanelOnClickListenerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
NewFlyoutPanelOnClickListenerFingerprint.result?.let { parentResult ->
|
||||
NewVideoSpeedChangedFingerprint.also {
|
||||
NewPlaybackSpeedChangedFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.let { result ->
|
||||
arrayOf(result, OverrideSpeedHookPatch.videoSpeedChangedResult).forEach {
|
||||
arrayOf(result, OverrideSpeedHookPatch.playbackSpeedChangedResult).forEach {
|
||||
it.mutableMethod.apply {
|
||||
val index = it.scanResult.patternScanResult!!.endIndex
|
||||
val register = getInstruction<FiveRegisterInstruction>(index).registerD
|
||||
|
||||
addInstruction(
|
||||
index,
|
||||
"invoke-static {v$register}, $INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->userChangedSpeed(F)V"
|
||||
"invoke-static {v$register}, $INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR->userChangedSpeed(F)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: return NewVideoSpeedChangedFingerprint.toErrorResult()
|
||||
} ?: return NewPlaybackSpeedChangedFingerprint.toErrorResult()
|
||||
} ?: return NewFlyoutPanelOnClickListenerFingerprint.toErrorResult()
|
||||
|
||||
VideoCpnPatch.injectCall("$INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Z)V")
|
||||
VideoCpnPatch.injectCall("$INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Z)V")
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -67,17 +67,17 @@ class VideoSpeedPatch : BytecodePatch(
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: VIDEO_SETTINGS",
|
||||
"SETTINGS: DEFAULT_VIDEO_SPEED"
|
||||
"SETTINGS: DEFAULT_PLAYBACK_SPEED"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("default-video-speed")
|
||||
SettingsPatch.updatePatchStatus("default-playback-speed")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/VideoSpeedPatch;"
|
||||
const val INTEGRATIONS_PLAYBACK_SPEED_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/PlaybackSpeedPatch;"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user