arm64 ptr size fix

This commit is contained in:
hymei 2022-03-02 23:55:50 +08:00 committed by nillerusr
parent fe2d89addb
commit fd38243b54
7 changed files with 39 additions and 10 deletions

View File

@ -2918,8 +2918,13 @@ BEGIN_BYTESWAP_DATADESC( mstudiomodel_t )
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudio_modelvertexdata_t )
#ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_pVertexData, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_pTangentData, FIELD_INTEGER ), // void*
#else
DEFINE_FIELD( pVertexData, FIELD_INTEGER ), // void*
DEFINE_FIELD( pTangentData, FIELD_INTEGER ), // void*
#endif
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudioflexdesc_t )
@ -2998,7 +3003,11 @@ BEGIN_BYTESWAP_DATADESC( mstudiomesh_t )
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudio_meshvertexdata_t )
#ifdef PLATFORM_64BITS
DEFINE_FIELD( unused_modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
#else
DEFINE_FIELD( modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
#endif
DEFINE_ARRAY( numLODVertexes, FIELD_INTEGER, MAX_NUM_LODS ),
END_BYTESWAP_DATADESC()

View File

@ -18,7 +18,7 @@ static ConVar cl_showevents ( "cl_showevents", "0", FCVAR_CHEAT, "Print event fi
// Input : slot -
// *eventname -
//-----------------------------------------------------------------------------
void CL_DescribeEvent( int slot, CEventInfo *event, const char *eventname )
void CL_DescribeEvent( intp slot, CEventInfo *event, const char *eventname )
{
int idx = (slot & 31);
@ -81,7 +81,7 @@ void CL_FireEvents( void )
return;
}
int i, next;
intp i, next;
for ( i = cl.events.Head(); i != cl.events.InvalidIndex(); i = next )
{
next = cl.events.Next( i );

View File

@ -141,7 +141,7 @@ void CTeleportCountdownScreen::OnTick()
// Find the active info teleporter countdown
C_InfoTeleporterCountdown *pActiveCountdown = NULL;
for ( int i = g_InfoTeleporterCountdownList.Head(); i != g_InfoTeleporterCountdownList.InvalidIndex();
for ( intp i = g_InfoTeleporterCountdownList.Head(); i != g_InfoTeleporterCountdownList.InvalidIndex();
i = g_InfoTeleporterCountdownList.Next(i) )
{
if ( g_InfoTeleporterCountdownList[i]->m_bCountdownStarted )

View File

@ -345,7 +345,9 @@ unsigned int CPhonemeTag::ComputeDataCheckSum()
//-----------------------------------------------------------------------------
// Purpose: Simple language to string and string to language lookup dictionary
//-----------------------------------------------------------------------------
#if defined(__i386__) || defined(__x86_64__)
#pragma pack(1)
#endif
struct CCLanguage
{
@ -369,8 +371,9 @@ static CCLanguage g_CCLanguageLookup[] =
{ CC_THAI, "thai", 0 , 150, 250 },
{ CC_PORTUGUESE,"portuguese", 0 , 0, 150 },
};
#if defined(__i386__) || defined(__x86_64__)
#pragma pack()
#endif
void CSentence::ColorForLanguage( int language, unsigned char& r, unsigned char& g, unsigned char& b )
{

View File

@ -1292,8 +1292,15 @@ struct mstudio_modelvertexdata_t
int GetGlobalTangentIndex( int i ) const;
// base of external vertex data stores
#ifdef PLATFORM_64BITS
int unused_pVertexData;
int unused_pTangentData;
const void *pVertexData;
const void *pTangentData;
#else
const void *pVertexData;
const void *pTangentData;
#endif
};
#ifdef PLATFORM_64BITS
@ -1314,12 +1321,19 @@ struct mstudio_meshvertexdata_t
int GetModelVertexIndex( int i ) const;
int GetGlobalVertexIndex( int i ) const;
#ifdef PLATFORM_64BITS
// MoeMod : fix 64bit ptr size
int unused_modelvertexdata;
int numLODVertexes[MAX_NUM_LODS];
const mstudio_modelvertexdata_t *modelvertexdata;
#else
// indirection to this mesh's model's vertex data
const mstudio_modelvertexdata_t *modelvertexdata;
// used for fixup calcs when culling top level lods
// expected number of mesh verts at desired lod
int numLODVertexes[MAX_NUM_LODS];
#endif
};
struct mstudiomesh_t
@ -1353,7 +1367,7 @@ struct mstudiomesh_t
#ifdef PLATFORM_64BITS
mstudio_meshvertexdata_t vertexdata;
int unused[7]; // remove as appropriate
int unused[6]; // remove as appropriate
#else
mstudio_meshvertexdata_t vertexdata;
@ -1424,14 +1438,16 @@ inline bool mstudio_modelvertexdata_t::HasTangentData( void ) const
inline int mstudio_modelvertexdata_t::GetGlobalVertexIndex( int i ) const
{
mstudiomodel_t *modelptr = (mstudiomodel_t *)((byte *)this - offsetof(mstudiomodel_t, vertexdata));
//Assert( ( modelptr->vertexindex % sizeof( mstudiovertex_t ) ) == 0 );
Assert(&modelptr->vertexdata == this);
Assert( ( modelptr->vertexindex % sizeof( mstudiovertex_t ) ) == 0 );
return ( i + ( modelptr->vertexindex / sizeof( mstudiovertex_t ) ) );
}
inline int mstudio_modelvertexdata_t::GetGlobalTangentIndex( int i ) const
{
mstudiomodel_t *modelptr = (mstudiomodel_t *)((byte *)this - offsetof(mstudiomodel_t, vertexdata));
//Assert( ( modelptr->tangentsindex % sizeof( Vector4D ) ) == 0 );
Assert(&modelptr->vertexdata == this);
Assert( ( modelptr->tangentsindex % sizeof( Vector4D ) ) == 0 );
return ( i + ( modelptr->tangentsindex / sizeof( Vector4D ) ) );
}
@ -1499,7 +1515,8 @@ inline const thinModelVertices_t * mstudiomesh_t::GetThinVertexData( void *pMode
inline int mstudio_meshvertexdata_t::GetModelVertexIndex( int i ) const
{
mstudiomesh_t *meshptr = (mstudiomesh_t *)((byte *)this - offsetof(mstudiomesh_t,vertexdata));
mstudiomesh_t *meshptr = (mstudiomesh_t *)((byte *)this - offsetof(mstudiomesh_t,vertexdata));
Assert(&meshptr->vertexdata == this);
return meshptr->vertexoffset + i;
}

View File

@ -24,7 +24,7 @@
// This is a useful macro to iterate from head to tail in a linked list.
#define FOR_EACH_LL( listName, iteratorName ) \
for( int iteratorName=(listName).Head(); (listName).IsUtlLinkedList && iteratorName != (listName).InvalidIndex(); iteratorName = (listName).Next( iteratorName ) )
for( auto iteratorName=(listName).Head(); (listName).IsUtlLinkedList && iteratorName != (listName).InvalidIndex(); iteratorName = (listName).Next( iteratorName ) )
//-----------------------------------------------------------------------------
// class CUtlLinkedList:

View File

@ -105,7 +105,7 @@ uint64 CalculateCPUFreq()
int retval = sysctlbyname("hw.cpufrequency_max", &freq_hz, &freq_size, NULL, 0);
// MoeMod : TODO dont know how to get freq on Apple Silicon
if(!freq_hz)
freq_hz = 3200000;
freq_hz = 3200000000;
return freq_hz;
#else
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.