mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 16:44:29 +02:00
fix(youtube/custom-video-speed): videos always play at 2.0x speed, even if the default video speed is faster than 2.0x speed
This commit is contained in:
parent
96cb62335d
commit
e4b1c487b7
@ -0,0 +1,20 @@
|
||||
package app.revanced.patches.youtube.video.customspeed.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
|
||||
object SpeedLimiterFallBackFingerprint : MethodFingerprint(
|
||||
returnType = "F",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("L"),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.GOTO,
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.CONST_HIGH16,
|
||||
Opcode.INVOKE_STATIC,
|
||||
),
|
||||
strings = listOf("Playback rate: %f")
|
||||
)
|
@ -17,6 +17,7 @@ import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.patch.OldSpeedLay
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedArrayGeneratorFingerprint
|
||||
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFallBackFingerprint
|
||||
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFingerprint
|
||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||
import org.jf.dexlib2.Opcode
|
||||
@ -40,6 +41,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
||||
class CustomVideoSpeedPatch : BytecodePatch(
|
||||
listOf(
|
||||
SpeedArrayGeneratorFingerprint,
|
||||
SpeedLimiterFallBackFingerprint,
|
||||
SpeedLimiterFingerprint
|
||||
)
|
||||
) {
|
||||
@ -97,7 +99,11 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
||||
}
|
||||
} ?: return SpeedArrayGeneratorFingerprint.toErrorResult()
|
||||
|
||||
SpeedLimiterFingerprint.result?.let { result ->
|
||||
arrayOf(
|
||||
SpeedLimiterFallBackFingerprint,
|
||||
SpeedLimiterFingerprint
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.result?.let { result ->
|
||||
result.mutableMethod.apply {
|
||||
val limiterMinConstIndex =
|
||||
implementation!!.instructions.indexOfFirst { (it as? NarrowLiteralInstruction)?.narrowLiteral == 0.25f.toRawBits() }
|
||||
@ -115,10 +121,11 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
||||
)
|
||||
replaceInstruction(
|
||||
limiterMaxConstIndex,
|
||||
"const/high16 v$limiterMaxConstDestination, 0x42c80000 # 100.0f"
|
||||
"const/high16 v$limiterMaxConstDestination, 0x41200000 # 10.0f"
|
||||
)
|
||||
}
|
||||
} ?: return SpeedLimiterFingerprint.toErrorResult()
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user