mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-31 22:30:17 +02:00
fix(YouTube/Hide previous next button): match to official ReVanced code
This commit is contained in:
parent
62573fbca5
commit
4006b55e17
@ -1,19 +1,21 @@
|
|||||||
package app.revanced.patches.youtube.player.previousnextbutton
|
package app.revanced.patches.youtube.player.previousnextbutton
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
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.utils.playerbutton.PlayerButtonHookPatch
|
import app.revanced.patches.youtube.utils.fingerprints.PlayerControlsVisibilityModelFingerprint
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.PLAYER
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Hide previous next button",
|
name = "Hide previous next button",
|
||||||
description = "Hides the previous and next button in the player controller.",
|
description = "Hides the previous and next button in the player controller.",
|
||||||
dependencies = [
|
dependencies = [SettingsPatch::class],
|
||||||
PlayerButtonHookPatch::class,
|
|
||||||
SettingsPatch::class
|
|
||||||
],
|
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage(
|
CompatiblePackage(
|
||||||
"com.google.android.youtube",
|
"com.google.android.youtube",
|
||||||
@ -40,9 +42,35 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object HidePreviousNextButtonPatch : BytecodePatch() {
|
object HidePreviousNextButtonPatch : BytecodePatch(
|
||||||
|
setOf(PlayerControlsVisibilityModelFingerprint)
|
||||||
|
) {
|
||||||
|
private const val HAS_NEXT = 5
|
||||||
|
private const val HAS_PREVIOUS = 6
|
||||||
|
|
||||||
|
private const val INTEGRATIONS_METHOD_REFERENCE =
|
||||||
|
"$PLAYER->hidePreviousNextButton(Z)Z"
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
PlayerControlsVisibilityModelFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val callIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val callInstruction = getInstruction<Instruction3rc>(callIndex)
|
||||||
|
|
||||||
|
val hasNextParameterRegister = callInstruction.startRegister + HAS_NEXT
|
||||||
|
val hasPreviousParameterRegister = callInstruction.startRegister + HAS_PREVIOUS
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
callIndex, """
|
||||||
|
invoke-static { v$hasNextParameterRegister }, $INTEGRATIONS_METHOD_REFERENCE
|
||||||
|
move-result v$hasNextParameterRegister
|
||||||
|
invoke-static { v$hasPreviousParameterRegister }, $INTEGRATIONS_METHOD_REFERENCE
|
||||||
|
move-result v$hasPreviousParameterRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw PlayerControlsVisibilityModelFingerprint.exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.utils.playercontrols.fingerprints
|
package app.revanced.patches.youtube.utils.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
object PlayerControlsVisibilityModelFingerprint : MethodFingerprint(
|
object PlayerControlsVisibilityModelFingerprint : MethodFingerprint(
|
||||||
opcodes = listOf(Opcode.IGET_BOOLEAN),
|
opcodes = listOf(Opcode.INVOKE_DIRECT_RANGE),
|
||||||
strings = listOf("Missing required properties:", "hasNext", "hasPrevious")
|
strings = listOf("Missing required properties:", "hasNext", "hasPrevious")
|
||||||
)
|
)
|
@ -16,7 +16,7 @@ import app.revanced.patches.youtube.utils.playercontrols.fingerprints.ControlsLa
|
|||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.FullscreenEngagementSpeedEduVisibleFingerprint
|
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.FullscreenEngagementSpeedEduVisibleFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.FullscreenEngagementSpeedEduVisibleParentFingerprint
|
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.FullscreenEngagementSpeedEduVisibleParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.PlayerControlsVisibilityFingerprint
|
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.PlayerControlsVisibilityFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.PlayerControlsVisibilityModelFingerprint
|
import app.revanced.patches.youtube.utils.fingerprints.PlayerControlsVisibilityModelFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.QuickSeekVisibleFingerprint
|
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.QuickSeekVisibleFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.SeekEDUVisibleFingerprint
|
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.SeekEDUVisibleFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.UserScrubbingFingerprint
|
import app.revanced.patches.youtube.utils.playercontrols.fingerprints.UserScrubbingFingerprint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user