mirror of
https://github.com/revanced/revanced-patches
synced 2024-09-03 04:56:05 +02:00
fix(youtube/sponsorblock): fix skip button in wrong location when full screen and comments visible (#2051)
This commit is contained in:
parent
43d22014c7
commit
30a954cac8
@ -4,7 +4,7 @@ import app.revanced.patcher.annotation.Compatibility
|
|||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility(
|
@Compatibility(
|
||||||
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40", "18.16.37"))]
|
[Package("com.google.android.youtube", arrayOf("18.15.40", "18.16.37"))]
|
||||||
)
|
)
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class SponsorBlockCompatibility
|
internal annotation class SponsorBlockCompatibility
|
@ -0,0 +1,27 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.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 ControlsOverlayFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
access = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
|
parameters = listOf(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST, // R.id.inset_overlay_view_layout
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.definingClass == "Lcom/google/android/apps/youtube/app/player/overlay/YouTubeControlsOverlay;"
|
||||||
|
}
|
||||||
|
)
|
@ -1,9 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
|
|
||||||
object PlayerOverlaysLayoutInitFingerprint : MethodFingerprint(
|
|
||||||
|
|
||||||
customFingerprint = { methodDef -> methodDef.returnType.endsWith("YouTubePlayerOverlaysLayout;") }
|
|
||||||
)
|
|
@ -8,6 +8,7 @@ import app.revanced.patcher.data.BytecodeContext
|
|||||||
import app.revanced.patcher.data.toMethodWalker
|
import app.revanced.patcher.data.toMethodWalker
|
||||||
import app.revanced.patcher.extensions.addInstruction
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
import app.revanced.patcher.extensions.replaceInstruction
|
||||||
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
|
||||||
@ -22,7 +23,7 @@ import app.revanced.patches.shared.fingerprints.SeekbarOnDrawFingerprint
|
|||||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.AppendTimeFingerprint
|
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.AppendTimeFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.PlayerOverlaysLayoutInitFingerprint
|
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.ControlsOverlayFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.RectangleFieldInvalidatorFingerprint
|
import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.RectangleFieldInvalidatorFingerprint
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatFingerprint
|
import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatFingerprint
|
||||||
@ -60,7 +61,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
listOf(
|
listOf(
|
||||||
SeekbarFingerprint,
|
SeekbarFingerprint,
|
||||||
AppendTimeFingerprint,
|
AppendTimeFingerprint,
|
||||||
PlayerOverlaysLayoutInitFingerprint,
|
ControlsOverlayFingerprint,
|
||||||
AutoRepeatParentFingerprint,
|
AutoRepeatParentFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -198,8 +199,8 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
method.addInstructions(
|
method.addInstructions(
|
||||||
moveResultInstructionIndex + 1, // insert right after moving the view to the register and use that register
|
moveResultInstructionIndex + 1, // insert right after moving the view to the register and use that register
|
||||||
"""
|
"""
|
||||||
invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Ljava/lang/Object;)V
|
invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_CREATE_SEGMENT_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/View;)V
|
||||||
invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Ljava/lang/Object;)V
|
invoke-static {v$inflatedViewRegister}, $INTEGRATIONS_VOTING_BUTTON_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/View;)V
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -240,10 +241,16 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
VideoInformationPatch.onCreateHook(INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR, "initialize")
|
VideoInformationPatch.onCreateHook(INTEGRATIONS_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR, "initialize")
|
||||||
|
|
||||||
// initialize the sponsorblock view
|
// initialize the sponsorblock view
|
||||||
PlayerOverlaysLayoutInitFingerprint.result!!.mutableMethod.addInstruction(
|
ControlsOverlayFingerprint.result?.let {
|
||||||
6, // after inflating the view
|
val startIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
"invoke-static {p0}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Ljava/lang/Object;)V"
|
it.mutableMethod.apply {
|
||||||
)
|
val frameLayoutRegister = (instruction(startIndex + 2) as OneRegisterInstruction).registerA
|
||||||
|
addInstruction(
|
||||||
|
startIndex + 3,
|
||||||
|
"invoke-static {v$frameLayoutRegister}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/ViewGroup;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return ControlsOverlayFingerprint.toErrorResult()
|
||||||
|
|
||||||
// get rectangle field name
|
// get rectangle field name
|
||||||
RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef)
|
RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef)
|
||||||
|
Loading…
Reference in New Issue
Block a user