Metin2 SetAttackKeyState

07/31/2014 14:51 3t3r4n#1
[Only registered and activated users can see links. Click Here To Register...]
why when i call this function [Only registered and activated users can see links. Click Here To Register...] game crash? :(
atac1 and atac2 contain the right values
when i set push to 0 game don't crash :/

What i do wrong? :((
07/31/2014 23:06 [uLow]Beni#2
for what does setne stand? I cant see any usage of dl, arguments are normally just pushed, but i dont know what the dl flag/byte does.
Did you make a breakpoint at it?
and when does it crash, it seems you should also push ecx on the stack and pop it after the call atac2.
you could also look at the function it should never set dl but it should use it.
08/01/2014 08:52 KaMeR1337#3
try

Quote:
mov eax, atac1
mov ecx, dword ptr ds:[eax]
push 1
call atac2
08/01/2014 11:28 [uLow]Beni#4
void CPlayer::SetAttackKeyState(bool isPress)
Code:
# add ; at end of line (c is shit)
typedef void(__fastcall *tSetAttackKeyState)(void*, void*, bool)
void* pThis = atac1
tSetAttackKeyState SetAttackKeyState = (tSetAttackKeyState) atac2
SetAttackKeyState(pThis, NULL, true)
Should work

EDIT:
Take a look at this:
[Only registered and activated users can see links. Click Here To Register...]
it seems the most clear method.


Code:
class IMyShitClass {
     void im_just_a_helper() = 0;
};
void (IMyShitClass::* pAttackKeyState)(bool) = atac2;
auto p = (IMyShitClass*)atac1;
p->*pAttackKeyState(true)
None of my code is tested but should work with right compiler
08/01/2014 12:32 3t3r4n#5
Thanks Kamer and Beni <3