Merge pull request #71 from nillerusr/64bits

64bits
This commit is contained in:
nillerusr 2022-06-19 15:12:20 +03:00 committed by GitHub
commit 1adc44a290
393 changed files with 18620 additions and 10840 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ build/
.lock-waf*
__pycache__
*.pyc
.DS_Store

View file

@ -206,7 +206,7 @@ GLMRendererInfo::GLMRendererInfo( GLMRendererInfoFields *info )
kCGLPFADoubleBuffer, kCGLPFANoRecovery, kCGLPFAAccelerated,
kCGLPFADepthSize, 0,
kCGLPFAColorSize, 32,
kCGLPFARendererID, info->m_rendererID,
kCGLPFARendererID, (unsigned int)info->m_rendererID,
0
};
@ -859,7 +859,7 @@ void GLMDisplayDB::PopulateRenderers( void )
{
// grab the OS version
long vMajor = 0; long vMinor = 0; long vMinorMinor = 0;
SInt32 vMajor = 0; SInt32 vMinor = 0; SInt32 vMinorMinor = 0;
OSStatus gestalt_err = 0;
gestalt_err = Gestalt(gestaltSystemVersionMajor, &vMajor);
@ -1374,7 +1374,7 @@ bool GLMDisplayDB::GetModeInfo( int rendererIndex, int displayIndex, int modeInd
{
int modeIndex=0;
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayMode);
CFNumberGetValue(number, kCFNumberLongType, &modeIndex);
CFNumberGetValue(number, kCFNumberIntType, &modeIndex);
// grab the width and height, I am unclear on whether this is the displayed FB width or the display device width.
int screenWidth=0;
@ -1382,11 +1382,11 @@ bool GLMDisplayDB::GetModeInfo( int rendererIndex, int displayIndex, int modeInd
int refreshHz=0;
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayWidth);
CFNumberGetValue(number, kCFNumberLongType, &screenWidth);
CFNumberGetValue(number, kCFNumberIntType, &screenWidth);
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayHeight);
CFNumberGetValue(number, kCFNumberLongType, &screenHeight);
CFNumberGetValue(number, kCFNumberIntType, &screenHeight);
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayRefreshRate);
CFNumberGetValue(number, kCFNumberLongType, &refreshHz);
CFNumberGetValue(number, kCFNumberIntType, &refreshHz);
GLMPRINTF(( "-D- GLMDisplayDB::GetModeInfo sees mode-index=%d, width=%d, height=%d on CGID %08x (display index %d on rendererindex %d)",
modeIndex,
@ -1574,7 +1574,7 @@ void GLMDisplayInfo::PopulateModes( void )
void GLMDisplayInfo::Dump( int which )
{
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %08x, cg-id=%08x display-mask=%08x pixwidth=%d pixheight=%d", which, (int)this, m_info.m_cgDisplayID, m_info.m_glDisplayMask, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
GLMPRINTF(("\n #%d: GLMDisplayInfo @ %08x, cg-id=%08x display-mask=%08x pixwidth=%d pixheight=%d", which, (int)(intp)this, m_info.m_cgDisplayID, m_info.m_glDisplayMask, m_info.m_displayPixelWidth, m_info.m_displayPixelHeight ));
FOR_EACH_VEC( *m_modes, i )
{

View file

@ -19,7 +19,9 @@
#include "tier1/utllinkedlist.h"
#include "tier1/convar.h"
#ifdef TOGLES
#include <EGL/egl.h>
#endif
// NOTE: This has to be the last file included! (turned off below, since this is included like a header)
#include "tier0/memdbgon.h"

View file

@ -10,7 +10,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
@ -435,7 +434,8 @@ static inline void DecodeAlpha3BitLinear( CDestPixel *pImPos, DXTAlphaBlock3BitL
// pRows = (Alpha3BitRows*) & ( pAlphaBlock->stuff[0] );
const DWORD mask = 0x00000007; // bits = 00 00 01 11
DWORD bits = *( (DWORD*) & ( pAlphaBlock->stuff[0] ));
DWORD bits;
memcpy( &bits, &(pAlphaBlock->stuff[0]), sizeof(DWORD) );
gBits[0][0] = (BYTE)( bits & mask );
bits >>= 3;
@ -454,7 +454,7 @@ static inline void DecodeAlpha3BitLinear( CDestPixel *pImPos, DXTAlphaBlock3BitL
gBits[1][3] = (BYTE)( bits & mask );
// now for last two rows:
bits = *( (DWORD*) & ( pAlphaBlock->stuff[3] )); // last 3 bytes
memcpy( &bits, &(pAlphaBlock->stuff[3]), sizeof(DWORD) );
gBits[2][0] = (BYTE)( bits & mask );
bits >>= 3;

View file

@ -311,13 +311,16 @@ FloatBitMap_t *FloatBitMap_t::QuarterSize(void) const
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
for(int y=0;y<Height/2;y++)
{
for(int x=0;x<Width/2;x++)
{
for(int c=0;c<4;c++)
newbm->Pixel(x,y,c)=((Pixel(x*2,y*2,c)+Pixel(x*2+1,y*2,c)+
Pixel(x*2,y*2+1,c)+Pixel(x*2+1,y*2+1,c))/4);
}
return newbm;
}
return newbm;
}
FloatBitMap_t *FloatBitMap_t::QuarterSizeBlocky(void) const
@ -326,12 +329,14 @@ FloatBitMap_t *FloatBitMap_t::QuarterSizeBlocky(void) const
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
for(int y=0;y<Height/2;y++)
{
for(int x=0;x<Width/2;x++)
{
for(int c=0;c<4;c++)
newbm->Pixel(x,y,c)=Pixel(x*2,y*2,c);
}
return newbm;
}
return newbm;
}
Vector FloatBitMap_t::AverageColor(void)
@ -349,12 +354,15 @@ float FloatBitMap_t::BrightestColor(void)
{
float ret=0.0;
for(int y=0;y<Height;y++)
{
for(int x=0;x<Width;x++)
{
Vector v(Pixel(x,y,0),Pixel(x,y,1),Pixel(x,y,2));
ret=max(ret,v.Length());
}
return ret;
}
return ret;
}
template <class T> static inline void SWAP(T & a, T & b)
@ -394,6 +402,7 @@ void FloatBitMap_t::UnLogize(void)
void FloatBitMap_t::Clear(float r, float g, float b, float alpha)
{
for(int y=0;y<Height;y++)
{
for(int x=0;x<Width;x++)
{
Pixel(x,y,0)=r;
@ -401,6 +410,7 @@ void FloatBitMap_t::Clear(float r, float g, float b, float alpha)
Pixel(x,y,2)=b;
Pixel(x,y,3)=alpha;
}
}
}
void FloatBitMap_t::ScaleRGB(float scale_factor)
@ -418,68 +428,77 @@ static int dy[4]={-1,0,0,1};
void FloatBitMap_t::SmartPaste(FloatBitMap_t const &b, int xofs, int yofs, uint32 Flags)
{
// now, need to make Difference map
FloatBitMap_t DiffMap0(this);
FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3};
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
// now, need to make Difference map
FloatBitMap_t DiffMap0(this);
FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3};
for (int x = 0; x < Width; x++)
{
for (int y = 0; y < Height; y++)
{
for(int i=0;i<NDELTAS;i++)
for (int c = 0; c < 3; c++)
{
int x1=x+dx[i];
int y1=y+dy[i];
x1=MAX(0,x1);
x1=MIN(Width-1,x1);
y1=MAX(0,y1);
y1=MIN(Height-1,y1);
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c);
deltas[i]->Pixel(x,y,c)=dx1;
for (int i = 0; i < NDELTAS; i++)
{
int x1 = x + dx[i];
int y1 = y + dy[i];
x1 = MAX(0, x1);
x1 = MIN(Width - 1, x1);
y1 = MAX(0, y1);
y1 = MIN(Height - 1, y1);
float dx1 = Pixel(x, y, c) - Pixel(x1, y1, c);
deltas[i]->Pixel(x, y, c) = dx1;
}
}
}
for(int x=1;x<b.Width-1;x++)
for(int y=1;y<b.Height-1;y++)
for(int c=0;c<3;c++)
}
for (int x = 1; x < b.Width - 1; x++)
{
for (int y = 1; y < b.Height - 1; y++)
{
for (int c = 0; c < 3; c++)
{
for (int i = 0; i < NDELTAS; i++)
{
for(int i=0;i<NDELTAS;i++)
float diff = b.Pixel(x, y, c) - b.Pixel(x + dx[i], y + dy[i], c);
deltas[i]->Pixel(x + xofs, y + yofs, c) = diff;
if (Flags & SPFLAGS_MAXGRADIENT)
{
float diff=b.Pixel(x,y,c)-b.Pixel(x+dx[i],y+dy[i],c);
deltas[i]->Pixel(x+xofs,y+yofs,c)=diff;
if (Flags & SPFLAGS_MAXGRADIENT)
{
float dx1=Pixel(x+xofs,y+yofs,c)-Pixel(x+dx[i]+xofs,y+dy[i]+yofs,c);
if (fabs(dx1)>fabs(diff))
deltas[i]->Pixel(x+xofs,y+yofs,c)=dx1;
}
float dx1 = Pixel(x + xofs, y + yofs, c) - Pixel(x + dx[i] + xofs, y + dy[i] + yofs, c);
if (fabs(dx1) > fabs(diff))
deltas[i]->Pixel(x + xofs, y + yofs, c) = dx1;
}
}
}
}
}
// now, calculate modifiability
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
{
float modify=0;
if (
(x>xofs+1) && (x<=xofs+b.Width-2) &&
(y>yofs+1) && (y<=yofs+b.Height-2))
modify=1;
Alpha(x,y)=modify;
}
// // now, force a fex pixels in center to be constant
// int midx=xofs+b.Width/2;
// int midy=yofs+b.Height/2;
// for(x=midx-10;x<midx+10;x++)
// for(int y=midy-10;y<midy+10;y++)
// {
// Alpha(x,y)=0;
// for(int c=0;c<3;c++)
// Pixel(x,y,c)=b.Pixel(x-xofs,y-yofs,c);
// }
Poisson(deltas,6000,Flags);
// now, calculate modifiability
for (int x = 0; x < Width; x++)
{
for (int y = 0; y < Height; y++)
{
float modify = 0;
if ( (x > xofs + 1) && (x <= xofs + b.Width - 2) &&
(y > yofs + 1) && (y <= yofs + b.Height - 2))
modify = 1;
Alpha(x, y) = modify;
}
}
// // now, force a fex pixels in center to be constant
// int midx=xofs+b.Width/2;
// int midy=yofs+b.Height/2;
// for(x=midx-10;x<midx+10;x++)
// for(int y=midy-10;y<midy+10;y++)
// {
// Alpha(x,y)=0;
// for(int c=0;c < 3;c++)
// Pixel(x,y,c)=b.Pixel(x-xofs,y-yofs,c);
// }
Poisson(deltas, 6000, Flags);
}
void FloatBitMap_t::ScaleGradients(void)
@ -489,57 +508,57 @@ void FloatBitMap_t::ScaleGradients(void)
FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3};
double gsum=0.0;
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3
};
double gsum = 0.0;
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
for (int c = 0; c < 3; c++)
{
for(int i=0;i<NDELTAS;i++)
for (int i = 0; i < NDELTAS; i++)
{
int x1=x+dx[i];
int y1=y+dy[i];
x1=MAX(0,x1);
x1=MIN(Width-1,x1);
y1=MAX(0,y1);
y1=MIN(Height-1,y1);
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c);
deltas[i]->Pixel(x,y,c)=dx1;
gsum+=fabs(dx1);
int x1 = x + dx[i];
int y1 = y + dy[i];
x1 = MAX(0, x1);
x1 = MIN(Width - 1, x1);
y1 = MAX(0, y1);
y1 = MIN(Height - 1, y1);
float dx1 = Pixel(x, y, c) - Pixel(x1, y1, c);
deltas[i]->Pixel(x, y, c) = dx1;
gsum += fabs(dx1);
}
}
// now, reduce gradient changes
// float gavg=gsum/(Width*Height);
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
for (int c = 0; c < 3; c++)
{
for (int i = 0; i < NDELTAS; i++)
{
float norml = 1.1 *deltas[i]->Pixel(x, y, c);
// if (norml < 0.0)
// norml=-pow(-norml,1.2);
// else
// norml=pow(norml,1.2);
deltas[i]->Pixel(x, y, c) = norml;
}
}
// now, reduce gradient changes
// float gavg=gsum/(Width*Height);
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
{
for(int i=0;i<NDELTAS;i++)
{
float norml=1.1*deltas[i]->Pixel(x,y,c);
// if (norml<0.0)
// norml=-pow(-norml,1.2);
// else
// norml=pow(norml,1.2);
deltas[i]->Pixel(x,y,c)=norml;
}
}
// now, calculate modifiability
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
{
float modify=0;
if (
(x>0) && (x<Width-1) &&
(y) && (y<Height-1))
{
modify=1;
Alpha(x,y)=modify;
}
}
// now, calculate modifiability
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
{
float modify = 0;
if ( (x > 0) && (x < Width - 1) &&
(y) && (y < Height - 1))
{
modify = 1;
Alpha(x, y) = modify;
}
}
Poisson(deltas,2200,0);
Poisson(deltas, 2200, 0);
}
@ -553,7 +572,9 @@ void FloatBitMap_t::MakeTileable(void)
// set each pixel=avg-pixel
FloatBitMap_t *cursrc=&rslta;
for(int x=1;x<Width-1;x++)
{
for(int y=1;y<Height-1;y++)
{
for(int c=0;c<3;c++)
{
DiffMapX.Pixel(x,y,c)=Pixel(x,y,c)-Pixel(x+1,y,c);
@ -586,7 +607,9 @@ void FloatBitMap_t::MakeTileable(void)
{
float error=0.0;
for(int x=1;x<Width-1;x++)
{
for(int y=1;y<Height-1;y++)
{
for(int c=0;c<3;c++)
{
float desiredx=DiffMapX.Pixel(x,y,c)+cursrc->Pixel(x+1,y,c);
@ -596,12 +619,16 @@ void FloatBitMap_t::MakeTileable(void)
error+=SQ(desired-cursrc->Pixel(x,y,c));
}
SWAP(cursrc,curdst);
}
}
}
// paste result
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
Pixel(x,y,c)=curdst->Pixel(x,y,c);
}
}
}
@ -613,15 +640,18 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(y=0;y<Height;y++)
if (Alpha(minx,y))
break;
if (y!=Height)
break;
}
for(maxx=Width-1;maxx>=0;maxx--)
{
int y;
for(y=0;y<Height;y++)
if (Alpha(maxx,y))
break;
if (y!=Height)
break;
}
@ -631,6 +661,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(x=minx;x<=maxx;x++)
if (Alpha(x,miny))
break;
if (x<maxx)
break;
}
@ -640,6 +671,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(x=minx;x<=maxx;x++)
if (Alpha(x,maxy))
break;
if (x<maxx)
break;
}
@ -647,7 +679,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
int n_iters,
uint32 flags // SPF_xxx
uint32 flags // SPF_xxx
)
{
int minx,miny,maxx,maxy;
@ -666,9 +698,13 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
tmp->Poisson(lowdeltas,n_iters*4,flags);
// now, propagate results from tmp to us
for(int x=0;x<tmp->Width;x++)
{
for(int y=0;y<tmp->Height;y++)
{
for(int xi=0;xi<2;xi++)
{
for(int yi=0;yi<2;yi++)
{
if (Alpha(x*2+xi,y*2+yi))
{
for(int c=0;c<3;c++)
@ -683,6 +719,10 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
delete tmp;
for(int i=0;i<NDELTAS;i++)
delete lowdeltas[i];
}
}
}
}
}
FloatBitMap_t work1(this);
FloatBitMap_t work2(this);
@ -704,7 +744,7 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
for(int i=0;i<NDELTAS;i++)
desired+=deltas[i]->Pixel(x,y,c)+cursrc->Pixel(x+dx[i],y+dy[i],c);
desired*=(1.0/NDELTAS);
// desired=FLerp(Pixel(x,y,c),desired,Alpha(x,y));
// desired=FLerp(Pixel(x,y,c),desired,Alpha(x,y));
curdst->Pixel(x,y,c)=FLerp(cursrc->Pixel(x,y,c),desired,0.5);
error+=SQ(desired-cursrc->Pixel(x,y,c));
}

View file

@ -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;

View file

@ -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++)

View file

@ -11,7 +11,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "nvtc.h"
#include "mathlib/mathlib.h"

View file

@ -8,7 +8,6 @@
#include "bitmap/imageformat.h"
#include "basetypes.h"
#include "tier0/dbg.h"
#include <malloc.h>
#include <memory.h>
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"

View file

@ -7,7 +7,6 @@
#include <stdlib.h>
#include <stdio.h>
#include "tier0/dbg.h"
#include <malloc.h>
#include "filesystem.h"
#include "bitmap/tgawriter.h"
#include "tier1/utlbuffer.h"

View file

@ -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"

View file

@ -6,7 +6,11 @@
//
//=============================================================================//
#include <stdio.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "ObjectList.h"
#include "tier1/strtools.h"

View file

@ -15,6 +15,7 @@
#include "filesystem.h"
#include "tier1/convar.h"
#include "cdll_int.h"
#include "vcrmode.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@ -1150,4 +1151,4 @@ void CInfoDescription::WriteFileHeader( FileHandle_t fp )
g_pFullFileSystem->FPrintf( fp, "//\r\n//\r\n// Cvar\t-\tSetting\r\n\r\n" );
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View file

@ -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;
};
//----------------------------------------------------------------------------------------

View file

@ -3,6 +3,8 @@
#ifdef ANDROID
#include <sys/cdefs.h>
#elif defined(OSX)
#include <stdint.h>
#else
#include <bits/wordsize.h>
#endif

View file

@ -22,7 +22,7 @@ extern "C" {
#define ALC_APIENTRY
#endif
#if TARGET_OS_MAC
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export on
#endif
@ -279,7 +279,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, A
#endif /* ALC_NO_PROTOTYPES */
#if TARGET_OS_MAC
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#pragma export off
#endif

File diff suppressed because it is too large Load diff

View file

@ -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,14 @@ BEGIN_BYTESWAP_DATADESC( studiohdr_t )
DEFINE_FIELD( contents, FIELD_INTEGER ),
DEFINE_FIELD( numincludemodels, FIELD_INTEGER ),
DEFINE_INDEX( includemodelindex, FIELD_INTEGER ),
DEFINE_FIELD( virtualModel, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_virtualModel, FIELD_INTEGER ), // void*
DEFINE_INDEX( szanimblocknameindex, FIELD_INTEGER ),
DEFINE_FIELD( numanimblocks, FIELD_INTEGER ),
DEFINE_INDEX( animblockindex, FIELD_INTEGER ),
DEFINE_FIELD( animblockModel, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_animblockModel, FIELD_INTEGER ), // void*
DEFINE_INDEX( bonetablebynameindex, FIELD_INTEGER ),
DEFINE_FIELD( pVertexBase, FIELD_INTEGER ), // void*
DEFINE_FIELD( pIndexBase, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_pVertexBase, FIELD_INTEGER ), // void*
DEFINE_FIELD( unused_pIndexBase, FIELD_INTEGER ), // void*
DEFINE_FIELD( constdirectionallightdot, FIELD_CHARACTER ), // byte
DEFINE_FIELD( rootLOD, FIELD_CHARACTER ), // byte
DEFINE_FIELD( numAllowedRootLODs, FIELD_CHARACTER ), // byte
@ -2985,7 +2985,11 @@ BEGIN_BYTESWAP_DATADESC( mstudiomesh_t )
END_BYTESWAP_DATADESC()
BEGIN_BYTESWAP_DATADESC( mstudio_meshvertexdata_t )
#ifdef PLATFORM_64BITS
DEFINE_FIELD( index_ptr_modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
#else
DEFINE_FIELD( modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
#endif
DEFINE_ARRAY( numLODVertexes, FIELD_INTEGER, MAX_NUM_LODS ),
END_BYTESWAP_DATADESC()

View file

@ -17,7 +17,7 @@
#include "filesystem.h"
#include "vguifont.h"
#ifdef LINUX
#if defined(LINUX) || defined(OSX)
#include <ft2build.h>
#include FT_FREETYPE_H
typedef void *(*FontDataHelper)( const char *pchFontName, int &size, const char *fontFileName );
@ -71,7 +71,7 @@ public:
IFileSystem *FileSystem() { return m_pFileSystem; }
IMaterialSystem *MaterialSystem() { return m_pMaterialSystem; }
#ifdef LINUX
#if defined(LINUX) || defined(OSX)
FT_Library GetFontLibraryHandle() { return library; }
void SetFontDataHelper( FontDataHelper helper ) { m_pFontDataHelper = helper; }
#endif
@ -96,7 +96,7 @@ private:
CUtlVector<CFontAmalgam> m_FontAmalgams;
CUtlVector<font_t *> m_Win32Fonts;
#ifdef LINUX
#if defined(LINUX) || defined(OSX)
FT_Library library;
FontDataHelper m_pFontDataHelper;
#endif

View file

@ -23,10 +23,7 @@ struct newChar_t
#ifdef WIN32
#include "Win32Font.h"
typedef CWin32Font font_t;
#elif defined(OSX)
#include "osxfont.h"
typedef COSXFont font_t;
#elif defined(LINUX)
#elif defined(LINUX) || defined(OSX)
#include "linuxfont.h"
typedef CLinuxFont font_t;
#else

View file

@ -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

View file

@ -126,7 +126,7 @@ struct studiodata_t
// array of cache handles to demand loaded virtual model data
int m_nAnimBlockCount;
DataCacheHandle_t *m_pAnimBlock;
unsigned long *m_iFakeAnimBlockStall;
unsigned int *m_iFakeAnimBlockStall;
// vertex data is usually compressed to save memory (model decal code only needs some data)
DataCacheHandle_t m_VertexCache;
@ -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 );
@ -523,7 +523,7 @@ private:
int UpdateOrCreate( studiohdr_t *pHdr, const char *pFilename, char *pX360Filename, int maxLen, const char *pPathID, bool bForce = false );
// Attempts to read the platform native file - on 360 it can read and swap Win32 file as a fallback
bool ReadFileNative( char *pFileName, const char *pPath, CUtlBuffer &buf, int nMaxBytes = 0 );
bool ReadFileNative( char *pFileName, const char *pPath, CUtlBuffer &buf, int nMaxBytes = 0, MDLCacheDataType_t type = MDLCACHE_NONE );
// Creates a thin cache entry (to be used for model decals) from fat vertex data
vertexFileHeader_t * CreateThinVertexes( vertexFileHeader_t * originalData, const studiohdr_t * pStudioHdr, int * cacheLength );
@ -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) )
{
@ -1169,8 +1169,8 @@ void CMDLCache::AllocateAnimBlocks( studiodata_t *pStudioData, int nCount )
memset( pStudioData->m_pAnimBlock, 0, sizeof(DataCacheHandle_t) * pStudioData->m_nAnimBlockCount );
pStudioData->m_iFakeAnimBlockStall = new unsigned long [pStudioData->m_nAnimBlockCount];
memset( pStudioData->m_iFakeAnimBlockStall, 0, sizeof( unsigned long ) * pStudioData->m_nAnimBlockCount );
pStudioData->m_iFakeAnimBlockStall = new unsigned int [pStudioData->m_nAnimBlockCount];
memset( pStudioData->m_iFakeAnimBlockStall, 0, sizeof( unsigned int ) * pStudioData->m_nAnimBlockCount );
}
void CMDLCache::FreeAnimBlocks( MDLHandle_t handle )
@ -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 );
}
@ -1453,7 +1453,7 @@ virtualmodel_t *CMDLCache::GetVirtualModelFast( const studiohdr_t *pStudioHdr, M
// 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 +1550,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 )
{
@ -1910,7 +1910,7 @@ int CMDLCache::UpdateOrCreate( studiohdr_t *pHdr, const char *pSourceName, char
//-----------------------------------------------------------------------------
// Purpose: Attempts to read a file native to the current platform
//-----------------------------------------------------------------------------
bool CMDLCache::ReadFileNative( char *pFileName, const char *pPath, CUtlBuffer &buf, int nMaxBytes )
bool CMDLCache::ReadFileNative( char *pFileName, const char *pPath, CUtlBuffer &buf, int nMaxBytes, MDLCacheDataType_t type )
{
bool bOk = false;
@ -1925,6 +1925,32 @@ bool CMDLCache::ReadFileNative( char *pFileName, const char *pPath, CUtlBuffer &
{
// Read the PC version
bOk = g_pFullFileSystem->ReadFile( pFileName, pPath, buf, nMaxBytes );
if( bOk && type == MDLCACHE_STUDIOHDR )
{
studiohdr_t* pStudioHdr = ( studiohdr_t* ) buf.PeekGet();
if ( pStudioHdr->studiohdr2index == 0 )
{
// We always need this now, so make room for it in the buffer now.
int bufferContentsEnd = buf.TellMaxPut();
int maskBits = VALIGNOF( studiohdr2_t ) - 1;
int offsetStudiohdr2 = ( bufferContentsEnd + maskBits ) & ~maskBits;
int sizeIncrease = ( offsetStudiohdr2 - bufferContentsEnd ) + sizeof( studiohdr2_t );
buf.SeekPut( CUtlBuffer::SEEK_CURRENT, sizeIncrease );
// Re-get the pointer after resizing, because it has probably moved.
pStudioHdr = ( studiohdr_t* ) buf.Base();
studiohdr2_t* pStudioHdr2 = ( studiohdr2_t* ) ( ( byte * ) pStudioHdr + offsetStudiohdr2 );
memset( pStudioHdr2, 0, sizeof( studiohdr2_t ) );
pStudioHdr2->flMaxEyeDeflection = 0.866f; // Matches studio.h.
pStudioHdr->studiohdr2index = offsetStudiohdr2;
// Also make sure the structure knows about the extra bytes
// we've added so they get copied around.
pStudioHdr->length += sizeIncrease;
}
}
}
return bOk;
@ -1970,7 +1996,7 @@ 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;
pStudioHdrIn->SetVirtualModel( MDLHandleToVirtual( handle ) );
MdlCacheMsg( "MDLCache: Alloc studiohdr %s\n", GetModelName( handle ) );
@ -2022,7 +2048,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
@ -2030,7 +2056,7 @@ bool CMDLCache::ReadMDLFile( MDLHandle_t handle, const char *pMDLFileName, CUtlB
MEM_ALLOC_CREDIT();
bool bOk = ReadFileNative( pFileName, "GAME", buf );
bool bOk = ReadFileNative( pFileName, "GAME", buf, 0, MDLCACHE_STUDIOHDR );
if ( !bOk )
{
DevWarning( "Failed to load %s!\n", pMDLFileName );
@ -2059,6 +2085,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 +2105,7 @@ 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;
pStudioHdr->SetVirtualModel( MDLHandleToVirtual( handle ) );
// Make sure all dependent files are valid
if ( !VerifyHeaders( pStudioHdr ) )
@ -2138,6 +2170,11 @@ studiohdr_t *CMDLCache::GetStudioHdr( MDLHandle_t handle )
// Assert( m_pModelCacheSection->IsFrameLocking() );
// Assert( m_pMeshCacheSection->IsFrameLocking() );
studiodata_t *pStudioData = m_MDLDict[handle];
if( !pStudioData )
return NULL;
#if _DEBUG
VPROF_INCREMENT_COUNTER( "GetStudioHdr", 1 );
#endif
@ -2236,7 +2273,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 +2338,7 @@ bool CMDLCache::HandleCacheNotification( const DataCacheNotification_t &notifica
{
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 +2357,7 @@ bool CMDLCache::HandleCacheNotification( const DataCacheNotification_t &notifica
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 +2463,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 +2618,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 +2679,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 +3074,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 +3159,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 +3185,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 +3279,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 +3367,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 +3377,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 +3457,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 +3621,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 +3932,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 +3941,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 ) );
}

View file

@ -8,7 +8,7 @@
#include "datamodel.h"
#include "tier1/KeyValues.h"
#ifndef _LINUX
#ifdef _WIN32
#define USE_WINDOWS_CLIPBOARD
#endif

View file

@ -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 )

View file

@ -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
}

View file

@ -264,7 +264,7 @@ DmAttributeType_t CDmSerializerKeyValues::DetermineAttributeType( KeyValues *pKe
if ( sscanf( pKeyValues->GetString(), "%f %f", &f1, &f2 ) == 2 )
return AT_VECTOR2;
int i = pKeyValues->GetInt( NULL, INT_MAX );
int i = pKeyValues->GetInt( nullptr, INT_MAX );
if ( ( sscanf( pKeyValues->GetString(), "%d", &i ) == 1 ) &&
( !strchr( pKeyValues->GetString(), '.' ) ) )
return AT_INT;

View file

@ -73,8 +73,10 @@ struct CSizeTest
COMPILE_TIME_ASSERT( sizeof( QAngle ) == 12 );
COMPILE_TIME_ASSERT( sizeof( Quaternion ) == 16 );
COMPILE_TIME_ASSERT( sizeof( VMatrix ) == 64 );
#if !defined( PLATFORM_64BITS )
COMPILE_TIME_ASSERT( sizeof( CUtlString ) == 4 );
COMPILE_TIME_ASSERT( sizeof( CUtlBinaryBlock ) == 16 );
#endif
COMPILE_TIME_ASSERT( sizeof( DmObjectId_t ) == 16 );
};
};

View file

@ -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 );

View file

@ -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 ) );
}

View file

@ -1268,7 +1268,9 @@ void CEdgeList::CullSmallOccluders()
// Sort the surfaces by screen area, in descending order
int nSurfCount = m_Surfaces.Count();
s_pSortSurfaces = m_Surfaces.Base();
qsort( m_SurfaceSort.Base(), nSurfCount, sizeof(int), SurfCompare );
if( m_SurfaceSort.Base() )
qsort( m_SurfaceSort.Base(), nSurfCount, sizeof(int), SurfCompare );
// We're going to keep the greater of r_occludermin + All surfaces with a screen area >= r_occluderarea
int nMinSurfaces = r_occludermincount.GetInt();
@ -1282,7 +1284,7 @@ void CEdgeList::CullSmallOccluders()
bool *bUseSurface = (bool*)stackalloc( nSurfCount * sizeof(bool) );
memset( bUseSurface, 0, nSurfCount * sizeof(bool) );
int i;
for ( i = 0; i < nSurfCount; ++i )
{

View file

@ -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;

View file

@ -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() );

View file

@ -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;

View file

@ -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;

View file

@ -109,7 +109,7 @@ private:
void audioRecordingCallback( void *userdata, uint8 *stream, int len )
{
VoiceRecord_SDL *voice = (VoiceRecord_SDL*)userdata;
voice->RenderBuffer( stream, len );
voice->RenderBuffer( (char*)stream, len );
}
VoiceRecord_SDL::VoiceRecord_SDL() :

View file

@ -1098,10 +1098,10 @@ void CBaseClient::EndTrace( bf_write &msg )
}
if ( sv_netspike_output.GetInt() & 1 )
COM_LogString( SERVER_PACKETS_LOG, logData.String() );
COM_LogString( SERVER_PACKETS_LOG, (const char*)logData.String() );
if ( sv_netspike_output.GetInt() & 2 )
Log( "%s", logData.String() );
ETWMark1S( "netspike", logData.String() );
Log( "%s", (const char*)logData.String() );
ETWMark1S( "netspike", (const char*)logData.String() );
m_Trace.m_Records.RemoveAll();
m_iTracing = 0;
}

View file

@ -893,7 +893,7 @@ CON_COMMAND_F( connect, "Connect to specified server.", FCVAR_DONTRECORD )
{
ConMsg( "Usage: connect <server>\n" );
}
vecArgs.PurgeAndDeleteElements();
vecArgs.PurgeAndDeleteElementsArray();
}
CON_COMMAND_F( redirect, "Redirect client to specified server.", FCVAR_DONTRECORD | FCVAR_SERVER_CAN_EXECUTE )
@ -2751,7 +2751,7 @@ void CL_InitLanguageCvar()
else if( szLang )
{
ELanguage lang = PchLanguageICUCodeToELanguage(szLang, k_Lang_English);
char *szShortLang = GetLanguageShortName(lang);
const char *szShortLang = GetLanguageShortName(lang);
cl_language.SetValue( szShortLang );
}
else

View file

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

View file

@ -56,12 +56,10 @@ public:
// Immediately try to start vprofiling
// Also, enable cheats on this client only
Cmd_SetRptActive( true );
StartVProfData();
}
virtual void OnSocketClosed( SocketHandle_t hSocket, const netadr_t & netAdr, void* pData )
{
StopVProfData();
Cmd_SetRptActive( false );
BaseClass::OnSocketClosed( hSocket, netAdr, pData );
}
@ -98,135 +96,6 @@ static void RconAddressChanged_f( IConVar *pConVar, const char *pOldString, floa
static ConVar rcon_address( "rcon_address", "", FCVAR_SERVER_CANNOT_QUERY|FCVAR_DONTRECORD, "Address of remote server if sending unconnected rcon commands (format x.x.x.x:p) ", RconAddressChanged_f );
//-----------------------------------------------------------------------------
// Implementation of remote vprof
//-----------------------------------------------------------------------------
CRConVProfExport::CRConVProfExport()
{
}
void CRConVProfExport::AddListener()
{
}
void CRConVProfExport::RemoveListener()
{
}
void CRConVProfExport::SetBudgetFlagsFilter( int filter )
{
}
int CRConVProfExport::GetNumBudgetGroups()
{
return m_Info.Count();
}
void CRConVProfExport::GetBudgetGroupInfos( CExportedBudgetGroupInfo *pInfos )
{
memcpy( pInfos, m_Info.Base(), GetNumBudgetGroups() * sizeof(CExportedBudgetGroupInfo) );
}
void CRConVProfExport::GetBudgetGroupTimes( float times[IVProfExport::MAX_BUDGETGROUP_TIMES] )
{
int nGroups = min( m_Times.Count(), (int)IVProfExport::MAX_BUDGETGROUP_TIMES );
memset( times, 0, nGroups * sizeof(float) );
nGroups = min( GetNumBudgetGroups(), nGroups );
memcpy( times, m_Times.Base(), nGroups * sizeof(float) );
}
void CRConVProfExport::PauseProfile()
{
// NOTE: This only has effect when testing on a listen server
// it shouldn't do anything in the wild. When drawing the budget panel
// this will cause the time spent doing so to not be counted
VProfExport_Pause();
}
void CRConVProfExport::ResumeProfile()
{
// NOTE: This only has effect when testing on a listen server
// it shouldn't do anything in the wild
VProfExport_Resume();
}
void CRConVProfExport::CleanupGroupData()
{
int nCount = m_Info.Count();
for ( int i = 0; i < nCount; ++i )
{
delete m_Info[i].m_pName;
}
m_Info.RemoveAll();
}
void CRConVProfExport::OnRemoteGroupData( const void *data, int len )
{
CUtlBuffer buf( data, len, CUtlBuffer::READ_ONLY );
int nFirstGroup = buf.GetInt();
if ( nFirstGroup == 0 )
{
CleanupGroupData();
}
else
{
Assert( nFirstGroup == m_Info.Count() );
}
// NOTE: See WriteRemoteVProfGroupData in vprof_engine.cpp
// to see the encoding of this data
int nGroupCount = buf.GetInt();
int nBase = m_Info.AddMultipleToTail( nGroupCount );
char temp[1024];
for ( int i = 0; i < nGroupCount; ++i )
{
CExportedBudgetGroupInfo *pInfo = &m_Info[nBase + i];
unsigned char red, green, blue, alpha;
red = buf.GetUnsignedChar( );
green = buf.GetUnsignedChar( );
blue = buf.GetUnsignedChar( );
alpha = buf.GetUnsignedChar( );
buf.GetString( temp );
int nLen = Q_strlen( temp );
pInfo->m_Color.SetColor( red, green, blue, alpha );
char *pBuf = new char[ nLen + 1 ];
pInfo->m_pName = pBuf;
memcpy( pBuf, temp, nLen+1 );
pInfo->m_BudgetFlags = 0;
}
}
void CRConVProfExport::OnRemoteData( const void *data, int len )
{
// NOTE: See WriteRemoteVProfData in vprof_engine.cpp
// to see the encoding of this data
int nCount = len / sizeof(float);
Assert( nCount == m_Info.Count() );
CUtlBuffer buf( data, len, CUtlBuffer::READ_ONLY );
m_Times.SetCount( nCount );
memcpy( m_Times.Base(), data, nCount * sizeof(float) );
}
CON_COMMAND( vprof_remote_start, "Request a VProf data stream from the remote server (requires authentication)" )
{
// TODO: Make this work (it might already!)
// RCONClient().StartVProfData();
}
CON_COMMAND( vprof_remote_stop, "Stop an existing remote VProf data request" )
{
// TODO: Make this work (it might already!)
// RCONClient().StopVProfData();
}
#ifdef ENABLE_RPT
CON_COMMAND_F( rpt_screenshot, "", FCVAR_HIDDEN | FCVAR_DONTRECORD )
{
@ -454,22 +323,6 @@ void CRConClient::ParseReceivedData()
}
break;
case SERVERDATA_VPROF_DATA:
{
int nDataSize = m_RecvBuffer.GetInt();
m_VProfExport.OnRemoteData( m_RecvBuffer.PeekGet(), nDataSize );
m_RecvBuffer.SeekGet( CUtlBuffer::SEEK_CURRENT, nDataSize );
}
break;
case SERVERDATA_VPROF_GROUPS:
{
int nDataSize = m_RecvBuffer.GetInt();
m_VProfExport.OnRemoteGroupData( m_RecvBuffer.PeekGet(), nDataSize );
m_RecvBuffer.SeekGet( CUtlBuffer::SEEK_CURRENT, nDataSize );
}
break;
case SERVERDATA_RESPONSE_STRING:
{
char pBuf[2048];
@ -706,45 +559,6 @@ void CRConClient::SendCmd( const char *msg )
SendResponse( response );
}
//-----------------------------------------------------------------------------
// Purpose: Start vprofiling
//-----------------------------------------------------------------------------
void CRConClient::StartVProfData()
{
if ( !IsConnected() )
{
if ( !ConnectSocket() )
return;
}
// Override the vprof export to point to our local profiling data
OverrideVProfExport( &m_VProfExport );
CUtlBuffer response;
BuildResponse( response, SERVERDATA_VPROF, "", "" );
SendResponse( response );
}
//-----------------------------------------------------------------------------
// Purpose: Stop vprofiling
//-----------------------------------------------------------------------------
void CRConClient::StopVProfData()
{
// Reset the vprof export to point to the normal profiling data
ResetVProfExport( &m_VProfExport );
// Don't bother restarting a connection to turn this off
if ( !IsConnected() )
return;
CUtlBuffer response;
BuildResponse( response, SERVERDATA_REMOVE_VPROF, "", "" );
SendResponse( response );
}
//-----------------------------------------------------------------------------
// Purpose: get data from the server
//-----------------------------------------------------------------------------

View file

@ -27,47 +27,6 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
abstract_class IVProfData
{
public:
virtual void OnRemoteGroupData( const void *data, int len ) = 0;
virtual void OnRemoteData( const void *data, int len ) = 0;
};
//-----------------------------------------------------------------------------
// Used to display client perf data in showbudget
//-----------------------------------------------------------------------------
class CRConVProfExport : public IVProfExport, public IVProfData
{
// Inherited from IVProfExport
public:
virtual void AddListener();
virtual void RemoveListener();
virtual void PauseProfile();
virtual void ResumeProfile();
virtual void SetBudgetFlagsFilter( int filter );
virtual int GetNumBudgetGroups();
virtual void GetBudgetGroupInfos( CExportedBudgetGroupInfo *pInfos );
virtual void GetBudgetGroupTimes( float times[MAX_BUDGETGROUP_TIMES] );
// Inherited from IVProfData
public:
virtual void OnRemoteGroupData( const void *data, int len );
virtual void OnRemoteData( const void *data, int len );
// Other public methods
public:
CRConVProfExport();
private:
void CleanupGroupData();
CUtlVector< CExportedBudgetGroupInfo > m_Info;
CUtlVector<float> m_Times; // Times from the most recent snapshot.
};
class CRConClient : public ISocketCreatorListener
{
public:
@ -89,10 +48,6 @@ public:
bool IsConnected() const;
bool IsAuthenticated() const { return m_bAuthenticated; }
void RegisterVProfDataCallback( IVProfData *callback );
void StopVProfData();
void StartVProfData();
void TakeScreenshot();
void GrabConsoleLog();
@ -116,7 +71,6 @@ private:
void SaveRemoteScreenshot( const void* pBuffer, int nBufLen );
void SaveRemoteConsoleLog( const void* pBuffer, int nBufLen );
CRConVProfExport m_VProfExport;
CSocketCreator m_Socket;
netadr_t m_Address;
int m_iAuthRequestID;

View file

@ -1816,14 +1816,14 @@ void CClientState::FinishSignonState_New()
//
// This is pretty janky, but doesn't really have any cost (and even makes our one-frozen-frame load screen slightly
// less likely to trigger OS "not responding" warnings)
extern void V_RenderVGuiOnly();
V_RenderVGuiOnly();
// extern void V_RenderVGuiOnly();
// V_RenderVGuiOnly();
// Before we do anything with the whitelist, make sure we have the proper map pack mounted
// this will load the .bsp by setting the world model the string list at the hardcoded index 1.
cl.SetModel( 1 );
V_RenderVGuiOnly();
//V_RenderVGuiOnly();
// Check for a new whitelist. It's good to do it early in the connection process here because if we wait until later,
// the client may have loaded some files w/o the proper whitelist restrictions and we'd have to reload them.

View file

@ -624,7 +624,7 @@ void Cmd_Exec_f( const CCommand &args )
}
}
char buf[16384] = { 0 };
static char buf[16384] = { 0 };
int len = 0;
char *f = (char *)COM_LoadStackFile( fileName, buf, sizeof( buf ), len );
if ( !f )
@ -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;

View file

@ -2677,6 +2677,9 @@ int CM_BoxVisible( const Vector& mins, const Vector& maxs, const byte *visbi
int cluster = CM_LeafCluster( leafList[i] );
int offset = cluster>>3;
if( offset == -1 )
return true;
if ( offset > vissize )
{
Sys_Error( "CM_BoxVisible: cluster %i, offset %i out of bounds %i\n", cluster, offset, vissize );

View file

@ -288,7 +288,7 @@ bool CollisionBSPData_Load( const char *pName, CCollisionBSPData *pBSPData )
CollisionBSPData_LoadPhysics( pBSPData );
COM_TimestampedLog( " CollisionBSPData_LoadDispInfo" );
CollisionBSPData_LoadDispInfo( pBSPData );
CollisionBSPData_LoadDispInfo( pBSPData );
return true;
}

View file

@ -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 &center, 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 )
@ -318,7 +318,7 @@ void CM_CreateDispPhysCollide( dphysdisp_t *pDispLump, int dispLumpSize )
{
g_VirtualTerrain.LevelInit(pDispLump, dispLumpSize);
g_TerrainList.SetCount( g_DispCollTreeCount );
for ( int i = 0; i < g_DispCollTreeCount; i++ )
for ( intp i = 0; i < g_DispCollTreeCount; i++ )
{
// Don't create a physics collision model for displacements that have been tagged as such.
CDispCollTree *pDispTree = &g_pDispCollTrees[i];

View file

@ -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 );
}
}
}

View file

@ -16,7 +16,11 @@
#include <characterset.h>
#include <bitbuf.h>
#include "common.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "traceinit.h"
#include <filesystem.h>
#include "filesystem_engine.h"

View file

@ -479,7 +479,7 @@ Handles cursor positioning, line wrapping, etc
*/
static bool g_fColorPrintf = false;
static bool g_bInColorPrint = false;
extern CThreadLocalInt<> g_bInSpew;
extern CTHREADLOCALINT g_bInSpew;
void Con_Printf( const char *fmt, ... );
@ -865,6 +865,7 @@ CConPanel::CConPanel( vgui::Panel *parent ) : CBasePanel( parent, "CConPanel" )
//-----------------------------------------------------------------------------
CConPanel::~CConPanel( void )
{
g_pConPanel = NULL;
}
void CConPanel::Con_NPrintf( int idx, const char *msg )

View file

@ -14,7 +14,11 @@
#include "filesystem.h"
#include "filesystem_engine.h"
#include "materialsystem/imaterial.h"
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "utldict.h"
// memdbgon must be the last include file in a .cpp file!!!

View file

@ -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 );
}

View file

@ -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;

View file

@ -924,14 +924,14 @@ 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 );
ReleaseThreadHandle( ( ThreadHandle_t )threadID );
}
else
{
@ -1070,16 +1070,16 @@ 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 );
ReleaseThreadHandle( ( ThreadHandle_t )nThreadID );
return nThreadID;
}
};

View file

@ -39,7 +39,7 @@ void EncodeFloat( const SendProp *pProp, float fVal, bf_write *pOut, int objectI
}
else // standard clamped-range float
{
unsigned long ulVal;
unsigned int ulVal;
int nBits = pProp->m_nBits;
if ( flags & SPROP_NOSCALE )
{
@ -109,7 +109,7 @@ static float DecodeFloat(SendProp const *pProp, bf_read *pIn)
}
else // standard clamped-range float
{
unsigned long dwInterp = pIn->ReadUBitLong(pProp->m_nBits);
unsigned int dwInterp = pIn->ReadUBitLong(pProp->m_nBits);
float fVal = (float)dwInterp / ((1 << pProp->m_nBits) - 1);
fVal = pProp->m_fLowValue + (pProp->m_fHighValue - pProp->m_fLowValue) * fVal;
return fVal;
@ -281,7 +281,7 @@ void Int_Decode( DecodeInfo *pInfo )
{
if ( flags & SPROP_UNSIGNED )
{
pInfo->m_Value.m_Int = (long)pInfo->m_pIn->ReadVarInt32();
pInfo->m_Value.m_Int = (int)pInfo->m_pIn->ReadVarInt32();
}
else
{
@ -295,7 +295,7 @@ void Int_Decode( DecodeInfo *pInfo )
if( bits != 32 && (flags & SPROP_UNSIGNED) == 0 )
{
unsigned long highbit = 1ul << (pProp->m_nBits - 1);
unsigned int highbit = 1ul << (pProp->m_nBits - 1);
if ( pInfo->m_Value.m_Int & highbit )
{
pInfo->m_Value.m_Int -= highbit; // strip high bit...

View file

@ -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;
}

View file

@ -121,7 +121,7 @@ inline unsigned char* UpdateRoutesExplicit_Template( DTStack *pStack, ProxyCalle
// Early out.
unsigned short iPropProxyIndex = pStack->m_pPrecalc->m_PropProxyIndices[pStack->m_iCurProp];
unsigned char **pTest = &pStack->m_pProxies[iPropProxyIndex];
if ( *pTest != (unsigned char*)0xFFFFFFFF )
if ( *pTest != (unsigned char*)-1 )
return *pTest;
// Ok.. setup this proxy.
@ -133,7 +133,7 @@ inline unsigned char* UpdateRoutesExplicit_Template( DTStack *pStack, ProxyCalle
CSendTablePrecalc::CProxyPathEntry *pEntry = &pStack->m_pPrecalc->m_ProxyPathEntries[proxyPath.m_iFirstEntry + i];
int iProxy = pEntry->m_iProxy;
if ( pStack->m_pProxies[iProxy] == (unsigned char*)0xFFFFFFFF )
if ( pStack->m_pProxies[iProxy] == (unsigned char*)-1 )
{
pStack->m_pProxies[iProxy] = ProxyCaller::CallProxy( pStack, pStructBase, pEntry->m_iDatatableProp );
if ( !pStack->m_pProxies[iProxy] )

View file

@ -52,7 +52,7 @@ public:
{
if ( pData )
{
delete pData;
delete[] pData;
}
}
@ -65,7 +65,7 @@ public:
pSendTable = src.pSendTable;
pClientClass = src.pClientClass;
filter.AddPlayersFromFilter( &src.filter );
if ( src.pData )
{
int size = Bits2Bytes( src.bits );

View file

@ -8,7 +8,6 @@
#include "quakedef.h" // for MAX_OSPATH
#include <stdlib.h>
#include <assert.h>
#include <malloc.h>
#include "filesystem.h"
#include "bitmap/tgawriter.h"
#include <tier2/tier2.h>

View file

@ -4099,7 +4099,9 @@ CBrushBatchRender::brushrender_t *CBrushBatchRender::FindOrCreateRenderBatch( mo
surfaceList.Sort( SurfaceCmp );
renderT.pPlanes = new cplane_t *[planeList.Count()];
renderT.planeCount = planeList.Count();
memcpy( renderT.pPlanes, planeList.Base(), sizeof(cplane_t *)*planeList.Count() );
if( planeList.Base() )
memcpy( renderT.pPlanes, planeList.Base(), sizeof(cplane_t *)*planeList.Count() );
renderT.pSurfaces = new brushrendersurface_t[surfaceList.Count()];
renderT.surfaceCount = surfaceList.Count();
@ -4745,7 +4747,7 @@ struct EnumLeafBoxInfo_t
VectorAligned m_vecBoxCenter;
VectorAligned m_vecBoxHalfDiagonal;
ISpatialLeafEnumerator *m_pIterator;
int m_nContext;
intp m_nContext;
};
struct EnumLeafSphereInfo_t
@ -4755,7 +4757,7 @@ struct EnumLeafSphereInfo_t
Vector m_vecBoxCenter;
Vector m_vecBoxHalfDiagonal;
ISpatialLeafEnumerator *m_pIterator;
int m_nContext;
intp m_nContext;
};
//-----------------------------------------------------------------------------
@ -5092,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)
@ -5151,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)
@ -5274,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 );
};
//-----------------------------------------------------------------------------
@ -5302,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 );
@ -5313,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;
@ -5338,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;
@ -5352,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)
{

View file

@ -22,6 +22,7 @@
#include "host.h"
#include "server.h"
#include "networkstringtableclient.h"
#include "vcrmode.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View file

@ -4850,7 +4850,9 @@ void Host_FreeToLowMark( bool server )
//-----------------------------------------------------------------------------
void Host_Shutdown(void)
{
#ifndef ANDROID
extern void ShutdownMixerControls();
#endif
if ( host_checkheap )
{
@ -4962,7 +4964,7 @@ void Host_Shutdown(void)
#ifndef SWDS
TRACESHUTDOWN( Key_Shutdown() );
#ifndef _X360
#if !defined _X360 && !defined ANDROID
TRACESHUTDOWN( ShutdownMixerControls() );
#endif
#endif

View file

@ -806,7 +806,8 @@ int CSaveRestore::SaveGameSlot( const char *pSaveName, const char *pSaveComment,
m_bWaitingForSafeDangerousSave = bIsAutosaveDangerous;
int iHeaderBufferSize = 64 + tokenSize + pSaveData->GetCurPos();
void *pMem = malloc(iHeaderBufferSize);
void *pMem = new char[iHeaderBufferSize];
CUtlBuffer saveHeader( pMem, iHeaderBufferSize );
// Write the header -- THIS SHOULD NEVER CHANGE STRUCTURE, USE SAVE_HEADER FOR NEW HEADER INFORMATION

View file

@ -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

View file

@ -6,7 +6,6 @@
//=============================================================================//
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "materialsystem/imaterialproxy.h"
#include "materialproxyfactory.h"

View file

@ -1831,7 +1831,7 @@ void *Hunk_AllocNameAlignedClear_( int size, int alignment, const char *pHunkNam
Assert(IsPowerOfTwo(alignment));
void *pMem = Hunk_AllocName( alignment + size, pHunkName );
memset( pMem, 0, size + alignment );
pMem = (void *)( ( ( ( unsigned long )pMem ) + (alignment-1) ) & ~(alignment-1) );
pMem = (void *)( ( ( ( uintp )pMem ) + (alignment-1) ) & ~(alignment-1) );
return pMem;
}
@ -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 );
}

View file

@ -1389,7 +1389,7 @@ bool NET_GetLoopPacket ( netpacket_t * packet )
if ( loop->data != loop->defbuffer )
{
delete loop->data;
delete[] loop->data;
loop->data = loop->defbuffer;
}

View file

@ -5,7 +5,11 @@
// $NoKeywords: $
//
//=============================================================================//
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <string.h>
#include <assert.h>
#include "packed_entity.h"

View file

@ -32,7 +32,11 @@
#ifdef _DEBUG
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#endif // _DEBUG
static ConVar sv_useexplicitdelete( "sv_useexplicitdelete", "1", FCVAR_DEVELOPMENTONLY, "Explicitly delete dormant client entities caused by AllowImmediateReuse()." );

View file

@ -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

View file

@ -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 );
@ -2154,11 +2154,11 @@ 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 );
@ -2304,7 +2304,7 @@ inline void R_DrawDecalMeshList( DecalMeshList_t &meshList )
}
#define DECALMARKERS_SWITCHSORTTREE ((decal_t *)0x00000000)
#define DECALMARKERS_SWITCHBUCKET ((decal_t *)0xFFFFFFFF)
#define DECALMARKERS_SWITCHBUCKET ((decal_t *)-1)
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
@ -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 );
@ -2647,7 +2647,7 @@ void R_DrawDecalsAll( IMatRenderContext *pRenderContext, int iGroup, int iTreeTy
if ( bucket.m_nCheckCount != nCheckCount )
continue;
int iHead = bucket.m_iHead;
intp iHead = bucket.m_iHead;
if ( !g_aDecalSortPool.IsValidIndex( iHead ) )
continue;
@ -2666,7 +2666,7 @@ void R_DrawDecalsAll( IMatRenderContext *pRenderContext, int iGroup, int iTreeTy
bool bBatchInit = true;
int nCount;
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 );
}

View file

@ -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 );
}
}

View file

@ -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 );
@ -310,12 +310,12 @@ int CSaveRestoreFileSystem::GetFileIndex( const char *filename )
FileHandle_t CSaveRestoreFileSystem::GetFileHandle( const char *filename )
{
int idx = GetFileIndex( filename );
intp idx = GetFileIndex( filename );
if ( idx == INVALID_INDEX )
{
idx = 0;
}
return (void*)idx;
return (FileHandle_t)idx;
}
//-----------------------------------------------------------------------------
@ -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 );
}
//-----------------------------------------------------------------------------
@ -339,7 +339,7 @@ bool CSaveRestoreFileSystem::HandleIsValid( FileHandle_t hFile )
//-----------------------------------------------------------------------------
void CSaveRestoreFileSystem::RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID )
{
int idx = GetFileIndex( pOldPath );
intp idx = GetFileIndex( pOldPath );
if ( idx != INVALID_INDEX )
{
CUtlSymbol newID = AddString( Q_UnqualifiedFileName( pNewPath ) );
@ -369,7 +369,7 @@ FileHandle_t CSaveRestoreFileSystem::Open( const char *pFullName, const char *pO
{
SaveFile_t *pFile = NULL;
CUtlSymbol id = AddString( Q_UnqualifiedFileName( pFullName ) );
int idx = GetDirectory().Find( id );
intp idx = GetDirectory().Find( id );
if ( idx == INVALID_INDEX )
{
// Don't create a read-only file
@ -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 )
{
@ -1289,7 +1289,7 @@ public:
SaveMsg( "DirectoryCopy: AsyncAppend %s, %s\n", szName, pDestFileName );
g_pFileSystem->AsyncAppend( pDestFileName, memcpy( new char[MAX_PATH], list[i].szFileName, MAX_PATH), MAX_PATH, true ); // Filename can only be as long as a map name + extension
g_pFileSystem->AsyncAppend( pDestFileName, new int(fileSize), sizeof(int), true );
g_pFileSystem->AsyncAppend( pDestFileName, memcpy( new char[sizeof(int)], &fileSize, sizeof(int)), sizeof(int), true );
g_pFileSystem->AsyncAppendFile( pDestFileName, szName );
}
}

View file

@ -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;
@ -2048,34 +2048,34 @@ public:
class CClipPlane
{
public:
static inline bool Inside( ShadowVertex_t const& vert )
static inline bool Inside( ShadowVertex_t const& vert )
{
return DotProduct( vert.m_Position, *m_pNormal ) < m_Dist;
return DotProduct( vert.m_Position, m_pNormal ) < m_Dist;
}
static inline float Clip( const Vector& one, const Vector& two )
static inline float Clip( const Vector& one, const Vector& two )
{
Vector dir;
VectorSubtract( two, one, dir );
return IntersectRayWithPlane( one, dir, *m_pNormal, m_Dist );
return IntersectRayWithPlane( one, dir, m_pNormal, m_Dist );
}
static inline bool IsAbove() {return false;}
static inline bool IsPlane() {return true;}
static void SetPlane( const Vector& normal, float dist )
static void SetPlane( const Vector normal, float dist )
{
m_pNormal = &normal;
m_pNormal = normal;
m_Dist = dist;
}
private:
static const Vector *m_pNormal;
static Vector m_pNormal;
static float m_Dist;
};
const Vector *CClipPlane::m_pNormal;
Vector CClipPlane::m_pNormal;
float CClipPlane::m_Dist;
static inline void ClampTexCoord( ShadowVertex_t *pInVertex, ShadowVertex_t *pOutVertex )

View file

@ -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;

File diff suppressed because it is too large Load diff

View file

@ -75,6 +75,7 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "tier0/memalloc.h"
extern CNetworkStringTableContainer *networkStringTableContainerServer;
extern CNetworkStringTableContainer *networkStringTableContainerClient;

View file

@ -284,53 +284,6 @@ void CServerRemoteAccess::WriteDataRequest( CRConServer *pNetworkListener, ra_li
#endif
}
break;
#ifdef VPROF_ENABLED
case SERVERDATA_VPROF:
{
char password[25];
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
{
invalidRequest = true;
break;
}
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
{
invalidRequest = true;
break;
}
if ( IsAuthenticated(listener) )
{
RegisterVProfDataListener( listener );
LogCommand( listener, "Remote VProf started!\n" );
RespondString( listener, requestID, "Remote VProf started!\n" );
}
}
break;
case SERVERDATA_REMOVE_VPROF:
{
char password[25];
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
{
invalidRequest = true;
break;
}
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
{
invalidRequest = true;
break;
}
if ( IsAuthenticated(listener) )
{
RemoveVProfDataListener( listener );
LogCommand( listener, "Remote VProf finished!\n" );
RespondString( listener, requestID, "Remote VProf finished!\n" );
}
}
break;
#endif
default:
Assert(!("Unknown requestType in CServerRemoteAccess::WriteDataRequest()"));
cmd.Purge();
@ -911,16 +864,6 @@ void CServerRemoteAccess::SendResponseToClient( ra_listener_id listenerID, Serve
response.Put( pData, nDataLen );
}
//-----------------------------------------------------------------------------
// Purpose: sends an opaque blob of data from VProf to a remote rcon listener
//-----------------------------------------------------------------------------
void CServerRemoteAccess::SendVProfData( ra_listener_id listenerID, bool bGroupData, void *data, int len )
{
Assert( listenerID != m_AdminUIID ); // only RCON clients support this right now
SendResponseToClient( listenerID, bGroupData ? SERVERDATA_VPROF_GROUPS : SERVERDATA_VPROF_DATA, data, len );
}
//-----------------------------------------------------------------------------
// Purpose: C function for rest of engine to access CServerRemoteAccess class
//-----------------------------------------------------------------------------

View file

@ -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();
};

View file

@ -797,7 +797,7 @@ void Sys_ShutdownAuthentication( void )
//-----------------------------------------------------------------------------
// Debug library spew output
//-----------------------------------------------------------------------------
CThreadLocalInt<> g_bInSpew;
CTHREADLOCALINT g_bInSpew;
#include "tier1/fmtstr.h"

View file

@ -100,6 +100,7 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "tier0/memalloc.h"
//-----------------------------------------------------------------------------
// Globals
@ -2260,7 +2261,7 @@ bool EnableLongTickWatcher()
#ifdef POSIX
(void*)
#endif
LongTickWatcherThread, NULL, 0, (unsigned long int *)&nThreadID );
LongTickWatcherThread, NULL, 0, (uintp *)&nThreadID );
bRet = true;
}

View file

@ -1566,7 +1566,7 @@ void *CGame::GetMainWindowPlatformSpecificHandle( void )
#ifdef OSX
id nsWindow = (id)pInfo.info.cocoa.window;
SEL selector = sel_registerName("windowRef");
id windowRef = objc_msgSend( nsWindow, selector );
id windowRef = ((id(*)(id, SEL))objc_msgSend)( nsWindow, selector );
return windowRef;
#else
// Not used on Linux.

View file

@ -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;
@ -367,7 +367,8 @@ void TextMessageParse( byte *pMemFile, int fileSize )
client_textmessage_t textMessages[ MAX_MESSAGES ];
int i, nameHeapSize, textHeapSize, messageSize, nameOffset;
int i, nameHeapSize, textHeapSize, messageSize;
intp nameOffset;
lastNamePos = 0;
lineNumber = 0;
@ -633,4 +634,4 @@ client_textmessage_t *TextMessageGet( const char *pName )
}
return NULL;
}
}

View file

@ -48,6 +48,7 @@
#include "replay_internal.h"
#include "replayserver.h"
#include "replay/iserverengine.h"
#include "vcrmode.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

View file

@ -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;
}

View file

@ -1117,8 +1117,6 @@ void WriteRemoteVProfGroupData( VProfListenInfo_t &info )
const char *pName = g_pVProfileForDisplay->GetBudgetGroupName( nIndex );
buf.PutString( pName );
}
g_ServerRemoteAccess.SendVProfData( info.m_nListenerId, true, buf.Base(), buf.TellMaxPut() );
}
static ConVar rpt_vprof_time( "rpt_vprof_time","0.25", FCVAR_HIDDEN | FCVAR_DONTRECORD, "" );
@ -1167,7 +1165,6 @@ void WriteRemoteVProfData()
Assert( nIndex >= 0 );
pSentTimes[ nIndex ] = pTimes[j];
}
g_ServerRemoteAccess.SendVProfData( s_VProfListeners[i].m_nListenerId, false, pSentTimes, nSentSize );
}
}

View file

@ -133,7 +133,14 @@ void Hunk_Print()
void Memory_Init( void )
{
MEM_ALLOC_CREDIT();
#ifdef PLATFORM_64BITS
// Seems to need to be larger to not get exhausted on
// 64-bit. Perhaps because of larger pointer sizes.
int nMaxBytes = 128*1024*1024;
#else
int nMaxBytes = 48*1024*1024;
#endif
const int nMinCommitBytes = 0x8000;
#ifndef HUNK_USE_16MB_PAGE
const int nInitialCommit = 0x280000;

View file

@ -306,7 +306,7 @@ CQueuedLoader::CQueuedLoader() : BaseClass( false )
V_memset( m_pLoaders, 0, sizeof( m_pLoaders ) );
// set resource dictionaries sort context
for ( int i = 0; i < RESOURCEPRELOAD_COUNT; i++ )
for ( intp i = 0; i < RESOURCEPRELOAD_COUNT; i++ )
{
m_ResourceNames[i].SetLessContext( (void *)i );
}
@ -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:
{

View file

@ -1804,7 +1804,7 @@ const char *CBaseFileSystem::GetWritePath( const char *pFilename, const char *pa
//-----------------------------------------------------------------------------
// Reads/writes files to utlbuffers. Attempts alignment fixups for optimal read
//-----------------------------------------------------------------------------
CThreadLocal<char *> g_pszReadFilename;
CTHREADLOCAL(char *) g_pszReadFilename;
bool CBaseFileSystem::ReadToBuffer( FileHandle_t fp, CUtlBuffer &buf, int nMaxBytes, FSAllocFunc_t pfnAlloc )
{
SetBufferSize( fp, 0 ); // TODO: what if it's a pack file? restore buffer size?

View file

@ -122,11 +122,11 @@ 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 );
int iEntry = m_map.Find( szFixedName );
intp iEntry = m_map.Find( szFixedName );
if ( iEntry == m_map.InvalidIndex() )
{
iEntry = m_map.Insert( strdup( szFixedName ), new AsyncOpenedFile_t );
@ -146,7 +146,7 @@ public:
AUTO_LOCK( m_mutex );
int iEntry = m_map.Find( szFixedName );
intp iEntry = m_map.Find( szFixedName );
if ( iEntry != m_map.InvalidIndex() )
{
m_map[iEntry]->AddRef();
@ -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 )
{
@ -488,7 +488,7 @@ public:
{
if ( m_pData && m_bFreeMemory )
{
free( (void*) m_pData );
delete[] (char*)m_pData;
}
}

View file

@ -14,7 +14,7 @@
#ifdef SUPPORT_PACKED_STORE
unsigned ThreadStubProcessMD5Requests( void *pParam )
uintp ThreadStubProcessMD5Requests( void *pParam )
{
return ((CFileTracker2 *)pParam)->ThreadedProcessMD5Requests();
}

View file

@ -102,7 +102,7 @@ HANDLE FindFirstFile( const char *fileName, FIND_DATA *dat)
{
char nameStore[PATH_MAX];
char *dir=NULL;
int n,iret=-1;
intp n,iret=-1;
Q_strncpy(nameStore,fileName, sizeof( nameStore ) );

View file

@ -677,6 +677,8 @@ C_BaseAnimating::C_BaseAnimating() :
m_pRagdoll = NULL;
m_builtRagdoll = false;
m_hitboxBoneCacheHandle = 0;
m_nHitboxSet = 0;
int i;
for ( i = 0; i < ARRAYSIZE( m_flEncodedController ); i++ )
{
@ -694,6 +696,8 @@ C_BaseAnimating::C_BaseAnimating() :
m_bStoreRagdollInfo = false;
m_pRagdollInfo = NULL;
m_pJiggleBones = NULL;
m_pBoneMergeCache = NULL;
m_flPlaybackRate = 1.0f;
@ -925,7 +929,7 @@ void C_BaseAnimating::LockStudioHdr()
if ( pNewWrapper->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)(pStudioHdr->virtualModel)&0xffff;
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
mdlcache->LockStudioHdr( hVirtualModel );
}
@ -946,7 +950,7 @@ void C_BaseAnimating::UnlockStudioHdr()
// Parallel rendering: don't unlock model data until end of rendering
if ( pStudioHdr->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( m_pStudioHdr->GetRenderHdr()->VirtualModel() );
pCallQueue->QueueCall( mdlcache, &IMDLCache::UnlockStudioHdr, hVirtualModel );
}
pCallQueue->QueueCall( mdlcache, &IMDLCache::UnlockStudioHdr, m_hStudioHdr );
@ -957,7 +961,7 @@ void C_BaseAnimating::UnlockStudioHdr()
// Immediate-mode rendering, can unlock immediately
if ( pStudioHdr->GetVirtualModel() )
{
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( m_pStudioHdr->GetRenderHdr()->VirtualModel() );
mdlcache->UnlockStudioHdr( hVirtualModel );
}
mdlcache->UnlockStudioHdr( m_hStudioHdr );

View file

@ -903,6 +903,7 @@ C_BaseEntity::C_BaseEntity() :
m_DataChangeEventRef = -1;
m_EntClientFlags = 0;
m_bEnableRenderingClipPlane = false;
m_iParentAttachment = 0;
m_nRenderFXBlend = 255;
@ -940,10 +941,12 @@ C_BaseEntity::C_BaseEntity() :
#if !defined( NO_ENTITY_PREDICTION )
m_pPredictionContext = NULL;
#endif
//NOTE: not virtual! we are in the constructor!
C_BaseEntity::Clear();
SetModelName( NULL_STRING );
m_iClassname = NULL_STRING;
m_InterpolationListEntry = 0xFFFF;
m_TeleportListEntry = 0xFFFF;
@ -984,7 +987,6 @@ C_BaseEntity::~C_BaseEntity()
void C_BaseEntity::Clear( void )
{
m_bDormant = true;
m_nCreationTick = -1;
m_RefEHandle.Term();
m_ModelInstance = MODEL_INSTANCE_INVALID;
@ -998,6 +1000,7 @@ void C_BaseEntity::Clear( void )
SetLocalOrigin( vec3_origin );
SetLocalAngles( vec3_angle );
model = NULL;
m_pOriginalData = NULL;
m_vecAbsOrigin.Init();
m_angAbsRotation.Init();
m_vecVelocity.Init();
@ -3741,7 +3744,7 @@ void C_BaseEntity::AddColoredDecal( const Vector& rayStart, const Vector& rayEnd
case mod_brush:
{
color32 cColor32 = { cColor.r(), cColor.g(), cColor.b(), cColor.a() };
color32 cColor32 = { (uint8)cColor.r(), (uint8)cColor.g(), (uint8)cColor.b(), (uint8)cColor.a() };
effects->DecalColorShoot( decalIndex, index, model, GetAbsOrigin(), GetAbsAngles(), decalCenter, 0, 0, cColor32 );
}
break;

View file

@ -91,7 +91,7 @@ struct FS_LocalToGlobal_t
const flexsettinghdr_t *m_Key;
int m_nCount;
int *m_Mapping;
int *m_Mapping = NULL;
};
bool FlexSettingLessFunc( const FS_LocalToGlobal_t& lhs, const FS_LocalToGlobal_t& rhs );

View file

@ -24,7 +24,7 @@ public:
private:
int m_nOccluderIndex;
bool m_bActive;
bool m_bActive = false;
};
IMPLEMENT_CLIENTCLASS_DT( C_FuncOccluder, DT_FuncOccluder, CFuncOccluder )

View file

@ -968,7 +968,7 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_FadeEndTime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minRandomSpeed", 10 );
pVelocity->SetFloat( "maxRandomSpeed", 20 );

View file

@ -345,7 +345,7 @@ float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, (int)m_queryHandle, pixelsPossible, (int)m_queryHandleCount, gpGlobals->framecount );
DevMsg( 1, "Pixels visible: %d (qh:%d) Pixels possible: %d (qh:%d) (frame:%d)\n", pixels, (int)(intp)m_queryHandle, pixelsPossible, (int)(intp)m_queryHandleCount, gpGlobals->framecount );
}
if ( pixels < 0 || pixelsPossible < 0 )
@ -376,7 +376,7 @@ float CPixelVisibilityQuery::GetFractionVisible( float fadeTimeInv )
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, (int)m_queryHandle, gpGlobals->framecount );
DevMsg( 1, "Pixels visible: %d (qh:%d) (frame:%d)\n", pixels, (int)(intp)m_queryHandle, gpGlobals->framecount );
}
if ( pixels < 0 )
@ -415,7 +415,7 @@ void CPixelVisibilityQuery::IssueQuery( IMatRenderContext *pRenderContext, float
if ( r_pixelvisibility_spew.GetBool() && CurrentViewID() == 0 )
{
DevMsg( 1, "Draw Proxy: qh:%d org:<%d,%d,%d> (frame:%d)\n", (int)m_queryHandle, (int)m_origin[0], (int)m_origin[1], (int)m_origin[2], gpGlobals->framecount );
DevMsg( 1, "Draw Proxy: qh:%d org:<%d,%d,%d> (frame:%d)\n", (int)(intp)m_queryHandle, (int)m_origin[0], (int)m_origin[1], (int)m_origin[2], gpGlobals->framecount );
}
m_clipFraction = PixelVisibility_DrawProxy( pRenderContext, m_queryHandle, m_origin, proxySize, proxyAspect, pMaterial, sizeIsScreenSpace );

View file

@ -1691,7 +1691,7 @@ void C_RopeKeyframe::BuildRope( RopeSegData_t *pSegmentData, const Vector &vCurr
if ( !bQueued && RopeManager()->IsHolidayLightMode() && r_rope_holiday_light_scale.GetFloat() > 0.0f )
{
data.m_nMaterial = reinterpret_cast< int >( this );
data.m_nMaterial = (intp)this;
data.m_nHitBox = ( iNode << 8 );
data.m_flScale = r_rope_holiday_light_scale.GetFloat();
data.m_vOrigin = pSegmentData->m_Segments[nSegmentCount].m_vPos;

View file

@ -166,7 +166,7 @@ void GenerateSquareWaveEffect( RumbleWaveform_t *pWaveform, const WaveGenParams_
while( i < NUM_WAVE_SAMPLES )
{
for( j = 0 ; j < steps ; j++ )
for( j = 0 ; j < steps && i < NUM_WAVE_SAMPLES; j++ )
{
if( params.leftChannel )
{
@ -177,7 +177,7 @@ void GenerateSquareWaveEffect( RumbleWaveform_t *pWaveform, const WaveGenParams_
pWaveform->amplitude_right[i++] = params.minAmplitude;
}
}
for( j = 0 ; j < steps ; j++ )
for( j = 0 ; j < steps && i < NUM_WAVE_SAMPLES; j++ )
{
if( params.leftChannel )
{

View file

@ -418,7 +418,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
// FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", m_nAttachment );
pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );
@ -430,7 +430,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_ParticleLifetime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minAttachmentSpeed", m_MinDirectedSpeed );
pVelocity->SetFloat( "maxAttachmentSpeed", m_MaxDirectedSpeed );
pVelocity->SetFloat( "minRandomSpeed", m_MinSpeed );
@ -1933,7 +1933,7 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg )
// FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", GetParentAttachment() );
pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );

View file

@ -132,7 +132,7 @@ static void RecordEffect( const char *pEffectName, const CEffectData &data )
msg->SetInt( "attachmentindex", data.m_nAttachmentIndex );
// NOTE: Ptrs are our way of indicating it's an entindex
msg->SetPtr( "entindex", (void*)data.entindex() );
msg->SetPtr( "entindex", (void*)(intp)data.entindex() );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
@ -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*)(intp)hWorld.ToInt() );
const char *pEffectName = pKeyValues->GetString( "effectname" );

Some files were not shown because too many files have changed in this diff Show more