Вопрос Как запихнуть код в осирис?

Начинающий
Статус
Оффлайн
Регистрация
1 Мар 2022
Сообщения
2
Реакции[?]
0
Поинты[?]
0
дратуте на форуме осириса нашел хуйню с обс бупасом но хз как его установить поможете?
вот код
Код:
//HOOGS
 
oDraw = (DrawFn)HD3D9->HookFunction((DWORD)Draw, 82);
 
oPresent = (Steam overlay or after PRESENT DSNT MATR)
 
    oReset
    = (RESET OUR SHIT)
 
        draw_points_ret_addr
    = (void*)(FindPattern(XorStr("studiorender.dll"), XorStr("8B 7D FC 03 F8")));
(Thanks to one guy from this forum, because counting vertex taking too much time daum)
 
    struct CUSTOMVERTEX {
    FLOAT x, y, z, r, h, w;
};
#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_TEX1)
 
LPDIRECT3DTEXTURE9 pTexturer;
LPDIRECT3DTEXTURE9 pTexturey;
IDirect3DBaseTexture9* deftexture;
IDirect3DBaseTexture9* deftexture2;
 
const BYTE bRed[60] = { 0x42, 0x4D, 0x3C, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00,
    0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x0B,
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
    0x00, 0x01 };
const BYTE bYellow[60] = { 0x42, 0x4D, 0x3C, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00,
    0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x0B,
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00,
    0x00, 0x01 };
 
IDirect3DStateBlock9* ppSB = nullptr;
DWORD oldz;
 
IDirect3DPixelShader9* pixelshader = NULL;
LPDIRECT3DTEXTURE9 sil_texture = NULL;
IDirect3DSurface9* ppSurfaceLevel = NULL;
IDirect3DPixelShader9* sil_ps = nullptr;
 
IDirect3DPixelShader9* oldpixelshader;
IDirect3DSurface9* oldrendersurface;
IDirect3DSurface9* oldrendersurface2;
 
IDirect3DSurface9* backbuffer = NULL;
D3DSURFACE_DESC desc;
 
IDirect3DVertexBuffer9* v_buffer = NULL; // the pointer to the vertex buffer
 
HRESULT Generate(LPDIRECT3DDEVICE9 pDevice)
{
 
    D3DCAPS9 caps;
 
    int major_vs, minor_vs;
    int major_ps, minor_ps;
    pDevice->GetDeviceCaps(&caps);
 
    DWORD VERSPX1 = D3DSHADER_VERSION_MAJOR(caps.PixelShaderVersion);
    DWORD VERSPX2 = D3DSHADER_VERSION_MINOR(caps.PixelShaderVersion);
 
    char szVersion[32];
    sprintf(szVersion, "ps_%d_%d", VERSPX1, VERSPX2);
 
    char szShader[256];
    sprintf(szShader, "%s \n mov oC0, c0", szVersion);
 
    ID3DXBuffer* pShaderBuf = NULL;
 
    D3DXAssembleShader(szShader, sizeof(szShader), NULL, NULL, 0, &pShaderBuf, NULL);
    if (pShaderBuf)
        pDevice->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), &pixelshader);
 
    pDevice->GetRenderTarget(0, &backbuffer);
    backbuffer->GetDesc(&desc);
    backbuffer->Release();
 
    pDevice->CreateTexture(desc.Width, desc.Height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &sil_texture, NULL);
    sil_texture->GetSurfaceLevel(0, &ppSurfaceLevel);
 
    pDevice->CreateVertexBuffer(4 * sizeof(CUSTOMVERTEX),
        0,
        CUSTOMFVF,
        D3DPOOL_MANAGED,
        &v_buffer,
        NULL);
 
    return S_OK;
}
 
void DrawRect(LPDIRECT3DDEVICE9 pDevice, int x1, int y1, int x2, int y2, BYTE r, BYTE g, BYTE b)
{
 
    pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
    pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
 
    D3DRECT BarRect;
    D3DCOLOR Cor;
 
    BarRect.x1 = x1;
    BarRect.x2 = x2;
    BarRect.y1 = y1;
    BarRect.y2 = y2;
 
    Cor = 0x00000000;
 
    pDevice->Clear(1, &BarRect, D3DCLEAR_TARGET || D3DCLEAR_ZBUFFER, Cor, 0, 0);
}
 
/*********************/
void* draw_points_ret_addr;
DWORD old_zenable;
void* traverse_stack(void** ebp)
{
    if (ebp == nullptr)
        return nullptr;
 
    auto** next = *(void***)(ebp);
    if (ebp[1] == draw_points_ret_addr)
        return next[4];
 
    return traverse_stack(next);
}
 
void* get_ent()
{
    auto data = 0;
    __asm {
mov data, ebp
    }
    return traverse_stack((void**)(data));
}
IDirect3DStateBlock9* pStateBlock = NULL;
HRESULT WINAPI Draw(LPDIRECT3DDEVICE9 pDev,
    D3DPRIMITIVETYPE PrimType, INT BaseVertexIndex, UINT MinVertexIndex,
    UINT NumVertices, UINT startIndex, UINT PrimitiveCount)
{
 
    oDraw(pDev, PrimType, BaseVertexIndex,
        MinVertexIndex, NumVertices, startIndex,
        PrimitiveCount);
 
    if (injectstuff.cham && cham) {
        const auto* ent = get_ent();
        if (ent != nullptr && local && injectstuff.cham && cham && *(int*)((uintptr_t)(ent))) {
            int team = *(int*)((uintptr_t)(ent) + 0xF0);
            int hpp = *(int*)((uintptr_t)(ent) + 0xFC);
 
            if (local->GetTeamNum() != team && team && (team == 3 || team == 2) && hpp) {
 
                //flat
                float def[4] = { 1, 1, 1, 1 };
                float value[4] = { chams.color2[0] / 255.f * chams.color2[3] / 255.f, chams.color2[1] / 255.f * chams.color2[3] / 255.f, chams.color2[2] / 255.f * chams.color2[3] / 255.f, chams.color2[3] / 255.f };
                float value2[4] = { chams.color[0] / 255.f * chams.color[3] / 255.f, chams.color[1] / 255.f * chams.color[3] / 255.f, chams.color[2] / 255.f * chams.color[3] / 255.f, chams.color[3] / 255.f };
                //textured
                float value3[4] = { chams.color2[0] / 20, chams.color2[1] / 20, chams.color2[2] / 20, chams.color2[3] };
                float value4[4] = { chams.color[0] / 20, chams.color[1] / 20, chams.color[2] / 20, chams.color[3] };
                //not flat not textured
                float value5[4] = { chams.color2[0] / 500.f, chams.color2[1] / 500.f, chams.color2[2] / 500.f, chams.color2[3] / 500.f };
                float value6[4] = { chams.color[0] / 500.f, chams.color[1] / 500.f, chams.color[2] / 500.f, chams.color[3] / 500.f };
 
                pDev->GetRenderTarget(0, &oldrendersurface);
                pDev->GetPixelShader(&oldpixelshader);
                pDev->GetRenderState(D3DRS_ZENABLE, &old_zenable);
                /*************************************************************/
                pDev->SetRenderTarget(0, ppSurfaceLevel);
                pDev->GetTexture(0, &deftexture);
 
                /*******************************************************/
                if (!chams.visibleonly) {
                    pDev->SetRenderState(D3DRS_ZENABLE, false);
                    if (!chams.textured) {
                        if (chams.flat) {
                            pDev->SetPixelShaderConstantF(0, value, 1);
                            pDev->SetPixelShader(pixelshader);
                        }
                        else {
                            pDev->SetTexture(0, pTexturey);
                            pDev->SetPixelShaderConstantF(1, value5, 1);
                        }
                    }
                    else
                        pDev->SetPixelShaderConstantF(1, value3, 1);
 
                    oDraw(pDev, PrimType, BaseVertexIndex,
                        MinVertexIndex, NumVertices, startIndex,
                        PrimitiveCount);
                }
 
                pDev->SetRenderState(D3DRS_ZENABLE, old_zenable);
                if (!chams.textured) {
                    if (chams.flat) {
                        pDev->SetPixelShader(pixelshader);
                        pDev->SetPixelShaderConstantF(0, value2, 1);
                    }
                    else {
                        pDev->SetTexture(0, pTexturey);
                        pDev->SetPixelShaderConstantF(1, value6, 1);
                    }
                }
                else
                    pDev->SetPixelShaderConstantF(1, value4, 1);
 
                oDraw(pDev, PrimType, BaseVertexIndex,
                    MinVertexIndex, NumVertices, startIndex,
                    PrimitiveCount);
 
                /****************************************/
                pDev->SetPixelShaderConstantF(0, def, 1);
                pDev->SetPixelShaderConstantF(1, def, 1);
                pDev->SetRenderTarget(0, oldrendersurface);
                pDev->SetRenderState(D3DRS_ZENABLE, old_zenable);
                pDev->SetPixelShader(oldpixelshader);
 
                pDev->SetTexture(0, deftexture);
                if (deftexture)
                    deftexture->Release();
                oldrendersurface->Release();
                if (oldpixelshader)
                    oldpixelshader->Release();
            }
        }
    }
    return true;
}
void drawtexture(LPDIRECT3DDEVICE9 pDevice)
{
 
    pDevice->GetRenderTarget(0, &backbuffer);
    backbuffer->GetDesc(&desc);
    backbuffer->Release();
 
    pDevice->CreateStateBlock(D3DSBT_ALL, &ppSB);
 
    CUSTOMVERTEX vertices[] = {
        {
            0, 0.0, 0, 1.0, 0.0, 0.0,
        },
        {
            desc.Width, 0, 0.0, 1.0, 1.0, 0.0,
        },
        {
            0, desc.Height, 0, 1.0, 0.0, 1.0,
        },
        {
            desc.Width, desc.Height, 0, 1.0, 1.0, 1.0,
        },
 
    };
 
    VOID* pVoid; // a void pointer
 
    v_buffer->Lock(0, 0, (void**)&pVoid, 0);
    memcpy(pVoid, vertices, sizeof(vertices));
    v_buffer->Unlock();
 
    pDevice->SetPixelShader(NULL);
    pDevice->SetTexture(0, sil_texture);
 
    pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
    pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
 
    pDevice->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
    pDevice->SetFVF(CUSTOMFVF);
    pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
 
    ppSB->Apply();
    ppSB->Release();
}
 
HRESULT _stdcall Present(LPDIRECT3DDEVICE9 pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion)
{
 
    if (init) {
        Generate(pDevice);
        D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bRed, sizeof(bRed), &pTexturer);
        init = false;
    }
 
    if (cham) {
        if (sil_texture && ppSurfaceLevel)
            drawtexture(pDevice);
        if (pDevice != NULL) {
            pDevice->GetRenderTarget(0, &oldrendersurface);
            pDevice->SetRenderTarget(0, ppSurfaceLevel);
            DrawRect(pDevice, 0, 0, desc.Width, desc.Height, 0, 0, 0);
            pDevice->SetRenderTarget(0, oldrendersurface);
            oldrendersurface->Release();
        }
    }
 
    pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
 
    return oPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}
long __stdcall Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
 
    v_buffer->Release();
    sil_texture->Release();
    ppSurfaceLevel->Release();
 
    HRESULT hr = oReset(pDevice, pPresentationParameters);
 
    if (SUCCEEDED(hr))
        Generate(pDevice);
 
    return hr;
}
 
std::X$$V::Z::_Func_impl_no_alloc
Пользователь
Статус
Оффлайн
Регистрация
30 Мар 2019
Сообщения
389
Реакции[?]
103
Поинты[?]
1K
Сверху Снизу