mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed value bounds for the redefined key code value in HOOK_KEYPRESS
Minor code & document edits.
This commit is contained in:
@@ -54,6 +54,7 @@ static double mousePartX;
|
||||
static double mousePartY;
|
||||
|
||||
#define MAX_KEYS (264)
|
||||
|
||||
static DWORD keysDown[MAX_KEYS] = {0};
|
||||
|
||||
static int mouseX;
|
||||
@@ -62,6 +63,7 @@ static int mouseY;
|
||||
static DWORD forcingGraphicsRefresh = 0;
|
||||
|
||||
void __stdcall ForceGraphicsRefresh(DWORD d) {
|
||||
if (!d3d9Device) return;
|
||||
forcingGraphicsRefresh = (d == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -287,11 +289,14 @@ public:
|
||||
|
||||
for (DWORD i = 0; i < *count; i++) {
|
||||
DWORD dxKey = buf[i].dwOfs;
|
||||
assert(dxKey >= 0 && dxKey < MAX_KEYS);
|
||||
DWORD state = buf[i].dwData & 0x80;
|
||||
DWORD oldState = keysDown[dxKey];
|
||||
keysDown[dxKey] = state;
|
||||
|
||||
KeyPressHook(&dxKey, (state > 0), MapVirtualKeyEx(dxKey, MAPVK_VSC_TO_VK, keyboardLayout));
|
||||
if (dxKey > 0 && dxKey != buf[i].dwOfs) {
|
||||
|
||||
if ((signed)dxKey > 0 && dxKey != buf[i].dwOfs) {
|
||||
keysDown[buf[i].dwOfs] = oldState;
|
||||
buf[i].dwOfs = dxKey; // Override key
|
||||
keysDown[buf[i].dwOfs] = state;
|
||||
@@ -446,7 +451,7 @@ HRESULT __stdcall FakeDirectInputCreate(HINSTANCE a, DWORD b, IDirectInputA** c,
|
||||
mousePartY = 0;
|
||||
} else adjustMouseSpeed = false;
|
||||
|
||||
middleMouseKey = GetConfigInt("Input", "MiddleMouse", 0x30);
|
||||
middleMouseKey = GetConfigInt("Input", "MiddleMouse", DIK_B);
|
||||
middleMouseDown = false;
|
||||
|
||||
backgroundKeyboard = GetConfigInt("Input", "BackgroundKeyboard", 0) != 0;
|
||||
|
||||
Reference in New Issue
Block a user