From 05b9f8709895dae67e8cc12e8b7bdb87ff401997 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:29:15 +0400 Subject: [PATCH] fix(YouTube - Playback speed): Remember playback speed when using non 1.0x default speed This code was previously present with PR #3810 but was accidentally left out during the DSL migration. --- .../youtube/video/information/VideoInformationPatch.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index 4b1755141..a44e371bf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -302,8 +302,14 @@ private fun getReference(instructions: List, offset: Int, op /** * Hook the video speed selected by the user. */ -fun userSelectedPlaybackSpeedHook(targetMethodClass: String, targetMethodName: String) = +fun userSelectedPlaybackSpeedHook(targetMethodClass: String, targetMethodName: String) { + legacySpeedSelectionInsertMethod.addInstruction( + legacySpeedSelectionInsertIndex++, + "invoke-static { v$legacySpeedSelectionValueRegister }, $targetMethodClass->$targetMethodName(F)V" + ) + speedSelectionInsertMethod.addInstruction( speedSelectionInsertIndex++, - "invoke-static {v$speedSelectionValueRegister}, $targetMethodClass->$targetMethodName(F)V", + "invoke-static { v$speedSelectionValueRegister }, $targetMethodClass->$targetMethodName(F)V", ) +}