build(Needs bump): Bump dependencies (#2946)
Co-authored-by: Ushie <ushiekane@gmail.com> Co-authored-by: aAbed <aabedhkhan@gmail.com> Co-authored-by: CnC-Robert <CnC.Rob3rt@gmail.com>
This commit is contained in:
co-authored by
Ushie
aAbed
CnC-Robert
parent
fe3a6fd4a4
commit
8c8dff9078
+25
-15
@@ -1,29 +1,39 @@
|
||||
package app.revanced.patches.youtube.video.hdrbrightness.patch
|
||||
package app.revanced.patches.youtube.video.hdrbrightness
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
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.hdrbrightness.annotations.HDRBrightnessCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.hdrbrightness.fingerprints.HDRBrightnessFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Patch
|
||||
@Name("HDR auto brightness")
|
||||
@Description("Makes the brightness of HDR videos follow the system default.")
|
||||
@HDRBrightnessCompatibility
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
class HDRBrightnessPatch : BytecodePatch(
|
||||
listOf(HDRBrightnessFingerprint)
|
||||
@Patch(
|
||||
name = "HDR auto brightness",
|
||||
description = "Makes the brightness of HDR videos follow the system default.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.16.37",
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HDRBrightnessPatch : BytecodePatch(
|
||||
setOf(HDRBrightnessFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.hdrbrightness.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HDRBrightnessCompatibility
|
||||
+67
-75
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.information.patch
|
||||
package app.revanced.patches.youtube.video.information
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@@ -10,14 +8,12 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.video.information.annotation.VideoInformationCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.video.information.fingerprints.*
|
||||
import app.revanced.patches.youtube.video.speed.remember.patch.RememberPlaybackSpeedPatch
|
||||
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
|
||||
import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.BuilderInstruction
|
||||
@@ -29,18 +25,35 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
@Name("Video information")
|
||||
@Description("Hooks YouTube to get information about the current playing video.")
|
||||
@VideoInformationCompatibility
|
||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class])
|
||||
class VideoInformationPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
description = "Hooks YouTube to get information about the current playing video.",
|
||||
dependencies = [IntegrationsPatch::class, VideoIdPatch::class]
|
||||
)
|
||||
object VideoInformationPatch : BytecodePatch(
|
||||
setOf(
|
||||
PlayerInitFingerprint,
|
||||
CreateVideoPlayerSeekbarFingerprint,
|
||||
PlayerControllerSetTimeReferenceFingerprint,
|
||||
OnPlaybackSpeedItemClickFingerprint,
|
||||
OnPlaybackSpeedItemClickFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
||||
|
||||
private lateinit var playerInitMethod: MutableMethod
|
||||
private var playerInitInsertIndex = 4
|
||||
|
||||
private lateinit var timeMethod: MutableMethod
|
||||
private var timeInitInsertIndex = 2
|
||||
|
||||
private lateinit var speedSelectionInsertMethod: MutableMethod
|
||||
private var speedSelectionInsertIndex = 0
|
||||
private var speedSelectionValueRegister = 0
|
||||
|
||||
// Used by other patches.
|
||||
internal lateinit var setPlaybackSpeedContainerClassFieldReference: String
|
||||
internal lateinit var setPlaybackSpeedClassFieldReference: String
|
||||
internal lateinit var setPlaybackSpeedMethodReference: String
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
with(PlayerInitFingerprint.result!!) {
|
||||
playerInitMethod = mutableClass.methods.first { MethodUtil.isConstructor(it) }
|
||||
@@ -138,72 +151,51 @@ class VideoInformationPatch : BytecodePatch(
|
||||
userSelectedPlaybackSpeedHook(INTEGRATIONS_CLASS_DESCRIPTOR, "userSelectedPlaybackSpeed")
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/VideoInformation;"
|
||||
private fun MutableMethod.insert(insertIndex: Int, register: String, descriptor: String) =
|
||||
addInstruction(insertIndex, "invoke-static { $register }, $descriptor")
|
||||
|
||||
private lateinit var playerInitMethod: MutableMethod
|
||||
private var playerInitInsertIndex = 4
|
||||
private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) =
|
||||
insert(insertIndex, "p1, p2", descriptor)
|
||||
|
||||
private lateinit var timeMethod: MutableMethod
|
||||
private var timeInitInsertIndex = 2
|
||||
/**
|
||||
* Hook the player controller. Called when a video is opened or the current video is changed.
|
||||
*
|
||||
* Note: This hook is called very early and is called before the video id, video time, video length,
|
||||
* and many other data fields are set.
|
||||
*
|
||||
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
||||
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||
*/
|
||||
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
||||
playerInitMethod.insert(
|
||||
playerInitInsertIndex++,
|
||||
"v0",
|
||||
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
||||
)
|
||||
|
||||
private fun MutableMethod.insert(insertIndex: Int, register: String, descriptor: String) =
|
||||
addInstruction(insertIndex, "invoke-static { $register }, $descriptor")
|
||||
/**
|
||||
* Hook the video time.
|
||||
* The hook is usually called once per second.
|
||||
*
|
||||
* @param targetMethodClass The descriptor for the static method to invoke when the player controller is created.
|
||||
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||
*/
|
||||
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||
timeMethod.insertTimeHook(
|
||||
timeInitInsertIndex++,
|
||||
"$targetMethodClass->$targetMethodName(J)V"
|
||||
)
|
||||
|
||||
private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) =
|
||||
insert(insertIndex, "p1, p2", descriptor)
|
||||
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
||||
(instructions[instructions.indexOfFirst { it.opcode == opcode } + offset] as ReferenceInstruction)
|
||||
.reference.toString()
|
||||
|
||||
/**
|
||||
* Hook the player controller. Called when a video is opened or the current video is changed.
|
||||
*
|
||||
* Note: This hook is called very early and is called before the video id, video time, video length,
|
||||
* and many other data fields are set.
|
||||
*
|
||||
* @param targetMethodClass The descriptor for the class to invoke when the player controller is created.
|
||||
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||
*/
|
||||
internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) =
|
||||
playerInitMethod.insert(
|
||||
playerInitInsertIndex++,
|
||||
"v0",
|
||||
"$targetMethodClass->$targetMethodName(Ljava/lang/Object;)V"
|
||||
)
|
||||
|
||||
/**
|
||||
* Hook the video time.
|
||||
* The hook is usually called once per second.
|
||||
*
|
||||
* @param targetMethodClass The descriptor for the static method to invoke when the player controller is created.
|
||||
* @param targetMethodName The name of the static method to invoke when the player controller is created.
|
||||
*/
|
||||
internal fun videoTimeHook(targetMethodClass: String, targetMethodName: String) =
|
||||
timeMethod.insertTimeHook(
|
||||
timeInitInsertIndex++,
|
||||
"$targetMethodClass->$targetMethodName(J)V"
|
||||
)
|
||||
|
||||
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
||||
(instructions[instructions.indexOfFirst { it.opcode == opcode } + offset] as ReferenceInstruction)
|
||||
.reference.toString()
|
||||
|
||||
private lateinit var speedSelectionInsertMethod: MutableMethod
|
||||
private var speedSelectionInsertIndex = 0
|
||||
private var speedSelectionValueRegister = 0
|
||||
|
||||
/**
|
||||
* Hook the video speed selected by the user.
|
||||
*/
|
||||
internal fun userSelectedPlaybackSpeedHook(targetMethodClass: String, targetMethodName: String) =
|
||||
speedSelectionInsertMethod.addInstruction(
|
||||
/**
|
||||
* Hook the video speed selected by the user.
|
||||
*/
|
||||
internal fun userSelectedPlaybackSpeedHook(targetMethodClass: String, targetMethodName: String) =
|
||||
speedSelectionInsertMethod.addInstruction(
|
||||
speedSelectionInsertIndex++,
|
||||
"invoke-static {v$speedSelectionValueRegister}, $targetMethodClass->$targetMethodName(F)V"
|
||||
)
|
||||
|
||||
/**
|
||||
* Used by [RememberPlaybackSpeedPatch]
|
||||
*/
|
||||
internal lateinit var setPlaybackSpeedContainerClassFieldReference: String
|
||||
internal lateinit var setPlaybackSpeedClassFieldReference: String
|
||||
internal lateinit var setPlaybackSpeedMethodReference: String
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.information.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class VideoInformationCompatibility
|
||||
+28
-22
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.quality.patch
|
||||
package app.revanced.patches.youtube.video.quality
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@@ -10,16 +8,15 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
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.information.patch.VideoInformationPatch
|
||||
import app.revanced.patches.youtube.video.quality.annotations.RememberVideoQualityCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
import app.revanced.patches.youtube.video.quality.fingerprints.NewVideoQualityChangedFingerprint
|
||||
import app.revanced.patches.youtube.video.quality.fingerprints.SetQualityByIndexMethodClassFieldReferenceFingerprint
|
||||
import app.revanced.patches.youtube.video.quality.fingerprints.VideoQualityItemOnClickParentFingerprint
|
||||
@@ -28,18 +25,33 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Patch
|
||||
@DependsOn([IntegrationsPatch::class, VideoInformationPatch::class, SettingsPatch::class])
|
||||
@Name("Remember video quality")
|
||||
@Description("Adds the ability to remember the video quality you chose in the video quality flyout.")
|
||||
@RememberVideoQualityCompatibility
|
||||
class RememberVideoQualityPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
name = "Remember video quality",
|
||||
description = "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||
dependencies = [IntegrationsPatch::class, VideoInformationPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.19.35",
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object RememberVideoQualityPatch : BytecodePatch(
|
||||
setOf(
|
||||
VideoQualitySetterFingerprint,
|
||||
VideoQualityItemOnClickParentFingerprint,
|
||||
NewVideoQualityChangedFingerprint
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/RememberVideoQualityPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// This is bloated as each value has it's own String key/value
|
||||
// ideally the entries would be raw values (and not a key to a String resource)
|
||||
@@ -188,11 +200,5 @@ class RememberVideoQualityPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
} ?: throw NewVideoQualityChangedFingerprint.exception
|
||||
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/RememberVideoQualityPatch;"
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.quality.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class RememberVideoQualityCompatibility
|
||||
@@ -1,20 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.speed
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.video.speed.custom.patch.CustomPlaybackSpeedPatch
|
||||
import app.revanced.patches.youtube.video.speed.remember.patch.RememberPlaybackSpeedPatch
|
||||
|
||||
@Patch
|
||||
@Name("Playback speed")
|
||||
@Description("Adds custom playback speeds and ability to remember the playback speed you chose in the video playback speed flyout.")
|
||||
@DependsOn([CustomPlaybackSpeedPatch::class, RememberPlaybackSpeedPatch::class])
|
||||
@PlaybackSpeedCompatibility
|
||||
class PlaybackSpeed : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) { // All patches this patch depends on succeed.
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.speed
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class PlaybackSpeedCompatibility
|
||||
@@ -0,0 +1,31 @@
|
||||
package app.revanced.patches.youtube.video.speed
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.video.speed.custom.CustomPlaybackSpeedPatch
|
||||
import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPatch
|
||||
|
||||
@Patch(
|
||||
name = "Playback speed",
|
||||
description = "Adds custom playback speeds and ability " +
|
||||
"to remember the playback speed you chose in the video playback speed flyout.",
|
||||
dependencies = [CustomPlaybackSpeedPatch::class, RememberPlaybackSpeedPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object PlaybackSpeedPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// All patches this patch depends on succeed.
|
||||
}
|
||||
}
|
||||
+17
-22
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.speed.custom.patch
|
||||
package app.revanced.patches.youtube.video.speed.custom
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@@ -12,15 +10,15 @@ import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patches.shared.settings.preference.impl.InputType
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
||||
import app.revanced.patches.youtube.misc.recyclerviewtree.hook.patch.RecyclerViewTreeHookPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.recyclerviewtree.hook.RecyclerViewTreeHookPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.speed.custom.fingerprints.*
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
@@ -30,17 +28,23 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableField
|
||||
|
||||
@Name("Custom playback speed")
|
||||
@Description("Adds custom playback speed options.")
|
||||
@DependsOn([IntegrationsPatch::class, LithoFilterPatch::class, SettingsPatch::class, RecyclerViewTreeHookPatch::class])
|
||||
class CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
listOf(
|
||||
@Patch(
|
||||
description = "Adds custom playback speed options.",
|
||||
dependencies = [IntegrationsPatch::class, LithoFilterPatch::class, SettingsPatch::class, RecyclerViewTreeHookPatch::class]
|
||||
)
|
||||
object CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
setOf(
|
||||
SpeedArrayGeneratorFingerprint,
|
||||
SpeedLimiterFingerprint,
|
||||
GetOldPlaybackSpeedsFingerprint,
|
||||
ShowOldPlaybackSpeedMenuIntegrationsFingerprint
|
||||
)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/PlaybackSpeedMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
@@ -175,13 +179,4 @@ class CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/PlaybackSpeedMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/speed/CustomPlaybackSpeedPatch;"
|
||||
|
||||
}
|
||||
}
|
||||
+16
-21
@@ -1,33 +1,33 @@
|
||||
package app.revanced.patches.youtube.video.speed.remember.patch
|
||||
package app.revanced.patches.youtube.video.speed.remember
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.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
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
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.information.patch.VideoInformationPatch
|
||||
import app.revanced.patches.youtube.video.speed.custom.patch.CustomPlaybackSpeedPatch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
import app.revanced.patches.youtube.video.speed.custom.CustomPlaybackSpeedPatch
|
||||
import app.revanced.patches.youtube.video.speed.remember.fingerprint.InitializePlaybackSpeedValuesFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@Name("Remember playback speed")
|
||||
@Description("Adds the ability to remember the playback speed you chose in the playback speed flyout.")
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class, VideoInformationPatch::class, CustomPlaybackSpeedPatch::class])
|
||||
class RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
listOf(
|
||||
InitializePlaybackSpeedValuesFingerprint
|
||||
)
|
||||
) {
|
||||
@Patch(
|
||||
description = "Adds the ability to remember the playback speed you chose in the playback speed flyout.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class, VideoInformationPatch::class, CustomPlaybackSpeedPatch::class]
|
||||
)
|
||||
object RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
setOf(InitializePlaybackSpeedValuesFingerprint)
|
||||
){
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/speed/RememberPlaybackSpeedPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -105,9 +105,4 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
)
|
||||
} ?: throw InitializePlaybackSpeedValuesFingerprint.exception
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/speed/RememberPlaybackSpeedPatch;"
|
||||
}
|
||||
}
|
||||
+19
-23
@@ -1,28 +1,33 @@
|
||||
package app.revanced.patches.youtube.video.videoid.patch
|
||||
package app.revanced.patches.youtube.video.videoid
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.video.videoid.annotation.VideoIdCompatibility
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.video.videoid.fingerprint.VideoIdFingerprint
|
||||
import app.revanced.patches.youtube.video.videoid.fingerprint.VideoIdFingerprintBackgroundPlay
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Name("Video id hook")
|
||||
@Description("Hooks to detect when the video id changes")
|
||||
@VideoIdCompatibility
|
||||
@DependsOn([IntegrationsPatch::class])
|
||||
class VideoIdPatch : BytecodePatch(
|
||||
listOf(VideoIdFingerprint, VideoIdFingerprintBackgroundPlay)
|
||||
@Patch(
|
||||
description = "Hooks to detect when the video id changes",
|
||||
dependencies = [IntegrationsPatch::class],
|
||||
)
|
||||
object VideoIdPatch : BytecodePatch(
|
||||
setOf(VideoIdFingerprint, VideoIdFingerprintBackgroundPlay)
|
||||
) {
|
||||
private var videoIdRegister = 0
|
||||
private var insertIndex = 0
|
||||
private lateinit var insertMethod: MutableMethod
|
||||
|
||||
private var backgroundPlaybackVideoIdRegister = 0
|
||||
private var backgroundPlaybackInsertIndex = 0
|
||||
private lateinit var backgroundPlaybackMethod: MutableMethod
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
/**
|
||||
* Supplies the method and register index of the video id register.
|
||||
@@ -53,16 +58,8 @@ class VideoIdPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var videoIdRegister = 0
|
||||
private var insertIndex = 0
|
||||
private lateinit var insertMethod: MutableMethod
|
||||
|
||||
private var backgroundPlaybackVideoIdRegister = 0
|
||||
private var backgroundPlaybackInsertIndex = 0
|
||||
private lateinit var backgroundPlaybackMethod: MutableMethod
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds an invoke-static instruction, called with the new id when the video changes.
|
||||
*
|
||||
* Supports all videos (regular videos, Shorts and Stories).
|
||||
@@ -97,7 +94,6 @@ class VideoIdPatch : BytecodePatch(
|
||||
) = backgroundPlaybackMethod.addInstruction(
|
||||
backgroundPlaybackInsertIndex++, // move-result-object offset
|
||||
"invoke-static {v$backgroundPlaybackVideoIdRegister}, $methodDescriptor"
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.videoid.annotation
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35", "18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class VideoIdCompatibility
|
||||
+36
-29
@@ -1,33 +1,48 @@
|
||||
package app.revanced.patches.youtube.video.videoqualitymenu.patch
|
||||
package app.revanced.patches.youtube.video.videoqualitymenu
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.recyclerviewtree.hook.patch.RecyclerViewTreeHookPatch
|
||||
import app.revanced.patches.youtube.video.videoqualitymenu.annotations.OldVideoQualityMenuCompatibility
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.recyclerviewtree.hook.RecyclerViewTreeHookPatch
|
||||
import app.revanced.patches.youtube.video.videoqualitymenu.fingerprints.VideoQualityMenuViewInflateFingerprint
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@DependsOn([
|
||||
IntegrationsPatch::class,
|
||||
OldVideoQualityMenuResourcePatch::class,
|
||||
LithoFilterPatch::class,
|
||||
RecyclerViewTreeHookPatch::class
|
||||
])
|
||||
@Name("Old video quality menu")
|
||||
@Description("Shows the old video quality with the advanced video quality options instead of the new one.")
|
||||
@OldVideoQualityMenuCompatibility
|
||||
class OldVideoQualityMenuPatch : BytecodePatch(
|
||||
listOf(VideoQualityMenuViewInflateFingerprint)
|
||||
@Patch(
|
||||
name = "Old video quality menu",
|
||||
description = "Shows the old video quality with the advanced video quality options instead of the new one.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
OldVideoQualityMenuResourcePatch::class,
|
||||
LithoFilterPatch::class,
|
||||
RecyclerViewTreeHookPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.20.39",
|
||||
"18.23.35",
|
||||
"18.29.38",
|
||||
"18.32.39"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object OldVideoQualityMenuPatch : BytecodePatch(
|
||||
setOf(VideoQualityMenuViewInflateFingerprint)
|
||||
) {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/VideoQualityMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/OldVideoQualityMenuPatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Patch for the old type of the video quality menu.
|
||||
// Only used when spoofing to old app version.
|
||||
@@ -57,12 +72,4 @@ class OldVideoQualityMenuPatch : BytecodePatch(
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/VideoQualityMenuFilterPatch;"
|
||||
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/playback/quality/OldVideoQualityMenuPatch;"
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -1,16 +1,20 @@
|
||||
package app.revanced.patches.youtube.video.videoqualitymenu.patch
|
||||
package app.revanced.patches.youtube.video.videoqualitymenu
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
dependencies = [SettingsPatch::class, ResourceMappingPatch::class]
|
||||
)
|
||||
object OldVideoQualityMenuResourcePatch : ResourcePatch() {
|
||||
internal var videoQualityBottomSheetListFragmentTitle = -1L
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class OldVideoQualityMenuResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.VIDEO.addPreferences(
|
||||
SwitchPreference(
|
||||
@@ -27,8 +31,4 @@ class OldVideoQualityMenuResourcePatch : ResourcePatch {
|
||||
// Used for the old type of the video quality menu.
|
||||
videoQualityBottomSheetListFragmentTitle = findResource("video_quality_bottom_sheet_list_fragment_title")
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
var videoQualityBottomSheetListFragmentTitle = -1L
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.video.videoqualitymenu.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.20.39", "18.23.35", "18.29.38", "18.32.39"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class OldVideoQualityMenuCompatibility
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.video.videoqualitymenu.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.video.videoqualitymenu.patch.OldVideoQualityMenuResourcePatch
|
||||
import app.revanced.patches.youtube.video.videoqualitymenu.OldVideoQualityMenuResourcePatch
|
||||
import app.revanced.util.patch.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -26,5 +26,5 @@ object VideoQualityMenuViewInflateFingerprint : LiteralValueFingerprint(
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST
|
||||
),
|
||||
literal = OldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle
|
||||
literalSupplier = { OldVideoQualityMenuResourcePatch.videoQualityBottomSheetListFragmentTitle }
|
||||
)
|
||||
Reference in New Issue
Block a user