Skip to content

Commit

Permalink
fix: HandleQQSomeFunExit fixFaceBubble
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Nov 8, 2024
1 parent 3074ac0 commit 10afe2f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/src/main/java/me/hd/hook/HandleQQSomeFunExit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,13 +52,15 @@ object HandleQQSomeFunExit : CommonSwitchFunctionHook(
如无特殊情况不建议打开
1. 拦截群礼物消息闪退
2. 拦截群文件消息闪退
3. 拦截表情泡泡消息闪退
""".trimIndent()
override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.EXPERIMENTAL_CATEGORY
override val isAvailable = requireMinQQVersion(QQVersion.QQ_8_9_88)

override fun initOnce(): Boolean {
fixGiftView()
fixFileView()
fixFaceBubble()
return true
}

Expand Down Expand Up @@ -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("拦截表情泡泡消息闪退")
}
}
}
}

0 comments on commit 10afe2f

Please sign in to comment.