arm64 : fix intptr_t size

This commit is contained in:
hymei
2022-02-23 19:50:30 +08:00
committed by nillerusr
parent 2690e6c85a
commit 4e4039d756
143 changed files with 1015 additions and 674 deletions

View File

@@ -14,7 +14,7 @@
class CAI_BaseNPC;
class CAI_Enemies;
typedef int AI_TaskFailureCode_t;
typedef intp AI_TaskFailureCode_t;
struct Task_t;
//-----------------------------------------------------------------------------

View File

@@ -741,9 +741,9 @@ CAI_Hint *CAI_HintManager::GetFirstHint( AIHintIter_t *pIter )
//-----------------------------------------------------------------------------
CAI_Hint *CAI_HintManager::GetNextHint( AIHintIter_t *pIter )
{
if ( (int)*pIter != gm_AllHints.InvalidIndex() )
if ( (intp)*pIter != gm_AllHints.InvalidIndex() )
{
int i = ( (int)*pIter ) + 1;
int i = ( (intp)*pIter ) + 1;
if ( gm_AllHints.Count() <= i )
{
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex();

View File

@@ -191,7 +191,7 @@ AI_EnemyInfo_t *CAI_Enemies::GetFirst( AIEnemiesIter_t *pIter )
AI_EnemyInfo_t *CAI_Enemies::GetNext( AIEnemiesIter_t *pIter )
{
CMemMap::IndexType_t i = (CMemMap::IndexType_t)((unsigned)(*pIter));
CMemMap::IndexType_t i = (CMemMap::IndexType_t)((uintp)(*pIter));
if ( i == m_Map.InvalidIndex() )
return NULL;

View File

@@ -1231,7 +1231,7 @@ AI_PathNode_t CAI_Navigator::GetNearestNode()
Vector CAI_Navigator::GetNodePos( AI_PathNode_t node )
{
return GetNetwork()->GetNode((int)node)->GetPosition(GetHullType());
return GetNetwork()->GetNode((intp)node)->GetPosition(GetHullType());
}
//-----------------------------------------------------------------------------

View File

@@ -29,7 +29,7 @@ class CAI_WaypointList;
class CAI_Network;
struct AIMoveTrace_t;
struct AILocalMoveGoal_t;
typedef int AI_TaskFailureCode_t;
typedef intp AI_TaskFailureCode_t;
//-----------------------------------------------------------------------------
// Debugging tools

View File

@@ -49,6 +49,9 @@ struct AISightIterVal_t
char array;
short iNext;
char SeenArray;
#ifdef PLATFORM_64BITS
uint32 unused;
#endif
};
#pragma pack(pop)
@@ -272,7 +275,7 @@ CBaseEntity *CAI_Senses::GetFirstSeenEntity( AISightIter_t *pIter, seentype_t iS
CBaseEntity *CAI_Senses::GetNextSeenEntity( AISightIter_t *pIter ) const
{
if ( ((int)*pIter) != -1 )
if ( ((intp)*pIter) != -1 )
{
AISightIterVal_t *pIterVal = (AISightIterVal_t *)pIter;
@@ -581,7 +584,7 @@ CSound* CAI_Senses::GetNextHeardSound( AISoundIter_t *pIter )
if ( !*pIter )
return NULL;
int iCurrent = (int)*pIter;
int iCurrent = (intp)*pIter;
Assert( iCurrent != SOUNDLIST_EMPTY );
if ( iCurrent == SOUNDLIST_EMPTY )

View File

@@ -21,9 +21,9 @@ class CStringRegistry;
// ----------------------------------------------------------------------
// Codes are either one of the enumerated types below, or a string (similar to Windows resource IDs)
typedef int AI_TaskFailureCode_t;
typedef intp AI_TaskFailureCode_t;
enum AI_BaseTaskFailureCodes_t
enum AI_BaseTaskFailureCodes_t : AI_TaskFailureCode_t
{
NO_TASK_FAILURE,
FAIL_NO_TARGET,
@@ -63,7 +63,7 @@ inline bool IsPathTaskFailure( AI_TaskFailureCode_t code )
}
const char *TaskFailureToString( AI_TaskFailureCode_t code );
inline int MakeFailCode( const char *pszGeneralError ) { return (int)pszGeneralError; }
inline intp MakeFailCode( const char *pszGeneralError ) { return (intp)pszGeneralError; }
enum TaskStatus_e

View File

@@ -2553,7 +2553,7 @@ void CBaseAnimating::LockStudioHdr()
if ( pStudioHdrContainer && pStudioHdrContainer->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)(pStudioHdrContainer->GetRenderHdr()->virtualModel)&0xffff;
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( pStudioHdrContainer->GetRenderHdr()->VirtualModel() );
mdlcache->LockStudioHdr( hVirtualModel );
}
m_pStudioHdr = pStudioHdrContainer; // must be last to ensure virtual model correctly set up
@@ -2571,7 +2571,7 @@ void CBaseAnimating::UnlockStudioHdr()
mdlcache->UnlockStudioHdr( modelinfo->GetCacheHandle( mdl ) );
if ( m_pStudioHdr->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)(m_pStudioHdr->GetRenderHdr()->virtualModel)&0xffff;
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( m_pStudioHdr->GetRenderHdr()->VirtualModel() );
mdlcache->UnlockStudioHdr( hVirtualModel );
}
}

View File

@@ -1259,7 +1259,7 @@ void CBaseEntity::ValidateEntityConnections()
typedescription_t *dataDesc = &dmap->dataDesc[i];
if ( ( dataDesc->fieldType == FIELD_CUSTOM ) && ( dataDesc->flags & FTYPEDESC_OUTPUT ) )
{
CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((int)this + (int)dataDesc->fieldOffset[0]);
CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((intp)this + (intp)dataDesc->fieldOffset[0]);
if ( pOutput->NumberOfElements() )
return;
}
@@ -1292,7 +1292,7 @@ void CBaseEntity::FireNamedOutput( const char *pszOutput, variant_t variant, CBa
typedescription_t *dataDesc = &dmap->dataDesc[i];
if ( ( dataDesc->fieldType == FIELD_CUSTOM ) && ( dataDesc->flags & FTYPEDESC_OUTPUT ) )
{
CBaseEntityOutput *pOutput = ( CBaseEntityOutput * )( ( int )this + ( int )dataDesc->fieldOffset[0] );
CBaseEntityOutput *pOutput = ( CBaseEntityOutput * )( ( intp )this + ( intp )dataDesc->fieldOffset[0] );
if ( !Q_stricmp( dataDesc->externalName, pszOutput ) )
{
pOutput->FireOutput( variant, pActivator, pCaller, flDelay );
@@ -3799,7 +3799,7 @@ void CBaseEntity::OnEntityEvent( EntityEvent_t event, void *pEventData )
{
case ENTITY_EVENT_WATER_TOUCH:
{
int nContents = (int)pEventData;
intp nContents = (intp)pEventData;
if ( !nContents || (nContents & CONTENTS_WATER) )
{
++m_nWaterTouch;
@@ -3813,7 +3813,7 @@ void CBaseEntity::OnEntityEvent( EntityEvent_t event, void *pEventData )
case ENTITY_EVENT_WATER_UNTOUCH:
{
int nContents = (int)pEventData;
intp nContents = (intp)pEventData;
if ( !nContents || (nContents & CONTENTS_WATER) )
{
--m_nWaterTouch;

View File

@@ -1089,6 +1089,21 @@ public:
// Ugly code to lookup all functions to make sure they are in the table when set.
#ifdef _DEBUG
#ifdef PLATFORM_64BITS
#ifdef GNUC
#define ENTITYFUNCPTR_SIZE 16
#else
#define ENTITYFUNCPTR_SIZE 8
#endif
#else
#ifdef GNUC
#define ENTITYFUNCPTR_SIZE 8
#else
#define ENTITYFUNCPTR_SIZE 4
#endif
#endif
void FunctionCheck( void *pFunction, const char *name );
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )

View File

@@ -1486,7 +1486,7 @@ bool variant_t::Convert( fieldtype_t newType )
//-----------------------------------------------------------------------------
const char *variant_t::ToString( void ) const
{
COMPILE_TIME_ASSERT( sizeof(string_t) == sizeof(int) );
COMPILE_TIME_ASSERT( sizeof(string_t) == sizeof(intp) );
static char szBuf[512];

View File

@@ -198,9 +198,15 @@ public:
unsigned int operator()( const NavVisPair_t &item ) const
{
#if PLATFORM_64BITS
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 8 );
int64 key[2] = { (int64)item.pAreas[0] + (int64)item.pAreas[1]->GetID(), (int64)item.pAreas[1] + (int64)item.pAreas[0]->GetID() };
return Hash16( key );
#else
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 );
int key[2] = { (int)(item.pAreas[0] + item.pAreas[1]->GetID()), (int)(item.pAreas[1] + item.pAreas[0]->GetID()) };
return Hash8( key );
#endif
}
};

View File

@@ -260,7 +260,7 @@ void CLagCompensationManager::FrameUpdatePostEntityThink()
Assert( track->Count() < 1000 ); // insanity check
// remove tail records that are too old
int tailIndex = track->Tail();
intp tailIndex = track->Tail();
while ( track->IsValidIndex( tailIndex ) )
{
LagRecord &tail = track->Element( tailIndex );
@@ -428,7 +428,7 @@ void CLagCompensationManager::BacktrackPlayer( CBasePlayer *pPlayer, float flTar
if ( track->Count() <= 0 )
return;
int curr = track->Head();
intp curr = track->Head();
LagRecord *prevRecord = NULL;
LagRecord *record = NULL;

View File

@@ -3688,7 +3688,7 @@ public:
return IMotionEvent::SIM_NOTHING;
// Get a cosine modulated noise between 5 and 20 that is object specific
int nNoiseMod = 5+(int)pObject%15; //
int nNoiseMod = 5+(intp)pObject%15; //
// Turn wind yaw direction into a vector and add noise
QAngle vWindAngle = vec3_angle;