mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +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.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.fingerprint.method.impl.MethodFingerprint
|
@ -11,8 +11,6 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
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.util.integrations.Constants.UTILS_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")
|
||||
class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
listOf(
|
||||
EndScreenEngagementPanelsFingerprint,
|
||||
PlayerControllerFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
/*
|
||||
/**
|
||||
* Hook the video time methods
|
||||
*/
|
||||
with(MainstreamVideoIdPatch) {
|
||||
@ -66,14 +67,14 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Seekbar drawing
|
||||
*/
|
||||
insertMethod = HookTimeBarPatch.setTimeBarMethod
|
||||
insertInstructions = insertMethod.implementation!!.instructions
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the instance of the seekbar rectangle
|
||||
*/
|
||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||
@ -100,7 +101,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
break
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Set rectangle absolute left and right positions
|
||||
*/
|
||||
val drawRectangleInstructions = insertInstructions.filter {
|
||||
@ -120,7 +121,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
injectCallRectangle(index, register, string)
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Draw segment
|
||||
*/
|
||||
for ((index, instruction) in insertInstructions.withIndex()) {
|
||||
@ -141,7 +142,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
break
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Voting & Shield button
|
||||
*/
|
||||
arrayOf("CreateSegmentButtonController", "VotingButtonController").forEach {
|
||||
@ -149,8 +150,15 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
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
|
||||
*/
|
||||
PlayerControllerFingerprint.result?.mutableMethod?.let {
|
||||
@ -167,7 +175,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
}
|
||||
} ?: return PlayerControllerFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
/**
|
||||
* Inject VideoIdPatch
|
||||
*/
|
||||
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.Companion.toMutable
|
||||
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.timebar.patch.HookTimeBarPatch
|
||||
import app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint.*
|
||||
@ -49,24 +47,12 @@ class MainstreamVideoIdPatch : BytecodePatch(
|
||||
PlayerInitFingerprint,
|
||||
SeekFingerprint,
|
||||
TimebarFingerprint,
|
||||
VideoEndParentFingerprint,
|
||||
VideoTimeHighPrecisionFingerprint,
|
||||
VideoTimeHighPrecisionParentFingerprint
|
||||
)
|
||||
) {
|
||||
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 ->
|
||||
playerInitMethod = parentResult.mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
||||
|
||||
|
Reference in New Issue
Block a user