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

    Delphi - D3d CrossHair

    After many hours trying to get D3d functions working in delphi finally worked it out. When I first came to this forum I couldn't find anything related to d3d in delphi, after searching many months, days, hours on google looking for something in delphi for d3d I decided to bite the bullet and try it my self with assistance from some C++ examples. Here is a simple CrossHair , I know you guys find nothing special about this as its common in C++, but us delphi users never have any examples to learn from so this is kinda a big step towards D3D hack menus in Delphi.

    XHair:
    [highlight=delphi]
    procedure DrawXhair (const Device: IDirect3DDevice9; color: D3DCOLOR);
    var
    viewP: D3DVIEWPORT9;
    ScreenCenterX,ScreenCenterY: DWORD;
    rec1,rec2: D3DRECT;
    begin
    // Get screen
    Device.GetViewport(viewP);
    ScreenCenterX:= ((viewP.Width div 2) - 1);
    ScreenCenterY:= ((viewP.Height div 2) - 1);
    //Set xhair params
    rec1.x1:= ScreenCenterX-20;
    rec1.y1:= ScreenCenterY;
    rec1.x2:= ScreenCenterX+ 20;
    rec1.y2:= ScreenCenterY+1;
    rec2.x1:= ScreenCenterX;
    rec2.y1:= ScreenCenterY-20;
    rec2.x2:= ScreenCenterX+ 1;
    rec2.y2:= ScreenCenterY+20;
    //Draw crosshair
    Device.Clear(1, @rec1, D3DCLEAR_TARGET, color, 0, 0);
    Device.Clear(1, @rec2, D3DCLEAR_TARGET, color, 0, 0);
    end;
    [/highlight]

    Example Use:
    [highlight=delphi]
    function PresentCallBack(const Self: IDirect3DDevice9; pSourceRect, pDestRect: PRect; hDestWindowOverride: HWND; pDirtyRegion: PRgnData): HResult; stdcall;
    begin
    asm
    pushad
    end;
    pD3Ddev:= Pointer(Self);
    //Write Some Text
    WriteText(pD3Ddev, 'Test');
    //Draw a crosshair($0000ffff = Blue)
    DrawXhair(Self,$0000ffff); //$ffff0000 <-- Red
    asm
    popad
    end;
    Result := PresentNext( Self,pSourceRect, pDestRect, hDestWindowOverride,pDirtyRegion);
    end;
    [/highlight]


    I hope it saves some delphi coder some time so they dont have spend months searching...

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

    [MPGH]flameswor10 (05-07-2011),markoj (05-07-2011),pashak (05-06-2011),Stephen (05-07-2011),The Real Red (06-05-2013)

  3. #2
    pashak's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Posts
    350
    Reputation
    29
    Thanks
    42
    holy shit
    way to go Departure

  4. The Following User Says Thank You to pashak For This Useful Post:

    The Real Red (06-07-2013)

  5. #3
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    A small update to have multiple colors, Just adding the following to your unit

    Code:
    var
     iXColor : Integer = 0;
    
    const
      bXColors : array[0..7] of DWord = ($0,$FFA34674,$FF6746A3,$FF6D8CF3,$FF238240,$FFE5dC73,$FFCB7018,$FFA90A0A);
    Change to this in Present....
    Code:
    DrawXhair(Self,bXColors[iXColor]);
    Now have a thread monotoring for keystrokes(this one will use the Add key on the number Pad)....
    Code:
    if (GetAsyncKeyState(VK_ADD) <> 0) then
        begin
          Inc(iXColor);
          iXColor:= iXColor mod 8;
          sleep(10);
        end;
    Use the "+" on NumberPad to cycle through the different colour crosshairs

  6. The Following User Says Thank You to Departure For This Useful Post:

    The Real Red (06-07-2013)

  7. #4
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,404
    My Mood
    In Love
    Holy crap dude..
    It's fking epic
    No I do not make game hacks anymore, please stop asking.


    Been MPGH Minion: 6 July 2011 - 1 August 2012

  8. #5
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    Im sure your just being sarcastic, Anyway I am in the process of making a Menu Unit, I think I got this D3D stuff pimped, Drawing Alpha blended boxes now should have a nice little demo menu by tomorrow code in Delphi.....

    I am going to start looking at adding images after I have done a basic menu, D3D supports alpha blending so there is no reason why it shouldn't load a .png and display it..

  9. #6
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,404
    My Mood
    In Love
    Quote Originally Posted by Departure View Post
    Im sure your just being sarcastic, Anyway I am in the process of making a Menu Unit, I think I got this D3D stuff pimped, Drawing Alpha blended boxes now should have a nice little demo menu by tomorrow code in Delphi.....

    I am going to start looking at adding images after I have done a basic menu, D3D supports alpha blending so there is no reason why it shouldn't load a .png and display it..
    @Departure
    Good luck dude.
    And I was not being sarcastic.
    I never thought Delphi can do that
    Last edited by flameswor10; 05-07-2011 at 07:36 AM.
    No I do not make game hacks anymore, please stop asking.


    Been MPGH Minion: 6 July 2011 - 1 August 2012

  10. #7
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    Delphi can do everything that C++ can do except for driver development, But saying that there are SDK's for delphi to build drivers. Yeah its ashame there is no resources out there for Delphi d3d hacks it seems everyone turns to C++ when it comes D3D. Hopefully I can get a well coded base released with lots of comments to encourage other Delphi users to make these...

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

    [MPGH]flameswor10 (05-07-2011),The Real Red (06-07-2013)

  12. #8
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,690
    Reputation
    184
    Thanks
    1,147
    My Mood
    Aggressive
    Quote Originally Posted by Departure View Post
    Delphi can do everything that C++ can do except for driver development, But saying that there are SDK's for delphi to build drivers. Yeah its ashame there is no resources out there for Delphi d3d hacks it seems everyone turns to C++ when it comes D3D. Hopefully I can get a well coded base released with lots of comments to encourage other Delphi users to make these...
    Making me read Delphi books now. .

  13. #9
    Strikex's Avatar
    Join Date
    Dec 2010
    Gender
    male
    Posts
    1,311
    Reputation
    9
    Thanks
    350
    My Mood
    Relaxed
    Nice Bro ...

  14. #10
    °Devil's Avatar
    Join Date
    May 2011
    Gender
    male
    Posts
    3
    Reputation
    9
    Thanks
    0
    My Mood
    Devilish
    Making me read Delphi books now.

  15. #11
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    Yay... converting people to delphi, Actually if you think about it using delphi to code your hacks is original and no one can say you stole there hacks ect, also has the less detected side effect due to the way delphi compiles...

  16. The Following User Says Thank You to Departure For This Useful Post:

    The Real Red (06-07-2013)

  17. #12
    killbunny51's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    At my computer screen.
    Posts
    46
    Reputation
    10
    Thanks
    32
    D*mn thats good! *begins searching Delphi tutorials*


    My TO-DO list
    Yes= No=
    Make a hack:
    Make my hack WORK: (kind of, it crashed every 5 mins, but it did work )
    Get called a hacker while hacking:
    Get Called a hacker while legit:
    Get banned for hacking(CA,CF,MS,RS):
    Get 10 posts:
    50:
    100:
    500:
    1000:

    Proud member of the High Council of Time Lords

  18. #13
    Se lutar tú vai além, humilde igual Jesus.
    MPGH Member
    Turbulence's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    2,182
    Reputation
    10
    Thanks
    741
    My Mood
    Pensive
    Nice...


    Epic Delphi =}