fix(youtube/video-speed): add compatibility annotation (#2156)
This commit is contained in:
parent
6f45b32fe3
commit
ffa2e5d7eb
|
@ -16,10 +16,12 @@ import app.revanced.patches.youtube.video.speed.remember.patch.RememberPlaybackS
|
|||
@Name("video-speed")
|
||||
@Description("Adds custom video speeds and ability to remember the playback speed you chose in the video playback speed flyout.")
|
||||
@DependsOn([CustomVideoSpeedPatch::class, RememberPlaybackSpeedPatch::class])
|
||||
@VideoSpeedCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoSpeeds : BytecodePatch() {
|
||||
class VideoSpeed : BytecodePatch() {
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
return PatchResultSuccess() // All patches this patch depends on succeed.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package app.revanced.patches.youtube.video.speed.remember.annotation
|
||||
package app.revanced.patches.youtube.video.speed
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
@ -7,4 +7,4 @@ import app.revanced.patcher.annotation.Package
|
|||
[Package("com.google.android.youtube", arrayOf("18.08.37", "18.15.40", "18.16.37"))]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class RememberPlaybackSpeedCompatibility
|
||||
internal annotation class VideoSpeedCompatibility
|
|
@ -1,24 +0,0 @@
|
|||
package app.revanced.patches.youtube.video.speed.custom.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility(
|
||||
[Package(
|
||||
"com.google.android.youtube", arrayOf(
|
||||
"17.49.37",
|
||||
"18.03.36",
|
||||
"18.03.42",
|
||||
"18.04.35",
|
||||
"18.04.41",
|
||||
"18.05.32",
|
||||
"18.05.35",
|
||||
"18.05.40",
|
||||
"18.08.37",
|
||||
"18.15.40",
|
||||
"18.16.37"
|
||||
)
|
||||
)]
|
||||
)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class CustomPlaybackSpeedCompatibility
|
|
@ -13,7 +13,6 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.speed.custom.annotations.CustomPlaybackSpeedCompatibility
|
||||
import app.revanced.patches.youtube.video.speed.custom.fingerprints.SpeedArrayGeneratorFingerprint
|
||||
import app.revanced.patches.youtube.video.speed.custom.fingerprints.SpeedLimiterFingerprint
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
@ -25,7 +24,6 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||
@Name("custom-video-speed")
|
||||
@Description("Adds custom video speed options.")
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
@CustomPlaybackSpeedCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomVideoSpeedPatch : BytecodePatch(
|
||||
listOf(
|
||||
|
@ -98,10 +96,12 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
|||
val limiterMethod = SpeedLimiterFingerprint.result?.mutableMethod!!
|
||||
val limiterMethodImpl = limiterMethod.implementation!!
|
||||
|
||||
val lowerLimitConst = 0.25f.toRawBits()
|
||||
val upperLimitConst = 2.0f.toRawBits()
|
||||
val (limiterMinConstIndex, limiterMinConst) = limiterMethodImpl.instructions.withIndex()
|
||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 0.25f.toRawBits() }
|
||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == lowerLimitConst }
|
||||
val (limiterMaxConstIndex, limiterMaxConst) = limiterMethodImpl.instructions.withIndex()
|
||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == 2.0f.toRawBits() }
|
||||
.first { (it.value as? NarrowLiteralInstruction)?.narrowLiteral == upperLimitConst }
|
||||
|
||||
val limiterMinConstDestination = (limiterMinConst as OneRegisterInstruction).registerA
|
||||
val limiterMaxConstDestination = (limiterMaxConst as OneRegisterInstruction).registerA
|
||||
|
|
|
@ -11,7 +11,6 @@ import app.revanced.patcher.patch.BytecodePatch
|
|||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
|
@ -22,13 +21,11 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch.Companion.reference
|
||||
import app.revanced.patches.youtube.video.speed.custom.patch.CustomVideoSpeedPatch
|
||||
import app.revanced.patches.youtube.video.speed.remember.annotation.RememberPlaybackSpeedCompatibility
|
||||
import app.revanced.patches.youtube.video.speed.remember.fingerprint.InitializePlaybackSpeedValuesFingerprint
|
||||
|
||||
@Name("remember-playback-speed")
|
||||
@Description("Adds the ability to remember the playback speed you chose in the video playback speed flyout.")
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, VideoInformationPatch::class, CustomVideoSpeedPatch::class])
|
||||
@RememberPlaybackSpeedCompatibility
|
||||
@Version("0.0.1")
|
||||
class RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
listOf(
|
||||
|
|
Loading…
Reference in a new issue