mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-04-30 22:54:40 +02:00
refactor(youtube/remember-playback-speed): do not use other unrelated patches extension methods
This commit is contained in:
parent
a64f33e385
commit
19798bf31c
@ -28,7 +28,6 @@ import org.jf.dexlib2.Opcode
|
|||||||
import org.jf.dexlib2.builder.BuilderInstruction
|
import org.jf.dexlib2.builder.BuilderInstruction
|
||||||
import org.jf.dexlib2.builder.MutableMethodImplementation
|
import org.jf.dexlib2.builder.MutableMethodImplementation
|
||||||
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.Instruction
|
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import org.jf.dexlib2.immutable.ImmutableMethod
|
import org.jf.dexlib2.immutable.ImmutableMethod
|
||||||
@ -218,9 +217,8 @@ class VideoInformationPatch : BytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
private fun getReference(instructions: List<BuilderInstruction>, offset: Int, opcode: Opcode) =
|
||||||
instructions[instructions.indexOfFirst { it.opcode == opcode } + offset].reference
|
(instructions[instructions.indexOfFirst { it.opcode == opcode } + offset] as ReferenceInstruction)
|
||||||
|
.reference.toString()
|
||||||
val Instruction.reference get() = (this as ReferenceInstruction).reference.toString()
|
|
||||||
|
|
||||||
private lateinit var speedSelectionInsertMethod: MutableMethod
|
private lateinit var speedSelectionInsertMethod: MutableMethod
|
||||||
private var speedSelectionInsertIndex = 0
|
private var speedSelectionInsertIndex = 0
|
||||||
|
@ -19,9 +19,9 @@ import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
|||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.video.information.patch.VideoInformationPatch.Companion.reference
|
|
||||||
import app.revanced.patches.youtube.video.speed.custom.patch.CustomVideoSpeedPatch
|
import app.revanced.patches.youtube.video.speed.custom.patch.CustomVideoSpeedPatch
|
||||||
import app.revanced.patches.youtube.video.speed.remember.fingerprint.InitializePlaybackSpeedValuesFingerprint
|
import app.revanced.patches.youtube.video.speed.remember.fingerprint.InitializePlaybackSpeedValuesFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
|
||||||
@Name("remember-playback-speed")
|
@Name("remember-playback-speed")
|
||||||
@Description("Adds the ability to remember the playback speed you chose in the video playback speed flyout.")
|
@Description("Adds the ability to remember the playback speed you chose in the video playback speed flyout.")
|
||||||
@ -78,7 +78,8 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
|
|||||||
*/
|
*/
|
||||||
InitializePlaybackSpeedValuesFingerprint.result?.apply {
|
InitializePlaybackSpeedValuesFingerprint.result?.apply {
|
||||||
// Infer everything necessary for calling the method setPlaybackSpeed().
|
// Infer everything necessary for calling the method setPlaybackSpeed().
|
||||||
val onItemClickListenerClassFieldReference = mutableMethod.instruction(0).reference
|
val onItemClickListenerClassFieldReference =
|
||||||
|
mutableMethod.instruction<ReferenceInstruction>(0).reference
|
||||||
|
|
||||||
// Registers are not used at index 0, so they can be freely used.
|
// Registers are not used at index 0, so they can be freely used.
|
||||||
mutableMethod.addInstructions(
|
mutableMethod.addInstructions(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user