Code:
unsigned long readAttribute(unsigned long attributeTable, int attributeKey)
{
int unk = 0;
ReadProcessMemory(hProcess,(LPCVOID)(attributeTable+0x38), &unk, 4, 0);
int hash = 0;
ReadProcessMemory(hProcess,(LPCVOID)(attributeTable+0xC8), &hash, 4, 0);
int v4 = (unk + 4 * (hash & (attributeKey ^ (attributeKey >> 16))));
ReadProcessMemory(hProcess,(LPCVOID)(v4), &v4, 4, 0);
if ( v4 )
{
while (1)
//*(_DWORD *)(v4 + 4) != attributeKey )
{
//v4 = *(_DWORD *)v4;
int key = 0;
ReadProcessMemory(hProcess,(LPCVOID)(v4+0x4), &key, 4, 0);
if (key == attributeKey)
break;
ReadProcessMemory(hProcess,(LPCVOID)(v4), &v4, 4, 0);
if ( !v4 )
goto LABEL_6;
}
//sub_85DEA0(attributeTable, attributeKey);
attributeKey = attributeKey;
}
LABEL_6:
int unk2 = 0;
ReadProcessMemory(hProcess,(LPCVOID)(attributeTable+0x10), &unk2, 4, 0);
int unk3 = 0;
ReadProcessMemory(hProcess,(LPCVOID)(unk2+0x8), &unk3, 4, 0);
int unk4 = 0;
ReadProcessMemory(hProcess,(LPCVOID)(unk2+0x418), &unk4, 4, 0);
int hash2 = attributeKey ^ (attributeKey >> 16);
int v5 = 0;
ReadProcessMemory(hProcess,(LPCVOID)(unk3 + 4 * (unk4 & (hash2))), &v5, 4, 0);
//v5 = *(_DWORD *)(unk3 + 4 * (unk4 & (v3 ^ (v3 >> 16))));
int result = 0;
if ( v5 )
{
while (1)
//*(_DWORD *)(v5 + 4) != attributeKey )
{
int key = 0;
ReadProcessMemory(hProcess,(LPCVOID)(v5+0x4), &key, 4, 0);
if (key == attributeKey)
break;
ReadProcessMemory(hProcess,(LPCVOID)(v5), &v5, 4, 0);
if ( !v5 )
goto LABEL_9;
}
ReadProcessMemory(hProcess,(LPCVOID)(v5+8), &result, 4, 0);
return result;
}
else
{
LABEL_9:
int unk5 = (4 * 10 * (attributeKey & 0xFFF));
int v7 = 0;
ReadProcessMemory(hProcess,(LPCVOID)(0x15494EC+unk5), &v7, 4, 0);
return v7;
//v7 = dword_15494EC[10 * (attributeKey & 0xFFF)];
//result = a1;
//*(_DWORD *)a1 = v7;
}
return result;
}
Based on int __cdecl sub_85E130(int a1, int attributeTable, signed int attributeCategory), called from getInt.