Mercurial > mm7
changeset 2445:b10125a9c772
fix crash in keyboard option
author | Ritor1 |
---|---|
date | Thu, 24 Jul 2014 12:44:14 +0600 |
parents | 702cc7e6eefd |
children | 063d194e0881 |
files | GUIWindow.cpp Game.cpp Render.cpp |
diffstat | 3 files changed, 81 insertions(+), 207 deletions(-) [+] |
line wrap: on
line diff
--- a/GUIWindow.cpp Thu Jul 24 01:39:07 2014 +0200 +++ b/GUIWindow.cpp Thu Jul 24 12:44:14 2014 +0600 @@ -112,18 +112,17 @@ //----- (0041B4E1) -------------------------------------------------------- int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) { - unsigned __int8 v3; // bl@1 int result; // eax@1 int i; // edx@2 GUIButton *j; // ecx@3 int k; // edx@7 GUIButton *l; // ecx@8 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 - char v10; // [sp+8h] [bp-4h]@1 + char old_hot_key; // [sp+8h] [bp-4h]@1 - v3 = uNewHotkey; - v10 = toupper(uOldHotkey); - result = toupper(v3); + //v3 = uNewHotkey; + old_hot_key = toupper(uOldHotkey); + result = toupper(uNewHotkey); v9 = result; if ( bFirstCall ) { @@ -139,8 +138,8 @@ result = 84 * pVisibleWindowsIdxs[k]; for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) { - LOBYTE(result) = v10; - if ( l->uHotkey == v10 ) + LOBYTE(result) = old_hot_key; + if ( l->uHotkey == old_hot_key ) { if ( !l->field_28 ) { @@ -157,28 +156,24 @@ //----- (0041B438) -------------------------------------------------------- GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) { - char v1; // al@1 - int v2; // esi@1 - char v3; // dl@1 - GUIWindow *v4; // ecx@2 + char Hot_key_num; // al@1 + GUIWindow *current_window; // ecx@2 GUIButton *result; // eax@2 - //int v6; // edx@12 - v1 = toupper(uHotkey); - v2 = uNumVisibleWindows; - v3 = v1; - for( v2 = uNumVisibleWindows; v2 >= 0 && pVisibleWindowsIdxs[v2] > 0; v2-- ) + Hot_key_num = toupper(uHotkey); + for( int i = uNumVisibleWindows; i >= 0 && pVisibleWindowsIdxs[i] > 0; i-- ) { - v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; - for ( result = v4->pControlsHead; result; result = result->pNext ) + current_window = &pWindowList[pVisibleWindowsIdxs[i] - 1]; + for ( result = current_window->pControlsHead; result; result = result->pNext ) { - if ( result->uHotkey == v3 ) + if ( result->uHotkey == Hot_key_num ) { pMessageQueue_50CBD0->AddGUIMessage(result->msg, result->msg_param, 0); return result; } } - if ( !v4->uFrameX && !v4->uFrameY && (v4->uFrameWidth == window->GetWidth() && v4->uFrameHeight == window->GetWidth()) ) + if ( !current_window->uFrameX && !current_window->uFrameY + && (current_window->uFrameWidth == window->GetWidth() && current_window->uFrameHeight == window->GetWidth()) ) break; } return 0;
--- a/Game.cpp Thu Jul 24 01:39:07 2014 +0200 +++ b/Game.cpp Thu Jul 24 12:44:14 2014 +0600 @@ -1089,50 +1089,24 @@ //----- (004304E7) -------------------------------------------------------- void GameUI_MsgProc() { - //signed int v0; // edi@6 - //char *v1; // esi@6 unsigned int v2; // edx@7 Actor *pActor; // ecx@13 int v4; // ecx@18 - //NPCData *pNPCData0; // eax@18 - //int v6; // edx@20 - //int v7; // ecx@29 - //unsigned int v8; // edx@59 - //unsigned int v9; // ecx@60 unsigned int v10; // ecx@73 - //unsigned int v11; // eax@75 - unsigned __int8 v12; // sf@75 - unsigned __int8 v13; // of@75 int v14; // eax@98 - unsigned int v15; // eax@102 - unsigned __int8 v16; // al@104 - unsigned __int8 v17; // al@105 int v18; // eax@106 float v19; // ST64_4@121 -// unsigned int v20; // ecx@121 float v21; // ST64_4@126 float v22; // ST64_4@127 -// unsigned int v23; // ecx@135 unsigned int v24; // ecx@149 -// unsigned int v25; // ecx@165 -// GUIWindow *pWindow; // eax@204 -// unsigned int v27; // edx@204 -// unsigned int v28; // ecx@204 GUIWindow *pWindow2; // ecx@248 - //int v30; // edx@258 - //const char *v31; // ecx@262 - signed int v32; // eax@269 + bool pKeyBindingFlag; // eax@269 unsigned int v33; // eax@277 - unsigned __int8 v34; // al@279 - unsigned __int8 v35; // al@280 - //GUIWindow *pWindow3; // ecx@332 int v37; // eax@341 int v38; // eax@358 SHORT v39; // ax@365 - //signed int v40; // eax@365 char *v41; // eax@380 int v42; // eax@396 -// POINT *pPoint; // eax@397 signed int v44; // eax@398 int v45; // edx@398 signed int v46; // ecx@398 @@ -1141,7 +1115,6 @@ BLVFace *pBLVFace; // ecx@410 ODMFace *pODMFace; // ecx@412 CastSpellInfo *pSpellInfo; // ecx@415 -// void *v52; // eax@424 __int16 v53; // ax@431 int v54; // eax@432 int v55; // ecx@432 @@ -1150,8 +1123,6 @@ Player *pPlayer; // edx@442 unsigned int pMapNum; // eax@445 signed int v60; // ST64_4@459 - //NPCData *pNPCData2; // eax@467 - //unsigned __int64 v62; // kr00_8@467 __int16 v63; // dx@479 unsigned int v64; // eax@486 int v65; // ecx@486 @@ -1168,30 +1139,21 @@ int v76; // esi@535 int v77; // eax@537 Player *pPlayer2; // ecx@549 - //int v79; // ecx@550 - //unsigned int v80; // edx@550 signed int v81; // eax@552 -// POINT *pPoint2; // eax@553 signed int v83; // ecx@554 signed int v84; // ecx@554 GUIButton *pButton; // eax@578 unsigned int v86; // eax@583 const char *v87; // ecx@595 const char *v88; // ecx@596 - //unsigned int v89; // eax@598 unsigned int v90; // eax@602 int v91; // edx@605 int v92; // eax@605 int v93; // edx@605 int pPlayerNum; // edx@611 int v95; // eax@611 - //const char *v96; // ecx@621 unsigned int v97; // eax@624 int v98; // eax@636 -// unsigned __int8 v99; // al@643 -// Player *pPlayer3; // eax@648 -// int v101; // ecx@648 -// int v102; // edx@652 int v103; // eax@671 Player *pPlayer4; // ecx@718 int v105; // eax@718 @@ -1200,71 +1162,20 @@ unsigned int v108; // eax@758 unsigned int v115; // eax@764 int v116; // eax@776 -// POINT *pPoint3; // eax@777 unsigned int v118; // eax@785 unsigned int v119; // ecx@786 -// unsigned int v120; // [sp-28h] [bp-624h]@86 unsigned int v121; // [sp-28h] [bp-624h]@711 -// unsigned int v122; // [sp-24h] [bp-620h]@86 unsigned int v123; // [sp-24h] [bp-620h]@711 -// unsigned int v124; // [sp-20h] [bp-61Ch]@86 unsigned int v125; // [sp-20h] [bp-61Ch]@711 -// unsigned int v126; // [sp-1Ch] [bp-618h]@86 int v127; // [sp-1Ch] [bp-618h]@107 unsigned int v128; // [sp-1Ch] [bp-618h]@711 -// int v129; // [sp-18h] [bp-614h]@86 - //signed int v130; // [sp-18h] [bp-614h]@107 -// int v131; // [sp-14h] [bp-610h]@86 - //unsigned int v132; // [sp-14h] [bp-610h]@107 - //unsigned int v133; // [sp-10h] [bp-60Ch]@60 -// unsigned int v134; // [sp-10h] [bp-60Ch]@86 - //signed int v135; // [sp-10h] [bp-60Ch]@107 -// unsigned int v136; // [sp-10h] [bp-60Ch]@121 - //unsigned int v137; // [sp-Ch] [bp-608h]@60 -// unsigned int v138; // [sp-Ch] [bp-608h]@86 - //signed int v139; // [sp-Ch] [bp-608h]@107 -// unsigned int v140; // [sp-Ch] [bp-608h]@121 -// enum WindowType pWindowType; // [sp-8h] [bp-604h]@56 - //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60 -// unsigned __int8 v143; // [sp-8h] [bp-604h]@86 - //int v144; // [sp-8h] [bp-604h]@107 -// enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121 - //const char *v146; // [sp-8h] [bp-604h]@449 - //unsigned int v147; // [sp-8h] [bp-604h]@550 - //int v148; // [sp-4h] [bp-600h]@56 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 -// const char *v150; // [sp-4h] [bp-600h]@86 - //unsigned int v151; // [sp-4h] [bp-600h]@107 -// int v152; // [sp-4h] [bp-600h]@121 -// int v153; // [sp-4h] [bp-600h]@135 - //int v154; // [sp-4h] [bp-600h]@149 -// int v155; // [sp-4h] [bp-600h]@165 -// int v156; // [sp-4h] [bp-600h]@204 - //const char *v157; // [sp-4h] [bp-600h]@444 - //unsigned int v158; // [sp-4h] [bp-600h]@449 - //__int16 v159; // [sp-4h] [bp-600h]@550 -// int v160; // [sp-4h] [bp-600h]@599 const char *v161; // [sp-4h] [bp-600h]@637 - //int v162; // [sp+0h] [bp-5FCh]@56 - //int v163; // [sp+0h] [bp-5FCh]@59 -// Texture *pTexture; // [sp+0h] [bp-5FCh]@86 - //int v165; // [sp+0h] [bp-5FCh]@107 -// int v166; // [sp+0h] [bp-5FCh]@121 -// int v167; // [sp+0h] [bp-5FCh]@135 - //int v168; // [sp+0h] [bp-5FCh]@149 -// int v169; // [sp+0h] [bp-5FCh]@165 -// int v170; // [sp+0h] [bp-5FCh]@204 - //signed int v171; // [sp+0h] [bp-5FCh]@259 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 char *v173; // [sp+0h] [bp-5FCh]@444 char *v174; // [sp+0h] [bp-5FCh]@449 - //int v175; // [sp+0h] [bp-5FCh]@550 -// int v176; // [sp+0h] [bp-5FCh]@599 const char *v177; // [sp+0h] [bp-5FCh]@629 char *v178; // [sp+0h] [bp-5FCh]@637 -// int v179; // [sp+4h] [bp-5F8h]@0 - //signed int _this; // [sp+14h] [bp-5E8h]@22 -// signed int thisa; // [sp+14h] [bp-5E8h]@251 signed int thisb; // [sp+14h] [bp-5E8h]@272 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 @@ -1275,7 +1186,6 @@ signed int thisi; // [sp+14h] [bp-5E8h]@535 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 -// int thisl; // [sp+14h] [bp-5E8h]@648 int uMessageParam; // [sp+18h] [bp-5E4h]@7 int uAction; // [sp+1Ch] [bp-5E0h]@18 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 @@ -1284,18 +1194,11 @@ enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 unsigned int v199; // [sp+30h] [bp-5CCh]@7 char *v200; // [sp+34h] [bp-5C8h]@518 -// POINT v201; // [sp+38h] [bp-5C4h]@553 POINT v202; // [sp+40h] [bp-5BCh]@141 POINT a2; // [sp+48h] [bp-5B4h]@127 -// POINT v204; // [sp+50h] [bp-5ACh]@777 POINT v205; // [sp+58h] [bp-5A4h]@171 -// POINT v206; // [sp+60h] [bp-59Ch]@553 POINT v207; // [sp+68h] [bp-594h]@155 -// POINT v208; // [sp+70h] [bp-58Ch]@397 -// POINT v209; // [sp+78h] [bp-584h]@777 -// POINT v210; // [sp+80h] [bp-57Ch]@397 POINT v211; // [sp+88h] [bp-574h]@704 - //__int64 v212; // [sp+90h] [bp-56Ch]@467 int v213; // [sp+98h] [bp-564h]@385 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 char pOut[32]; // [sp+BCh] [bp-540h]@370 @@ -1305,7 +1208,6 @@ char a1[64]; // [sp+1F8h] [bp-404h]@467 char Str2[128]; // [sp+238h] [bp-3C4h]@527 Actor actor; // [sp+2B8h] [bp-344h]@4 - //unsigned short* screenshot; int currHour; dword_50CDC8 = 0; @@ -1438,7 +1340,7 @@ } else { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" + ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game" pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); dword_6BE138 = 124; } @@ -1633,32 +1535,34 @@ uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_KeyMappingOptions, 0, 0); - pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); + + pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, "", 0); + + pGUIWindow_CurrentMenu->CreateButton(19, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(127, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(127, 324, 108, 20, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(19, 324, 108, 20, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); + + pGUIWindow_CurrentMenu->CreateButton(129, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 1, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 2, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 3, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 4, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 5, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 6, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 7, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 8, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 9, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 10, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 11, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 12, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 13, 0, "", 0); + uGameMenuUI_CurentlySelectedKeyIdx = -1; KeyboardPageNum = 1; memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); //*(_WORD *)KeyButtonArray[28] = 0; memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); - //v1 = ""; - //v0 = 1; continue; case UIMSG_ChangeKeyButton: if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) @@ -1675,31 +1579,21 @@ case UIMSG_ResetKeyMapping: v197 = 1; pKeyActionMap->SetDefaultMapping(); - uAction = 0; - do + for ( uint i = 0; i < 28; i++ ) { - v15 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - if ( v15 != pPrevVirtualCidesMapping[uAction] ) + if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] ) { if ( v197 ) { - v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1); + GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1); v197 = 0; } else - { - v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v17, 0); - } + GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0); } - pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - v18 = uAction++; - v13 = uAction > 28; - v12 = uAction - 28 < 0; - GameMenuUI_InvaligKeyBindingsFlags[v18] = 0; + pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i); + GameMenuUI_InvaligKeyBindingsFlags[i] = false; } - while ( v12 ^ v13 ); pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); continue; case UIMSG_SelectKeyPage1: @@ -2221,52 +2115,44 @@ case SCREEN_KEYBOARD_OPTIONS://Return to game v197 = 1; - v32 = 0; - while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) + pKeyBindingFlag = false; + for ( uint i = 0; i < 28; ++i ) + { + if ( GameMenuUI_InvaligKeyBindingsFlags[i] ) + pKeyBindingFlag = true; + } + if ( !pKeyBindingFlag ) { - ++v32; - if ( v32 >= 28 ) + for ( uint i = 0; i < 5; i++ ) { - thisb = (signed int)&uTextureID_Optkb; - assert(false && "Invalid condition values"); - do + if ( uTextureID_Optkb[i] ) + pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release(); + } + memset(&uTextureID_Optkb, 0, 20); + pIcons_LOD->SyncLoadedFilesCount(); + for ( uint i = 0; i < 28; ++i ) + { + if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] ) { - if ( *(int *)thisb ) - pIcons_LOD->pTextures[*(int *)thisb].Release(); - thisb += 4; - } - while ( thisb < (signed int)0x00507C08 ); - - memset(&uTextureID_Optkb, 0, 0x14u); - pIcons_LOD->SyncLoadedFilesCount(); - for ( uAction = 0; uAction < 28; ++uAction ) - { - v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - if ( v33 != pPrevVirtualCidesMapping[uAction] ) + if ( v197 ) { - if ( v197 ) - { - v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1); - v197 = 0; - } - else - { - v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); - } + GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1); + v197 = 0; } - if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 ) - pKeyToggleType = TOGGLE_OneTimePress; else - pKeyToggleType = TOGGLE_Continuously; - pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); + GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0); } - pKeyActionMap->StoreMappings(); - stru_506E40.Release(); - break; + if ( i > 3 && i != 25 && i != 26 ) + pKeyToggleType = TOGGLE_OneTimePress; + else + pKeyToggleType = TOGGLE_Continuously; + pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType); } + pKeyActionMap->StoreMappings(); + stru_506E40.Release(); + break; } + pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); break; case SCREEN_REST://close rest screen if ( dword_506F14 )
--- a/Render.cpp Thu Jul 24 01:39:07 2014 +0200 +++ b/Render.cpp Thu Jul 24 12:44:14 2014 +0600 @@ -728,14 +728,9 @@ { size_t v4; // eax@1 size_t v5; // eax@1 - IUnknown *v6; // eax@10 size_t v7; // eax@13 DDDEVICEIDENTIFIER ddDevId; // [sp+4h] [bp-4F8h]@11 - DDSURFACEDESC2 v10;/*int v10; // [sp+42Ch] [bp-D0h]@16 - int v11; // [sp+430h] [bp-CCh]@16 - int v12; // [sp+434h] [bp-C8h]@16 - int v13; // [sp+438h] [bp-C4h]@16 - int v14; // [sp+474h] [bp-88h]@16*/ + DDSURFACEDESC2 v10;/*int v10; // [sp+42Ch] [bp-D0h]@16*/ DDSCAPS2 ddsCaps; // [sp+4A8h] [bp-54h]@14 unsigned int uFreeVideoMem; // [sp+4B8h] [bp-44h]@14 RenderD3D_aux aux; // [sp+4BCh] [bp-40h]@19 @@ -772,7 +767,7 @@ delete [] v20.pDriverName; delete [] v20.pDeviceDesc; delete v20.pGUID; - v6 = (IUnknown *)pDirectDraw; + pDirectDraw->Release(); } else { @@ -805,7 +800,7 @@ //free(v20.pDDraw4DevDesc); delete [] v20.pDDraw4DevDesc; delete v20.pGUID; - v6 = (IUnknown *)pDirectDraw4; + pDirectDraw4->Release(); } else { @@ -814,15 +809,13 @@ pDirect3D3->EnumDevices((LPD3DENUMDEVICESCALLBACK)D3DDeviceEnumerator, &aux); delete [] v20.pDriverName; delete [] v20.pDeviceDesc; - //free(v20.pDDraw4DevDesc); delete [] v20.pDDraw4DevDesc; delete v20.pGUID; pDirectDraw4->Release(); - v6 = (IUnknown *)pDirect3D3; pDirectDraw4 = 0; - } - } - v6->Release(); + pDirect3D3->Release(); + } + } } return 1; }