Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Capevaldo's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    CWBeats
    Posts
    5,518
    Reputation
    242
    Thanks
    1,145
    My Mood
    Drunk
    Still having this problem?
    GodHack will help you with this post!
    Last edited by Capevaldo; 11-19-2010 at 01:14 PM.

  2. #17
    CanYouDoIt's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    pau
    Posts
    49
    Reputation
    10
    Thanks
    3
    I know I need to lear C++...
    Ah, here is my DirectX.cpp and .h

    DirectX.cpp

    [php]#include "DirectX.h"
    #include "Menu.h"

    oReset pReset;
    oPresent pPresent;

    cDirectx Directx;
    LPDIRECT3DDEVICE9 g_pDevice = 0;

    void refont( LPDIRECT3DDEVICE9 pDevice)
    {

    if (g_pDevice != pDevice)
    {
    g_pDevice = pDevice;

    try
    {
    if (Directx.pFont != 0)
    Directx.pFont->Release();
    } catch (...) {}
    Directx.pFont = 0;
    D3DXCreateFont(pDevice, 15, 0, 350, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx.pFont );
    }

    if (g_pDevice != pDevice)
    {
    g_pDevice = pDevice;
    try
    {
    if (Directx.pFont2 != 0)
    Directx.pFont2->Release();
    } catch (...) {}
    Directx.pFont2 = 0;
    D3DXCreateFont(pDevice, 18, 0, 700, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Black", &Directx.pFont2 );
    }
    }

    void cDirectx:rawTri(LPDIRECT3DDEVICE9 dev, int x, int y, int w, int h, DWORD Color)
    {
    D3DRECT BarRect = { x, y, x + w, y + h };
    dev->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Color, 0, 0);
    }

    void cDirectx:rawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...)
    {
    RECT FontPos = { x, y, x + 120, y + 16 };
    char buf[1024] = {'\0'};
    va_list va_alist;

    va_start(va_alist, fmt);
    vsprintf_s(buf, fmt, va_alist);
    va_end(va_alist);

    g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
    }


    //Credits to Azorbix i think
    HRESULT cDirectx::GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex,NULL)) )
    return E_FAIL;

    WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
    |(WORD)(((colour32>>20)&0xF)<<8)
    |(WORD)(((colour32>>12)&0xF)<<4)
    |(WORD)(((colour32>>4)&0xF)<<0);

    D3DLOCKED_RECT d3dlr;
    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    WORD *pDst16 = (WORD*)d3dlr.pBits;

    for(int xy=0; xy < 8*8; xy++)
    *pDst16++ = colour16;

    (*ppD3Dtex)->UnlockRect(0);

    return S_OK;
    }

    HRESULT WINAPI gellReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
    {
    Sprite->OnLostDevice();
    Directx.pFont->OnLostDevice();
    Directx.pFont2->OnLostDevice();

    HRESULT hRet = pReset(pDevice, pPresentationParameters);

    Sprite->OnResetDevice();
    Directx.pFont->OnResetDevice();
    Directx.pFont2->OnResetDevice();

    return hRet;
    }

    HRESULT WINAPI gellPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
    {
    Base.RenderFrame(pDevice);

    return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
    }

    void cDirectx::Hook(void)
    {
    DWORD Reset = Base.GetPointer(16);
    DWORD Present = Base.GetPointer(17);

    pReset = (oReset) DetourCreate(( BYTE* )Reset, ( BYTE* )gellReset );
    pPresent = (oPresent) DetourCreate(( BYTE* )Present, ( BYTE* )gellPresent );
    }
    [/php]

    DirectX.h

    [php]#ifndef __DIRECTX_H__
    #define __DIRECTX_H__

    #pragma once

    #include "Files.h"

    typedef HRESULT ( WINAPI* oPresent ) ( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion);
    typedef HRESULT ( WINAPI* oReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );

    class cDirectx{
    public:
    LPD3DXFONT pFont;
    LPD3DXFONT pFont2;
    void Hook(void);
    void DrawTri(LPDIRECT3DDEVICE9 dev, int x, int y, int w, int h, DWORD Color);
    void DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...);
    HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32);

    };

    extern cDirectx Directx;

    #endif

    [/php]

  3. #18
    Decoder back's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    197
    Reputation
    28
    Thanks
    112
    Quote Originally Posted by CanYouDoIt View Post
    I know I need to lear C++...
    Ah, here is my DirectX.cpp and .h

    DirectX.cpp

    [php]#include "DirectX.h"
    #include "Menu.h"

    oReset pReset;
    oPresent pPresent;

    cDirectx Directx;
    LPDIRECT3DDEVICE9 g_pDevice = 0;

    void refont( LPDIRECT3DDEVICE9 pDevice)
    {

    if (g_pDevice != pDevice)
    {
    g_pDevice = pDevice;

    try
    {
    if (Directx.pFont != 0)
    Directx.pFont->Release();
    } catch (...) {}
    Directx.pFont = 0;
    D3DXCreateFont(pDevice, 15, 0, 350, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx.pFont );
    }

    if (g_pDevice != pDevice)
    {
    g_pDevice = pDevice;
    try
    {
    if (Directx.pFont2 != 0)
    Directx.pFont2->Release();
    } catch (...) {}
    Directx.pFont2 = 0;
    D3DXCreateFont(pDevice, 18, 0, 700, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Black", &Directx.pFont2 );
    }
    }

    void cDirectx:rawTri(LPDIRECT3DDEVICE9 dev, int x, int y, int w, int h, DWORD Color)
    {
    D3DRECT BarRect = { x, y, x + w, y + h };
    dev->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Color, 0, 0);
    }

    void cDirectx:rawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...)
    {
    RECT FontPos = { x, y, x + 120, y + 16 };
    char buf[1024] = {'\0'};
    va_list va_alist;

    va_start(va_alist, fmt);
    vsprintf_s(buf, fmt, va_alist);
    va_end(va_alist);

    g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
    }


    //Credits to Azorbix i think
    HRESULT cDirectx::GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex,NULL)) )
    return E_FAIL;

    WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
    |(WORD)(((colour32>>20)&0xF)<<8)
    |(WORD)(((colour32>>12)&0xF)<<4)
    |(WORD)(((colour32>>4)&0xF)<<0);

    D3DLOCKED_RECT d3dlr;
    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    WORD *pDst16 = (WORD*)d3dlr.pBits;

    for(int xy=0; xy < 8*8; xy++)
    *pDst16++ = colour16;

    (*ppD3Dtex)->UnlockRect(0);

    return S_OK;
    }

    HRESULT WINAPI gellReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
    {
    Sprite->OnLostDevice();
    Directx.pFont->OnLostDevice();
    Directx.pFont2->OnLostDevice();

    HRESULT hRet = pReset(pDevice, pPresentationParameters);

    Sprite->OnResetDevice();
    Directx.pFont->OnResetDevice();
    Directx.pFont2->OnResetDevice();

    return hRet;
    }

    HRESULT WINAPI gellPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
    {
    Base.RenderFrame(pDevice);

    return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
    }

    void cDirectx::Hook(void)
    {
    DWORD Reset = Base.GetPointer(16);
    DWORD Present = Base.GetPointer(17);

    pReset = (oReset) DetourCreate(( BYTE* )Reset, ( BYTE* )gellReset );
    pPresent = (oPresent) DetourCreate(( BYTE* )Present, ( BYTE* )gellPresent );
    }
    [/php]

    DirectX.h

    [php]#ifndef __DIRECTX_H__
    #define __DIRECTX_H__

    #pragma once

    #include "Files.h"

    typedef HRESULT ( WINAPI* oPresent ) ( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion);
    typedef HRESULT ( WINAPI* oReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );

    class cDirectx{
    public:
    LPD3DXFONT pFont;
    LPD3DXFONT pFont2;
    void Hook(void);
    void DrawTri(LPDIRECT3DDEVICE9 dev, int x, int y, int w, int h, DWORD Color);
    void DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...);
    HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32);

    };

    extern cDirectx Directx;

    #endif

    [/php]
    i think he have only the base , not the source with everything !
    Last edited by Decoder back; 11-19-2010 at 02:11 PM.

  4. #19
    GodHack2's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    645
    Reputation
    38
    Thanks
    762
    My Mood
    Amused
    Quote Originally Posted by CanYouDoIt View Post
    I know I need to lear C++...
    Ah, here is my DirectX.cpp and .h

    DirectX.cpp

    [php]#include "DirectX.h"
    #include "Menu.h"

    oReset pReset;
    oPresent pPresent;

    cDirectx Directx;
    LPDIRECT3DDEVICE9 g_pDevice = 0;

    void refont( LPDIRECT3DDEVICE9 pDevice)
    {

    if (g_pDevice != pDevice)
    {
    g_pDevice = pDevice;

    try
    {
    if (Directx.pFont != 0)
    Directx.pFont->Release();
    } catch (...) {}
    Directx.pFont = 0;
    D3DXCreateFont(pDevice, 15, 0, 350, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx.pFont );
    }

    if (g_pDevice != pDevice)
    {
    g_pDevice = pDevice;
    try
    {
    if (Directx.pFont2 != 0)
    Directx.pFont2->Release();
    } catch (...) {}
    Directx.pFont2 = 0;
    D3DXCreateFont(pDevice, 18, 0, 700, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial Black", &Directx.pFont2 );
    }
    }

    void cDirectx:rawTri(LPDIRECT3DDEVICE9 dev, int x, int y, int w, int h, DWORD Color)
    {
    D3DRECT BarRect = { x, y, x + w, y + h };
    dev->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Color, 0, 0);
    }

    void cDirectx:rawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...)
    {
    RECT FontPos = { x, y, x + 120, y + 16 };
    char buf[1024] = {'\0'};
    va_list va_alist;

    va_start(va_alist, fmt);
    vsprintf_s(buf, fmt, va_alist);
    va_end(va_alist);

    g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
    }


    //Credits to Azorbix i think
    HRESULT cDirectx::GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex,NULL)) )
    return E_FAIL;

    WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
    |(WORD)(((colour32>>20)&0xF)<<8)
    |(WORD)(((colour32>>12)&0xF)<<4)
    |(WORD)(((colour32>>4)&0xF)<<0);

    D3DLOCKED_RECT d3dlr;
    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    WORD *pDst16 = (WORD*)d3dlr.pBits;

    for(int xy=0; xy < 8*8; xy++)
    *pDst16++ = colour16;

    (*ppD3Dtex)->UnlockRect(0);

    return S_OK;
    }

    HRESULT WINAPI gellReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
    {
    Sprite->OnLostDevice();
    Directx.pFont->OnLostDevice();
    Directx.pFont2->OnLostDevice();

    HRESULT hRet = pReset(pDevice, pPresentationParameters);

    Sprite->OnResetDevice();
    Directx.pFont->OnResetDevice();
    Directx.pFont2->OnResetDevice();

    return hRet;
    }

    HRESULT WINAPI gellPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion)
    {
    Base.RenderFrame(pDevice);

    return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
    }

    void cDirectx::Hook(void)
    {
    DWORD Reset = Base.GetPointer(16);
    DWORD Present = Base.GetPointer(17);

    pReset = (oReset) DetourCreate(( BYTE* )Reset, ( BYTE* )gellReset );
    pPresent = (oPresent) DetourCreate(( BYTE* )Present, ( BYTE* )gellPresent );
    }
    [/php]

    DirectX.h

    [php]#ifndef __DIRECTX_H__
    #define __DIRECTX_H__

    #pragma once

    #include "Files.h"

    typedef HRESULT ( WINAPI* oPresent ) ( LPDIRECT3DDEVICE9 pDevice, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion);
    typedef HRESULT ( WINAPI* oReset )( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters );

    class cDirectx{
    public:
    LPD3DXFONT pFont;
    LPD3DXFONT pFont2;
    void Hook(void);
    void DrawTri(LPDIRECT3DDEVICE9 dev, int x, int y, int w, int h, DWORD Color);
    void DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...);
    HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32);

    };

    extern cDirectx Directx;

    #endif

    [/php]
    you don't even have the function DetourCreate O.o





    beat this bitches ^^^^^^^

    Current Stats : Bored :/


    Respect list :
    Crash !
    Gordon'
    Markoj

  5. #20
    CanYouDoIt's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    pau
    Posts
    49
    Reputation
    10
    Thanks
    3
    Quote Originally Posted by GodHack2 View Post
    you don't even have the function DetourCreate O.o
    I'll need to create this function?

    /Fuck.

  6. #21
    whatup777's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    CA Source Code Section
    Posts
    4,030
    Reputation
    147
    Thanks
    351
    My Mood
    Dead
    Learn what your doing
    Quotes I live by.


    A foolish person learns from his mistakes, I wise person learns from others.
    Quote Originally Posted by AVGN View Post



    mhm

    i live in texas

    i was at the grocery store with my son. He saw a mexican guy, and he said "Look daddy! a mower man!"

    he's 4 yrs old

  7. #22
    GodHack2's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    645
    Reputation
    38
    Thanks
    762
    My Mood
    Amused
    Quote Originally Posted by CanYouDoIt View Post
    I'll need to create this function?

    /Fuck.
    you should probably learn the basics first b4 going into "game hacking"
    because if you didn't have that function your error will be DetourCreate is undefined
    so you do have that function but you just miss placed it





    beat this bitches ^^^^^^^

    Current Stats : Bored :/


    Respect list :
    Crash !
    Gordon'
    Markoj

  8. #23
    CanYouDoIt's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    pau
    Posts
    49
    Reputation
    10
    Thanks
    3
    Well, my english isn't good to read english books of C++.
    The brazilian books are totally the same thing, show how you create "Hello Word", and explain the functions of this "command".
    And i search for VC++ books, and i failed.
    So, I can't study by the internet.

  9. #24
    Gordon`'s Avatar
    Join Date
    Dec 2007
    Gender
    male
    Posts
    283
    Reputation
    24
    Thanks
    325
    did you read my post? i said you dont have the function detourcreate in your project. you may have somewhere "extern void* DetourCreate(...)" and thats why it causing the linker error (you told the compiler the function exists, but it doesnt). otherwise the compiler would say the function doesnt exist.

    seriously, stop coding


  10. #25
    Nubzgetkillz's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    hacktown
    Posts
    838
    Reputation
    13
    Thanks
    411
    My Mood
    Amazed
    Quote Originally Posted by Gordon` View Post
    did you read my post? i said you dont have the function detourcreate in your project. you may have somewhere "extern void* DetourCreate(...)" and thats why it causing the linker error (you told the compiler the function exists, but it doesnt). otherwise the compiler would say the function doesnt exist.

    seriously, stop coding
    /facepalm

    Lol This site is awesome

    Member since September 25, 2010

    Current Objectives:
    • Graduate college with a degree in Computer Science
    • Find a decent job in the Computer Science Field
    • Learn more programming languages

    Looking for Elo Boosting Job - League of Legends
    Looking for Bronze -> Gold Jobs


    Skype: whatthedream

  11. #26
    o-o's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    who reading that ? T_T
    Posts
    682
    Reputation
    10
    Thanks
    307
    My Mood
    Cold
    Lol just add this to Detours.h :
    [php]void *DetourCreate(BYTE *src, const BYTE *dst, const int minlen=0);[/php]

    And This To Detours.cpp :
    [php]void *DetourCreate(BYTE *src, const BYTE *dst, int minlen)
    {
    BYTE *jmp, *org;
    DWORD dwBack;
    int len;

    len=DetourASMlen(src,(minlen<6)?6:minlen);
    if (len==0 && minlen>=6) len=minlen;
    if (len==0) return 0;

    org=jmp = (BYTE*)malloc(len+5+1); // room for nobytes + jmplen + size byte
    jmp[0]=len; // save length in first byte
    jmp++;

    VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
    memcpy(jmp, src, len);
    jmp += len;
    jmp[0] = 0xE9;
    *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;

    src[0] = 0x68; // different hook, push address ret
    *(DWORD*)(src+1) = (DWORD)(dst);
    src[5] = 0xc3;
    for (int i=6; i<len; i++) src[i] = 0x90;
    VirtualProtect(src, len, dwBack, &dwBack);

    return &org[1]; // return entry point, byte 0 = length
    }[/php]

    100% Works .. So simple error 2 fix ..

    Happy Hanukkah For All Of MPGH !


    The Real Life Are Better Then A Game !


    Song :[YOUTUBE]vgKBOkvO5N0&feature=player_embedded[/YOUTUBE]
    Best Friends :

    Hax4Life!

    Solify

    [MPGH]Drake`

    Respect Them Or I'll Kill You ...



  12. The Following User Says Thank You to o-o For This Useful Post:

    [_] (11-20-2010)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [Help Request] HELP... ANOTHER COMBAT ARMS ERROR :O
    By luiz408 in forum Combat Arms Help
    Replies: 13
    Last Post: 06-02-2011, 02:47 AM
  2. {HELP} script compile error
    By pizza127 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 3
    Last Post: 10-22-2010, 12:16 PM
  3. [Help]Script compile error.(rules readed this time)
    By GBot! in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 11
    Last Post: 08-15-2010, 09:33 AM
  4. Help WarRock compile error
    By djxorwkd11 in forum C++/C Programming
    Replies: 2
    Last Post: 03-08-2010, 08:37 AM
  5. [HELP] making UCE compile error
    By herowarz in forum Suggestions, Requests & Help
    Replies: 6
    Last Post: 02-03-2008, 01:35 AM