I've been reading about the fast call convention and I realized that ECX and EDX are also parameters in my function
ECX is always 0xFFFF
EDX is 0x40 + IdContainer
Convention says that allways ECX and EDX come first and then the opther parameters int he stack from left to right;
So I changed my function to:
Code:
typedef void(__fastcall *_useItem)(DWORD ECX, DWORD EDX, DWORD poscon1, DWORD itemId, DWORD poscon2, DWORD container);
Now the function works, it eats the brea but it makes tibia crash anyways. What am I missing?
I'm calling _useItem function in sync with peekMessage Function