#1 02-08-2011 11:25

VintProg_Pro
Registered: 17-06-2010
Posts: 153

Что не так?

Вот функция в IDA

.text:004C3950     ; int __cdecl set_color_marker(int id_marker, int id_color)
.text:004C3950     proc            set_color_marker near   ; CODE XREF: sub_453670+91Cp
.text:004C3950
.text:004C3950     id_marker       = dword ptr  4
.text:004C3950     id_color        = dword ptr  8
.text:004C3950
.text:004C3950 000                 mov     ecx, [esp+id_marker] ; id marker
.text:004C3954 000                 push    ebx
.text:004C3955 004                 mov     eax, ecx
.text:004C3957 004                 mov     edx, eax
.text:004C3959 004                 and     edx, 0FFFFh
.text:004C395F 004                 cmp     ecx, 0FFFFFFFFh
.text:004C3962 004                 jz      short loc_4C3983
.text:004C3964 004                 mov     ebx, edx
.text:004C3966 004                 and     eax, 0FFFF0000h
.text:004C396B 004                 lea     ecx, [ds:0+ebx*8]
.text:004C3972 004                 shr     eax, 10h
.text:004C3975 004                 sub     ecx, ebx
.text:004C3977 004                 movzx   ecx, [ds:_radarBlips.field_24+ecx*8]
.text:004C397F 004                 cmp     eax, ecx
.text:004C3981 004                 jz      short loc_4C3986
.text:004C3983
.text:004C3983     loc_4C3983:                             ; CODE XREF: set_color_marker+12j
.text:004C3983 004                 or      edx, 0FFFFFFFFh
.text:004C3986
.text:004C3986     loc_4C3986:                             ; CODE XREF: set_color_marker+31j
.text:004C3986 004                 cmp     edx, 0FFFFFFFFh
.text:004C3989 004                 jnz     short loc_4C3990
.text:004C398B 004                 pop     ebx
.text:004C398C 000                 retn
.text:004C398C     ; ---------------------------------------------------------------------------
.text:004C398D 000                 align 10h
.text:004C3990
.text:004C3990     loc_4C3990:                             ; CODE XREF: set_color_marker+39j
.text:004C3990 004                 lea     ecx, [ds:0+edx*8]
.text:004C3997 004                 mov     eax, [esp+4+id_color]
.text:004C399B 004                 sub     ecx, edx
.text:004C399D 004                 mov     [ds:_radarBlips.field_0+ecx*8], eax
.text:004C39A4 004                 pop     ebx
.text:004C39A5 000                 retn
.text:004C39A5     endp            set_color_marker

Попытался перевести ее для дельфи:

procedure a_marker_set_color(id_marker, id_color : dword); cdecl;
begin

 _radarBlips := pointer($007D7D40);



asm
  mov     ecx, [esp+id_marker] // id marker
  push    ebx
  mov     eax, ecx
  mov     edx, eax
  and     edx, 0FFFFh
  cmp     ecx, 0FFFFFFFFh
  jz      @@loc_4C3983     //short loc_4C3983
  mov     ebx, edx
  and     eax, 0FFFF0000h
  lea     ecx, [ds:0+edx*8]
  shr     eax, 10h
  sub     ecx, ebx
  movzx   ecx, [ds:007D7D64h+ecx*8]
  cmp     eax, ecx
  jz      @@loc_4C3986

@@loc_4C3983:                             // CODE XREF: set_color_marker+12j
  or      edx, 0FFFFFFFFh

@@loc_4C3986:                             // CODE XREF: set_color_marker+31j
  cmp     edx, 0FFFFFFFFh
  jnz     @@loc_4C3990
  pop     ebx
  retn

@@loc_4C3990:                             // CODE XREF: set_color_marker+39j
  lea     ecx, [ds:0+edx*8]
  mov     eax, [esp+4+id_color]
  sub     ecx, edx
  mov     [ds: 007D7D40h+ecx*8], eax
  pop     ebx
  retn
end;

Пытаюсь ее вызвать:

     Marker_Create :=    ptr($004C3CA0);
     marker_show_onRadar   :=    ptr($004C3860);
     marker_set_color    := ptr($004C3950); //Вот эта работает нормально!


     randomize;
     Marker_Handle := Marker_Create(4, Random(1400), Random(1400), 10.0, 2, 3);
     marker_show_onRadar(Marker_Handle, 3);
     a_marker_set_color(Marker_Handle, 4); //Вот она

Но не фига не выходит! Что не так? Только не надо молчать пожалуйста!!!

Offline

Board footer

Powered by FluxBB