briankendall/devreorder

Less invasive alternative to a system-wide installation

CookiePLMonster opened this issue · 7 comments

Currently, devreorder says this for cases when the game initializes DirectInput via COM:

NOTE: This method of using devreorder will not work for games that initialize DirectInput via the COM interface. If you follow these directions to apply devreorder to a single game and it is not having any effect, it is likely that the game is accessing the DirectInput COM interface. In that case, you will need to follow the directions in the Apply to your entire system section.

This is a much more heavy-handed solution than necessary. It is possible to avoid messing with the system files, or even avoid requiring admin access by modifying DirectInput's CLSID definitions. Looking into the registry in a HKEY_CLASSES_ROOT\CLSID directory, starting from Windows 8, CLSID's related to DirectInput specify an absolute path to dinput8.dll, therefore games ignore your custom DLL placed in the game directory.

The fix is trivial and can be applied to the current user only - replacing the path field (inside InProcServer32) with a relative path to the DLL (aka just the name) will revert to the "old" behaviour of first trying to load a DLL from the application directory, before getting it from the system directory.

The original guide for this was approach written by John-Paul Ownby for IndirectSound. I created a revision of this guide that does not require using regedit.exe, and can be done from the Command Prompt without admin access.

Naturally, for devreorder these steps should be taken for DirectInput interfaces, not XAudio/DirectSound interfaces, but the idea is the same.

That sounds like a great idea. Admittedly I am not deeply knowledgable about Windows and how it loads DLLs, so that means that there are surely techniques (such as this one) that I'm unaware of that could be used with devreorder.

Would you like to update the instructions in README and submit a PR?

mirh commented

Just for the records, as I said in VFansss/mgs2-v-s-fix#26.. W7 already had absolute paths (in this case for {25E609E4-B259-11CF-BFC7-444553540000} and {25E609E5-B259-11CF-BFC7-444553540000} I believe).
Something else must have changed.

Also take note that if programs are run as administrator, those user-defined CLSIDs may not be read for whatever unknown reason.

That sounds like a great idea. Admittedly I am not deeply knowledgable about Windows and how it loads DLLs, so that means that there are surely techniques (such as this one) that I'm unaware of that could be used with devreorder.

Would you like to update the instructions in README and submit a PR?

Sounds good! Do you think it should replace a system-wide installation or be added alongside, with system-wide installation marked as "the very last resort, you almost certainly don't want to do it"?

I'd at least say it's the last thing to try if all else fails and maybe mention warnings related to doing it (such as running afoul of anti-cheat systems), but I'd avoid saying "you almost certainly don't want to do it" because I bet there's going to be plenty of situations where it's still necessary for some reason. (In fact there's still been a few cases where, for some reason, a particular game uses DirectInput but never loads devreorder's version of dinput8.dll, even though it was installed to the Windows directory and alongside the game's executable.)

It will be interesting to see how many cases this technique can cover, though. Obviously if this prevents most people from needing to modify the Windows directory, that's great.

Created #49 to resolve this.

Regarding the system-wide installation, I still think it should not be needed, but I can't say much else not knowing what do these offending games do. In cases where games ignore devreorder's dinput8.dll I would be more inclined to believe it's a configuration issue, rather than an odd way of loading the DLL (because there is no way the game/OS has any knowledge of dinput8org.dll).

@CookiePLMonster Thanks! I've merged the PR.

One other possible use case for the system-wide instructions is for when you just want every game on your system to use devreorder's DLL without having to manually copy it into every game folder, which is the case on my own gaming PC. But naturally I wouldn't recommend that for everyone.

mirh commented

What about https://github.com/x360ce/x360ce/blob/master/x360ce/InputHook/HookCOM.cpp?

kcat/dsoal#34 (comment)
Also, you should add the whole explanation (and re-word the wrong bits here).
The system-wide installation may be the last/only hope in certain situations, but that's just because the HKCU key isn't read for applications that run as administrator. But you can still do the same magic with the equivalent HKLM overrides though.

Then AFAICT the "windows 8" detail is a complete red herring, and all of this would also happen on previous OSs too.
CLSID_DirectInput8 and CLSID_DirectInputDevice8 aren't registered any differently.