mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 14:27:18 +02:00
feat(YouTube/Disable HDR video): support version 18.46.43
This commit is contained in:
parent
72406fb377
commit
70f8435789
@ -7,7 +7,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||||
import app.revanced.patches.youtube.video.hdr.fingerprints.HdrCapabilitiesFingerprint
|
import app.revanced.patches.youtube.video.hdr.fingerprints.HdrCapabilitiesFingerprint
|
||||||
@ -50,22 +49,15 @@ object DisableHdrVideoPatch : BytecodePatch(
|
|||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
HdrCapabilitiesFingerprint.result?.let {
|
HdrCapabilitiesFingerprint.result?.mutableMethod?.apply {
|
||||||
with(
|
addInstructionsWithLabels(
|
||||||
context
|
0, """
|
||||||
.toMethodWalker(it.method)
|
invoke-static {}, $VIDEO_PATH/HDRVideoPatch;->disableHDRVideo()Z
|
||||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
move-result v0
|
||||||
.getMethod() as MutableMethod
|
if-nez v0, :default
|
||||||
) {
|
return v0
|
||||||
addInstructionsWithLabels(
|
""", ExternalLabel("default", getInstruction(0))
|
||||||
0, """
|
)
|
||||||
invoke-static {}, $VIDEO_PATH/HDRVideoPatch;->disableHDRVideo()Z
|
|
||||||
move-result v0
|
|
||||||
if-nez v0, :default
|
|
||||||
return v0
|
|
||||||
""", ExternalLabel("default", getInstruction(0))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw HdrCapabilitiesFingerprint.exception
|
} ?: throw HdrCapabilitiesFingerprint.exception
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
package app.revanced.patches.youtube.video.hdr.fingerprints
|
package app.revanced.patches.youtube.video.hdr.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
object HdrCapabilitiesFingerprint : MethodFingerprint(
|
object HdrCapabilitiesFingerprint : MethodFingerprint(
|
||||||
returnType = "V",
|
returnType = "Z",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
parameters = listOf("I", "Landroid/view/Display;"),
|
||||||
parameters = listOf("L", "L"),
|
customFingerprint = custom@{ methodDef, _ ->
|
||||||
opcodes = listOf(
|
if (methodDef.implementation == null)
|
||||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
return@custom false
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
for (instruction in methodDef.implementation!!.instructions) {
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||||
Opcode.INVOKE_VIRTUAL,
|
continue
|
||||||
),
|
|
||||||
strings = listOf("av1_profile_main_10_hdr_10_plus_supported")
|
val objectInstruction = instruction as ReferenceInstruction
|
||||||
|
if ((objectInstruction.reference as MethodReference).name != "getSupportedHdrTypes")
|
||||||
|
continue
|
||||||
|
|
||||||
|
return@custom true
|
||||||
|
}
|
||||||
|
return@custom false
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user