arm64 : fix intptr_t size

This commit is contained in:
hymei
2022-06-05 01:12:32 +03:00
committed by nillerusr
parent 2690e6c85a
commit 4e4039d756
143 changed files with 1015 additions and 674 deletions
+3 -3
View File
@@ -345,7 +345,7 @@ float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, (int)m_queryHandle, pixelsPossible, (int)m_queryHandleCount, gpGlobals->framecount );
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, (int)(intp)m_queryHandle, pixelsPossible, (int)(intp)m_queryHandleCount, gpGlobals->framecount );
}
if ( pixels < 0 || pixelsPossible < 0 )
@@ -376,7 +376,7 @@ float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, (int)m_queryHandle, gpGlobals->framecount );
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, (int)(intp)m_queryHandle, gpGlobals->framecount );
}
if ( pixels < 0 )
@@ -415,7 +415,7 @@ void CPixelVisibilityQuery::IssueQuery( IMatRenderContext *pRenderContext, float
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Draw Proxy: qh:%d org:<%d,%d,%d> (frame:%d)\n", (int)m_queryHandle, (int)m_origin[0], (int)m_origin[1], (int)m_origin[2], gpGlobals->framecount );
DevMsg( 1, "Draw Proxy: qh:%d org:<%d,%d,%d> (frame:%d)\n", (int)(intp)m_queryHandle, (int)m_origin[0], (int)m_origin[1], (int)m_origin[2], gpGlobals->framecount );
}
m_clipFraction = PixelVisibility_DrawProxy( pRenderContext, m_queryHandle, m_origin, proxySize, proxyAspect, pMaterial, sizeIsScreenSpace );
+1 -1
View File
@@ -1691,7 +1691,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData, const Vector &vCurr
if ( !bQueued && RopeManager()->IsHolidayLightMode() && r_rope_holiday_light_scale.GetFloat() > 0.0f )
{
data.m_nMaterial = reinterpret_cast< int >( this );
data.m_nMaterial = (intp)this;
data.m_nHitBox = ( iNode << 8 );
data.m_flScale = r_rope_holiday_light_scale.GetFloat();
data.m_vOrigin = pSegmentData->m_Segments[nSegmentCount].m_vPos;
+1 -1
View File
@@ -213,7 +213,7 @@ void TE_DispatchEffect( IRecipientFilter& filter, float delay, KeyValues *pKeyVa
// NOTE: Ptrs are our way of indicating it's an entindex
ClientEntityHandle_t hWorld = ClientEntityList().EntIndexToHandle( 0 );
data.m_hEntity = (int)pKeyValues->GetPtr( "entindex", (void*)hWorld.ToInt() );
data.m_hEntity = (intp)pKeyValues->GetPtr( "entindex", (void*)hWorld.ToInt() );
const char *pEffectName = pKeyValues->GetString( "effectname" );
+3 -3
View File
@@ -132,7 +132,7 @@ public:
// methods of ISpatialLeafEnumerator
public:
bool EnumerateLeaf( int leaf, int context );
bool EnumerateLeaf( int leaf, intp context );
// Adds a shadow to a leaf
void AddShadowToLeaf( int leaf, ClientLeafShadowHandle_t handle );
@@ -1132,7 +1132,7 @@ void CClientLeafSystem::AddRenderableToLeaves( ClientRenderHandle_t handle, int
//-----------------------------------------------------------------------------
// Inserts an element into the tree
//-----------------------------------------------------------------------------
bool CClientLeafSystem::EnumerateLeaf( int leaf, int context )
bool CClientLeafSystem::EnumerateLeaf( int leaf, intp context )
{
EnumResultList_t *pList = (EnumResultList_t *)context;
if ( ThreadInMainThread() )
@@ -1168,7 +1168,7 @@ void CClientLeafSystem::InsertIntoTree( ClientRenderHandle_t &handle )
Assert( absMins.IsValid() && absMaxs.IsValid() );
ISpatialQuery* pQuery = engine->GetBSPTreeQuery();
pQuery->EnumerateLeavesInBox( absMins, absMaxs, this, (int)&list );
pQuery->EnumerateLeavesInBox( absMins, absMaxs, this, (intp)&list );
if ( list.pHead )
{
+3 -3
View File
@@ -2244,7 +2244,7 @@ inline ShadowType_t CClientShadowMgr::GetActualShadowCastType( IClientRenderable
class CShadowLeafEnum : public ISpatialLeafEnumerator
{
public:
bool EnumerateLeaf( int leaf, int context )
bool EnumerateLeaf( int leaf, intp context )
{
m_LeafList.AddToTail( leaf );
return true;
@@ -4217,7 +4217,7 @@ bool CShadowProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
void CShadowProxy::OnBind( void *pProxyData )
{
unsigned short clientShadowHandle = ( unsigned short )(int)pProxyData&0xffff;
unsigned short clientShadowHandle = ( unsigned short )(intp)pProxyData&0xffff;
ITexture* pTex = s_ClientShadowMgr.GetShadowTexture( clientShadowHandle );
m_BaseTextureVar->SetTextureValue( pTex );
if ( ToolsEnabled() )
@@ -4301,7 +4301,7 @@ bool CShadowModelProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
void CShadowModelProxy::OnBind( void *pProxyData )
{
unsigned short clientShadowHandle = ( unsigned short )((int)pProxyData&0xffff);
unsigned short clientShadowHandle = ( unsigned short )((intp)pProxyData&0xffff);
ITexture* pTex = s_ClientShadowMgr.GetShadowTexture( clientShadowHandle );
m_BaseTextureVar->SetTextureValue( pTex );
+6 -6
View File
@@ -405,7 +405,7 @@ public:
void BeginTranslucentDetailRendering( );
// Method of ISpatialLeafEnumerator
bool EnumerateLeaf( int leaf, int context );
bool EnumerateLeaf( int leaf, intp context );
DetailPropLightstylesLump_t& DetailLighting( int i ) { return m_DetailLighting[i]; }
DetailPropSpriteDict_t& DetailSpriteDict( int i ) { return m_DetailSpriteDict[i]; }
@@ -464,7 +464,7 @@ private:
int SortSpritesBackToFront( int nLeaf, const Vector &viewOrigin, const Vector &viewForward, SortInfo_t *pSortInfo );
// For fast detail object insertion
IterationRetval_t EnumElement( int userId, int context );
IterationRetval_t EnumElement( int userId, intp context );
CUtlVector<DetailModelDict_t> m_DetailObjectDict;
CUtlVector<CDetailModel> m_DetailObjects;
@@ -2322,7 +2322,7 @@ void CDetailObjectSystem::RenderFastSprites( const Vector &viewOrigin, const Vec
FastSpriteQuadBuildoutBufferNonSIMDView_t const *pquad = pQuadBuffer+nSIMDIdx;
// voodoo - since everything is in 4s, offset structure pointer by a couple of floats to handle sub-index
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (int) ( pquad ) )+ ( nSubIdx << 2 ) );
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (intp) ( pquad ) )+ ( nSubIdx << 2 ) );
uint8 const *pColorsCasted = reinterpret_cast<uint8 const *> ( pquad->m_Alpha );
uint8 color[4];
@@ -2554,7 +2554,7 @@ void CDetailObjectSystem::RenderFastTranslucentDetailObjectsInLeaf( const Vector
FastSpriteQuadBuildoutBufferNonSIMDView_t const *pquad = pQuadBuffer+nSIMDIdx;
// voodoo - since everything is in 4s, offset structure pointer by a couple of floats to handle sub-index
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (int) ( pquad ) )+ ( nSubIdx << 2 ) );
pquad = (FastSpriteQuadBuildoutBufferNonSIMDView_t const *) ( ( (intp) ( pquad ) )+ ( nSubIdx << 2 ) );
uint8 const *pColorsCasted = reinterpret_cast<uint8 const *> ( pquad->m_Alpha );
uint8 color[4];
@@ -2707,7 +2707,7 @@ void CDetailObjectSystem::RenderTranslucentDetailObjectsInLeaf( const Vector &vi
//-----------------------------------------------------------------------------
// Gets called each view
//-----------------------------------------------------------------------------
bool CDetailObjectSystem::EnumerateLeaf( int leaf, int context )
bool CDetailObjectSystem::EnumerateLeaf( int leaf, intp context )
{
VPROF_BUDGET( "CDetailObjectSystem::EnumerateLeaf", VPROF_BUDGETGROUP_DETAILPROP_RENDERING );
Vector v;
@@ -2806,6 +2806,6 @@ void CDetailObjectSystem::BuildDetailObjectRenderLists( const Vector &vViewOrigi
ISpatialQuery* pQuery = engine->GetBSPTreeQuery();
pQuery->EnumerateLeavesInSphere( CurrentViewOrigin(),
cl_detaildist.GetFloat(), this, (int)&ctx );
cl_detaildist.GetFloat(), this, (intp)&ctx );
}
+1 -1
View File
@@ -410,7 +410,7 @@ bool CPlayerLogoProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
void CPlayerLogoProxy::OnBind( void *pC_BaseEntity )
{
// Decal's are bound with the player index as the passed in paramter
int playerindex = (int)pC_BaseEntity;
int playerindex = (intp)pC_BaseEntity;
if ( playerindex <= 0 )
return;
+1 -1
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;
//-----------------------------------------------------------------------------
+2 -2
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();
+1 -1
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;
+1 -1
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());
}
//-----------------------------------------------------------------------------
+1 -1
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
+5 -2
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 )
+3 -3
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
+2 -2
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 );
}
}
+4 -4
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;
+15
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 )
+1 -1
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];
+6
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
}
};
+2 -2
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;
+1 -1
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;
+8
View File
@@ -754,12 +754,20 @@ BASEPTR CBaseEntity::ThinkSet( BASEPTR func, float thinkTime, const char *szCont
{
#if !defined( CLIENT_DLL )
#ifdef _DEBUG
#ifdef PLATFORM_64BITS
#ifdef GNUC
COMPILE_TIME_ASSERT( sizeof(func) == 16 );
#else
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
#endif
#else
#ifdef GNUC
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
#else
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
#endif
#endif
#endif
#endif
// Old system?
+1 -1
View File
@@ -115,7 +115,7 @@ private:
static unsigned int KeyFunc( const HashEntry &src )
{
// Shift right to get rid of alignment bits and border the struct on a 16 byte boundary
return (unsigned int)src.key;
return (unsigned int)(uintp)src.key;
}
CUtlHash< HashEntry > m_HashTable;
+1 -1
View File
@@ -45,7 +45,7 @@ void QueryCacheKey_t::ComputeHashIndex( void )
for( int i = 0 ; i < m_nNumValidPoints; i++ )
{
ret += ( unsigned int ) m_pEntities[i].ToInt();
ret += ( unsigned int ) m_nOffsetMode;
ret += ( uintp ) m_nOffsetMode;
}
ret += *( ( uint32 *) &m_flMinimumUpdateInterval );
ret += m_nTraceMask;
+1
View File
@@ -91,6 +91,7 @@ static int gSizes[FIELD_TYPECOUNT] =
FIELD_SIZE( FIELD_MATERIALINDEX ),
FIELD_SIZE( FIELD_VECTOR2D ),
FIELD_SIZE( FIELD_INTEGER64 ),
};