Jump to content
  • Advertisement
Sign in to follow this  
Sonic Song

About the mouse/cursor in the DirectInput, Please help me

This topic is 4507 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Recently, I am doing an interesting project, but I meet something that is so strange with the way the program getting mouse's data from the device that I need your help. The problem can be described in the follows: The project I am taking part in is aim to play PC's games in front of TV, and while the user in front of PC(we call the PC host, and the TV client) will not be effected at the same time. We set the game to background running mode, and we get its video and audio, and sent it to the DMA(Digital Media Adapter, it is connected to the TV), and the DMA play it in the TV. And the message data of Keyboard and mouse which is connected to the DMA are sent back PC, and we send them to the background running games directly. Then the game can be controlled. NOW, we meet some problem with NFS: UnderGround2,when we send the position of the mouse which connected to the DMA to it. Normally, We have two common ways to send the messages of keyboard and mouse to games. The first one is through "DirectInput", and the second one is through "windows message and Win32 API".For the first one, we simulated an interface of IDirectInputDevice using the data of mouse and keyboard from DMA, we replace all the methods of the IDirectInputDevice8 interfaces, which in count is 29. For the second one, we simulate the Win32 API such as GetCursorPos/GetCursorInfo/SetCursor/SetCursorPos/GetMessagePos/GetMessage/mouse_event/SendInput/SetCapture/GetCapture/GetMouseMovePointsEx/GetRawInputData/TrackMouseEvent/ClienttoScreen/ScreentoClient etc, with the data we retrieved from the DMA's mouse an keyboard, and send the messages such as WM_MOUSEMOVE etc with the data we retrieved from the DMA's mouse and keyboard , to send the data of DMA's mouse and keyboard to the background running game. Using these methods, we tested the NFS:Underground in background mode, it is all OK,mouse of the client(TV) can control the game that is running in the PC correctly, and the mouse of the PC have no interfere with the game's images in TV. That is to say, the NFS:UG can only get the data from DMA, it is just what we want. But, when we test the NFS:Underground2, we found that the mouse in the PC appeared on the TV side, and when we move the mouse on the PC, it just moved on the TV! And what is more, the mouse of the host can get the focus of the game's button. That is to say, the game did not used the position we send to it, it got the mouse of PC's position by some other way which we do not know. We know the Underground1 used the DirectInput8 to retrieve mouse/keyboard data. We think, possibility we omitted to handle some functions that the NFS:Underground2 get the mouse's position,or there is something different with the parameter in the interfaces of the DirectInput, so we can not send the mouse's position of the DMA side to the game, and at the same time, the background running game can get the mouse's position through some other way. Because we don't know the way that the Underground2 get the mouse's position ,so we only guess the ways and try one by one ,but it does no take any effort, because the project is so emergency that we need your help . Are there any other ways for the 3D games to get the mouse's position? Or, are there any trick in the interfaces of DirectInput8 to get the mouse's position? Any advise from you means much to me, Thank you very much!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!