d3d hook

Trou

Известный
Автор темы
31
33
Hi, I Have A Issue About D3D Render It's Works But When I Did Alt Tab After Came Back Game Not Appears/Render But Game Working In Background. Whats My Mistake?

Код:
void InitHook()

{
    void** vTableDevice = *(void***)(*(DWORD*)0xC97C28);
    VMTHookManager* vmtHooks = new VMTHookManager(vTableDevice);
    hPresent = (_Present)vmtHooks->Hook(17, (void*)Present);
    hReset = (_Reset)vmtHooks->Hook(16, (void*)Reset);
 
    pRender = new CD3DRender(128);
}


Код:
HRESULT WINAPI Present(IDirect3DDevice9* m_pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hdest, const RGNDATA *pDirtyRegion)
{
    if (!_pD3D)
    {
        if (pRender->Initialize(m_pDevice) == S_OK)
            _pD3D = true;        
    }
    else
    {
        pRender->D3DBox(0, 0, 100, 100, D3DCOLOR_ARGB(255, 255, 255, 255));
   
    }
 
    return hPresent(m_pDevice, pSourceRect, pDestRect, hdest, pDirtyRegion);
}

Its Happens After Initalize
Код:
pRender->Initialize(m_pDevice)


Код:
HRESULT CD3DRender::Initialize ( IDirect3DDevice9 *pD3Ddev )
{
    if (!m_canRender)
    {
        if (FAILED(CD3DBaseRender::Initialize(pD3Ddev)))
            return E_FAIL;
        if (FAILED(m_pD3Ddev->CreateVertexBuffer(m_maxVertex * sizeof(d3dvertex_s),
            D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0, D3DPOOL_DEFAULT, &m_pD3Dbuf, NULL)))
            return E_FAIL;

        m_canRender = true;
    }

    return S_OK;
}
 
Последнее редактирование: