Mercurial > might-and-magic-trilogy
view Keyboard.cpp @ 175:9b5df6cc45a4
Слияние
author | Ritor1 |
---|---|
date | Wed, 12 Dec 2012 20:11:41 +0600 |
parents | 8b0c4d626477 |
children | af624eaf2fc5 |
line wrap: on
line source
#include "OSAPI.h" #include "Keyboard.h" #include "GUIWindow.h" #include "Game.h" #include "OSInfo.h" #include "mm7_data.h" struct KeyboardActionMapping *pKeyActionMap; struct AsyncKeyboard *pAsyncKeyboard; //----- (00459C68) -------------------------------------------------------- void KeyboardActionMapping::SetKeyMapping(int uAction, int vKey, KeyToggleType type) { pVirtualKeyCodesMapping[uAction] = vKey; pToggleTypes[uAction] = type; } //----- (00459C82) -------------------------------------------------------- unsigned int KeyboardActionMapping::GetActionVKey(enum InputAction eAction) { return this->pVirtualKeyCodesMapping[eAction]; } //----- (00459C8D) -------------------------------------------------------- KeyboardActionMapping::KeyboardActionMapping() { uLastKeyPressed = 0; SetDefaultMapping(); ReadMappings(); ResetKeys(); dword_506E68 = -1; } // 506E68: using guessed type int dword_506E68; //----- (00459CC4) -------------------------------------------------------- void KeyboardActionMapping::SetDefaultMapping() { pVirtualKeyCodesMapping[0] = VK_UP; pToggleTypes[0] = TOGGLE_Continuously; pVirtualKeyCodesMapping[1] = VK_DOWN; pToggleTypes[1] = TOGGLE_Continuously; pVirtualKeyCodesMapping[2] = VK_LEFT; pToggleTypes[2] = TOGGLE_Continuously; pVirtualKeyCodesMapping[3] = VK_RIGHT; pToggleTypes[3] = TOGGLE_Continuously; pVirtualKeyCodesMapping[8] = 'A'; pToggleTypes[8] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[7] = 'S'; pToggleTypes[7] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[4] = 'Y'; pToggleTypes[4] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[5] = 'X'; pToggleTypes[5] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[6] = VK_RETURN; pToggleTypes[6] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[9] = VK_SPACE; pToggleTypes[9] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[10] = 'C'; pToggleTypes[10] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[11] = 'B'; pToggleTypes[11] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[12] = VK_TAB; pToggleTypes[12] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[13] = 'Q'; pToggleTypes[13] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[14] = 'Z'; pToggleTypes[14] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[15] = 'R'; pToggleTypes[15] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[16] = 'T'; pToggleTypes[16] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[17] = 'N'; pToggleTypes[17] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[18] = 'M'; pToggleTypes[18] = TOGGLE_OneTimePress; pVirtualKeyCodesMapping[20] = VK_NEXT; pToggleTypes[20] = TOGGLE_Continuously; pVirtualKeyCodesMapping[21] = VK_DELETE; pToggleTypes[21] = TOGGLE_Continuously; SetKeyMapping(INPUT_CenterView, VK_END, TOGGLE_Continuously); SetKeyMapping(INPUT_ZoomIn, VK_ADD, TOGGLE_OneTimePress); SetKeyMapping(INPUT_ZoomOut, VK_SUBTRACT, TOGGLE_OneTimePress); SetKeyMapping(INPUT_FlyUp, VK_PRIOR, TOGGLE_Continuously); SetKeyMapping(INPUT_FlyDown, VK_INSERT, TOGGLE_Continuously); SetKeyMapping(INPUT_Land, VK_HOME, TOGGLE_OneTimePress); SetKeyMapping(INPUT_AlwaysRun, 'U', TOGGLE_OneTimePress); SetKeyMapping(INPUT_StrafeLeft, VK_OEM_4, TOGGLE_Continuously); SetKeyMapping(INPUT_StrafeRight, VK_OEM_6, TOGGLE_Continuously); } //----- (00459E3F) -------------------------------------------------------- void KeyboardActionMapping::ResetKeys() { for (uint i = 0; i < 30; ++i) GetAsyncKeyState(pVirtualKeyCodesMapping[i]); } //----- (00459E5A) -------------------------------------------------------- void KeyboardActionMapping::_459E5A(int a2, int a3, GUIWindow *pWindow) { KeyboardActionMapping *v4; // esi@1 v4 = this; memset(this->pPressedKeysBuffer, 0, 0x101u); v4->uNumKeysPressed = 0; if ( a2 ) v4->field_204 = 2; else v4->field_204 = 1; v4->field_FC = a3; v4->pWindow = pWindow; pWindow->field_40 = 1; if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) ) { if ( pAsyncKeyboard ) pAsyncKeyboard->Suspend(); } } //----- (00459ED1) -------------------------------------------------------- void KeyboardActionMapping::_459ED1(int a2) { KeyboardActionMapping *v2; // esi@1 GUIWindow *v3; // esi@4 v2 = this; if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard) pAsyncKeyboard->Resume(); v2->field_204 = 0; v3 = v2->pWindow; if ( v3 ) v3->field_40 = a2; } //----- (00459F10) -------------------------------------------------------- bool KeyboardActionMapping::_459F10(unsigned int a2) { int v3; // [sp-4h] [bp-4h]@3 pKeyActionMap->uLastKeyPressed = a2; if ( dword_506E68 == -1 ) { if ( pKeyActionMap->field_204 == 1 ) { if ( a2 != 8 ) { if ( a2 == 9 ) return 1; if ( a2 == 13 ) goto LABEL_3; if ( a2 == 27 ) goto LABEL_15; if ( this->uNumKeysPressed >= this->field_FC ) return 1; pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; LABEL_24: pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0; return 1; } } else { if ( pKeyActionMap->field_204 != 2 ) return 0; if ( a2 != 8 ) { if ( a2 == 13 ) goto LABEL_3; if ( a2 != 27 ) { if ( (signed int)a2 >= 48 && (signed int)a2 <= 57 ) { if ( pKeyActionMap->uNumKeysPressed < this->field_FC ) { pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; } } return 1; } LABEL_15: v3 = 3; goto LABEL_4; } } if ( !pKeyActionMap->uNumKeysPressed ) return 1; --pKeyActionMap->uNumKeysPressed; goto LABEL_24; } pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0; LABEL_3: v3 = 2; LABEL_4: pKeyActionMap->_459ED1(v3); return 1; } // 506E68: using guessed type int dword_506E68; //----- (00459FFC) -------------------------------------------------------- void KeyboardActionMapping::ReadMappings() { //KeyboardActionMapping *v1; // esi@1 int v2; // eax@2 unsigned int v3; // eax@3 int v4; // eax@6 unsigned int v5; // eax@7 int v6; // eax@10 unsigned int v7; // eax@11 int v8; // eax@14 unsigned int v9; // eax@15 int v10; // eax@18 unsigned int v11; // eax@19 int v12; // eax@22 //unsigned int v13; // eax@23 int v14; // eax@26 //unsigned int v15; // eax@27 int v16; // eax@30 //unsigned int v17; // eax@31 int v18; // eax@34 //unsigned int v19; // eax@35 int v20; // eax@38 //unsigned int v21; // eax@39 int v22; // eax@42 //unsigned int v23; // eax@43 int v24; // eax@46 //unsigned int v25; // eax@47 int v26; // eax@50 //unsigned int v27; // eax@51 int v28; // eax@54 //unsigned int v29; // eax@55 int v30; // eax@58 //unsigned int v31; // eax@59 int v32; // eax@62 //unsigned int v33; // eax@63 int v34; // eax@66 //unsigned int v35; // eax@67 int v36; // eax@70 //unsigned int v37; // eax@71 int v38; // eax@74 //unsigned int v39; // eax@75 int v40; // eax@78 //unsigned int v41; // eax@79 int v42; // eax@82 //unsigned int v43; // eax@83 int v44; // eax@86 //unsigned int v45; // eax@87 int v46; // eax@90 //unsigned int v47; // eax@91 int v48; // eax@94 //unsigned int v49; // eax@95 int v50; // eax@98 //unsigned int v51; // eax@99 int v52; // eax@102 //unsigned int v53; // eax@103 int v54; // eax@106 //unsigned int v55; // eax@107 int v56; // eax@110 unsigned int v57; // eax@111 int v58; // eax@114 unsigned int v59; // eax@115 int v60; // eax@118 unsigned int v61; // eax@119 //char str[32]; // [sp+Ch] [bp-20h]@1 char str[32]; ReadWindowsRegistryString("KEY_FORWARD", str, 32, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v2) = GetActionDefaultVKey(str), v2 != -1) ) { pVirtualKeyCodesMapping[0] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[0] = VK_UP; } pToggleTypes[0] = TOGGLE_Continuously; ReadWindowsRegistryString("KEY_BACKWARD", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v4) = GetActionDefaultVKey(str), v4 != -1) ) { pVirtualKeyCodesMapping[1] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[1] = VK_DOWN; } pToggleTypes[1] = TOGGLE_Continuously; ReadWindowsRegistryString("KEY_LEFT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v6) = GetActionDefaultVKey(str), v6 != -1) ) { pVirtualKeyCodesMapping[2] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[2] = VK_LEFT; } pToggleTypes[2] = TOGGLE_Continuously; ReadWindowsRegistryString("KEY_RIGHT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v8) = GetActionDefaultVKey(str), v8 != -1) ) { pVirtualKeyCodesMapping[3] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[3] = VK_RIGHT; } pToggleTypes[3] = TOGGLE_Continuously; ReadWindowsRegistryString("KEY_ATTACK", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v10) = GetActionDefaultVKey(str), v10 != -1) ) { pVirtualKeyCodesMapping[8] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[8] = 'A'; } pToggleTypes[8] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_CASTREADY", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v12) = GetActionDefaultVKey(str), v12 != -1) ) { pVirtualKeyCodesMapping[7] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[7] = 'S'; } pToggleTypes[7] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_YELL", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v14) = GetActionDefaultVKey(str), v14 != -1) ) { pVirtualKeyCodesMapping[4] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[4] = 'Y'; } pToggleTypes[4] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_JUMP", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v16) = GetActionDefaultVKey(str), v16 != -1) ) { pVirtualKeyCodesMapping[5] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[5] = 'X'; } pToggleTypes[5] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_COMBAT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v18) = GetActionDefaultVKey(str), v18 != -1) ) { pVirtualKeyCodesMapping[6] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[6] = VK_RETURN; } pToggleTypes[6] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_EVENTTRIGGER", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v20) = GetActionDefaultVKey(str), v20 != -1) ) { pVirtualKeyCodesMapping[9] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[9] = VK_SPACE; } pToggleTypes[9] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_CAST", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v22) = GetActionDefaultVKey(str), v22 != -1) ) { pVirtualKeyCodesMapping[10] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[10] = 'C'; } pToggleTypes[10] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_PASS", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v24) = GetActionDefaultVKey(str), v24 != -1) ) { pVirtualKeyCodesMapping[11] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[11] = 'B'; } pToggleTypes[11] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_CHARCYCLE", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v26) = GetActionDefaultVKey(str), v26 != -1) ) { pVirtualKeyCodesMapping[12] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[12] = VK_TAB; } pToggleTypes[12] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_QUEST", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v28) = GetActionDefaultVKey(str), v28 != -1) ) { pVirtualKeyCodesMapping[13] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[13] = 'Q'; } pToggleTypes[13] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_QUICKREF", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v30) = GetActionDefaultVKey(str), v30 != -1) ) { pVirtualKeyCodesMapping[14] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[14] = 'Z'; } pToggleTypes[14] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_REST", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v32) = GetActionDefaultVKey(str), v32 != -1) ) { pVirtualKeyCodesMapping[15] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[15] = 'R'; } pToggleTypes[15] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_TIMECAL", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v34) = GetActionDefaultVKey(str), v34 != -1) ) { pVirtualKeyCodesMapping[16] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[16] = 'T'; } pToggleTypes[16] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_AUTONOTES", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v36) = GetActionDefaultVKey(str), v36 != -1) ) { pVirtualKeyCodesMapping[17] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[17] = 'N'; } pToggleTypes[17] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_MAPBOOK", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v38) = GetActionDefaultVKey(str), v38 != -1) ) { pVirtualKeyCodesMapping[18] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[18] = 'M'; } pToggleTypes[18] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_LOOKUP", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v40) = GetActionDefaultVKey(str), v40 != -1) ) { pVirtualKeyCodesMapping[20] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[20] = VK_NEXT; } pToggleTypes[20] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_LOOKDOWN", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v42) = GetActionDefaultVKey(str), v42 != -1) ) { pVirtualKeyCodesMapping[21] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[21] = VK_DELETE; } pToggleTypes[21] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_CENTERVIEWPT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v44) = GetActionDefaultVKey(str), v44 != -1) ) { pVirtualKeyCodesMapping[22] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[22] = VK_END; } pToggleTypes[22] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_ZOOMIN", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v46) = GetActionDefaultVKey(str), v46 != -1) ) { pVirtualKeyCodesMapping[23] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[23] = VK_ADD; } pToggleTypes[23] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_ZOOMOUT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v48) = GetActionDefaultVKey(str), v48 != -1) ) { pVirtualKeyCodesMapping[24] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[24] = VK_SUBTRACT; } pToggleTypes[24] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_FLYUP", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v50) = GetActionDefaultVKey(str), v50 != -1) ) { pVirtualKeyCodesMapping[25] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[25] = VK_PRIOR; } pToggleTypes[25] = TOGGLE_Continuously; ReadWindowsRegistryString("KEY_FLYDOWN", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v52) = GetActionDefaultVKey(str), v52 != -1) ) { pVirtualKeyCodesMapping[26] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[26] = VK_INSERT; } pToggleTypes[26] = TOGGLE_Continuously; ReadWindowsRegistryString("KEY_LAND", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v54) = GetActionDefaultVKey(str), v54 != -1) ) { pVirtualKeyCodesMapping[27] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[27] = VK_HOME; } pToggleTypes[27] = TOGGLE_OneTimePress; ReadWindowsRegistryString("KEY_ALWAYSRUN", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v56) = GetActionDefaultVKey(str), v56 != -1) ) { pVirtualKeyCodesMapping[19] = GetActionDefaultVKey(str); } else { pVirtualKeyCodesMapping[19] = 'U'; } pToggleTypes[19] = TOGGLE_OneTimePress; bAlwaysRun = ReadWindowsRegistryInt("valAlwaysRun", 0) != 0; bFlipOnExit = ReadWindowsRegistryInt("FlipOnExit", 0) != 0; ReadWindowsRegistryString("KEY_STEPLEFT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v58) = GetActionDefaultVKey(str), v58 != -1) ) { pVirtualKeyCodesMapping[28] = GetActionDefaultVKey(str); pToggleTypes[28] = TOGGLE_OneTimePress; } else { pToggleTypes[28] = TOGGLE_Continuously; pVirtualKeyCodesMapping[28] = VK_OEM_4; } ReadWindowsRegistryString("KEY_STEPRIGHT", str, 0x20u, "DEFAULT"); if ( strcmp(str, "DEFAULT") && (LOBYTE(v60) = GetActionDefaultVKey(str), v60 != -1) ) { pVirtualKeyCodesMapping[29] = GetActionDefaultVKey(str); pToggleTypes[29] = TOGGLE_OneTimePress; } else { pToggleTypes[29] = TOGGLE_Continuously; pVirtualKeyCodesMapping[29] = VK_OEM_6; } } //----- (0045A960) -------------------------------------------------------- void KeyboardActionMapping::StoreMappings() { const char *v2; // eax@1 const char *v3; // eax@1 const char *v4; // eax@1 const char *v5; // eax@1 const char *v6; // eax@1 const char *v7; // eax@1 const char *v8; // eax@1 const char *v9; // eax@1 const char *v10; // eax@1 const char *v11; // eax@1 const char *v12; // eax@1 const char *v13; // eax@1 const char *v14; // eax@1 const char *v15; // eax@1 const char *v16; // eax@1 const char *v17; // eax@1 const char *v18; // eax@1 const char *v19; // eax@1 const char *v20; // eax@1 const char *v21; // eax@1 const char *v22; // eax@1 const char *v23; // eax@1 const char *v24; // eax@1 const char *v25; // eax@1 const char *v26; // eax@1 const char *v27; // eax@1 const char *v28; // eax@1 const char *v29; // eax@1 v2 = GetVKeyDisplayName(this->pVirtualKeyCodesMapping[0]); WriteWindowsRegistryString("KEY_FORWARD", v2); v3 = GetVKeyDisplayName(pVirtualKeyCodesMapping[1]); WriteWindowsRegistryString("KEY_BACKWARD", v3); v4 = GetVKeyDisplayName(pVirtualKeyCodesMapping[2]); WriteWindowsRegistryString("KEY_LEFT", v4); v5 = GetVKeyDisplayName(pVirtualKeyCodesMapping[3]); WriteWindowsRegistryString("KEY_RIGHT", v5); v6 = GetVKeyDisplayName(pVirtualKeyCodesMapping[8]); WriteWindowsRegistryString("KEY_ATTACK", v6); v7 = GetVKeyDisplayName(pVirtualKeyCodesMapping[7]); WriteWindowsRegistryString("KEY_CASTREADY", v7); v8 = GetVKeyDisplayName(pVirtualKeyCodesMapping[4]); WriteWindowsRegistryString("KEY_YELL", v8); v9 = GetVKeyDisplayName(pVirtualKeyCodesMapping[5]); WriteWindowsRegistryString("KEY_JUMP", v9); v10 = GetVKeyDisplayName(pVirtualKeyCodesMapping[6]); WriteWindowsRegistryString("KEY_COMBAT", v10); v11 = GetVKeyDisplayName(pVirtualKeyCodesMapping[9]); WriteWindowsRegistryString("KEY_EVENTTRIGGER", v11); v12 = GetVKeyDisplayName(pVirtualKeyCodesMapping[10]); WriteWindowsRegistryString("KEY_CAST", v12); v13 = GetVKeyDisplayName(pVirtualKeyCodesMapping[11]); WriteWindowsRegistryString("KEY_PASS", v13); v14 = GetVKeyDisplayName(pVirtualKeyCodesMapping[12]); WriteWindowsRegistryString("KEY_CHARCYCLE", v14); v15 = GetVKeyDisplayName(pVirtualKeyCodesMapping[13]); WriteWindowsRegistryString("KEY_QUEST", v15); v16 = GetVKeyDisplayName(pVirtualKeyCodesMapping[14]); WriteWindowsRegistryString("KEY_QUICKREF", v16); v17 = GetVKeyDisplayName(pVirtualKeyCodesMapping[15]); WriteWindowsRegistryString("KEY_REST", v17); v18 = GetVKeyDisplayName(pVirtualKeyCodesMapping[16]); WriteWindowsRegistryString("KEY_TIMECAL", v18); v19 = GetVKeyDisplayName(pVirtualKeyCodesMapping[17]); WriteWindowsRegistryString("KEY_AUTONOTES", v19); v20 = GetVKeyDisplayName(pVirtualKeyCodesMapping[18]); WriteWindowsRegistryString("KEY_MAPBOOK", v20); v21 = GetVKeyDisplayName(pVirtualKeyCodesMapping[20]); WriteWindowsRegistryString("KEY_LOOKUP", v21); v22 = GetVKeyDisplayName(pVirtualKeyCodesMapping[21]); WriteWindowsRegistryString("KEY_LOOKDOWN", v22); v23 = GetVKeyDisplayName(pVirtualKeyCodesMapping[22]); WriteWindowsRegistryString("KEY_CENTERVIEWPT", v23); v24 = GetVKeyDisplayName(pVirtualKeyCodesMapping[23]); WriteWindowsRegistryString("KEY_ZOOMIN", v24); v25 = GetVKeyDisplayName(pVirtualKeyCodesMapping[24]); WriteWindowsRegistryString("KEY_ZOOMOUT", v25); v26 = GetVKeyDisplayName(pVirtualKeyCodesMapping[25]); WriteWindowsRegistryString("KEY_FLYUP", v26); v27 = GetVKeyDisplayName(pVirtualKeyCodesMapping[26]); WriteWindowsRegistryString("KEY_FLYDOWN", v27); v28 = GetVKeyDisplayName(pVirtualKeyCodesMapping[27]); WriteWindowsRegistryString("KEY_LAND", v28); v29 = GetVKeyDisplayName(pVirtualKeyCodesMapping[19]); WriteWindowsRegistryString("KEY_ALWAYSRUN", v29); } //----- (0045ABCA) -------------------------------------------------------- const unsigned __int8 KeyboardActionMapping::GetActionDefaultVKey(const char *Str) { unsigned __int8 result; // al@3 if ( !strcmp(Str, "UP") ) return VK_UP; if ( !strcmp(Str, "DOWN") ) return VK_DOWN; if (!strcmp(Str, "") || !strcmp(Str, "LEFT")) return VK_LEFT; if (!strcmp(Str, "") || !strcmp(Str, "RIGHT")) return VK_RIGHT; if ( !strcmp(Str, "RETURN") ) return VK_RETURN; if ( !strcmp(Str, "SPACE") ) return VK_SPACE; if ( !strcmp(Str, "PAGE_DOWN") ) return VK_NEXT; if ( !strcmp(Str, "PAGE_UP") ) return VK_PRIOR; if ( !strcmp(Str, "TAB") ) return VK_TAB; if ( !strcmp(Str, "SUBTRACT") ) return VK_SUBTRACT; if ( !strcmp(Str, "ADD") ) return VK_ADD; if ( !strcmp(Str, "END") ) return VK_END; if ( !strcmp(Str, "DELETE") ) return VK_DELETE; if ( !strcmp(Str, "HOME") ) return VK_HOME; if ( !strcmp(Str, "INSERT") ) return VK_INSERT; if ( strcmp(Str, "COMMA") ) { if ( !strcmp(Str, "DECIMAL") ) return VK_DECIMAL; if ( strcmp(Str, "SEMICOLON") ) { if ( strcmp(Str, "PERIOD") ) { if ( strcmp(Str, "SLASH") ) { if ( strcmp(Str, "SQUOTE") ) { if ( strcmp(Str, "BACKSLASH") ) { if ( !strcmp(Str, "BACKSPACE") ) return VK_BACK; if ( !strcmp(Str, "CONTROL") ) return VK_CONTROL; if ( strlen(Str) != 1 || (result = *Str, (unsigned __int8)*Str < 0x41u) || result > 0x5Au ) result = -1; } else { result = -36; } } else { result = -34; } } else { result = -65; } } else { result = -66; } } else { result = -70; } } else { result = -68; } return result; } //----- (0045AE2C) -------------------------------------------------------- const char *KeyboardActionMapping::GetVKeyDisplayName(signed int a1) { char *v3; // [sp-4h] [bp-8h]@2 static char static_sub_45AE2C_string_69ADE0[32]; if ( a1 == VK_UP ) { v3 = "UP"; LABEL_53: strcpy(static_sub_45AE2C_string_69ADE0, v3); return static_sub_45AE2C_string_69ADE0; } if ( a1 == VK_DOWN ) { v3 = "DOWN"; goto LABEL_53; } if ( a1 == VK_LEFT ) { v3 = ascii_4E2D48; goto LABEL_53; } if ( a1 == VK_RIGHT ) { v3 = ascii_4E2D40; goto LABEL_53; } if ( a1 == VK_RETURN ) { v3 = "RETURN"; goto LABEL_53; } if ( a1 == VK_SPACE ) { v3 = "SPACE"; goto LABEL_53; } if ( a1 == VK_NEXT ) { v3 = "PAGE_DOWN"; goto LABEL_53; } if ( a1 == VK_PRIOR ) { v3 = "PAGE_UP"; goto LABEL_53; } if ( a1 == VK_TAB ) { v3 = "TAB"; goto LABEL_53; } if ( a1 == 'm' ) { v3 = "SUBTRACT"; goto LABEL_53; } if ( a1 == 'k' ) { v3 = "ADD"; goto LABEL_53; } if ( a1 == VK_END ) { v3 = "END"; goto LABEL_53; } if ( a1 == VK_DELETE ) { v3 = "DELETE"; goto LABEL_53; } if ( a1 == VK_HOME ) { v3 = "HOME"; goto LABEL_53; } if ( a1 == VK_INSERT ) { v3 = "INSERT"; goto LABEL_53; } if ( a1 == VK_DECIMAL ) { v3 = "DECIMAL"; goto LABEL_53; } if ( a1 == VK_OEM_COMMA ) { v3 = "COMMA"; goto LABEL_53; } if ( a1 == VK_OEM_1 ) { v3 = "SEMICOLON"; goto LABEL_53; } if ( a1 == VK_OEM_PERIOD ) { v3 = "PERIOD"; goto LABEL_53; } if ( a1 == VK_OEM_2 ) { v3 = "SLASH"; goto LABEL_53; } if ( a1 == VK_OEM_7 ) { v3 = "SQUOTE"; goto LABEL_53; } if ( a1 == VK_OEM_5 ) { v3 = "BACKSLASH"; goto LABEL_53; } if ( a1 == VK_CONTROL ) { v3 = "CONTROL"; goto LABEL_53; } if ( a1 == VK_BACK ) { v3 = "BACKSPACE"; goto LABEL_53; } if ( a1 < 65 || a1 > 90 ) { v3 = "- -"; goto LABEL_53; } *(unsigned short *)static_sub_45AE2C_string_69ADE0 = (unsigned __int8)a1; return static_sub_45AE2C_string_69ADE0; } //----- (0045AFD9) -------------------------------------------------------- Keyboard::Keyboard() { bUsingAsynKeyboard = false; if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && pVersion->pVersionInfo.dwMajorVersion == 4) bUsingAsynKeyboard = false; } //----- (0045B019) -------------------------------------------------------- void Keyboard::EnterCriticalSection() { if (bUsingAsynKeyboard) AsyncKeyboard::EnterCriticalSection(); } //----- (0045B06E) -------------------------------------------------------- bool Keyboard::IsShiftHeld() { bool result; // eax@2 char v2; // zf@3 if (bUsingAsynKeyboard) { if ( pAsyncKeyboard->_45B4EC(0x2Au) ) { LABEL_6: LOBYTE(result) = 1; return result; } v2 = pAsyncKeyboard->_45B4EC(0x36u) == 0; } else { LOWORD(result) = GetAsyncKeyState(VK_SHIFT); v2 = result == 0; } if ( !v2 ) goto LABEL_6; LOBYTE(result) = 0; return result; } //----- (0045B0A9) -------------------------------------------------------- bool Keyboard::IsKeyBeingHeld(int vKey) { void *v2; // esi@2 char v3; // bl@2 if (bUsingAsynKeyboard) { __debugbreak(); /* v2 = pAsyncKeyboard; EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); v3 = *((unsigned char *)v2 + (unsigned __int8)AsyncKeyboard::map_key(v2, vKey) + 265) >> 7; LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); return v3;*/ } else return (GetAsyncKeyState(vKey) & 0x8001) != 0; } //----- (0045B0CE) -------------------------------------------------------- bool Keyboard::WasKeyPressed(int vKey) { void *v2; // esi@2 char v3; // bl@2 bool result; // eax@2 if ( LOBYTE(this->bUsingAsynKeyboard) ) { __debugbreak(); /*v2 = pAsyncKeyboard; EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); v3 = *((unsigned char *)v2 + (unsigned __int8)AsyncKeyboard::map_key(v2, vKey) + 521) >> 7; LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); LOBYTE(result) = v3;*/ } else { LOWORD(result) = GetAsyncKeyState(vKey); LOBYTE(result) = result & 1; } return result; } //----- (0045B10A) -------------------------------------------------------- AsyncKeyboard::AsyncKeyboard() { *(unsigned int *)(this + 4) = 0; *(unsigned char *)(this + 8) = 0; if (!Initialize()) MessageBoxW(nullptr, L"Could not initialize asynchronos keyboard object", nullptr, 0); } // 4D86B8: using guessed type int (__stdcall *AsyncKeyboard_pvdtor)(char); // 4DBD94: using guessed type int dword_4DBD94; //----- (0045B15E) -------------------------------------------------------- AsyncKeyboard::~AsyncKeyboard() { __debugbreak(); /* void *v1; // esi@1 char *v2; // edi@1 int v3; // ecx@1 v1 = this; v2 = (char *)this + 1804; v3 = *((unsigned int *)this + 451); if ( v3 ) (**(void (__stdcall ***)(unsigned int))v3)(1); *(unsigned int *)v2 = 0; return TerminateThread(*((HANDLE *)v1 + 1), 0x1F4u);*/ } // 4D86B8: using guessed type int (__stdcall *AsyncKeyboard_pvdtor)(char); //----- (0045B18E) -------------------------------------------------------- bool AsyncKeyboard::Initialize() { _45B1B1(); if (_45B229()) return CreateDirectInputKeyboard() != 0; return false; } //----- (0045B1B1) -------------------------------------------------------- void AsyncKeyboard::_45B1B1() { void *v1; // esi@1 v1 = this; memset((char *)this + 9, 0, 0x100u); memset((char *)v1 + 265, 0, 0x100u); memset((char *)v1 + 521, 0, 0x100u); memset((char *)v1 + 780, 0, 0x400u); } //----- (0045B1FD) -------------------------------------------------------- void AsyncKeyboard::EnterCriticalSection() { __debugbreak(); //EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); } //----- (0045B213) -------------------------------------------------------- void AsyncKeyboard::LeaveCriticalSection() { __debugbreak(); //LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); } //----- (0045B229) -------------------------------------------------------- char AsyncKeyboard::_45B229() { __debugbreak(); return 0; /*void *v1; // esi@1 HANDLE v2; // eax@1 char result; // al@2 DWORD ThreadId; // [sp+0h] [bp-4h]@1 ThreadId = (DWORD)this; v1 = this; v2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AsyncKeyboardThread, this, 4u, &ThreadId); *((unsigned int *)v1 + 1) = v2; if ( v2 ) result = SetThreadPriority(v2, 15) != 0; else result = 0; return result;*/ } //----- (0045B260) -------------------------------------------------------- char AsyncKeyboard::CreateDirectInputKeyboard() { __debugbreak(); return 0; /*v1 = this; v2 = new DirectInputKeyboard; *((void **)v1 + 451) = v2; return v2 != 0;*/ } //----- (0045B2A7) -------------------------------------------------------- void AsyncKeyboard::Resume() { __debugbreak(); /*void *v1; // esi@1 std::string v2; // [sp-18h] [bp-24h]@2 const char *v3; // [sp-8h] [bp-14h]@2 int v4; // [sp-4h] [bp-10h]@2 std::string *v5; // [sp+4h] [bp-8h]@2 int a3; // [sp+Bh] [bp-1h]@2 v1 = this; if ( *((unsigned int *)this + 451) ) { EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); _45B1B1(); DirectInputKeyboard::set_acquire(*((DirectInputKeyboard **)v1 + 451), (int *)1); ResumeThread(*((HANDLE *)v1 + 1)); LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); } else { MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of resume()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:97", 0); }*/ } //----- (0045B329) -------------------------------------------------------- void AsyncKeyboard::Suspend() { __debugbreak(); /*void *v1; // esi@1 std::string v2; // [sp-18h] [bp-24h]@2 const char *v3; // [sp-8h] [bp-14h]@2 int v4; // [sp-4h] [bp-10h]@2 std::string *v5; // [sp+4h] [bp-8h]@2 int a3; // [sp+Bh] [bp-1h]@2 v1 = this; if ( *((unsigned int *)this + 451) ) { EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); SuspendThread(*((HANDLE *)v1 + 1)); DirectInputKeyboard::set_acquire(*((DirectInputKeyboard **)v1 + 451), 0); LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); } else { MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of suspend()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:115", 0); }*/ } //----- (0045B3A4) -------------------------------------------------------- char AsyncKeyboard::_45B3A4() { __debugbreak(); return 0; /**((unsigned char *)this + 8) = 1; Sleep(0x85u); return 1;*/ } //----- (00465C53) -------------------------------------------------------- void AsyncKeyboard::Release() { __debugbreak(); /*if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) ) { if ( pAsyncKeyboard ) { pAsyncKeyboard->Suspend(); if ( pAsyncKeyboard ) (**(void (__stdcall ***)(int))pAsyncKeyboard)(1); } pAsyncKeyboard = 0; }*/ } //----- (0045B3B6) -------------------------------------------------------- void AsyncKeyboard::Thread() { __debugbreak(); /*void *v1; // esi@1 signed int v2; // ecx@3 int v3; // eax@3 DWORD v4; // edx@6 std::string v5; // [sp-18h] [bp-2Ch]@2 const char *v6; // [sp-8h] [bp-1Ch]@2 int v7; // [sp-4h] [bp-18h]@2 DWORD v8; // [sp+Ch] [bp-8h]@2 int a3; // [sp+13h] [bp-1h]@2 v1 = this; if ( *((unsigned int *)this + 451) ) { ::EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); v8 = timeGetTime(); memcpy((char *)v1 + 9, (const void *)(*((unsigned int *)v1 + 451) + 29), 0x100u); (*((DirectInputKeyboard **)v1 + 451)->_43B8EC(); memcpy((char *)v1 + 265, (const void *)(*((unsigned int *)v1 + 451) + 29), 0x100u); v2 = 0; v3 = (int)((char *)v1 + 780); do { if ( *((unsigned char *)v1 + v2 + 265) & 0x80 ) { if ( v8 - *(unsigned int *)v3 > 0xC8 ) { v4 = v8; *((unsigned char *)v1 + v2 + 521) |= 0x80u; *(unsigned int *)v3 = v4; } } ++v2; v3 += 4; } while ( v2 < 256 ); ::LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); } else { MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of update_keyboard_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:169", 0); }*/ } //----- (0045B4EC) -------------------------------------------------------- char AsyncKeyboard::_45B4EC(unsigned __int8 a2) { __debugbreak(); return 0; /*void *v2; // esi@1 char v3; // bl@1 v2 = this; EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); v3 = *((unsigned char *)v2 + a2 + 265) >> 7; LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard); return v3;*/ } //----- (0045B57D) -------------------------------------------------------- char AsyncKeyboard::map_key(int key) { __debugbreak(); return 0; /*char result; // al@2 std::string v3; // [sp-18h] [bp-1Ch]@99 const char *v4; // [sp-8h] [bp-Ch]@99 int v5; // [sp-4h] [bp-8h]@99 void *v6; // [sp+0h] [bp-4h]@1 v6 = this; switch ( key ) { case 8: result = 14; break; case 9: result = 15; break; case 13: result = 28; break; case 16: case 161: result = 54; break; case 160: result = 42; break; case 17: case 163: result = -99; break; case 162: result = 29; break; case 18: result = -72; break; case 20: result = 58; break; case 21: result = 112; break; case 25: result = -108; break; case 27: result = 1; break; case 28: result = 121; break; case 29: result = 123; break; case 32: result = 57; break; case 33: result = -55; break; case 34: result = -47; break; case 35: result = -49; break; case 36: result = -57; break; case 37: result = -53; break; case 38: result = -56; break; case 39: result = -51; break; case 40: result = -48; break; case 42: result = -73; break; case 45: result = -46; break; case 46: result = -45; break; case 48: result = 11; break; case 49: result = 2; break; case 50: result = 3; break; case 51: result = 4; break; case 52: result = 5; break; case 53: result = 6; break; case 54: result = 7; break; case 55: result = 8; break; case 56: result = 9; break; case 57: result = 10; break; case 65: result = 30; break; case 66: result = 48; break; case 67: result = 46; break; case 68: result = 32; break; case 69: result = 18; break; case 70: result = 33; break; case 71: result = 34; break; case 72: result = 35; break; case 73: result = 23; break; case 74: result = 36; break; case 75: result = 37; break; case 76: result = 38; break; case 77: result = 50; break; case 78: result = 49; break; case 79: result = 24; break; case 80: result = 25; break; case 81: result = 16; break; case 82: result = 19; break; case 83: result = 31; break; case 84: result = 20; break; case 85: result = 22; break; case 86: result = 47; break; case 87: result = 17; break; case 88: result = 45; break; case 89: result = 21; break; case 90: result = 44; break; case 91: result = -37; break; case 92: result = -36; break; case 93: result = -35; break; case 96: result = 82; break; case 97: result = 79; break; case 98: result = 80; break; case 99: result = 81; break; case 100: result = 75; break; case 101: result = 76; break; case 102: result = 77; break; case 103: result = 71; break; case 104: result = 72; break; case 105: result = 73; break; case 106: result = 55; break; case 107: result = 78; break; case 109: result = 74; break; case 110: result = 83; break; case 111: result = -75; break; case 112: result = 59; break; case 113: result = 60; break; case 114: result = 61; break; case 115: result = 62; break; case 116: result = 63; break; case 117: result = 64; break; case 118: result = 65; break; case 119: result = 66; break; case 120: result = 67; break; case 121: result = 68; break; case 122: result = 87; break; case 123: result = 88; break; case 124: result = 100; break; case 125: result = 101; break; case 126: result = 102; break; case 144: result = 69; break; case 145: result = 70; break; default: MessageBoxW(nullptr, L"Uknown key detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:999", 0); goto LABEL_100; case 1: case 2: case 3: case 4: case 12: case 19: case 23: case 24: case 30: case 31: case 41: case 43: case 44: case 47: case 108: case 127: case 128: case 129: case 130: case 131: case 132: case 133: case 134: case 135: LABEL_100: result = -1; break; } return result;*/ } //----- (0045BA60) -------------------------------------------------------- int __stdcall AsyncKeyboard::ThreadStarter(AsyncKeyboard *pInstance) { __debugbreak(); return 0; /*while ( 1 ) { while ( !pAsyncKeyboard ) ; if ( *((unsigned char *)pAsyncKeyboard + 8) ) ExitThread(0); pAsyncKeyboard->Thread(); Sleep(0x21u); }*/ } /* //----- (0043B76D) -------------------------------------------------------- DirectInputKeyboard *__thiscall DirectInputKeyboard::DirectInputKeyboard(DirectInputKeyboard *this) { DirectInputKeyboard *v1; // esi@1 HRESULT v2; // eax@5 unsigned int uVersion; // [sp-18h] [bp-20h]@3 IDirectInput **ppDirectInput; // [sp-14h] [bp-1Ch]@3 int v6; // [sp-10h] [bp-18h]@3 const char *v7; // [sp-Ch] [bp-14h]@3 int v8; // [sp-8h] [bp-10h]@3 unsigned int v9; // [sp-4h] [bp-Ch]@3 CheckHRESULT_stru0 v10; // [sp+4h] [bp-4h]@5 v1 = this; this->field_8 = 0; LOBYTE(this->field_1C) = 0; this->vdestructor_ptr = &pDirectInputKeyboard_pvdtor; if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) { v9 = 1; v8 = 28; v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"; v6 = 0; ppDirectInput = &this->pDirectInput; uVersion = 0x500u; } else { v9 = 1; v8 = 26; v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"; v6 = 0; ppDirectInput = &this->pDirectInput; uVersion = 0x300u; } v2 = DirectInputCreateA(hInstance, uVersion, ppDirectInput, v6); CheckHRESULT(&v10, v2, v7, v8, v9); DirectInputKeyboard::CreateDevice(v1); DirectInputKeyboard::43B87B(v1); return v1; } // 4C8880: using guessed type int __stdcall DirectInputCreateA(int, int, int, int); //----- (0043B7E3) -------------------------------------------------------- void __thiscall DirectInputKeyboard::vdtor(DirectInputKeyboard *this, bool a2) { void *v2; // esi@1 v2 = this; DirectInputKeyboard::dtor(this); if ( a2 & 1 ) free(v2); } //----- (0043B7FF) -------------------------------------------------------- void __thiscall DirectInputKeyboard::dtor(DirectInputKeyboard *this) { DirectInputKeyboard *v1; // esi@1 int v2; // eax@1 v1 = this; v2 = this->field_8; this->vdestructor_ptr = &pDirectInputKeyboard_pvdtor; if ( v2 ) { (*(void (__stdcall **)(int))(*(int *)v2 + 32))(v2); (*(void (__stdcall **)(int))(*(int *)v1->field_8 + 8))(v1->field_8); v1->field_8 = 0; } v1->pDirectInput->lpVtbl->Release(v1->pDirectInput); v1->pDirectInput = 0; } //----- (0043B831) -------------------------------------------------------- void __thiscall DirectInputKeyboard::CreateDevice(DirectInputKeyboard *this) { DirectInputKeyboard *v1; // esi@1 HRESULT v2; // eax@1 int v3; // [sp+4h] [bp-4h]@1 v1 = this; v2 = ((int (__stdcall *)(IDirectInput *, signed int, int (__stdcall *)(int, int), DirectInputKeyboard *, signed int))this->pDirectInput->lpVtbl->field_10)( this->pDirectInput, 3, DirectInputKeyboard_enumerator_43B9B9, this, 1); CheckHRESULT((CheckHRESULT_stru0 *)&v3, v2, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 52, 1u); if ( !LOBYTE(v1->field_1C) ) { v3 = (int)"Error: No keyboard found"; _CxxThrowException((int)&v3, (int)&dword_4DBD94); } } // 43B9B9: using guessed type int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int); // 4DBD94: using guessed type int dword_4DBD94; //----- (0043B87B) -------------------------------------------------------- void __thiscall DirectInputKeyboard::43B87B(DirectInputKeyboard *ecx0) { char *v1; // esi@1 HRESULT v2; // eax@1 HRESULT v3; // eax@1 HRESULT v4; // eax@1 unsigned int v5; // [sp+0h] [bp-Ch]@0 char this; // [sp+8h] [bp-4h]@1 v1 = (char *)&ecx0->field_8; v2 = ((int (__stdcall *)(IDirectInput *, int *, int *, int, int))ecx0->pDirectInput->lpVtbl->field_C)( ecx0->pDirectInput, &ecx0->field_C, &ecx0->field_8, 0, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"); CheckHRESULT((CheckHRESULT_stru0 *)&this, v2, (const char *)0x3C, 1, v5); v3 = (*(int (__stdcall **)(int, int))(**(int **)v1 + 44))(*(int *)v1, dword_4C9890); CheckHRESULT((CheckHRESULT_stru0 *)&this, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 63, 1u); v4 = (*(int (__stdcall **)(int, HWND, signed int))(**(int **)v1 + 52))(*(int *)v1, hWnd, 6); CheckHRESULT((CheckHRESULT_stru0 *)&this, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 64, 1u); (*(void (__cdecl **)(int))(**(int **)v1 + 28))(*(int *)v1); } // 4C9890: using guessed type int dword_4C9890[10]; //----- (0043B8EC) -------------------------------------------------------- char __thiscall DirectInputKeyboard::43B8EC(DirectInputKeyboard *this) { DirectInputKeyboard *v1; // esi@1 int v2; // eax@1 char result; // al@2 char *v4; // ebx@3 int v5; // esi@5 HRESULT v6; // eax@5 std::string v7; // [sp-18h] [bp-2Ch]@2 int v8; // [sp-Ch] [bp-20h]@5 const char *v9; // [sp-8h] [bp-1Ch]@2 int v10; // [sp-4h] [bp-18h]@2 std::string *v13; // [sp+Ch] [bp-8h]@2 int a3; // [sp+13h] [bp-1h]@2 v1 = this; v2 = this->field_8; if ( v2 ) { v4 = (char *)&this->field_1C + 1; if ( (*(int (__stdcall **)(int, signed int, char *))(*(int *)v2 + 36))(v2, 256, (char *)&this->field_1C + 1) == -2147024866 ) { if ( !(*(int (__stdcall **)(int))(*(int *)v1->field_8 + 28))(v1->field_8) ) { v5 = v1->field_8; v10 = 1; v9 = (const char *)79; v8 = (int)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp"; v6 = (*(int (__stdcall **)(int, signed int, char *))(*(int *)v5 + 36))(v5, 256, v4); CheckHRESULT((CheckHRESULT_stru0 *)&v13, v6, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 79, 1u); } } result = 1; } else { MessageBoxW(nullptr, L"Invalid Device pointer, bailing out of update_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp:72", 0); result = 0; } return result; } //----- (0043B96E) -------------------------------------------------------- char __thiscall DirectInputKeyboard::set_acquire(DirectInputKeyboard *this, int *a2) { int v2; // eax@1 char result; // al@2 int v4; // ecx@3 std::string v5; // [sp-18h] [bp-1Ch]@2 const char *v6; // [sp-8h] [bp-Ch]@2 int v7; // [sp-4h] [bp-8h]@2 DirectInputKeyboard *v8; // [sp+0h] [bp-4h]@1 v8 = this; v2 = this->field_8; if ( v2 ) { v4 = *(int *)v2; v7 = v2; if ( (char)a2 ) (*(void (__stdcall **)(int))(v4 + 28))(v7); else (*(void (__stdcall **)(int))(v4 + 32))(v7); result = 1; } else { MessageBoxW(nullptr, L"Invalid Device pointer, bailing out of set_acquire()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp:89", 0); result = 0; } return result; } //----- (0043B9B9) -------------------------------------------------------- signed int __stdcall DirectInputKeyboard_enumerator_43B9B9(int a1, int a2) { signed int result; // eax@2 if ( *(char *)(a1 + 36) & 3 ) { *(int *)(a2 + 12) = *(int *)(a1 + 4); *(int *)(a2 + 16) = *(int *)(a1 + 8); *(int *)(a2 + 20) = *(int *)(a1 + 12); *(int *)(a2 + 24) = *(int *)(a1 + 16); *(char *)(a2 + 28) = 1; result = 0; } else { result = 1; } return result; } // 43B9B9: using guessed type int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int); */