mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 13:47:42 +02:00
feat(youtube/default-video-quality): Enable save video quality
not working in new layout
This commit is contained in:
@ -0,0 +1,48 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object NewFlyoutPanelsOnClickListenerFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.AND_INT_LIT8,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.CONST_16,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.NEW_INSTANCE
|
||||||
|
)
|
||||||
|
)
|
@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.youtube.video.quality.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object NewVideoQualityChangedFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IF_NE,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.IGET
|
||||||
|
)
|
||||||
|
)
|
@ -15,9 +15,11 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
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.fingerprints.NewFlyoutPanelsOnClickListenerFingerprint
|
||||||
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.videocpn.patch.VideoCpnPatch
|
import app.revanced.patches.youtube.utils.videocpn.patch.VideoCpnPatch
|
||||||
|
import app.revanced.patches.youtube.video.quality.fingerprints.NewVideoQualityChangedFingerprint
|
||||||
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
|
||||||
@ -26,6 +28,7 @@ import app.revanced.patches.youtube.video.quality.fingerprints.VideoUserQualityC
|
|||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.reference.FieldReference
|
import org.jf.dexlib2.iface.reference.FieldReference
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -41,11 +44,32 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
|||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class VideoQualityPatch : BytecodePatch(
|
class VideoQualityPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
|
NewFlyoutPanelsOnClickListenerFingerprint,
|
||||||
VideoQualitySetterFingerprint,
|
VideoQualitySetterFingerprint,
|
||||||
VideoQualitySettingsParentFingerprint
|
VideoQualitySettingsParentFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
NewFlyoutPanelsOnClickListenerFingerprint.result?.let { parentResult ->
|
||||||
|
NewVideoQualityChangedFingerprint.also {
|
||||||
|
it.resolve(
|
||||||
|
context,
|
||||||
|
parentResult.classDef
|
||||||
|
)
|
||||||
|
}.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val index = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
val register = getInstruction<TwoRegisterInstruction>(index).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
index + 1,
|
||||||
|
"invoke-static {v$register}, $INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->userChangedQualityInNewFlyoutPanels(I)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: return NewFlyoutPanelsOnClickListenerFingerprint.toErrorResult()
|
||||||
|
|
||||||
VideoQualitySetterFingerprint.result?.let { parentResult ->
|
VideoQualitySetterFingerprint.result?.let { parentResult ->
|
||||||
VideoQualityReferenceFingerprint.also {
|
VideoQualityReferenceFingerprint.also {
|
||||||
it.resolve(
|
it.resolve(
|
||||||
|
Reference in New Issue
Block a user