mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-03 22:42:55 +01:00
feat: disable sponsorblock on shorts (#439)
This commit is contained in:
parent
d1fa2c3bc3
commit
47fbcba3f8
@ -0,0 +1,38 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("shorts-player-constructor-fingerprint")
|
||||||
|
@MatchingMethod("Lhgp;", "<init>")
|
||||||
|
@FuzzyPatternScanMethod(3)
|
||||||
|
@SponsorBlockCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ShortsPlayerConstructorFingerprint : MethodFingerprint(
|
||||||
|
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.MOVE_OBJECT_FROM16,
|
||||||
|
Opcode.MOVE_OBJECT_FROM16,
|
||||||
|
Opcode.MOVE_OBJECT_FROM16,
|
||||||
|
Opcode.INVOKE_DIRECT_RANGE,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT
|
||||||
|
)
|
||||||
|
)
|
@ -25,6 +25,7 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|||||||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch
|
||||||
|
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.StartVideoInformerFingerprint
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||||
@ -53,7 +54,8 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
NextGenWatchLayoutFingerprint,
|
NextGenWatchLayoutFingerprint,
|
||||||
AppendTimeFingerprint,
|
AppendTimeFingerprint,
|
||||||
PlayerInitFingerprint,
|
PlayerInitFingerprint,
|
||||||
PlayerOverlaysLayoutInitFingerprint
|
PlayerOverlaysLayoutInitFingerprint,
|
||||||
|
ShortsPlayerConstructorFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {/*
|
override fun execute(data: BytecodeData): PatchResult {/*
|
||||||
@ -324,6 +326,23 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val startVideoInformerMethod = StartVideoInformerFingerprint.result!!.mutableMethod
|
||||||
|
startVideoInformerMethod.addInstructions(
|
||||||
|
0, """
|
||||||
|
const/4 v0, 0x1
|
||||||
|
sput-boolean v0, Lapp/revanced/integrations/settings/SettingsEnum;->shorts_playing:Z
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
val shortsPlayerConstructorMethod = ShortsPlayerConstructorFingerprint.result!!.mutableMethod
|
||||||
|
|
||||||
|
shortsPlayerConstructorMethod.addInstructions(
|
||||||
|
0, """
|
||||||
|
const/4 v0, 0x0
|
||||||
|
sput-boolean v0, Lapp/revanced/integrations/settings/SettingsEnum;->shorts_playing:Z
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
// TODO: isSBChannelWhitelisting implementation
|
// TODO: isSBChannelWhitelisting implementation
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
Loading…
Reference in New Issue
Block a user