mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
feat(youtube/overlay-buttons): now you can disable autoplay by long-pressing the always repeat button
This commit is contained in:
@ -1,19 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object RepeatListenerFingerprint : MethodFingerprint(
|
|
||||||
returnType = "Z",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.CONST_WIDE_32
|
|
||||||
),
|
|
||||||
strings = listOf("ppoobsa")
|
|
||||||
)
|
|
@ -5,10 +5,10 @@ import app.revanced.patcher.annotation.Name
|
|||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
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.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
@ -16,15 +16,14 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.AutoNavInformerFingerprint
|
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.AutoNavInformerFingerprint
|
||||||
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.RepeatListenerFingerprint
|
|
||||||
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.VideoEndFingerprint
|
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.VideoEndFingerprint
|
||||||
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.VideoEndParentFingerprint
|
import app.revanced.patches.youtube.overlaybutton.autorepeat.fingerprints.VideoEndParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.utils.fingerprints.PlayerPatchFingerprint
|
||||||
|
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
|
|
||||||
@Name("always-repeat")
|
@Name("always-repeat")
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@ -32,7 +31,7 @@ import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
|||||||
class AutoRepeatPatch : BytecodePatch(
|
class AutoRepeatPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
AutoNavInformerFingerprint,
|
AutoNavInformerFingerprint,
|
||||||
RepeatListenerFingerprint,
|
PlayerPatchFingerprint,
|
||||||
VideoEndParentFingerprint
|
VideoEndParentFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -42,6 +41,7 @@ class AutoRepeatPatch : BytecodePatch(
|
|||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
0, """
|
0, """
|
||||||
|
invoke-static {}, $UTILS_PATH/AlwaysRepeatPatch;->shouldRepeatAndPause()V
|
||||||
invoke-static {}, $VIDEO_PATH/VideoInformation;->shouldAutoRepeat()Z
|
invoke-static {}, $VIDEO_PATH/VideoInformation;->shouldAutoRepeat()Z
|
||||||
move-result v0
|
move-result v0
|
||||||
if-eqz v0, :notrepeat
|
if-eqz v0, :notrepeat
|
||||||
@ -52,28 +52,12 @@ class AutoRepeatPatch : BytecodePatch(
|
|||||||
} ?: return VideoEndFingerprint.toErrorResult()
|
} ?: return VideoEndFingerprint.toErrorResult()
|
||||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
} ?: return VideoEndParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
RepeatListenerFingerprint.result?.let {
|
PlayerPatchFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
it.mutableMethod.apply {
|
0,
|
||||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex - 1
|
"invoke-static {p0}, " +
|
||||||
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" +
|
||||||
|
"setPlayPauseButton(Landroid/view/View;)V"
|
||||||
val registerC = getInstruction<BuilderInstruction35c>(targetIndex).registerC
|
) ?: return PlayerPatchFingerprint.toErrorResult()
|
||||||
val registerD = getInstruction<BuilderInstruction35c>(targetIndex).registerD
|
|
||||||
|
|
||||||
val dummyRegister = getInstruction<OneRegisterInstruction>(endIndex).registerA
|
|
||||||
val targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference
|
|
||||||
|
|
||||||
addInstructionsWithLabels(
|
|
||||||
targetIndex + 1, """
|
|
||||||
invoke-static {}, $UTILS_PATH/AlwaysRepeatPatch;->shouldAlwaysRepeat()Z
|
|
||||||
move-result v$dummyRegister
|
|
||||||
if-nez v$dummyRegister, :bypass
|
|
||||||
invoke-virtual {v$registerC, v$registerD}, $targetReference
|
|
||||||
""", ExternalLabel("bypass", getInstruction(targetIndex + 1))
|
|
||||||
)
|
|
||||||
removeInstruction(targetIndex)
|
|
||||||
}
|
|
||||||
} ?: return RepeatListenerFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
AutoNavInformerFingerprint.result?.let {
|
AutoNavInformerFingerprint.result?.let {
|
||||||
with(
|
with(
|
||||||
|
@ -13,6 +13,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.overlaybutton.autorepeat.patch.AutoRepeatPatch
|
import app.revanced.patches.youtube.overlaybutton.autorepeat.patch.AutoRepeatPatch
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch
|
import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch
|
||||||
|
import app.revanced.patches.youtube.utils.playerbutton.patch.PlayerButtonHookPatch
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.patch.PlayerControlsPatch
|
import app.revanced.patches.youtube.utils.playercontrols.patch.PlayerControlsPatch
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
@ -30,6 +31,7 @@ import org.w3c.dom.Element
|
|||||||
[
|
[
|
||||||
AutoRepeatPatch::class,
|
AutoRepeatPatch::class,
|
||||||
OverrideSpeedHookPatch::class,
|
OverrideSpeedHookPatch::class,
|
||||||
|
PlayerButtonHookPatch::class,
|
||||||
PlayerControlsPatch::class,
|
PlayerControlsPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class,
|
SharedResourceIdPatch::class,
|
||||||
|
@ -11,8 +11,8 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.HidePlayerButtonFingerprint
|
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.utils.fingerprints.PlayerPatchFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playerbutton.patch.PlayerButtonHookPatch
|
import app.revanced.patches.youtube.utils.playerbutton.patch.PlayerButtonHookPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||||
@ -29,16 +29,16 @@ import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
|||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class HidePlayerButtonBackgroundPatch : BytecodePatch(
|
class HidePlayerButtonBackgroundPatch : BytecodePatch(
|
||||||
listOf(HidePlayerButtonFingerprint)
|
listOf(PlayerPatchFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
HidePlayerButtonFingerprint.result?.mutableMethod?.addInstruction(
|
PlayerPatchFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static {p0}, " +
|
"invoke-static {p0}, " +
|
||||||
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" +
|
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" +
|
||||||
"hidePlayerButtonBackground(Landroid/view/View;)V"
|
"hidePlayerButtonBackground(Landroid/view/View;)V"
|
||||||
) ?: return HidePlayerButtonFingerprint.toErrorResult()
|
) ?: return PlayerPatchFingerprint.toErrorResult()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package app.revanced.patches.youtube.player.playerbuttonbg.fingerprints
|
package app.revanced.patches.youtube.utils.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
object HidePlayerButtonFingerprint : MethodFingerprint(
|
object PlayerPatchFingerprint : MethodFingerprint(
|
||||||
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PlayerPatch;") && methodDef.name == "hidePlayerButton" }
|
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("PlayerPatch;") && methodDef.name == "hidePlayerButton" }
|
||||||
)
|
)
|
Reference in New Issue
Block a user