Вопрос Dota 2 netvar manager

Участник
Статус
Оффлайн
Регистрация
23 Май 2019
Сообщения
760
Реакции[?]
328
Поинты[?]
60K
thanks a lot for that i was doing something wrong made me think that this was wrong
thanks a lot mate for all the help ur providing but i still cant find the hero entity itself even in the dissect structure
wdym?
did you not look at the code?
C++:
(*(CHandle*)((uintptr_t)Entity/*player controller*/ + offset_m_hAssignedHero)).index()
is the index of the hero in the entity system. just get the entity by that index(the same way you got players by index)
did you not see the log?
DebugString: "player unnamed(0x13dac701c00) controls hero indexed 157"
DebugString: "player Kat(0x13d4dab1c00) controls hero indexed 209"
DebugString: "player Kjetil(0x13cc7e42a00) controls hero indexed 256"
DebugString: "player Борис(0x13cca980000) controls hero indexed 304"
DebugString: "player Julia(0x13c78d80000) controls hero indexed 351"
DebugString: "player Jéssica(0x13d34276200) controls hero indexed 399"
DebugString: "player Anne(0x13d38564600) controls hero indexed 447"
DebugString: "player Bjørn(0x13d34274600) controls hero indexed 495"
DebugString: "player กิตติ(0x13d38b50000) controls hero indexed 542"
DebugString: "player Zhang(0x13d2e8a5400) controls hero indexed 590"
 
Участник
Статус
Оффлайн
Регистрация
23 Май 2019
Сообщения
760
Реакции[?]
328
Поинты[?]
60K
Начинающий
Статус
Оффлайн
Регистрация
11 Фев 2023
Сообщения
31
Реакции[?]
0
Поинты[?]
0
dude iam kinda sure that u know that i still dont have the context of the
GetEntityByIndex right ?

but lemme guess is it void* HeroObject = (void*)((uintptr_t)List + ((CHandle)((uintptr_t)Entity + offset_m_hAssignedHero)).index() % 512); ?
 
Участник
Статус
Оффлайн
Регистрация
23 Май 2019
Сообщения
760
Реакции[?]
328
Поинты[?]
60K
dude iam kinda sure that u know that i still dont have the context of the
GetEntityByIndex right ?

but lemme guess is it void* HeroObject = (void*)((uintptr_t)List + ((CHandle)((uintptr_t)Entity + offset_m_hAssignedHero)).index() % 512); ?
somewhat close but not really.
what exactly do you not understand about the layout of the entity system and its 64 entitylists(512 identities each)?
you have pointers to lists starting at (entitysystem + 0x10) - i.e. + 0x10, +0x18, +0x20, +0x28, ..., +0x208
you use modular arithmetic to break the entity index down into a list index(div 512) and an entry index(mod 512).
just like how you would break 56 hours into 2 days and 8 hours(56 div 24 = 2, 56 mod 24 = 8)
you select the list ptr and read it: list = *(void**)((uintptr_t)entitysystem + 0x10 + 8 * list_index)
you then, in that list(dont forget to check it for nullptr), select an entry: identity = (void*)((uintptr_t)list + entry_index * 0x78)
you got the identity. you then get its m_pEntity: entity = *(void**)(identity)
C++:
const auto _GetEntityByIndex = [entitysystem](std::size_t index) -> void*
{
    const auto entitysystem_lists = (const void**)((const std::uint8_t*)entitysystem + 0x10);
    const auto list =
        entitysystem_lists[index / ENTITY_SYSTEM_LIST_SIZE];
    if(list)
    {
        const auto entry_index = index % ENTITY_SYSTEM_LIST_SIZE;
        constexpr auto sizeof_CEntityIdentity = 0x78;
        const auto identity = (const std::uint8_t*)list + entry_index * sizeof_CEntityIdentity;
        return *(void**)identity;
    }
    return nullptr;
};
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
11 Фев 2023
Сообщения
31
Реакции[?]
0
Поинты[?]
0
somewhat close but not really.
what exactly do you not understand about the layout of the entity system and its 64 entitylists(512 identities each)?
you have pointers to lists starting at (entitysystem + 0x10) - ie + 0x10, +0x18, +0x20, +0x28, ..., +0x208
you use modular arithmetic to break the entity index down into a list index(div 512) and an entry index(mod 512).
just like how you would break 56 hours into 2 days and 8 hours(56 div 24 = 2, 56 mod 24 = 8)
you select the list ptr and read it: list = *(void**)((uintptr_t)entitysystem + 0x10 + 8 * list_index)
you then, in that list(dont forget to check it for nullptr), select an entry: identity = (void*)((uintptr_t)list + entry_index * 0x78)
you got the identity. you then get its m_pEntity: entity = *(void**)(identity)
C++:
const auto _GetEntityByIndex = [entitysystem](std::size_t index) -> void*
{
    const auto entitysystem_lists = (const void**)((const std::uint8_t*)entitysystem + 0x10);
    const auto list =
        entitysystem_lists[index / ENTITY_SYSTEM_LIST_SIZE];
    if(list)
    {
        const auto entry_index = index % ENTITY_SYSTEM_LIST_SIZE;
        constexpr auto sizeof_CEntityIdentity = 0x78;
        const auto identity = (const std::uint8_t*)list + entry_index * sizeof_CEntityIdentity;
        if (identity)
        {
            return *(void**)identity;
        }
    }
    return nullptr;
};

oh my god, thanks a lot dude for ur help i really appreciate ur help <3

i just want to know how do u know all of that ?
 
Участник
Статус
Оффлайн
Регистрация
23 Май 2019
Сообщения
760
Реакции[?]
328
Поинты[?]
60K
oh my god, thanks a lot dude for ur help i really appreciate ur help <3

i just want to know how do u know all of that ?
reverse engineering, duh
this is a reconstruction of what the game does, I didn't invent it
1723394990693.png
C++:
if(param > 32766) return nullptr;
list_index = param / 512;// technically param >> 9 but that's the same thing(512 is 2 in power of 9)
if(list_index > 63) return nullptr;
list = *(entity_system + 0x10 + list_index * 8);
if(!list) return nullptr;
entry_index = param % 512;//technically param & 511 but that's the same thing(512 is a power of two)
entry_index *= 0x78;//this isn't the index anymore, it's index * 0x78
list += entry_index;//this isn't the list anymore, it's list + entry_index * 0x78
if(!list) return nullptr;//this check isn't really necessary
if((*(list + m_hEntityHandle) & 32767) != param) return nullptr;//check that identity's index matches requested index(I don't see why it wouldn't so I don't have this check)
return *(list + m_pEntity);//m_pEntity is 0 so this is essentially return *list;
 
Сверху Снизу