TKC-Community

Hacking and Art => Mount and Blade => Topic started by: Mercenary_Frank on February 10, 2016, 03:33:47 am

Title: W2S function what does it check?
Post by: Mercenary_Frank on February 10, 2016, 03:33:47 am
Goodday

This question is more aimed at mrmedic but anybody is free to answer this. Its about the W2S function mrmedic told me about I am still trying to call it. It doesn't crash anymore but it checks something but I don't know what. here is the provided code.

my code

Code: [Select]
float offsets[3]{500,500,500};
HookWorldToScreen hookWorldToScreen = reinterpret_cast<HookWorldToScreen(0x0434CA0);
goldenKey = new D3DXMATRIX(offsets);

DWORD a = hookWorldToScreen(0x8E3120,0xA633F0,(DWORD)goldenKey,0x0);
cout << a;
Code: [Select]
 
result = a4;
v8 = *(_DWORD *)(*(_DWORD *)(a4 + 520) + 4 * a6);
v9 = *(_DWORD *)(*(_DWORD *)(v8 + 2344) + 4);
v10 = *(_DWORD *)(v9 + 164);
if ( !(v10 & 0x10000) && !(v10 & 0xC) && !(*(_DWORD *)(*(_DWORD *)(v9 + 332) + 160) & 0x100) )

the if checks fails going straight to the end of the function and returning "result", a4 is the second parameters so its returning 0xA633F0

I suspect the & has something to do with ANDing however I still don't know what is making this test fail or why it is ever there in a worldtoscreen function.

EDIT: also what is the purpose of the last parameters? whenever the code is run it is an index starting from 0 going up 1 everytime it is called

Thanks for your help.