From 10afe2f294a21830bce30a189458c48b1f9c41f7 Mon Sep 17 00:00:00 2001 From: hd <1839732296@qq.com> Date: Thu, 7 Nov 2024 13:03:38 +0800 Subject: [PATCH] fix: HandleQQSomeFunExit fixFaceBubble --- .../java/me/hd/hook/HandleQQSomeFunExit.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/me/hd/hook/HandleQQSomeFunExit.kt b/app/src/main/java/me/hd/hook/HandleQQSomeFunExit.kt index 8ddaa9655f..e0493d7779 100644 --- a/app/src/main/java/me/hd/hook/HandleQQSomeFunExit.kt +++ b/app/src/main/java/me/hd/hook/HandleQQSomeFunExit.kt @@ -22,7 +22,10 @@ package me.hd.hook +import cc.ioctl.util.hookAfterIfEnabled import cc.ioctl.util.hookBeforeIfEnabled +import com.tencent.qqnt.kernel.nativeinterface.FaceBubbleElement +import com.tencent.qqnt.kernel.nativeinterface.MsgElement import io.github.qauxv.base.annotation.FunctionHookEntry import io.github.qauxv.base.annotation.UiItemAgentEntry import io.github.qauxv.dsl.FunctionEntryRouter @@ -49,6 +52,7 @@ object HandleQQSomeFunExit : CommonSwitchFunctionHook( 如无特殊情况不建议打开 1. 拦截群礼物消息闪退 2. 拦截群文件消息闪退 + 3. 拦截表情泡泡消息闪退 """.trimIndent() override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.EXPERIMENTAL_CATEGORY override val isAvailable = requireMinQQVersion(QQVersion.QQ_8_9_88) @@ -56,6 +60,7 @@ object HandleQQSomeFunExit : CommonSwitchFunctionHook( override fun initOnce(): Boolean { fixGiftView() fixFileView() + fixFaceBubble() return true } @@ -91,4 +96,22 @@ object HandleQQSomeFunExit : CommonSwitchFunctionHook( } } } + + private fun fixFaceBubble() { + val faceBubbleClass = Initiator.loadClass("com.tencent.mobileqq.aio.msg.FaceBubbleMsgItem") + val method = faceBubbleClass.declaredMethods.single { method -> + method.returnType == MsgElement::class.java && method.parameterTypes.size == 0 + } + hookAfterIfEnabled(method) { param -> + if (param.result == null) { + param.result = MsgElement().apply { + faceBubbleElement = FaceBubbleElement().apply { + faceType = 5 + faceCount = Int.MAX_VALUE + } + } + Toasts.show("拦截表情泡泡消息闪退") + } + } + } } \ No newline at end of file