J2Kbr / TitanTwo

Titan Two - Device firmware bug report.
http://www.consoletuner.com
26 stars 3 forks source link

We need a API mouse_set(uint8 ident, int32 status) using fix32 version #288

Closed lVentus closed 3 years ago

lVentus commented 3 years ago

I’m now working on a script to allow using controller to play FPS games as virtual keyboard and mouse. Because the curve of each game is different, and there are different stick acceleration, so I decided to use Titan Two to directly simulate the mouse. However, I found a major issue on the function of mouse_set API.

The API mouse_set now is using int. It is like this: void mouse_set(uint8 ident, int32 status); For example, in this function: mouse_set(MOUSE_X, (int16)round(get_value(PS4_RX))); Because of the accuracy of the int, it caused a great error when moving the stick in a small range and lost the smooth feeling.It makes some accurate aim isn’t possible since integer is absolutely not enough as a output value for a virtual mouse. I hope there can be a API like: void mouse_set(uint8 ident, fix32 status); thank you.

Scachi commented 3 years ago

@J2kbr Questions about the USB HID implementation : Is it possible to adjust the mouse dpi rate of the simulated mouse ? At which speed or rate or dpi is the mouse_passthru working ? You have mentioned we need to limit the report rate via a combo to not overload the usb connection, how do you avoid that via the passthru function ? Using higher wait times will result in choppy movement for some games where we can't tune down the games sensitivity enough. Example:

#include <mouse.gph>

main {
    key_passthru();
    combo_run(cMove);
}

combo cMove {
    mouse_set(MOUSE_X,0);
    mouse_set(MOUSE_Y,1);
    wait(0);
    wait(6);
}

It would be good to be able to use the exact same rate as the mouse_passthru is working for simulating a mouse output via code. Also being able to adjust the dpi rate of that simulated mouse is a must have for being able to get smooth mouse movement output to any game. Think about using gamepad to mouse output via script for games that require smooth controls like fps shooter. So we need to be able to adjust the effective output value range somehow to match the games required mouse data.

lVentus commented 3 years ago

@J2Kbr Questions about the USB HID implementation : Is it possible to adjust the mouse dpi rate of the simulated mouse ? At which speed or rate or dpi is the mouse_passthru working ? You have mentioned we need to limit the report rate via a combo to not overload the usb connection, how do you avoid that via the passthru function ? Using higher wait times will result in choppy movement for some games where we can't tune down the games sensitivity enough. Example:

#include <mouse.gph>

main {
    key_passthru();
    combo_run(cMove);
}

combo cMove {
    mouse_set(MOUSE_X,0);
    mouse_set(MOUSE_Y,1);
    wait(0);
    wait(6);
}

It would be good to be able to use the exact same rate as the mouse_passthru is working for simulating a mouse output via code. Also being able to adjust the dpi rate of that simulated mouse is a must have for being able to get smooth mouse movement output to any game. Think about using gamepad to mouse output via script for games that require smooth controls like fps shooter. So we need to be able to adjust the effective output value range somehow to match the games required mouse data.

    Yes,After the discussion in discord, we think we just need a method to set the virtual mouse DPI. We don't actully need a mouse_set of fix32 version. Int32 range of titan2 is huge. Its accuracy is enough if I can use the whole range of int32 instead of -100 to 100.
    But the default DPI of virtual mouse is too high. When I use Mouse_set(MOUSE_X, 1); and set the sensitivity in game to the lowest(for example it's 0.2 in Apex and 0.10 in Escape from Tarkov). The camera still move too fast. According to my test, compared with my real mouse, the default dpi is almost 9000. This is insane.
    And the method using system_time()%7 is unacceptable, This is just to reduce the mouse response rate, which will cause Input delay and chopping movement. Most mouse has a 1000 times per second polling rate.  
v-jacob commented 3 years ago

Yes, this is something I've been having issues as well. I'm trying to create an anti-recoil script for apex legends on PC with mouse passthrough, but mouse_set value of 1 is still too much pull down. Setting the in-game sensitivity low helps but then it's too slow to play.

Scachi commented 3 years ago

This github issue is more important for direct mouse control, like gamepad to mouse than applying anti recoil.

For anti recoil you can work around that limitation most of the time by using a higher value for the mouse speed in that script: https://www.consoletuner.com/wiki/index.php?id=t2:gpc_scripting:usb_hid#anti_recoil or give my usb hid warzone script a try. there you can insert decimal values for anti recoil.

v-jacob commented 3 years ago

Setting a higher value for mouse speed results in choppy mouse movements. I'll give the usb hid warzone script a try.

Scachi commented 3 years ago

Setting a higher value for mouse speed results in choppy mouse movements. I'll give the usb hid warzone script a try.

I also added a working example code with decimal support to the wiki: https://www.consoletuner.com/wiki/index.php?id=t2:gpc_scripting:usb_hid#anti_recoil_decimal

lVentus commented 3 years ago

Setting a higher value for mouse speed results in choppy mouse movements. I'll give the usb hid warzone script a try.

I also added a working example code with decimal support to the wiki: https://www.consoletuner.com/wiki/index.php?id=t2:gpc_scripting:usb_hid#anti_recoil_decimal

Hello,I have solve this problem by myself.

J2Kbr commented 3 years ago

The mouse DPI is not something that is configured, for example, on the device USB descriptors.

In practice a high DPI mouse just sends higher values (e.g. mouse_set(MOUSE_X, <mouse_value>); for the same traveled distance.

Anyway, the newly added function on Gtuner/Titan Two 1.11 (to be released soon), can be used to sync the generated mouse data packets with the output polling rate. This can be used to implement scripts with more precise mouse movement.

More info here: #271