vendredi 24 janvier 2014

[Help] Updating bones causes me to crash topic




Hi!

I update bones through setting m_hadVisualUpdate to true, but it makes me crash. Here is how I do it (sorry for random checks, I had no idea which pointer made me crash, so I just added some more or less random pointerchecks. I saw that I would often crash just before respawn (during killcam) so I set it to not update if my player's health was down)


PHP Code:







void testBonesUpdate()
{
    
    for(
int i 064i++)
    {
        
ClientGameContext *pContext ClientGameContext::GetInstance();
        if(!
IsValidPtr(pContext))
            continue;

        
ClientPlayerManager *pManager pContext->m_pPlayerManager;
        if(!
IsValidPtr(pManager))
            continue;

        
ClientPlayer *lPlayer pManager->m_pLocalPlayer;
        if (!
IsValidPtr(lPlayer))
            continue;
        if(
lPlayer->InVehicle())
            continue;

        
ClientSoldierEntity *localSoldier lPlayer->m_pControlledControllable;
        if(!
IsValidPtr(localSoldier))
            continue;

        if(
localSoldier->m_pHealthComponent->m_Health 2.0f)
            continue;

        
ClientPlayer *pPlayer pManager->GetPlayerById(i);
        if(!
IsValidPtr(pPlayer))
            continue;

        if(
pPlayer->InVehicle())
            continue;

        
ClientSoldierEntity *pEnemy pPlayer->GetClientSoldier();

        if(!
IsValidPtr(pEnemy))
            continue;

        if(
pEnemy->m_pHealthComponent->m_Health 0.5)
            continue;

        
ClientSoldierEntity *pSoldierEntity pPlayer->m_pControlledControllable;
        if(!
IsValidPtr(pSoldierEntity))
            continue;

        if(
pPlayer->m_teamId == lPlayer->m_teamId)
            continue;

        
ClientCharacterEntity *pCharEnt pSoldierEntity->m_pClientCharacterEntity;
        if(!
IsValidPtr(pCharEnt))
            continue;

        
ClientAntAnimatableComponent *pAntAnimatable pCharEnt->m_animatableComponent[1];
        if(!
IsValidPtr(pAntAnimatable))
            continue;

        
GameAnimatable *pHandler pAntAnimatable->m_handler;
        if(!
IsValidPtr(pHandler) || pEnemy->m_pHealthComponent->m_Health 0.5)
            continue;

        if(
pHandler->m_hadVisualUpdate == false)
            
pHandler->m_hadVisualUpdate true;
    }










I don't really know what to do, any help is much appreciated. I tried putting it in a thread that I called with CreateThread in the DllMain, and I've tried calling this function from my PresentHook as well.

But I know for sure that this is the function that makes me crash, because I played with only that one enabled and I crashed.

I dunno. As I said any help is much appreciated.





Aucun commentaire:

Enregistrer un commentaire