mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-21 21:56:50 +00:00
arm64 : fix intptr_t size
This commit is contained in:
parent
2690e6c85a
commit
4e4039d756
@ -40,7 +40,7 @@ struct SSBumpCalculationContext // what each thread needs to see
|
||||
};
|
||||
|
||||
|
||||
static unsigned SSBumpCalculationThreadFN( void * ctx1 )
|
||||
static uintp SSBumpCalculationThreadFN( void * ctx1 )
|
||||
{
|
||||
SSBumpCalculationContext *ctx = ( SSBumpCalculationContext * ) ctx1;
|
||||
|
||||
|
@ -24,7 +24,7 @@ struct TBFCalculationContext
|
||||
FloatBitMap_t *dest_bm;
|
||||
};
|
||||
|
||||
static unsigned TBFCalculationThreadFN( void *ctx1 )
|
||||
static uintp TBFCalculationThreadFN( void *ctx1 )
|
||||
{
|
||||
TBFCalculationContext *ctx = (TBFCalculationContext *) ctx1;
|
||||
for(int y=ctx->min_y; y <= ctx->max_y; y++)
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
// return true if the console has focus
|
||||
virtual bool IsConsoleVisible() = 0;
|
||||
|
||||
virtual void SetParent( int parent ) = 0;
|
||||
virtual void SetParent( intp parent ) = 0;
|
||||
};
|
||||
|
||||
#define GAMECONSOLE_INTERFACE_VERSION "GameConsole004"
|
||||
|
@ -32,7 +32,7 @@ struct RequestContext_t;
|
||||
class IDownloadSystem : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual DWORD CreateDownloadThread( RequestContext_t *pContext ) = 0;
|
||||
virtual uintp CreateDownloadThread( RequestContext_t *pContext ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
@ -16,10 +16,10 @@
|
||||
#undef ALIGN4
|
||||
#undef ALIGN16
|
||||
#undef ALIGN32
|
||||
#define ALIGN4( a ) a = (byte *)((int)((byte *)a + 3) & ~ 3)
|
||||
#define ALIGN16( a ) a = (byte *)((int)((byte *)a + 15) & ~ 15)
|
||||
#define ALIGN32( a ) a = (byte *)((int)((byte *)a + 31) & ~ 31)
|
||||
#define ALIGN64( a ) a = (byte *)((int)((byte *)a + 63) & ~ 63)
|
||||
#define ALIGN4( a ) a = (byte *)((intp)((byte *)a + 3) & ~ 3)
|
||||
#define ALIGN16( a ) a = (byte *)((intp)((byte *)a + 15) & ~ 15)
|
||||
#define ALIGN32( a ) a = (byte *)((intp)((byte *)a + 31) & ~ 31)
|
||||
#define ALIGN64( a ) a = (byte *)((intp)((byte *)a + 63) & ~ 63)
|
||||
|
||||
// Fixup macros create variables that may not be referenced
|
||||
#pragma warning( push )
|
||||
@ -1228,8 +1228,8 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
|
||||
V_memcpy( pNewDest, pDestBase, pAnimBlock->datastart );
|
||||
pNewDest += pAnimBlock->datastart;
|
||||
|
||||
int padding = AlignValue( (unsigned int)pNewDest - (unsigned int)pNewDestBase, 2048 );
|
||||
padding -= (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
||||
int padding = AlignValue( (uintp)pNewDest - (uintp)pNewDestBase, 2048 );
|
||||
padding -= (uintp)pNewDest - (uintp)pNewDestBase;
|
||||
pNewDest += padding;
|
||||
|
||||
// iterate and compress anim blocks
|
||||
@ -1240,7 +1240,7 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
|
||||
void *pInput = (byte *)pDestBase + pAnimBlock->datastart;
|
||||
int inputSize = pAnimBlock->dataend - pAnimBlock->datastart;
|
||||
|
||||
pAnimBlock->datastart = (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
||||
pAnimBlock->datastart = (uintp)pNewDest - (uintp)pNewDestBase;
|
||||
|
||||
void *pOutput;
|
||||
int outputSize;
|
||||
@ -1257,11 +1257,11 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
|
||||
pNewDest += inputSize;
|
||||
}
|
||||
|
||||
padding = AlignValue( (unsigned int)pNewDest - (unsigned int)pNewDestBase, 2048 );
|
||||
padding -= (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
||||
padding = AlignValue( (uintp)pNewDest - (uintp)pNewDestBase, 2048 );
|
||||
padding -= (uintp)pNewDest - (uintp)pNewDestBase;
|
||||
pNewDest += padding;
|
||||
|
||||
pAnimBlock->dataend = (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
||||
pAnimBlock->dataend = (uintp)pNewDest - (uintp)pNewDestBase;
|
||||
}
|
||||
|
||||
fixedFileSize = pNewDest - pNewDestBase;
|
||||
@ -2522,14 +2522,27 @@ BEGIN_BYTESWAP_DATADESC( studiohdr_t )
|
||||
DEFINE_FIELD( contents, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( numincludemodels, FIELD_INTEGER ),
|
||||
DEFINE_INDEX( includemodelindex, FIELD_INTEGER ),
|
||||
#ifdef PLATFORM_64BITS
|
||||
DEFINE_FIELD( index_ptr_virtualModel, FIELD_INTEGER ), // void*
|
||||
#else
|
||||
DEFINE_FIELD( virtualModel, FIELD_INTEGER ), // void*
|
||||
#endif
|
||||
DEFINE_INDEX( szanimblocknameindex, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( numanimblocks, FIELD_INTEGER ),
|
||||
DEFINE_INDEX( animblockindex, FIELD_INTEGER ),
|
||||
#ifdef PLATFORM_64BITS
|
||||
DEFINE_FIELD( index_ptr_virtualModel, FIELD_INTEGER ), // void*
|
||||
#else
|
||||
DEFINE_FIELD( animblockModel, FIELD_INTEGER ), // void*
|
||||
#endif
|
||||
DEFINE_INDEX( bonetablebynameindex, FIELD_INTEGER ),
|
||||
#ifdef PLATFORM_64BITS
|
||||
DEFINE_FIELD( index_ptr_pVertexBase, FIELD_INTEGER ), // void*
|
||||
DEFINE_FIELD( index_ptr_pVertexBase, FIELD_INTEGER ), // void*
|
||||
#else
|
||||
DEFINE_FIELD( pVertexBase, FIELD_INTEGER ), // void*
|
||||
DEFINE_FIELD( pIndexBase, FIELD_INTEGER ), // void*
|
||||
#endif
|
||||
DEFINE_FIELD( constdirectionallightdot, FIELD_CHARACTER ), // byte
|
||||
DEFINE_FIELD( rootLOD, FIELD_CHARACTER ), // byte
|
||||
DEFINE_FIELD( numAllowedRootLODs, FIELD_CHARACTER ), // byte
|
||||
|
@ -39,7 +39,7 @@ struct DataCacheItemData_t
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
#define DC_NO_NEXT_LOCKED ((DataCacheItem_t *)0xffffffff)
|
||||
#define DC_NO_NEXT_LOCKED ((DataCacheItem_t *)-1)
|
||||
#define DC_MAX_THREADS_FRAMELOCKED 4
|
||||
|
||||
struct DataCacheItem_t : DataCacheItemData_t
|
||||
|
@ -235,11 +235,11 @@ struct AsyncInfo_t
|
||||
int iAnimBlock;
|
||||
};
|
||||
|
||||
const int NO_ASYNC = CUtlLinkedList< AsyncInfo_t >::InvalidIndex();
|
||||
const intp NO_ASYNC = CUtlFixedLinkedList< AsyncInfo_t >::InvalidIndex();
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
CUtlMap<int, int> g_AsyncInfoMap( DefLessFunc( int ) );
|
||||
CUtlMap<int, intp> g_AsyncInfoMap( DefLessFunc( int ) );
|
||||
CThreadFastMutex g_AsyncInfoMapMutex;
|
||||
|
||||
inline int MakeAsyncInfoKey( MDLHandle_t hModel, MDLCacheDataType_t type, int iAnimBlock )
|
||||
@ -248,7 +248,7 @@ inline int MakeAsyncInfoKey( MDLHandle_t hModel, MDLCacheDataType_t type, int iA
|
||||
return ( ( ( (int)hModel) << 16 ) | ( (int)type << 13 ) | iAnimBlock );
|
||||
}
|
||||
|
||||
inline int GetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int iAnimBlock = 0 )
|
||||
inline intp GetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int iAnimBlock = 0 )
|
||||
{
|
||||
AUTO_LOCK( g_AsyncInfoMapMutex );
|
||||
int key = MakeAsyncInfoKey( hModel, type, iAnimBlock );
|
||||
@ -260,7 +260,7 @@ inline int GetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int i
|
||||
return g_AsyncInfoMap[i];
|
||||
}
|
||||
|
||||
inline int SetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int iAnimBlock, int index )
|
||||
inline intp SetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int iAnimBlock, intp index )
|
||||
{
|
||||
AUTO_LOCK( g_AsyncInfoMapMutex );
|
||||
Assert( index == NO_ASYNC || GetAsyncInfoIndex( hModel, type, iAnimBlock ) == NO_ASYNC );
|
||||
@ -277,7 +277,7 @@ inline int SetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int i
|
||||
return index;
|
||||
}
|
||||
|
||||
inline int SetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, int index )
|
||||
inline intp SetAsyncInfoIndex( MDLHandle_t hModel, MDLCacheDataType_t type, intp index )
|
||||
{
|
||||
return SetAsyncInfoIndex( hModel, type, 0, index );
|
||||
}
|
||||
@ -507,7 +507,7 @@ private:
|
||||
bool BuildHardwareData( MDLHandle_t handle, studiodata_t *pStudioData, studiohdr_t *pStudioHdr, OptimizedModel::FileHeader_t *pVtxHdr );
|
||||
void ConvertFlexData( studiohdr_t *pStudioHdr );
|
||||
|
||||
int ProcessPendingAsync( int iAsync );
|
||||
int ProcessPendingAsync( intp iAsync );
|
||||
void ProcessPendingAsyncs( MDLCacheDataType_t type = MDLCACHE_NONE );
|
||||
bool ClearAsync( MDLHandle_t handle, MDLCacheDataType_t type, int iAnimBlock, bool bAbort = false );
|
||||
|
||||
@ -879,7 +879,7 @@ void CMDLCache::SetCacheNotify( IMDLCacheNotify *pNotify )
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CMDLCache::GetModelName( MDLHandle_t handle )
|
||||
{
|
||||
if ( handle == MDLHANDLE_INVALID )
|
||||
if ( handle == MDLHANDLE_INVALID )
|
||||
return ERROR_MODEL;
|
||||
|
||||
return m_MDLDict.GetElementName( handle );
|
||||
@ -909,7 +909,7 @@ void CMDLCache::MakeFilename( MDLHandle_t handle, const char *pszExtension, char
|
||||
Q_strncpy( pszFileName, GetActualModelName( handle ), nMaxLength );
|
||||
Q_SetExtension( pszFileName, pszExtension, nMaxLength );
|
||||
Q_FixSlashes( pszFileName );
|
||||
#ifdef _LINUX
|
||||
#ifdef POSIX
|
||||
Q_strlower( pszFileName );
|
||||
#endif
|
||||
}
|
||||
@ -1004,7 +1004,7 @@ void CMDLCache::UnserializeVCollide( MDLHandle_t handle, bool synchronousLoad )
|
||||
// FIXME: Should the vcollde be played into cacheable memory?
|
||||
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||
|
||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VCOLLIDE );
|
||||
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VCOLLIDE );
|
||||
|
||||
if ( iAsync == NO_ASYNC )
|
||||
{
|
||||
@ -1025,7 +1025,7 @@ void CMDLCache::UnserializeVCollide( MDLHandle_t handle, bool synchronousLoad )
|
||||
{
|
||||
for ( int i = 1; i < pVirtualModel->m_group.Count(); i++ )
|
||||
{
|
||||
MDLHandle_t sharedHandle = (MDLHandle_t) (int)pVirtualModel->m_group[i].cache & 0xffff;
|
||||
MDLHandle_t sharedHandle = VoidPtrToMDLHandle(pVirtualModel->m_group[i].cache);
|
||||
studiodata_t *pData = m_MDLDict[sharedHandle];
|
||||
if ( !(pData->m_nFlags & STUDIODATA_FLAGS_VCOLLISION_LOADED) )
|
||||
{
|
||||
@ -1219,7 +1219,7 @@ unsigned char *CMDLCache::UnserializeAnimBlock( MDLHandle_t handle, int nBlock )
|
||||
|
||||
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||
|
||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_ANIMBLOCK, nBlock );
|
||||
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_ANIMBLOCK, nBlock );
|
||||
|
||||
if ( iAsync == NO_ASYNC )
|
||||
{
|
||||
@ -1238,7 +1238,7 @@ unsigned char *CMDLCache::UnserializeAnimBlock( MDLHandle_t handle, int nBlock )
|
||||
char pFileName[MAX_PATH];
|
||||
Q_strncpy( pFileName, pModelName, sizeof(pFileName) );
|
||||
Q_FixSlashes( pFileName );
|
||||
#ifdef _LINUX
|
||||
#ifdef POSIX
|
||||
Q_strlower( pFileName );
|
||||
#endif
|
||||
if ( IsX360() )
|
||||
@ -1398,12 +1398,12 @@ void CMDLCache::FreeVirtualModel( MDLHandle_t handle )
|
||||
if ( pStudioData && pStudioData->m_pVirtualModel )
|
||||
{
|
||||
int nGroupCount = pStudioData->m_pVirtualModel->m_group.Count();
|
||||
Assert( (nGroupCount >= 1) && pStudioData->m_pVirtualModel->m_group[0].cache == (void*)(uintp)handle );
|
||||
Assert( (nGroupCount >= 1) && pStudioData->m_pVirtualModel->m_group[0].cache == MDLHandleToVirtual(handle) );
|
||||
|
||||
// NOTE: Start at *1* here because the 0th element contains a reference to *this* handle
|
||||
for ( int i = 1; i < nGroupCount; ++i )
|
||||
{
|
||||
MDLHandle_t h = (MDLHandle_t)(int)pStudioData->m_pVirtualModel->m_group[i].cache&0xffff;
|
||||
MDLHandle_t h = VoidPtrToMDLHandle( pStudioData->m_pVirtualModel->m_group[i].cache );
|
||||
FreeVirtualModel( h );
|
||||
Release( h );
|
||||
}
|
||||
@ -1450,10 +1450,13 @@ virtualmodel_t *CMDLCache::GetVirtualModelFast( const studiohdr_t *pStudioHdr, M
|
||||
|
||||
AllocateVirtualModel( handle );
|
||||
|
||||
// MoeMod : added
|
||||
pStudioHdr->SetVirtualModel( MDLHandleToVirtual( handle ) );
|
||||
|
||||
// Group has to be zero to ensure refcounting is correct
|
||||
int nGroup = pStudioData->m_pVirtualModel->m_group.AddToTail( );
|
||||
Assert( nGroup == 0 );
|
||||
pStudioData->m_pVirtualModel->m_group[nGroup].cache = (void *)(uintp)handle;
|
||||
pStudioData->m_pVirtualModel->m_group[nGroup].cache = MDLHandleToVirtual(handle);
|
||||
|
||||
// Add all dependent data
|
||||
pStudioData->m_pVirtualModel->AppendModels( 0, pStudioHdr );
|
||||
@ -1550,7 +1553,7 @@ bool CMDLCache::LoadHardwareData( MDLHandle_t handle )
|
||||
return false;
|
||||
}
|
||||
|
||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_STUDIOHWDATA );
|
||||
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_STUDIOHWDATA );
|
||||
|
||||
if ( iAsync == NO_ASYNC )
|
||||
{
|
||||
@ -1970,18 +1973,39 @@ studiohdr_t *CMDLCache::UnserializeMDL( MDLHandle_t handle, void *pData, int nDa
|
||||
|
||||
// critical! store a back link to our data
|
||||
// this is fetched when re-establishing dependent cached data (vtx/vvd)
|
||||
pStudioHdrIn->virtualModel = (void *)(uintp)handle;
|
||||
#ifndef PLATFORM_64BITS
|
||||
pStudioHdrIn->SetVirtualModel( MDLHandleToVirtual( handle ) );
|
||||
#endif
|
||||
|
||||
MdlCacheMsg( "MDLCache: Alloc studiohdr %s\n", GetModelName( handle ) );
|
||||
|
||||
// allocate cache space
|
||||
MemAlloc_PushAllocDbgInfo( "Models:StudioHdr", 0);
|
||||
#ifdef PLATFORM_64BITS
|
||||
studiohdr_t *pHdr = (studiohdr_t *)AllocData( MDLCACHE_STUDIOHDR, pStudioHdrIn->length + sizeof(studiohdr_shim64_index) );
|
||||
#else
|
||||
studiohdr_t *pHdr = (studiohdr_t *)AllocData( MDLCACHE_STUDIOHDR, pStudioHdrIn->length );
|
||||
#endif
|
||||
MemAlloc_PopAllocDbgInfo();
|
||||
if ( !pHdr )
|
||||
return NULL;
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
// MoeMod : fix shim64 index
|
||||
studiohdr_shim64_index *pHdrIndex = (studiohdr_shim64_index *)(((byte *)pHdr)+ pStudioHdrIn->length);
|
||||
pHdrIndex->virtualModel = nullptr;
|
||||
pHdrIndex->animblockModel = nullptr;
|
||||
pHdrIndex->pVertexBase = nullptr;
|
||||
pHdrIndex->pIndexBase = nullptr;
|
||||
pStudioHdrIn->index_ptr_virtualModel = (byte *)&pHdrIndex->virtualModel - (byte *)pHdr;
|
||||
pStudioHdrIn->index_ptr_animblockModel = (byte *)&pHdrIndex->animblockModel - (byte *)pHdr;
|
||||
pStudioHdrIn->index_ptr_pVertexBase = (byte *)&pHdrIndex->pVertexBase - (byte *)pHdr;
|
||||
pStudioHdrIn->index_ptr_pIndexBase = (byte *)&pHdrIndex->pIndexBase - (byte *)pHdr;
|
||||
pStudioHdrIn->SetVirtualModel( MDLHandleToVirtual( handle ) );
|
||||
CacheData( &m_MDLDict[handle]->m_MDLCache, pHdr, pStudioHdrIn->length + sizeof(studiohdr_shim64_index), GetModelName( handle ), MDLCACHE_STUDIOHDR, MakeCacheID( handle, MDLCACHE_STUDIOHDR) );
|
||||
#else
|
||||
CacheData( &m_MDLDict[handle]->m_MDLCache, pHdr, pStudioHdrIn->length, GetModelName( handle ), MDLCACHE_STUDIOHDR, MakeCacheID( handle, MDLCACHE_STUDIOHDR) );
|
||||
#endif
|
||||
|
||||
if ( mod_lock_mdls_on_load.GetBool() )
|
||||
{
|
||||
@ -2022,7 +2046,7 @@ bool CMDLCache::ReadMDLFile( MDLHandle_t handle, const char *pMDLFileName, CUtlB
|
||||
char pFileName[ MAX_PATH ];
|
||||
Q_strncpy( pFileName, pMDLFileName, sizeof( pFileName ) );
|
||||
Q_FixSlashes( pFileName );
|
||||
#ifdef _LINUX
|
||||
#ifdef POSIX
|
||||
Q_strlower( pFileName );
|
||||
#endif
|
||||
|
||||
@ -2059,6 +2083,12 @@ bool CMDLCache::ReadMDLFile( MDLHandle_t handle, const char *pMDLFileName, CUtlB
|
||||
}
|
||||
}
|
||||
|
||||
if ( buf.Size() < sizeof(studiohdr_t) )
|
||||
{
|
||||
DevWarning( "Empty model %s\n", pMDLFileName );
|
||||
return false;
|
||||
}
|
||||
|
||||
studiohdr_t *pStudioHdr = (studiohdr_t*)buf.PeekGet();
|
||||
if ( !pStudioHdr )
|
||||
{
|
||||
@ -2073,7 +2103,27 @@ bool CMDLCache::ReadMDLFile( MDLHandle_t handle, const char *pMDLFileName, CUtlB
|
||||
|
||||
// critical! store a back link to our data
|
||||
// this is fetched when re-establishing dependent cached data (vtx/vvd)
|
||||
pStudioHdr->virtualModel = (void*)(uintp)handle;
|
||||
#if PLATFORM_64BITS
|
||||
int length = buf.Size();
|
||||
{
|
||||
studiohdr_shim64_index shim;
|
||||
buf.Put( &shim, sizeof(shim) );
|
||||
}
|
||||
studiohdr_shim64_index *pHdrIndex = (studiohdr_shim64_index *)(((byte *)buf.PeekGet())+ length);
|
||||
pStudioHdr = (studiohdr_t*)buf.PeekGet();
|
||||
|
||||
pHdrIndex->virtualModel = nullptr;
|
||||
pHdrIndex->animblockModel = nullptr;
|
||||
pHdrIndex->pVertexBase = nullptr;
|
||||
pHdrIndex->pIndexBase = nullptr;
|
||||
pStudioHdr->index_ptr_virtualModel = (byte *)&pHdrIndex->virtualModel - (byte *)pStudioHdr;
|
||||
pStudioHdr->index_ptr_animblockModel = (byte *)&pHdrIndex->animblockModel - (byte *)pStudioHdr;
|
||||
pStudioHdr->index_ptr_pVertexBase = (byte *)&pHdrIndex->pVertexBase - (byte *)pStudioHdr;
|
||||
pStudioHdr->index_ptr_pIndexBase = (byte *)&pHdrIndex->pIndexBase - (byte *)pStudioHdr;
|
||||
pStudioHdr->SetVirtualModel( MDLHandleToVirtual( handle ) );
|
||||
#else
|
||||
pStudioHdr->SetVirtualModel( MDLHandleToVirtual( handle ) );
|
||||
#endif
|
||||
|
||||
// Make sure all dependent files are valid
|
||||
if ( !VerifyHeaders( pStudioHdr ) )
|
||||
@ -2236,7 +2286,7 @@ void CMDLCache::TouchAllData( MDLHandle_t handle )
|
||||
// ensure all sub models are cached
|
||||
for ( int i=1; i<pVModel->m_group.Count(); ++i )
|
||||
{
|
||||
MDLHandle_t childHandle = (MDLHandle_t)(int)pVModel->m_group[i].cache&0xffff;
|
||||
MDLHandle_t childHandle = VoidPtrToMDLHandle( pVModel->m_group[i].cache );
|
||||
if ( childHandle != MDLHANDLE_INVALID )
|
||||
{
|
||||
// FIXME: Should this be calling TouchAllData on the child?
|
||||
@ -2301,7 +2351,7 @@ bool CMDLCache::HandleCacheNotification( const DataCacheNotification_t ¬ifica
|
||||
{
|
||||
MdlCacheMsg( "MDLCache: Data cache discard %s %s\n", g_ppszTypes[TypeFromCacheID( notification.clientId )], GetModelName( HandleFromCacheID( notification.clientId ) ) );
|
||||
|
||||
if ( (DataCacheClientID_t)notification.pItemData == notification.clientId ||
|
||||
if ( (DataCacheClientID_t)(intp)notification.pItemData == notification.clientId ||
|
||||
TypeFromCacheID(notification.clientId) != MDLCACHE_STUDIOHWDATA )
|
||||
{
|
||||
Assert( notification.pItemData );
|
||||
@ -2320,7 +2370,7 @@ bool CMDLCache::HandleCacheNotification( const DataCacheNotification_t ¬ifica
|
||||
|
||||
bool CMDLCache::GetItemName( DataCacheClientID_t clientId, const void *pItem, char *pDest, unsigned nMaxLen )
|
||||
{
|
||||
if ( (DataCacheClientID_t)pItem == clientId )
|
||||
if ( (DataCacheClientID_t)(uintp)pItem == clientId )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -2426,7 +2476,7 @@ void CMDLCache::FinishPendingLoads()
|
||||
AUTO_LOCK( m_AsyncMutex );
|
||||
|
||||
// finish just our known jobs
|
||||
int iAsync = m_PendingAsyncs.Head();
|
||||
intp iAsync = m_PendingAsyncs.Head();
|
||||
while ( iAsync != m_PendingAsyncs.InvalidIndex() )
|
||||
{
|
||||
AsyncInfo_t &info = m_PendingAsyncs[iAsync];
|
||||
@ -2581,7 +2631,7 @@ bool CMDLCache::VerifyHeaders( studiohdr_t *pStudioHdr )
|
||||
}
|
||||
|
||||
char pFileName[ MAX_PATH ];
|
||||
MDLHandle_t handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
MDLHandle_t handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
|
||||
MakeFilename( handle, ".vvd", pFileName, sizeof(pFileName) );
|
||||
|
||||
@ -2642,7 +2692,7 @@ vertexFileHeader_t *CMDLCache::CacheVertexData( studiohdr_t *pStudioHdr )
|
||||
|
||||
Assert( pStudioHdr );
|
||||
|
||||
handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
Assert( handle != MDLHANDLE_INVALID );
|
||||
|
||||
pVvdHdr = (vertexFileHeader_t *)CheckData( m_MDLDict[handle]->m_VertexCache, MDLCACHE_VERTEXES );
|
||||
@ -3037,7 +3087,7 @@ bool CMDLCache::ProcessDataIntoCache( MDLHandle_t handle, MDLCacheDataType_t typ
|
||||
// =0: pending
|
||||
// >0: completed
|
||||
//-----------------------------------------------------------------------------
|
||||
int CMDLCache::ProcessPendingAsync( int iAsync )
|
||||
int CMDLCache::ProcessPendingAsync( intp iAsync )
|
||||
{
|
||||
if ( !ThreadInMainThread() )
|
||||
{
|
||||
@ -3122,10 +3172,10 @@ void CMDLCache::ProcessPendingAsyncs( MDLCacheDataType_t type )
|
||||
// things -- the LRU is in correct order, and it catches precached items lurking
|
||||
// in the async queue that have only been requested once (thus aren't being cached
|
||||
// and might lurk forever, e.g., wood gibs in the citadel)
|
||||
int current = m_PendingAsyncs.Head();
|
||||
intp current = m_PendingAsyncs.Head();
|
||||
while ( current != m_PendingAsyncs.InvalidIndex() )
|
||||
{
|
||||
int next = m_PendingAsyncs.Next( current );
|
||||
intp next = m_PendingAsyncs.Next( current );
|
||||
|
||||
if ( type == MDLCACHE_NONE || m_PendingAsyncs[current].type == type )
|
||||
{
|
||||
@ -3148,7 +3198,7 @@ void CMDLCache::ProcessPendingAsyncs( MDLCacheDataType_t type )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CMDLCache::ClearAsync( MDLHandle_t handle, MDLCacheDataType_t type, int iAnimBlock, bool bAbort )
|
||||
{
|
||||
int iAsyncInfo = GetAsyncInfoIndex( handle, type, iAnimBlock );
|
||||
intp iAsyncInfo = GetAsyncInfoIndex( handle, type, iAnimBlock );
|
||||
if ( iAsyncInfo != NO_ASYNC )
|
||||
{
|
||||
AsyncInfo_t *pInfo;
|
||||
@ -3242,7 +3292,7 @@ bool CMDLCache::SetAsyncLoad( MDLCacheDataType_t type, bool bAsync )
|
||||
//-----------------------------------------------------------------------------
|
||||
vertexFileHeader_t *CMDLCache::BuildAndCacheVertexData( studiohdr_t *pStudioHdr, vertexFileHeader_t *pRawVvdHdr )
|
||||
{
|
||||
MDLHandle_t handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
MDLHandle_t handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
vertexFileHeader_t *pVvdHdr;
|
||||
|
||||
MdlCacheMsg( "MDLCache: Load VVD for %s\n", pStudioHdr->pszName() );
|
||||
@ -3330,7 +3380,7 @@ vertexFileHeader_t *CMDLCache::LoadVertexData( studiohdr_t *pStudioHdr )
|
||||
MDLHandle_t handle;
|
||||
|
||||
Assert( pStudioHdr );
|
||||
handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
Assert( !m_MDLDict[handle]->m_VertexCache );
|
||||
|
||||
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||
@ -3340,7 +3390,7 @@ vertexFileHeader_t *CMDLCache::LoadVertexData( studiohdr_t *pStudioHdr )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VERTEXES );
|
||||
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VERTEXES );
|
||||
|
||||
if ( iAsync == NO_ASYNC )
|
||||
{
|
||||
@ -3420,7 +3470,7 @@ void CMDLCache::CacheData( DataCacheHandle_t *c, void *pData, int size, const ch
|
||||
}
|
||||
|
||||
if ( id == (DataCacheClientID_t)-1 )
|
||||
id = (DataCacheClientID_t)pData;
|
||||
id = (DataCacheClientID_t)(intp)pData;
|
||||
|
||||
GetCacheSection( type )->Add(id, pData, size, c );
|
||||
}
|
||||
@ -3584,7 +3634,7 @@ void CMDLCache::QueuedLoaderCallback_MDL( void *pContext, void *pContext2, const
|
||||
|
||||
// journal each incoming buffer
|
||||
ModelParts_t *pModelParts = (ModelParts_t *)pContext;
|
||||
ModelParts_t::BufferType_t bufferType = static_cast< ModelParts_t::BufferType_t >((int)pContext2);
|
||||
ModelParts_t::BufferType_t bufferType = static_cast< ModelParts_t::BufferType_t >((intp)pContext2);
|
||||
pModelParts->Buffers[bufferType].SetExternalBuffer( (void *)pData, nSize, nSize, CUtlBuffer::READ_ONLY );
|
||||
pModelParts->nLoadedParts += (1 << bufferType);
|
||||
|
||||
@ -3895,7 +3945,7 @@ void CMDLCache::MarkFrame()
|
||||
const studiohdr_t *studiohdr_t::FindModel( void **cache, char const *pModelName ) const
|
||||
{
|
||||
MDLHandle_t handle = g_MDLCache.FindMDL( pModelName );
|
||||
*cache = (void*)(uintp)handle;
|
||||
*cache = MDLHandleToVirtual(handle);
|
||||
return g_MDLCache.GetStudioHdr( handle );
|
||||
}
|
||||
|
||||
@ -3904,21 +3954,21 @@ virtualmodel_t *studiohdr_t::GetVirtualModel( void ) const
|
||||
if (numincludemodels == 0)
|
||||
return NULL;
|
||||
|
||||
return g_MDLCache.GetVirtualModelFast( this, (MDLHandle_t)(int)virtualModel&0xffff );
|
||||
return g_MDLCache.GetVirtualModelFast( this, VoidPtrToMDLHandle( VirtualModel() ) );
|
||||
}
|
||||
|
||||
byte *studiohdr_t::GetAnimBlock( int i ) const
|
||||
{
|
||||
return g_MDLCache.GetAnimBlock( (MDLHandle_t)(int)virtualModel&0xffff, i );
|
||||
return g_MDLCache.GetAnimBlock( VoidPtrToMDLHandle( VirtualModel() ), i );
|
||||
}
|
||||
|
||||
int studiohdr_t::GetAutoplayList( unsigned short **pOut ) const
|
||||
{
|
||||
return g_MDLCache.GetAutoplayList( (MDLHandle_t)(int)virtualModel&0xffff, pOut );
|
||||
return g_MDLCache.GetAutoplayList( VoidPtrToMDLHandle( VirtualModel() ), pOut );
|
||||
}
|
||||
|
||||
const studiohdr_t *virtualgroup_t::GetStudioHdr( void ) const
|
||||
{
|
||||
return g_MDLCache.GetStudioHdr( (MDLHandle_t)(int)cache&0xffff );
|
||||
return g_MDLCache.GetStudioHdr( VoidPtrToMDLHandle( cache ) );
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,9 @@ bool CDataModel::Unserialize( CUtlBuffer &inBuf, const char *pEncodingName, cons
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !defined(NO_MALLOC_OVERRIDE)
|
||||
g_pMemAlloc->heapchk();
|
||||
#endif
|
||||
|
||||
DmxHeader_t header;
|
||||
bool bStoresVersionInFile = pSerializer->StoresVersionInFile();
|
||||
@ -1656,7 +1658,7 @@ DmAttributeReferenceIterator_t CDataModel::FirstAttributeReferencingElement( DmE
|
||||
if ( !pRef || pRef->m_attributes.m_hAttribute == DMATTRIBUTE_HANDLE_INVALID )
|
||||
return DMATTRIBUTE_REFERENCE_ITERATOR_INVALID;
|
||||
|
||||
return ( DmAttributeReferenceIterator_t )( int )&pRef->m_attributes;
|
||||
return ( DmAttributeReferenceIterator_t )( intp )&pRef->m_attributes;
|
||||
}
|
||||
|
||||
DmAttributeReferenceIterator_t CDataModel::NextAttributeReferencingElement( DmAttributeReferenceIterator_t hAttrIter )
|
||||
@ -1665,7 +1667,7 @@ DmAttributeReferenceIterator_t CDataModel::NextAttributeReferencingElement( DmAt
|
||||
if ( !pList )
|
||||
return DMATTRIBUTE_REFERENCE_ITERATOR_INVALID;
|
||||
|
||||
return ( DmAttributeReferenceIterator_t )( int )pList->m_pNext;
|
||||
return ( DmAttributeReferenceIterator_t )( intp )pList->m_pNext;
|
||||
}
|
||||
|
||||
CDmAttribute *CDataModel::GetAttribute( DmAttributeReferenceIterator_t hAttrIter )
|
||||
|
@ -67,7 +67,7 @@ bool HashEntryCompareFunc( CAttributeNode *const& lhs, CAttributeNode *const& rh
|
||||
|
||||
uint HashEntryKeyFunc( CAttributeNode *const& keyinfo )
|
||||
{
|
||||
uint i = (uint)keyinfo->m_attribute;
|
||||
uintp i = (uintp)keyinfo->m_attribute;
|
||||
return i >> 2; // since memory is allocated on a 4-byte (at least!) boundary
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,8 @@ public:
|
||||
DELEGATE_TO_OBJECT_0( int, heapchk, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_0( bool, IsDebugHeap, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_2V( GetActualDbgInfo, const char *&, int &, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_5V( RegisterAllocation, const char *, int, int, int, unsigned, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_5V( RegisterDeallocation, const char *, int, int, int, unsigned, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_5V( RegisterAllocation, const char *, int, size_t, size_t, unsigned, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_5V( RegisterDeallocation, const char *, int, size_t, size_t, unsigned, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_0( int, GetVersion, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_0V( CompactHeap, m_pMemAlloc );
|
||||
DELEGATE_TO_OBJECT_1( MemAllocFailHandler_t, SetAllocFailHandler, MemAllocFailHandler_t, m_pMemAlloc );
|
||||
|
@ -208,8 +208,8 @@ protected:
|
||||
public:
|
||||
struct ModelFileHandleHash
|
||||
{
|
||||
uint operator()( model_t *p ) const { return Mix32HashFunctor()( (uint32)( p->fnHandle ) ); }
|
||||
uint operator()( FileNameHandle_t fn ) const { return Mix32HashFunctor()( (uint32) fn ); }
|
||||
uint operator()( model_t *p ) const { return PointerHashFunctor()( p->fnHandle ); }
|
||||
uint operator()( FileNameHandle_t fn ) const { return PointerHashFunctor()( fn ); }
|
||||
};
|
||||
struct ModelFileHandleEq
|
||||
{
|
||||
@ -532,7 +532,7 @@ const studiohdr_t *CModelInfo::FindModel( const studiohdr_t *pStudioHdr, void **
|
||||
//-----------------------------------------------------------------------------
|
||||
const studiohdr_t *CModelInfo::FindModel( void *cache ) const
|
||||
{
|
||||
return g_pMDLCache->GetStudioHdr( (MDLHandle_t)(int)cache&0xffff );
|
||||
return g_pMDLCache->GetStudioHdr( VoidPtrToMDLHandle( cache ) );
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +541,7 @@ const studiohdr_t *CModelInfo::FindModel( void *cache ) const
|
||||
//-----------------------------------------------------------------------------
|
||||
virtualmodel_t *CModelInfo::GetVirtualModel( const studiohdr_t *pStudioHdr ) const
|
||||
{
|
||||
MDLHandle_t handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
MDLHandle_t handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
return g_pMDLCache->GetVirtualModelFast( pStudioHdr, handle );
|
||||
}
|
||||
|
||||
@ -550,13 +550,13 @@ virtualmodel_t *CModelInfo::GetVirtualModel( const studiohdr_t *pStudioHdr ) con
|
||||
//-----------------------------------------------------------------------------
|
||||
byte *CModelInfo::GetAnimBlock( const studiohdr_t *pStudioHdr, int nBlock ) const
|
||||
{
|
||||
MDLHandle_t handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
MDLHandle_t handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
return g_pMDLCache->GetAnimBlock( handle, nBlock );
|
||||
}
|
||||
|
||||
int CModelInfo::GetAutoplayList( const studiohdr_t *pStudioHdr, unsigned short **pAutoplayList ) const
|
||||
{
|
||||
MDLHandle_t handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
||||
MDLHandle_t handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||
return g_pMDLCache->GetAutoplayList( handle, pAutoplayList );
|
||||
}
|
||||
|
||||
@ -576,22 +576,22 @@ virtualmodel_t *studiohdr_t::GetVirtualModel( void ) const
|
||||
{
|
||||
if ( numincludemodels == 0 )
|
||||
return NULL;
|
||||
return g_pMDLCache->GetVirtualModelFast( this, (MDLHandle_t)(int)virtualModel&0xffff );
|
||||
return g_pMDLCache->GetVirtualModelFast( this, VoidPtrToMDLHandle( VirtualModel() ) );
|
||||
}
|
||||
|
||||
byte *studiohdr_t::GetAnimBlock( int i ) const
|
||||
{
|
||||
return g_pMDLCache->GetAnimBlock( (MDLHandle_t)(int)virtualModel&0xffff, i );
|
||||
return g_pMDLCache->GetAnimBlock( VoidPtrToMDLHandle( VirtualModel() ), i );
|
||||
}
|
||||
|
||||
int studiohdr_t::GetAutoplayList( unsigned short **pOut ) const
|
||||
{
|
||||
return g_pMDLCache->GetAutoplayList( (MDLHandle_t)(int)virtualModel&0xffff, pOut );
|
||||
return g_pMDLCache->GetAutoplayList( VoidPtrToMDLHandle( VirtualModel() ), pOut );
|
||||
}
|
||||
|
||||
const studiohdr_t *virtualgroup_t::GetStudioHdr( void ) const
|
||||
{
|
||||
return g_pMDLCache->GetStudioHdr( (MDLHandle_t)(int)cache&0xffff );
|
||||
return g_pMDLCache->GetStudioHdr( VoidPtrToMDLHandle( cache ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1962,7 +1962,7 @@ public:
|
||||
{
|
||||
int m_channelNum;
|
||||
int m_vol; // max volume of sound. -1 means "do not cull, ever, do not even do the math"
|
||||
unsigned int m_nameHash; // a unique id for a sound file
|
||||
uintp m_nameHash; // a unique id for a sound file
|
||||
};
|
||||
protected:
|
||||
sChannelVolData m_channelInfo[MAX_CHANNELS];
|
||||
@ -1994,7 +1994,7 @@ void CChannelCullList::Initialize( CChannelList &list )
|
||||
{
|
||||
m_channelInfo[i].m_vol = ChannelLoudestCurVolume(ch);
|
||||
AssertMsg(m_channelInfo[i].m_vol >= 0, "Sound channel has a negative volume?");
|
||||
m_channelInfo[i].m_nameHash = (unsigned int) ch->sfx;
|
||||
m_channelInfo[i].m_nameHash = (uintp) ch->sfx;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2029,7 +2029,7 @@ void CChannelCullList::Initialize( CChannelList &list )
|
||||
++j )
|
||||
{
|
||||
// j steps through the sorted list until we find ourselves:
|
||||
if (m_channelInfo[j].m_nameHash == (unsigned int)(ch->sfx))
|
||||
if (m_channelInfo[j].m_nameHash == (uintp)(ch->sfx))
|
||||
{
|
||||
// that's another channel playing this sound but louder than me
|
||||
++howManyLouder;
|
||||
|
@ -93,7 +93,7 @@ CAudioSourceMP3::CAudioSourceMP3( CSfxTable *pSfx )
|
||||
|
||||
m_dataStart = 0;
|
||||
|
||||
int file = g_pSndIO->open( pSfx->GetFileName() );
|
||||
intp file = g_pSndIO->open( pSfx->GetFileName() );
|
||||
if ( file != -1 )
|
||||
{
|
||||
m_dataSize = g_pSndIO->size( file );
|
||||
@ -239,7 +239,7 @@ void CAudioSourceMP3::GetCacheData( CAudioSourceCachedInfo *info )
|
||||
info->SetSampleRate( m_sampleRate );
|
||||
info->SetDataStart( 0 );
|
||||
|
||||
int file = g_pSndIO->open( m_pSfx->GetFileName() );
|
||||
intp file = g_pSndIO->open( m_pSfx->GetFileName() );
|
||||
if ( !file )
|
||||
{
|
||||
Warning( "Failed to find file for building soundcache [ %s ]\n", m_pSfx->GetFileName() );
|
||||
|
@ -723,7 +723,7 @@ bool CAudioSourceWave::GetStartupData( void *dest, int destsize, int& bytesCopie
|
||||
// requesting precache snippet as leader for streaming startup latency
|
||||
if ( destsize )
|
||||
{
|
||||
int file = g_pSndIO->open( m_pSfx->GetFileName() );
|
||||
intp file = g_pSndIO->open( m_pSfx->GetFileName() );
|
||||
if ( !file )
|
||||
{
|
||||
return false;
|
||||
|
@ -141,7 +141,7 @@ bool CMixerControls::GetValue_Float(Control iControl, float &value)
|
||||
case MicVolume:
|
||||
{
|
||||
OSStatus theError = noErr;
|
||||
for ( int iChannel = 0; iChannel < 3; iChannel++ )
|
||||
for ( uint iChannel = 0; iChannel < 3; iChannel++ )
|
||||
{
|
||||
// scan the channel list until you find a channel set to non-zero, then use that
|
||||
Float32 theVolume = 0;
|
||||
|
@ -645,7 +645,7 @@ void Cmd_Exec_f( const CCommand &args )
|
||||
ConDMsg( "execing %s\n", szFile );
|
||||
|
||||
// check to make sure we're not going to overflow the cmd_text buffer
|
||||
int hCommand = s_CommandBuffer.GetNextCommandHandle();
|
||||
CommandHandle_t hCommand = s_CommandBuffer.GetNextCommandHandle();
|
||||
|
||||
// Execute each command immediately
|
||||
const char *pszDataPtr = f;
|
||||
|
@ -228,7 +228,7 @@ public:
|
||||
// Fill out the meshlist for this terrain patch
|
||||
virtual void GetVirtualMesh( void *userData, virtualmeshlist_t *pList )
|
||||
{
|
||||
int index = (int)userData;
|
||||
intp index = (intp)userData;
|
||||
Assert(index >= 0 && index < g_DispCollTreeCount );
|
||||
g_pDispCollTrees[index].GetVirtualMeshList( pList );
|
||||
pList->pHull = NULL;
|
||||
@ -243,14 +243,14 @@ public:
|
||||
// returns the bounds for the terrain patch
|
||||
virtual void GetWorldspaceBounds( void *userData, Vector *pMins, Vector *pMaxs )
|
||||
{
|
||||
int index = (int)userData;
|
||||
intp index = (intp)userData;
|
||||
*pMins = g_pDispBounds[index].mins;
|
||||
*pMaxs = g_pDispBounds[index].maxs;
|
||||
}
|
||||
// Query against the AABB tree to find the list of triangles for this patch in a sphere
|
||||
virtual void GetTrianglesInSphere( void *userData, const Vector ¢er, float radius, virtualmeshtrianglelist_t *pList )
|
||||
{
|
||||
int index = (int)userData;
|
||||
intp index = (intp)userData;
|
||||
pList->triangleCount = g_pDispCollTrees[index].AABBTree_GetTrisInSphere( center, radius, pList->triangleIndices, ARRAYSIZE(pList->triangleIndices) );
|
||||
}
|
||||
void LevelInit( dphysdisp_t *pLump, int lumpSize )
|
||||
|
@ -4895,7 +4895,7 @@ void CColorOperationListPanel::PopulateList( )
|
||||
KeyValues *kv = new KeyValues( "operation", "layer", op->GetName() );
|
||||
kv->SetInt( "image", (op->IsEnabled())?1:0 );
|
||||
|
||||
m_pOperationListPanel->AddItem( kv, (unsigned int)op, false, false );
|
||||
m_pOperationListPanel->AddItem( kv, (uintp)op, false, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -547,9 +547,9 @@ bool CDispInfo::Render( CGroupMesh *pGroup, bool bAllowDebugModes )
|
||||
VectorAdd( bbMin, bbMax, vecCenter );
|
||||
vecCenter *= 0.5f;
|
||||
|
||||
int nInt = ( mat_surfaceid.GetInt() != 2 ) ? (int)m_ParentSurfID : (msurface2_t*)m_ParentSurfID - host_state.worldbrush->surfaces2;
|
||||
intp nInt = ( mat_surfaceid.GetInt() != 2 ) ? (intp)m_ParentSurfID : (msurface2_t*)m_ParentSurfID - host_state.worldbrush->surfaces2;
|
||||
char buf[32];
|
||||
Q_snprintf( buf, sizeof( buf ), "%d", nInt );
|
||||
Q_snprintf( buf, sizeof( buf ), "%d", (int)nInt );
|
||||
CDebugOverlay::AddTextOverlay( vecCenter, 0, buf );
|
||||
}
|
||||
|
||||
|
@ -764,7 +764,7 @@ void DispInfo_BatchDecals( CDispInfo **pVisibleDisps, int nVisibleDisps )
|
||||
// There is only one group at a time.
|
||||
int iGroup = 0;
|
||||
|
||||
int iPool = g_aDispDecalSortPool.Alloc( true );
|
||||
intp iPool = g_aDispDecalSortPool.Alloc( true );
|
||||
g_aDispDecalSortPool[iPool] = decal.m_pDecal;
|
||||
|
||||
int iSortTree = decal.m_pDecal->m_iSortTree;
|
||||
@ -773,7 +773,7 @@ void DispInfo_BatchDecals( CDispInfo **pVisibleDisps, int nVisibleDisps )
|
||||
DecalMaterialBucket_t &materialBucket = g_aDispDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iSortMaterial );
|
||||
if ( materialBucket.m_nCheckCount == g_nDispDecalSortCheckCount )
|
||||
{
|
||||
int iHead = materialBucket.m_iHead;
|
||||
intp iHead = materialBucket.m_iHead;
|
||||
g_aDispDecalSortPool.LinkBefore( iHead, iPool );
|
||||
}
|
||||
|
||||
@ -844,7 +844,7 @@ void DispInfo_DrawDecalsGroup( int iGroup, int iTreeType )
|
||||
if ( materialBucketList.Element( iBucket ).m_nCheckCount != g_nDispDecalSortCheckCount )
|
||||
continue;
|
||||
|
||||
int iHead = materialBucketList.Element( iBucket ).m_iHead;
|
||||
intp iHead = materialBucketList.Element( iBucket ).m_iHead;
|
||||
if ( !g_aDispDecalSortPool.IsValidIndex( iHead ) )
|
||||
continue;
|
||||
|
||||
@ -863,7 +863,7 @@ void DispInfo_DrawDecalsGroup( int iGroup, int iTreeType )
|
||||
bool bBatchInit = true;
|
||||
|
||||
int nCount;
|
||||
int iElement = iHead;
|
||||
intp iElement = iHead;
|
||||
while ( iElement != g_aDispDecalSortPool.InvalidIndex() )
|
||||
{
|
||||
decal_t *pDecal = g_aDispDecalSortPool.Element( iElement );
|
||||
@ -1300,7 +1300,7 @@ int DispInfo_ComputeIndex( HDISPINFOARRAY hArray, IDispInfo* pInfo )
|
||||
if( !pArray )
|
||||
return NULL;
|
||||
|
||||
int iElement = ((int)pInfo - (int)(pArray->m_pDispInfos)) / sizeof(CDispInfo);
|
||||
intp iElement = ((intp)pInfo - (intp)(pArray->m_pDispInfos)) / sizeof(CDispInfo);
|
||||
|
||||
Assert( iElement >= 0 && iElement < pArray->m_nDispInfos );
|
||||
return iElement;
|
||||
|
@ -924,12 +924,12 @@ void CDownloadManager::StartNewDownload()
|
||||
m_lastPercent = 0;
|
||||
|
||||
// Start the thread
|
||||
DWORD threadID;
|
||||
uintp threadID;
|
||||
VCRHook_CreateThread(NULL, 0,
|
||||
#ifdef POSIX
|
||||
(void *)
|
||||
#endif
|
||||
DownloadThread, m_activeRequest, 0, (unsigned long int *)&threadID );
|
||||
DownloadThread, m_activeRequest, 0, &threadID );
|
||||
|
||||
ThreadDetach( ( ThreadHandle_t )threadID );
|
||||
}
|
||||
@ -1070,14 +1070,14 @@ bool CL_IsGamePathValidAndSafeForDownload( const char *pGamePath )
|
||||
class CDownloadSystem : public IDownloadSystem
|
||||
{
|
||||
public:
|
||||
virtual DWORD CreateDownloadThread( RequestContext_t *pContext )
|
||||
virtual uintp CreateDownloadThread( RequestContext_t *pContext )
|
||||
{
|
||||
DWORD nThreadID;
|
||||
uintp nThreadID;
|
||||
VCRHook_CreateThread(NULL, 0,
|
||||
#ifdef POSIX
|
||||
(void*)
|
||||
#endif
|
||||
DownloadThread, pContext, 0, (unsigned long int *)&nThreadID );
|
||||
DownloadThread, pContext, 0, (uintp *)&nThreadID );
|
||||
|
||||
ThreadDetach( ( ThreadHandle_t )nThreadID );
|
||||
return nThreadID;
|
||||
|
@ -175,12 +175,12 @@ void BuildPropOffsetToIndexMap( CSendTablePrecalc *pPrecalc, const CStandardSend
|
||||
{
|
||||
const SendProp *pProp = pPrecalc->m_Props[i];
|
||||
|
||||
int offset = pProp->GetOffset() + (int)pmStack.GetCurStructBase() - 1;
|
||||
intp offset = pProp->GetOffset() + (intp)pmStack.GetCurStructBase() - 1;
|
||||
int elementCount = 1;
|
||||
int elementStride = 0;
|
||||
if ( pProp->GetType() == DPT_Array )
|
||||
{
|
||||
offset = pProp->GetArrayProp()->GetOffset() + (int)pmStack.GetCurStructBase() - 1;
|
||||
offset = pProp->GetArrayProp()->GetOffset() + (intp)pmStack.GetCurStructBase() - 1;
|
||||
elementCount = pProp->m_nElements;
|
||||
elementStride = pProp->m_ElementStride;
|
||||
}
|
||||
|
@ -4747,7 +4747,7 @@ struct EnumLeafBoxInfo_t
|
||||
VectorAligned m_vecBoxCenter;
|
||||
VectorAligned m_vecBoxHalfDiagonal;
|
||||
ISpatialLeafEnumerator *m_pIterator;
|
||||
int m_nContext;
|
||||
intp m_nContext;
|
||||
};
|
||||
|
||||
struct EnumLeafSphereInfo_t
|
||||
@ -4757,7 +4757,7 @@ struct EnumLeafSphereInfo_t
|
||||
Vector m_vecBoxCenter;
|
||||
Vector m_vecBoxHalfDiagonal;
|
||||
ISpatialLeafEnumerator *m_pIterator;
|
||||
int m_nContext;
|
||||
intp m_nContext;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -5094,7 +5094,7 @@ bool EnumerateLeafInSphere_R( mnode_t *node, EnumLeafSphereInfo_t& info, int nTe
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static bool EnumerateLeavesAlongRay_R( mnode_t *node, Ray_t const& ray,
|
||||
float start, float end, ISpatialLeafEnumerator* pEnum, int context )
|
||||
float start, float end, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
// no polygons in solid nodes (don't report these leaves either)
|
||||
if (node->contents == CONTENTS_SOLID)
|
||||
@ -5153,7 +5153,7 @@ static bool EnumerateLeavesAlongRay_R( mnode_t *node, Ray_t const& ray,
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static bool EnumerateLeavesAlongExtrudedRay_R( mnode_t *node, Ray_t const& ray,
|
||||
float start, float end, ISpatialLeafEnumerator* pEnum, int context )
|
||||
float start, float end, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
// no polygons in solid nodes (don't report these leaves either)
|
||||
if (node->contents == CONTENTS_SOLID)
|
||||
@ -5276,10 +5276,10 @@ public:
|
||||
int LeafCount() const;
|
||||
|
||||
// Enumerates the leaves along a ray, box, etc.
|
||||
bool EnumerateLeavesAtPoint( const Vector& pt, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesInBox( const Vector& mins, const Vector& maxs, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesInSphere( const Vector& center, float radius, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesAtPoint( const Vector& pt, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
bool EnumerateLeavesInBox( const Vector& mins, const Vector& maxs, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
bool EnumerateLeavesInSphere( const Vector& center, float radius, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -5304,7 +5304,7 @@ int CEngineBSPTree::LeafCount() const
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool CEngineBSPTree::EnumerateLeavesAtPoint( const Vector& pt,
|
||||
ISpatialLeafEnumerator* pEnum, int context )
|
||||
ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
int leaf = CM_PointLeafnum( pt );
|
||||
return pEnum->EnumerateLeaf( leaf, context );
|
||||
@ -5315,7 +5315,7 @@ static ConVar opt_EnumerateLeavesFastAlgorithm( "opt_EnumerateLeavesFastAlgorith
|
||||
|
||||
|
||||
bool CEngineBSPTree::EnumerateLeavesInBox( const Vector& mins, const Vector& maxs,
|
||||
ISpatialLeafEnumerator* pEnum, int context )
|
||||
ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
if ( !host_state.worldmodel )
|
||||
return false;
|
||||
@ -5340,7 +5340,7 @@ bool CEngineBSPTree::EnumerateLeavesInBox( const Vector& mins, const Vector& max
|
||||
|
||||
|
||||
bool CEngineBSPTree::EnumerateLeavesInSphere( const Vector& center, float radius,
|
||||
ISpatialLeafEnumerator* pEnum, int context )
|
||||
ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
EnumLeafSphereInfo_t info;
|
||||
info.m_vecCenter = center;
|
||||
@ -5354,7 +5354,7 @@ bool CEngineBSPTree::EnumerateLeavesInSphere( const Vector& center, float radius
|
||||
}
|
||||
|
||||
|
||||
bool CEngineBSPTree::EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int context )
|
||||
bool CEngineBSPTree::EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
if (!ray.m_IsSwept)
|
||||
{
|
||||
|
@ -872,7 +872,7 @@ public:
|
||||
virtual void SetupLighting( const Vector &vecCenter );
|
||||
virtual void SuppressEngineLighting( bool bSuppress );
|
||||
|
||||
inline vertexFileHeader_t *CacheVertexData() { return g_pMDLCache->GetVertexData( (MDLHandle_t)(int)m_pStudioHdr->virtualModel&0xffff ); }
|
||||
inline vertexFileHeader_t *CacheVertexData() { return g_pMDLCache->GetVertexData( VoidPtrToMDLHandle( m_pStudioHdr->VirtualModel() ) ); }
|
||||
|
||||
bool Init();
|
||||
void Shutdown();
|
||||
@ -4121,7 +4121,7 @@ bool CModelRender::UpdateStaticPropColorData( IHandleEntity *pProp, ModelInstanc
|
||||
if ( !bDebugColor )
|
||||
{
|
||||
// vertexes must be available for lighting calculation
|
||||
vertexFileHeader_t *pVertexHdr = g_pMDLCache->GetVertexData( (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff );
|
||||
vertexFileHeader_t *pVertexHdr = g_pMDLCache->GetVertexData( VoidPtrToMDLHandle( pStudioHdr->VirtualModel() ) );
|
||||
if ( !pVertexHdr )
|
||||
{
|
||||
// data not available yet
|
||||
|
@ -1869,6 +1869,12 @@ void Mod_LoadFaces( void )
|
||||
|
||||
// align these allocations
|
||||
// If you trip one of these, you need to rethink the alignment of the struct
|
||||
#ifdef PLATFORM_64BITS
|
||||
msurface1_t *out1 = Hunk_AllocNameAlignedClear< msurface1_t >( count, alignof(msurface1_t), va( "%s [%s]", lh.GetLoadName(), "surface1" ) );
|
||||
msurface2_t *out2 = Hunk_AllocNameAlignedClear< msurface2_t >( count, alignof(msurface2_t), va( "%s [%s]", lh.GetLoadName(), "surface2" ) );
|
||||
|
||||
msurfacelighting_t *pLighting = Hunk_AllocNameAlignedClear< msurfacelighting_t >( count, alignof(msurfacelighting_t), va( "%s [%s]", lh.GetLoadName(), "surfacelighting" ) );
|
||||
#else
|
||||
Assert( sizeof(msurface1_t) == 16 );
|
||||
Assert( sizeof(msurface2_t) == 32 );
|
||||
Assert( sizeof(msurfacelighting_t) == 32 );
|
||||
@ -1877,6 +1883,7 @@ void Mod_LoadFaces( void )
|
||||
msurface2_t *out2 = Hunk_AllocNameAlignedClear< msurface2_t >( count, 32, va( "%s [%s]", lh.GetLoadName(), "surface2" ) );
|
||||
|
||||
msurfacelighting_t *pLighting = Hunk_AllocNameAlignedClear< msurfacelighting_t >( count, 32, va( "%s [%s]", lh.GetLoadName(), "surfacelighting" ) );
|
||||
#endif
|
||||
|
||||
lh.GetMap()->surfaces1 = out1;
|
||||
lh.GetMap()->surfaces2 = out2;
|
||||
@ -2860,7 +2867,7 @@ void Mod_TouchAllData( model_t *pModel, int nServerCount )
|
||||
// skip self, start at children
|
||||
for ( int i=1; i<pVirtualModel->m_group.Count(); ++i )
|
||||
{
|
||||
MDLHandle_t childHandle = (MDLHandle_t)(int)pVirtualModel->m_group[i].cache&0xffff;
|
||||
MDLHandle_t childHandle = (MDLHandle_t)(intp)pVirtualModel->m_group[i].cache&0xffff;
|
||||
model_t *pChildModel = (model_t *)g_pMDLCache->GetUserData( childHandle );
|
||||
if ( pChildModel )
|
||||
{
|
||||
@ -4325,7 +4332,7 @@ public:
|
||||
m_pShared = pBrush->brush.pShared;
|
||||
m_count = 0;
|
||||
}
|
||||
bool EnumerateLeaf( int leaf, int )
|
||||
bool EnumerateLeaf( int leaf, intp )
|
||||
{
|
||||
// garymcthack - need to test identity brush models
|
||||
int flags = ( m_pShared->leafs[leaf].leafWaterDataID == -1 ) ? SURFDRAW_ABOVEWATER : SURFDRAW_UNDERWATER;
|
||||
@ -4372,7 +4379,7 @@ static void MarkBrushModelWaterSurfaces( model_t* world,
|
||||
model_t* pTemp = host_state.worldmodel;
|
||||
CBrushBSPIterator brushIterator( world, brush );
|
||||
host_state.SetWorldModel( world );
|
||||
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, &brushIterator, (int)brush );
|
||||
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, &brushIterator, (intp)brush );
|
||||
brushIterator.CheckSurfaces();
|
||||
host_state.SetWorldModel( pTemp );
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ private:
|
||||
CPureServerWhitelist::CCommand *pBestEntry );
|
||||
|
||||
unsigned short m_LoadCounter; // Incremented as we load things so their m_LoadOrder increases.
|
||||
volatile long int m_RefCount;
|
||||
volatile int32 m_RefCount;
|
||||
|
||||
// Commands are applied to files in order.
|
||||
CUtlDict<CCommand*,int> m_FileCommands; // file commands
|
||||
|
@ -2001,9 +2001,9 @@ void R_DrawDecalsAllImmediate_GatherDecals( IMatRenderContext *pRenderContext, i
|
||||
if ( g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_nCheckCount != nCheckCount )
|
||||
continue;
|
||||
|
||||
int iHead = g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_iHead;
|
||||
intp iHead = g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_iHead;
|
||||
|
||||
int iElement = iHead;
|
||||
intp iElement = iHead;
|
||||
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||
{
|
||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
||||
@ -2155,10 +2155,10 @@ void R_DrawDecalsAllImmediate( IMatRenderContext *pRenderContext, int iGroup, in
|
||||
if ( g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_nCheckCount != nCheckCount )
|
||||
continue;
|
||||
|
||||
int iHead = g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_iHead;
|
||||
intp iHead = g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_iHead;
|
||||
|
||||
int nCount;
|
||||
int iElement = iHead;
|
||||
intp iElement = iHead;
|
||||
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||
{
|
||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
||||
@ -2330,7 +2330,7 @@ void R_DrawDecalsAll_GatherDecals( IMatRenderContext *pRenderContext, int iGroup
|
||||
if ( bucket.m_nCheckCount != nCheckCount )
|
||||
continue;
|
||||
|
||||
int iHead = bucket.m_iHead;
|
||||
intp iHead = bucket.m_iHead;
|
||||
if ( !g_aDecalSortPool.IsValidIndex( iHead ) )
|
||||
continue;
|
||||
|
||||
@ -2346,7 +2346,7 @@ void R_DrawDecalsAll_GatherDecals( IMatRenderContext *pRenderContext, int iGroup
|
||||
|
||||
DrawDecals.AddToTail( DECALMARKERS_SWITCHBUCKET );
|
||||
|
||||
int iElement = iHead;
|
||||
intp iElement = iHead;
|
||||
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||
{
|
||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
||||
@ -3015,7 +3015,7 @@ void DecalSurfaceAdd( SurfaceHandle_t surfID, int iGroup )
|
||||
}
|
||||
|
||||
pDecal->flags &= ~FDECAL_HASUPDATED;
|
||||
int iPool = g_aDecalSortPool.Alloc( true );
|
||||
intp iPool = g_aDecalSortPool.Alloc( true );
|
||||
if ( iPool != g_aDecalSortPool.InvalidIndex() )
|
||||
{
|
||||
g_aDecalSortPool[iPool] = pDecal;
|
||||
@ -3024,7 +3024,7 @@ void DecalSurfaceAdd( SurfaceHandle_t surfID, int iGroup )
|
||||
DecalMaterialBucket_t &bucket = sortTree.m_aDecalSortBuckets[iGroup][iTreeType].Element( pDecal->m_iSortMaterial );
|
||||
if ( bucket.m_nCheckCount == nCheckCount )
|
||||
{
|
||||
int iHead = bucket.m_iHead;
|
||||
intp iHead = bucket.m_iHead;
|
||||
g_aDecalSortPool.LinkBefore( iHead, iPool );
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ struct DecalMaterialSortData_t
|
||||
|
||||
struct DecalMaterialBucket_t
|
||||
{
|
||||
int m_iHead;
|
||||
intp m_iHead;
|
||||
int m_nCheckCount;
|
||||
};
|
||||
|
||||
@ -82,16 +82,16 @@ inline bool DecalSortTreeSortLessFunc( const DecalMaterialSortData_t &decal1, co
|
||||
{
|
||||
if ( ( decal1.m_iLightmapPage == -1 ) || ( decal2.m_iLightmapPage == -1 ) )
|
||||
{
|
||||
return ( ( int )decal1.m_pMaterial < ( int )decal2.m_pMaterial );
|
||||
return ( ( intp )decal1.m_pMaterial < ( intp )decal2.m_pMaterial );
|
||||
}
|
||||
|
||||
if ( ( int )decal1.m_pMaterial == ( int )decal2.m_pMaterial )
|
||||
if ( ( intp )decal1.m_pMaterial == ( intp )decal2.m_pMaterial )
|
||||
{
|
||||
return ( decal1.m_iLightmapPage < decal2.m_iLightmapPage );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( ( int )decal1.m_pMaterial < ( int )decal2.m_pMaterial );
|
||||
return ( ( intp )decal1.m_pMaterial < ( intp )decal2.m_pMaterial );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ private:
|
||||
CSaveDirectory *m_pSaveDirectory;
|
||||
CUtlMap<CUtlSymbol, SaveFile_t> &GetDirectory( void ) { return m_pSaveDirectory->m_Files; }
|
||||
SaveFile_t &GetFile( const int idx ) { return m_pSaveDirectory->m_Files[idx]; }
|
||||
SaveFile_t &GetFile( const FileHandle_t hFile ) { return GetFile( (unsigned int)hFile ); }
|
||||
SaveFile_t &GetFile( const FileHandle_t hFile ) { return GetFile( (uintp)hFile ); }
|
||||
|
||||
FileHandle_t GetFileHandle( const char *pFileName );
|
||||
int GetFileIndex( const char *pFileName );
|
||||
@ -331,7 +331,7 @@ bool CSaveRestoreFileSystem::FileExists( const char *pFileName, const char *pPat
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CSaveRestoreFileSystem::HandleIsValid( FileHandle_t hFile )
|
||||
{
|
||||
return hFile && GetDirectory().IsValidIndex( (unsigned int)hFile );
|
||||
return hFile && GetDirectory().IsValidIndex( (uintp)hFile );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -588,7 +588,7 @@ FSAsyncStatus_t CSaveRestoreFileSystem::AsyncWrite( const char *pFileName, const
|
||||
FileHandle_t hFile = Open( pFileName, "wb" );
|
||||
if ( hFile )
|
||||
{
|
||||
SaveFile_t &file = GetFile( (unsigned int)hFile );
|
||||
SaveFile_t &file = GetFile( (uintp)hFile );
|
||||
|
||||
if( file.eType == WRITE_ONLY )
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
virtual unsigned short InvalidShadowIndex( );
|
||||
|
||||
// Methods of ISpatialLeafEnumerator
|
||||
virtual bool EnumerateLeaf( int leaf, int context );
|
||||
virtual bool EnumerateLeaf( int leaf, intp context );
|
||||
|
||||
// Sets the texture coordinate range for a shadow...
|
||||
virtual void SetShadowTexCoord( ShadowHandle_t handle, float x, float y, float w, float h );
|
||||
@ -605,7 +605,7 @@ void CShadowMgr::SetMaterial( Shadow_t& shadow, IMaterial* pMaterial, IMaterial*
|
||||
}
|
||||
|
||||
// Search the sort order handles for an enumeration id match
|
||||
int materialEnum = (int)pMaterial;
|
||||
int materialEnum = (intp)pMaterial;
|
||||
for (unsigned short i = m_SortOrderIds.Head(); i != m_SortOrderIds.InvalidIndex();
|
||||
i = m_SortOrderIds.Next(i) )
|
||||
{
|
||||
@ -1536,7 +1536,7 @@ void CShadowMgr::ProjectShadow( ShadowHandle_t handle, const Vector &origin,
|
||||
for ( int i = 0; i < nLeafCount; ++i )
|
||||
{
|
||||
// NOTE: Scope specifier eliminates virtual function call
|
||||
CShadowMgr::EnumerateLeaf( pLeafList[i], (int)&build );
|
||||
CShadowMgr::EnumerateLeaf( pLeafList[i], (intp)&build );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1650,7 +1650,7 @@ void CShadowMgr::ProjectFlashlight( ShadowHandle_t handle, const VMatrix& worldT
|
||||
for ( int i = 0; i < nLeafCount; ++i )
|
||||
{
|
||||
// NOTE: Scope specifier eliminates virtual function call
|
||||
CShadowMgr::EnumerateLeaf( pLeafList[i], (int)&build );
|
||||
CShadowMgr::EnumerateLeaf( pLeafList[i], (intp)&build );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1809,7 +1809,7 @@ void CShadowMgr::ApplyShadowToLeaf( const Shadow_t &shadow, mleaf_t* RESTRICT pL
|
||||
//-----------------------------------------------------------------------------
|
||||
// Applies a projected texture to all surfaces in the leaf
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CShadowMgr::EnumerateLeaf( int leaf, int context )
|
||||
bool CShadowMgr::EnumerateLeaf( int leaf, intp context )
|
||||
{
|
||||
VPROF( "CShadowMgr::EnumerateLeaf" );
|
||||
ShadowBuildInfo_t* pBuild = (ShadowBuildInfo_t*)context;
|
||||
|
@ -20,17 +20,17 @@
|
||||
class COM_IOReadBinary : public IFileReadBinary
|
||||
{
|
||||
public:
|
||||
int open( const char *pFileName );
|
||||
int read( void *pOutput, int size, int file );
|
||||
void seek( int file, int pos );
|
||||
unsigned int tell( int file );
|
||||
unsigned int size( int file );
|
||||
void close( int file );
|
||||
intp open( const char *pFileName );
|
||||
int read( void *pOutput, int size, intp file );
|
||||
void seek( intp file, int pos );
|
||||
unsigned int tell( intp file );
|
||||
unsigned int size( intp file );
|
||||
void close( intp file );
|
||||
};
|
||||
|
||||
|
||||
// prepend sound/ to the filename -- all sounds are loaded from the sound/ directory
|
||||
int COM_IOReadBinary::open( const char *pFileName )
|
||||
intp COM_IOReadBinary::open( const char *pFileName )
|
||||
{
|
||||
char namebuffer[512];
|
||||
FileHandle_t hFile;
|
||||
@ -46,10 +46,10 @@ int COM_IOReadBinary::open( const char *pFileName )
|
||||
|
||||
hFile = g_pFileSystem->Open( namebuffer, "rb", "GAME" );
|
||||
|
||||
return (int)hFile;
|
||||
return (intp)hFile;
|
||||
}
|
||||
|
||||
int COM_IOReadBinary::read( void *pOutput, int size, int file )
|
||||
int COM_IOReadBinary::read( void *pOutput, int size, intp file )
|
||||
{
|
||||
if ( !file )
|
||||
return 0;
|
||||
@ -57,7 +57,7 @@ int COM_IOReadBinary::read( void *pOutput, int size, int file )
|
||||
return g_pFileSystem->Read( pOutput, size, (FileHandle_t)file );
|
||||
}
|
||||
|
||||
void COM_IOReadBinary::seek( int file, int pos )
|
||||
void COM_IOReadBinary::seek( intp file, int pos )
|
||||
{
|
||||
if ( !file )
|
||||
return;
|
||||
@ -65,7 +65,7 @@ void COM_IOReadBinary::seek( int file, int pos )
|
||||
g_pFileSystem->Seek( (FileHandle_t)file, pos, FILESYSTEM_SEEK_HEAD );
|
||||
}
|
||||
|
||||
unsigned int COM_IOReadBinary::tell( int file )
|
||||
unsigned int COM_IOReadBinary::tell( intp file )
|
||||
{
|
||||
if ( !file )
|
||||
return 0;
|
||||
@ -73,7 +73,7 @@ unsigned int COM_IOReadBinary::tell( int file )
|
||||
return g_pFileSystem->Tell( (FileHandle_t)file );
|
||||
}
|
||||
|
||||
unsigned int COM_IOReadBinary::size( int file )
|
||||
unsigned int COM_IOReadBinary::size( intp file )
|
||||
{
|
||||
if (!file)
|
||||
return 0;
|
||||
@ -81,7 +81,7 @@ unsigned int COM_IOReadBinary::size( int file )
|
||||
return g_pFileSystem->Size( (FileHandle_t)file );
|
||||
}
|
||||
|
||||
void COM_IOReadBinary::close( int file )
|
||||
void COM_IOReadBinary::close( intp file )
|
||||
{
|
||||
if (!file)
|
||||
return;
|
||||
|
@ -1099,7 +1099,7 @@ protected:
|
||||
};
|
||||
|
||||
public:
|
||||
static unsigned CallbackThreadProc( void *pvParam ) { ((CAsyncUploaderThread*) pvParam)->ThreadProc(); return 0; }
|
||||
static uintp CallbackThreadProc( void *pvParam ) { ((CAsyncUploaderThread*) pvParam)->ThreadProc(); return 0; }
|
||||
void QueueData( char const *szMapName, uint uiBlobVersion, uint uiBlobSize, const void *pvBlob );
|
||||
void TerminateAndSelfDelete();
|
||||
};
|
||||
|
@ -2260,7 +2260,7 @@ bool EnableLongTickWatcher()
|
||||
#ifdef POSIX
|
||||
(void*)
|
||||
#endif
|
||||
LongTickWatcherThread, NULL, 0, (unsigned long int *)&nThreadID );
|
||||
LongTickWatcherThread, NULL, 0, (uintp *)&nThreadID );
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ int ParseString( char const *pText, char *buf, size_t bufsize )
|
||||
char const *pStart = pTemp;
|
||||
pTemp = SkipText( pTemp );
|
||||
|
||||
int len = min( pTemp - pStart + 1, (int)bufsize - 1 );
|
||||
intp len = min( pTemp - pStart + 1, (ptrdiff_t)bufsize - 1 );
|
||||
Q_strncpy( buf, pStart, len );
|
||||
buf[ len ] = 0;
|
||||
return 1;
|
||||
|
@ -523,7 +523,7 @@ public:
|
||||
int m_nLeafWaterDataID;
|
||||
};
|
||||
|
||||
bool EnumerateLeaf( int leaf, int context )
|
||||
bool EnumerateLeaf( int leaf, intp context )
|
||||
{
|
||||
BoxIntersectWaterContext_t *pSearchContext = ( BoxIntersectWaterContext_t * )context;
|
||||
mleaf_t *pLeaf = &host_state.worldmodel->brush.pShared->leafs[leaf];
|
||||
@ -541,7 +541,7 @@ public:
|
||||
BoxIntersectWaterContext_t context;
|
||||
context.m_bFoundWaterLeaf = false;
|
||||
context.m_nLeafWaterDataID = leafWaterDataID;
|
||||
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, this, ( int )&context );
|
||||
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, this, ( intp )&context );
|
||||
return context.m_bFoundWaterLeaf;
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ FileNameHandle_t CQueuedLoader::FindFilename( const char *pFilename )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CQueuedLoader::CResourceNameLessFunc::Less( const FileNameHandle_t &hFilenameLHS, const FileNameHandle_t &hFilenameRHS, void *pCtx )
|
||||
{
|
||||
switch ( (int)pCtx )
|
||||
switch ( (intp)pCtx )
|
||||
{
|
||||
case RESOURCEPRELOAD_MATERIAL:
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
Q_strncpy( szFixedName, pszFilename, sizeof( szFixedName ) );
|
||||
Q_FixSlashes( szFixedName );
|
||||
|
||||
Assert( (int)FS_INVALID_ASYNC_FILE == m_map.InvalidIndex() );
|
||||
Assert( (intp)FS_INVALID_ASYNC_FILE == m_map.InvalidIndex() );
|
||||
|
||||
AUTO_LOCK( m_mutex );
|
||||
|
||||
@ -164,7 +164,7 @@ public:
|
||||
|
||||
AUTO_LOCK( m_mutex );
|
||||
|
||||
int iEntry = (CUtlMap<CUtlString, AsyncOpenedFile_t>::IndexType_t)(int)item;
|
||||
int iEntry = (CUtlMap<CUtlString, AsyncOpenedFile_t>::IndexType_t)(intp)item;
|
||||
Assert( m_map.IsValidIndex( iEntry ) );
|
||||
m_map[iEntry]->AddRef();
|
||||
return m_map[iEntry];
|
||||
@ -179,7 +179,7 @@ public:
|
||||
|
||||
AUTO_LOCK( m_mutex );
|
||||
|
||||
int iEntry = (CUtlMap<CUtlString, AsyncOpenedFile_t>::IndexType_t)(int)item;
|
||||
int iEntry = (CUtlMap<CUtlString, AsyncOpenedFile_t>::IndexType_t)(intp)item;
|
||||
Assert( m_map.IsValidIndex( iEntry ) );
|
||||
m_map[iEntry]->AddRef();
|
||||
}
|
||||
@ -193,7 +193,7 @@ public:
|
||||
|
||||
AUTO_LOCK( m_mutex );
|
||||
|
||||
int iEntry = (CUtlMap<CUtlString, AsyncOpenedFile_t>::IndexType_t)(int)item;
|
||||
int iEntry = (CUtlMap<CUtlString, AsyncOpenedFile_t>::IndexType_t)(intp)item;
|
||||
Assert( m_map.IsValidIndex( iEntry ) );
|
||||
if ( m_map[iEntry]->Release() == 0 )
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#ifdef SUPPORT_PACKED_STORE
|
||||
|
||||
unsigned ThreadStubProcessMD5Requests( void *pParam )
|
||||
uintp ThreadStubProcessMD5Requests( void *pParam )
|
||||
{
|
||||
return ((CFileTracker2 *)pParam)->ThreadedProcessMD5Requests();
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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" );
|
||||
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
class CAI_BaseNPC;
|
||||
class CAI_Enemies;
|
||||
typedef int AI_TaskFailureCode_t;
|
||||
typedef intp AI_TaskFailureCode_t;
|
||||
struct Task_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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?
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -91,6 +91,7 @@ static int gSizes[FIELD_TYPECOUNT] =
|
||||
FIELD_SIZE( FIELD_MATERIALINDEX ),
|
||||
|
||||
FIELD_SIZE( FIELD_VECTOR2D ),
|
||||
FIELD_SIZE( FIELD_INTEGER64 ),
|
||||
};
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ void CGameConsole::ActivateDelayed(float time)
|
||||
#endif
|
||||
}
|
||||
|
||||
void CGameConsole::SetParent( int parent )
|
||||
void CGameConsole::SetParent( intp parent )
|
||||
{
|
||||
#ifndef _XBOX
|
||||
if (!m_bInitialized)
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
// activates the console after a delay
|
||||
void ActivateDelayed(float time);
|
||||
|
||||
void SetParent( int parent );
|
||||
void SetParent( intp parent );
|
||||
|
||||
static void OnCmdCondump();
|
||||
private:
|
||||
|
@ -64,7 +64,7 @@ CTextureSystem g_Textures;
|
||||
//-----------------------------------------------------------------------------
|
||||
// CMaterialFileChangeWatcher implementation.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialFileChangeWatcher::Init( CTextureSystem *pSystem, int context )
|
||||
void CMaterialFileChangeWatcher::Init( CTextureSystem *pSystem, intp context )
|
||||
{
|
||||
m_pTextureSystem = pSystem;
|
||||
m_Context = context;
|
||||
@ -662,7 +662,7 @@ void CTextureSystem::UpdateFileChangeWatchers()
|
||||
}
|
||||
|
||||
|
||||
void CTextureSystem::OnFileChange( const char *pFilename, int context, CTextureSystem::EFileType eFileType )
|
||||
void CTextureSystem::OnFileChange( const char *pFilename, intp context, CTextureSystem::EFileType eFileType )
|
||||
{
|
||||
// It requires the forward slashes later...
|
||||
char fixedSlashes[MAX_PATH];
|
||||
|
@ -106,7 +106,7 @@ struct TextureContext_t
|
||||
class CMaterialFileChangeWatcher : private CFileChangeWatcher::ICallbacks
|
||||
{
|
||||
public:
|
||||
void Init( CTextureSystem *pSystem, int context );
|
||||
void Init( CTextureSystem *pSystem, intp context );
|
||||
void Update(); // Call this periodically to update.
|
||||
|
||||
private:
|
||||
@ -214,7 +214,7 @@ protected:
|
||||
k_eFileTypeVMT,
|
||||
k_eFileTypeVTF
|
||||
};
|
||||
void OnFileChange( const char *pFilename, int context, EFileType eFileType );
|
||||
void OnFileChange( const char *pFilename, intp context, EFileType eFileType );
|
||||
void ReloadMaterialsUsingTexture( ITexture *pTestTexture );
|
||||
|
||||
static bool GetFileTypeFromFilename( const char *pFilename, CTextureSystem::EFileType *pFileType );
|
||||
|
@ -338,7 +338,7 @@ public:
|
||||
Assert( m_VertexSize );
|
||||
Assert( !m_pVertexData );
|
||||
m_pVertexData = (byte *)m_pOwner->AllocVertices( numVerts, m_VertexSize );
|
||||
Assert( (unsigned)m_pVertexData % 16 == 0 );
|
||||
Assert( (uintp)m_pVertexData % 16 == 0 );
|
||||
|
||||
// Compute the vertex index..
|
||||
desc.m_nFirstVertex = 0;
|
||||
|
@ -2200,7 +2200,7 @@ int CMatRenderContext::CompareMaterialCombos( IMaterial *pMaterial1, IMaterial *
|
||||
if ( dLightmap )
|
||||
return dLightmap;
|
||||
|
||||
return (int)pMat1 - (int)pMat2;
|
||||
return (intp)pMat1 - (intp)pMat2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
class ITextureInternal;
|
||||
class CMaterialSystem;
|
||||
class CMatLightmaps;
|
||||
typedef int ShaderAPITextureHandle_t;
|
||||
typedef intp ShaderAPITextureHandle_t;
|
||||
class IMorphMgrRenderContext;
|
||||
class CMatCallQueue;
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#endif
|
||||
#include "colorspace.h"
|
||||
#include "string.h"
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include "utlmemory.h"
|
||||
#include "IHardwareConfigInternal.h"
|
||||
@ -2577,7 +2576,7 @@ bool CTexture::SetRenderTarget( int nRenderTargetID, ITexture *pDepthTexture )
|
||||
|
||||
ShaderAPITextureHandle_t textureHandle = m_pTextureHandles[0];
|
||||
|
||||
ShaderAPITextureHandle_t depthTextureHandle = (unsigned int)SHADER_RENDERTARGET_DEPTHBUFFER;
|
||||
ShaderAPITextureHandle_t depthTextureHandle = (uintp)SHADER_RENDERTARGET_DEPTHBUFFER;
|
||||
|
||||
if ( m_nFlags & TEXTUREFLAGS_DEPTHRENDERTARGET )
|
||||
{
|
||||
@ -2587,7 +2586,7 @@ bool CTexture::SetRenderTarget( int nRenderTargetID, ITexture *pDepthTexture )
|
||||
else if ( m_nFlags & TEXTUREFLAGS_NODEPTHBUFFER )
|
||||
{
|
||||
// GR - render target without depth buffer
|
||||
depthTextureHandle = (unsigned int)SHADER_RENDERTARGET_NONE;
|
||||
depthTextureHandle = (uintp)SHADER_RENDERTARGET_NONE;
|
||||
}
|
||||
|
||||
if ( pDepthTexture)
|
||||
@ -4140,7 +4139,7 @@ bool CTexture::UpdateExcludedState( void )
|
||||
|
||||
void CTextureStreamingJob::OnAsyncFindComplete( ITexture* pTex, void* pExtraArgs )
|
||||
{
|
||||
const int cArgsAsInt = ( int ) pExtraArgs;
|
||||
const intp cArgsAsInt = ( intp ) pExtraArgs;
|
||||
|
||||
Assert( m_pOwner == NULL || m_pOwner == pTex );
|
||||
if ( m_pOwner )
|
||||
|
@ -453,7 +453,7 @@ public:
|
||||
|
||||
virtual void OnAsyncFindComplete( ITexture* pTex, void* pExtraArgs )
|
||||
{
|
||||
switch ( ( int ) pExtraArgs )
|
||||
switch ( ( intp ) pExtraArgs )
|
||||
{
|
||||
case Neutral:
|
||||
SafeAssign( &m_pTex, pTex );
|
||||
@ -1202,7 +1202,7 @@ protected:
|
||||
|
||||
virtual void OnAsyncFindComplete( ITexture* pTex, void* pExtraArgs )
|
||||
{
|
||||
switch ( ( int ) pExtraArgs )
|
||||
switch ( ( intp ) pExtraArgs )
|
||||
{
|
||||
case Albedo:
|
||||
SafeAssign( &m_pTex, pTex );
|
||||
|
@ -38,7 +38,7 @@ COcclusionQueryMgr::COcclusionQueryMgr()
|
||||
OcclusionQueryObjectHandle_t COcclusionQueryMgr::CreateOcclusionQueryObject( )
|
||||
{
|
||||
m_Mutex.Lock();
|
||||
int h = m_OcclusionQueryObjects.AddToTail();
|
||||
intp h = m_OcclusionQueryObjects.AddToTail();
|
||||
m_Mutex.Unlock();
|
||||
return (OcclusionQueryObjectHandle_t)h;
|
||||
}
|
||||
@ -47,7 +47,7 @@ void COcclusionQueryMgr::OnCreateOcclusionQueryObject( OcclusionQueryObjectHandl
|
||||
{
|
||||
for ( int i = 0; i < COUNT_OCCLUSION_QUERY_STACK; i++)
|
||||
{
|
||||
m_OcclusionQueryObjects[(int)h].m_QueryHandle[i] = g_pShaderAPI->CreateOcclusionQueryObject( );
|
||||
m_OcclusionQueryObjects[(intp)h].m_QueryHandle[i] = g_pShaderAPI->CreateOcclusionQueryObject( );
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ void COcclusionQueryMgr::OnCreateOcclusionQueryObject( OcclusionQueryObjectHandl
|
||||
void COcclusionQueryMgr::FlushQuery( OcclusionQueryObjectHandle_t hOcclusionQuery, int nIndex )
|
||||
{
|
||||
// Flush out any previous queries
|
||||
int h = (int)hOcclusionQuery;
|
||||
intp h = (intp)hOcclusionQuery;
|
||||
if ( m_OcclusionQueryObjects[h].m_bHasBeenIssued[nIndex] )
|
||||
{
|
||||
ShaderAPIOcclusionQuery_t hQuery = m_OcclusionQueryObjects[h].m_QueryHandle[nIndex];
|
||||
@ -68,7 +68,7 @@ void COcclusionQueryMgr::FlushQuery( OcclusionQueryObjectHandle_t hOcclusionQuer
|
||||
|
||||
void COcclusionQueryMgr::DestroyOcclusionQueryObject( OcclusionQueryObjectHandle_t hOcclusionQuery )
|
||||
{
|
||||
int h = (int)hOcclusionQuery;
|
||||
intp h = (intp)hOcclusionQuery;
|
||||
Assert( m_OcclusionQueryObjects.IsValidIndex( h ) );
|
||||
if ( m_OcclusionQueryObjects.IsValidIndex( h ) )
|
||||
{
|
||||
@ -133,7 +133,7 @@ void COcclusionQueryMgr::FreeOcclusionQueryObjects( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
void COcclusionQueryMgr::ResetOcclusionQueryObject( OcclusionQueryObjectHandle_t hOcclusionQuery )
|
||||
{
|
||||
int h = (int)hOcclusionQuery;
|
||||
intp h = (intp)hOcclusionQuery;
|
||||
Assert( m_OcclusionQueryObjects.IsValidIndex( h ) );
|
||||
if ( m_OcclusionQueryObjects.IsValidIndex( h ) )
|
||||
{
|
||||
@ -154,7 +154,7 @@ void COcclusionQueryMgr::ResetOcclusionQueryObject( OcclusionQueryObjectHandle_t
|
||||
//-----------------------------------------------------------------------------
|
||||
void COcclusionQueryMgr::BeginOcclusionQueryDrawing( OcclusionQueryObjectHandle_t hOcclusionQuery )
|
||||
{
|
||||
int h = (int)hOcclusionQuery;
|
||||
intp h = (intp)hOcclusionQuery;
|
||||
Assert( m_OcclusionQueryObjects.IsValidIndex( h ) );
|
||||
if ( m_OcclusionQueryObjects.IsValidIndex( h ) )
|
||||
{
|
||||
@ -194,7 +194,7 @@ void COcclusionQueryMgr::BeginOcclusionQueryDrawing( OcclusionQueryObjectHandle_
|
||||
|
||||
void COcclusionQueryMgr::EndOcclusionQueryDrawing( OcclusionQueryObjectHandle_t hOcclusionQuery )
|
||||
{
|
||||
int h = (int)hOcclusionQuery;
|
||||
intp h = (intp)hOcclusionQuery;
|
||||
Assert( m_OcclusionQueryObjects.IsValidIndex( h ) );
|
||||
if ( m_OcclusionQueryObjects.IsValidIndex( h ) )
|
||||
{
|
||||
@ -220,7 +220,7 @@ void COcclusionQueryMgr::EndOcclusionQueryDrawing( OcclusionQueryObjectHandle_t
|
||||
//-----------------------------------------------------------------------------
|
||||
void COcclusionQueryMgr::OcclusionQuery_IssueNumPixelsRenderedQuery( OcclusionQueryObjectHandle_t hOcclusionQuery )
|
||||
{
|
||||
int h = (int)hOcclusionQuery;
|
||||
intp h = (intp)hOcclusionQuery;
|
||||
Assert( m_OcclusionQueryObjects.IsValidIndex( h ) );
|
||||
if ( m_OcclusionQueryObjects.IsValidIndex( h ) )
|
||||
{
|
||||
@ -253,6 +253,6 @@ int COcclusionQueryMgr::OcclusionQuery_GetNumPixelsRendered( OcclusionQueryObjec
|
||||
OcclusionQuery_IssueNumPixelsRenderedQuery( h );
|
||||
}
|
||||
|
||||
int nPixels = m_OcclusionQueryObjects[(int)h].m_LastResult;
|
||||
int nPixels = m_OcclusionQueryObjects[(intp)h].m_LastResult;
|
||||
return nPixels;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CVBAllocTracker, IVBAllocTracker,
|
||||
UtlHashFixedHandle_t CVBAllocTracker::TrackAlloc( void * buffer, int bufferSize, VertexFormat_t fmt, int numVerts, short allocatorHash )
|
||||
{
|
||||
AllocData newData( buffer, bufferSize, fmt, numVerts, allocatorHash );
|
||||
UtlHashFixedHandle_t handle = m_VBAllocTable.Insert( (int)buffer, newData );
|
||||
UtlHashFixedHandle_t handle = m_VBAllocTable.Insert( (intp)buffer, newData );
|
||||
if ( handle == m_VBAllocTable.InvalidHandle() )
|
||||
{
|
||||
Warning( "[VBMEM] VBMemAllocTable hash collision (grow table).\n" );
|
||||
@ -247,7 +247,7 @@ UtlHashFixedHandle_t CVBAllocTracker::TrackAlloc( void * buffer, int bufferSize,
|
||||
|
||||
bool CVBAllocTracker::KillAlloc( void * buffer, int & bufferSize, VertexFormat_t & fmt, int & numVerts, short & allocatorHash )
|
||||
{
|
||||
UtlHashFixedHandle_t handle = m_VBAllocTable.Find( (int)buffer );
|
||||
UtlHashFixedHandle_t handle = m_VBAllocTable.Find( (intp)buffer );
|
||||
if ( handle != m_VBAllocTable.InvalidHandle() )
|
||||
{
|
||||
AllocData & data = m_VBAllocTable.Element( handle );
|
||||
|
@ -12,6 +12,8 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#if defined( DX10 ) && !defined( DX_TO_GL_ABSTRACTION )
|
||||
|
||||
#include <d3d10.h>
|
||||
@ -113,13 +115,13 @@ typedef void *HardwareShader_t;
|
||||
//-----------------------------------------------------------------------------
|
||||
// The vertex and pixel shader type
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef int VertexShader_t;
|
||||
typedef int PixelShader_t;
|
||||
typedef intp VertexShader_t;
|
||||
typedef intp PixelShader_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Bitpattern for an invalid shader
|
||||
//-----------------------------------------------------------------------------
|
||||
#define INVALID_SHADER ( 0xFFFFFFFF )
|
||||
#define INVALID_SHADER (-1) // ( 0xFFFFFFFF )
|
||||
#define INVALID_HARDWARE_SHADER ( NULL )
|
||||
|
||||
#define D3DSAMP_NOTSUPPORTED D3DSAMP_FORCE_DWORD
|
||||
|
@ -184,7 +184,7 @@ protected:
|
||||
|
||||
int m_nWindowWidth;
|
||||
int m_nWindowHeight;
|
||||
uint32 m_dwThreadId;
|
||||
uintp m_dwThreadId;
|
||||
};
|
||||
|
||||
|
||||
|
@ -615,7 +615,7 @@ private:
|
||||
ShaderStaticCombos_t m_ShaderStaticCombos;
|
||||
DWORD m_Flags;
|
||||
int m_nRefCount;
|
||||
unsigned int m_hShaderFileCache;
|
||||
uintp m_hShaderFileCache;
|
||||
|
||||
// for queued loading, bias an aligned optimal buffer forward to correct location
|
||||
int m_nDataOffset;
|
||||
@ -1017,7 +1017,7 @@ void CShaderManager::DestroyVertexShader( VertexShaderHandle_t hShader )
|
||||
if ( hShader == VERTEX_SHADER_HANDLE_INVALID )
|
||||
return;
|
||||
|
||||
VertexShaderIndex_t i = (VertexShaderIndex_t)hShader;
|
||||
VertexShaderIndex_t i = (VertexShaderIndex_t)(uintp)hShader;
|
||||
IDirect3DVertexShader9 *pVertexShader = m_RawVertexShaderDict[ i ];
|
||||
|
||||
UnregisterVS( pVertexShader );
|
||||
@ -1053,7 +1053,7 @@ void CShaderManager::DestroyPixelShader( PixelShaderHandle_t hShader )
|
||||
if ( hShader == PIXEL_SHADER_HANDLE_INVALID )
|
||||
return;
|
||||
|
||||
PixelShaderIndex_t i = (PixelShaderIndex_t)hShader;
|
||||
PixelShaderIndex_t i = (PixelShaderIndex_t)(uintp)hShader;
|
||||
IDirect3DPixelShader9 *pPixelShader = m_RawPixelShaderDict[ i ];
|
||||
|
||||
UnregisterPS( pPixelShader );
|
||||
@ -2522,7 +2522,7 @@ bool CShaderManager::LoadAndCreateShaders( ShaderLookup_t &lookup, bool bVertexS
|
||||
ShaderFileCache_t fileCacheLookup;
|
||||
fileCacheLookup.m_Name = lookup.m_Name;
|
||||
fileCacheLookup.m_bVertexShader = bVertexShader;
|
||||
int fileCacheIndex = m_ShaderFileCache.Find( fileCacheLookup );
|
||||
intp fileCacheIndex = m_ShaderFileCache.Find( fileCacheLookup );
|
||||
if ( fileCacheIndex == m_ShaderFileCache.InvalidIndex() )
|
||||
{
|
||||
// not found, create a new entry
|
||||
@ -3286,7 +3286,7 @@ void CShaderManager::SetVertexShaderState( HardwareShader_t shader, DataCacheHan
|
||||
|
||||
void CShaderManager::BindVertexShader( VertexShaderHandle_t hVertexShader )
|
||||
{
|
||||
HardwareShader_t hHardwareShader = m_RawVertexShaderDict[ (VertexShaderIndex_t)hVertexShader] ;
|
||||
HardwareShader_t hHardwareShader = m_RawVertexShaderDict[ (VertexShaderIndex_t)(uintp)hVertexShader] ;
|
||||
SetVertexShaderState( hHardwareShader );
|
||||
}
|
||||
|
||||
@ -3395,7 +3395,7 @@ void CShaderManager::SetPixelShaderState( HardwareShader_t shader, DataCacheHand
|
||||
|
||||
void CShaderManager::BindPixelShader( PixelShaderHandle_t hPixelShader )
|
||||
{
|
||||
HardwareShader_t hHardwareShader = m_RawPixelShaderDict[ (PixelShaderIndex_t)hPixelShader ];
|
||||
HardwareShader_t hHardwareShader = m_RawPixelShaderDict[ (PixelShaderIndex_t)(uintp)hPixelShader ];
|
||||
SetPixelShaderState( hHardwareShader );
|
||||
}
|
||||
|
||||
@ -3594,7 +3594,7 @@ void CShaderManager::SpewVertexAndPixelShaders( void )
|
||||
{
|
||||
// only spew a populated shader file cache
|
||||
Msg( "\nShader File Cache:\n" );
|
||||
for ( int cacheIndex = m_ShaderFileCache.Head();
|
||||
for ( intp cacheIndex = m_ShaderFileCache.Head();
|
||||
cacheIndex != m_ShaderFileCache.InvalidIndex();
|
||||
cacheIndex = m_ShaderFileCache.Next( cacheIndex ) )
|
||||
{
|
||||
|
@ -61,6 +61,11 @@ public:
|
||||
Put( nValue );
|
||||
}
|
||||
|
||||
FORCEINLINE void PutIntPtr( intp nValue )
|
||||
{
|
||||
Put( nValue );
|
||||
}
|
||||
|
||||
FORCEINLINE void PutFloat( float nValue )
|
||||
{
|
||||
Put( nValue );
|
||||
@ -335,7 +340,7 @@ public:
|
||||
{
|
||||
m_Storage.PutInt( CBCMD_BIND_SHADERAPI_TEXTURE_HANDLE );
|
||||
m_Storage.PutInt( nSampler );
|
||||
m_Storage.PutInt( hTexture );
|
||||
m_Storage.PutIntPtr( hTexture );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
//===========================================================================//
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include "materialsystem_global.h"
|
||||
#include "string.h"
|
||||
#include "shaderapi/ishaderapi.h"
|
||||
@ -787,8 +786,8 @@ protected:
|
||||
friend class AsyncReader;
|
||||
AsyncReader* m_pAsyncReader;
|
||||
|
||||
uint m_nAsyncLoadThread;
|
||||
uint m_nAsyncReadThread;
|
||||
ThreadId_t m_nAsyncLoadThread;
|
||||
ThreadId_t m_nAsyncReadThread;
|
||||
|
||||
int m_iSuspendTextureStreaming;
|
||||
};
|
||||
@ -1131,7 +1130,7 @@ private:
|
||||
m_completedJobs.PushItem( pJob );
|
||||
}
|
||||
|
||||
static unsigned LoaderMain( void* _this )
|
||||
static uintp LoaderMain( void* _this )
|
||||
{
|
||||
ThreadSetDebugName( "Loader" );
|
||||
|
||||
@ -1432,7 +1431,7 @@ private:
|
||||
mip_h = Max( 1, mip_h >> 1 );
|
||||
}
|
||||
}
|
||||
static unsigned ReaderMain( void* _this )
|
||||
static uintp ReaderMain( void* _this )
|
||||
{
|
||||
ThreadSetDebugName( "Helper" );
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ void CParticleCollection::Init( CParticleSystemDefinition *pDef, float flDelay,
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nRandomSeed = (int)this;
|
||||
m_nRandomSeed = (intp)this;
|
||||
#ifndef _DEBUG
|
||||
m_nRandomSeed += Plat_MSTime();
|
||||
#endif
|
||||
|
@ -119,21 +119,21 @@
|
||||
#define _T( arg ) arg
|
||||
#endif
|
||||
#define INVALID_HANDLE_VALUE (void*)-1
|
||||
#define CloseHandle( arg ) close( (int) arg )
|
||||
#define CloseHandle( arg ) close( (intptr_t) arg )
|
||||
#define ZeroMemory( ptr, size ) memset( ptr, 0, size )
|
||||
#define FILE_CURRENT SEEK_CUR
|
||||
#define FILE_BEGIN SEEK_SET
|
||||
#define FILE_END SEEK_END
|
||||
#define CreateDirectory( dir, ign ) mkdir( dir, S_IRWXU | S_IRWXG | S_IRWXO )
|
||||
#define SetFilePointer( handle, pos, ign, dir ) lseek( (int) handle, pos, dir )
|
||||
#define SetFilePointer( handle, pos, ign, dir ) lseek( (intptr_t) handle, pos, dir )
|
||||
bool ReadFile( void *handle, void *outbuf, unsigned int toread, unsigned int *nread, void *ignored )
|
||||
{
|
||||
*nread = read( (int) handle, outbuf, toread );
|
||||
*nread = read( (intptr_t) handle, outbuf, toread );
|
||||
return *nread == toread;
|
||||
}
|
||||
bool WriteFile( void *handle, void *buf, unsigned int towrite, unsigned int *written, void *ignored )
|
||||
{
|
||||
*written = write( (int) handle, buf, towrite );
|
||||
*written = write( (intptr_t) handle, buf, towrite );
|
||||
return *written == towrite;
|
||||
}
|
||||
|
||||
@ -2778,8 +2778,8 @@ LUFILE *lufopen(void *z,unsigned int len,DWORD flags,ZRESULT *err)
|
||||
#ifdef _WIN32
|
||||
res = DuplicateHandle(GetCurrentProcess(),hf,GetCurrentProcess(),&h,0,FALSE,DUPLICATE_SAME_ACCESS) == TRUE;
|
||||
#else
|
||||
h = (void*) dup( (int)hf );
|
||||
res = (int) dup >= 0;
|
||||
h = (void*) dup( (intptr_t)hf );
|
||||
res = (intptr_t) dup >= 0;
|
||||
#endif
|
||||
if (!res)
|
||||
{
|
||||
@ -2806,7 +2806,7 @@ LUFILE *lufopen(void *z,unsigned int len,DWORD flags,ZRESULT *err)
|
||||
canseek = (type==FILE_TYPE_DISK);
|
||||
#else
|
||||
struct stat buf;
|
||||
fstat( (int)h, &buf );
|
||||
fstat( (intptr_t)h, &buf );
|
||||
canseek = buf.st_mode & S_IFREG;
|
||||
#endif
|
||||
}
|
||||
@ -4235,7 +4235,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
|
||||
settime=true;
|
||||
#else
|
||||
struct stat sbuf;
|
||||
fstat( (int)h, &sbuf );
|
||||
fstat( (intptr_t)h, &sbuf );
|
||||
settime = ( sbuf.st_mode & S_IFREG );
|
||||
#endif
|
||||
|
||||
@ -4256,7 +4256,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = ze.mtime;
|
||||
tv[1].tv_usec = 0;
|
||||
futimes( (int)h, tv );
|
||||
futimes( (intptr_t)h, tv );
|
||||
#endif
|
||||
}
|
||||
if (flags!=ZIP_HANDLE)
|
||||
|
@ -663,7 +663,7 @@ public:
|
||||
CDispCornerNeighbors m_CornerNeighbors[4]; // Indexed by CORNER_ defines.
|
||||
|
||||
enum unnamed { ALLOWEDVERTS_SIZE = PAD_NUMBER( MAX_DISPVERTS, 32 ) / 32 };
|
||||
unsigned long m_AllowedVerts[ALLOWEDVERTS_SIZE]; // This is built based on the layout and sizes of our neighbors
|
||||
unsigned int m_AllowedVerts[ALLOWEDVERTS_SIZE]; // This is built based on the layout and sizes of our neighbors
|
||||
// and tells us which vertices are allowed to be active.
|
||||
};
|
||||
|
||||
|
@ -35,16 +35,16 @@ public:
|
||||
void ElementMoved( BSPTreeDataHandle_t handle, Vector const& mins, Vector const& maxs );
|
||||
|
||||
// Enumerate elements in a particular leaf
|
||||
bool EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pEnum, int context );
|
||||
bool EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pEnum, intp context );
|
||||
|
||||
// For convenience, enumerates the leaves along a ray, box, etc.
|
||||
bool EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int context );
|
||||
bool EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
bool EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
bool EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, intp context );
|
||||
|
||||
// methods of IBSPLeafEnumerator
|
||||
bool EnumerateLeaf( int leaf, int context );
|
||||
bool EnumerateLeaf( int leaf, intp context );
|
||||
|
||||
// Is the element in any leaves at all?
|
||||
bool IsElementInTree( BSPTreeDataHandle_t handle ) const;
|
||||
@ -223,7 +223,7 @@ void CBSPTreeData::AddHandleToLeaf( int leaf, BSPTreeDataHandle_t handle )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Inserts an element into the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBSPTreeData::EnumerateLeaf( int leaf, int context )
|
||||
bool CBSPTreeData::EnumerateLeaf( int leaf, intp context )
|
||||
{
|
||||
BSPTreeDataHandle_t handle = (BSPTreeDataHandle_t)context;
|
||||
AddHandleToLeaf( leaf, handle );
|
||||
@ -302,7 +302,7 @@ int CBSPTreeData::CountElementsInLeaf( int leaf )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Enumerate elements in a particular leaf
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBSPTreeData::EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pEnum, int context )
|
||||
bool CBSPTreeData::EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pEnum, intp context )
|
||||
{
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
// The enumeration method better damn well not change this list...
|
||||
@ -330,22 +330,22 @@ bool CBSPTreeData::EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pE
|
||||
//-----------------------------------------------------------------------------
|
||||
// For convenience, enumerates the leaves along a ray, box, etc.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBSPTreeData::EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, int context )
|
||||
bool CBSPTreeData::EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
return m_pBSPTree->EnumerateLeavesAtPoint( pt, pEnum, context );
|
||||
}
|
||||
|
||||
bool CBSPTreeData::EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, int context )
|
||||
bool CBSPTreeData::EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
return m_pBSPTree->EnumerateLeavesInBox( mins, maxs, pEnum, context );
|
||||
}
|
||||
|
||||
bool CBSPTreeData::EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, int context )
|
||||
bool CBSPTreeData::EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
return m_pBSPTree->EnumerateLeavesInSphere( center, radius, pEnum, context );
|
||||
}
|
||||
|
||||
bool CBSPTreeData::EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int context )
|
||||
bool CBSPTreeData::EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, intp context )
|
||||
{
|
||||
return m_pBSPTree->EnumerateLeavesAlongRay( ray, pEnum, context );
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
// that passes the test; return true to continue enumerating,
|
||||
// false to stop
|
||||
|
||||
virtual bool EnumerateLeaf( int leaf, int context ) = 0;
|
||||
virtual bool EnumerateLeaf( int leaf, intp context ) = 0;
|
||||
};
|
||||
|
||||
abstract_class ISpatialQuery
|
||||
@ -68,10 +68,10 @@ public:
|
||||
virtual int LeafCount() const = 0;
|
||||
|
||||
// Enumerates the leaves along a ray, box, etc.
|
||||
virtual bool EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
virtual bool EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
virtual bool EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
virtual bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ abstract_class IBSPTreeDataEnumerator
|
||||
{
|
||||
public:
|
||||
// call back with a userId and a context
|
||||
virtual bool FASTCALL EnumerateElement( int userId, int context ) = 0;
|
||||
virtual bool FASTCALL EnumerateElement( int userId, intp context ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IBSPTreeData
|
||||
@ -109,7 +109,7 @@ public:
|
||||
virtual void ElementMoved( BSPTreeDataHandle_t handle, Vector const& mins, Vector const& maxs ) = 0;
|
||||
|
||||
// Enumerate elements in a particular leaf
|
||||
virtual bool EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateElementsInLeaf( int leaf, IBSPTreeDataEnumerator* pEnum, intp context ) = 0;
|
||||
|
||||
// Is the element in any leaves at all?
|
||||
virtual bool IsElementInTree( BSPTreeDataHandle_t handle ) const = 0;
|
||||
@ -117,10 +117,10 @@ public:
|
||||
// NOTE: These methods call through to the functions in the attached
|
||||
// ISpatialQuery
|
||||
// For convenience, enumerates the leaves along a ray, box, etc.
|
||||
virtual bool EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int context ) = 0;
|
||||
virtual bool EnumerateLeavesAtPoint( Vector const& pt, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
virtual bool EnumerateLeavesInBox( Vector const& mins, Vector const& maxs, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
virtual bool EnumerateLeavesInSphere( Vector const& center, float radius, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
virtual bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, intp context ) = 0;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -35,7 +35,7 @@ class IDataCache;
|
||||
//---------------------------------------------------------
|
||||
// Unique (per section) identifier for a cache item defined by client
|
||||
//---------------------------------------------------------
|
||||
typedef uint32 DataCacheClientID_t;
|
||||
typedef uintp DataCacheClientID_t;
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
@ -491,7 +491,7 @@ public:
|
||||
m_pCache->EnsureCapacity(STORAGE_TYPE::EstimatedSize(createParams));
|
||||
STORAGE_TYPE *pStore = STORAGE_TYPE::CreateResource( createParams );
|
||||
DataCacheHandle_t handle;
|
||||
m_pCache->AddEx( (DataCacheClientID_t)pStore, pStore, pStore->Size(), flags, &handle);
|
||||
m_pCache->AddEx( (DataCacheClientID_t)(uintp)pStore, pStore, pStore->Size(), flags, &handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,17 @@ namespace OptimizedModel
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef unsigned short MDLHandle_t;
|
||||
|
||||
// MoeMod : integer promotion keeps sign on arm, but discards sign on x86
|
||||
inline MDLHandle_t VoidPtrToMDLHandle( void *ptr )
|
||||
{
|
||||
return ( MDLHandle_t ) ( ( uintp ) ptr & 0xffff );
|
||||
}
|
||||
|
||||
inline void* MDLHandleToVirtual( MDLHandle_t hndl )
|
||||
{
|
||||
return (void*)(uintp)hndl;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
MDLHANDLE_INVALID = (MDLHandle_t)~0
|
||||
|
@ -64,6 +64,7 @@ typedef enum _fieldtypes
|
||||
FIELD_MATERIALINDEX, // a material index (using the material precache string table)
|
||||
|
||||
FIELD_VECTOR2D, // 2 floats
|
||||
FIELD_INTEGER64, // 64bit integer
|
||||
|
||||
FIELD_TYPECOUNT, // MUST BE LAST
|
||||
} fieldtype_t;
|
||||
@ -128,7 +129,7 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
|
||||
#define ARRAYSIZE2D(p) (sizeof(p)/sizeof(p[0][0]))
|
||||
#define SIZE_OF_ARRAY(p) _ARRAYSIZE(p)
|
||||
|
||||
#define _offsetof(s,m) ((int)&(((s *)0)->m))
|
||||
#define _offsetof(s,m) ((int)(intp)&(((s *)0)->m))
|
||||
|
||||
#define _FIELD(name,fieldtype,count,flags,mapname,tolerance) { fieldtype, #name, { _offsetof(classNameTypedef, name), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance }
|
||||
#define DEFINE_FIELD_NULL { FIELD_VOID,0, {0,0},0,0,0,0,0,0}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "tier1/interface.h"
|
||||
#include "bitmap/imageformat.h"
|
||||
|
||||
typedef unsigned int ColorCorrectionHandle_t;
|
||||
typedef uintp ColorCorrectionHandle_t;
|
||||
struct ShaderColorCorrectionInfo_t;
|
||||
|
||||
#define COLORCORRECTION_INTERFACE_VERSION "COLORCORRECTION_VERSION_1"
|
||||
|
@ -1156,7 +1156,7 @@ inline void CVertexBuilder::FastAdvanceNVertices( int n )
|
||||
//-----------------------------------------------------------------------------
|
||||
inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex )
|
||||
{
|
||||
#ifdef __arm__
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
FastVertexSSE( vertex );
|
||||
#else
|
||||
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
|
||||
@ -1244,11 +1244,11 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex )
|
||||
const char *pRead = (char *)&vertex;
|
||||
char *pCurrPos = (char *)m_pCurrPosition;
|
||||
__m128 m1 = _mm_load_ps( (float *)pRead );
|
||||
__m128 m2 = _mm_load_ps( (float *)((int)pRead + 16) );
|
||||
__m128 m3 = _mm_load_ps( (float *)((int)pRead + 32) );
|
||||
__m128 m2 = _mm_load_ps( (float *)((intp)pRead + 16) );
|
||||
__m128 m3 = _mm_load_ps( (float *)((intp)pRead + 32) );
|
||||
_mm_stream_ps( (float *)pCurrPos, m1 );
|
||||
_mm_stream_ps( (float *)((int)pCurrPos + 16), m2 );
|
||||
_mm_stream_ps( (float *)((int)pCurrPos + 32), m3 );
|
||||
_mm_stream_ps( (float *)((intp)pCurrPos + 16), m2 );
|
||||
_mm_stream_ps( (float *)((intp)pCurrPos + 32), m3 );
|
||||
#else
|
||||
Error( "Implement CMeshBuilder::FastVertexSSE(dx7)" );
|
||||
#endif
|
||||
@ -1326,7 +1326,7 @@ inline void CVertexBuilder::Fast4VerticesSSE(
|
||||
|
||||
inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex )
|
||||
{
|
||||
#ifdef __arm__
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
FastVertexSSE( vertex );
|
||||
#else
|
||||
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
|
||||
@ -1436,13 +1436,13 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex )
|
||||
:: "r" (pRead), "r" (pCurrPos) : "memory"); */
|
||||
|
||||
__m128 m1 = _mm_load_ps( (float *)pRead );
|
||||
__m128 m2 = _mm_load_ps( (float *)((int)pRead + 16) );
|
||||
__m128 m3 = _mm_load_ps( (float *)((int)pRead + 32) );
|
||||
__m128 m4 = _mm_load_ps( (float *)((int)pRead + 48) );
|
||||
__m128 m2 = _mm_load_ps( (float *)((intp)pRead + 16) );
|
||||
__m128 m3 = _mm_load_ps( (float *)((intp)pRead + 32) );
|
||||
__m128 m4 = _mm_load_ps( (float *)((intp)pRead + 48) );
|
||||
_mm_stream_ps( (float *)pCurrPos, m1 );
|
||||
_mm_stream_ps( (float *)((int)pCurrPos + 16), m2 );
|
||||
_mm_stream_ps( (float *)((int)pCurrPos + 32), m3 );
|
||||
_mm_stream_ps( (float *)((int)pCurrPos + 48), m4 );
|
||||
_mm_stream_ps( (float *)((intp)pCurrPos + 16), m2 );
|
||||
_mm_stream_ps( (float *)((intp)pCurrPos + 32), m3 );
|
||||
_mm_stream_ps( (float *)((intp)pCurrPos + 48), m4 );
|
||||
#else
|
||||
Error( "Implement CMeshBuilder::FastVertexSSE((dx8)" );
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#pragma warning( disable : 4284 ) // warning C4284: return type for 'CNetworkVarT<int>::operator ->' is 'int *' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation)
|
||||
|
||||
#define MyOffsetOf( type, var ) ( (int)&((type*)0)->var )
|
||||
#define MyOffsetOf( type, var ) ( (intp)&((type*)0)->var )
|
||||
|
||||
#ifdef _DEBUG
|
||||
extern bool g_bUseNetworkVars;
|
||||
|
@ -52,7 +52,7 @@ enum ShaderRenderTarget_t
|
||||
//-----------------------------------------------------------------------------
|
||||
// This must match the definition in playback.cpp!
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef int ShaderAPITextureHandle_t;
|
||||
typedef intp ShaderAPITextureHandle_t;
|
||||
#define INVALID_SHADERAPI_TEXTURE_HANDLE 0
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "tier0/basetypes.h"
|
||||
|
||||
|
||||
typedef int ShaderAPITextureHandle_t;
|
||||
typedef intp ShaderAPITextureHandle_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
|
@ -1194,10 +1194,16 @@ struct mstudiotexture_t
|
||||
int flags;
|
||||
int used;
|
||||
int unused1;
|
||||
#if PLATFORM_64BITS
|
||||
mutable IMaterial *material;
|
||||
mutable void *clientmaterial;
|
||||
int unused[8];
|
||||
#else
|
||||
mutable IMaterial *material; // fixme: this needs to go away . .isn't used by the engine, but is used by studiomdl
|
||||
mutable void *clientmaterial; // gary, replace with client material pointer if used
|
||||
|
||||
int unused[10];
|
||||
#endif
|
||||
};
|
||||
|
||||
// eyeball
|
||||
@ -1290,6 +1296,11 @@ struct mstudio_modelvertexdata_t
|
||||
const void *pTangentData;
|
||||
};
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
// 64b - match 32-bit packing
|
||||
#pragma pack( push, 4 )
|
||||
#endif
|
||||
|
||||
struct mstudio_meshvertexdata_t
|
||||
{
|
||||
DECLARE_BYTESWAP_DATADESC();
|
||||
@ -1339,9 +1350,15 @@ struct mstudiomesh_t
|
||||
|
||||
Vector center;
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
mstudio_meshvertexdata_t vertexdata;
|
||||
|
||||
int unused[7]; // remove as appropriate
|
||||
#else
|
||||
mstudio_meshvertexdata_t vertexdata;
|
||||
|
||||
int unused[8]; // remove as appropriate
|
||||
#endif
|
||||
|
||||
mstudiomesh_t(){}
|
||||
private:
|
||||
@ -1383,11 +1400,22 @@ struct mstudiomodel_t
|
||||
int eyeballindex;
|
||||
inline mstudioeyeball_t *pEyeball( int i ) { return (mstudioeyeball_t *)(((byte *)this) + eyeballindex) + i; };
|
||||
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
mstudio_modelvertexdata_t vertexdata; // sizeof(mstudio_modelvertexdata_t) == 16
|
||||
|
||||
int unused[6]; // remove as appropriate
|
||||
#else
|
||||
mstudio_modelvertexdata_t vertexdata;
|
||||
|
||||
int unused[8]; // remove as appropriate
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
#pragma pack( pop )
|
||||
#endif
|
||||
|
||||
inline bool mstudio_modelvertexdata_t::HasTangentData( void ) const
|
||||
{
|
||||
return (pTangentData != NULL);
|
||||
@ -1396,14 +1424,14 @@ 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->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->tangentsindex % sizeof( Vector4D ) ) == 0 );
|
||||
return ( i + ( modelptr->tangentsindex / sizeof( Vector4D ) ) );
|
||||
}
|
||||
|
||||
@ -2263,7 +2291,11 @@ struct studiohdr_t
|
||||
const studiohdr_t *FindModel( void **cache, char const *modelname ) const;
|
||||
|
||||
// implementation specific back pointer to virtual data
|
||||
#ifdef PLATFORM_64BITS
|
||||
int index_ptr_virtualModel;
|
||||
#else
|
||||
mutable void *virtualModel;
|
||||
#endif
|
||||
virtualmodel_t *GetVirtualModel( void ) const;
|
||||
|
||||
// for demand loaded animation blocks
|
||||
@ -2272,7 +2304,11 @@ struct studiohdr_t
|
||||
int numanimblocks;
|
||||
int animblockindex;
|
||||
inline mstudioanimblock_t *pAnimBlock( int i ) const { Assert( i > 0 && i < numanimblocks); return (mstudioanimblock_t *)(((byte *)this) + animblockindex) + i; };
|
||||
#ifdef PLATFORM_64BITS
|
||||
int index_ptr_animblockModel;
|
||||
#else
|
||||
mutable void *animblockModel;
|
||||
#endif
|
||||
byte * GetAnimBlock( int i ) const;
|
||||
|
||||
int bonetablebynameindex;
|
||||
@ -2280,8 +2316,13 @@ struct studiohdr_t
|
||||
|
||||
// used by tools only that don't cache, but persist mdl's peer data
|
||||
// engine uses virtualModel to back link to cache pointers
|
||||
#ifdef PLATFORM_64BITS
|
||||
int index_ptr_pVertexBase;
|
||||
int index_ptr_pIndexBase;
|
||||
#else
|
||||
void *pVertexBase;
|
||||
void *pIndexBase;
|
||||
#endif
|
||||
|
||||
// if STUDIOHDR_FLAGS_CONSTANT_DIRECTIONAL_LIGHT_DOT is set,
|
||||
// this value is used to calculate directional components of lighting
|
||||
@ -2327,7 +2368,23 @@ struct studiohdr_t
|
||||
inline mstudiolinearbone_t *pLinearBones() const { return studiohdr2index ? pStudioHdr2()->pLinearBones() : NULL; }
|
||||
|
||||
inline int BoneFlexDriverCount() const { return studiohdr2index ? pStudioHdr2()->m_nBoneFlexDriverCount : 0; }
|
||||
inline const mstudioboneflexdriver_t* BoneFlexDriver( int i ) const { Assert( i >= 0 && i < BoneFlexDriverCount() ); return studiohdr2index ? pStudioHdr2()->pBoneFlexDriver( i ) : NULL; }
|
||||
inline const mstudioboneflexdriver_t* BoneFlexDriver( int i ) const { Assert( i >= 0 && i < BoneFlexDriverCount() ); return studiohdr2index > 0 ? pStudioHdr2()->pBoneFlexDriver( i ) : NULL; }
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
void* VirtualModel() const { return *(void **)(((byte *)this) + index_ptr_virtualModel); }
|
||||
void SetVirtualModel( void* ptr ) const { *(void **)(((byte *)this) + index_ptr_virtualModel) = ptr; }
|
||||
void* VertexBase() const { return *(void **)(((byte *)this) + index_ptr_pVertexBase); }
|
||||
void SetVertexBase( void* ptr ) { *(void **)(((byte *)this) + index_ptr_pVertexBase) = ptr; }
|
||||
void* IndexBase() const { return *(void **)(((byte *)this) + index_ptr_pIndexBase); }
|
||||
void SetIndexBase( void* ptr ) { *(void **)(((byte *)this) + index_ptr_pIndexBase) = ptr; }
|
||||
#else
|
||||
void* VirtualModel() const { return virtualModel; }
|
||||
void SetVirtualModel( void* ptr ) const { virtualModel = ptr; }
|
||||
void* VertexBase() const { return pVertexBase; }
|
||||
void SetVertexBase( void* ptr ) { pVertexBase = ptr; }
|
||||
void* IndexBase() const { return pIndexBase; }
|
||||
void SetIndexBase( void* ptr ) { pIndexBase = ptr; } }
|
||||
#endif
|
||||
|
||||
// NOTE: No room to add stuff? Up the .mdl file format version
|
||||
// [and move all fields in studiohdr2_t into studiohdr_t and kill studiohdr2_t],
|
||||
@ -2340,6 +2397,15 @@ private:
|
||||
friend struct virtualmodel_t;
|
||||
};
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
struct studiohdr_shim64_index
|
||||
{
|
||||
mutable void *virtualModel;
|
||||
mutable void *animblockModel;
|
||||
void *pVertexBase;
|
||||
void *pIndexBase;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
#if defined(__x86_64__) || defined(_WIN64)
|
||||
#if defined(__x86_64__) || defined(_WIN64) || defined(__arm64__)
|
||||
#define PLATFORM_64BITS 1
|
||||
#endif
|
||||
|
||||
@ -70,7 +70,11 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#ifdef OSX
|
||||
#include <malloc/malloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <new>
|
||||
|
||||
// need this for memset
|
||||
@ -171,6 +175,9 @@ typedef signed char int8;
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
|
||||
typedef int64 lint64;
|
||||
typedef uint64 ulint64;
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
typedef __int64 intp; // intp is an integer that can accomodate a pointer
|
||||
typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
|
||||
@ -201,13 +208,17 @@ typedef signed char int8;
|
||||
typedef unsigned int uint32;
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
typedef long int lint64;
|
||||
typedef unsigned long int ulint64;
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
typedef long long intp;
|
||||
typedef unsigned long long uintp;
|
||||
#else
|
||||
typedef int intp;
|
||||
typedef unsigned int uintp;
|
||||
#endif
|
||||
#endif
|
||||
typedef void *HWND;
|
||||
|
||||
// Avoid redefinition warnings if a previous header defines this.
|
||||
@ -429,7 +440,11 @@ typedef void * HINSTANCE;
|
||||
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
|
||||
// So if being debugged, use INT3 which is precise.
|
||||
#ifdef OSX
|
||||
#define DebuggerBreak() if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); }
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
|
||||
#else
|
||||
#define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } } while(0)
|
||||
#endif
|
||||
#else
|
||||
#define DebuggerBreak() raise(SIGTRAP)
|
||||
#endif
|
||||
@ -752,7 +767,7 @@ typedef void * HINSTANCE;
|
||||
#define _wtoi(arg) wcstol(arg, NULL, 10)
|
||||
#define _wtoi64(arg) wcstoll(arg, NULL, 10)
|
||||
|
||||
typedef uint32 HMODULE;
|
||||
typedef uintp HMODULE;
|
||||
typedef void *HANDLE;
|
||||
#endif
|
||||
|
||||
@ -830,7 +845,7 @@ static FORCEINLINE double fsel(double fComparand, double fValGE, double fLT)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#elif defined (__arm__)
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
inline void SetupFPUControlWord() {}
|
||||
#else
|
||||
inline void SetupFPUControlWord()
|
||||
@ -1094,12 +1109,12 @@ FORCEINLINE void StoreLittleDWord( unsigned long *base, unsigned int dwordIndex,
|
||||
__storewordbytereverse( dword, dwordIndex<<2, base );
|
||||
}
|
||||
#else
|
||||
FORCEINLINE unsigned long LoadLittleDWord( const unsigned long *base, unsigned int dwordIndex )
|
||||
FORCEINLINE uint32 LoadLittleDWord( const uint32 *base, unsigned int dwordIndex )
|
||||
{
|
||||
return LittleDWord( base[dwordIndex] );
|
||||
}
|
||||
|
||||
FORCEINLINE void StoreLittleDWord( unsigned long *base, unsigned int dwordIndex, unsigned long dword )
|
||||
FORCEINLINE void StoreLittleDWord( uint32 *base, unsigned int dwordIndex, uint32 dword )
|
||||
{
|
||||
base[dwordIndex] = LittleDWord(dword);
|
||||
}
|
||||
@ -1167,7 +1182,7 @@ PLATFORM_INTERFACE struct tm * Plat_localtime( const time_t *timep, struct tm *
|
||||
|
||||
inline uint64 Plat_Rdtsc()
|
||||
{
|
||||
#if defined( __arm__ ) && defined (POSIX)
|
||||
#if (defined( __arm__ ) || defined( __arm64__ )) && defined (POSIX)
|
||||
struct timespec t;
|
||||
clock_gettime( CLOCK_REALTIME, &t);
|
||||
return t.tv_sec * 1000000000ULL + t.tv_nsec;
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include "tier0/type_traits.h"
|
||||
|
||||
#include <limits.h>
|
||||
#if defined( __arm__ ) || defined( __arm64__ )
|
||||
#include <atomic>
|
||||
#endif
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "tier0/dbg.h"
|
||||
@ -100,7 +103,11 @@ const unsigned TT_INFINITE = 0xffffffff;
|
||||
|
||||
#endif // NO_THREAD_LOCAL
|
||||
|
||||
typedef unsigned long ThreadId_t;
|
||||
#ifdef PLATFORM_64BITS
|
||||
typedef uint64 ThreadId_t;
|
||||
#else
|
||||
typedef uint32 ThreadId_t;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
@ -109,7 +116,7 @@ typedef unsigned long ThreadId_t;
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
FORWARD_DECLARE_HANDLE( ThreadHandle_t );
|
||||
typedef unsigned (*ThreadFunc_t)( void *pParam );
|
||||
typedef uintp (*ThreadFunc_t)( void *pParam );
|
||||
|
||||
PLATFORM_OVERLOAD ThreadHandle_t CreateSimpleThread( ThreadFunc_t, void *pParam, ThreadId_t *pID, unsigned stackSize = 0 );
|
||||
PLATFORM_INTERFACE ThreadHandle_t CreateSimpleThread( ThreadFunc_t, void *pParam, unsigned stackSize = 0 );
|
||||
@ -119,7 +126,7 @@ PLATFORM_INTERFACE bool ReleaseThreadHandle( ThreadHandle_t );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
PLATFORM_INTERFACE void ThreadSleep(unsigned duration = 0);
|
||||
PLATFORM_INTERFACE uint ThreadGetCurrentId();
|
||||
PLATFORM_INTERFACE ThreadId_t ThreadGetCurrentId();
|
||||
PLATFORM_INTERFACE ThreadHandle_t ThreadGetCurrentHandle();
|
||||
PLATFORM_INTERFACE int ThreadGetPriority( ThreadHandle_t hThread = NULL );
|
||||
PLATFORM_INTERFACE bool ThreadSetPriority( ThreadHandle_t hThread, int priority );
|
||||
@ -142,10 +149,10 @@ inline void ThreadPause()
|
||||
#if defined( PLATFORM_WINDOWS_PC )
|
||||
// Intrinsic for __asm pause; from <intrin.h>
|
||||
_mm_pause();
|
||||
#elif POSIX && defined( __i386__ )
|
||||
#elif POSIX && ( defined( __i386__ ) || defined( __x86_64__ ) )
|
||||
__asm __volatile( "pause" );
|
||||
#elif defined( _X360 )
|
||||
#elif defined(__arm__)
|
||||
#elif defined(__arm__) || defined(__arm64__)
|
||||
sched_yield();
|
||||
#else
|
||||
#error "implement me"
|
||||
@ -238,28 +245,28 @@ extern "C"
|
||||
#pragma intrinsic( _InterlockedExchangeAdd )
|
||||
#pragma intrinsic( _InterlockedIncrement )
|
||||
|
||||
inline long ThreadInterlockedIncrement( long volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedIncrement( p ); }
|
||||
inline long ThreadInterlockedDecrement( long volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedDecrement( p ); }
|
||||
inline long ThreadInterlockedExchange( long volatile *p, long value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchange( p, value ); }
|
||||
inline long ThreadInterlockedExchangeAdd( long volatile *p, long value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchangeAdd( p, value ); }
|
||||
inline long ThreadInterlockedCompareExchange( long volatile *p, long value, long comperand ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedCompareExchange( p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( long volatile *p, long value, long comperand ) { Assert( (size_t)p % 4 == 0 ); return ( _InterlockedCompareExchange( p, value, comperand ) == comperand ); }
|
||||
inline int32 ThreadInterlockedIncrement( int32 volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedIncrement( p ); }
|
||||
inline int32 ThreadInterlockedDecrement( int32 volatile *p ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedDecrement( p ); }
|
||||
inline int32 ThreadInterlockedExchange( int32 volatile *p, int32 value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchange( p, value ); }
|
||||
inline int32 ThreadInterlockedExchangeAdd( int32 volatile *p, int32 value ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedExchangeAdd( p, value ); }
|
||||
inline int32 ThreadInterlockedCompareExchange( int32 volatile *p, int32 value, int32 comperand ) { Assert( (size_t)p % 4 == 0 ); return _InterlockedCompareExchange( p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( int32 volatile *p, int32 value, int32 comperand ) { Assert( (size_t)p % 4 == 0 ); return ( _InterlockedCompareExchange( p, value, comperand ) == comperand ); }
|
||||
#else
|
||||
PLATFORM_INTERFACE long ThreadInterlockedIncrement( long volatile * );
|
||||
PLATFORM_INTERFACE long ThreadInterlockedDecrement( long volatile * );
|
||||
PLATFORM_INTERFACE long ThreadInterlockedExchange( long volatile *, long value );
|
||||
PLATFORM_INTERFACE long ThreadInterlockedExchangeAdd( long volatile *, long value );
|
||||
PLATFORM_INTERFACE long ThreadInterlockedCompareExchange( long volatile *, long value, long comperand );
|
||||
PLATFORM_INTERFACE bool ThreadInterlockedAssignIf( long volatile *, long value, long comperand );
|
||||
PLATFORM_INTERFACE int32 ThreadInterlockedIncrement( int32 volatile * );
|
||||
PLATFORM_INTERFACE int32 ThreadInterlockedDecrement( int32 volatile * );
|
||||
PLATFORM_INTERFACE int32 ThreadInterlockedExchange( int32 volatile *, int32 value );
|
||||
PLATFORM_INTERFACE int32 ThreadInterlockedExchangeAdd( int32 volatile *, int32 value );
|
||||
PLATFORM_INTERFACE int32 ThreadInterlockedCompareExchange( int32 volatile *, int32 value, int32 comperand );
|
||||
PLATFORM_INTERFACE bool ThreadInterlockedAssignIf( int32 volatile *, int32 value, int32 comperand );
|
||||
#endif
|
||||
|
||||
inline unsigned ThreadInterlockedExchangeSubtract( long volatile *p, long value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, -value ); }
|
||||
inline unsigned ThreadInterlockedExchangeSubtract( int32 volatile *p, int32 value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, -value ); }
|
||||
|
||||
#if defined( USE_INTRINSIC_INTERLOCKED ) && !defined( _WIN64 )
|
||||
#define TIPTR()
|
||||
inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)_InterlockedExchange( reinterpret_cast<long volatile *>(p), reinterpret_cast<long>(value) ); }
|
||||
inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)_InterlockedCompareExchange( reinterpret_cast<long volatile *>(p), reinterpret_cast<long>(value), reinterpret_cast<long>(comperand) ); }
|
||||
inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ( _InterlockedCompareExchange( reinterpret_cast<long volatile *>(p), reinterpret_cast<long>(value), reinterpret_cast<long>(comperand) ) == reinterpret_cast<long>(comperand) ); }
|
||||
inline void *ThreadInterlockedExchangePointer( void * volatile *p, void *value ) { return (void *)_InterlockedExchange( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value) ); }
|
||||
inline void *ThreadInterlockedCompareExchangePointer( void * volatile *p, void *value, void *comperand ) { return (void *)_InterlockedCompareExchange( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value), reinterpret_cast<intp>(comperand) ); }
|
||||
inline bool ThreadInterlockedAssignPointerIf( void * volatile *p, void *value, void *comperand ) { return ( _InterlockedCompareExchange( reinterpret_cast<intp volatile *>(p), reinterpret_cast<intp>(value), reinterpret_cast<intp>(comperand) ) == reinterpret_cast<intp>(comperand) ); }
|
||||
#else
|
||||
PLATFORM_INTERFACE void *ThreadInterlockedExchangePointer( void * volatile *, void *value ) NOINLINE;
|
||||
PLATFORM_INTERFACE void *ThreadInterlockedCompareExchangePointer( void * volatile *, void *value, void *comperand ) NOINLINE;
|
||||
@ -276,7 +283,7 @@ typedef __m128i int128;
|
||||
inline int128 int128_zero() { return _mm_setzero_si128(); }
|
||||
#else
|
||||
typedef __int128_t int128;
|
||||
#define int128_zero() 0
|
||||
#define int128_zero() int128()
|
||||
#endif
|
||||
|
||||
PLATFORM_INTERFACE bool ThreadInterlockedAssignIf128( volatile int128 *pDest, const int128 &value, const int128 &comperand ) NOINLINE;
|
||||
@ -290,21 +297,28 @@ PLATFORM_INTERFACE int64 ThreadInterlockedExchange64( int64 volatile *, int64 va
|
||||
PLATFORM_INTERFACE int64 ThreadInterlockedExchangeAdd64( int64 volatile *, int64 value ) NOINLINE;
|
||||
PLATFORM_INTERFACE bool ThreadInterlockedAssignIf64(volatile int64 *pDest, int64 value, int64 comperand ) NOINLINE;
|
||||
|
||||
inline unsigned ThreadInterlockedExchangeSubtract( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline unsigned ThreadInterlockedIncrement( unsigned volatile *p ) { return ThreadInterlockedIncrement( (long volatile *)p ); }
|
||||
inline unsigned ThreadInterlockedDecrement( unsigned volatile *p ) { return ThreadInterlockedDecrement( (long volatile *)p ); }
|
||||
inline unsigned ThreadInterlockedExchange( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchange( (long volatile *)p, value ); }
|
||||
inline unsigned ThreadInterlockedExchangeAdd( unsigned volatile *p, unsigned value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline unsigned ThreadInterlockedCompareExchange( unsigned volatile *p, unsigned value, unsigned comperand ) { return ThreadInterlockedCompareExchange( (long volatile *)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( unsigned volatile *p, unsigned value, unsigned comperand ) { return ThreadInterlockedAssignIf( (long volatile *)p, value, comperand ); }
|
||||
inline uint32 ThreadInterlockedExchangeSubtract( uint32 volatile *p, uint32 value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); }
|
||||
inline uint32 ThreadInterlockedIncrement( uint32 volatile *p ) { return ThreadInterlockedIncrement( (int32 volatile *)p ); }
|
||||
inline uint32 ThreadInterlockedDecrement( uint32 volatile *p ) { return ThreadInterlockedDecrement( (int32 volatile *)p ); }
|
||||
inline uint32 ThreadInterlockedExchange( uint32 volatile *p, uint32 value ) { return ThreadInterlockedExchange( (int32 volatile *)p, value ); }
|
||||
inline uint32 ThreadInterlockedExchangeAdd( uint32 volatile *p, uint32 value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); }
|
||||
inline uint32 ThreadInterlockedCompareExchange( uint32 volatile *p, uint32 value, uint32 comperand ) { return ThreadInterlockedCompareExchange( (int32 volatile *)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( uint32 volatile *p, uint32 value, uint32 comperand ) { return ThreadInterlockedAssignIf( (int32 volatile *)p, value, comperand ); }
|
||||
|
||||
inline int ThreadInterlockedExchangeSubtract( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline int ThreadInterlockedIncrement( int volatile *p ) { return ThreadInterlockedIncrement( (long volatile *)p ); }
|
||||
inline int ThreadInterlockedDecrement( int volatile *p ) { return ThreadInterlockedDecrement( (long volatile *)p ); }
|
||||
inline int ThreadInterlockedExchange( int volatile *p, int value ) { return ThreadInterlockedExchange( (long volatile *)p, value ); }
|
||||
inline int ThreadInterlockedExchangeAdd( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (long volatile *)p, value ); }
|
||||
inline int ThreadInterlockedCompareExchange( int volatile *p, int value, int comperand ) { return ThreadInterlockedCompareExchange( (long volatile *)p, value, comperand ); }
|
||||
inline bool ThreadInterlockedAssignIf( int volatile *p, int value, int comperand ) { return ThreadInterlockedAssignIf( (long volatile *)p, value, comperand ); }
|
||||
inline uint64 ThreadInterlockedIncrement64( uint64 volatile *p ) { return ThreadInterlockedIncrement64( (int64 volatile *)p ); }
|
||||
inline uint64 ThreadInterlockedDecrement64( uint64 volatile *p ) { return ThreadInterlockedDecrement64( (int64 volatile *)p ); }
|
||||
inline uint64 ThreadInterlockedCompareExchange64( uint64 volatile *p, uint64 value, uint64 comperand ) { return ThreadInterlockedCompareExchange64( (int64 volatile *)p, value, comperand ); }
|
||||
inline uint64 ThreadInterlockedExchange64( uint64 volatile *p, uint64 value ) { return ThreadInterlockedExchange64( (int64 volatile *)p, value ); }
|
||||
inline uint64 ThreadInterlockedExchangeAdd64( uint64 volatile *p, uint64 value ) { return ThreadInterlockedExchangeAdd64( (int64 volatile *)p, value ); }
|
||||
inline bool ThreadInterlockedAssignIf64( uint64 volatile *p, uint64 value, uint64 comperand ) { return ThreadInterlockedAssignIf64( (int64 volatile *)p, value, comperand ); }
|
||||
|
||||
//inline int ThreadInterlockedExchangeSubtract( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); }
|
||||
//inline int ThreadInterlockedIncrement( int volatile *p ) { return ThreadInterlockedIncrement( (int32 volatile *)p ); }
|
||||
//inline int ThreadInterlockedDecrement( int volatile *p ) { return ThreadInterlockedDecrement( (int32 volatile *)p ); }
|
||||
//inline int ThreadInterlockedExchange( int volatile *p, int value ) { return ThreadInterlockedExchange( (int32 volatile *)p, value ); }
|
||||
//inline int ThreadInterlockedExchangeAdd( int volatile *p, int value ) { return ThreadInterlockedExchangeAdd( (int32 volatile *)p, value ); }
|
||||
//inline int ThreadInterlockedCompareExchange( int volatile *p, int value, int comperand ) { return ThreadInterlockedCompareExchange( (int32 volatile *)p, value, comperand ); }
|
||||
//inline bool ThreadInterlockedAssignIf( int volatile *p, int value, int comperand ) { return ThreadInterlockedAssignIf( (int32 volatile *)p, value, comperand ); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Access to VTune thread profiling
|
||||
@ -380,17 +394,44 @@ private:
|
||||
public:
|
||||
CThreadLocal()
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof(T) == sizeof(void *) );
|
||||
#ifdef PLATFORM_64BITS
|
||||
COMPILE_TIME_ASSERT( sizeof(T) <= sizeof(void *) );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(T) == sizeof(void *) );
|
||||
#endif
|
||||
}
|
||||
|
||||
T Get() const
|
||||
{
|
||||
#ifdef PLATFORM_64BITS
|
||||
void *pData = CThreadLocalBase::Get();
|
||||
return *reinterpret_cast<T*>( &pData );
|
||||
#else
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma warning ( disable : 4311 )
|
||||
#endif
|
||||
return reinterpret_cast<T>( CThreadLocalBase::Get() );
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma warning ( default : 4311 )
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Set(T val)
|
||||
{
|
||||
#ifdef PLATFORM_64BITS
|
||||
void* pData = 0;
|
||||
*reinterpret_cast<T*>( &pData ) = val;
|
||||
CThreadLocalBase::Set( pData );
|
||||
#else
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma warning ( disable : 4312 )
|
||||
#endif
|
||||
CThreadLocalBase::Set( reinterpret_cast<void *>(val) );
|
||||
#ifdef COMPILER_MSVC
|
||||
#pragma warning ( default : 4312 )
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@ -433,16 +474,11 @@ template <class T = intp>
|
||||
operator const T *() { return (T *)Get(); }
|
||||
operator T *() { return (T *)Get(); }
|
||||
|
||||
int operator=( int i ) { AssertMsg( i == 0, "Only NULL allowed on integer assign" ); Set( NULL ); return 0; }
|
||||
T * operator=( T *p ) { Set( p ); return p; }
|
||||
|
||||
bool operator !() const { return (!Get()); }
|
||||
bool operator!=( int i ) const { AssertMsg( i == 0, "Only NULL allowed on integer compare" ); return (Get() != NULL); }
|
||||
bool operator==( int i ) const { AssertMsg( i == 0, "Only NULL allowed on integer compare" ); return (Get() == NULL); }
|
||||
bool operator==( const void *p ) const { return (Get() == p); }
|
||||
bool operator!=( const void *p ) const { return (Get() != p); }
|
||||
bool operator==( const T *p ) const { return operator==((void*)p); }
|
||||
bool operator!=( const T *p ) const { return operator!=((void*)p); }
|
||||
|
||||
T * operator->() { return (T *)Get(); }
|
||||
T & operator *() { return *((T *)Get()); }
|
||||
@ -480,7 +516,7 @@ template <typename T>
|
||||
class CInterlockedIntT
|
||||
{
|
||||
public:
|
||||
CInterlockedIntT() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(long) ); }
|
||||
CInterlockedIntT() : m_value( 0 ) { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(int) ); }
|
||||
CInterlockedIntT( T value ) : m_value( value ) {}
|
||||
|
||||
T GetRaw() const { return m_value; }
|
||||
@ -491,17 +527,34 @@ public:
|
||||
bool operator==( T rhs ) const { return ( m_value == rhs ); }
|
||||
bool operator!=( T rhs ) const { return ( m_value != rhs ); }
|
||||
|
||||
T operator++() { return (T)ThreadInterlockedIncrement( (long *)&m_value ); }
|
||||
|
||||
#if defined( __arm__ ) || defined( __arm64__ )
|
||||
CInterlockedIntT( const CInterlockedIntT &rhs ) : m_value( rhs ) {}
|
||||
CInterlockedIntT &operator=( const CInterlockedIntT &rhs ) { m_value.store(rhs.m_value.load()); return *this; }
|
||||
T operator++() { return m_value.fetch_add(1) + 1; }
|
||||
T operator++(int) { return m_value.fetch_add(1); }
|
||||
|
||||
T operator--() { return m_value.fetch_sub(1) - 1; }
|
||||
T operator--(int) { return m_value.fetch_sub(1); }
|
||||
|
||||
bool AssignIf( T conditionValue, T newValue ) { return m_value.compare_exchange_strong(conditionValue, newValue); }
|
||||
|
||||
T operator=( T newValue ) { m_value.store(newValue); return newValue; }
|
||||
|
||||
void operator+=( T add ) { m_value.fetch_add(add); }
|
||||
#else
|
||||
T operator++() { return (T)ThreadInterlockedIncrement( (int *)&m_value ); }
|
||||
T operator++(int) { return operator++() - 1; }
|
||||
|
||||
T operator--() { return (T)ThreadInterlockedDecrement( (long *)&m_value ); }
|
||||
T operator--() { return (T)ThreadInterlockedDecrement( (int *)&m_value ); }
|
||||
T operator--(int) { return operator--() + 1; }
|
||||
|
||||
bool AssignIf( T conditionValue, T newValue ) { return ThreadInterlockedAssignIf( (long *)&m_value, (long)newValue, (long)conditionValue ); }
|
||||
bool AssignIf( T conditionValue, T newValue ) { return ThreadInterlockedAssignIf( (int *)&m_value, (int)newValue, (int)conditionValue ); }
|
||||
|
||||
T operator=( T newValue ) { ThreadInterlockedExchange((long *)&m_value, newValue); return m_value; }
|
||||
T operator=( T newValue ) { ThreadInterlockedExchange((int *)&m_value, newValue); return m_value; }
|
||||
|
||||
void operator+=( T add ) { ThreadInterlockedExchangeAdd( (long *)&m_value, (long)add ); }
|
||||
void operator+=( T add ) { ThreadInterlockedExchangeAdd( (int *)&m_value, (int)add ); }
|
||||
#endif
|
||||
void operator-=( T subtract ) { operator+=( -subtract ); }
|
||||
void operator*=( T multiplier ) {
|
||||
T original, result;
|
||||
@ -524,7 +577,11 @@ public:
|
||||
T operator-( T rhs ) const { return m_value - rhs; }
|
||||
|
||||
private:
|
||||
#if defined( __arm__ ) || defined( __arm64__ )
|
||||
std::atomic<T> m_value;
|
||||
#else
|
||||
volatile T m_value;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef CInterlockedIntT<int> CInterlockedInt;
|
||||
@ -544,7 +601,21 @@ public:
|
||||
bool operator!() const { return ( m_value == 0 ); }
|
||||
bool operator==( T *rhs ) const { return ( m_value == rhs ); }
|
||||
bool operator!=( T *rhs ) const { return ( m_value != rhs ); }
|
||||
#if defined( __arm__ ) || defined( __arm64__ )
|
||||
CInterlockedPtr( const CInterlockedPtr &rhs ) : m_value( rhs ) {}
|
||||
CInterlockedPtr &operator=( const CInterlockedPtr &rhs ) { m_value.store(rhs.m_value.load()); return *this; }
|
||||
T *operator++() { return m_value.fetch_add(1) + 1; }
|
||||
T *operator++(int) { return m_value.fetch_add(1); }
|
||||
|
||||
T *operator--() { return m_value.fetch_sub(1) - 1; }
|
||||
T *operator--(int) { return m_value.fetch_sub(1); }
|
||||
|
||||
bool AssignIf( T *conditionValue, T *newValue ) { return m_value.compare_exchange_strong(conditionValue, newValue); }
|
||||
|
||||
T *operator=( T *newValue ) { m_value.store(newValue); return newValue; }
|
||||
|
||||
void operator+=( int add ) { m_value.fetch_add(add); }
|
||||
#else
|
||||
#if defined( PLATFORM_64BITS )
|
||||
T *operator++() { return ((T *)ThreadInterlockedExchangeAdd64( (int64 *)&m_value, sizeof(T) )) + 1; }
|
||||
T *operator++(int) { return (T *)ThreadInterlockedExchangeAdd64( (int64 *)&m_value, sizeof(T) ); }
|
||||
@ -569,6 +640,7 @@ public:
|
||||
T *operator=( T *newValue ) { ThreadInterlockedExchangePointerToConst( (void const **) &m_value, (void const *) newValue ); return newValue; }
|
||||
|
||||
void operator+=( int add ) { ThreadInterlockedExchangeAdd( (long *)&m_value, add * sizeof(T) ); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void operator-=( int subtract ) { operator+=( -subtract ); }
|
||||
@ -581,7 +653,11 @@ public:
|
||||
size_t operator-( const CInterlockedPtr<T> &p ) const { return m_value - p.m_value; }
|
||||
|
||||
private:
|
||||
#if defined( __arm__ ) || defined( __arm64__ )
|
||||
std::atomic<T *> m_value;
|
||||
#else
|
||||
T * volatile m_value;
|
||||
#endif
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -708,9 +784,13 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
FORCEINLINE bool TryLockInline( const uint32 threadId ) volatile
|
||||
FORCEINLINE bool TryLockInline( const uintp threadId ) volatile
|
||||
{
|
||||
if ( threadId != m_ownerID && !ThreadInterlockedAssignIf( (volatile long *)&m_ownerID, (long)threadId, 0 ) )
|
||||
#if PLATFORM_64BITS
|
||||
if ( threadId != m_ownerID && !ThreadInterlockedAssignIf64( &m_ownerID, threadId, 0 ) )
|
||||
#else
|
||||
if ( threadId != m_ownerID && !ThreadInterlockedAssignIf( &m_ownerID, threadId, 0 ) )
|
||||
#endif
|
||||
return false;
|
||||
|
||||
ThreadMemoryBarrier();
|
||||
@ -718,12 +798,12 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TryLock( const uint32 threadId ) volatile
|
||||
bool TryLock( const uintp threadId ) volatile
|
||||
{
|
||||
return TryLockInline( threadId );
|
||||
}
|
||||
|
||||
PLATFORM_CLASS void Lock( const uint32 threadId, unsigned nSpinSleepTime ) volatile;
|
||||
PLATFORM_CLASS void Lock( const uintp threadId, unsigned nSpinSleepTime ) volatile;
|
||||
|
||||
public:
|
||||
bool TryLock() volatile
|
||||
@ -743,7 +823,7 @@ public:
|
||||
#endif
|
||||
void Lock( unsigned int nSpinSleepTime = 0 ) volatile
|
||||
{
|
||||
const uint32 threadId = ThreadGetCurrentId();
|
||||
const uintp threadId = ThreadGetCurrentId();
|
||||
|
||||
if ( !TryLockInline( threadId ) )
|
||||
{
|
||||
@ -779,7 +859,11 @@ public:
|
||||
if ( !m_depth )
|
||||
{
|
||||
ThreadMemoryBarrier();
|
||||
ThreadInterlockedExchange( &m_ownerID, 0 );
|
||||
#if PLATFORM_64BITS
|
||||
ThreadInterlockedExchange64( &m_ownerID, 0 );
|
||||
#else
|
||||
ThreadInterlockedExchange( &m_ownerID, 0 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,10 +876,10 @@ public:
|
||||
bool AssertOwnedByCurrentThread() { return true; }
|
||||
void SetTrace( bool ) {}
|
||||
|
||||
uint32 GetOwnerId() const { return m_ownerID; }
|
||||
uintp GetOwnerId() const { return m_ownerID; }
|
||||
int GetDepth() const { return m_depth; }
|
||||
private:
|
||||
volatile uint32 m_ownerID;
|
||||
volatile uintp m_ownerID;
|
||||
int m_depth;
|
||||
};
|
||||
|
||||
@ -838,7 +922,7 @@ public:
|
||||
static bool AssertOwnedByCurrentThread() { return true; }
|
||||
static void SetTrace( bool b ) {}
|
||||
|
||||
static uint32 GetOwnerId() { return 0; }
|
||||
static uintp GetOwnerId() { return 0; }
|
||||
static int GetDepth() { return 0; }
|
||||
};
|
||||
|
||||
@ -1182,11 +1266,7 @@ private:
|
||||
class ALIGN8 PLATFORM_CLASS CThreadSpinRWLock
|
||||
{
|
||||
public:
|
||||
CThreadSpinRWLock()
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof( LockInfo_t ) == sizeof( int64 ) );
|
||||
Assert( (intp)this % 8 == 0 );
|
||||
}
|
||||
CThreadSpinRWLock() { Assert( (intp)this % 8 == 0 ); memset( this, 0, sizeof( *this ) ); }
|
||||
|
||||
bool TryLockForWrite();
|
||||
bool TryLockForRead();
|
||||
@ -1218,8 +1298,8 @@ private:
|
||||
};
|
||||
|
||||
bool AssignIf( const LockInfo_t &newValue, const LockInfo_t &comperand );
|
||||
bool TryLockForWrite( const uint32 threadId );
|
||||
void SpinLockForWrite( const uint32 threadId );
|
||||
bool TryLockForWrite( const uintp threadId );
|
||||
void SpinLockForWrite( const uintp threadId );
|
||||
|
||||
volatile LockInfo_t m_lockInfo;
|
||||
CInterlockedInt m_nWriters;
|
||||
@ -1751,10 +1831,16 @@ inline void CThreadRWLock::UnlockRead()
|
||||
|
||||
inline bool CThreadSpinRWLock::AssignIf( const LockInfo_t &newValue, const LockInfo_t &comperand )
|
||||
{
|
||||
#if PLATFORM_64BITS
|
||||
COMPILE_TIME_ASSERT(sizeof(LockInfo_t) == 16);
|
||||
return ThreadInterlockedAssignIf128( (int128 *)&m_lockInfo, *((int128 *)&newValue), *((int128 *)&comperand) );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT(sizeof(LockInfo_t) == 8);
|
||||
return ThreadInterlockedAssignIf64( (int64 *)&m_lockInfo, *((int64 *)&newValue), *((int64 *)&comperand) );
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool CThreadSpinRWLock::TryLockForWrite( const uint32 threadId )
|
||||
inline bool CThreadSpinRWLock::TryLockForWrite( const uintp threadId )
|
||||
{
|
||||
// In order to grab a write lock, there can be no readers and no owners of the write lock
|
||||
if ( m_lockInfo.m_nReaders > 0 || ( m_lockInfo.m_writerId && m_lockInfo.m_writerId != threadId ) )
|
||||
@ -1812,7 +1898,7 @@ inline bool CThreadSpinRWLock::TryLockForRead()
|
||||
|
||||
inline void CThreadSpinRWLock::LockForWrite()
|
||||
{
|
||||
const uint32 threadId = ThreadGetCurrentId();
|
||||
const uintp threadId = ThreadGetCurrentId();
|
||||
|
||||
m_nWriters++;
|
||||
|
||||
|
@ -190,7 +190,7 @@ typedef struct VCR_s
|
||||
void *lpStartAddress,
|
||||
void *lpParameter,
|
||||
unsigned long dwCreationFlags,
|
||||
unsigned long *lpThreadID );
|
||||
uintp *lpThreadID );
|
||||
|
||||
unsigned long (*Hook_WaitForSingleObject)(
|
||||
void *handle,
|
||||
|
@ -28,7 +28,7 @@ class CUtlBuffer;
|
||||
//-----------------------------------------------------------------------------
|
||||
// Invalid command handle
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef int CommandHandle_t;
|
||||
typedef intp CommandHandle_t;
|
||||
enum
|
||||
{
|
||||
COMMAND_BUFFER_INVALID_COMMAND_HANDLE = 0
|
||||
@ -100,11 +100,11 @@ private:
|
||||
};
|
||||
|
||||
// Insert a command into the command queue at the appropriate time
|
||||
void InsertCommandAtAppropriateTime( int hCommand );
|
||||
void InsertCommandAtAppropriateTime( CommandHandle_t hCommand );
|
||||
|
||||
// Insert a command into the command queue
|
||||
// Only happens if it's inserted while processing other commands
|
||||
void InsertImmediateCommand( int hCommand );
|
||||
void InsertImmediateCommand( CommandHandle_t hCommand );
|
||||
|
||||
// Insert a command into the command queue
|
||||
bool InsertCommand( const char *pArgS, int nCommandSize, int nTick );
|
||||
@ -125,7 +125,7 @@ private:
|
||||
int m_nCurrentTick;
|
||||
int m_nLastTickToProcess;
|
||||
int m_nWaitDelayTicks;
|
||||
int m_hNextCommand;
|
||||
CommandHandle_t m_hNextCommand;
|
||||
int m_nMaxArgSBufferLength;
|
||||
bool m_bIsProcessingCommands;
|
||||
bool m_bWaitEnabled;
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
void SetName( const char *setName);
|
||||
|
||||
// gets the name as a unique int
|
||||
int GetNameSymbol() const { return m_iKeyName; }
|
||||
intp GetNameSymbol() const { return m_iKeyName; }
|
||||
|
||||
// File access. Set UsesEscapeSequences true, if resource file/buffer uses Escape Sequences (eg \n, \t)
|
||||
void UsesEscapeSequences(bool state); // default false
|
||||
@ -132,7 +132,7 @@ public:
|
||||
// Find a keyValue, create it if it is not found.
|
||||
// Set bCreate to true to create the key if it doesn't already exist (which ensures a valid pointer will be returned)
|
||||
KeyValues *FindKey(const char *keyName, bool bCreate = false);
|
||||
KeyValues *FindKey(int keySymbol) const;
|
||||
KeyValues *FindKey(intp keySymbol) const;
|
||||
KeyValues *CreateNewKey(); // creates a new key, with an autogenerated name. name is guaranteed to be an integer, of value 1 higher than the highest other integer key name
|
||||
void AddSubKey( KeyValues *pSubkey ); // Adds a subkey. Make sure the subkey isn't a child of some other keyvalues
|
||||
void RemoveSubKey(KeyValues *subKey); // removes a subkey from the list, DOES NOT DELETE IT
|
||||
@ -311,7 +311,7 @@ private:
|
||||
void FreeAllocatedValue();
|
||||
void AllocateValueBlock(int size);
|
||||
|
||||
int m_iKeyName; // keyname is a symbol defined in KeyValuesSystem
|
||||
intp m_iKeyName; // keyname is a symbol defined in KeyValuesSystem
|
||||
|
||||
// These are needed out of the union because the API returns string pointers
|
||||
char *m_sValue;
|
||||
@ -338,22 +338,22 @@ private:
|
||||
private:
|
||||
// Statics to implement the optional growable string table
|
||||
// Function pointers that will determine which mode we are in
|
||||
static int (*s_pfGetSymbolForString)( const char *name, bool bCreate );
|
||||
static const char *(*s_pfGetStringForSymbol)( int symbol );
|
||||
static intp (*s_pfGetSymbolForString)( const char *name, bool bCreate );
|
||||
static const char *(*s_pfGetStringForSymbol)( intp symbol );
|
||||
static CKeyValuesGrowableStringTable *s_pGrowableStringTable;
|
||||
|
||||
public:
|
||||
// Functions that invoke the default behavior
|
||||
static int GetSymbolForStringClassic( const char *name, bool bCreate = true );
|
||||
static const char *GetStringForSymbolClassic( int symbol );
|
||||
static intp GetSymbolForStringClassic( const char *name, bool bCreate = true );
|
||||
static const char *GetStringForSymbolClassic( intp symbol );
|
||||
|
||||
// Functions that use the growable string table
|
||||
static int GetSymbolForStringGrowable( const char *name, bool bCreate = true );
|
||||
static const char *GetStringForSymbolGrowable( int symbol );
|
||||
static intp GetSymbolForStringGrowable( const char *name, bool bCreate = true );
|
||||
static const char *GetStringForSymbolGrowable( intp symbol );
|
||||
|
||||
// Functions to get external access to whichever of the above functions we're going to call.
|
||||
static int CallGetSymbolForString( const char *name, bool bCreate = true ) { return s_pfGetSymbolForString( name, bCreate ); }
|
||||
static const char *CallGetStringForSymbol( int symbol ) { return s_pfGetStringForSymbol( symbol ); }
|
||||
static intp CallGetSymbolForString( const char *name, bool bCreate = true ) { return s_pfGetSymbolForString( name, bCreate ); }
|
||||
static const char *CallGetStringForSymbol( intp symbol ) { return s_pfGetStringForSymbol( symbol ); }
|
||||
};
|
||||
|
||||
typedef KeyValues::AutoDelete KeyValuesAD;
|
||||
|
@ -225,7 +225,7 @@ public:
|
||||
void WriteByte(int val);
|
||||
void WriteShort(int val);
|
||||
void WriteWord(int val);
|
||||
void WriteLong(long val);
|
||||
void WriteLong(int32 val);
|
||||
void WriteLongLong(int64 val);
|
||||
void WriteFloat(float val);
|
||||
bool WriteBytes( const void *pBuf, int nBytes );
|
||||
@ -255,7 +255,7 @@ public:
|
||||
|
||||
public:
|
||||
// The current buffer.
|
||||
unsigned long* RESTRICT m_pData;
|
||||
uint32* RESTRICT m_pData;
|
||||
int m_nDataBytes;
|
||||
int m_nDataBits;
|
||||
|
||||
@ -342,7 +342,7 @@ BITBUF_INLINE void bf_write::WriteOneBitNoCheck(int nValue)
|
||||
else
|
||||
m_pData[m_iCurBit >> 5] &= ~(1u << (m_iCurBit & 31));
|
||||
#else
|
||||
extern unsigned long g_LittleBits[32];
|
||||
extern uint32 g_LittleBits[32];
|
||||
if(nValue)
|
||||
m_pData[m_iCurBit >> 5] |= g_LittleBits[m_iCurBit & 31];
|
||||
else
|
||||
@ -379,7 +379,7 @@ inline void bf_write::WriteOneBitAt( int iBit, int nValue )
|
||||
else
|
||||
m_pData[iBit >> 5] &= ~(1u << (iBit & 31));
|
||||
#else
|
||||
extern unsigned long g_LittleBits[32];
|
||||
extern uint32 g_LittleBits[32];
|
||||
if(nValue)
|
||||
m_pData[iBit >> 5] |= g_LittleBits[iBit & 31];
|
||||
else
|
||||
@ -393,7 +393,7 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||
// Make sure it doesn't overflow.
|
||||
if ( bCheckRange && numbits < 32 )
|
||||
{
|
||||
if ( curData >= (unsigned long)(1 << numbits) )
|
||||
if ( curData >= (uint32)(1 << numbits) )
|
||||
{
|
||||
CallErrorHandler( BITBUFERROR_VALUE_OUT_OF_RANGE, GetDebugName() );
|
||||
}
|
||||
@ -414,8 +414,8 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||
m_iCurBit += numbits;
|
||||
|
||||
// Mask in a dword.
|
||||
Assert( (iDWord*4 + sizeof(long)) <= (unsigned int)m_nDataBytes );
|
||||
unsigned long * RESTRICT pOut = &m_pData[iDWord];
|
||||
Assert( (iDWord*4 + sizeof(int32)) <= (unsigned int)m_nDataBytes );
|
||||
uint32 * RESTRICT pOut = &m_pData[iDWord];
|
||||
|
||||
// Rotate data into dword alignment
|
||||
curData = (curData << iCurBitMasked) | (curData >> (32 - iCurBitMasked));
|
||||
@ -427,8 +427,8 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||
|
||||
// Only look beyond current word if necessary (avoid access violation)
|
||||
int i = mask2 & 1;
|
||||
unsigned long dword1 = LoadLittleDWord( pOut, 0 );
|
||||
unsigned long dword2 = LoadLittleDWord( pOut, i );
|
||||
uint32 dword1 = LoadLittleDWord( pOut, 0 );
|
||||
uint32 dword2 = LoadLittleDWord( pOut, i );
|
||||
|
||||
// Drop bits into place
|
||||
dword1 ^= ( mask1 & ( curData ^ dword1 ) );
|
||||
@ -467,7 +467,7 @@ BITBUF_INLINE void bf_write::WriteBitFloat(float val)
|
||||
{
|
||||
int32 intVal;
|
||||
|
||||
Assert(sizeof(long) == sizeof(float));
|
||||
Assert(sizeof(int32) == sizeof(float));
|
||||
Assert(sizeof(float) == 4);
|
||||
|
||||
Q_memcpy( &intVal, &val, sizeof(intVal));
|
||||
@ -603,7 +603,7 @@ public:
|
||||
BITBUF_INLINE int ReadByte() { return ReadUBitLong(8); }
|
||||
BITBUF_INLINE int ReadShort() { return (short)ReadUBitLong(16); }
|
||||
BITBUF_INLINE int ReadWord() { return ReadUBitLong(16); }
|
||||
BITBUF_INLINE long ReadLong() { return ReadUBitLong(32); }
|
||||
BITBUF_INLINE int32 ReadLong() { return ReadUBitLong(32); }
|
||||
int64 ReadLongLong();
|
||||
float ReadFloat();
|
||||
bool ReadBytes(void *pOut, int nBytes);
|
||||
@ -728,7 +728,7 @@ inline bool bf_read::CheckForOverflow(int nBits)
|
||||
inline int bf_read::ReadOneBitNoCheck()
|
||||
{
|
||||
#if VALVE_LITTLE_ENDIAN
|
||||
unsigned int value = ((unsigned long * RESTRICT)m_pData)[m_iCurBit >> 5] >> (m_iCurBit & 31);
|
||||
unsigned int value = ((uint32 * RESTRICT)m_pData)[m_iCurBit >> 5] >> (m_iCurBit & 31);
|
||||
#else
|
||||
unsigned char value = m_pData[m_iCurBit >> 3] >> (m_iCurBit & 7);
|
||||
#endif
|
||||
@ -787,12 +787,12 @@ BITBUF_INLINE unsigned int bf_read::ReadUBitLong( int numbits ) RESTRICT
|
||||
#if __i386__
|
||||
unsigned int bitmask = (2 << (numbits-1)) - 1;
|
||||
#else
|
||||
extern unsigned long g_ExtraMasks[33];
|
||||
extern uint32 g_ExtraMasks[33];
|
||||
unsigned int bitmask = g_ExtraMasks[numbits];
|
||||
#endif
|
||||
|
||||
unsigned int dw1 = LoadLittleDWord( (unsigned long* RESTRICT)m_pData, iWordOffset1 ) >> iStartBit;
|
||||
unsigned int dw2 = LoadLittleDWord( (unsigned long* RESTRICT)m_pData, iWordOffset2 ) << (32 - iStartBit);
|
||||
unsigned int dw1 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset1 ) >> iStartBit;
|
||||
unsigned int dw2 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset2 ) << (32 - iStartBit);
|
||||
|
||||
return (dw1 | dw2) & bitmask;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ private:
|
||||
|
||||
inline unsigned short CDataManagerBase::FromHandle( memhandle_t handle )
|
||||
{
|
||||
unsigned int fullWord = (unsigned int)handle;
|
||||
uintp fullWord = (uintp)handle;
|
||||
unsigned short serial = fullWord>>16;
|
||||
unsigned short index = fullWord & 0xFFFF;
|
||||
index--;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user