mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(YouTube Music): add support versions 6.34.51
~ 6.50.51
This commit is contained in:
@ -13,6 +13,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||
|
||||
@Deprecated("This patch is generally not required for the latest versions of YouTube and YouTube Music." +
|
||||
"For YouTube Music, if user spoofs the app version to v4.27.53, mp4a codec is still used, this is the patch for some of these users.")
|
||||
abstract class BaseOpusCodecsPatch(
|
||||
private val descriptor: String
|
||||
) : BytecodePatch(
|
||||
@ -21,28 +23,29 @@ abstract class BaseOpusCodecsPatch(
|
||||
CodecSelectorFingerprint
|
||||
)
|
||||
) {
|
||||
private lateinit var targetReference: Reference
|
||||
private lateinit var opusCodecReference: Reference
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
CodecReferenceFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getTargetIndexWithReference("Ljava/util/Set;")
|
||||
targetReference = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
opusCodecReference = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
}
|
||||
}
|
||||
|
||||
CodecSelectorFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val freeRegister = implementation!!.registerCount - parameters.size - 2
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructionsWithLabels(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $descriptor
|
||||
move-result v7
|
||||
if-eqz v7, :mp4a
|
||||
invoke-static {}, $targetReference
|
||||
move-result v$freeRegister
|
||||
if-eqz v$freeRegister, :mp4a
|
||||
invoke-static {}, $opusCodecReference
|
||||
move-result-object v$targetRegister
|
||||
""", ExternalLabel("mp4a", getInstruction(targetIndex + 1))
|
||||
)
|
||||
|
@ -14,5 +14,5 @@ internal object CodecSelectorFingerprint : MethodFingerprint(
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT
|
||||
),
|
||||
strings = listOf("eac3_supported")
|
||||
strings = listOf("Audio track id %s not in audio streams")
|
||||
)
|
||||
|
Reference in New Issue
Block a user