From 3cd628f7cfa326e02b49f3804a5dbd07bc74ab96 Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:31:44 +0200 Subject: [PATCH] fix: bypass video length restriction --- .../features/impl/global/BypassVideoLengthRestriction.kt | 8 +++++--- .../rhunk/snapenhance/core/scripting/impl/ScriptHooker.kt | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/global/BypassVideoLengthRestriction.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/global/BypassVideoLengthRestriction.kt index b8803686..1662bd23 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/global/BypassVideoLengthRestriction.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/global/BypassVideoLengthRestriction.kt @@ -63,9 +63,11 @@ class BypassVideoLengthRestriction : } // chat camera roll grid - findClass("com.snap.impala.common.media.MediaLibraryItem").hookConstructor(HookStage.BEFORE) { param -> - //set the video length argument - param.setArg(3, -1L) + findClass("com.snap.composer.memories.MemoriesPickerVideoDurationConfig").hookConstructor(HookStage.AFTER) { param -> + param.thisObject().apply { + setObjectField("_maxSingleItemDurationMs", null) + setObjectField("_maxTotalDurationMs", null) + } } } } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/scripting/impl/ScriptHooker.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/scripting/impl/ScriptHooker.kt index 91f4416b..b53c80e3 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/scripting/impl/ScriptHooker.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/scripting/impl/ScriptHooker.kt @@ -48,7 +48,7 @@ class ScriptHookCallback( fun arg(index: Int) = hookAdapter.argNullable(index) - fun setArg(index: Int, value: Any) { + fun setArg(index: Int, value: Any?) { hookAdapter.setArg(index, value.toPrimitiveValue(lazy { parameterTypes[index].name })) }