fix(TikTok - Playback speed): Prevent crash by fixing invalid patch

This commit is contained in:
oSumAtrIX 2024-07-31 19:40:33 +02:00
parent bbbc071db0
commit 82d53cbc3b
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -20,19 +20,19 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch( @Patch(
name = "Playback speed", name = "Playback speed",
description = "Enables the playback speed option for all videos and " + description = "Enables the playback speed option for all videos and " +
"retains the speed configurations in between videos.", "retains the speed configurations in between videos.",
compatiblePackages = [ compatiblePackages = [
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]), CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]) CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"]),
] ],
) )
@Suppress("unused") @Suppress("unused")
object PlaybackSpeedPatch : BytecodePatch( object PlaybackSpeedPatch : BytecodePatch(
setOf( setOf(
GetSpeedFingerprint, GetSpeedFingerprint,
OnRenderFirstFrameFingerprint, OnRenderFirstFrameFingerprint,
SetSpeedFingerprint SetSpeedFingerprint,
) ),
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
SetSpeedFingerprint.result?.let { onVideoSwiped -> SetSpeedFingerprint.result?.let { onVideoSwiped ->
@ -44,7 +44,7 @@ object PlaybackSpeedPatch : BytecodePatch(
addInstruction( addInstruction(
injectIndex, injectIndex,
"invoke-static { v$register }," + "invoke-static { v$register }," +
" Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V" " Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V",
) )
} ?: throw GetSpeedFingerprint.exception } ?: throw GetSpeedFingerprint.exception
@ -64,9 +64,9 @@ object PlaybackSpeedPatch : BytecodePatch(
# Desired playback speed retrieved using getPlaybackSpeed method. # Desired playback speed retrieved using getPlaybackSpeed method.
invoke-static {}, Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F invoke-static {}, Lapp/revanced/integrations/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F
move-result-object v2 move-result v2
invoke-static { v0, v1, v2 }, ${onVideoSwiped.method} invoke-static { v0, v1, v2 }, ${onVideoSwiped.method}
""" """,
) ?: throw OnRenderFirstFrameFingerprint.exception ) ?: throw OnRenderFirstFrameFingerprint.exception
// Force enable the playback speed option for all videos. // Force enable the playback speed option for all videos.
@ -75,7 +75,7 @@ object PlaybackSpeedPatch : BytecodePatch(
""" """
const/4 v0, 0x1 const/4 v0, 0x1
return v0 return v0
""" """,
) ?: throw PatchException("Failed to force enable the playback speed option.") ) ?: throw PatchException("Failed to force enable the playback speed option.")
} ?: throw SetSpeedFingerprint.exception } ?: throw SetSpeedFingerprint.exception
} }