mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 15:14:34 +02:00
feat(music): add enable-old-style-library-shelf
patch
This commit is contained in:
parent
2d9daa0518
commit
6abfa670ac
@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.music.general.oldstylelibraryshelf.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.util.bytecode.isWide32LiteralExists
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object BrowseIdFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
strings = listOf("FEmusic_offline"),
|
||||
customFingerprint = { methodDef, _ -> methodDef.isWide32LiteralExists(45358178) }
|
||||
)
|
@ -0,0 +1,51 @@
|
||||
package app.revanced.patches.music.general.oldstylelibraryshelf.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
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.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.general.oldstylelibraryshelf.fingerprints.BrowseIdFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getStringIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Enable old style library shelf")
|
||||
@Description("Return the library shelf to old style.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
class OldStyleLibraryShelfPatch : BytecodePatch(
|
||||
listOf(BrowseIdFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
BrowseIdFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getStringIndex("FEmusic_offline") - 5
|
||||
val targetRegister = getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {v$targetRegister}, $MUSIC_GENERAL->enableOldStyleLibraryShelf(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw BrowseIdFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_enable_old_style_library_shelf",
|
||||
"false"
|
||||
)
|
||||
|
||||
}
|
||||
}
|
@ -30,6 +30,8 @@
|
||||
<string name="revanced_enable_landscape_mode_title">Enable landscape mode</string>
|
||||
<string name="revanced_enable_new_layout_summary">Enable new player layouts. (YT Music v5.47.51+)</string>
|
||||
<string name="revanced_enable_new_layout_title">Enable new 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_title">Enable old style library shelf</string>
|
||||
<string name="revanced_enable_old_style_mini_player_summary">Return the mini players to old style. (YT Music v5.55.53+)</string>
|
||||
<string name="revanced_enable_old_style_mini_player_title">Enable old style mini player</string>
|
||||
<string name="revanced_enable_opus_codec_summary">Enable 250/251 opus codec when playing audio.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user