From 805e64448a266dbc2e05c1142006d94a6bc9d116 Mon Sep 17 00:00:00 2001 From: MarcaDian <152095496+MarcaDian@users.noreply.github.com> Date: Sat, 8 Nov 2025 03:57:12 +0200 Subject: [PATCH 1/8] feat(YouTube Music): Add `Change miniplayer color` patch --- .../patches/ChangeMiniplayerColorPatch.java | 14 +++ .../extension/music/settings/Settings.java | 1 + .../miniplayercolor/ChangeMiniplayerColor.kt | 108 ++++++++++++++++++ .../layout/miniplayercolor/Fingerprints.kt | 24 ++++ .../resources/addresources/values/strings.xml | 5 + 5 files changed, 152 insertions(+) create mode 100644 extensions/music/src/main/java/app/revanced/extension/music/patches/ChangeMiniplayerColorPatch.java create mode 100644 patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt diff --git a/extensions/music/src/main/java/app/revanced/extension/music/patches/ChangeMiniplayerColorPatch.java b/extensions/music/src/main/java/app/revanced/extension/music/patches/ChangeMiniplayerColorPatch.java new file mode 100644 index 0000000000..ec941f7f3b --- /dev/null +++ b/extensions/music/src/main/java/app/revanced/extension/music/patches/ChangeMiniplayerColorPatch.java @@ -0,0 +1,14 @@ +package app.revanced.extension.music.patches; + +import app.revanced.extension.music.settings.Settings; + +@SuppressWarnings("unused") +public class ChangeMiniplayerColorPatch { + + /** + * Injection point + */ + public static boolean changeMiniplayerColor() { + return Settings.CHANGE_MINIPLAYER_COLOR.get(); + } +} diff --git a/extensions/music/src/main/java/app/revanced/extension/music/settings/Settings.java b/extensions/music/src/main/java/app/revanced/extension/music/settings/Settings.java index a56fb04b92..bf3e0015a4 100644 --- a/extensions/music/src/main/java/app/revanced/extension/music/settings/Settings.java +++ b/extensions/music/src/main/java/app/revanced/extension/music/settings/Settings.java @@ -27,6 +27,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_NAVIGATION_BAR_LABEL = new BooleanSetting("revanced_music_hide_navigation_bar_labels", FALSE, true); // Player + public static final BooleanSetting CHANGE_MINIPLAYER_COLOR = new BooleanSetting("revanced_music_change_miniplayer_color", FALSE, true); public static final BooleanSetting PERMANENT_REPEAT = new BooleanSetting("revanced_music_play_permanent_repeat", FALSE, true); // Miscellaneous diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt new file mode 100644 index 0000000000..2eb0b095a8 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -0,0 +1,108 @@ +package app.revanced.patches.music.layout.miniplayercolor + +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.patch.bytecodePatch +import app.revanced.patches.all.misc.resources.addResources +import app.revanced.patches.all.misc.resources.addResourcesPatch +import app.revanced.patches.music.misc.extension.sharedExtensionPatch +import app.revanced.patches.music.misc.settings.PreferenceScreen +import app.revanced.patches.music.misc.settings.settingsPatch +import app.revanced.patches.shared.misc.mapping.get +import app.revanced.patches.shared.misc.mapping.resourceMappingPatch +import app.revanced.patches.shared.misc.mapping.resourceMappings +import app.revanced.patches.shared.misc.settings.preference.SwitchPreference +import app.revanced.util.indexOfFirstInstructionOrThrow +import app.revanced.util.indexOfFirstInstructionReversedOrThrow +import app.revanced.util.indexOfFirstLiteralInstructionOrThrow +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction +import com.android.tools.smali.dexlib2.iface.reference.FieldReference + +internal var colorGrey = -1L + private set + +private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/music/patches/ChangeMiniplayerColorPatch;" + +@Suppress("unused") +val changeMiniplayerColor = bytecodePatch( + name = "Change miniplayer color", + description = "Adds an option to make the miniplayer match the fullscreen player color." +) { + dependsOn( + sharedExtensionPatch, + settingsPatch, + addResourcesPatch, + resourceMappingPatch + ) + + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.29.52", + "8.10.52" + ) + ) + + execute { + colorGrey = resourceMappings["color", "ytm_color_grey_12"] + + addResources("music", "layout.miniplayercolor.changeMiniplayerColor") + + PreferenceScreen.PLAYER.addPreferences( + SwitchPreference("revanced_music_change_miniplayer_color"), + ) + + val switchToggleColorMatch = switchToggleColorFingerprint.match(miniPlayerConstructorFingerprint.classDef) + val relativeIndex = switchToggleColorMatch.patternMatch!!.endIndex + 1 + + val invokeVirtualIndex = + switchToggleColorMatch.method.indexOfFirstInstructionOrThrow(relativeIndex, Opcode.INVOKE_VIRTUAL) + val iGetIndex = + switchToggleColorMatch.method.indexOfFirstInstructionOrThrow(relativeIndex, Opcode.IGET) + + val colorMathPlayerMethodParameter = switchToggleColorMatch.method.parameters + val colorMathPlayerInvokeVirtualReference = + switchToggleColorMatch.method.getInstruction(invokeVirtualIndex).reference + val colorMathPlayerIGetReference = + switchToggleColorMatch.method.getInstruction(iGetIndex).reference + + val colorGreyIndex = + miniPlayerConstructorFingerprint.method.indexOfFirstLiteralInstructionOrThrow(colorGrey) + val iPutIndex = + miniPlayerConstructorFingerprint.method.indexOfFirstInstructionOrThrow(colorGreyIndex, Opcode.IPUT) + val colorMathPlayerIPutReference = + miniPlayerConstructorFingerprint.method.getInstruction(iPutIndex).reference + + miniPlayerConstructorFingerprint.classDef.methods.filter { + it.accessFlags == AccessFlags.PUBLIC.value or AccessFlags.FINAL.value && + it.parameters == colorMathPlayerMethodParameter && + it.returnType == "V" + }.forEach { method -> + method.apply { + val freeRegister = implementation!!.registerCount - parameters.size - 3 + val invokeDirectIndex = + indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) + val invokeDirectReference = + getInstruction(invokeDirectIndex).reference + addInstructionsWithLabels( + invokeDirectIndex + 1, + """ + invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->changeMiniplayerColor()Z + move-result v$freeRegister + if-eqz v$freeRegister, :off + invoke-virtual {p1}, $colorMathPlayerInvokeVirtualReference + move-result-object v$freeRegister + check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass} + iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference + iput v$freeRegister, p0, $colorMathPlayerIPutReference + :off + invoke-direct {p0}, $invokeDirectReference + """ + ) + removeInstruction(invokeDirectIndex) + } + } + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt new file mode 100644 index 0000000000..ed3aa94105 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt @@ -0,0 +1,24 @@ +package app.revanced.patches.music.layout.miniplayercolor + +import app.revanced.patcher.fingerprint +import app.revanced.util.literal +import com.android.tools.smali.dexlib2.AccessFlags +import com.android.tools.smali.dexlib2.Opcode + +internal val miniPlayerConstructorFingerprint = fingerprint { + returns("V") + strings("sharedToggleMenuItemMutations") + literal { colorGrey } +} + +internal val switchToggleColorFingerprint = fingerprint { + accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL) + returns("V") + parameters("L", "J") + opcodes( + Opcode.INVOKE_VIRTUAL, + Opcode.MOVE_RESULT_OBJECT, + Opcode.CHECK_CAST, + Opcode.IGET + ) +} diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index bf2a45a878..78c6556832 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -1757,6 +1757,11 @@ Video playback with AV1 may stutter or drop frames." Category bar is hidden Category bar is shown + + Change miniplayer color + Miniplayer matches fullscreen player color + Miniplayer uses default color + Navigation bar Hide or change navigation bar buttons From e621abd0b2ba17a9fd94dbc090966df9837b95df Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 8 Nov 2025 11:27:53 +0200 Subject: [PATCH 2/8] api dump --- patches/api/patches.api | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/patches/api/patches.api b/patches/api/patches.api index 9c3b806d38..21cd0046b4 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -412,6 +412,10 @@ public final class app/revanced/patches/music/layout/compactheader/HideCategoryB public static final fun getHideCategoryBar ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColorKt { + public static final fun getChangeMiniplayerColor ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/music/layout/navigationbar/NavigationBarPatchKt { public static final fun getNavigationBarPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } From aac8814a70ef7c8ac6a8150019c237c7f7dbcd28 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 8 Nov 2025 11:34:36 +0200 Subject: [PATCH 3/8] refactor --- .../miniplayercolor/ChangeMiniplayerColor.kt | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt index 2eb0b095a8..8c328cd666 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -1,8 +1,6 @@ package app.revanced.patches.music.layout.miniplayercolor -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.patch.bytecodePatch import app.revanced.patches.all.misc.resources.addResources import app.revanced.patches.all.misc.resources.addResourcesPatch @@ -13,6 +11,8 @@ import app.revanced.patches.shared.misc.mapping.get import app.revanced.patches.shared.misc.mapping.resourceMappingPatch import app.revanced.patches.shared.misc.mapping.resourceMappings import app.revanced.patches.shared.misc.settings.preference.SwitchPreference +import app.revanced.util.addInstructionsAtControlFlowLabel +import app.revanced.util.findFreeRegister import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfFirstInstructionReversedOrThrow import app.revanced.util.indexOfFirstLiteralInstructionOrThrow @@ -57,52 +57,52 @@ val changeMiniplayerColor = bytecodePatch( val switchToggleColorMatch = switchToggleColorFingerprint.match(miniPlayerConstructorFingerprint.classDef) val relativeIndex = switchToggleColorMatch.patternMatch!!.endIndex + 1 - val invokeVirtualIndex = - switchToggleColorMatch.method.indexOfFirstInstructionOrThrow(relativeIndex, Opcode.INVOKE_VIRTUAL) - val iGetIndex = - switchToggleColorMatch.method.indexOfFirstInstructionOrThrow(relativeIndex, Opcode.IGET) + val invokeVirtualIndex = switchToggleColorMatch.method.indexOfFirstInstructionOrThrow( + relativeIndex, Opcode.INVOKE_VIRTUAL + ) + val colorMathPlayerInvokeVirtualReference = switchToggleColorMatch.method + .getInstruction(invokeVirtualIndex).reference - val colorMathPlayerMethodParameter = switchToggleColorMatch.method.parameters - val colorMathPlayerInvokeVirtualReference = - switchToggleColorMatch.method.getInstruction(invokeVirtualIndex).reference - val colorMathPlayerIGetReference = - switchToggleColorMatch.method.getInstruction(iGetIndex).reference + val iGetIndex = switchToggleColorMatch.method.indexOfFirstInstructionOrThrow( + relativeIndex, Opcode.IGET + ) + val colorMathPlayerIGetReference = switchToggleColorMatch.method + .getInstruction(iGetIndex).reference - val colorGreyIndex = - miniPlayerConstructorFingerprint.method.indexOfFirstLiteralInstructionOrThrow(colorGrey) - val iPutIndex = - miniPlayerConstructorFingerprint.method.indexOfFirstInstructionOrThrow(colorGreyIndex, Opcode.IPUT) - val colorMathPlayerIPutReference = - miniPlayerConstructorFingerprint.method.getInstruction(iPutIndex).reference + val colorGreyIndex = miniPlayerConstructorFingerprint.method + .indexOfFirstLiteralInstructionOrThrow(colorGrey) + val iPutIndex = miniPlayerConstructorFingerprint.method.indexOfFirstInstructionOrThrow( + colorGreyIndex, Opcode.IPUT + ) + val colorMathPlayerIPutReference = miniPlayerConstructorFingerprint.method + .getInstruction(iPutIndex).reference - miniPlayerConstructorFingerprint.classDef.methods.filter { + miniPlayerConstructorFingerprint.classDef.methods.single { it.accessFlags == AccessFlags.PUBLIC.value or AccessFlags.FINAL.value && - it.parameters == colorMathPlayerMethodParameter && + it.parameters == switchToggleColorMatch.method.parameters && it.returnType == "V" - }.forEach { method -> - method.apply { - val freeRegister = implementation!!.registerCount - parameters.size - 3 - val invokeDirectIndex = - indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) - val invokeDirectReference = - getInstruction(invokeDirectIndex).reference - addInstructionsWithLabels( - invokeDirectIndex + 1, - """ - invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->changeMiniplayerColor()Z - move-result v$freeRegister - if-eqz v$freeRegister, :off - invoke-virtual {p1}, $colorMathPlayerInvokeVirtualReference - move-result-object v$freeRegister - check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass} - iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference - iput v$freeRegister, p0, $colorMathPlayerIPutReference - :off - invoke-direct {p0}, $invokeDirectReference - """ - ) - removeInstruction(invokeDirectIndex) - } + }.apply { + val invokeDirectIndex = + indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) + + val insertIndex = invokeDirectIndex + 1 + val freeRegister = findFreeRegister(insertIndex) + + addInstructionsAtControlFlowLabel( + insertIndex, + """ + invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->changeMiniplayerColor()Z + move-result v$freeRegister + if-eqz v$freeRegister, :off + invoke-virtual { p1 }, $colorMathPlayerInvokeVirtualReference + move-result-object v$freeRegister + check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass} + iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference + iput v$freeRegister, p0, $colorMathPlayerIPutReference + :off + nop + """ + ) } } } From 86d5f0125ca966fd9e872b935c358490acfc0f50 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 8 Nov 2025 11:57:02 +0200 Subject: [PATCH 4/8] unofficial 8.44.53 --- .../miniplayercolor/ChangeMiniplayerColor.kt | 95 ++++++++++--------- .../layout/miniplayercolor/Fingerprints.kt | 5 +- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt index 8c328cd666..bc76a6a18d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -13,15 +13,16 @@ import app.revanced.patches.shared.misc.mapping.resourceMappings import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.util.addInstructionsAtControlFlowLabel import app.revanced.util.findFreeRegister +import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow import app.revanced.util.indexOfFirstInstructionReversedOrThrow -import app.revanced.util.indexOfFirstLiteralInstructionOrThrow import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.FieldReference +import com.android.tools.smali.dexlib2.iface.reference.MethodReference -internal var colorGrey = -1L +internal var mpp_player_bottom_sheet = -1L private set private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/music/patches/ChangeMiniplayerColorPatch;" @@ -46,7 +47,7 @@ val changeMiniplayerColor = bytecodePatch( ) execute { - colorGrey = resourceMappings["color", "ytm_color_grey_12"] + mpp_player_bottom_sheet = resourceMappings["id", "mpp_player_bottom_sheet"] addResources("music", "layout.miniplayercolor.changeMiniplayerColor") @@ -54,55 +55,57 @@ val changeMiniplayerColor = bytecodePatch( SwitchPreference("revanced_music_change_miniplayer_color"), ) - val switchToggleColorMatch = switchToggleColorFingerprint.match(miniPlayerConstructorFingerprint.classDef) - val relativeIndex = switchToggleColorMatch.patternMatch!!.endIndex + 1 + switchToggleColorFingerprint.match(miniPlayerConstructorFingerprint.classDef).let { + val relativeIndex = it.patternMatch!!.endIndex + 1 - val invokeVirtualIndex = switchToggleColorMatch.method.indexOfFirstInstructionOrThrow( - relativeIndex, Opcode.INVOKE_VIRTUAL - ) - val colorMathPlayerInvokeVirtualReference = switchToggleColorMatch.method - .getInstruction(invokeVirtualIndex).reference + val invokeVirtualIndex = it.method.indexOfFirstInstructionOrThrow( + relativeIndex, Opcode.INVOKE_VIRTUAL + ) + val colorMathPlayerInvokeVirtualReference = it.method + .getInstruction(invokeVirtualIndex).reference - val iGetIndex = switchToggleColorMatch.method.indexOfFirstInstructionOrThrow( - relativeIndex, Opcode.IGET - ) - val colorMathPlayerIGetReference = switchToggleColorMatch.method - .getInstruction(iGetIndex).reference + val iGetIndex = it.method.indexOfFirstInstructionOrThrow( + relativeIndex, Opcode.IGET + ) + val colorMathPlayerIGetReference = it.method + .getInstruction(iGetIndex).reference - val colorGreyIndex = miniPlayerConstructorFingerprint.method - .indexOfFirstLiteralInstructionOrThrow(colorGrey) - val iPutIndex = miniPlayerConstructorFingerprint.method.indexOfFirstInstructionOrThrow( - colorGreyIndex, Opcode.IPUT - ) - val colorMathPlayerIPutReference = miniPlayerConstructorFingerprint.method - .getInstruction(iPutIndex).reference + val colorGreyIndex = miniPlayerConstructorFingerprint.method.indexOfFirstInstructionReversedOrThrow { + val reference = getReference() + reference?.name == "getColor" + } + val iPutIndex = miniPlayerConstructorFingerprint.method.indexOfFirstInstructionOrThrow( + colorGreyIndex, Opcode.IPUT + ) + val colorMathPlayerIPutReference = miniPlayerConstructorFingerprint.method + .getInstruction(iPutIndex).reference - miniPlayerConstructorFingerprint.classDef.methods.single { - it.accessFlags == AccessFlags.PUBLIC.value or AccessFlags.FINAL.value && - it.parameters == switchToggleColorMatch.method.parameters && - it.returnType == "V" - }.apply { - val invokeDirectIndex = - indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) + miniPlayerConstructorFingerprint.classDef.methods.single { method -> + method.accessFlags == AccessFlags.PUBLIC.value or AccessFlags.FINAL.value && + method.returnType == "V" && + method.parameters == it.originalMethod.parameters + }.apply { + val invokeDirectIndex = indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) - val insertIndex = invokeDirectIndex + 1 - val freeRegister = findFreeRegister(insertIndex) + val insertIndex = invokeDirectIndex + 1 + val freeRegister = findFreeRegister(insertIndex) - addInstructionsAtControlFlowLabel( - insertIndex, - """ - invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->changeMiniplayerColor()Z - move-result v$freeRegister - if-eqz v$freeRegister, :off - invoke-virtual { p1 }, $colorMathPlayerInvokeVirtualReference - move-result-object v$freeRegister - check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass} - iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference - iput v$freeRegister, p0, $colorMathPlayerIPutReference - :off - nop - """ - ) + addInstructionsAtControlFlowLabel( + insertIndex, + """ + invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->changeMiniplayerColor()Z + move-result v$freeRegister + if-eqz v$freeRegister, :off + invoke-virtual { p1 }, $colorMathPlayerInvokeVirtualReference + move-result-object v$freeRegister + check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass} + iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference + iput v$freeRegister, p0, $colorMathPlayerIPutReference + :off + nop + """ + ) + } } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt index ed3aa94105..8cc939f0f3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/Fingerprints.kt @@ -8,9 +8,12 @@ import com.android.tools.smali.dexlib2.Opcode internal val miniPlayerConstructorFingerprint = fingerprint { returns("V") strings("sharedToggleMenuItemMutations") - literal { colorGrey } + literal { mpp_player_bottom_sheet } } +/** + * Matches to the class found in [miniPlayerConstructorFingerprint]. + */ internal val switchToggleColorFingerprint = fingerprint { accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL) returns("V") From 0257236281beaaea051d239316ba9ceef431871c Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:03:53 +0200 Subject: [PATCH 5/8] refactor --- .../layout/miniplayercolor/ChangeMiniplayerColor.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt index bc76a6a18d..5a6b2148ae 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -1,3 +1,5 @@ +@file:Suppress("SpellCheckingInspection") + package app.revanced.patches.music.layout.miniplayercolor import app.revanced.patcher.extensions.InstructionExtensions.getInstruction @@ -68,11 +70,10 @@ val changeMiniplayerColor = bytecodePatch( relativeIndex, Opcode.IGET ) val colorMathPlayerIGetReference = it.method - .getInstruction(iGetIndex).reference + .getInstruction(iGetIndex).reference as FieldReference val colorGreyIndex = miniPlayerConstructorFingerprint.method.indexOfFirstInstructionReversedOrThrow { - val reference = getReference() - reference?.name == "getColor" + getReference()?.name == "getColor" } val iPutIndex = miniPlayerConstructorFingerprint.method.indexOfFirstInstructionOrThrow( colorGreyIndex, Opcode.IPUT @@ -98,7 +99,7 @@ val changeMiniplayerColor = bytecodePatch( if-eqz v$freeRegister, :off invoke-virtual { p1 }, $colorMathPlayerInvokeVirtualReference move-result-object v$freeRegister - check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass} + check-cast v$freeRegister, ${colorMathPlayerIGetReference.definingClass} iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference iput v$freeRegister, p0, $colorMathPlayerIPutReference :off From 0db9df4505b6922bbc4aceb914c575c606a2db61 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 8 Nov 2025 20:04:58 +0200 Subject: [PATCH 6/8] Update patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt --- .../music/layout/miniplayercolor/ChangeMiniplayerColor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt index 5a6b2148ae..c28283541d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -32,7 +32,7 @@ private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/music/pa @Suppress("unused") val changeMiniplayerColor = bytecodePatch( name = "Change miniplayer color", - description = "Adds an option to make the miniplayer match the fullscreen player color." + description = "Adds an option to change the miniplayer background color to match the fullscreen player." ) { dependsOn( sharedExtensionPatch, From 32e01db8923d045b4b82d47ba665bbd7ff73483b Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sat, 8 Nov 2025 20:06:01 +0200 Subject: [PATCH 7/8] Update patches/src/main/resources/addresources/values/strings.xml --- patches/src/main/resources/addresources/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index 78c6556832..cddb717f5a 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -1759,7 +1759,7 @@ Video playback with AV1 may stutter or drop frames." Change miniplayer color - Miniplayer matches fullscreen player color + Miniplayer color matches fullscreen player Miniplayer uses default color From c6f517ae2d2f465983c0881f606b3aada9f74845 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Sun, 9 Nov 2025 08:43:23 +0200 Subject: [PATCH 8/8] fix refactoring --- .../music/layout/miniplayercolor/ChangeMiniplayerColor.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt index c28283541d..ef44657185 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -86,9 +86,7 @@ val changeMiniplayerColor = bytecodePatch( method.returnType == "V" && method.parameters == it.originalMethod.parameters }.apply { - val invokeDirectIndex = indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) - - val insertIndex = invokeDirectIndex + 1 + val insertIndex = indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT) val freeRegister = findFreeRegister(insertIndex) addInstructionsAtControlFlowLabel(