Results 1 to 10 of 10
  1. #1
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh

    Strides Logger [Delphi]

    For the delphi developer wanting to make custom chams, this tool will help in finding the strides, Hooks not included....

    Screenshot


    Usage:
    Insert - Logger Off/On
    Arrow Up/Down - Navigate
    Arrow Left/Right - Decrease/Increase Value Of Selected Item
    NumberPad 7 - Strides Off/On
    NumberPad 8 - Nums Off/On
    NumberPad 9 - Prims Off/On

    Code
    Code:
    var
      //LogThread Handle
      dwPresent: Cardinal = 0;
      dwReset: Cardinal = 0;
      dwDIP  : Cardinal = 0;
      dwThrdLog: Dword = 0;
      dwThrdMain: Dword = 0;
      bColorsSet: Boolean = False;
      texRed: IDIRECT3DTEXTURE9;
      pD3Ddev:  IDirect3DDevice9;
    
      iItem: Integer = 0;
    
      cStride: Cardinal = 0;
      cNums: LongWord = 0;
      cPrims: LongWord = 0;
    
      bMenuOn: Boolean = True;
      bStride: Boolean = False;
      bNums: Boolean = False;
      bPrims: Boolean = False;
    
      MenuFont: D3DX9.ID3DXFont;
    
      ResetNext     : function(const Self: IDirect3DDevice9; const PPresentationParameters:_D3DPRESENT_PARAMETERS_):HResult;stdcall = nil;
      DrawIndexedPrimitiveNext: function(const Self: IDirect3DDevice9; _Type: TD3DPrimitiveType; BaseVertexIndex: Integer; MinVertexIndex, NumVertices, startIndex, primCount: LongWord): HResult; stdcall = nil;
      PresentNext   : function(const Self: IDirect3DDevice9; pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall = nil;
    
    const
      aRed: array[1..60] of Byte = ($42, $4D, $3C, $00, $00, $00, $00, $00, $00, $00, $36, $00, $00, $00, $28, $00, $00, $00, $01, $00, $00, $00, $01, $00, $00, $00, $01, $00, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $12, $0B, $00, $00, $12, $0B, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $FF, $00, $00, $00);
    
    
      Function LogThread():Dword;
    
    implementation
    
    Function GetDevice():IDirect3DDevice9;
    begin
      Result:= pD3Ddev;
    end;
    
    //Returns the Font Interface
    function GetFont(): ID3DXFont;
    begin
      Result:= MenuFont;
    end;
    
    procedure MenuInt(pDevice: IDirect3DDevice9);
    begin
     if GetDevice <>  pDevice then
       begin
        pD3Ddev:= pDevice;
        MenuFont:= nil;
        if GetFont = nil then
         D3DXCreateFont(pDevice,10, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH or FF_DONTCARE, 'Terminal', MenuFont);
       end;
    end;
    
    procedure DrawTextA(const iLeft, iTop: Integer; szText: PAnsiChar; Color: D3DCOLOR);
    var
      d3dRectangle : D3DRECT;
    begin
      d3dRectangle.x1:= ileft;
      d3dRectangle.y1:= itop;
      d3dRectangle.x2:= ileft + 100;
      d3dRectangle.y2:= itop + 10;
    
      GetFont.DrawTextA(nil, szText, -1, @D3DRectangle, 0{( DT_CALCRECT or DT_NOCLIP )}, Color);
    end;
    
    Function DrawIndexedPrimitiveCallback(const Self: IDIRECT3DDEVICE9; _Type: TD3DPrimitiveType; BaseVertexIndex: Integer; MinVertexIndex, NumVertices, startIndex, primCount: LongWord): HResult; stdcall;
    var
     Stream_Data: IDIRECT3DVERTEXBUFFER9;
     Offset: cardinal;
     Stride: cardinal;
    begin
       asm
        PUSHAD
       end;
    
       if bColorsSet = False then
        begin
         D3DXCreateTextureFromFileInMemory(Self, @Ared, sizeof(aRed), texRed);
         bColorsSet:= True;
        end;
    
         Self.GetStreamSource(0, Stream_Data, Offset, Stride);
        if bStride then
         if Stride = cStride then
          begin
           //Texture
           Self.SetTexture(1,nil);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
           DrawIndexedPrimitiveNext(Self, _Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
          end;
    
        if ((bStride = True) and (bNums = True)) then
         if ((Stride = cStride) and (NumVertices = cNums)) then
          begin
           //Texture
           Self.SetTexture(1,nil);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
           DrawIndexedPrimitiveNext(Self, _Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
          end;
    
        if ((bStride = True) and (bNums = True) and (bPrims = True)) then
         if ((Stride = cStride) and (NumVertices = cNums) and (primCount = cPrims)) then
          begin
           //Texture
           Self.SetTexture(1,nil);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
           DrawIndexedPrimitiveNext(Self, _Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
          end;
    
        if bNums = True then
         if NumVertices = cNums then
          begin
           //Texture
           Self.SetTexture(1,nil);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
           DrawIndexedPrimitiveNext(Self, _Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
           Self.SetTexture(0, texRed);
           Self.SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
          end;
    
      asm
       POPAD
      end;
    
      Result:= DrawIndexedPrimitiveNext(Self, _Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    end;
    
    
    function ResetCallBack(const Self:IDirect3DDevice9; const PPresentationParameters:_D3DPRESENT_PARAMETERS_):HRESULT;stdcall;
    begin
      asm
       nop
      end;
    
      MenuFont.OnLostDevice;
      MenuFont.OnResetDevice;
      bColorsSet:= False;
      result := ResetNext(self,PPresentationParameters);
    end;
    
    function PresentCallBack(const Self: IDirect3DDevice9; pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall;
    begin
       asm
        pushad
       end;
       if bMenuOn then
       begin
       //Render Menu
       MenuInt(Self);
       GetDevice.SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
    	 GetDevice.SetRenderState( D3DRS_BLENDOP, D3DBLENDOP_ADD );
    	 GetDevice.SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
    	 GetDevice.SetRenderState( D3DRS_ALPHATESTENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_SEPARATEALPHABLENDENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_STENCILENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_ALPHABLENDENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_DISABLE );
    	 GetDevice.SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA or D3DCOLORWRITEENABLE_BLUE or D3DCOLORWRITEENABLE_GREEN or D3DCOLORWRITEENABLE_RED );
    	 GetDevice.SetRenderState( D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
    	 GetDevice.SetRenderState( D3DRS_FOGENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_SPECULARENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_LIGHTING, 0 );
    	 GetDevice.SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
    	 GetDevice.SetRenderState( D3DRS_ZWRITEENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_ZENABLE, 0 );
    	 GetDevice.SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
    
       if bStride then
        DrawTextA(20, 20, PChar('Stride: ' + IntToStr(cStride)), $FF0676CD)
       else
        DrawTextA(20, 20, PChar('Stride: ' + IntToStr(cStride)), $FFFF0000);
    
       if bNums then
        DrawTextA(20, 30, PChar('NumVertices: ' + IntToStr(cNums)), $FF0676CD)
       else
        DrawTextA(20, 30, PChar('NumVertices: ' + IntToStr(cNums)), $FFFF0000);
    
       if bPrims then
        DrawTextA(20, 40, PChar('PrimCount: ' + IntToStr(cPrims)), $FF0676CD)
       else
        DrawTextA(20, 40, PChar('PrimCount: ' + IntToStr(cPrims)), $FFFF0000);
    
       case iItem of
       0:begin
         if bStride then
          DrawTextA(8, 20, PChar('>>'), $FF0676CD)
         else
          DrawTextA(8, 20, PChar('>>'), $FFFF0000);
        end;
    
       1:begin
         if bNums then
          DrawTextA(8, 30, PChar('>>'), $FF0676CD)
         else
          DrawTextA(8, 30, PChar('>>'), $FFFF0000);
        end;
    
       2:begin
          if bPrims then
           DrawTextA(8, 40, PChar('>>'), $FF0676CD)
          else
           DrawTextA(8, 40, PChar('>>'), $FFFF0000);
         end;
       end;
    
       end;
    
       asm
        popad
       end;
    
       Result := PresentNext( Self,pSourceRect, pDestRect, hDestWindowOverride,pDirtyRegion);
    end;
    
    Function IsGameReadyForHook: Boolean;
    var
      null: variant;
    begin
    
     if (GetModuleHandleA('d3d9.dll') <> null) then
      begin
        Result := True;
      end
      else
        Result := False;
    end;
    
    function FuncMain(const LPVOID: variant): Boolean;
    begin
      while (True) do
       begin
    
        asm
         pushad;
        end;
    
        //Hide Show Stride Logger
        if (GetAsyncKeyState(VK_INSERT) <> 0) then
        begin
         bMenuOn:= Not bMenuOn;
         Sleep(100);
        end;
    
        //Strides On/Off
        if (GetAsyncKeyState(VK_NUMPAD7) <> 0) then
        begin
         bStride:= Not bStride;
         Sleep(100);
        end;
    
       //Strides On/Off
        if (GetAsyncKeyState(VK_NUMPAD8) <> 0) then
        begin
         bNums:= Not bNums;
         Sleep(100);
        end;
    
       //Strides On/Off
        if (GetAsyncKeyState(VK_NUMPAD9) <> 0) then
        begin
         bPrims:= Not bPrims;
         Sleep(100);
        end;
    
        //Increase Menu Item
        if (GetAsyncKeyState(VK_RIGHT) <> 0) then
        begin
        case iItem of
         0:begin Inc(cStride); end;
         1:begin Inc(cNums); end;
         2:begin Inc(cPrims); end;
        end;
        end;
        //Decrease Menu Item
        if (GetAsyncKeyState(VK_LEFT) <> 0) then
        begin
         case iItem of
          0:begin Dec(cStride); end;
          1:begin Dec(cNums); end;
          2:begin Dec(cPrims); end;
         end;
        end;
    
        if (GetAsyncKeyState(VK_UP) <> 0) then
        begin
         if iItem = 0 then
          iItem:= 2
         else
          Dec(iItem);
         Sleep(100);
        end;
    
        if (GetAsyncKeyState(VK_Down) <> 0) then
        begin
         if iItem = 2 then
          iItem:= 0
         else
          Inc(iItem);
         Sleep(100);
        end;
    
        Sleep(50);
    
        asm
         popad;
        end;
    
      end;
    end;
    
    Function LogThread():Dword;
    begin
     Repeat
        Sleep(500);
      Until ((IsGameReadyForHook = True) and (dwThrdMain = 0));
      dwPresent:= GetD3d9Vtable(17);
      dwReset:= GetD3d9Vtable(16);
      dwDip:= GetD3d9Vtable(82);
    
     if (Hook(Pointer(dwPresent) , @presentCallBack, @presentNext) and
         Hook(Pointer(dwReset) , @ReSeTCallBack, @ReSeTNext) and
         Hook(Pointer(dwDip) , @drawIndexedPrimitiveCallback, @drawIndexedPrimitiveNext))
      then
      begin
       CreateThread(nil, 0, @FuncMain, nil, 0, dwThrdMain);
       messagebox(0,Pchar('Hooked'),Pchar('hookedy'), mb_ok);
      end;
    
     Result:= 0;
    
    end;
    
    end.
    Last edited by Departure; 12-07-2012 at 12:00 AM. Reason: added screenshot
    DJector.Lite
    Get the advantages of new injection technology, with 1 click easy to use injector, work for all platforms x86/x64

    Download

    D-Jector
    Get the most advanced and full featured injector around, works for any game and any platform x86/x64, nothing comes even close.
    Download

  2. The Following 3 Users Say Thank You to Departure For This Useful Post:

    Saltine (12-07-2012),sasue111 (12-07-2012),The Decoder (12-16-2012)

  3. #2
    sasue111's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    :O I like it.Thank you so much
    Last edited by sasue111; 12-07-2012 at 10:45 AM.

  4. #3
    surpresso34's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    72
    Reputation
    10
    Thanks
    5
    My Mood
    Inspired
    Do I just compile this into a DLL to get it to work?

  5. #4
    Genesis's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Location
    Terra Australis
    Posts
    4,106
    Reputation
    1315
    Thanks
    2,466
    Quote Originally Posted by surpresso34 View Post
    Do I just compile this into a DLL to get it to work?
    If you don't know what to do then you shouldn't be in this section.
    helt ensam.

  6. #5
    surpresso34's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    72
    Reputation
    10
    Thanks
    5
    My Mood
    Inspired
    Quote Originally Posted by Redux View Post


    If you don't know what to do then you shouldn't be in this section.
    Well i'm sorry for asking. People have to learn somewhere :/

  7. #6
    Genesis's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Location
    Terra Australis
    Posts
    4,106
    Reputation
    1315
    Thanks
    2,466
    Quote Originally Posted by surpresso34 View Post
    Well i'm sorry for asking. People have to learn somewhere :/
    Of course, this just isn't the place.
    May i suggest to google "Learn Delphi" if you're interested in learning how to use this.
    helt ensam.

  8. #7
    JohnFame's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    Mpgh
    Posts
    528
    Reputation
    46
    Thanks
    93
    My Mood
    Buzzed
    Dephi is pretty tight!

  9. #8
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted
    Looks good, great job!
    Last edited by |-|3|_][({}PT3R12; 12-16-2012 at 10:50 AM.

  10. #9
    RobinC's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Location
    Mpgh.exe
    Posts
    1,771
    Reputation
    69
    Thanks
    3,657
    My Mood
    Aggressive
    Good code oude.

  11. #10
    JohnFame's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    Mpgh
    Posts
    528
    Reputation
    46
    Thanks
    93
    My Mood
    Buzzed
    Thanks for the great project

Similar Threads

  1. [Discussion] Stride logger ?!?
    By kmanev073 in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 6
    Last Post: 09-30-2012, 11:55 AM
  2. [leech] stride logger d3d9 source
    By supercarz1991 in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 13
    Last Post: 09-06-2010, 09:24 PM
  3. [RELEASE] Stride Logger
    By J in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 47
    Last Post: 08-10-2010, 01:41 AM
  4. Replies: 6
    Last Post: 04-22-2010, 03:56 AM
  5. [Release] Stride Logger
    By [Jesuz] in forum K.O.S. Secret Operation Hacks
    Replies: 13
    Last Post: 01-30-2010, 01:30 AM