mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 14:27:18 +02:00
fix(music/enable-playback-speed): excluding enable playback speed patch still shows playback speed icon in the flyout menu
This commit is contained in:
parent
0309c5c94b
commit
650d0d9fff
@ -13,7 +13,7 @@ import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
|
||||
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerResourcePatch
|
||||
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
@ -27,7 +27,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
@Description("Hides flyout panel components.")
|
||||
@DependsOn(
|
||||
[
|
||||
FlyoutButtonContainerResourcePatch::class,
|
||||
FlyoutButtonContainerPatch::class,
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
|
@ -1,67 +1,31 @@
|
||||
package app.revanced.patches.music.flyoutpanel.playbackspeed.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.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.flyoutpanel.playbackspeed.fingerprints.FlyoutPanelLikeButtonFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerResourcePatch
|
||||
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerPatch
|
||||
import app.revanced.patches.music.utils.overridespeed.patch.OverrideSpeedHookPatch
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("Enable playback speed")
|
||||
@Description("Add playback speed button to the flyout panel.")
|
||||
@DependsOn(
|
||||
[
|
||||
FlyoutButtonContainerResourcePatch::class,
|
||||
FlyoutButtonContainerPatch::class,
|
||||
OverrideSpeedHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
SettingsPatch::class
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
class PlaybackSpeedPatch : BytecodePatch(
|
||||
listOf(FlyoutPanelLikeButtonFingerprint)
|
||||
) {
|
||||
class PlaybackSpeedPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FlyoutPanelLikeButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(SharedResourceIdPatch.MusicMenuLikeButtons)
|
||||
|
||||
var insertIndex = -1
|
||||
|
||||
for (index in targetIndex until targetIndex + 5) {
|
||||
if (getInstruction(index).opcode != Opcode.MOVE_RESULT_OBJECT) continue
|
||||
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
insertIndex = index
|
||||
|
||||
addInstruction(
|
||||
index + 1,
|
||||
"invoke-static {v$register}, $MUSIC_FLYOUT->setFlyoutButtonContainer(Landroid/view/View;)V"
|
||||
)
|
||||
break
|
||||
}
|
||||
if (insertIndex == -1)
|
||||
throw PatchException("Couldn't find target Index")
|
||||
}
|
||||
} ?: throw FlyoutPanelLikeButtonFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_enable_flyout_panel_playback_speed",
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.flyoutpanel.playbackspeed.fingerprints
|
||||
package app.revanced.patches.music.utils.flyoutbutton.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
@ -0,0 +1,53 @@
|
||||
package app.revanced.patches.music.utils.flyoutbutton.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.music.utils.flyoutbutton.fingerprints.FlyoutPanelLikeButtonFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.MusicMenuLikeButtons
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@DependsOn(
|
||||
[
|
||||
FlyoutButtonContainerResourcePatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
class FlyoutButtonContainerPatch : BytecodePatch(
|
||||
listOf(FlyoutPanelLikeButtonFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FlyoutPanelLikeButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(MusicMenuLikeButtons)
|
||||
|
||||
var insertIndex = -1
|
||||
|
||||
for (index in targetIndex until targetIndex + 5) {
|
||||
if (getInstruction(index).opcode != Opcode.MOVE_RESULT_OBJECT) continue
|
||||
|
||||
val register = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
insertIndex = index
|
||||
|
||||
addInstruction(
|
||||
index + 1,
|
||||
"invoke-static {v$register}, $MUSIC_FLYOUT->setFlyoutButtonContainer(Landroid/view/View;)V"
|
||||
)
|
||||
break
|
||||
}
|
||||
if (insertIndex == -1)
|
||||
throw PatchException("Couldn't find target Index")
|
||||
}
|
||||
} ?: throw FlyoutPanelLikeButtonFingerprint.exception
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user