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.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
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.SpeedArrayGeneratorFingerprint
|
||||||
|
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFallBackFingerprint
|
||||||
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFingerprint
|
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFingerprint
|
||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
@ -40,6 +41,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||||||
class CustomVideoSpeedPatch : BytecodePatch(
|
class CustomVideoSpeedPatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
SpeedArrayGeneratorFingerprint,
|
SpeedArrayGeneratorFingerprint,
|
||||||
|
SpeedLimiterFallBackFingerprint,
|
||||||
SpeedLimiterFingerprint
|
SpeedLimiterFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -97,28 +99,33 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return SpeedArrayGeneratorFingerprint.toErrorResult()
|
} ?: return SpeedArrayGeneratorFingerprint.toErrorResult()
|
||||||
|
|
||||||
SpeedLimiterFingerprint.result?.let { result ->
|
arrayOf(
|
||||||
result.mutableMethod.apply {
|
SpeedLimiterFallBackFingerprint,
|
||||||
val limiterMinConstIndex =
|
SpeedLimiterFingerprint
|
||||||
implementation!!.instructions.indexOfFirst { (it as? NarrowLiteralInstruction)?.narrowLiteral == 0.25f.toRawBits() }
|
).forEach { fingerprint ->
|
||||||
val limiterMaxConstIndex =
|
fingerprint.result?.let { result ->
|
||||||
implementation!!.instructions.indexOfFirst { (it as? NarrowLiteralInstruction)?.narrowLiteral == 2.0f.toRawBits() }
|
result.mutableMethod.apply {
|
||||||
|
val limiterMinConstIndex =
|
||||||
|
implementation!!.instructions.indexOfFirst { (it as? NarrowLiteralInstruction)?.narrowLiteral == 0.25f.toRawBits() }
|
||||||
|
val limiterMaxConstIndex =
|
||||||
|
implementation!!.instructions.indexOfFirst { (it as? NarrowLiteralInstruction)?.narrowLiteral == 2.0f.toRawBits() }
|
||||||
|
|
||||||
val limiterMinConstDestination =
|
val limiterMinConstDestination =
|
||||||
getInstruction<OneRegisterInstruction>(limiterMinConstIndex).registerA
|
getInstruction<OneRegisterInstruction>(limiterMinConstIndex).registerA
|
||||||
val limiterMaxConstDestination =
|
val limiterMaxConstDestination =
|
||||||
getInstruction<OneRegisterInstruction>(limiterMaxConstIndex).registerA
|
getInstruction<OneRegisterInstruction>(limiterMaxConstIndex).registerA
|
||||||
|
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
limiterMinConstIndex,
|
limiterMinConstIndex,
|
||||||
"const/high16 v$limiterMinConstDestination, 0x0"
|
"const/high16 v$limiterMinConstDestination, 0x0"
|
||||||
)
|
)
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
limiterMaxConstIndex,
|
limiterMaxConstIndex,
|
||||||
"const/high16 v$limiterMaxConstDestination, 0x42c80000 # 100.0f"
|
"const/high16 v$limiterMaxConstDestination, 0x41200000 # 10.0f"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: return SpeedLimiterFingerprint.toErrorResult()
|
} ?: return fingerprint.toErrorResult()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user