mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
fix(youtube/sponsorblock): vote button and new segment button do not disappear when end screen overlay appears
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.shared.fingerprints
|
package app.revanced.patches.youtube.button.autorepeat.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.shared.fingerprints
|
package app.revanced.patches.youtube.button.autorepeat.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -11,8 +11,6 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.fingerprints.VideoEndFingerprint
|
|
||||||
import app.revanced.patches.shared.fingerprints.VideoEndParentFingerprint
|
|
||||||
import app.revanced.patches.youtube.button.autorepeat.fingerprints.*
|
import app.revanced.patches.youtube.button.autorepeat.fingerprints.*
|
||||||
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
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object EndScreenEngagementPanelsFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
opcodes = listOf(Opcode.CONST_WIDE_16),
|
||||||
|
strings = listOf("ITEM_COUNT")
|
||||||
|
)
|
@ -46,12 +46,13 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SponsorBlockBytecodePatch : BytecodePatch(
|
class SponsorBlockBytecodePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
|
EndScreenEngagementPanelsFingerprint,
|
||||||
PlayerControllerFingerprint
|
PlayerControllerFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Hook the video time methods
|
* Hook the video time methods
|
||||||
*/
|
*/
|
||||||
with(MainstreamVideoIdPatch) {
|
with(MainstreamVideoIdPatch) {
|
||||||
@ -66,14 +67,14 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Seekbar drawing
|
* Seekbar drawing
|
||||||
*/
|
*/
|
||||||
insertMethod = HookTimeBarPatch.setTimeBarMethod
|
insertMethod = HookTimeBarPatch.setTimeBarMethod
|
||||||
insertInstructions = insertMethod.implementation!!.instructions
|
insertInstructions = insertMethod.implementation!!.instructions
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Get the instance of the seekbar rectangle
|
* Get the instance of the seekbar rectangle
|
||||||
*/
|
*/
|
||||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||||
@ -100,7 +101,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Set rectangle absolute left and right positions
|
* Set rectangle absolute left and right positions
|
||||||
*/
|
*/
|
||||||
val drawRectangleInstructions = insertInstructions.filter {
|
val drawRectangleInstructions = insertInstructions.filter {
|
||||||
@ -120,7 +121,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
injectCallRectangle(index, register, string)
|
injectCallRectangle(index, register, string)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Draw segment
|
* Draw segment
|
||||||
*/
|
*/
|
||||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||||
@ -141,7 +142,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Voting & Shield button
|
* Voting & Shield button
|
||||||
*/
|
*/
|
||||||
arrayOf("CreateSegmentButtonController", "VotingButtonController").forEach {
|
arrayOf("CreateSegmentButtonController", "VotingButtonController").forEach {
|
||||||
@ -149,8 +150,15 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
PlayerControlsPatch.injectVisibility("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/ui/$it;")
|
PlayerControlsPatch.injectVisibility("$INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/ui/$it;")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EndScreenEngagementPanelsFingerprint.result?.mutableMethod?.let {
|
||||||
|
it.addInstruction(
|
||||||
|
it.implementation!!.instructions.size - 1,
|
||||||
|
"invoke-static {}, $INTEGRATIONS_BUTTON_CLASS_DESCRIPTOR/ui/SponsorBlockViewController;->endOfVideoReached()V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
/**
|
||||||
* Replace strings
|
* Replace strings
|
||||||
*/
|
*/
|
||||||
PlayerControllerFingerprint.result?.mutableMethod?.let {
|
PlayerControllerFingerprint.result?.mutableMethod?.let {
|
||||||
@ -167,7 +175,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return PlayerControllerFingerprint.toErrorResult()
|
} ?: return PlayerControllerFingerprint.toErrorResult()
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Inject VideoIdPatch
|
* Inject VideoIdPatch
|
||||||
*/
|
*/
|
||||||
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
||||||
|
@ -15,8 +15,6 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.shared.fingerprints.VideoEndFingerprint
|
|
||||||
import app.revanced.patches.shared.fingerprints.VideoEndParentFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.timebar.patch.HookTimeBarPatch
|
import app.revanced.patches.youtube.misc.timebar.patch.HookTimeBarPatch
|
||||||
import app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint.*
|
import app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint.*
|
||||||
@ -49,24 +47,12 @@ class MainstreamVideoIdPatch : BytecodePatch(
|
|||||||
PlayerInitFingerprint,
|
PlayerInitFingerprint,
|
||||||
SeekFingerprint,
|
SeekFingerprint,
|
||||||
TimebarFingerprint,
|
TimebarFingerprint,
|
||||||
VideoEndParentFingerprint,
|
|
||||||
VideoTimeHighPrecisionFingerprint,
|
VideoTimeHighPrecisionFingerprint,
|
||||||
VideoTimeHighPrecisionParentFingerprint
|
VideoTimeHighPrecisionParentFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
VideoEndParentFingerprint.result?.classDef?.let { classDef ->
|
|
||||||
VideoEndFingerprint.also {
|
|
||||||
it.resolve(context, classDef)
|
|
||||||
}.result?.mutableMethod?.let { method ->
|
|
||||||
method.addInstruction(
|
|
||||||
method.implementation!!.instructions.size - 1,
|
|
||||||
"invoke-static {}, $VIDEO_PATH/VideoInformation;->videoEnd()V"
|
|
||||||
)
|
|
||||||
} ?: return VideoEndFingerprint.toErrorResult()
|
|
||||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
PlayerInitFingerprint.result?.let { parentResult ->
|
PlayerInitFingerprint.result?.let { parentResult ->
|
||||||
playerInitMethod = parentResult.mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
playerInitMethod = parentResult.mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user