feat(YouTube/Disable HDR video): support version 18.46.43

This commit is contained in:
inotia00 2023-12-02 14:45:57 +09:00
parent 72406fb377
commit 70f8435789
2 changed files with 29 additions and 30 deletions

View File

@ -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,13 +49,7 @@ 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
) {
HdrCapabilitiesFingerprint.result?.mutableMethod?.apply {
addInstructionsWithLabels(
0, """
invoke-static {}, $VIDEO_PATH/HDRVideoPatch;->disableHDRVideo()Z
@ -65,7 +58,6 @@ object DisableHdrVideoPatch : BytecodePatch(
return v0
""", ExternalLabel("default", getInstruction(0))
)
}
} ?: throw HdrCapabilitiesFingerprint.exception
/**

View File

@ -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
}
)