mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
feat(music): add player-type-hook
patch (unused)
This commit is contained in:
@ -0,0 +1,19 @@
|
|||||||
|
package app.revanced.patches.music.utils.playertype.fingerprint
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
object PlayerTypeFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET_BOOLEAN,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.RETURN_VOID
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("/MppWatchWhileLayout;") }
|
||||||
|
)
|
@ -0,0 +1,30 @@
|
|||||||
|
package app.revanced.patches.music.utils.playertype.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patches.music.utils.playertype.fingerprint.PlayerTypeFingerprint
|
||||||
|
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||||
|
|
||||||
|
class PlayerTypeHookPatch : BytecodePatch(
|
||||||
|
listOf(PlayerTypeFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
PlayerTypeFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
addInstruction(
|
||||||
|
0,
|
||||||
|
"invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerType(Ljava/lang/Enum;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw PlayerTypeFingerprint.exception
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"$MUSIC_UTILS_PATH/PlayerTypeHookPatch;"
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user