-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for mouse capturing games #168
Comments
Hi 👋 I think that nut.js might be detected as automation software from the anti cheat protection of the game. There are several functionalities which are not indented to be automated. E.g the login screen for windows forbids automated interaction using the OS API. I've had an idea a while ago where we could try to simulate a usb keyboard and a usb mouse with virtual USB devices, similar to VM integrations. But that would require a lot of research an POC work at first. |
Hi @lkd70, nut.js relies on our N-API port of robotjs, so if it's doable with robotjs, it should™ be doable with nut.js as well. Since we're not primarily focusing on game automation, I'm not 100% sure on this, but feel free to follow along here for updates and feedback! Thanks for reaching out and your kind words! |
For anyone who really wants to do this. It is possible by modifying mouse.c inside of libnut. It requires you to roll libnut yourself then import that binary into a copy of the nut.js repo and then roll that yourself too. So not for the feint of heart. Here is a crude implementation of SendInput as suggested by @s1hofmann which offers a very limited usage within mouse capture apps. HERE BE DRAGONS Be aware this snippet fundamentally changes the way moveMouse works and breaks most of the existing mouse behavious of nut.js. It offers only a relative pixel movement of the mouse so you will lose ALL nut.js functionality around setting the mouse position to absolute pixel values on a screen.
This enables you to do this using your modified nut.js lib
|
Hi @Reiss-Cashmore 👋 That’s almost exactly what I had in mind!
to
This treats x and y values as absolute coordinates, keeping it consistent with the current implementation and thus not breaking nut.js API. See https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-mouseinput#remarks I’d happily accept a PR for this change! |
Hey, no worries I did a more technical response over here: nut-tree/libnut-core#26 I would be happy to do a PR if you feel the code is high enough quality. I wasn't sure, I am an absolute noob with C/C++ so could be doing something wrong. I think if you let me know whether you want me to modify moveMouse or create separate methods for relative / absolute movements |
Is there any intent to support games which capture the mouse input? Or ones that simply track mouse movement, even if the mouse moves beyond the bounds of the screen (ARK, for example)
Windows 10 - Native install
When attempting to use this tool to move my mouse in a game (Using ARK, for example) the cursor doesn't move within the game, but does seem to move when not in game. This issue doesn't seem to occur in robot.js or any other software I've played with, but the dynamic movement support of this library is fantastic. Is this something this library could do to? Is this possible or is it outside the bounds of this project?
Thanks for this amazing work of art!
The text was updated successfully, but these errors were encountered: