mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-29 21:30:19 +02:00
feat(YouTube Music): remove Enable old style miniplayer
patch
This commit is contained in:
parent
d6a01c6648
commit
9e3dd001eb
@ -1,96 +0,0 @@
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer
|
||||
|
||||
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.oldstyleminiplayer.fingerprints.MiniPlayerParentFingerprint
|
||||
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
|
||||
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.PLAYER
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Enable old style miniplayer",
|
||||
description = "Adds an option to return the miniplayer to the old style.",
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.apps.youtube.music",
|
||||
[
|
||||
"6.21.52",
|
||||
"6.22.52",
|
||||
"6.23.56",
|
||||
"6.25.53",
|
||||
"6.26.51",
|
||||
"6.27.54",
|
||||
"6.28.53",
|
||||
"6.29.58",
|
||||
"6.31.55",
|
||||
"6.33.52"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
setOf(
|
||||
MiniPlayerParentFingerprint,
|
||||
SwipeToCloseFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
MiniPlayerParentFingerprint.result?.let { parentResult ->
|
||||
NextButtonVisibilityFingerprint.also {
|
||||
it.resolve(
|
||||
context,
|
||||
parentResult.classDef
|
||||
)
|
||||
}.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
|
||||
val targetRegister =
|
||||
getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw NextButtonVisibilityFingerprint.exception
|
||||
} ?: throw MiniPlayerParentFingerprint.exception
|
||||
|
||||
SwipeToCloseFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = implementation!!.instructions.size - 1
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$targetRegister}, $PLAYER->enableOldStyleMiniPlayer(Z)Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw SwipeToCloseFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_old_style_mini_player",
|
||||
"true"
|
||||
)
|
||||
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MiniPlayerMdxPlaying
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object MiniPlayerParentFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
literalSupplier = { MiniPlayerMdxPlaying }
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object NextButtonVisibilityFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.CONST_16,
|
||||
Opcode.IF_EQZ
|
||||
)
|
||||
)
|
@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.music.player.oldstyleminiplayer.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object SwipeToCloseFingerprint : LiteralValueFingerprint(
|
||||
returnType = "Z",
|
||||
parameters = emptyList(),
|
||||
literalSupplier = { 45398432 }
|
||||
)
|
@ -61,8 +61,6 @@ Some features may not work properly in the old player layout."</string>
|
||||
<string name="revanced_enable_old_player_layout_title">Enable old player layout</string>
|
||||
<string name="revanced_enable_old_style_library_shelf_summary">Returns the library tab to the 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_mini_player_summary">Returns the miniplayer to the old style.</string>
|
||||
<string name="revanced_enable_old_style_mini_player_title">Enable old style mini player</string>
|
||||
<string name="revanced_enable_opus_codec_summary">Enables the opus audio codec instead of the mp4a audio codec.</string>
|
||||
<string name="revanced_enable_opus_codec_title">Enable opus codec</string>
|
||||
<string name="revanced_enable_save_playback_speed_summary">Remembers the last playback speed selected.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user