llde / xOBSE

Oblivion Script extender source
247 stars 35 forks source link

(x)OBSE input functions ignore windows mouse button swap #156

Closed Laulajatar closed 2 years ago

Laulajatar commented 2 years ago

A user of my mod here reported that xOBSE functions (in my case IsKeyPressed3, but it's reasonable to assume that it affects most) ignore the Windows option of switching left/right mouse key - while the game handles it correctly.

This seems to be an older problem predating xOBSE, as they say they've been dealing with it for years.

Any chance of getting a version of this mod that works with mouse buttons reversed (via Windows Control Panel)? I use the physical right button as MB1, and the left button as MB2. (FWIW the game itself handles this configuration.) So the button I use to activate a soulgem for normal use also triggers this mod's action (which is apparently triggered by a click of the physical right button, not the logical secondary button). It appears to be random choice that determines whether I get the game's dialogue of magic items to recharge, or this mod's dialogue. Sometimes I get one, sometimes the other.

Using OBSE 22.6. Yeah, you would think the script engine would handle the mapping between logical and physical buttons, but it doesn't as far as I can tell. (I encounter this problem with a lot of mods.)

I think I can do that without too much trouble. But I doubt it'll change anything. I've been wrestling with this problem for years. (And FWIW you're the only mod developer who's actually tried to help me fix or work around it. I really appreciate that. Although to be fair, I know I'm in the minority with this mouse button config.)

Currently lacking the Windows install to test it myself. Tried it with my install, and it works as expected (XFCE/Manjaro/some older tkg wine).

llde commented 2 years ago

I found that the game has a parameter for detecting if the buttons are swapped. Implementing it's handling. The only place where I see this used in the game is inside the QueryMouseKeyState function. The internal structure (and from what I understood the underlying DInput structures) use the non-inverted buttons ordering (pysical Left button is still 0 or 256)