mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 14:27:18 +02:00
feat(YouTube Music/Player components): add Enable black player background
settings https://github.com/inotia00/ReVanced_Extended/issues/1374
This commit is contained in:
parent
b5038586a0
commit
4fd2577a8f
@ -117,7 +117,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
// region patch for enable color match player
|
||||
// region patch for enable color match player and enable black player background
|
||||
|
||||
lateinit var colorMathPlayerInvokeVirtualReference: Reference
|
||||
lateinit var colorMathPlayerIGetReference: Reference
|
||||
@ -138,6 +138,23 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
|
||||
colorMathPlayerInvokeVirtualReference = getInstruction<ReferenceInstruction>(invokeVirtualIndex).reference
|
||||
colorMathPlayerIGetReference = getInstruction<ReferenceInstruction>(iGetIndex).reference
|
||||
|
||||
// black player background
|
||||
val invokeDirectIndex = getTargetIndex(Opcode.INVOKE_DIRECT)
|
||||
val targetMethod = getWalkerMethod(context, invokeDirectIndex)
|
||||
|
||||
targetMethod.apply {
|
||||
val insertIndex = getTargetIndex(0, Opcode.IF_NE)
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {p1}, $PLAYER_CLASS_DESCRIPTOR->enableBlackPlayerBackground(I)I
|
||||
move-result p1
|
||||
invoke-static {p2}, $PLAYER_CLASS_DESCRIPTOR->enableBlackPlayerBackground(I)I
|
||||
move-result p2
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
parentResult.mutableMethod.apply {
|
||||
@ -178,6 +195,11 @@ object PlayerComponentsPatch : BaseBytecodePatch(
|
||||
}
|
||||
}
|
||||
|
||||
SettingsPatch.addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_black_player_background",
|
||||
"false"
|
||||
)
|
||||
SettingsPatch.addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_color_match_player",
|
||||
|
@ -211,6 +211,8 @@ This does not bypass the age restriction. It just accepts it automatically."</st
|
||||
<!-- PreferenceScreen: Player -->
|
||||
<string name="revanced_preference_screen_player_title">Player</string>
|
||||
|
||||
<string name="revanced_enable_black_player_background_title">Enable black player background</string>
|
||||
<string name="revanced_enable_black_player_background_summary">Changes the player background color to black.</string>
|
||||
<string name="revanced_enable_color_match_player_title">Enable color match player</string>
|
||||
<string name="revanced_enable_color_match_player_summary">Matches the color of the miniplayer to the fullscreen player.</string>
|
||||
<string name="revanced_enable_force_minimized_player_title">Enable force minimized player</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user