fix(hook-timebar-patch): use upper case

This commit is contained in:
inotia00 2023-05-06 01:38:56 +09:00
parent c2ddefe010
commit 6c742b4e99
4 changed files with 49 additions and 9 deletions

View File

@ -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, """

View File

@ -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

View File

@ -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
}
}

View File

@ -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 =