Вопрос Chams

  • Автор темы Автор темы whkax
  • Дата начала Дата начала
Начинающий
Начинающий
Статус
Оффлайн
Регистрация
29 Май 2024
Сообщения
12
Реакции
0
всем привет,
подскажите, пожалуйста, как в текущей версии игры пишется chams? какие хуки и в целом как реализовать? искал в готовых исходниках, но как я понял методы устарели.
заранее спасибо
 
hello everyone
please tell me how to spell chams in the current version of the game? what hooks and how to implement them in general? I looked for it in ready-made sources, but as I understand it, the methods are outdated.
thanks in advance
methods are fine just update sig
 
methods are fine just update sig

hi can u pls help me

getting error when try to create material

*** CMaterial2::LoadShadersAndSetupModes(1538): Error! Trying to load material "materials/dev/primary_white_invisible.vmat" without any params!

C++:
Expand Collapse Copy
void CKeyValues3::LoadFromBuffer(const char* szString)
{
    CUtlBuffer buffer(0, (memory::StringLength(szString) + 10), 1);
    buffer.PutString(szString);
    LoadKV3(&buffer);
}

bool CKeyValues3::LoadKV3(CUtlBuffer* buffer)
{
    bool(__fastcall * FnLoadKeyValues)(CKeyValues3*, void*, CUtlBuffer*, KV3ID_t*, void*);
    using fnLoadKeyValues = bool(__fastcall*)(CKeyValues3*, void*, CUtlBuffer*, KV3ID_t*, void*);
    static const fnLoadKeyValues oLoadKeyValues = reinterpret_cast<fnLoadKeyValues>(memory::GetAbsoluteAddress(memory::PatternScan("tier0.dll", "E8 ? ? ? ? EB ? F7 43"), 0x1, 0x0)); // E8 ? ? ? ? EB 36 8B 43 10


    const char* szName = "";
    KV3ID_t kv3ID = KV3ID_t("generic", 0x41B818518343427E, 0xB5F447C23C0CDF8C);
    return oLoadKeyValues(this, nullptr, buffer, &kv3ID, nullptr);
}


CKeyValues3* CKeyValues3::CreateMaterialResource()
{
    static void* pSetTypeKV3 = nullptr;
    if (!pSetTypeKV3) {
        void* pPattern = memory::PatternScan("client.dll", "40 53 48 83 EC ? 4C 8B 11 41 B9");
        if (pPattern) {
            pSetTypeKV3 = pPattern;
            printf("[DEBUG] SetTypeKV3 found at: %p\n", pSetTypeKV3);
        } else {
            printf("[ERROR] SetTypeKV3 function not found!\n");
            return nullptr;
        }
    }

    using fnSetTypeKV3 = CKeyValues3*(__fastcall*)(CKeyValues3*, unsigned int, unsigned int);
    auto oSetTypeKV3 = reinterpret_cast<fnSetTypeKV3>(pSetTypeKV3);

    CKeyValues3* pKeyValue = new CKeyValues3[0x10];
    
    return oSetTypeKV3(pKeyValue, 1U, 6U);
}


C++:
Expand Collapse Copy
CStrongHandle<CMaterial2> CreateMaterial(const char* szMaterialName, const char szVmatBuffer[]) {
    printf("[DEBUG] Creating material: %s\n", szMaterialName);
    

    try
    {


        CKeyValues3* pKeyValues3 = CKeyValues3::CreateMaterialResource();
        if (!pKeyValues3)
            return {};
        


        pKeyValues3->LoadFromBuffer(szVmatBuffer);



        CStrongHandle<CMaterial2> pCustomMaterial = {};
        printf("[DEBUG] Calling fnCreateMaterial...\n");

        memory::material_system::fnCreateMaterial(
            nullptr,           // pContext
            &pCustomMaterial,  // pOutMaterial
            szMaterialName,    // szMaterialName
            pKeyValues3,       // pKeyValues3
            0,                 // nFlags1
            1                  // nFlags2
        );


        return pCustomMaterial;
    }
    catch (...)
    {
        return {};
    }
}
 
Назад
Сверху Снизу