Hello, I've just started in the ME business. I tried making some code after looking at all the great documentation.
I've tried this code:
Code:
BlackMagic WoW = new BlackMagic();
WoW.OpenProcessAndThread(SProcess.GetProcessFromWindowTitle("World of Warcraft"));
uint CodeCave = WoW.AllocateMemory();
WoW.Asm.Clear();
WoW.Asm.AddLine("var_18= dword ptr -18h");
WoW.Asm.AddLine("var_4= dword ptr -4");
WoW.Asm.AddLine("arg_0= dword ptr 8");
WoW.Asm.AddLine("push ebp");
WoW.Asm.AddLine("mov ebp, esp");
WoW.Asm.AddLine("push ecx");
WoW.Asm.AddLine("push ebx");
WoW.Asm.AddLine("push esi");
WoW.Asm.AddLine("mov esi, [ebp+arg_0]");
WoW.Asm.AddLine("push edi");
WoW.Asm.AddLine("push 1");
WoW.Asm.AddLine("push esi");
WoW.Asm.AddLine("call sub_827110");
WoW.Asm.AddLine("add esp, 8");
WoW.Asm.AddLine("test eax, eax");
WoW.Asm.AddLine("jz loc_4A6752");
WoW.Asm.InjectAndExecute(CodeCave);
WoW.FreeMemory(CodeCave);
That ASM code is the code for DoEmote(), it fails at
Code:
WoW.Asm.InjectAndExecute(CodeCave);
After that code failed, I began looking at the pseudo code, the pseudo code for DoEmote is this;
Code:
int __cdecl sub_4A6610(int a1)
{
char *v1; // eax@3
char *v2; // esi@3
int v4; // esi@6
int v5; // edi@7
int v6; // ebx@10
int v7; // eax@15
int v8; // ecx@15
int v9; // edi@15
int v10; // esi@15
int v11; // edx@18
int v12; // eax@19
int v13; // edx@19
int v14; // ST18_4@21
char *v15; // [sp+14h] [bp-4h]@2
if ( sub_827110(a1, 1) )
{
v15 = (char *)sub_827290(a1, 1, 0);
if ( !sub_7019D0(v15, "DANCE", 0x7FFFFFFFu) )
{
v1 = (char *)sub_827290(a1, 2, 0);
v2 = v1;
if ( v1 )
{
if ( (unsigned __int8)sub_50DAC0(v1) )
{
sub_50D9F0(v2);
return 0;
}
}
}
v4 = dword_A75074;
if ( dword_A75074 )
{
v5 = 76 * dword_A75074;
while ( 1 )
{
--v4;
v5 -= 76;
if ( v4 < 0 || v4 >= dword_A75074 )
v6 = 0;
else
v6 = v5 + dword_A75088;
if ( !sub_7019D0(v15, *(char **)(v6 + 4), 0x7FFFFFFFu) )
break;
if ( !v4 )
return 0;
}
v10 = dword_B695C8;
v9 = dword_B695CC;
v7 = sub_827290(a1, 2, 0);
if ( v7 )
{
LOBYTE(v8) = *(_BYTE *)v7;
if ( *(_BYTE *)v7 )
{
if ( (_BYTE)v8 != 37 )
{
v10 = sub_4C4DC0(v7, 16, 0, 0, 3.402823466385289e38, 0);
v9 = v11;
}
}
}
v12 = sub_47A5C0(v8);
if ( sub_47BBC0(v12, v13, 16) )
{
sub_671C90(v6, v10, v9);
return 0;
}
}
}
else
{
sub_828430(a1, "Usage: DoEmote(\"emote\"[, \"target\"])", v14);
}
return 0;
}
But I don't know how to call DoEmote using the pseudo-code, any pointer on how to do that would be nice! But, the main question still is; How do I make the ASM stuff work? :-)
( I did read the rules, and I don't think that this is breaking it, if it is just delete it.. )