Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Emulate mouse movement ingame for the purpose of controlling recoil

How would one achieve this?
I've messed about with:
Code
Cursor.Position = (New Point(MousePosition.X, MousePosition.Y + 5))
to set the cursor position.
And this works when not ingame. [In this case Rust, csgo, fullscreen or fullscreen windowed]
But when I go ingame, it does not and has no effect.
I assume the game is blocking this type of input
Has anyone got a solution?
- Cheers boyos
[Image: SMnpQ4d.gif]
It's an assumption, but maybe in game uses Direct Input (from DirectX API) for mouse stuff, and thats is why does not work.

Update
NVM my previous reply.

Try to use mouse_event API instead Cursor

C#:

PHP Code

<?php 
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static 
extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, UIntPtr dwExtraInfo);
private const 
uint MOUSEEVENTF_LEFTDOWN = 0x02;
private const 
uint MOUSEEVENTF_LEFTUP = 0x04;
private const 
uint MOUSEEVENTF_RIGHTDOWN = 0x08;
private const 
uint MOUSEEVENTF_RIGHTUP = 0x10; 

Bonus-Track: very advadced stuff (you need to know what you are doing) http://pastebin.com/rj4YcW4C
Bookmarked for futher uses
SendMessage/PostMessage API. Use ilspy++ to read what messages are sent to simulate a mouse click.
Most games get their input directly from the mouse driver itself (DirectInput, part of DirectX). I'm not sure of a way to get around that, but most games have an option to disable 'RawInput' such as csgo.
Use SendInput our the deprecated api mouse_event, will work whether the game is fullscreen or not, and raw input enabled or not.
A more costy way is to use a microcontroller emulating the mouse. If you are interested, send me a message and I give you all links.
My method works when raw input is off now which is fine in games that have the option to turn raw input off, however I need this for a game that doesn't have the option [Rust]
Does anyone have an example of something that could get around this? whether it be sendinput,mouse_event or some other way?
Or could someone point me at some documentation of these methods?
[Image: SMnpQ4d.gif]
God damn you're all fucking morons.
(Mar 17, 2017 11:57 AM)webinjectsformgrabberhvnc Wrote:  God damn you're all fucking morons.

Care to elaborate?
[Image: SMnpQ4d.gif]
Angles to pixels in CS:GO looks like this I believe:
Code
Public Function AngleToPixel(ByVal viewAngles As Vector3D, ByVal AimAngles As Vector3D) As Vector3D
        Dim newAngle As New Vector3D
        newAngle = viewAngles - AimAngles
        newAngle.Normalize()
        newAngle.X /= (0.022F * m_Sensitivity)
        newAngle.Y /= (0.022F * m_Sensitivity)
        Return New Vector3D(newAngle.Y, -newAngle.X, 0.0F)
    End Function

And you need to clamp them if you're using ABSOLUTE flag.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by HorribleaimFeb 11, 2025 06:17 PM 4 556 Feb 11, 2025 06:17 PM
Last Post: SIM-5604220
[Python] by david0369Aug 30, 2021 04:46 PM 3 124 Aug 30, 2021 04:46 PM
Last Post: david0369
[C] by SIM-4828712Dec 28, 2020 01:17 PM 3 217 Dec 28, 2020 01:17 PM
Last Post: DeadCode