forked from ReVanced/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
58 changed files
with
583 additions
and
537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...c/main/java/app/revanced/extension/youtube/patches/FixPlaybackSpeedWhilePlayingPatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package app.revanced.extension.youtube.patches; | ||
|
||
import app.revanced.extension.shared.Logger; | ||
import app.revanced.extension.youtube.shared.PlayerType; | ||
|
||
@SuppressWarnings("unused") | ||
public class FixPlaybackSpeedWhilePlayingPatch { | ||
|
||
private static final float DEFAULT_YOUTUBE_PLAYBACK_SPEED = 1.0f; | ||
|
||
public static boolean playbackSpeedChanged(float playbackSpeed) { | ||
if (playbackSpeed == DEFAULT_YOUTUBE_PLAYBACK_SPEED && | ||
PlayerType.getCurrent().isMaximizedOrFullscreen()) { | ||
|
||
Logger.printDebug(() -> "Blocking call to change playback speed to 1.0x"); | ||
|
||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
.../app/revanced/patches/youtube/misc/fix/playbackspeed/FIxPlaybackSpeedWhilePlayingPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package app.revanced.patches.youtube.misc.fix.playbackspeed | ||
|
||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.patch.bytecodePatch | ||
import app.revanced.patcher.util.smali.ExternalLabel | ||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch | ||
import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch | ||
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater | ||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch | ||
import app.revanced.util.indexOfFirstInstructionOrThrow | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction | ||
|
||
private const val EXTENSION_CLASS_DESCRIPTOR = | ||
"Lapp/revanced/extension/youtube/patches/FixPlaybackSpeedWhilePlayingPatch;" | ||
|
||
/** | ||
* Fixes a bug in YouTube 19.34+ where the playback speed | ||
* can incorrectly reset to 1.0x under certain conditions. | ||
* | ||
* Reproduction steps using 19.34+ | ||
* 1. Open a video and start playback | ||
* 2. Change the speed to any value that is not 1.0x. | ||
* 3. Open the comments panel. | ||
* 4. Tap any "N more replies" link at the bottom of a comment, or tap on a timestamp of a comment. | ||
* 5. Pause the video | ||
* 6. Resume the video | ||
* 7. Playback speed will incorrectly change to 1.0x. | ||
*/ | ||
@Suppress("unused") | ||
val fixPlaybackSpeedWhilePlayingPatch = bytecodePatch{ | ||
dependsOn( | ||
sharedExtensionPatch, | ||
playerTypeHookPatch, | ||
versionCheckPatch, | ||
) | ||
|
||
execute { | ||
if (!is_19_34_or_greater) { | ||
return@execute | ||
} | ||
|
||
playbackSpeedInFeedsFingerprint.method.apply { | ||
val freeRegister = implementation!!.registerCount - parameters.size - 2 | ||
val playbackSpeedIndex = indexOfGetPlaybackSpeedInstruction(this) | ||
val playbackSpeedRegister = getInstruction<TwoRegisterInstruction>(playbackSpeedIndex).registerA | ||
val returnIndex = indexOfFirstInstructionOrThrow(playbackSpeedIndex, Opcode.RETURN_VOID) | ||
|
||
addInstructionsWithLabels( | ||
playbackSpeedIndex + 1, | ||
""" | ||
invoke-static { v$playbackSpeedRegister }, $EXTENSION_CLASS_DESCRIPTOR->playbackSpeedChanged(F)Z | ||
move-result v$freeRegister | ||
if-nez v$freeRegister, :do_not_change | ||
""", | ||
ExternalLabel("do_not_change", getInstruction(returnIndex)) | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.