typedef int (*InitializeMotionEventFunc)(void *thiz, void *motio
typedef int (*InitializeMotionEventFunc)(void *thiz, void *motionEvent, const void *inputMessage); // Function pointer to hold the original initializeMotionEvent function InitializeMotionEventFunc origInitializeMotionEvent = nullptr; // Custom implementation of the initializeMotionEvent function int myInitializeMotionEvent(void *thiz, void *motionEvent, const void *inputMessage) { // Call the original initializeMotionEvent function int result = origInitializeMotionEvent(thiz, motionEvent, inputMessage); // Extract touch event information AInputEvent *inputEvent = (AInputEvent *)thiz; LOGI("inputEvent %p", inputEvent); int32_t action = AMotionEvent_getAction(inputEvent); int32_t actionMasked = action & AMOTION_EVENT_ACTION_MASK; int32_t pointerIndex = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; int32_t pointerCount = AMotionEvent_getPointerCount(inputEvent); // Process touch event based on the action switch (actionMasked) { case AMOTION_EVENT_ACTION_DOWN: case AMOTION_EVENT_ACTION_POINTER_DOWN: { // Touch down event int32_t pointerId = AMotionEvent_getPointerId(inputEvent, pointerIndex); float x = AMotionEvent_getX(inputEvent, pointerIndex); float y = AMotionEvent_getY(inputEvent, pointerIndex); LOGI("X : %f Y : %f", x, y); // Call the ImGui_ImplAndroid_HandleInputEvent function with the touch event information ImGui_ImplAndroid_HandleInputEvent(static_cast<int>(x), static_cast<int>(y), AMOTION_EVENT_ACTION_DOWN); break; } case AMOTION_EVENT_ACTION_MOVE: { // Touch move event for (int32_t i = 0; i < pointerCount; ++i) { int32_t pointerId = AMotionEvent_getPointerId(inputEvent, i); float x = AMotionEvent_getX(inputEvent, i); float y = AMotionEvent_getY(inputEvent, i); LOGI("X : %f Y : %f", x, y); // Call the ImGui_ImplAndroid_HandleInputEvent function with the touch event information ImGui_ImplAndroid_HandleInputEvent(static_cast<int>(x), static_cast<int>(y), AMOTION_EVENT_ACTION_MOVE); } break; } case AMOTION_EVENT_ACTION_UP: case AMOTION_EVENT_ACTION_POINTER_UP: { // Touch up event int32_t pointerId = AMotionEvent_getPointerId(inputEvent, pointerIndex); float x = AMotionEvent_getX(inputEvent, pointerIndex); float y = AMotionEvent_getY(inputEvent, pointerIndex); LOGI("X : %f Y : %f", x, y); // Call the ImGui_ImplAndroid_HandleInputEvent function with the touch event information ImGui_ImplAndroid_HandleInputEvent(static_cast<int>(x), static_cast<int>(y), AMOTION_EVENT_ACTION_UP); break; } // Add additional cases as needed for other touch event types default: break; } return result; } void *sym_input = DobbySymbolResolver(("/system/lib/libinput.so"), ("_ZN7android13InputConsumer21initializeMotionEventEPNS_11MotionEventEPKNS_12InputMessageE")); if (nullptr != sym_input){ LOGI("TOUCH %p",sym_input); origInitializeMotionEvent = reinterpret_cast<InitializeMotionEventFunc>(sym_input); DobbyHook((void *)origInitializeMotionEvent, (void *)myInitializeMotionEvent, (void **)&origInitializeMotionEvent); } 通用安卓imgui的触摸自瞄
在Telegram中查看相关推荐

🔍 发送关键词来寻找群组、频道或视频。
启动SOSO机器人