Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh

    [HELP]Drawing a crosshair

    Well after followed the HD's tut I found the pointer to the CreateDevice. But it won't draw my corsshair.

    This is what I do:
    Code:
    void (*oEndScene)(void);
    
    void DrawCrosshair(IDirect3DDevice9 *pDevice)
    {
    	D3DRECT pRect1;
    	int x1 = ((GetSystemMetrics( 0 )) / 2) - 35;
    	int x2 = ((GetSystemMetrics( 0 )) / 2) + 35;
    	int y1 = ((GetSystemMetrics( 1 )) / 2) - 5;
    	int y2 = ((GetSystemMetrics( 1 )) / 2) + 5;
    	pRect1.x1 = x1;
    	pRect1.x2 = x2;
    	pRect1.y1 = y1;
    	pRect1.y2 = y2;
    	pDevice->Clear(0, &pRect1, 0, (D3DCOLOR_XRGB(255, 0, 0)), 0, 0);
    	D3DRECT pRect2;
    	int aX = ((GetSystemMetrics( 0 )) / 2) - 5;
    	int aX2 = ((GetSystemMetrics( 0 )) / 2) + 5;
    	int aY = ((GetSystemMetrics( 1 )) / 2) - 35;
    	int aY2 = ((GetSystemMetrics( 1 ) / 2)) + 35;
    	pDevice->Clear(0, &pRect2, 0, (D3DCOLOR_XRGB(255, 0, 0)), 0, 0);
    }
    
    void xEndScene(void)
    {
           	oEndScene();
    
    	IDirect3DDevice9 *pDevice = *(IDirect3DDevice9**)0x6737268;
    
    	DrawCrosshair(pDevice);
    }
    Now this is the thread that I add in the process (iw4mp.dat):
    Code:
    void ShakeBaby(void)
    {
    	oEndScene = (void (__cdecl *)(void))DetourFunction((PBYTE)0x586E00, (PBYTE)xEndScene);
    	while(1) Sleep(10);
    }
    Please help me, the game doesn't crash but it simply won't draw my crosshair.

  2. #2
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    What's oEndScene? If that finalizes the rendering, you should call it _after_ you render your crosshair, because the game, should in theory, be about to finalize the rendering when calling xEndScene, and so it would make sense to draw there and then finalize.

    Also, you shouldn't be clearing the screen if you're rendering over an existing frame.

    AFAIK, you don't seem to be initilizing pRect2 either.

    Why don't you just initilize a basic vertex buffer and draw a line-list on the near-plane? I see what you're trying to do with the clear member function of the device but it's a bit of an odd route to take.
    Last edited by radnomguywfq3; 04-13-2011 at 08:48 AM.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  3. #3
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh

    Gonna try.....

  4. #4
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Code:
    void ShakeBaby(void)
    {
    	oEndScene = (void (__cdecl *)(void))DetourFunction((PBYTE)0x586E00, (PBYTE)xEndScene);
    	while(1) Sleep(10);
    }
    That just means you set oEndScene, and suspend the thread forever...

    You aren't actually drawing anything at all.

    Logic please.

  5. The Following User Says Thank You to freedompeace For This Useful Post:

    [MPGH]master131 (04-14-2011)

  6. #5
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Quote Originally Posted by freedompeace View Post
    Code:
    void ShakeBaby(void)
    {
        oEndScene = (void (__cdecl *)(void))DetourFunction((PBYTE)0x586E00, (PBYTE)xEndScene);
        while(1) Sleep(10);
    }
    That just means you set oEndScene, and suspend the thread forever...

    You aren't actually drawing anything at all.

    Logic please.
    It depends on what calls ShakeBaby(). I assume he created a thread, and, for some reason, wants to keep it alive (probably not a good one though.) If he hooks the render routine it will be called by the targets thread and so his thread doesn't even need to continue after execution.

    Btw you need to call DetourCommit after DetourTransactionBegin();

    DetourTransactionBegin();
    Detour the functions here
    DetourTransactionCommit();

    If you have a handle to the executing thread, you should also call
    DetourUpdateThread before commiting.

    SO if you want to use the clear screen method, you can use that. I bet that's the reason your cross hair wasn't rendering.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  7. #6
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    My bad . <<
    Last edited by freedompeace; 04-14-2011 at 06:35 PM.

  8. #7
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by freedompeace View Post
    which would logically lead to the result of his crosshair not being drawn.
    If he successfully detours it will still draw since it's a seperate thread from the one he suspended
    Ah we-a blaze the fyah, make it bun dem!

  9. #8
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Well everything that I draw using the game engine, appears while in game. Anyways...
    @Jetamay
    Those Detour function can't be found at my detorus.h.

    EDIT:
    LOL! I forgot to init. the pRect2.

    Now I realized it. Feel so much asleep. -_-
    Last edited by ♪~ ᕕ(ᐛ)ᕗ; 04-14-2011 at 06:38 AM.

  10. #9
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    MS Detours 1.5 doesn't have DetourTransactionBegin and Commit, so you're fine =P
    Ah we-a blaze the fyah, make it bun dem!

  11. #10
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Quote Originally Posted by Hell_Demon View Post
    MS Detours 1.5 doesn't have DetourTransactionBegin and Commit, so you're fine =P
    I really have 1.5? :O

  12. #11
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Most likely
    Ah we-a blaze the fyah, make it bun dem!

  13. #12
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Quote Originally Posted by Hell_Demon View Post
    Most likely
    I feel kinda embarrassed.

    EDIT:
    Aww I installed 2.1 since 3.00 is not free. But I simply can't find em.
    Last edited by ♪~ ᕕ(ᐛ)ᕗ; 04-14-2011 at 09:45 AM.

  14. #13
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    Quote Originally Posted by Play&Win View Post


    I feel kinda embarrassed.

    EDIT:
    Aww I installed 2.1 since 3.00 is not free. But I simply can't find em.
    Google Detours express 1.5 and you will see them posted on UC ...

  15. #14
    ♪~ ᕕ(ᐛ)ᕗ's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Uterus
    Posts
    9,119
    Reputation
    1096
    Thanks
    1,970
    My Mood
    Doh
    Quote Originally Posted by whit View Post
    Google Detours express 1.5 and you will see them posted on UC ...
    I need an updated version. Not 1.5.

    EDIT:
    Well it' now fixed. But it says that DetourFunction is undefined. -.-
    I tried to put it on the detours.h, but it still won't work.
    Last edited by ♪~ ᕕ(ᐛ)ᕗ; 04-14-2011 at 12:21 PM.

  16. #15
    aanthonyz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Hitler's Minivan
    Posts
    483
    Reputation
    27
    Thanks
    83
    My Mood
    Relaxed
    What about the library file for Detours?
    "The best way to predict your future is to create it."

    Contributions I made:

    DirectX E-Books
    Hacking Tools
    Hacking into a PC

    Need Help?
    Send me a PM, or send me a email at : aanthonyz10@gmail.com

    Click My Dragon:


Page 1 of 2 12 LastLast