VFansss / mgs2-v-s-fix

Unofficial fix for PC version of Metal Gear Solid 2
Other
570 stars 23 forks source link

Suggest: Patch exe so DirectInput controls work when game is unfocused #179

Open bmn opened 3 years ago

bmn commented 3 years ago

XInput controllers (via XInputPlus) send input to the game regardless of whether the game is focused or not. If a DirectInput controller is being used directly, unfocusing the game causes input to stop working until it's re-focused.

During launch, mgs2_sse.exe sets the cooperative level for any type x14 (joystick) and x15 (gamepad) DirectInput devices to DISCL_EXCLUSIVE (1) | DISCL_FOREGROUND (4) (=5).

(If it fails, it tries again, replacing DISCL_EXCLUSIVE (1) with DISCL_NONEXCLUSIVE (2), but that's not important)

If the call is changed to DISCL_EXCLUSIVE (1) | DISCL_BACKGROUND (8) (=9), DI controllers will work even when the game is unfocused, which would be a much happier experience for people (like me) playing windowed.

This can be done with a hex edit of mgs2_sse.exe:

VFansss commented 3 years ago

Oh, this is very interesting. Just a question:

which would be a much happier experience for people (like me) playing windowed.

Well, even in that case shoudn't you keep the game focused?

bmn commented 3 years ago

Normally yes, but I'll often be clicking away to use Discord, visit a site, make notes, etc. A lot of the time I'll forget to click back onto the game (or try to, and miss the window entirely without realising it...), and wonder why my guy's not moving.

Plus it'd be really nice to be able to e.g. use Discord and play the game, without having to alt-tab or click between them. Or even have one hand on the controller moving the character and the other typing. I find myself doing that sometimes on my other computer with a 360 controller.