mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 08:34:27 +02:00
fix(YouTube/Default video quality): applying default video quality to shorts causes the beginning of the shorts to get stuck in a loop
This commit is contained in:
parent
0cfe7c7b88
commit
eed9d58da8
@ -0,0 +1,41 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.fix.shortsplayback
|
||||||
|
|
||||||
|
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.annotation.Patch
|
||||||
|
import app.revanced.patches.youtube.utils.fix.shortsplayback.fingerprints.ShortsPlaybackFingerprint
|
||||||
|
import app.revanced.util.getTargetIndex
|
||||||
|
import app.revanced.util.getWideLiteralInstructionIndex
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
description = "Fix issue with looping at the start of the video when applying default video quality to Shorts."
|
||||||
|
)
|
||||||
|
object ShortsPlaybackPatch : BytecodePatch(
|
||||||
|
setOf(ShortsPlaybackFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This issue only affects some versions of YouTube.
|
||||||
|
* Therefore, this patch only applies to versions that can resolve this fingerprint.
|
||||||
|
*
|
||||||
|
* RVX applies default video quality to Shorts as well, so this patch is required.
|
||||||
|
*/
|
||||||
|
ShortsPlaybackFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val targetIndex = getTargetIndex(getWideLiteralInstructionIndex(45387052), Opcode.MOVE_RESULT)
|
||||||
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
targetIndex + 1,
|
||||||
|
"const/4 v$targetRegister, 0x0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.fix.shortsplayback.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object ShortsPlaybackFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
literalSupplier = { 45387052 }
|
||||||
|
)
|
@ -17,6 +17,7 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch.contexts
|
|||||||
import app.revanced.patches.youtube.utils.videoid.general.VideoIdPatch
|
import app.revanced.patches.youtube.utils.videoid.general.VideoIdPatch
|
||||||
import app.revanced.patches.youtube.utils.videoid.withoutshorts.VideoIdWithoutShortsPatch
|
import app.revanced.patches.youtube.utils.videoid.withoutshorts.VideoIdWithoutShortsPatch
|
||||||
import app.revanced.patches.youtube.utils.fingerprints.VideoQualitySetterFingerprint
|
import app.revanced.patches.youtube.utils.fingerprints.VideoQualitySetterFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.fix.shortsplayback.ShortsPlaybackPatch
|
||||||
import app.revanced.util.copyXmlNode
|
import app.revanced.util.copyXmlNode
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
@ -29,6 +30,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
OverrideSpeedHookPatch::class,
|
OverrideSpeedHookPatch::class,
|
||||||
PlayerTypeHookPatch::class,
|
PlayerTypeHookPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
|
ShortsPlaybackPatch::class,
|
||||||
VideoIdPatch::class,
|
VideoIdPatch::class,
|
||||||
VideoIdWithoutShortsPatch::class
|
VideoIdWithoutShortsPatch::class
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user