feat(YouTube Music): add support versions 6.34.51 ~ 6.50.51

This commit is contained in:
inotia00
2024-05-03 04:43:15 +09:00
parent e4b87a72ea
commit 78067f1c68
4 changed files with 11 additions and 64 deletions

View File

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

View File

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