mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
feat(YouTube Music): add support versions 6.34.51
~ 6.50.51
This commit is contained in:
@ -2,14 +2,12 @@ package app.revanced.patches.music.actionbar.component
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.ActionBarComponentFingerprint
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerFingerprint
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerVisibilityFingerprint
|
||||
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACTIONBAR_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
@ -120,29 +118,8 @@ object ActionBarComponentPatch : BaseBytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
LikeDislikeContainerFingerprint.resultOrThrow().let { parentResult ->
|
||||
// Resolves fingerprints
|
||||
LikeDislikeContainerVisibilityFingerprint.resolve(context, parentResult.classDef)
|
||||
|
||||
/**
|
||||
* Added in YouTube Music v6.35.xx~
|
||||
*/
|
||||
LikeDislikeContainerVisibilityFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
val targetRegister =
|
||||
getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $ACTIONBAR_CLASS_DESCRIPTOR->hideLikeDislikeButton(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} // Don't throw exception
|
||||
|
||||
parentResult.mutableMethod.apply {
|
||||
LikeDislikeContainerFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralInstructionIndex(LikeDislikeContainer) + 2
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
package app.revanced.patches.music.actionbar.component.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
|
||||
|
||||
object LikeDislikeContainerVisibilityFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT
|
||||
),
|
||||
customFingerprint = custom@{ methodDef, _ ->
|
||||
if (methodDef.implementation == null)
|
||||
return@custom false
|
||||
|
||||
for (instruction in methodDef.implementation!!.instructions) {
|
||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL)
|
||||
continue
|
||||
|
||||
val referenceInstruction = instruction as ReferenceInstruction
|
||||
if (referenceInstruction.reference.toString() != "Landroid/view/View;->setVisibility(I)V")
|
||||
continue
|
||||
|
||||
return@custom true
|
||||
}
|
||||
return@custom false
|
||||
}
|
||||
)
|
@ -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