feat(YouTube Music - Exclusive audio playback): Support latest version

This commit is contained in:
oSumAtrIX 2023-08-26 16:21:58 +02:00
parent 35a1a778a7
commit 0861991cfb
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 20 additions and 17 deletions

View File

@ -5,14 +5,11 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
object AudioOnlyEnablerFingerprint: MethodFingerprint( object AllowExclusiveAudioPlaybackFingerprint: MethodFingerprint(
"Z", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf( "Z",
Opcode.IGET_OBJECT, AccessFlags.PUBLIC or AccessFlags.FINAL,
Opcode.INVOKE_INTERFACE, listOf(),
Opcode.MOVE_RESULT_OBJECT, listOf(
Opcode.IGET_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST,

View File

@ -1,25 +1,31 @@
package app.revanced.patches.music.audio.exclusiveaudio.patch package app.revanced.patches.music.audio.exclusiveaudio.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext 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.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint
@Patch @Patch
@Name("Exclusive audio playback") @Name("Exclusive audio playback")
@Description("Enables the option to play music without video.") @Description("Enables the option to play audio without video.")
@MusicCompatibility @MusicCompatibility
class ExclusiveAudioPatch : BytecodePatch( class ExclusiveAudioPatch : BytecodePatch(
listOf(AudioOnlyEnablerFingerprint) listOf(AllowExclusiveAudioPlaybackFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val method = AudioOnlyEnablerFingerprint.result!!.mutableMethod AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply {
method.replaceInstruction(method.implementation!!.instructions.count() - 1, "const/4 v0, 0x1") addInstructions(
method.addInstruction("return v0") 0,
"""
const/4 v0, 0x1
return v0
"""
)
} ?: throw AllowExclusiveAudioPlaybackFingerprint.exception
} }
} }