Mercurial > mm7
diff Keyboard.cpp @ 1038:39f42990698f
Cleanings
author | Nomad |
---|---|
date | Thu, 23 May 2013 03:29:29 +0200 |
parents | f93d17337113 |
children | 29a8defbad9e |
line wrap: on
line diff
--- a/Keyboard.cpp Wed May 22 14:12:51 2013 +0200 +++ b/Keyboard.cpp Thu May 23 03:29:29 2013 +0200 @@ -113,7 +113,7 @@ } //----- (00459E5A) -------------------------------------------------------- -void KeyboardActionMapping::EnterText(int a2, int pNumWord, GUIWindow *pWindow) +void KeyboardActionMapping::EnterText(int a2, int max_string_len, GUIWindow *pWindow) { KeyboardActionMapping *v4; // esi@1 @@ -124,29 +124,17 @@ v4->field_204 = 2; else v4->field_204 = 1; - v4->field_FC = pNumWord; + v4->max_input_string_len = max_string_len; v4->pWindow = pWindow; - pWindow->field_40 = 1; - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) ) - { - if ( pAsyncKeyboard ) - pAsyncKeyboard->Suspend(); - } + pWindow->receives_keyboard_input_2 = WINDOW_INPUT_IN_PROGRESS; } //----- (00459ED1) -------------------------------------------------------- -void KeyboardActionMapping::_459ED1(int a2) +void KeyboardActionMapping::SetWindowInputStatus(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; + field_204 = 0; + if ( pWindow ) + pWindow->receives_keyboard_input_2 = a2; } //----- (00459F10) -------------------------------------------------------- @@ -167,7 +155,7 @@ goto LABEL_3; if ( a2 == 27 ) goto LABEL_15; - if ( this->uNumKeysPressed >= this->field_FC ) + if ( this->uNumKeysPressed >= this->max_input_string_len ) return 1; pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; @@ -188,7 +176,7 @@ { if ( (signed int)a2 >= 48 && (signed int)a2 <= 57 ) { - if ( pKeyActionMap->uNumKeysPressed < this->field_FC ) + if ( pKeyActionMap->uNumKeysPressed < this->max_input_string_len ) { pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2; ++pKeyActionMap->uNumKeysPressed; @@ -212,7 +200,7 @@ LABEL_3: v3 = 2; LABEL_4: - pKeyActionMap->_459ED1(v3); + pKeyActionMap->SetWindowInputStatus(v3); return 1; } // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx; @@ -651,7 +639,7 @@ const char *v28; // eax@1 const char *v29; // eax@1 - v2 = GetVKeyDisplayName(this->pVirtualKeyCodesMapping[0]); + v2 = GetVKeyDisplayName(pVirtualKeyCodesMapping[0]); WriteWindowsRegistryString("KEY_FORWARD", v2); v3 = GetVKeyDisplayName(pVirtualKeyCodesMapping[1]); WriteWindowsRegistryString("KEY_BACKWARD", v3); @@ -948,893 +936,22 @@ //----- (0045B019) -------------------------------------------------------- void Keyboard::EnterCriticalSection() { - if (bUsingAsynKeyboard) - AsyncKeyboard::EnterCriticalSection(); } //----- (0045B06E) -------------------------------------------------------- bool Keyboard::IsShiftHeld() { - if (bUsingAsynKeyboard) - { - if ( pAsyncKeyboard->_45B4EC(0x2Au) ) - { - return true; - } - return pAsyncKeyboard->_45B4EC(0x36u) != 0; - } - else - return GetAsyncKeyState(VK_SHIFT); + return GetAsyncKeyState(VK_SHIFT); } //----- (0045B0A9) -------------------------------------------------------- bool Keyboard::IsKeyBeingHeld(int vKey) { - void *v2; // esi@2 - char v3; // bl@2 - bool result; - - 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; - result = GetAsyncKeyState(vKey); - return result; + return GetAsyncKeyState(vKey) & 0x8001; } //----- (0045B0CE) -------------------------------------------------------- bool Keyboard::WasKeyPressed(int vKey) { - void *v2; // esi@2 - char v3; // bl@2 - bool result; // eax@2 - - if ( 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 - { - 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;*/ + return GetAsyncKeyState(vKey) & 1; } - -//----- (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); -*/ \ No newline at end of file