I dont get the "GetAcdByAcdId"-function for 2.0.3.22427 to work -.-
i tried to write the function at 0x00954AD0 in assembler in my c# Programm.
What i think is the GetAcdByAcdId:
Code:
.text:00954AD0 arg_0 = dword ptr 8
.text:00954AD0
.text:00954AD0 push ebp
.text:00954AD1 mov ebp, esp
.text:00954AD3 push edi
.text:00954AD4 mov edi, [ebp+arg_0]
.text:00954AD7 mov edx, ecx
.text:00954AD9 cmp edi, 0FFFFFFFFh
.text:00954ADC jnz short loc_954AE5
.text:00954ADE xor eax, eax
.text:00954AE0 pop edi
.text:00954AE1 pop ebp
.text:00954AE2 retn 4
.text:00954AE5 ; ---------------------------------------------------------------------------
.text:00954AE5
.text:00954AE5 loc_954AE5: ; CODE XREF: D3_GetAcdById+Cj
.text:00954AE5 push esi
.text:00954AE6 movzx esi, di
.text:00954AE9 cmp esi, [edx+100h]
.text:00954AEF jb short loc_954AF9
.text:00954AF1 pop esi
.text:00954AF2 xor eax, eax
.text:00954AF4 pop edi
.text:00954AF5 pop ebp
.text:00954AF6 retn 4
.text:00954AF9 ; ---------------------------------------------------------------------------
.text:00954AF9
.text:00954AF9 loc_954AF9: ; CODE XREF: D3_GetAcdById+1Fj
.text:00954AF9 mov cl, [edx+164h]
.text:00954AFF push ebx
.text:00954B00 mov ebx, esi
.text:00954B02 shr ebx, cl
.text:00954B04 mov ecx, [edx+164h]
.text:00954B0A mov eax, 1
.text:00954B0F shl eax, cl
.text:00954B11 mov ecx, [edx+120h]
.text:00954B17 dec eax
.text:00954B18 and eax, esi
.text:00954B1A imul eax, 2F8h
.text:00954B20 add eax, [ecx+ebx*4]
.text:00954B23 xor ecx, ecx
.text:00954B25 cmp [eax], edi
.text:00954B27 pop ebx
.text:00954B28 setnz cl
.text:00954B2B pop esi
.text:00954B2C pop edi
.text:00954B2D dec ecx
.text:00954B2E and eax, ecx
.text:00954B30 pop ebp
.text:00954B31 retn 4
my C# code i put together was then:
Code:
byte bits_cl = (byte)ReadInt(acdContainer + 0x164);
UInt16 actorAcdId_lWord = (UInt16)actorAcdId;
int ebx2 = (int)actorAcdId_lWord >> bits_cl;
int addr = ((((1 << bits_cl) - 1) & (int)actorAcdId_lWord) * 0x2F8) + ReadInt(ReadInt(acdContainer + 0x120) + ebx2 * 4);
but for some reason it doesnt work. i always get an different ACD then i wanted.
Is this the wrong function i'm using to get the ACD or is my code wrong?