int sub_10003770()
{
bool v0; // al
bool v1; // bl
HWND ActiveWindow; // eax
int v3; // esi
int v4; // edx
int v5; // ebx
int v6; // edi
int v7; // ecx
int v8; // ecx
HMODULE *v9; // edi
HMODULE ModuleHandleA; // eax
HMODULE v11; // esi
HMODULE v12; // edx
int v13; // eax
HMODULE v14; // eax
HMODULE v15; // eax
if ( !working_maybe )
{
if ( *(_DWORD *)(*(_DWORD *)(dword_10005648 + 12) + 40) )
{
v0 = (GetKeyState(1) & 0x8000) != 0;
v1 = v0 && !byte_1000565C;
byte_1000565C = v0;
GetCursorPos(&cursor_pos);
ActiveWindow = GetActiveWindow();
ScreenToClient(ActiveWindow, &cursor_pos);
v3 = dword_10005648;
v4 = *(_DWORD *)(*(_DWORD *)(dword_10005648 + 12) + 28);
if ( !byte_1000564C )
{
if ( v1 )
{
v5 = *(_DWORD *)(v4 + 278);
v6 = *(_DWORD *)(v4 + 282);
if ( cursor_pos.x > v5
&& cursor_pos.x < v5 + *(_DWORD *)(v4 + 286)
&& cursor_pos.y > v6
&& cursor_pos.y < v6 + *(_DWORD *)(v4 + 294) )
{
byte_1000564C = 1;
dword_10005650 = cursor_pos.x - v5;
dword_10005654 = cursor_pos.y - v6;
}
}
return dword_1000563C();
}
if ( byte_1000565C )
{
v7 = cursor_pos.x - dword_10005650;
*(_DWORD *)(v4 + 278) = cursor_pos.x - dword_10005650;
*(_DWORD *)(*(_DWORD *)(v3 + 12) + 4) = v7;
v8 = cursor_pos.y - dword_10005654;
*(_DWORD *)(v4 + 282) = cursor_pos.y - dword_10005654;
*(_DWORD *)(*(_DWORD *)(v3 + 12) + 8) = v8;
return dword_1000563C();
}
}
byte_1000564C = 0;
return dword_1000563C();
}
if ( working_maybe != 1 && working_maybe == 2 )
{
v9 = (HMODULE *)dword_10005648;
ModuleHandleA = GetModuleHandleA("samp.dll");
v11 = ModuleHandleA;
*v9 = ModuleHandleA;
if ( ModuleHandleA )
{
v12 = 0;
v13 = *(_DWORD *)((char *)ModuleHandleA + *((_DWORD *)ModuleHandleA + 15) + 40);
while ( v13 != dword_10004280[(_DWORD)v12] )
{
v12 = (HMODULE)((char *)v12 + 1);
if ( (unsigned int)v12 >= 6 )
{
v12 = v9[1];
goto LABEL_25;
}
}
v9[1] = v12;
LABEL_25:
if ( !v12
|| (v14 = *(HMODULE *)((char *)v11 + dword_10004298[(_DWORD)v12]), (v9[2] = v14) != 0)
&& (v15 = *(HMODULE *)((char *)v11 + dword_100042B0[(_DWORD)v12]), (v9[3] = v15) != 0) )
{
if ( *(_DWORD *)(dword_10005648 + 4) )
{
sub_10003090(*(_DWORD *)dword_10005648);
working_maybe = 0;
}
else
{
MessageBoxA(0, "Unknown SA-MP version.", "samp-cursor-patch.asi", 0x10);
working_maybe = 1;
}
}
}
}
return dword_1000563C();
}