mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 17:14:35 +02:00
feat(YouTube Music/Enable new player layout): change patch name Enable new layout
→ Enable new player layout
This commit is contained in:
parent
cbafebdc99
commit
8779a99065
@ -1,59 +0,0 @@
|
|||||||
package app.revanced.patches.music.player.newlayout
|
|
||||||
|
|
||||||
import app.revanced.extensions.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.music.player.newlayout.fingerprints.NewLayoutFingerprint
|
|
||||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
|
||||||
import app.revanced.util.enum.CategoryType
|
|
||||||
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Enable new layout",
|
|
||||||
description = "Enable new player layouts.",
|
|
||||||
dependencies = [SettingsPatch::class],
|
|
||||||
compatiblePackages = [
|
|
||||||
CompatiblePackage(
|
|
||||||
"com.google.android.apps.youtube.music",
|
|
||||||
[
|
|
||||||
"6.15.52",
|
|
||||||
"6.20.51",
|
|
||||||
"6.21.51",
|
|
||||||
"6.22.51"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object NewLayoutPatch : BytecodePatch(
|
|
||||||
setOf(NewLayoutFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
|
|
||||||
NewLayoutFingerprint.result?.let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val insertIndex = implementation!!.instructions.size - 1
|
|
||||||
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
|
||||||
|
|
||||||
addInstructions(
|
|
||||||
insertIndex, """
|
|
||||||
invoke-static {}, $MUSIC_PLAYER->enableNewLayout()Z
|
|
||||||
move-result v$targetRegister
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} ?: throw NewLayoutFingerprint.exception
|
|
||||||
|
|
||||||
SettingsPatch.addMusicPreference(
|
|
||||||
CategoryType.PLAYER,
|
|
||||||
"revanced_enable_new_layout",
|
|
||||||
"true"
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,41 @@
|
|||||||
|
package app.revanced.patches.music.player.newplayerlayout
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.music.utils.playerlayouthook.PlayerLayoutHookPatch
|
||||||
|
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||||
|
import app.revanced.util.enum.CategoryType
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Enable new player layout",
|
||||||
|
description = "Enable new player layouts.",
|
||||||
|
[
|
||||||
|
PlayerLayoutHookPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
],
|
||||||
|
compatiblePackages = [
|
||||||
|
CompatiblePackage(
|
||||||
|
"com.google.android.apps.youtube.music",
|
||||||
|
[
|
||||||
|
"6.15.52",
|
||||||
|
"6.20.51",
|
||||||
|
"6.21.51",
|
||||||
|
"6.22.51"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object NewPlayerLayoutPatch : ResourcePatch() {
|
||||||
|
override fun execute(context: ResourceContext) {
|
||||||
|
|
||||||
|
SettingsPatch.addMusicPreference(
|
||||||
|
CategoryType.PLAYER,
|
||||||
|
"revanced_enable_new_player_layout",
|
||||||
|
"true"
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patches.music.utils.playerlayouthook
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patches.music.utils.playerlayouthook.fingerprints.NewPlayerLayoutFingerprint
|
||||||
|
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
object PlayerLayoutHookPatch : BytecodePatch(
|
||||||
|
setOf(NewPlayerLayoutFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
NewPlayerLayoutFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = implementation!!.instructions.size - 1
|
||||||
|
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
insertIndex, """
|
||||||
|
invoke-static {}, $MUSIC_PLAYER->enableNewPlayerLayout()Z
|
||||||
|
move-result v$targetRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw NewPlayerLayoutFingerprint.exception
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.music.player.newlayout.fingerprints
|
package app.revanced.patches.music.utils.playerlayouthook.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||||
|
|
||||||
object NewLayoutFingerprint : MethodFingerprint(
|
object NewPlayerLayoutFingerprint : MethodFingerprint(
|
||||||
returnType = "Z",
|
returnType = "Z",
|
||||||
parameters = emptyList(),
|
parameters = emptyList(),
|
||||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45399578) }
|
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45399578) }
|
@ -34,8 +34,8 @@
|
|||||||
<string name="revanced_enable_force_minimized_player_title">Enable force minimized player</string>
|
<string name="revanced_enable_force_minimized_player_title">Enable force minimized player</string>
|
||||||
<string name="revanced_enable_landscape_mode_summary">Enables entry into landscape mode by screen rotation on the phone.</string>
|
<string name="revanced_enable_landscape_mode_summary">Enables entry into landscape mode by screen rotation on the phone.</string>
|
||||||
<string name="revanced_enable_landscape_mode_title">Enable landscape mode</string>
|
<string name="revanced_enable_landscape_mode_title">Enable landscape mode</string>
|
||||||
<string name="revanced_enable_new_layout_summary">Enable new player layouts.</string>
|
<string name="revanced_enable_new_player_layout_summary">Enable new player layouts.</string>
|
||||||
<string name="revanced_enable_new_layout_title">Enable new layout</string>
|
<string name="revanced_enable_new_player_layout_title">Enable new player layout</string>
|
||||||
<string name="revanced_enable_old_style_library_shelf_summary">Return the library shelf to old style. (Experimental)</string>
|
<string name="revanced_enable_old_style_library_shelf_summary">Return the library shelf to old style. (Experimental)</string>
|
||||||
<string name="revanced_enable_old_style_library_shelf_title">Enable old style library shelf</string>
|
<string name="revanced_enable_old_style_library_shelf_title">Enable old style library shelf</string>
|
||||||
<string name="revanced_enable_old_style_mini_player_summary">Return the mini players to old style.</string>
|
<string name="revanced_enable_old_style_mini_player_summary">Return the mini players to old style.</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user