HOOKAF(void, Input, void *thiz, void *ex_ab, void *ex_ac)
{
origInput(thiz, ex_ab, ex_ac);
ImGui_ImplAndroid_HandleInputEvent((AInputEvent *)thiz);
return;
}
cpp
HOOKAF(bool, Input, void *thiz, void *ex_ab, void *ex_ac)
{
// Call ImGui to handle the input event
bool handled = ImGui_ImplAndroid_HandleInputEvent((AInputEvent *)thiz);
// If ImGui handled the event, return true to stop further processing
if (handled) {
return true; // Prevent the game from receiving the event
}
// If not handled, call the original input function
return origInput(thiz, ex_ab, ex_ac);
}
Crashes the game upon touch.You might want to modify your hook to check if ImGui has handled the input. If it has, you can prevent the game from processing the touch event further:
Code:cpp HOOKAF(bool, Input, void *thiz, void *ex_ab, void *ex_ac) { // Call ImGui to handle the input event bool handled = ImGui_ImplAndroid_HandleInputEvent((AInputEvent *)thiz); // If ImGui handled the event, return true to stop further processing if (handled) { return true; // Prevent the game from receiving the event } // If not handled, call the original input function return origInput(thiz, ex_ab, ex_ac); }
do {
sleep(1);
unityMaps = ElfScanner::createWithPath("libunity.so");
} while (!unityMaps.isValid());
// input native function
RegisterNativeFn nativeInjectEventFn = KittyScanner::findRegisterNativeFn(unityMaps, "nativeInjectEvent");
forgot to also mention you hook nativeInjectEvent function from JNIStuff.h on the pointer nativeInjectEventFn.fnPtrif its a unity game you can use the native input event to get the positions, it has worked for me on my Xposed ImGui template, you should try it:
XposedImGuiMenu/app/src/main/cpp/include/JNIStuff.h at master · fedes1to/XposedImGuiMenu
Xposed ImGui Injection for Unity Games. Contribute to fedes1to/XposedImGuiMenu development by creating an account on GitHub.github.com XposedImGuiMenu/app/src/main/cpp/include/input.h at master · fedes1to/XposedImGuiMenu
Xposed ImGui Injection for Unity Games. Contribute to fedes1to/XposedImGuiMenu development by creating an account on GitHub.github.com
Remember to hook the native input method
C++:do { sleep(1); unityMaps = ElfScanner::createWithPath("libunity.so"); } while (!unityMaps.isValid()); // input native function RegisterNativeFn nativeInjectEventFn = KittyScanner::findRegisterNativeFn(unityMaps, "nativeInjectEvent");
if its a unity game you can use the native input event to get the positions, it has worked for me on my Xposed ImGui template, you should try it:
XposedImGuiMenu/app/src/main/cpp/include/JNIStuff.h at master · fedes1to/XposedImGuiMenu
Xposed ImGui Injection for Unity Games. Contribute to fedes1to/XposedImGuiMenu development by creating an account on GitHub.github.com XposedImGuiMenu/app/src/main/cpp/include/input.h at master · fedes1to/XposedImGuiMenu
Xposed ImGui Injection for Unity Games. Contribute to fedes1to/XposedImGuiMenu development by creating an account on GitHub.github.com
Remember to hook the native input method
C++:do { sleep(1); unityMaps = ElfScanner::createWithPath("libunity.so"); } while (!unityMaps.isValid()); // input native function RegisterNativeFn nativeInjectEventFn = KittyScanner::findRegisterNativeFn(unityMaps, "nativeInjectEvent");
public static Touch GetTouch(int index) { }
struct Touch {
int m_FingerId;
Vector2 m_Position;
Vector2 m_RawPosition;
Vector2 m_PositionDelta;
float m_TimeDelta;
int m_TapCount;
int m_Phase; // Enum TouchPhase
int m_Type; // Enum TouchType
float m_Pressure;
float m_MaximumPossiblePressure;
float m_Radius;
float m_RadiusVariance;
float m_AltitudeAngle;
float m_AzimuthAngle;
};
Touch (*old_GetTouch)(int index);
Touch GetTouch(int index) {
return old_GetTouch(index;
}
// Then hook it
DobbyHook(..., (void*)GetTouch, (void*)old_GetTouch
public const TouchPhase Began = 0;
Touch (*old_GetTouch)(int index);
Touch GetTouch(int index) {
Touch touch = old_GetTouch(index);
if (GetIO().WantCaptureMouse) {
touch.m_Phase = 0;
}
return touch;
}
touch.m_Phase = TouchPhase::Stationary;Lemme know what you think of this!
Edit: I read what I wrote above again and it looks I made a mistake with writing some code. It should be easy to spot and fix, hehe.
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies