Kthook help

penta

Участник
Автор темы
42
9
Вот такая ошибка с kthook, если кто-то догадывается о моей ошибке, дайте знать пожалуйста

ptPJtO_fJu8.jpg

 
Решение
Вот такая ошибка с kthook, если кто-то догадывается о моей ошибке, дайте знать пожалуйста

ptPJtO_fJu8.jpg

Используй kthook::kthook_simple<CHUD__DrawRadar>
kthook_simple_t там нет(я даже на гите в коммитах не нашёл его нигде)

C++:
#include <kthook/kthook.hpp>

typedef struct CVector { float x, y, z; } CVector;

typedef struct tRadarTrace {
    unsigned int      m_nColour;                   // see eBlipColour
    unsigned int      m_nEntityHandle;
    CVector           m_vecPos;
    unsigned short    m_nCounter;
    float             m_fSphereRadius;
    unsigned...

Andrinall

Известный
678
531
Вот такая ошибка с kthook, если кто-то догадывается о моей ошибке, дайте знать пожалуйста

ptPJtO_fJu8.jpg

Используй kthook::kthook_simple<CHUD__DrawRadar>
kthook_simple_t там нет(я даже на гите в коммитах не нашёл его нигде)

C++:
#include <kthook/kthook.hpp>

typedef struct CVector { float x, y, z; } CVector;

typedef struct tRadarTrace {
    unsigned int      m_nColour;                   // see eBlipColour
    unsigned int      m_nEntityHandle;
    CVector           m_vecPos;
    unsigned short    m_nCounter;
    float             m_fSphereRadius;
    unsigned short    m_nBlipSize;
    class CEntryExit* m_pEntryExit;
    unsigned char     m_nRadarSprite;              // see eRadarSprite
    unsigned char     m_bBright      : 1;          // It makes use of bright colors. Always set.
    unsigned char     m_bInUse       : 1;          // It is available.
    unsigned char     m_bShortRange  : 1;          // It doesn't show permanently on the radar.
    unsigned char     m_bFriendly    : 1;          // It is affected by BLIP_COLOUR_THREAT.   
    unsigned char     m_bBlipRemain  : 1;          // It has the priority over the entity (it will still appear after the entity's deletion).
    unsigned char     m_bBlipFade    : 1;          // Possibly a leftover. Always unset (unused).
    unsigned char     m_nCoordBlipAppearance : 2;  // see eBlipAppearance
    unsigned char     m_nBlipDisplay : 2;          // see eBlipDisplay
    unsigned char     m_nBlipType    : 4;          // see eBlipType
} tRadarTrace;

class plugin {
protected:
    using drawCoordBlip_t = void(__cdecl*)(int, std::uint8_t);

    unsigned char deleted_sprite_idx = 32;
    kthook::kthook_simple<drawCoordBlip_t> hk_drawCoordBlip{ 0x586D60 };
    tRadarTrace* ms_RadarTrace = (tRadarTrace*)0xBA86F0;
public:
    plugin() {
        hk_drawCoordBlip.set_cb(
            [this](const decltype(hk_drawCoordBlip)& hook, int blipArrId, std::uint8_t isSprite) {
                if (ms_RadarTrace[blipArrId].m_nRadarSprite == deleted_sprite_idx) return;
                return hook.get_trampoline()(blipArrId, isSprite);
            }
        );
        hk_drawCoordBlip.install();
    }

    ~plugin() { hk_drawCoordBlip.~kthook_simple(); }
} _plugin_;
 

penta

Участник
Автор темы
42
9
Используй kthook::kthook_simple<CHUD__DrawRadar>
kthook_simple_t там нет(я даже на гите в коммитах не нашёл его нигде)

C++:
#include <kthook/kthook.hpp>

typedef struct CVector { float x, y, z; } CVector;

typedef struct tRadarTrace {
    unsigned int      m_nColour;                   // see eBlipColour
    unsigned int      m_nEntityHandle;
    CVector           m_vecPos;
    unsigned short    m_nCounter;
    float             m_fSphereRadius;
    unsigned short    m_nBlipSize;
    class CEntryExit* m_pEntryExit;
    unsigned char     m_nRadarSprite;              // see eRadarSprite
    unsigned char     m_bBright      : 1;          // It makes use of bright colors. Always set.
    unsigned char     m_bInUse       : 1;          // It is available.
    unsigned char     m_bShortRange  : 1;          // It doesn't show permanently on the radar.
    unsigned char     m_bFriendly    : 1;          // It is affected by BLIP_COLOUR_THREAT. 
    unsigned char     m_bBlipRemain  : 1;          // It has the priority over the entity (it will still appear after the entity's deletion).
    unsigned char     m_bBlipFade    : 1;          // Possibly a leftover. Always unset (unused).
    unsigned char     m_nCoordBlipAppearance : 2;  // see eBlipAppearance
    unsigned char     m_nBlipDisplay : 2;          // see eBlipDisplay
    unsigned char     m_nBlipType    : 4;          // see eBlipType
} tRadarTrace;

class plugin {
protected:
    using drawCoordBlip_t = void(__cdecl*)(int, std::uint8_t);

    unsigned char deleted_sprite_idx = 32;
    kthook::kthook_simple<drawCoordBlip_t> hk_drawCoordBlip{ 0x586D60 };
    tRadarTrace* ms_RadarTrace = (tRadarTrace*)0xBA86F0;
public:
    plugin() {
        hk_drawCoordBlip.set_cb(
            [this](const decltype(hk_drawCoordBlip)& hook, int blipArrId, std::uint8_t isSprite) {
                if (ms_RadarTrace[blipArrId].m_nRadarSprite == deleted_sprite_idx) return;
                return hook.get_trampoline()(blipArrId, isSprite);
            }
        );
        hk_drawCoordBlip.install();
    }

    ~plugin() { hk_drawCoordBlip.~kthook_simple(); }
} _plugin_;
Там еще много ошибок, и я полагаю связанны с неправильным подключением, в туториале -> https://www.blast.hk/threads/101433/ там так и было написано
UPD: Проблема решена, спасибо
 
Последнее редактирование:
  • Нравится
Реакции: Andrinall