elishacloud / dxwrapper

Fixes compatibility issues with older games running on Windows 10/11 by wrapping DirectX dlls. Also allows loading custom libraries with the file extension .asi into game processes.
zlib License
1.17k stars 83 forks source link

AvP2/LithTech Jittery Mouse fix? #30

Open StrikerMan780 opened 5 years ago

StrikerMan780 commented 5 years ago

Would it be possible to get some fix for dinput.dll to fix the jittery mouse in Aliens Vs. Predator 2, and other LithTech games like No One Lives Forever?

It seem to stem from USB mice with poll rates higher than 125hz, and many mice can't be set that low, making these games unplayable. I've tried DI-Wrapper, but it doesn't fix it, and makes things worse by not allowing you to shoot (clicks don't register).

elishacloud commented 5 years ago

I had a similar problem on Interstate '82. I used the dinput.dll file from below. Not sure if the same version will work on these games too. You can try it out.

dinput.zip

elishacloud commented 5 years ago

@StrikerMan780, I created a DirectInput converter that converts DirectInput games to DirectInput8. I am not sure if this will help, but at least it will allow you to use dinput8.dll tools with these older games.

You can check it out here: dinputto8

mirh commented 5 years ago

Is there some.. Possibility to document the differences between the (4 I think?) different versions dinput? And is there any "gain" (aside of compatibility with external tools in itself) from the upgrade?

elishacloud commented 5 years ago

Yes, there are some minor differences between the different versions. However DirectInput8 has enough functions that I was able to map all versions to it. dinputto8 does a 1:1 mapping of all dinput functions to DirectInput8 functions.

As far as the versions of DirectInput, the dinput.h file says:

/*
 *  To build applications for older versions of DirectInput
 *
 *  #define DIRECTINPUT_VERSION [ 0x0300 | 0x0500 | 0x0700 ]
 *
 *  before #include <dinput.h>.  By default, #include <dinput.h>
 *  will produce a DirectX 8-compatible header file.
 *
 */

So it lists the same three versions that you mentioned. However, besides those versions there are also three interfaces:

See here. So, in reality there are more than just those three versions. There are actually 7 versions (excluding version 8 of course).

Is there some.. Possibility to document the differences between the (4 I think?) different versions dinput?

All the differences are documented in the dinput.h file (that is the a link to the latest version).

Note: I pulled these by hand quickly so I may have made a mistake.

And is there any "gain" (aside of compatibility with external tools in itself) from the upgrade?

Currently, dinputto8 does nothing with the gain. However I could add config options to control the gain later.

elishacloud commented 5 years ago

@StrikerMan780, I will also look into customizing the mouse pull rate to fix issues in the games you mentioned.

brazzjazz commented 5 years ago

I'm having a choppy, jittery etc. mouse movement as well, in KISS Psycho Circus: The Nightmare Child, a game from 2000 based on Lithtech Engine 1, and the custom dinput.dll did not change that. The movement is silky smooth with arrow keys but it makes smaller and bigger jumps when I evenly move the mouse. Someone pointed out that turning off VSync might solve the problem, but I haven't succeeded in forcing it to be turned off - there are no ingame settings, no entry in the cfg file, and neither Nvidia Profile Inspector nor Nvidia driver settings succeed in turning VSync off.

NATO2000 commented 2 years ago

I'm having a choppy, jittery etc. mouse movement as well, in KISS Psycho Circus: The Nightmare Child, a game from 2000 based on Lithtech Engine 1, and the custom dinput.dll did not change that. The movement is silky smooth with arrow keys but it makes smaller and bigger jumps when I evenly move the mouse. Someone pointed out that turning off VSync might solve the problem, but I haven't succeeded in forcing it to be turned off - there are no ingame settings, no entry in the cfg file, and neither Nvidia Profile Inspector nor Nvidia driver settings succeed in turning VSync off.

that is because the game limits its frame rate@60FPS,you need pcgamingwiki to seek for solution

elishacloud commented 2 years ago

dxwrapper can force v-sync off by setting the following options:

EnableVSync                = 0
ForceVsyncMode             = 1
Mitradis commented 2 years ago

Disable HardWare cursor if it possible in game. In some games HW cursor so does. Exactly the same behavior i had in Space Rangers 2.

elishacloud commented 1 year ago

I was finally able to reproduce this issue. It seems to be fixed with a dinput8wrapper from here: https://github.com/geeky/dinput8wrapper

If the game only used dinput you may need to enable dinputto8 from dxwrapper for this wrapper to work.

elishacloud commented 1 week ago

I just added some features to dxwrapper that should help with this:

  1. FixHighFrequencyMouse
  2. DeviceLookupCacheTime

Enabling FixHighFrequencyMouse will help with a number of issues, including cases where the games frame rate is too slow or the mouse input speed is too fast. It also helps if the game does not correctly support DirectInput's buffer overflow code.

Setting DeviceLookupCacheTime to a larger number helps with games that try and enumerate the attached devices too often, leading to shuttering and other input slowdowns.

Try this update: dxwrapper.zip