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.annotation.CompatiblePackage
|
||||
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.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.hdr.fingerprints.HdrCapabilitiesFingerprint
|
||||
@ -50,22 +49,15 @@ object DisableHdrVideoPatch : BytecodePatch(
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
HdrCapabilitiesFingerprint.result?.let {
|
||||
with(
|
||||
context
|
||||
.toMethodWalker(it.method)
|
||||
.nextMethod(it.scanResult.patternScanResult!!.endIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
) {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $VIDEO_PATH/HDRVideoPatch;->disableHDRVideo()Z
|
||||
move-result v0
|
||||
if-nez v0, :default
|
||||
return v0
|
||||
""", ExternalLabel("default", getInstruction(0))
|
||||
)
|
||||
}
|
||||
HdrCapabilitiesFingerprint.result?.mutableMethod?.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $VIDEO_PATH/HDRVideoPatch;->disableHDRVideo()Z
|
||||
move-result v0
|
||||
if-nez v0, :default
|
||||
return v0
|
||||
""", ExternalLabel("default", getInstruction(0))
|
||||
)
|
||||
} ?: throw HdrCapabilitiesFingerprint.exception
|
||||
|
||||
/**
|
||||
|
@ -1,20 +1,27 @@
|
||||
package app.revanced.patches.youtube.video.hdr.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
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.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
object HdrCapabilitiesFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L", "L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL_RANGE,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.INVOKE_INTERFACE,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
),
|
||||
strings = listOf("av1_profile_main_10_hdr_10_plus_supported")
|
||||
returnType = "Z",
|
||||
parameters = listOf("I", "Landroid/view/Display;"),
|
||||
customFingerprint = custom@{ methodDef, _ ->
|
||||
if (methodDef.implementation == null)
|
||||
return@custom false
|
||||
|
||||
for (instruction in methodDef.implementation!!.instructions) {
|
||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||
continue
|
||||
|
||||
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