mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 19:14:37 +02:00
feat(music/exclusive-audio-playback): now patch enables the Don't play podcast videos
setting
This commit is contained in:
parent
0e2b2a9ce2
commit
c284098a1f
@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.music.misc.exclusiveaudio.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object PodCastConfigFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = emptyList(),
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45388403) }
|
||||||
|
)
|
@ -4,15 +4,18 @@ 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.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
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.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.MusicBrowserServiceFingerprint
|
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.MusicBrowserServiceFingerprint
|
||||||
|
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.PodCastConfigFingerprint
|
||||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||||
import app.revanced.util.bytecode.getStringIndex
|
import app.revanced.util.bytecode.getStringIndex
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
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.instruction.ReferenceInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@ -20,10 +23,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|||||||
@Description("Enables the option to play music without video.")
|
@Description("Enables the option to play music without video.")
|
||||||
@MusicCompatibility
|
@MusicCompatibility
|
||||||
class ExclusiveAudioPatch : BytecodePatch(
|
class ExclusiveAudioPatch : BytecodePatch(
|
||||||
listOf(MusicBrowserServiceFingerprint)
|
listOf(
|
||||||
|
MusicBrowserServiceFingerprint,
|
||||||
|
PodCastConfigFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't play music videos
|
||||||
|
*/
|
||||||
MusicBrowserServiceFingerprint.result?.let {
|
MusicBrowserServiceFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val targetIndex =
|
val targetIndex =
|
||||||
@ -54,5 +63,19 @@ class ExclusiveAudioPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: throw MusicBrowserServiceFingerprint.exception
|
} ?: throw MusicBrowserServiceFingerprint.exception
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't play podcast videos
|
||||||
|
*/
|
||||||
|
PodCastConfigFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = implementation!!.instructions.size - 1
|
||||||
|
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"const/4 v$targetRegister, 0x1"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw PodCastConfigFingerprint.exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user