mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-06 17:44:36 +02:00
feat(youtube/default-video-quality): apply video-cpn-hook
instead of video-id-hook
This commit is contained in:
parent
818629b4dc
commit
78e86a192b
@ -16,7 +16,7 @@ import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookP
|
|||||||
import app.revanced.patches.youtube.utils.playercontrols.patch.PlayerControlsPatch
|
import app.revanced.patches.youtube.utils.playercontrols.patch.PlayerControlsPatch
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.patch.MainstreamVideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.general.patch.VideoIdPatch
|
||||||
import app.revanced.util.integrations.Constants.BUTTON_PATH
|
import app.revanced.util.integrations.Constants.BUTTON_PATH
|
||||||
import app.revanced.util.resources.ResourceUtils
|
import app.revanced.util.resources.ResourceUtils
|
||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
@ -29,11 +29,11 @@ import org.w3c.dom.Element
|
|||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
AutoRepeatPatch::class,
|
AutoRepeatPatch::class,
|
||||||
MainstreamVideoIdPatch::class,
|
|
||||||
OverrideSpeedHookPatch::class,
|
OverrideSpeedHookPatch::class,
|
||||||
PlayerControlsPatch::class,
|
PlayerControlsPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class
|
SharedResourceIdPatch::class,
|
||||||
|
VideoIdPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
|
@ -19,15 +19,15 @@ import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.ProtobufPar
|
|||||||
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.SubtitleWindowFingerprint
|
import app.revanced.patches.youtube.utils.fix.parameter.fingerprints.SubtitleWindowFingerprint
|
||||||
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.patch.MainstreamVideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.general.patch.VideoIdPatch
|
||||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||||
|
|
||||||
@Name("spoof-player-parameters")
|
@Name("spoof-player-parameters")
|
||||||
@Description("Spoofs player parameters to prevent playback issues.")
|
@Description("Spoofs player parameters to prevent playback issues.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
MainstreamVideoIdPatch::class,
|
PlayerTypeHookPatch::class,
|
||||||
PlayerTypeHookPatch::class
|
VideoIdPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@ -53,7 +53,7 @@ class SpoofPlayerParameterPatch : BytecodePatch(
|
|||||||
addInstructions(
|
addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
invoke-static {p$protobufParam}, $MISC_PATH/SpoofPlayerParameterPatch;->overridePlayerParameter(Ljava/lang/String;)Ljava/lang/String;
|
invoke-static {p$protobufParam}, $INTEGRATIONS_CLASS_DESCRIPTOR->overridePlayerParameter(Ljava/lang/String;)Ljava/lang/String;
|
||||||
move-result-object p$protobufParam
|
move-result-object p$protobufParam
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@ -63,14 +63,14 @@ class SpoofPlayerParameterPatch : BytecodePatch(
|
|||||||
// hook video playback result
|
// hook video playback result
|
||||||
BadResponseFingerprint.result?.mutableMethod?.addInstruction(
|
BadResponseFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static {}, $MISC_PATH/SpoofPlayerParameterPatch;->switchPlayerParameters()V"
|
"invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->switchPlayerParameters()V"
|
||||||
) ?: return BadResponseFingerprint.toErrorResult()
|
) ?: return BadResponseFingerprint.toErrorResult()
|
||||||
|
|
||||||
// fix protobuf spoof side issue
|
// fix protobuf spoof side issue
|
||||||
SubtitleWindowFingerprint.result?.mutableMethod?.addInstructions(
|
SubtitleWindowFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
invoke-static {p1, p2, p3, p4, p5}, $MISC_PATH/SpoofPlayerParameterPatch;->getSubtitleWindowSettingsOverride(IIIZZ)[I
|
invoke-static {p1, p2, p3, p4, p5}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSubtitleWindowSettingsOverride(IIIZZ)[I
|
||||||
move-result-object v0
|
move-result-object v0
|
||||||
const/4 v1, 0x0
|
const/4 v1, 0x0
|
||||||
aget p1, v0, v1 # ap, anchor position
|
aget p1, v0, v1 # ap, anchor position
|
||||||
@ -82,7 +82,7 @@ class SpoofPlayerParameterPatch : BytecodePatch(
|
|||||||
) ?: return SubtitleWindowFingerprint.toErrorResult()
|
) ?: return SubtitleWindowFingerprint.toErrorResult()
|
||||||
|
|
||||||
// Hook video id, required for subtitle fix.
|
// Hook video id, required for subtitle fix.
|
||||||
MainstreamVideoIdPatch.injectCall("$MISC_PATH/SpoofPlayerParameterPatch;->setCurrentVideoId(Ljava/lang/String;)V")
|
VideoIdPatch.injectCall("$MISC_PATH/SpoofPlayerParameterPatch;->setCurrentVideoId(Ljava/lang/String;)V")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
@ -95,4 +95,8 @@ class SpoofPlayerParameterPatch : BytecodePatch(
|
|||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"$MISC_PATH/SpoofPlayerParameterPatch;"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import app.revanced.patches.youtube.utils.returnyoutubedislike.general.fingerpri
|
|||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.oldlayout.patch.ReturnYouTubeDislikeOldLayoutPatch
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.oldlayout.patch.ReturnYouTubeDislikeOldLayoutPatch
|
||||||
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.patch.ReturnYouTubeDislikeShortsPatch
|
import app.revanced.patches.youtube.utils.returnyoutubedislike.shorts.patch.ReturnYouTubeDislikeShortsPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.patch.MainstreamVideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.general.patch.VideoIdPatch
|
||||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
@ -38,10 +38,10 @@ import org.jf.dexlib2.iface.reference.Reference
|
|||||||
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
MainstreamVideoIdPatch::class,
|
|
||||||
ReturnYouTubeDislikeOldLayoutPatch::class,
|
ReturnYouTubeDislikeOldLayoutPatch::class,
|
||||||
ReturnYouTubeDislikeShortsPatch::class,
|
ReturnYouTubeDislikeShortsPatch::class,
|
||||||
SettingsPatch::class
|
SettingsPatch::class,
|
||||||
|
VideoIdPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@ -134,7 +134,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
|||||||
} ?: return TextComponentConstructorFingerprint.toErrorResult()
|
} ?: return TextComponentConstructorFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
|
||||||
MainstreamVideoIdPatch.injectCall("$INTEGRATIONS_RYD_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
VideoIdPatch.injectCall("$INTEGRATIONS_RYD_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add ReVanced Settings
|
* Add ReVanced Settings
|
||||||
|
@ -27,8 +27,8 @@ import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
|||||||
import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.EndScreenEngagementPanelsFingerprint
|
import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.EndScreenEngagementPanelsFingerprint
|
||||||
import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.PlayerControllerFingerprint
|
import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.PlayerControllerFingerprint
|
||||||
import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.RectangleFieldInvalidatorFingerprint
|
import app.revanced.patches.youtube.utils.sponsorblock.bytecode.fingerprints.RectangleFieldInvalidatorFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.legacy.patch.LegacyVideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.general.patch.VideoIdPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.patch.MainstreamVideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.withoutshorts.patch.VideoIdWithoutShortsPatch
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.injectInit
|
import app.revanced.util.bytecode.BytecodeHelper.injectInit
|
||||||
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||||
@ -45,11 +45,11 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||||||
@Name("sponsorblock-bytecode-patch")
|
@Name("sponsorblock-bytecode-patch")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LegacyVideoIdPatch::class,
|
|
||||||
MainstreamVideoIdPatch::class,
|
|
||||||
OverrideSpeedHookPatch::class,
|
OverrideSpeedHookPatch::class,
|
||||||
PlayerControlsPatch::class,
|
PlayerControlsPatch::class,
|
||||||
SharedResourceIdPatch::class
|
SharedResourceIdPatch::class,
|
||||||
|
VideoIdPatch::class,
|
||||||
|
VideoIdWithoutShortsPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@ -67,7 +67,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
/**
|
/**
|
||||||
* Hook the video time methods
|
* Hook the video time methods
|
||||||
*/
|
*/
|
||||||
MainstreamVideoIdPatch.apply {
|
VideoIdPatch.apply {
|
||||||
videoTimeHook(
|
videoTimeHook(
|
||||||
INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR,
|
INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR,
|
||||||
"setVideoTime"
|
"setVideoTime"
|
||||||
@ -217,7 +217,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
|||||||
/**
|
/**
|
||||||
* Inject VideoIdPatch
|
* Inject VideoIdPatch
|
||||||
*/
|
*/
|
||||||
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
VideoIdWithoutShortsPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
||||||
|
|
||||||
context.injectInit("FirstRun", "initializationSB")
|
context.injectInit("FirstRun", "initializationSB")
|
||||||
context.updatePatchStatus("SponsorBlock")
|
context.updatePatchStatus("SponsorBlock")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.video.speed.fingerprints
|
package app.revanced.patches.youtube.utils.videocpn.fingerprint
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.videocpn.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.youtube.utils.videocpn.fingerprint.OrganicPlaybackContextModelFingerprint
|
||||||
|
|
||||||
|
@Name("video-cpn-hook")
|
||||||
|
@Version("0.0.1")
|
||||||
|
class VideoCpnPatch : BytecodePatch(
|
||||||
|
listOf(OrganicPlaybackContextModelFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
insertMethod = OrganicPlaybackContextModelFingerprint.result?.mutableMethod?: return OrganicPlaybackContextModelFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private lateinit var insertMethod: MutableMethod
|
||||||
|
|
||||||
|
fun injectCall(
|
||||||
|
methodDescriptor: String
|
||||||
|
) {
|
||||||
|
insertMethod.addInstructions(
|
||||||
|
2,
|
||||||
|
"invoke-static {p1,p2}, $methodDescriptor"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
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
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object MainstreamVideoIdFingerprint : MethodFingerprint(
|
object VideoIdFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
object MainstreamVideoIdParentFingerprint : MethodFingerprint(
|
object VideoIdParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
parameters = listOf("L", "L"),
|
parameters = listOf("L", "L"),
|
||||||
strings = listOf("error retrieving subtitle"),
|
strings = listOf("error retrieving subtitle"),
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
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.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
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.youtube.utils.videoid.mainstream.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.general.fingerprint
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
@ -1,7 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.patch
|
package app.revanced.patches.youtube.utils.videoid.general.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
@ -17,17 +16,15 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
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.youtube.utils.annotations.YouTubeCompatibility
|
|
||||||
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.MainstreamVideoIdFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.PlayerControllerSetTimeReferenceFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.MainstreamVideoIdParentFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.PlayerInitFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.PlayerControllerSetTimeReferenceFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.SeekFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.PlayerInitFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.VideoIdFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.SeekFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.VideoIdParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.TimebarFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.VideoLengthFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.VideoLengthFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.VideoTimeHighPrecisionFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.VideoTimeHighPrecisionFingerprint
|
import app.revanced.patches.youtube.utils.videoid.general.fingerprint.VideoTimeHighPrecisionParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint.VideoTimeHighPrecisionParentFingerprint
|
|
||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||||
@ -36,18 +33,15 @@ import org.jf.dexlib2.immutable.ImmutableMethod
|
|||||||
import org.jf.dexlib2.immutable.ImmutableMethodParameter
|
import org.jf.dexlib2.immutable.ImmutableMethodParameter
|
||||||
import org.jf.dexlib2.util.MethodUtil
|
import org.jf.dexlib2.util.MethodUtil
|
||||||
|
|
||||||
@Name("video-id-hook-mainstream")
|
@Name("video-id-hook")
|
||||||
@Description("Hook to detect when the video id changes (mainstream)")
|
|
||||||
@YouTubeCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
@DependsOn([PlayerTypeHookPatch::class])
|
@DependsOn([PlayerTypeHookPatch::class])
|
||||||
class MainstreamVideoIdPatch : BytecodePatch(
|
class VideoIdPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
MainstreamVideoIdParentFingerprint,
|
|
||||||
PlayerControllerSetTimeReferenceFingerprint,
|
PlayerControllerSetTimeReferenceFingerprint,
|
||||||
PlayerInitFingerprint,
|
PlayerInitFingerprint,
|
||||||
SeekFingerprint,
|
SeekFingerprint,
|
||||||
TimebarFingerprint,
|
VideoIdParentFingerprint,
|
||||||
VideoLengthFingerprint,
|
VideoLengthFingerprint,
|
||||||
VideoTimeHighPrecisionFingerprint,
|
VideoTimeHighPrecisionFingerprint,
|
||||||
VideoTimeHighPrecisionParentFingerprint
|
VideoTimeHighPrecisionParentFingerprint
|
||||||
@ -134,8 +128,8 @@ class MainstreamVideoIdPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return VideoLengthFingerprint.toErrorResult()
|
} ?: return VideoLengthFingerprint.toErrorResult()
|
||||||
|
|
||||||
MainstreamVideoIdParentFingerprint.result?.let { parentResult ->
|
VideoIdParentFingerprint.result?.let { parentResult ->
|
||||||
MainstreamVideoIdFingerprint.also {
|
VideoIdFingerprint.also {
|
||||||
it.resolve(
|
it.resolve(
|
||||||
context,
|
context,
|
||||||
parentResult.classDef
|
parentResult.classDef
|
||||||
@ -147,8 +141,8 @@ class MainstreamVideoIdPatch : BytecodePatch(
|
|||||||
videoIdRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
videoIdRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
}
|
}
|
||||||
offset++ // offset so setVideoId is called before any injected call
|
offset++ // offset so setVideoId is called before any injected call
|
||||||
} ?: return MainstreamVideoIdFingerprint.toErrorResult()
|
} ?: return VideoIdFingerprint.toErrorResult()
|
||||||
} ?: return MainstreamVideoIdParentFingerprint.toErrorResult()
|
} ?: return VideoIdParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
@ -1,16 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.mainstream.fingerprint
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
object TimebarFingerprint : MethodFingerprint(
|
|
||||||
returnType = "V",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
parameters = listOf("L"),
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.definingClass.endsWith("/TimeBar;") && methodDef.name.contains(
|
|
||||||
"draw"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.legacy.fingerprint
|
package app.revanced.patches.youtube.utils.videoid.withoutshorts.fingerprint
|
||||||
|
|
||||||
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
|
||||||
@ -6,7 +6,7 @@ import app.revanced.util.bytecode.isWideLiteralExists
|
|||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
object LegacyVideoIdParentFingerprint : MethodFingerprint(
|
object VideoIdWithoutShortsParentFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = listOf("L"),
|
parameters = listOf("L"),
|
@ -1,7 +1,6 @@
|
|||||||
package app.revanced.patches.youtube.utils.videoid.legacy.patch
|
package app.revanced.patches.youtube.utils.videoid.withoutshorts.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
import app.revanced.extensions.toErrorResult
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
@ -12,22 +11,19 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.videoid.withoutshorts.fingerprint.VideoIdWithoutShortsParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.videoid.legacy.fingerprint.LegacyVideoIdParentFingerprint
|
|
||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Name("video-id-hook-legacy")
|
@Name("video-id-without-shorts-hook")
|
||||||
@Description("Hook to detect when the video id changes (legacy)")
|
|
||||||
@YouTubeCompatibility
|
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class LegacyVideoIdPatch : BytecodePatch(
|
class VideoIdWithoutShortsPatch : BytecodePatch(
|
||||||
listOf(LegacyVideoIdParentFingerprint)
|
listOf(VideoIdWithoutShortsParentFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
LegacyVideoIdParentFingerprint.result?.let {
|
VideoIdWithoutShortsParentFingerprint.result?.let {
|
||||||
insertMethod = context
|
insertMethod = context
|
||||||
.toMethodWalker(it.method)
|
.toMethodWalker(it.method)
|
||||||
.nextMethod(it.scanResult.patternScanResult!!.startIndex + 3, true)
|
.nextMethod(it.scanResult.patternScanResult!!.startIndex + 3, true)
|
||||||
@ -39,15 +35,14 @@ class LegacyVideoIdPatch : BytecodePatch(
|
|||||||
|
|
||||||
insertRegister =
|
insertRegister =
|
||||||
insertMethod.getInstruction<OneRegisterInstruction>(insertIndex + 1).registerA
|
insertMethod.getInstruction<OneRegisterInstruction>(insertIndex + 1).registerA
|
||||||
} ?: return LegacyVideoIdParentFingerprint.toErrorResult()
|
} ?: return VideoIdWithoutShortsParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V")
|
injectCall("$VIDEO_PATH/VideoInformation;->setVideoId(Ljava/lang/String;)V")
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$VIDEO_PATH/VideoInformation;"
|
|
||||||
private var offset = 2
|
private var offset = 2
|
||||||
|
|
||||||
private var insertIndex: Int = 0
|
private var insertIndex: Int = 0
|
@ -17,7 +17,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch.Companion.contexts
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch.Companion.contexts
|
||||||
import app.revanced.patches.youtube.utils.videoid.legacy.patch.LegacyVideoIdPatch
|
import app.revanced.patches.youtube.utils.videocpn.patch.VideoCpnPatch
|
||||||
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualityReferenceFingerprint
|
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualityReferenceFingerprint
|
||||||
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualitySetterFingerprint
|
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualitySetterFingerprint
|
||||||
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualitySettingsFingerprint
|
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualitySettingsFingerprint
|
||||||
@ -33,8 +33,8 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
|||||||
@Description("Adds ability to set default video quality settings.")
|
@Description("Adds ability to set default video quality settings.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
LegacyVideoIdPatch::class,
|
SettingsPatch::class,
|
||||||
SettingsPatch::class
|
VideoCpnPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@ -96,8 +96,7 @@ class VideoQualityPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
} ?: return VideoQualitySettingsParentFingerprint.toErrorResult()
|
} ?: return VideoQualitySettingsParentFingerprint.toErrorResult()
|
||||||
|
|
||||||
LegacyVideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
VideoCpnPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Z)V")
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy arrays
|
* Copy arrays
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package app.revanced.patches.youtube.video.speed.patch
|
package app.revanced.patches.youtube.video.speed.patch
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
@ -14,9 +13,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch
|
import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch
|
||||||
import app.revanced.patches.youtube.utils.playertype.patch.PlayerTypeHookPatch
|
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.video.speed.fingerprints.OrganicPlaybackContextModelFingerprint
|
import app.revanced.patches.youtube.utils.videocpn.patch.VideoCpnPatch
|
||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
|
||||||
@ -26,14 +24,12 @@ import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
|||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
OverrideSpeedHookPatch::class,
|
OverrideSpeedHookPatch::class,
|
||||||
PlayerTypeHookPatch::class
|
VideoCpnPatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class VideoSpeedPatch : BytecodePatch(
|
class VideoSpeedPatch : BytecodePatch() {
|
||||||
listOf(OrganicPlaybackContextModelFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
OverrideSpeedHookPatch.videoSpeedChangedResult.let {
|
OverrideSpeedHookPatch.videoSpeedChangedResult.let {
|
||||||
@ -48,10 +44,7 @@ class VideoSpeedPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OrganicPlaybackContextModelFingerprint.result?.mutableMethod?.addInstruction(
|
VideoCpnPatch.injectCall("$INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Z)V")
|
||||||
2,
|
|
||||||
"invoke-static {p1,p2}, $INTEGRATIONS_VIDEO_SPEED_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;Z)V"
|
|
||||||
) ?: return OrganicPlaybackContextModelFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user