diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbar/patch/HideSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbar/patch/HideSeekbarPatch.kt index d7a39bc27..7c6bd07af 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbar/patch/HideSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/seekbar/patch/HideSeekbarPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch -import app.revanced.patches.youtube.misc.timebar.patch.HookTimebarPatch +import app.revanced.patches.youtube.misc.timebar.patch.HookTimeBarPatch import app.revanced.util.integrations.Constants.SEEKBAR @Patch @@ -22,7 +22,7 @@ import app.revanced.util.integrations.Constants.SEEKBAR @Description("Hides the seekbar.") @DependsOn( [ - HookTimebarPatch::class, + HookTimeBarPatch::class, SettingsPatch::class ] ) @@ -31,7 +31,7 @@ import app.revanced.util.integrations.Constants.SEEKBAR class HideSeekbarPatch : BytecodePatch() { override fun execute(context: BytecodeContext): PatchResult { - val insertMethod = HookTimebarPatch.setTimebarMethod + val insertMethod = HookTimeBarPatch.setTimeBarMethod insertMethod.addInstructions( 0, """ diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt index bd4f0a95e..a38d478ab 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt @@ -17,7 +17,7 @@ import app.revanced.patches.youtube.misc.overridespeed.bytecode.patch.OverrideSp import app.revanced.patches.youtube.misc.playercontrols.patch.PlayerControlsPatch import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourceIdPatch import app.revanced.patches.youtube.misc.sponsorblock.bytecode.fingerprints.* -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.legacy.patch.LegacyVideoIdPatch import app.revanced.patches.youtube.misc.videoid.mainstream.patch.MainstreamVideoIdPatch import app.revanced.util.bytecode.BytecodeHelper.injectInit @@ -34,7 +34,7 @@ import org.jf.dexlib2.iface.reference.MethodReference @Name("sponsorblock-bytecode-patch") @DependsOn( [ - HookTimebarPatch::class, + HookTimeBarPatch::class, LegacyVideoIdPatch::class, MainstreamVideoIdPatch::class, OverrideSpeedHookPatch::class, @@ -69,7 +69,7 @@ class SponsorBlockBytecodePatch : BytecodePatch( /* * Seekbar drawing */ - insertMethod = HookTimebarPatch.setTimebarMethod + insertMethod = HookTimeBarPatch.setTimeBarMethod insertInstructions = insertMethod.implementation!!.instructions diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimeBarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimeBarPatch.kt new file mode 100644 index 000000000..d0962b947 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/timebar/patch/HookTimeBarPatch.kt @@ -0,0 +1,40 @@ +package app.revanced.patches.youtube.misc.timebar.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.fingerprint.method.impl.MethodFingerprint.Companion.resolve +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.shared.annotation.YouTubeCompatibility +import app.revanced.patches.youtube.misc.timebar.fingerprints.* + +@Name("hook-timebar-patch") +@YouTubeCompatibility +@Version("0.0.1") +class HookTimeBarPatch : BytecodePatch( + listOf( + EmptyColorFingerprint + ) +) { + override fun execute(context: BytecodeContext): PatchResult { + + EmptyColorFingerprint.result?.let { parentResult -> + emptyColorMethod = parentResult.mutableMethod + OnDrawFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.mutableMethod?.let { + setTimeBarMethod = it + } ?: return OnDrawFingerprint.toErrorResult() + } ?: return EmptyColorFingerprint.toErrorResult() + + + return PatchResultSuccess() + } + + internal companion object { + lateinit var emptyColorMethod: MutableMethod + lateinit var setTimeBarMethod: MutableMethod + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt index 1d22d07ea..2aa01e968 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videoid/mainstream/patch/MainstreamVideoIdPatch.kt @@ -18,7 +18,7 @@ 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.timebar.patch.HookTimeBarPatch import app.revanced.patches.youtube.misc.videoid.mainstream.fingerprint.* import app.revanced.util.integrations.Constants.VIDEO_PATH import org.jf.dexlib2.AccessFlags @@ -38,7 +38,7 @@ import org.jf.dexlib2.util.MethodUtil @Version("0.0.1") @DependsOn( [ - HookTimebarPatch::class, + HookTimeBarPatch::class, PlayerTypeHookPatch::class ] ) @@ -128,7 +128,7 @@ class MainstreamVideoIdPatch : BytecodePatch( } ?: return PlayerControllerSetTimeReferenceFingerprint.toErrorResult() - with (HookTimebarPatch.emptyColorMethod) { + with (HookTimeBarPatch.emptyColorMethod) { val timeBarResult = TimebarFingerprint.result ?: return TimebarFingerprint.toErrorResult() val timeBarInstructions = timeBarResult.method.implementation!!.instructions val timeBarReference =