Merge branch 'master' into windows
This commit is contained in:
commit
90cd6e0e15
37
.github/workflows/build.yml
vendored
Normal file
37
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: Build tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux-32:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build linux-i386
|
||||||
|
run: |
|
||||||
|
scripts/build-ubuntu-i386.sh
|
||||||
|
|
||||||
|
build-linux-64:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build linux-amd64
|
||||||
|
run: |
|
||||||
|
scripts/build-ubuntu-amd64.sh
|
||||||
|
|
||||||
|
build-android-armv7a:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build android-armv7a
|
||||||
|
run: |
|
||||||
|
scripts/build-android-armv7a.sh
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -4,7 +4,6 @@
|
|||||||
*.vpc.*
|
*.vpc.*
|
||||||
*.project
|
*.project
|
||||||
*obj_*
|
*obj_*
|
||||||
build/
|
|
||||||
.waf*
|
.waf*
|
||||||
.lock-waf*
|
.lock-waf*
|
||||||
__pycache__
|
__pycache__
|
||||||
@ -29,4 +28,11 @@ Release_*/
|
|||||||
*.ilk
|
*.ilk
|
||||||
ValveETWProviderEvents.h
|
ValveETWProviderEvents.h
|
||||||
game/client/*/client.lib
|
game/client/*/client.lib
|
||||||
game/server/*/server.lib
|
game/server/*/server.lib
|
||||||
|
.DS_Store
|
||||||
|
build*/
|
||||||
|
android/
|
||||||
|
.cache/
|
||||||
|
.ccache/
|
||||||
|
waf3*/
|
||||||
|
.vscode/
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -4,3 +4,6 @@
|
|||||||
[submodule "ivp"]
|
[submodule "ivp"]
|
||||||
path = ivp
|
path = ivp
|
||||||
url = https://github.com/nillerusr/source-physics
|
url = https://github.com/nillerusr/source-physics
|
||||||
|
[submodule "lib"]
|
||||||
|
path = lib
|
||||||
|
url = https://github.com/nillerusr/source-engine-libs
|
||||||
|
49
README.md
49
README.md
@ -1,36 +1,21 @@
|
|||||||
# source-engine
|
# source-engine
|
||||||
|
Welcome to source engine:)
|
||||||
|
|
||||||
# Goals
|
Discord: https://discord.gg/hZRB7WMgGw
|
||||||
* fixing bugs
|
|
||||||
* ~~NEON support~~
|
|
||||||
* DXVK support
|
|
||||||
* remove unnecessary dependencies
|
|
||||||
* Elbrus port
|
|
||||||
* ~~Arm(android) port~~
|
|
||||||
* improve performance
|
|
||||||
* ~~replace current buildsystem with waf~~
|
|
||||||
* rewrite achivement system( to work without steam )
|
|
||||||
* 64-bit support
|
|
||||||
|
|
||||||
# How to Build?
|
# Current tasks
|
||||||
Clone repo and change directory:
|
- [x] NEON support
|
||||||
```
|
- [x] remove unnecessary dependencies
|
||||||
git clone https://github.com/nillerusr/source-engine --recursive --depth 1
|
- [x] Arm(android) port
|
||||||
cd source-engine
|
- [x] replace current buildsystem with waf
|
||||||
```
|
- [x] rewrite achivement system( to work without steam )
|
||||||
On Linux:
|
- [x] 64-bit support
|
||||||
|
- [ ] improve performance
|
||||||
|
- [ ] fixing bugs
|
||||||
|
- [ ] dxvk-native support
|
||||||
|
- [ ] Elbrus port
|
||||||
|
- [ ] rewrite serverbrowser to work without steam
|
||||||
|
- [ ] Windows build support for waf
|
||||||
|
|
||||||
dependencies:
|
|
||||||
fontconfig, freetype2, OpenAL, SDL2, libbz2, libcurl, libjpeg, libpng, zlib
|
# [How to Build?](https://github.com/nillerusr/source-engine/wiki/How-to-build)
|
||||||
```
|
|
||||||
./waf configure -T debug
|
|
||||||
./waf build
|
|
||||||
```
|
|
||||||
On Linux for Android(**Note: only Android NDK r10e is supported**):
|
|
||||||
```
|
|
||||||
export ANDROID_NDK=/path/to/ndk
|
|
||||||
./waf configure -T debug --android=armeabi-v7a,4.9,21
|
|
||||||
./waf build
|
|
||||||
```
|
|
||||||
On Windows/MacOS:
|
|
||||||
**TODO(WAF is not configured for Windows/MacOS. Use VPC as temporary solution)**
|
|
||||||
|
@ -595,9 +595,13 @@ void GLMDisplayInfo::PopulateModes( void )
|
|||||||
// Add double of everything also - Retina proofing hopefully.
|
// Add double of everything also - Retina proofing hopefully.
|
||||||
m_modes->AddToTail( new GLMDisplayMode( w * 2, h * 2, 0 ) );
|
m_modes->AddToTail( new GLMDisplayMode( w * 2, h * 2, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_modes->AddToTail( new GLMDisplayMode( w, w * ((float)m_info.m_displayPixelHeight/m_info.m_displayPixelWidth), 0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_modes->AddToTail( new GLMDisplayMode( m_info.m_displayPixelWidth / 2, m_info.m_displayPixelHeight / 2, 0 ) );
|
||||||
|
|
||||||
m_modes->Sort( DisplayModeSortFunction );
|
m_modes->Sort( DisplayModeSortFunction );
|
||||||
|
|
||||||
// remove dupes.
|
// remove dupes.
|
||||||
|
@ -206,7 +206,7 @@ GLMRendererInfo::GLMRendererInfo( GLMRendererInfoFields *info )
|
|||||||
kCGLPFADoubleBuffer, kCGLPFANoRecovery, kCGLPFAAccelerated,
|
kCGLPFADoubleBuffer, kCGLPFANoRecovery, kCGLPFAAccelerated,
|
||||||
kCGLPFADepthSize, 0,
|
kCGLPFADepthSize, 0,
|
||||||
kCGLPFAColorSize, 32,
|
kCGLPFAColorSize, 32,
|
||||||
kCGLPFARendererID, info->m_rendererID,
|
kCGLPFARendererID, (unsigned int)info->m_rendererID,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -859,7 +859,7 @@ void GLMDisplayDB::PopulateRenderers( void )
|
|||||||
{
|
{
|
||||||
// grab the OS version
|
// 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;
|
OSStatus gestalt_err = 0;
|
||||||
gestalt_err = Gestalt(gestaltSystemVersionMajor, &vMajor);
|
gestalt_err = Gestalt(gestaltSystemVersionMajor, &vMajor);
|
||||||
@ -1374,7 +1374,7 @@ bool GLMDisplayDB::GetModeInfo( int rendererIndex, int displayIndex, int modeInd
|
|||||||
{
|
{
|
||||||
int modeIndex=0;
|
int modeIndex=0;
|
||||||
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayMode);
|
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.
|
// grab the width and height, I am unclear on whether this is the displayed FB width or the display device width.
|
||||||
int screenWidth=0;
|
int screenWidth=0;
|
||||||
@ -1382,11 +1382,11 @@ bool GLMDisplayDB::GetModeInfo( int rendererIndex, int displayIndex, int modeInd
|
|||||||
int refreshHz=0;
|
int refreshHz=0;
|
||||||
|
|
||||||
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayWidth);
|
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayWidth);
|
||||||
CFNumberGetValue(number, kCFNumberLongType, &screenWidth);
|
CFNumberGetValue(number, kCFNumberIntType, &screenWidth);
|
||||||
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayHeight);
|
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayHeight);
|
||||||
CFNumberGetValue(number, kCFNumberLongType, &screenHeight);
|
CFNumberGetValue(number, kCFNumberIntType, &screenHeight);
|
||||||
number = (CFNumberRef)CFDictionaryGetValue(curModeDict, kCGDisplayRefreshRate);
|
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)",
|
GLMPRINTF(( "-D- GLMDisplayDB::GetModeInfo sees mode-index=%d, width=%d, height=%d on CGID %08x (display index %d on rendererindex %d)",
|
||||||
modeIndex,
|
modeIndex,
|
||||||
@ -1574,7 +1574,7 @@ void GLMDisplayInfo::PopulateModes( void )
|
|||||||
|
|
||||||
void GLMDisplayInfo::Dump( int which )
|
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 )
|
FOR_EACH_VEC( *m_modes, i )
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
#include "tier1/utllinkedlist.h"
|
#include "tier1/utllinkedlist.h"
|
||||||
#include "tier1/convar.h"
|
#include "tier1/convar.h"
|
||||||
|
#ifdef TOGLES
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// NOTE: This has to be the last file included! (turned off below, since this is included like a header)
|
// NOTE: This has to be the last file included! (turned off below, since this is included like a header)
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -63,10 +65,16 @@ static void *l_egl = NULL;
|
|||||||
static void *l_gles = NULL;
|
static void *l_gles = NULL;
|
||||||
|
|
||||||
typedef void *(*t_glGetProcAddress)( const char * );
|
typedef void *(*t_glGetProcAddress)( const char * );
|
||||||
t_glGetProcAddress _glGetProcAddress;
|
|
||||||
|
|
||||||
typedef EGLBoolean (*t_eglBindAPI)(EGLenum api);
|
typedef EGLBoolean (*t_eglBindAPI)(EGLenum api);
|
||||||
|
typedef EGLBoolean (*t_eglInitialize)(EGLDisplay display, EGLint *major, EGLint *minor);
|
||||||
|
typedef EGLDisplay (*t_eglGetDisplay)(NativeDisplayType native_display);
|
||||||
|
typedef char const *(*t_eglQueryString)(EGLDisplay display, EGLint name);
|
||||||
|
|
||||||
t_eglBindAPI _eglBindAPI;
|
t_eglBindAPI _eglBindAPI;
|
||||||
|
t_glGetProcAddress _glGetProcAddress;
|
||||||
|
t_eglInitialize _eglInitialize;
|
||||||
|
t_eglGetDisplay _eglGetDisplay;
|
||||||
|
t_eglQueryString _eglQueryString;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -594,11 +602,25 @@ InitReturnVal_t CSDLMgr::Init()
|
|||||||
l_gles = dlopen("libGLESv3.so", RTLD_LAZY);
|
l_gles = dlopen("libGLESv3.so", RTLD_LAZY);
|
||||||
|
|
||||||
if( l_egl )
|
if( l_egl )
|
||||||
|
{
|
||||||
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_egl, "eglGetProcAddress");
|
_glGetProcAddress = (t_glGetProcAddress)dlsym(l_egl, "eglGetProcAddress");
|
||||||
|
}
|
||||||
|
|
||||||
SET_GL_ATTR(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
SET_GL_ATTR(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||||
SET_GL_ATTR(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
SET_GL_ATTR(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
SET_GL_ATTR(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
SET_GL_ATTR(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||||
|
|
||||||
|
_eglInitialize = (t_eglInitialize)dlsym(l_egl, "eglInitialize");
|
||||||
|
_eglGetDisplay = (t_eglGetDisplay)dlsym(l_egl, "eglGetDisplay");
|
||||||
|
_eglQueryString = (t_eglQueryString)dlsym(l_egl, "eglQueryString");
|
||||||
|
|
||||||
|
if( _eglInitialize && _eglInitialize && _eglQueryString )
|
||||||
|
{
|
||||||
|
EGLDisplay display = _eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
|
if( _eglInitialize(display, NULL, NULL) != -1
|
||||||
|
&& strstr(_eglQueryString(display, EGL_EXTENSIONS) ,"EGL_KHR_gl_colorspace") )
|
||||||
|
SET_GL_ATTR(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1)
|
||||||
|
}
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
bool m_bOGL = false;
|
bool m_bOGL = false;
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "bitmap/imageformat.h"
|
#include "bitmap/imageformat.h"
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include "mathlib/mathlib.h"
|
#include "mathlib/mathlib.h"
|
||||||
#include "mathlib/vector.h"
|
#include "mathlib/vector.h"
|
||||||
@ -435,7 +434,8 @@ static inline void DecodeAlpha3BitLinear( CDestPixel *pImPos, DXTAlphaBlock3BitL
|
|||||||
// pRows = (Alpha3BitRows*) & ( pAlphaBlock->stuff[0] );
|
// pRows = (Alpha3BitRows*) & ( pAlphaBlock->stuff[0] );
|
||||||
const DWORD mask = 0x00000007; // bits = 00 00 01 11
|
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 );
|
gBits[0][0] = (BYTE)( bits & mask );
|
||||||
bits >>= 3;
|
bits >>= 3;
|
||||||
@ -454,7 +454,7 @@ static inline void DecodeAlpha3BitLinear( CDestPixel *pImPos, DXTAlphaBlock3BitL
|
|||||||
gBits[1][3] = (BYTE)( bits & mask );
|
gBits[1][3] = (BYTE)( bits & mask );
|
||||||
|
|
||||||
// now for last two rows:
|
// 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 );
|
gBits[2][0] = (BYTE)( bits & mask );
|
||||||
bits >>= 3;
|
bits >>= 3;
|
||||||
|
@ -311,13 +311,16 @@ FloatBitMap_t *FloatBitMap_t::QuarterSize(void) const
|
|||||||
|
|
||||||
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
|
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
|
||||||
for(int y=0;y<Height/2;y++)
|
for(int y=0;y<Height/2;y++)
|
||||||
|
{
|
||||||
for(int x=0;x<Width/2;x++)
|
for(int x=0;x<Width/2;x++)
|
||||||
{
|
{
|
||||||
for(int c=0;c<4;c++)
|
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)+
|
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);
|
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
|
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);
|
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
|
||||||
for(int y=0;y<Height/2;y++)
|
for(int y=0;y<Height/2;y++)
|
||||||
|
{
|
||||||
for(int x=0;x<Width/2;x++)
|
for(int x=0;x<Width/2;x++)
|
||||||
{
|
{
|
||||||
for(int c=0;c<4;c++)
|
for(int c=0;c<4;c++)
|
||||||
newbm->Pixel(x,y,c)=Pixel(x*2,y*2,c);
|
newbm->Pixel(x,y,c)=Pixel(x*2,y*2,c);
|
||||||
}
|
}
|
||||||
return newbm;
|
}
|
||||||
|
return newbm;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector FloatBitMap_t::AverageColor(void)
|
Vector FloatBitMap_t::AverageColor(void)
|
||||||
@ -349,12 +354,15 @@ float FloatBitMap_t::BrightestColor(void)
|
|||||||
{
|
{
|
||||||
float ret=0.0;
|
float ret=0.0;
|
||||||
for(int y=0;y<Height;y++)
|
for(int y=0;y<Height;y++)
|
||||||
|
{
|
||||||
for(int x=0;x<Width;x++)
|
for(int x=0;x<Width;x++)
|
||||||
{
|
{
|
||||||
Vector v(Pixel(x,y,0),Pixel(x,y,1),Pixel(x,y,2));
|
Vector v(Pixel(x,y,0),Pixel(x,y,1),Pixel(x,y,2));
|
||||||
ret=max(ret,v.Length());
|
ret=max(ret,v.Length());
|
||||||
}
|
}
|
||||||
return ret;
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> static inline void SWAP(T & a, T & b)
|
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)
|
void FloatBitMap_t::Clear(float r, float g, float b, float alpha)
|
||||||
{
|
{
|
||||||
for(int y=0;y<Height;y++)
|
for(int y=0;y<Height;y++)
|
||||||
|
{
|
||||||
for(int x=0;x<Width;x++)
|
for(int x=0;x<Width;x++)
|
||||||
{
|
{
|
||||||
Pixel(x,y,0)=r;
|
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,2)=b;
|
||||||
Pixel(x,y,3)=alpha;
|
Pixel(x,y,3)=alpha;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatBitMap_t::ScaleRGB(float scale_factor)
|
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)
|
void FloatBitMap_t::SmartPaste(FloatBitMap_t const &b, int xofs, int yofs, uint32 Flags)
|
||||||
{
|
{
|
||||||
// now, need to make Difference map
|
// now, need to make Difference map
|
||||||
FloatBitMap_t DiffMap0(this);
|
FloatBitMap_t DiffMap0(this);
|
||||||
FloatBitMap_t DiffMap1(this);
|
FloatBitMap_t DiffMap1(this);
|
||||||
FloatBitMap_t DiffMap2(this);
|
FloatBitMap_t DiffMap2(this);
|
||||||
FloatBitMap_t DiffMap3(this);
|
FloatBitMap_t DiffMap3(this);
|
||||||
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3};
|
FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3};
|
||||||
for(int x=0;x<Width;x++)
|
for (int x = 0; x < Width; x++)
|
||||||
for(int y=0;y<Height;y++)
|
{
|
||||||
for(int c=0;c<3;c++)
|
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];
|
for (int i = 0; i < NDELTAS; i++)
|
||||||
int y1=y+dy[i];
|
{
|
||||||
x1=MAX(0,x1);
|
int x1 = x + dx[i];
|
||||||
x1=MIN(Width-1,x1);
|
int y1 = y + dy[i];
|
||||||
y1=MAX(0,y1);
|
x1 = MAX(0, x1);
|
||||||
y1=MIN(Height-1,y1);
|
x1 = MIN(Width - 1, x1);
|
||||||
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c);
|
y1 = MAX(0, y1);
|
||||||
deltas[i]->Pixel(x,y,c)=dx1;
|
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);
|
float dx1 = Pixel(x + xofs, y + yofs, c) - Pixel(x + dx[i] + xofs, y + dy[i] + yofs, c);
|
||||||
deltas[i]->Pixel(x+xofs,y+yofs,c)=diff;
|
if (fabs(dx1) > fabs(diff))
|
||||||
if (Flags & SPFLAGS_MAXGRADIENT)
|
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
|
// now, calculate modifiability
|
||||||
for(int x=0;x<Width;x++)
|
for (int x = 0; x < Width; x++)
|
||||||
for(int y=0;y<Height;y++)
|
{
|
||||||
{
|
for (int y = 0; y < Height; y++)
|
||||||
float modify=0;
|
{
|
||||||
if (
|
float modify = 0;
|
||||||
(x>xofs+1) && (x<=xofs+b.Width-2) &&
|
if ( (x > xofs + 1) && (x <= xofs + b.Width - 2) &&
|
||||||
(y>yofs+1) && (y<=yofs+b.Height-2))
|
(y > yofs + 1) && (y <= yofs + b.Height - 2))
|
||||||
modify=1;
|
modify = 1;
|
||||||
Alpha(x,y)=modify;
|
Alpha(x, y) = modify;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// // now, force a fex pixels in center to be constant
|
// // now, force a fex pixels in center to be constant
|
||||||
// int midx=xofs+b.Width/2;
|
// int midx=xofs+b.Width/2;
|
||||||
// int midy=yofs+b.Height/2;
|
// int midy=yofs+b.Height/2;
|
||||||
// for(x=midx-10;x<midx+10;x++)
|
// for(x=midx-10;x<midx+10;x++)
|
||||||
// for(int y=midy-10;y<midy+10;y++)
|
// for(int y=midy-10;y<midy+10;y++)
|
||||||
// {
|
// {
|
||||||
// Alpha(x,y)=0;
|
// Alpha(x,y)=0;
|
||||||
// for(int c=0;c<3;c++)
|
// for(int c=0;c < 3;c++)
|
||||||
// Pixel(x,y,c)=b.Pixel(x-xofs,y-yofs,c);
|
// Pixel(x,y,c)=b.Pixel(x-xofs,y-yofs,c);
|
||||||
// }
|
// }
|
||||||
Poisson(deltas,6000,Flags);
|
Poisson(deltas, 6000, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FloatBitMap_t::ScaleGradients(void)
|
void FloatBitMap_t::ScaleGradients(void)
|
||||||
@ -489,57 +508,57 @@ void FloatBitMap_t::ScaleGradients(void)
|
|||||||
FloatBitMap_t DiffMap1(this);
|
FloatBitMap_t DiffMap1(this);
|
||||||
FloatBitMap_t DiffMap2(this);
|
FloatBitMap_t DiffMap2(this);
|
||||||
FloatBitMap_t DiffMap3(this);
|
FloatBitMap_t DiffMap3(this);
|
||||||
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3};
|
FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3
|
||||||
double gsum=0.0;
|
};
|
||||||
for(int x=0;x<Width;x++)
|
double gsum = 0.0;
|
||||||
for(int y=0;y<Height;y++)
|
for (int x = 0; x < Width; x++)
|
||||||
for(int c=0;c<3;c++)
|
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 x1 = x + dx[i];
|
||||||
int y1=y+dy[i];
|
int y1 = y + dy[i];
|
||||||
x1=MAX(0,x1);
|
x1 = MAX(0, x1);
|
||||||
x1=MIN(Width-1,x1);
|
x1 = MIN(Width - 1, x1);
|
||||||
y1=MAX(0,y1);
|
y1 = MAX(0, y1);
|
||||||
y1=MIN(Height-1,y1);
|
y1 = MIN(Height - 1, y1);
|
||||||
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c);
|
float dx1 = Pixel(x, y, c) - Pixel(x1, y1, c);
|
||||||
deltas[i]->Pixel(x,y,c)=dx1;
|
deltas[i]->Pixel(x, y, c) = dx1;
|
||||||
gsum+=fabs(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
|
// now, calculate modifiability
|
||||||
for(int x=0;x<Width;x++)
|
for (int x = 0; x < Width; x++)
|
||||||
for(int y=0;y<Height;y++)
|
for (int y = 0; y < Height; y++)
|
||||||
{
|
{
|
||||||
float modify=0;
|
float modify = 0;
|
||||||
if (
|
if ( (x > 0) && (x < Width - 1) &&
|
||||||
(x>0) && (x<Width-1) &&
|
(y) && (y < Height - 1))
|
||||||
(y) && (y<Height-1))
|
{
|
||||||
{
|
modify = 1;
|
||||||
modify=1;
|
Alpha(x, y) = modify;
|
||||||
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
|
// set each pixel=avg-pixel
|
||||||
FloatBitMap_t *cursrc=&rslta;
|
FloatBitMap_t *cursrc=&rslta;
|
||||||
for(int x=1;x<Width-1;x++)
|
for(int x=1;x<Width-1;x++)
|
||||||
|
{
|
||||||
for(int y=1;y<Height-1;y++)
|
for(int y=1;y<Height-1;y++)
|
||||||
|
{
|
||||||
for(int c=0;c<3;c++)
|
for(int c=0;c<3;c++)
|
||||||
{
|
{
|
||||||
DiffMapX.Pixel(x,y,c)=Pixel(x,y,c)-Pixel(x+1,y,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;
|
float error=0.0;
|
||||||
for(int x=1;x<Width-1;x++)
|
for(int x=1;x<Width-1;x++)
|
||||||
|
{
|
||||||
for(int y=1;y<Height-1;y++)
|
for(int y=1;y<Height-1;y++)
|
||||||
|
{
|
||||||
for(int c=0;c<3;c++)
|
for(int c=0;c<3;c++)
|
||||||
{
|
{
|
||||||
float desiredx=DiffMapX.Pixel(x,y,c)+cursrc->Pixel(x+1,y,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));
|
error+=SQ(desired-cursrc->Pixel(x,y,c));
|
||||||
}
|
}
|
||||||
SWAP(cursrc,curdst);
|
SWAP(cursrc,curdst);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// paste result
|
// paste result
|
||||||
for(int x=0;x<Width;x++)
|
for(int x=0;x<Width;x++)
|
||||||
for(int y=0;y<Height;y++)
|
for(int y=0;y<Height;y++)
|
||||||
for(int c=0;c<3;c++)
|
for(int c=0;c<3;c++)
|
||||||
Pixel(x,y,c)=curdst->Pixel(x,y,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++)
|
for(y=0;y<Height;y++)
|
||||||
if (Alpha(minx,y))
|
if (Alpha(minx,y))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (y!=Height)
|
if (y!=Height)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(maxx=Width-1;maxx>=0;maxx--)
|
for(maxx=Width-1;maxx>=0;maxx--)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
for(y=0;y<Height;y++)
|
for(y=0;y<Height;y++)
|
||||||
if (Alpha(maxx,y))
|
if (Alpha(maxx,y))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (y!=Height)
|
if (y!=Height)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -631,6 +661,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
|
|||||||
for(x=minx;x<=maxx;x++)
|
for(x=minx;x<=maxx;x++)
|
||||||
if (Alpha(x,miny))
|
if (Alpha(x,miny))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (x<maxx)
|
if (x<maxx)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -640,6 +671,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
|
|||||||
for(x=minx;x<=maxx;x++)
|
for(x=minx;x<=maxx;x++)
|
||||||
if (Alpha(x,maxy))
|
if (Alpha(x,maxy))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (x<maxx)
|
if (x<maxx)
|
||||||
break;
|
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],
|
void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
|
||||||
int n_iters,
|
int n_iters,
|
||||||
uint32 flags // SPF_xxx
|
uint32 flags // SPF_xxx
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int minx,miny,maxx,maxy;
|
int minx,miny,maxx,maxy;
|
||||||
@ -666,9 +698,13 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
|
|||||||
tmp->Poisson(lowdeltas,n_iters*4,flags);
|
tmp->Poisson(lowdeltas,n_iters*4,flags);
|
||||||
// now, propagate results from tmp to us
|
// now, propagate results from tmp to us
|
||||||
for(int x=0;x<tmp->Width;x++)
|
for(int x=0;x<tmp->Width;x++)
|
||||||
|
{
|
||||||
for(int y=0;y<tmp->Height;y++)
|
for(int y=0;y<tmp->Height;y++)
|
||||||
|
{
|
||||||
for(int xi=0;xi<2;xi++)
|
for(int xi=0;xi<2;xi++)
|
||||||
|
{
|
||||||
for(int yi=0;yi<2;yi++)
|
for(int yi=0;yi<2;yi++)
|
||||||
|
{
|
||||||
if (Alpha(x*2+xi,y*2+yi))
|
if (Alpha(x*2+xi,y*2+yi))
|
||||||
{
|
{
|
||||||
for(int c=0;c<3;c++)
|
for(int c=0;c<3;c++)
|
||||||
@ -683,6 +719,10 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
|
|||||||
delete tmp;
|
delete tmp;
|
||||||
for(int i=0;i<NDELTAS;i++)
|
for(int i=0;i<NDELTAS;i++)
|
||||||
delete lowdeltas[i];
|
delete lowdeltas[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FloatBitMap_t work1(this);
|
FloatBitMap_t work1(this);
|
||||||
FloatBitMap_t work2(this);
|
FloatBitMap_t work2(this);
|
||||||
@ -704,7 +744,7 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
|
|||||||
for(int i=0;i<NDELTAS;i++)
|
for(int i=0;i<NDELTAS;i++)
|
||||||
desired+=deltas[i]->Pixel(x,y,c)+cursrc->Pixel(x+dx[i],y+dy[i],c);
|
desired+=deltas[i]->Pixel(x,y,c)+cursrc->Pixel(x+dx[i],y+dy[i],c);
|
||||||
desired*=(1.0/NDELTAS);
|
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);
|
curdst->Pixel(x,y,c)=FLerp(cursrc->Pixel(x,y,c),desired,0.5);
|
||||||
error+=SQ(desired-cursrc->Pixel(x,y,c));
|
error+=SQ(desired-cursrc->Pixel(x,y,c));
|
||||||
}
|
}
|
||||||
|
@ -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;
|
SSBumpCalculationContext *ctx = ( SSBumpCalculationContext * ) ctx1;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ struct TBFCalculationContext
|
|||||||
FloatBitMap_t *dest_bm;
|
FloatBitMap_t *dest_bm;
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned TBFCalculationThreadFN( void *ctx1 )
|
static uintp TBFCalculationThreadFN( void *ctx1 )
|
||||||
{
|
{
|
||||||
TBFCalculationContext *ctx = (TBFCalculationContext *) ctx1;
|
TBFCalculationContext *ctx = (TBFCalculationContext *) ctx1;
|
||||||
for(int y=ctx->min_y; y <= ctx->max_y; y++)
|
for(int y=ctx->min_y; y <= ctx->max_y; y++)
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "bitmap/imageformat.h"
|
#include "bitmap/imageformat.h"
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include "nvtc.h"
|
#include "nvtc.h"
|
||||||
#include "mathlib/mathlib.h"
|
#include "mathlib/mathlib.h"
|
||||||
@ -312,12 +311,17 @@ ImageFormat D3DFormatToImageFormat( D3DFORMAT format )
|
|||||||
|
|
||||||
switch ( format )
|
switch ( format )
|
||||||
{
|
{
|
||||||
#if !defined( _X360 )
|
#ifdef TOGLES
|
||||||
|
case D3DFMT_R8G8B8:
|
||||||
|
return IMAGE_FORMAT_RGB888;
|
||||||
|
case D3DFMT_A8R8G8B8:
|
||||||
|
return IMAGE_FORMAT_RGBA8888;
|
||||||
|
#else
|
||||||
case D3DFMT_R8G8B8:
|
case D3DFMT_R8G8B8:
|
||||||
return IMAGE_FORMAT_BGR888;
|
return IMAGE_FORMAT_BGR888;
|
||||||
#endif
|
|
||||||
case D3DFMT_A8R8G8B8:
|
case D3DFMT_A8R8G8B8:
|
||||||
return IMAGE_FORMAT_BGRA8888;
|
return IMAGE_FORMAT_BGRA8888;
|
||||||
|
#endif
|
||||||
case D3DFMT_X8R8G8B8:
|
case D3DFMT_X8R8G8B8:
|
||||||
return IMAGE_FORMAT_BGRX8888;
|
return IMAGE_FORMAT_BGRX8888;
|
||||||
case D3DFMT_R5G6B5:
|
case D3DFMT_R5G6B5:
|
||||||
@ -426,6 +430,10 @@ D3DFORMAT ImageFormatToD3DFormat( ImageFormat format )
|
|||||||
#endif
|
#endif
|
||||||
case IMAGE_FORMAT_BGRA8888:
|
case IMAGE_FORMAT_BGRA8888:
|
||||||
return D3DFMT_A8R8G8B8;
|
return D3DFMT_A8R8G8B8;
|
||||||
|
case IMAGE_FORMAT_RGB888:
|
||||||
|
return D3DFMT_R8G8B8;
|
||||||
|
case IMAGE_FORMAT_RGBA8888:
|
||||||
|
return D3DFMT_A8R8G8B8;
|
||||||
case IMAGE_FORMAT_BGRX8888:
|
case IMAGE_FORMAT_BGRX8888:
|
||||||
return D3DFMT_X8R8G8B8;
|
return D3DFMT_X8R8G8B8;
|
||||||
case IMAGE_FORMAT_BGR565:
|
case IMAGE_FORMAT_BGR565:
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "bitmap/imageformat.h"
|
#include "bitmap/imageformat.h"
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include "mathlib/mathlib.h"
|
#include "mathlib/mathlib.h"
|
||||||
#include "mathlib/vector.h"
|
#include "mathlib/vector.h"
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "tier0/dbg.h"
|
#include "tier0/dbg.h"
|
||||||
#include <malloc.h>
|
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "bitmap/tgawriter.h"
|
#include "bitmap/tgawriter.h"
|
||||||
#include "tier1/utlbuffer.h"
|
#include "tier1/utlbuffer.h"
|
||||||
|
5
build.sh
5
build.sh
@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# example: ./build.sh everything togl
|
|
||||||
|
|
||||||
make MAKE_VERBOSE=1 NO_CHROOT=1 -f $1.mak $2 -j$(nproc --all)
|
|
@ -33,7 +33,7 @@ public:
|
|||||||
// return true if the console has focus
|
// return true if the console has focus
|
||||||
virtual bool IsConsoleVisible() = 0;
|
virtual bool IsConsoleVisible() = 0;
|
||||||
|
|
||||||
virtual void SetParent( int parent ) = 0;
|
virtual void SetParent( intp parent ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GAMECONSOLE_INTERFACE_VERSION "GameConsole004"
|
#define GAMECONSOLE_INTERFACE_VERSION "GameConsole004"
|
||||||
|
@ -6,7 +6,11 @@
|
|||||||
//
|
//
|
||||||
//=============================================================================//
|
//=============================================================================//
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef OSX
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#include "ObjectList.h"
|
#include "ObjectList.h"
|
||||||
#include "tier1/strtools.h"
|
#include "tier1/strtools.h"
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "tier1/convar.h"
|
#include "tier1/convar.h"
|
||||||
#include "cdll_int.h"
|
#include "cdll_int.h"
|
||||||
|
#include "vcrmode.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#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" );
|
g_pFullFileSystem->FPrintf( fp, "//\r\n//\r\n// Cvar\t-\tSetting\r\n\r\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -32,7 +32,7 @@ struct RequestContext_t;
|
|||||||
class IDownloadSystem : public IBaseInterface
|
class IDownloadSystem : public IBaseInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual DWORD CreateDownloadThread( RequestContext_t *pContext ) = 0;
|
virtual uintp CreateDownloadThread( RequestContext_t *pContext ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#elif defined(OSX)
|
||||||
|
#include <stdint.h>
|
||||||
#else
|
#else
|
||||||
#include <bits/wordsize.h>
|
#include <bits/wordsize.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,8 +55,7 @@ typedef struct __iconv_t* iconv_t;
|
|||||||
* Available since API level 28.
|
* Available since API level 28.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if __ANDROID_API__ >= 28
|
iconv_t iconv_open(const char* __src_encoding, const char* __dst_encoding);
|
||||||
iconv_t iconv_open(const char* __src_encoding, const char* __dst_encoding) __INTRODUCED_IN(28);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [iconv(3)](http://man7.org/linux/man-pages/man3/iconv.3.html) converts characters from one
|
* [iconv(3)](http://man7.org/linux/man-pages/man3/iconv.3.html) converts characters from one
|
||||||
@ -70,7 +69,7 @@ iconv_t iconv_open(const char* __src_encoding, const char* __dst_encoding) __INT
|
|||||||
*
|
*
|
||||||
* Available since API level 28.
|
* Available since API level 28.
|
||||||
*/
|
*/
|
||||||
size_t iconv(iconv_t __converter, char** __src_buf, size_t* __src_bytes_left, char** __dst_buf, size_t* __dst_bytes_left) __INTRODUCED_IN(28);
|
size_t iconv(iconv_t __converter, char** __src_buf, size_t* __src_bytes_left, char** __dst_buf, size_t* __dst_bytes_left);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [iconv_close(3)](http://man7.org/linux/man-pages/man3/iconv_close.3.html) deallocates a converter
|
* [iconv_close(3)](http://man7.org/linux/man-pages/man3/iconv_close.3.html) deallocates a converter
|
||||||
@ -80,8 +79,6 @@ size_t iconv(iconv_t __converter, char** __src_buf, size_t* __src_bytes_left, ch
|
|||||||
*
|
*
|
||||||
* Available since API level 28.
|
* Available since API level 28.
|
||||||
*/
|
*/
|
||||||
int iconv_close(iconv_t __converter) __INTRODUCED_IN(28);
|
int iconv_close(iconv_t __converter);
|
||||||
#endif /* __ANDROID_API__ >= 28 */
|
|
||||||
|
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@ -22,7 +22,7 @@ extern "C" {
|
|||||||
#define ALC_APIENTRY
|
#define ALC_APIENTRY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TARGET_OS_MAC
|
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||||
#pragma export on
|
#pragma export on
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, A
|
|||||||
|
|
||||||
#endif /* ALC_NO_PROTOTYPES */
|
#endif /* ALC_NO_PROTOTYPES */
|
||||||
|
|
||||||
#if TARGET_OS_MAC
|
#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
|
||||||
#pragma export off
|
#pragma export off
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
13043
common/sse2neon.h
13043
common/sse2neon.h
File diff suppressed because it is too large
Load Diff
@ -16,10 +16,10 @@
|
|||||||
#undef ALIGN4
|
#undef ALIGN4
|
||||||
#undef ALIGN16
|
#undef ALIGN16
|
||||||
#undef ALIGN32
|
#undef ALIGN32
|
||||||
#define ALIGN4( a ) a = (byte *)((int)((byte *)a + 3) & ~ 3)
|
#define ALIGN4( a ) a = (byte *)((intp)((byte *)a + 3) & ~ 3)
|
||||||
#define ALIGN16( a ) a = (byte *)((int)((byte *)a + 15) & ~ 15)
|
#define ALIGN16( a ) a = (byte *)((intp)((byte *)a + 15) & ~ 15)
|
||||||
#define ALIGN32( a ) a = (byte *)((int)((byte *)a + 31) & ~ 31)
|
#define ALIGN32( a ) a = (byte *)((intp)((byte *)a + 31) & ~ 31)
|
||||||
#define ALIGN64( a ) a = (byte *)((int)((byte *)a + 63) & ~ 63)
|
#define ALIGN64( a ) a = (byte *)((intp)((byte *)a + 63) & ~ 63)
|
||||||
|
|
||||||
// Fixup macros create variables that may not be referenced
|
// Fixup macros create variables that may not be referenced
|
||||||
#pragma warning( push )
|
#pragma warning( push )
|
||||||
@ -1228,8 +1228,8 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
|
|||||||
V_memcpy( pNewDest, pDestBase, pAnimBlock->datastart );
|
V_memcpy( pNewDest, pDestBase, pAnimBlock->datastart );
|
||||||
pNewDest += pAnimBlock->datastart;
|
pNewDest += pAnimBlock->datastart;
|
||||||
|
|
||||||
int padding = AlignValue( (unsigned int)pNewDest - (unsigned int)pNewDestBase, 2048 );
|
int padding = AlignValue( (uintp)pNewDest - (uintp)pNewDestBase, 2048 );
|
||||||
padding -= (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
padding -= (uintp)pNewDest - (uintp)pNewDestBase;
|
||||||
pNewDest += padding;
|
pNewDest += padding;
|
||||||
|
|
||||||
// iterate and compress anim blocks
|
// 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;
|
void *pInput = (byte *)pDestBase + pAnimBlock->datastart;
|
||||||
int inputSize = pAnimBlock->dataend - pAnimBlock->datastart;
|
int inputSize = pAnimBlock->dataend - pAnimBlock->datastart;
|
||||||
|
|
||||||
pAnimBlock->datastart = (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
pAnimBlock->datastart = (uintp)pNewDest - (uintp)pNewDestBase;
|
||||||
|
|
||||||
void *pOutput;
|
void *pOutput;
|
||||||
int outputSize;
|
int outputSize;
|
||||||
@ -1257,11 +1257,11 @@ int ByteswapANI( studiohdr_t* pHdr, void *pDestBase, const void *pSrcBase, const
|
|||||||
pNewDest += inputSize;
|
pNewDest += inputSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
padding = AlignValue( (unsigned int)pNewDest - (unsigned int)pNewDestBase, 2048 );
|
padding = AlignValue( (uintp)pNewDest - (uintp)pNewDestBase, 2048 );
|
||||||
padding -= (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
padding -= (uintp)pNewDest - (uintp)pNewDestBase;
|
||||||
pNewDest += padding;
|
pNewDest += padding;
|
||||||
|
|
||||||
pAnimBlock->dataend = (unsigned int)pNewDest - (unsigned int)pNewDestBase;
|
pAnimBlock->dataend = (uintp)pNewDest - (uintp)pNewDestBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedFileSize = pNewDest - pNewDestBase;
|
fixedFileSize = pNewDest - pNewDestBase;
|
||||||
@ -2522,14 +2522,14 @@ BEGIN_BYTESWAP_DATADESC( studiohdr_t )
|
|||||||
DEFINE_FIELD( contents, FIELD_INTEGER ),
|
DEFINE_FIELD( contents, FIELD_INTEGER ),
|
||||||
DEFINE_FIELD( numincludemodels, FIELD_INTEGER ),
|
DEFINE_FIELD( numincludemodels, FIELD_INTEGER ),
|
||||||
DEFINE_INDEX( includemodelindex, 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_INDEX( szanimblocknameindex, FIELD_INTEGER ),
|
||||||
DEFINE_FIELD( numanimblocks, FIELD_INTEGER ),
|
DEFINE_FIELD( numanimblocks, FIELD_INTEGER ),
|
||||||
DEFINE_INDEX( animblockindex, 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_INDEX( bonetablebynameindex, FIELD_INTEGER ),
|
||||||
DEFINE_FIELD( pVertexBase, FIELD_INTEGER ), // void*
|
DEFINE_FIELD( unused_pVertexBase, FIELD_INTEGER ), // void*
|
||||||
DEFINE_FIELD( pIndexBase, FIELD_INTEGER ), // void*
|
DEFINE_FIELD( unused_pIndexBase, FIELD_INTEGER ), // void*
|
||||||
DEFINE_FIELD( constdirectionallightdot, FIELD_CHARACTER ), // byte
|
DEFINE_FIELD( constdirectionallightdot, FIELD_CHARACTER ), // byte
|
||||||
DEFINE_FIELD( rootLOD, FIELD_CHARACTER ), // byte
|
DEFINE_FIELD( rootLOD, FIELD_CHARACTER ), // byte
|
||||||
DEFINE_FIELD( numAllowedRootLODs, FIELD_CHARACTER ), // byte
|
DEFINE_FIELD( numAllowedRootLODs, FIELD_CHARACTER ), // byte
|
||||||
@ -2985,7 +2985,11 @@ BEGIN_BYTESWAP_DATADESC( mstudiomesh_t )
|
|||||||
END_BYTESWAP_DATADESC()
|
END_BYTESWAP_DATADESC()
|
||||||
|
|
||||||
BEGIN_BYTESWAP_DATADESC( mstudio_meshvertexdata_t )
|
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*
|
DEFINE_FIELD( modelvertexdata, FIELD_INTEGER ), // mstudio_modelvertexdata_t*
|
||||||
|
#endif
|
||||||
DEFINE_ARRAY( numLODVertexes, FIELD_INTEGER, MAX_NUM_LODS ),
|
DEFINE_ARRAY( numLODVertexes, FIELD_INTEGER, MAX_NUM_LODS ),
|
||||||
END_BYTESWAP_DATADESC()
|
END_BYTESWAP_DATADESC()
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "vguifont.h"
|
#include "vguifont.h"
|
||||||
|
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(OSX)
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
typedef void *(*FontDataHelper)( const char *pchFontName, int &size, const char *fontFileName );
|
typedef void *(*FontDataHelper)( const char *pchFontName, int &size, const char *fontFileName );
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
IFileSystem *FileSystem() { return m_pFileSystem; }
|
IFileSystem *FileSystem() { return m_pFileSystem; }
|
||||||
IMaterialSystem *MaterialSystem() { return m_pMaterialSystem; }
|
IMaterialSystem *MaterialSystem() { return m_pMaterialSystem; }
|
||||||
|
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(OSX)
|
||||||
FT_Library GetFontLibraryHandle() { return library; }
|
FT_Library GetFontLibraryHandle() { return library; }
|
||||||
void SetFontDataHelper( FontDataHelper helper ) { m_pFontDataHelper = helper; }
|
void SetFontDataHelper( FontDataHelper helper ) { m_pFontDataHelper = helper; }
|
||||||
#endif
|
#endif
|
||||||
@ -96,7 +96,7 @@ private:
|
|||||||
CUtlVector<CFontAmalgam> m_FontAmalgams;
|
CUtlVector<CFontAmalgam> m_FontAmalgams;
|
||||||
CUtlVector<font_t *> m_Win32Fonts;
|
CUtlVector<font_t *> m_Win32Fonts;
|
||||||
|
|
||||||
#ifdef LINUX
|
#if defined(LINUX) || defined(OSX)
|
||||||
FT_Library library;
|
FT_Library library;
|
||||||
FontDataHelper m_pFontDataHelper;
|
FontDataHelper m_pFontDataHelper;
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,10 +23,7 @@ struct newChar_t
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include "Win32Font.h"
|
#include "Win32Font.h"
|
||||||
typedef CWin32Font font_t;
|
typedef CWin32Font font_t;
|
||||||
#elif defined(OSX)
|
#elif defined(LINUX) || defined(OSX)
|
||||||
#include "osxfont.h"
|
|
||||||
typedef COSXFont font_t;
|
|
||||||
#elif defined(LINUX)
|
|
||||||
#include "linuxfont.h"
|
#include "linuxfont.h"
|
||||||
typedef CLinuxFont font_t;
|
typedef CLinuxFont font_t;
|
||||||
#else
|
#else
|
||||||
|
@ -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
|
#define DC_MAX_THREADS_FRAMELOCKED 4
|
||||||
|
|
||||||
struct DataCacheItem_t : DataCacheItemData_t
|
struct DataCacheItem_t : DataCacheItemData_t
|
||||||
|
@ -126,7 +126,7 @@ struct studiodata_t
|
|||||||
// array of cache handles to demand loaded virtual model data
|
// array of cache handles to demand loaded virtual model data
|
||||||
int m_nAnimBlockCount;
|
int m_nAnimBlockCount;
|
||||||
DataCacheHandle_t *m_pAnimBlock;
|
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)
|
// vertex data is usually compressed to save memory (model decal code only needs some data)
|
||||||
DataCacheHandle_t m_VertexCache;
|
DataCacheHandle_t m_VertexCache;
|
||||||
@ -235,11 +235,11 @@ struct AsyncInfo_t
|
|||||||
int iAnimBlock;
|
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;
|
CThreadFastMutex g_AsyncInfoMapMutex;
|
||||||
|
|
||||||
inline int MakeAsyncInfoKey( MDLHandle_t hModel, MDLCacheDataType_t type, int iAnimBlock )
|
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 );
|
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 );
|
AUTO_LOCK( g_AsyncInfoMapMutex );
|
||||||
int key = MakeAsyncInfoKey( hModel, type, iAnimBlock );
|
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];
|
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 );
|
AUTO_LOCK( g_AsyncInfoMapMutex );
|
||||||
Assert( index == NO_ASYNC || GetAsyncInfoIndex( hModel, type, iAnimBlock ) == NO_ASYNC );
|
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;
|
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 );
|
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 );
|
bool BuildHardwareData( MDLHandle_t handle, studiodata_t *pStudioData, studiohdr_t *pStudioHdr, OptimizedModel::FileHeader_t *pVtxHdr );
|
||||||
void ConvertFlexData( studiohdr_t *pStudioHdr );
|
void ConvertFlexData( studiohdr_t *pStudioHdr );
|
||||||
|
|
||||||
int ProcessPendingAsync( int iAsync );
|
int ProcessPendingAsync( intp iAsync );
|
||||||
void ProcessPendingAsyncs( MDLCacheDataType_t type = MDLCACHE_NONE );
|
void ProcessPendingAsyncs( MDLCacheDataType_t type = MDLCACHE_NONE );
|
||||||
bool ClearAsync( MDLHandle_t handle, MDLCacheDataType_t type, int iAnimBlock, bool bAbort = false );
|
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 );
|
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
|
// 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
|
// 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 );
|
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 )
|
const char *CMDLCache::GetModelName( MDLHandle_t handle )
|
||||||
{
|
{
|
||||||
if ( handle == MDLHANDLE_INVALID )
|
if ( handle == MDLHANDLE_INVALID )
|
||||||
return ERROR_MODEL;
|
return ERROR_MODEL;
|
||||||
|
|
||||||
return m_MDLDict.GetElementName( handle );
|
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_strncpy( pszFileName, GetActualModelName( handle ), nMaxLength );
|
||||||
Q_SetExtension( pszFileName, pszExtension, nMaxLength );
|
Q_SetExtension( pszFileName, pszExtension, nMaxLength );
|
||||||
Q_FixSlashes( pszFileName );
|
Q_FixSlashes( pszFileName );
|
||||||
#ifdef _LINUX
|
#ifdef POSIX
|
||||||
Q_strlower( pszFileName );
|
Q_strlower( pszFileName );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1004,7 +1004,7 @@ void CMDLCache::UnserializeVCollide( MDLHandle_t handle, bool synchronousLoad )
|
|||||||
// FIXME: Should the vcollde be played into cacheable memory?
|
// FIXME: Should the vcollde be played into cacheable memory?
|
||||||
studiodata_t *pStudioData = m_MDLDict[handle];
|
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||||
|
|
||||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VCOLLIDE );
|
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VCOLLIDE );
|
||||||
|
|
||||||
if ( iAsync == NO_ASYNC )
|
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++ )
|
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];
|
studiodata_t *pData = m_MDLDict[sharedHandle];
|
||||||
if ( !(pData->m_nFlags & STUDIODATA_FLAGS_VCOLLISION_LOADED) )
|
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 );
|
memset( pStudioData->m_pAnimBlock, 0, sizeof(DataCacheHandle_t) * pStudioData->m_nAnimBlockCount );
|
||||||
|
|
||||||
pStudioData->m_iFakeAnimBlockStall = new unsigned long [pStudioData->m_nAnimBlockCount];
|
pStudioData->m_iFakeAnimBlockStall = new unsigned int [pStudioData->m_nAnimBlockCount];
|
||||||
memset( pStudioData->m_iFakeAnimBlockStall, 0, sizeof( unsigned long ) * pStudioData->m_nAnimBlockCount );
|
memset( pStudioData->m_iFakeAnimBlockStall, 0, sizeof( unsigned int ) * pStudioData->m_nAnimBlockCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMDLCache::FreeAnimBlocks( MDLHandle_t handle )
|
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];
|
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||||
|
|
||||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_ANIMBLOCK, nBlock );
|
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_ANIMBLOCK, nBlock );
|
||||||
|
|
||||||
if ( iAsync == NO_ASYNC )
|
if ( iAsync == NO_ASYNC )
|
||||||
{
|
{
|
||||||
@ -1238,7 +1238,7 @@ unsigned char *CMDLCache::UnserializeAnimBlock( MDLHandle_t handle, int nBlock )
|
|||||||
char pFileName[MAX_PATH];
|
char pFileName[MAX_PATH];
|
||||||
Q_strncpy( pFileName, pModelName, sizeof(pFileName) );
|
Q_strncpy( pFileName, pModelName, sizeof(pFileName) );
|
||||||
Q_FixSlashes( pFileName );
|
Q_FixSlashes( pFileName );
|
||||||
#ifdef _LINUX
|
#ifdef POSIX
|
||||||
Q_strlower( pFileName );
|
Q_strlower( pFileName );
|
||||||
#endif
|
#endif
|
||||||
if ( IsX360() )
|
if ( IsX360() )
|
||||||
@ -1398,12 +1398,12 @@ void CMDLCache::FreeVirtualModel( MDLHandle_t handle )
|
|||||||
if ( pStudioData && pStudioData->m_pVirtualModel )
|
if ( pStudioData && pStudioData->m_pVirtualModel )
|
||||||
{
|
{
|
||||||
int nGroupCount = pStudioData->m_pVirtualModel->m_group.Count();
|
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
|
// NOTE: Start at *1* here because the 0th element contains a reference to *this* handle
|
||||||
for ( int i = 1; i < nGroupCount; ++i )
|
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 );
|
FreeVirtualModel( h );
|
||||||
Release( 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
|
// Group has to be zero to ensure refcounting is correct
|
||||||
int nGroup = pStudioData->m_pVirtualModel->m_group.AddToTail( );
|
int nGroup = pStudioData->m_pVirtualModel->m_group.AddToTail( );
|
||||||
Assert( nGroup == 0 );
|
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
|
// Add all dependent data
|
||||||
pStudioData->m_pVirtualModel->AppendModels( 0, pStudioHdr );
|
pStudioData->m_pVirtualModel->AppendModels( 0, pStudioHdr );
|
||||||
@ -1550,7 +1550,7 @@ bool CMDLCache::LoadHardwareData( MDLHandle_t handle )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_STUDIOHWDATA );
|
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_STUDIOHWDATA );
|
||||||
|
|
||||||
if ( iAsync == NO_ASYNC )
|
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
|
// 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;
|
bool bOk = false;
|
||||||
|
|
||||||
@ -1925,6 +1925,32 @@ bool CMDLCache::ReadFileNative( char *pFileName, const char *pPath, CUtlBuffer &
|
|||||||
{
|
{
|
||||||
// Read the PC version
|
// Read the PC version
|
||||||
bOk = g_pFullFileSystem->ReadFile( pFileName, pPath, buf, nMaxBytes );
|
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;
|
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
|
// critical! store a back link to our data
|
||||||
// this is fetched when re-establishing dependent cached data (vtx/vvd)
|
// 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 ) );
|
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 ];
|
char pFileName[ MAX_PATH ];
|
||||||
Q_strncpy( pFileName, pMDLFileName, sizeof( pFileName ) );
|
Q_strncpy( pFileName, pMDLFileName, sizeof( pFileName ) );
|
||||||
Q_FixSlashes( pFileName );
|
Q_FixSlashes( pFileName );
|
||||||
#ifdef _LINUX
|
#ifdef POSIX
|
||||||
Q_strlower( pFileName );
|
Q_strlower( pFileName );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2030,7 +2056,7 @@ bool CMDLCache::ReadMDLFile( MDLHandle_t handle, const char *pMDLFileName, CUtlB
|
|||||||
|
|
||||||
MEM_ALLOC_CREDIT();
|
MEM_ALLOC_CREDIT();
|
||||||
|
|
||||||
bool bOk = ReadFileNative( pFileName, "GAME", buf );
|
bool bOk = ReadFileNative( pFileName, "GAME", buf, 0, MDLCACHE_STUDIOHDR );
|
||||||
if ( !bOk )
|
if ( !bOk )
|
||||||
{
|
{
|
||||||
DevWarning( "Failed to load %s!\n", pMDLFileName );
|
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();
|
studiohdr_t *pStudioHdr = (studiohdr_t*)buf.PeekGet();
|
||||||
if ( !pStudioHdr )
|
if ( !pStudioHdr )
|
||||||
{
|
{
|
||||||
@ -2073,7 +2105,7 @@ bool CMDLCache::ReadMDLFile( MDLHandle_t handle, const char *pMDLFileName, CUtlB
|
|||||||
|
|
||||||
// critical! store a back link to our data
|
// critical! store a back link to our data
|
||||||
// this is fetched when re-establishing dependent cached data (vtx/vvd)
|
// 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
|
// Make sure all dependent files are valid
|
||||||
if ( !VerifyHeaders( pStudioHdr ) )
|
if ( !VerifyHeaders( pStudioHdr ) )
|
||||||
@ -2138,6 +2170,11 @@ studiohdr_t *CMDLCache::GetStudioHdr( MDLHandle_t handle )
|
|||||||
// Assert( m_pModelCacheSection->IsFrameLocking() );
|
// Assert( m_pModelCacheSection->IsFrameLocking() );
|
||||||
// Assert( m_pMeshCacheSection->IsFrameLocking() );
|
// Assert( m_pMeshCacheSection->IsFrameLocking() );
|
||||||
|
|
||||||
|
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||||
|
|
||||||
|
if( !pStudioData )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
VPROF_INCREMENT_COUNTER( "GetStudioHdr", 1 );
|
VPROF_INCREMENT_COUNTER( "GetStudioHdr", 1 );
|
||||||
#endif
|
#endif
|
||||||
@ -2236,7 +2273,7 @@ void CMDLCache::TouchAllData( MDLHandle_t handle )
|
|||||||
// ensure all sub models are cached
|
// ensure all sub models are cached
|
||||||
for ( int i=1; i<pVModel->m_group.Count(); ++i )
|
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 )
|
if ( childHandle != MDLHANDLE_INVALID )
|
||||||
{
|
{
|
||||||
// FIXME: Should this be calling TouchAllData on the child?
|
// FIXME: Should this be calling TouchAllData on the child?
|
||||||
@ -2301,7 +2338,7 @@ bool CMDLCache::HandleCacheNotification( const DataCacheNotification_t ¬ifica
|
|||||||
{
|
{
|
||||||
MdlCacheMsg( "MDLCache: Data cache discard %s %s\n", g_ppszTypes[TypeFromCacheID( notification.clientId )], GetModelName( HandleFromCacheID( notification.clientId ) ) );
|
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 )
|
TypeFromCacheID(notification.clientId) != MDLCACHE_STUDIOHWDATA )
|
||||||
{
|
{
|
||||||
Assert( notification.pItemData );
|
Assert( notification.pItemData );
|
||||||
@ -2320,7 +2357,7 @@ bool CMDLCache::HandleCacheNotification( const DataCacheNotification_t ¬ifica
|
|||||||
|
|
||||||
bool CMDLCache::GetItemName( DataCacheClientID_t clientId, const void *pItem, char *pDest, unsigned nMaxLen )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2426,7 +2463,7 @@ void CMDLCache::FinishPendingLoads()
|
|||||||
AUTO_LOCK( m_AsyncMutex );
|
AUTO_LOCK( m_AsyncMutex );
|
||||||
|
|
||||||
// finish just our known jobs
|
// finish just our known jobs
|
||||||
int iAsync = m_PendingAsyncs.Head();
|
intp iAsync = m_PendingAsyncs.Head();
|
||||||
while ( iAsync != m_PendingAsyncs.InvalidIndex() )
|
while ( iAsync != m_PendingAsyncs.InvalidIndex() )
|
||||||
{
|
{
|
||||||
AsyncInfo_t &info = m_PendingAsyncs[iAsync];
|
AsyncInfo_t &info = m_PendingAsyncs[iAsync];
|
||||||
@ -2581,7 +2618,7 @@ bool CMDLCache::VerifyHeaders( studiohdr_t *pStudioHdr )
|
|||||||
}
|
}
|
||||||
|
|
||||||
char pFileName[ MAX_PATH ];
|
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) );
|
MakeFilename( handle, ".vvd", pFileName, sizeof(pFileName) );
|
||||||
|
|
||||||
@ -2642,7 +2679,7 @@ vertexFileHeader_t *CMDLCache::CacheVertexData( studiohdr_t *pStudioHdr )
|
|||||||
|
|
||||||
Assert( pStudioHdr );
|
Assert( pStudioHdr );
|
||||||
|
|
||||||
handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||||
Assert( handle != MDLHANDLE_INVALID );
|
Assert( handle != MDLHANDLE_INVALID );
|
||||||
|
|
||||||
pVvdHdr = (vertexFileHeader_t *)CheckData( m_MDLDict[handle]->m_VertexCache, MDLCACHE_VERTEXES );
|
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: pending
|
||||||
// >0: completed
|
// >0: completed
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int CMDLCache::ProcessPendingAsync( int iAsync )
|
int CMDLCache::ProcessPendingAsync( intp iAsync )
|
||||||
{
|
{
|
||||||
if ( !ThreadInMainThread() )
|
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
|
// 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
|
// 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)
|
// 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() )
|
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 )
|
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 )
|
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 )
|
if ( iAsyncInfo != NO_ASYNC )
|
||||||
{
|
{
|
||||||
AsyncInfo_t *pInfo;
|
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 )
|
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;
|
vertexFileHeader_t *pVvdHdr;
|
||||||
|
|
||||||
MdlCacheMsg( "MDLCache: Load VVD for %s\n", pStudioHdr->pszName() );
|
MdlCacheMsg( "MDLCache: Load VVD for %s\n", pStudioHdr->pszName() );
|
||||||
@ -3330,7 +3367,7 @@ vertexFileHeader_t *CMDLCache::LoadVertexData( studiohdr_t *pStudioHdr )
|
|||||||
MDLHandle_t handle;
|
MDLHandle_t handle;
|
||||||
|
|
||||||
Assert( pStudioHdr );
|
Assert( pStudioHdr );
|
||||||
handle = (MDLHandle_t)(int)pStudioHdr->virtualModel&0xffff;
|
handle = VoidPtrToMDLHandle( pStudioHdr->VirtualModel() );
|
||||||
Assert( !m_MDLDict[handle]->m_VertexCache );
|
Assert( !m_MDLDict[handle]->m_VertexCache );
|
||||||
|
|
||||||
studiodata_t *pStudioData = m_MDLDict[handle];
|
studiodata_t *pStudioData = m_MDLDict[handle];
|
||||||
@ -3340,7 +3377,7 @@ vertexFileHeader_t *CMDLCache::LoadVertexData( studiohdr_t *pStudioHdr )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VERTEXES );
|
intp iAsync = GetAsyncInfoIndex( handle, MDLCACHE_VERTEXES );
|
||||||
|
|
||||||
if ( iAsync == NO_ASYNC )
|
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 )
|
if ( id == (DataCacheClientID_t)-1 )
|
||||||
id = (DataCacheClientID_t)pData;
|
id = (DataCacheClientID_t)(intp)pData;
|
||||||
|
|
||||||
GetCacheSection( type )->Add(id, pData, size, c );
|
GetCacheSection( type )->Add(id, pData, size, c );
|
||||||
}
|
}
|
||||||
@ -3584,7 +3621,7 @@ void CMDLCache::QueuedLoaderCallback_MDL( void *pContext, void *pContext2, const
|
|||||||
|
|
||||||
// journal each incoming buffer
|
// journal each incoming buffer
|
||||||
ModelParts_t *pModelParts = (ModelParts_t *)pContext;
|
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->Buffers[bufferType].SetExternalBuffer( (void *)pData, nSize, nSize, CUtlBuffer::READ_ONLY );
|
||||||
pModelParts->nLoadedParts += (1 << bufferType);
|
pModelParts->nLoadedParts += (1 << bufferType);
|
||||||
|
|
||||||
@ -3895,7 +3932,7 @@ void CMDLCache::MarkFrame()
|
|||||||
const studiohdr_t *studiohdr_t::FindModel( void **cache, char const *pModelName ) const
|
const studiohdr_t *studiohdr_t::FindModel( void **cache, char const *pModelName ) const
|
||||||
{
|
{
|
||||||
MDLHandle_t handle = g_MDLCache.FindMDL( pModelName );
|
MDLHandle_t handle = g_MDLCache.FindMDL( pModelName );
|
||||||
*cache = (void*)(uintp)handle;
|
*cache = MDLHandleToVirtual(handle);
|
||||||
return g_MDLCache.GetStudioHdr( handle );
|
return g_MDLCache.GetStudioHdr( handle );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3904,21 +3941,21 @@ virtualmodel_t *studiohdr_t::GetVirtualModel( void ) const
|
|||||||
if (numincludemodels == 0)
|
if (numincludemodels == 0)
|
||||||
return NULL;
|
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
|
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
|
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
|
const studiohdr_t *virtualgroup_t::GetStudioHdr( void ) const
|
||||||
{
|
{
|
||||||
return g_MDLCache.GetStudioHdr( (MDLHandle_t)(int)cache&0xffff );
|
return g_MDLCache.GetStudioHdr( VoidPtrToMDLHandle( cache ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "datamodel.h"
|
#include "datamodel.h"
|
||||||
#include "tier1/KeyValues.h"
|
#include "tier1/KeyValues.h"
|
||||||
|
|
||||||
#ifndef _LINUX
|
#ifdef _WIN32
|
||||||
#define USE_WINDOWS_CLIPBOARD
|
#define USE_WINDOWS_CLIPBOARD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -901,7 +901,9 @@ bool CDataModel::Unserialize( CUtlBuffer &inBuf, const char *pEncodingName, cons
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(NO_MALLOC_OVERRIDE)
|
||||||
g_pMemAlloc->heapchk();
|
g_pMemAlloc->heapchk();
|
||||||
|
#endif
|
||||||
|
|
||||||
DmxHeader_t header;
|
DmxHeader_t header;
|
||||||
bool bStoresVersionInFile = pSerializer->StoresVersionInFile();
|
bool bStoresVersionInFile = pSerializer->StoresVersionInFile();
|
||||||
@ -1656,7 +1658,7 @@ DmAttributeReferenceIterator_t CDataModel::FirstAttributeReferencingElement( DmE
|
|||||||
if ( !pRef || pRef->m_attributes.m_hAttribute == DMATTRIBUTE_HANDLE_INVALID )
|
if ( !pRef || pRef->m_attributes.m_hAttribute == DMATTRIBUTE_HANDLE_INVALID )
|
||||||
return DMATTRIBUTE_REFERENCE_ITERATOR_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 )
|
DmAttributeReferenceIterator_t CDataModel::NextAttributeReferencingElement( DmAttributeReferenceIterator_t hAttrIter )
|
||||||
@ -1665,7 +1667,7 @@ DmAttributeReferenceIterator_t CDataModel::NextAttributeReferencingElement( DmAt
|
|||||||
if ( !pList )
|
if ( !pList )
|
||||||
return DMATTRIBUTE_REFERENCE_ITERATOR_INVALID;
|
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 )
|
CDmAttribute *CDataModel::GetAttribute( DmAttributeReferenceIterator_t hAttrIter )
|
||||||
|
@ -67,7 +67,7 @@ bool HashEntryCompareFunc( CAttributeNode *const& lhs, CAttributeNode *const& rh
|
|||||||
|
|
||||||
uint HashEntryKeyFunc( CAttributeNode *const& keyinfo )
|
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
|
return i >> 2; // since memory is allocated on a 4-byte (at least!) boundary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,7 +721,7 @@ public:
|
|||||||
|
|
||||||
virtual void Undo()
|
virtual void Undo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.Set( m_nSlot, m_OldValue );
|
array.Set( m_nSlot, m_OldValue );
|
||||||
@ -730,7 +730,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redo()
|
virtual void Redo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.Set( m_nSlot, m_Value );
|
array.Set( m_nSlot, m_Value );
|
||||||
@ -789,7 +789,7 @@ public:
|
|||||||
|
|
||||||
virtual void Undo()
|
virtual void Undo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < m_nCount; ++i )
|
for ( int i = 0; i < m_nCount; ++i )
|
||||||
@ -801,7 +801,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redo()
|
virtual void Redo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < m_nCount; ++i )
|
for ( int i = 0; i < m_nCount; ++i )
|
||||||
@ -838,7 +838,7 @@ public:
|
|||||||
|
|
||||||
virtual void Undo()
|
virtual void Undo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.RemoveMultiple( m_nIndex, m_nCount );
|
array.RemoveMultiple( m_nIndex, m_nCount );
|
||||||
@ -847,7 +847,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redo()
|
virtual void Redo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
T defaultVal;
|
T defaultVal;
|
||||||
@ -888,7 +888,7 @@ public:
|
|||||||
|
|
||||||
virtual void Undo()
|
virtual void Undo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.Remove( m_nIndex );
|
array.Remove( m_nIndex );
|
||||||
@ -897,7 +897,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redo()
|
virtual void Redo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.InsertBefore( m_nIndex, m_newValue );
|
array.InsertBefore( m_nIndex, m_newValue );
|
||||||
@ -955,7 +955,7 @@ public:
|
|||||||
|
|
||||||
virtual void Undo()
|
virtual void Undo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
if ( m_bFastRemove )
|
if ( m_bFastRemove )
|
||||||
@ -993,7 +993,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redo()
|
virtual void Redo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
if ( m_bFastRemove )
|
if ( m_bFastRemove )
|
||||||
@ -1015,7 +1015,7 @@ public:
|
|||||||
static char buf[ 128 ];
|
static char buf[ 128 ];
|
||||||
|
|
||||||
const char *base = BaseClass::GetDesc();
|
const char *base = BaseClass::GetDesc();
|
||||||
Q_snprintf( buf, sizeof( buf ), "%s (%s) = remove( pos %i, count %i )", base, GetAttributeName(), m_nIndex, m_nCount );
|
Q_snprintf( buf, sizeof( buf ), "%s (%s) = remove( pos %i, count %i )", base, this->GetAttributeName(), m_nIndex, m_nCount );
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1097,7 +1097,7 @@ public:
|
|||||||
|
|
||||||
virtual void Undo()
|
virtual void Undo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.RemoveAll();
|
array.RemoveAll();
|
||||||
@ -1110,7 +1110,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redo()
|
virtual void Redo()
|
||||||
{
|
{
|
||||||
CDmrArray<T> array( GetAttribute() );
|
CDmrArray<T> array( this->GetAttribute() );
|
||||||
if ( array.IsValid() )
|
if ( array.IsValid() )
|
||||||
{
|
{
|
||||||
array.RemoveAll();
|
array.RemoveAll();
|
||||||
@ -2734,7 +2734,7 @@ CDmaArrayConstBase<T,B>::CDmaArrayConstBase( )
|
|||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
int CDmaArrayConstBase<T,B>::Find( const T &value ) const
|
int CDmaArrayConstBase<T,B>::Find( const T &value ) const
|
||||||
{
|
{
|
||||||
return Value().Find( value );
|
return this->Value().Find( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2747,7 +2747,7 @@ int CDmaArrayBase<T,B>::AddToTail()
|
|||||||
T defaultVal;
|
T defaultVal;
|
||||||
CDmAttributeInfo<T>::SetDefaultValue( defaultVal );
|
CDmAttributeInfo<T>::SetDefaultValue( defaultVal );
|
||||||
CDmArrayAttributeOp<T> accessor( this->m_pAttribute );
|
CDmArrayAttributeOp<T> accessor( this->m_pAttribute );
|
||||||
return accessor.InsertBefore( Value().Count(), defaultVal );
|
return accessor.InsertBefore( this->Value().Count(), defaultVal );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
@ -2763,7 +2763,7 @@ template< class T, class B >
|
|||||||
int CDmaArrayBase<T,B>::AddToTail( const T& src )
|
int CDmaArrayBase<T,B>::AddToTail( const T& src )
|
||||||
{
|
{
|
||||||
CDmArrayAttributeOp<T> accessor( this->m_pAttribute );
|
CDmArrayAttributeOp<T> accessor( this->m_pAttribute );
|
||||||
return accessor.InsertBefore( Value().Count(), src );
|
return accessor.InsertBefore( this->Value().Count(), src );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
@ -2777,7 +2777,7 @@ template< class T, class B >
|
|||||||
int CDmaArrayBase<T,B>::AddMultipleToTail( int num )
|
int CDmaArrayBase<T,B>::AddMultipleToTail( int num )
|
||||||
{
|
{
|
||||||
CDmArrayAttributeOp<T> accessor( this->m_pAttribute );
|
CDmArrayAttributeOp<T> accessor( this->m_pAttribute );
|
||||||
return accessor.InsertMultipleBefore( Value().Count(), num );
|
return accessor.InsertMultipleBefore( this->Value().Count(), num );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
@ -2790,7 +2790,7 @@ int CDmaArrayBase<T,B>::InsertMultipleBefore( int elem, int num )
|
|||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
void CDmaArrayBase<T,B>::EnsureCount( int num )
|
void CDmaArrayBase<T,B>::EnsureCount( int num )
|
||||||
{
|
{
|
||||||
int nCurrentCount = Value().Count();
|
int nCurrentCount = this->Value().Count();
|
||||||
if ( nCurrentCount < num )
|
if ( nCurrentCount < num )
|
||||||
{
|
{
|
||||||
AddMultipleToTail( num - nCurrentCount );
|
AddMultipleToTail( num - nCurrentCount );
|
||||||
@ -2879,7 +2879,7 @@ void CDmaArrayBase<T,B>::RemoveMultiple( int elem, int num )
|
|||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
void CDmaArrayBase<T,B>::EnsureCapacity( int num )
|
void CDmaArrayBase<T,B>::EnsureCapacity( int num )
|
||||||
{
|
{
|
||||||
Value().EnsureCapacity( num );
|
this->Value().EnsureCapacity( num );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
@ -2894,10 +2894,10 @@ void CDmaArrayBase<T,B>::Purge()
|
|||||||
// Attribute initialization
|
// Attribute initialization
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template< class T, class B >
|
template< class T, class B >
|
||||||
void CDmaDecorator<T,B>::Init( CDmElement *pOwner, const char *pAttributeName, int nFlags = 0 )
|
void CDmaDecorator<T,B>::Init( CDmElement *pOwner, const char *pAttributeName, int nFlags )
|
||||||
{
|
{
|
||||||
Assert( pOwner );
|
Assert( pOwner );
|
||||||
this->m_pAttribute = pOwner->AddExternalAttribute( pAttributeName, CDmAttributeInfo<CUtlVector<T> >::AttributeType(), &Value() );
|
this->m_pAttribute = pOwner->AddExternalAttribute( pAttributeName, CDmAttributeInfo<CUtlVector<T> >::AttributeType(), &(this->Value()) );
|
||||||
Assert( this->m_pAttribute );
|
Assert( this->m_pAttribute );
|
||||||
if ( nFlags )
|
if ( nFlags )
|
||||||
{
|
{
|
||||||
@ -2915,12 +2915,12 @@ void CDmrDecoratorConst<T,BaseClass>::Init( const CDmAttribute* pAttribute )
|
|||||||
if ( pAttribute && pAttribute->GetType() == CDmAttributeInfo< CUtlVector< T > >::AttributeType() )
|
if ( pAttribute && pAttribute->GetType() == CDmAttributeInfo< CUtlVector< T > >::AttributeType() )
|
||||||
{
|
{
|
||||||
this->m_pAttribute = const_cast<CDmAttribute*>( pAttribute );
|
this->m_pAttribute = const_cast<CDmAttribute*>( pAttribute );
|
||||||
Attach( this->m_pAttribute->GetAttributeData() );
|
this->Attach( this->m_pAttribute->GetAttributeData() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->m_pAttribute = NULL;
|
this->m_pAttribute = NULL;
|
||||||
Attach( NULL );
|
this->Attach( NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2948,12 +2948,12 @@ void CDmrDecorator<T,BaseClass>::Init( CDmAttribute* pAttribute )
|
|||||||
if ( pAttribute && pAttribute->GetType() == CDmAttributeInfo< CUtlVector< T > >::AttributeType() )
|
if ( pAttribute && pAttribute->GetType() == CDmAttributeInfo< CUtlVector< T > >::AttributeType() )
|
||||||
{
|
{
|
||||||
this->m_pAttribute = pAttribute;
|
this->m_pAttribute = pAttribute;
|
||||||
Attach( this->m_pAttribute->GetAttributeData() );
|
this->Attach( this->m_pAttribute->GetAttributeData() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->m_pAttribute = NULL;
|
this->m_pAttribute = NULL;
|
||||||
Attach( NULL );
|
this->Attach( NULL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ DmAttributeType_t CDmSerializerKeyValues::DetermineAttributeType( KeyValues *pKe
|
|||||||
if ( sscanf( pKeyValues->GetString(), "%f %f", &f1, &f2 ) == 2 )
|
if ( sscanf( pKeyValues->GetString(), "%f %f", &f1, &f2 ) == 2 )
|
||||||
return AT_VECTOR2;
|
return AT_VECTOR2;
|
||||||
|
|
||||||
int i = pKeyValues->GetInt( NULL, INT_MAX );
|
int i = pKeyValues->GetInt( nullptr, INT_MAX );
|
||||||
if ( ( sscanf( pKeyValues->GetString(), "%d", &i ) == 1 ) &&
|
if ( ( sscanf( pKeyValues->GetString(), "%d", &i ) == 1 ) &&
|
||||||
( !strchr( pKeyValues->GetString(), '.' ) ) )
|
( !strchr( pKeyValues->GetString(), '.' ) ) )
|
||||||
return AT_INT;
|
return AT_INT;
|
||||||
|
@ -13,7 +13,7 @@ def options(opt):
|
|||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
conf.define('LAUNCHERONLY',1)
|
conf.define('LAUNCHERONLY',1)
|
||||||
# conf.define('SUPPORT_PACKED_STORE',1)
|
conf.define('SUPPORT_PACKED_STORE',1)
|
||||||
conf.define('DEDICATED',1)
|
conf.define('DEDICATED',1)
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
@ -56,7 +56,7 @@ def build(bld):
|
|||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
|
|
||||||
libs = ['tier0','tier1','tier2','tier3','vstdlib','steam_api','vpklib','appframework','mathlib', 'EDIT']
|
libs = ['tier0','vpklib','tier1','tier2','tier3','vstdlib','steam_api','appframework','mathlib', 'EDIT']
|
||||||
|
|
||||||
install_path = bld.env.LIBDIR
|
install_path = bld.env.LIBDIR
|
||||||
|
|
||||||
|
@ -73,8 +73,10 @@ struct CSizeTest
|
|||||||
COMPILE_TIME_ASSERT( sizeof( QAngle ) == 12 );
|
COMPILE_TIME_ASSERT( sizeof( QAngle ) == 12 );
|
||||||
COMPILE_TIME_ASSERT( sizeof( Quaternion ) == 16 );
|
COMPILE_TIME_ASSERT( sizeof( Quaternion ) == 16 );
|
||||||
COMPILE_TIME_ASSERT( sizeof( VMatrix ) == 64 );
|
COMPILE_TIME_ASSERT( sizeof( VMatrix ) == 64 );
|
||||||
|
#if !defined( PLATFORM_64BITS )
|
||||||
COMPILE_TIME_ASSERT( sizeof( CUtlString ) == 4 );
|
COMPILE_TIME_ASSERT( sizeof( CUtlString ) == 4 );
|
||||||
COMPILE_TIME_ASSERT( sizeof( CUtlBinaryBlock ) == 16 );
|
COMPILE_TIME_ASSERT( sizeof( CUtlBinaryBlock ) == 16 );
|
||||||
|
#endif
|
||||||
COMPILE_TIME_ASSERT( sizeof( DmObjectId_t ) == 16 );
|
COMPILE_TIME_ASSERT( sizeof( DmObjectId_t ) == 16 );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -53,8 +53,8 @@ public:
|
|||||||
DELEGATE_TO_OBJECT_0( int, heapchk, m_pMemAlloc );
|
DELEGATE_TO_OBJECT_0( int, heapchk, m_pMemAlloc );
|
||||||
DELEGATE_TO_OBJECT_0( bool, IsDebugHeap, m_pMemAlloc );
|
DELEGATE_TO_OBJECT_0( bool, IsDebugHeap, m_pMemAlloc );
|
||||||
DELEGATE_TO_OBJECT_2V( GetActualDbgInfo, const char *&, int &, 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( RegisterAllocation, const char *, int, size_t, size_t, unsigned, m_pMemAlloc );
|
||||||
DELEGATE_TO_OBJECT_5V( RegisterDeallocation, const char *, int, int, int, 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_0( int, GetVersion, m_pMemAlloc );
|
||||||
DELEGATE_TO_OBJECT_0V( CompactHeap, m_pMemAlloc );
|
DELEGATE_TO_OBJECT_0V( CompactHeap, m_pMemAlloc );
|
||||||
DELEGATE_TO_OBJECT_1( MemAllocFailHandler_t, SetAllocFailHandler, MemAllocFailHandler_t, m_pMemAlloc );
|
DELEGATE_TO_OBJECT_1( MemAllocFailHandler_t, SetAllocFailHandler, MemAllocFailHandler_t, m_pMemAlloc );
|
||||||
|
@ -208,8 +208,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
struct ModelFileHandleHash
|
struct ModelFileHandleHash
|
||||||
{
|
{
|
||||||
uint operator()( model_t *p ) const { return Mix32HashFunctor()( (uint32)( p->fnHandle ) ); }
|
uint operator()( model_t *p ) const { return PointerHashFunctor()( p->fnHandle ); }
|
||||||
uint operator()( FileNameHandle_t fn ) const { return Mix32HashFunctor()( (uint32) fn ); }
|
uint operator()( FileNameHandle_t fn ) const { return PointerHashFunctor()( fn ); }
|
||||||
};
|
};
|
||||||
struct ModelFileHandleEq
|
struct ModelFileHandleEq
|
||||||
{
|
{
|
||||||
@ -532,7 +532,7 @@ const studiohdr_t *CModelInfo::FindModel( const studiohdr_t *pStudioHdr, void **
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
const studiohdr_t *CModelInfo::FindModel( void *cache ) const
|
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
|
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 );
|
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
|
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 );
|
return g_pMDLCache->GetAnimBlock( handle, nBlock );
|
||||||
}
|
}
|
||||||
|
|
||||||
int CModelInfo::GetAutoplayList( const studiohdr_t *pStudioHdr, unsigned short **pAutoplayList ) const
|
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 );
|
return g_pMDLCache->GetAutoplayList( handle, pAutoplayList );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,22 +576,22 @@ virtualmodel_t *studiohdr_t::GetVirtualModel( void ) const
|
|||||||
{
|
{
|
||||||
if ( numincludemodels == 0 )
|
if ( numincludemodels == 0 )
|
||||||
return NULL;
|
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
|
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
|
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
|
const studiohdr_t *virtualgroup_t::GetStudioHdr( void ) const
|
||||||
{
|
{
|
||||||
return g_pMDLCache->GetStudioHdr( (MDLHandle_t)(int)cache&0xffff );
|
return g_pMDLCache->GetStudioHdr( VoidPtrToMDLHandle( cache ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1268,7 +1268,9 @@ void CEdgeList::CullSmallOccluders()
|
|||||||
// Sort the surfaces by screen area, in descending order
|
// Sort the surfaces by screen area, in descending order
|
||||||
int nSurfCount = m_Surfaces.Count();
|
int nSurfCount = m_Surfaces.Count();
|
||||||
s_pSortSurfaces = m_Surfaces.Base();
|
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
|
// We're going to keep the greater of r_occludermin + All surfaces with a screen area >= r_occluderarea
|
||||||
int nMinSurfaces = r_occludermincount.GetInt();
|
int nMinSurfaces = r_occludermincount.GetInt();
|
||||||
@ -1282,7 +1284,7 @@ void CEdgeList::CullSmallOccluders()
|
|||||||
|
|
||||||
bool *bUseSurface = (bool*)stackalloc( nSurfCount * sizeof(bool) );
|
bool *bUseSurface = (bool*)stackalloc( nSurfCount * sizeof(bool) );
|
||||||
memset( bUseSurface, 0, nSurfCount * sizeof(bool) );
|
memset( bUseSurface, 0, nSurfCount * sizeof(bool) );
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < nSurfCount; ++i )
|
for ( i = 0; i < nSurfCount; ++i )
|
||||||
{
|
{
|
||||||
|
@ -1962,7 +1962,7 @@ public:
|
|||||||
{
|
{
|
||||||
int m_channelNum;
|
int m_channelNum;
|
||||||
int m_vol; // max volume of sound. -1 means "do not cull, ever, do not even do the math"
|
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:
|
protected:
|
||||||
sChannelVolData m_channelInfo[MAX_CHANNELS];
|
sChannelVolData m_channelInfo[MAX_CHANNELS];
|
||||||
@ -1994,7 +1994,7 @@ void CChannelCullList::Initialize( CChannelList &list )
|
|||||||
{
|
{
|
||||||
m_channelInfo[i].m_vol = ChannelLoudestCurVolume(ch);
|
m_channelInfo[i].m_vol = ChannelLoudestCurVolume(ch);
|
||||||
AssertMsg(m_channelInfo[i].m_vol >= 0, "Sound channel has a negative volume?");
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -2029,7 +2029,7 @@ void CChannelCullList::Initialize( CChannelList &list )
|
|||||||
++j )
|
++j )
|
||||||
{
|
{
|
||||||
// j steps through the sorted list until we find ourselves:
|
// 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
|
// that's another channel playing this sound but louder than me
|
||||||
++howManyLouder;
|
++howManyLouder;
|
||||||
|
@ -93,7 +93,7 @@ CAudioSourceMP3::CAudioSourceMP3( CSfxTable *pSfx )
|
|||||||
|
|
||||||
m_dataStart = 0;
|
m_dataStart = 0;
|
||||||
|
|
||||||
int file = g_pSndIO->open( pSfx->GetFileName() );
|
intp file = g_pSndIO->open( pSfx->GetFileName() );
|
||||||
if ( file != -1 )
|
if ( file != -1 )
|
||||||
{
|
{
|
||||||
m_dataSize = g_pSndIO->size( file );
|
m_dataSize = g_pSndIO->size( file );
|
||||||
@ -239,7 +239,7 @@ void CAudioSourceMP3::GetCacheData( CAudioSourceCachedInfo *info )
|
|||||||
info->SetSampleRate( m_sampleRate );
|
info->SetSampleRate( m_sampleRate );
|
||||||
info->SetDataStart( 0 );
|
info->SetDataStart( 0 );
|
||||||
|
|
||||||
int file = g_pSndIO->open( m_pSfx->GetFileName() );
|
intp file = g_pSndIO->open( m_pSfx->GetFileName() );
|
||||||
if ( !file )
|
if ( !file )
|
||||||
{
|
{
|
||||||
Warning( "Failed to find file for building soundcache [ %s ]\n", m_pSfx->GetFileName() );
|
Warning( "Failed to find file for building soundcache [ %s ]\n", m_pSfx->GetFileName() );
|
||||||
|
@ -723,7 +723,7 @@ bool CAudioSourceWave::GetStartupData( void *dest, int destsize, int& bytesCopie
|
|||||||
// requesting precache snippet as leader for streaming startup latency
|
// requesting precache snippet as leader for streaming startup latency
|
||||||
if ( destsize )
|
if ( destsize )
|
||||||
{
|
{
|
||||||
int file = g_pSndIO->open( m_pSfx->GetFileName() );
|
intp file = g_pSndIO->open( m_pSfx->GetFileName() );
|
||||||
if ( !file )
|
if ( !file )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -37,7 +37,7 @@ void VoiceTweak_EndVoiceTweakMode();
|
|||||||
void EngineTool_OverrideSampleRate( int& rate );
|
void EngineTool_OverrideSampleRate( int& rate );
|
||||||
|
|
||||||
// A fallback codec that should be the most likely to work for local/offline use
|
// A fallback codec that should be the most likely to work for local/offline use
|
||||||
#define VOICE_FALLBACK_CODEC "vaudio_celt"
|
#define VOICE_FALLBACK_CODEC "vaudio_opus"
|
||||||
|
|
||||||
// Special entity index used for tweak mode.
|
// Special entity index used for tweak mode.
|
||||||
#define TWEAKMODE_ENTITYINDEX -500
|
#define TWEAKMODE_ENTITYINDEX -500
|
||||||
@ -197,6 +197,9 @@ extern IVoiceRecord* CreateVoiceRecord_AudioQueue(int sampleRate);
|
|||||||
extern IVoiceRecord* CreateVoiceRecord_OpenAL(int sampleRate);
|
extern IVoiceRecord* CreateVoiceRecord_OpenAL(int sampleRate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_SDL
|
||||||
|
extern IVoiceRecord *CreateVoiceRecord_SDL(int sampleRate);
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool VoiceRecord_Start()
|
static bool VoiceRecord_Start()
|
||||||
{
|
{
|
||||||
@ -583,12 +586,13 @@ bool Voice_Init( const char *pCodecName, int nSampleRate )
|
|||||||
|
|
||||||
bool bSpeex = Q_stricmp( pCodecName, "vaudio_speex" ) == 0;
|
bool bSpeex = Q_stricmp( pCodecName, "vaudio_speex" ) == 0;
|
||||||
bool bCelt = Q_stricmp( pCodecName, "vaudio_celt" ) == 0;
|
bool bCelt = Q_stricmp( pCodecName, "vaudio_celt" ) == 0;
|
||||||
|
bool bOpus = Q_stricmp( pCodecName, "vaudio_opus" ) == 0;
|
||||||
bool bSteam = Q_stricmp( pCodecName, "steam" ) == 0;
|
bool bSteam = Q_stricmp( pCodecName, "steam" ) == 0;
|
||||||
// Miles has not been in use for voice in a long long time. Not worth the surface to support ancient demos that may
|
// Miles has not been in use for voice in a long long time. Not worth the surface to support ancient demos that may
|
||||||
// use it (and probably do not work for other reasons)
|
// use it (and probably do not work for other reasons)
|
||||||
// "vaudio_miles"
|
// "vaudio_miles"
|
||||||
|
|
||||||
if ( !( bSpeex || bCelt || bSteam ) )
|
if ( !( bSpeex || bCelt || bOpus || bSteam ) )
|
||||||
{
|
{
|
||||||
Msg( "Voice_Init Failed: invalid voice codec %s.\n", pCodecName );
|
Msg( "Voice_Init Failed: invalid voice codec %s.\n", pCodecName );
|
||||||
return false;
|
return false;
|
||||||
@ -648,6 +652,8 @@ bool Voice_Init( const char *pCodecName, int nSampleRate )
|
|||||||
}
|
}
|
||||||
#elif defined( WIN32 )
|
#elif defined( WIN32 )
|
||||||
g_pVoiceRecord = CreateVoiceRecord_DSound( Voice_SamplesPerSec() );
|
g_pVoiceRecord = CreateVoiceRecord_DSound( Voice_SamplesPerSec() );
|
||||||
|
#elif defined( USE_SDL )
|
||||||
|
g_pVoiceRecord = CreateVoiceRecord_SDL( Voice_SamplesPerSec() );
|
||||||
#else
|
#else
|
||||||
g_pVoiceRecord = CreateVoiceRecord_OpenAL( Voice_SamplesPerSec() );
|
g_pVoiceRecord = CreateVoiceRecord_OpenAL( Voice_SamplesPerSec() );
|
||||||
#endif
|
#endif
|
||||||
@ -671,6 +677,12 @@ bool Voice_Init( const char *pCodecName, int nSampleRate )
|
|||||||
CreateInterfaceFn createCodecFn = NULL;
|
CreateInterfaceFn createCodecFn = NULL;
|
||||||
g_hVoiceCodecDLL = FileSystem_LoadModule(pCodecName);
|
g_hVoiceCodecDLL = FileSystem_LoadModule(pCodecName);
|
||||||
|
|
||||||
|
if( !g_hVoiceCodecDLL || (createCodecFn = Sys_GetFactory(g_hVoiceCodecDLL)) == NULL )
|
||||||
|
{
|
||||||
|
g_hVoiceCodecDLL = FileSystem_LoadModule( VOICE_FALLBACK_CODEC );
|
||||||
|
pCodecName = VOICE_FALLBACK_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !g_hVoiceCodecDLL || (createCodecFn = Sys_GetFactory(g_hVoiceCodecDLL)) == NULL ||
|
if ( !g_hVoiceCodecDLL || (createCodecFn = Sys_GetFactory(g_hVoiceCodecDLL)) == NULL ||
|
||||||
(g_pEncodeCodec = (IVoiceCodec*)createCodecFn(pCodecName, NULL)) == NULL || !g_pEncodeCodec->Init( quality ) )
|
(g_pEncodeCodec = (IVoiceCodec*)createCodecFn(pCodecName, NULL)) == NULL || !g_pEncodeCodec->Init( quality ) )
|
||||||
{
|
{
|
||||||
@ -1075,7 +1087,7 @@ int Voice_GetCompressedData(char *pchDest, int nCount, bool bFinal)
|
|||||||
{
|
{
|
||||||
// Check g_bVoiceRecordStopping in case g_bUsingSteamVoice changes on us
|
// Check g_bVoiceRecordStopping in case g_bUsingSteamVoice changes on us
|
||||||
// while waiting for the end of voice data.
|
// while waiting for the end of voice data.
|
||||||
if ( g_bUsingSteamVoice || g_bVoiceRecordStopping )
|
if ( g_bUsingSteamVoice && g_bVoiceRecordStopping )
|
||||||
{
|
{
|
||||||
uint32 cbCompressedWritten = 0;
|
uint32 cbCompressedWritten = 0;
|
||||||
uint32 cbUncompressedWritten = 0;
|
uint32 cbUncompressedWritten = 0;
|
||||||
|
@ -141,7 +141,7 @@ bool CMixerControls::GetValue_Float(Control iControl, float &value)
|
|||||||
case MicVolume:
|
case MicVolume:
|
||||||
{
|
{
|
||||||
OSStatus theError = noErr;
|
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
|
// scan the channel list until you find a channel set to non-zero, then use that
|
||||||
Float32 theVolume = 0;
|
Float32 theVolume = 0;
|
||||||
|
257
engine/audio/private/voice_record_sdl.cpp
Normal file
257
engine/audio/private/voice_record_sdl.cpp
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
//========= Copyright 1996-2009, Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//
|
||||||
|
//=============================================================================//
|
||||||
|
// This module implements the voice record and compression functions
|
||||||
|
|
||||||
|
//#include "audio_pch.h"
|
||||||
|
//#include "voice.h"
|
||||||
|
#include "tier0/platform.h"
|
||||||
|
#include "ivoicerecord.h"
|
||||||
|
#include "tier0/dbg.h"
|
||||||
|
#include "tier0/threadtools.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <SDL_audio.h>
|
||||||
|
|
||||||
|
#define RECORDING_BUFFER_SECONDS 3
|
||||||
|
#define SAMPLE_COUNT 2048
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// VoiceRecord_SDL
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct AudioBuf
|
||||||
|
{
|
||||||
|
int Read(char *out, int len)
|
||||||
|
{
|
||||||
|
int nAvalible = (size + (writePtr - readPtr)) % size;
|
||||||
|
|
||||||
|
if( nAvalible == 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( len > nAvalible ) len = nAvalible;
|
||||||
|
|
||||||
|
int diff = (data + size) - readPtr;
|
||||||
|
|
||||||
|
|
||||||
|
if( len > diff )
|
||||||
|
{
|
||||||
|
memcpy(out, readPtr, diff );
|
||||||
|
memcpy(out+diff, data, len-diff );
|
||||||
|
} else memcpy(out, readPtr, len);
|
||||||
|
|
||||||
|
readPtr += len;
|
||||||
|
|
||||||
|
if( readPtr >= data + size )
|
||||||
|
readPtr -= size;
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Write(char *in, int len)
|
||||||
|
{
|
||||||
|
int diff = (data + size) - writePtr;
|
||||||
|
|
||||||
|
if( len > diff )
|
||||||
|
{
|
||||||
|
memcpy(writePtr, in, diff );
|
||||||
|
memcpy(data, in+diff, len-diff );
|
||||||
|
} else memcpy(writePtr, in, len);
|
||||||
|
|
||||||
|
writePtr += len;
|
||||||
|
|
||||||
|
if (writePtr >= (data + size))
|
||||||
|
writePtr -= size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int size;
|
||||||
|
char *data;
|
||||||
|
char *readPtr;
|
||||||
|
char *writePtr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class VoiceRecord_SDL : public IVoiceRecord
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual ~VoiceRecord_SDL();
|
||||||
|
public:
|
||||||
|
VoiceRecord_SDL();
|
||||||
|
virtual void Release();
|
||||||
|
virtual bool RecordStart();
|
||||||
|
virtual void RecordStop();
|
||||||
|
|
||||||
|
// Initialize. The format of the data we expect from the provider is
|
||||||
|
// 8-bit signed mono at the specified sample rate.
|
||||||
|
virtual bool Init(int sampleRate);
|
||||||
|
virtual void Idle() {}; // Stub
|
||||||
|
void RenderBuffer( char *pszBuf, int size );
|
||||||
|
|
||||||
|
// Get the most recent N samples.
|
||||||
|
virtual int GetRecordedData(short *pOut, int nSamplesWanted );
|
||||||
|
|
||||||
|
SDL_AudioSpec m_ReceivedRecordingSpec;
|
||||||
|
int m_BytesPerSample; // Да кому нужна эта ваша инкапсуляция?
|
||||||
|
int m_nSampleRate;
|
||||||
|
private:
|
||||||
|
bool InitalizeInterfaces(); // Initialize the openal capture buffers and other interfaces
|
||||||
|
void ReleaseInterfaces(); // Release openal buffers and other interfaces
|
||||||
|
void ClearInterfaces(); // Clear members.
|
||||||
|
private:
|
||||||
|
|
||||||
|
SDL_AudioDeviceID m_Device;
|
||||||
|
AudioBuf m_AudioBuffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
void audioRecordingCallback( void *userdata, uint8 *stream, int len )
|
||||||
|
{
|
||||||
|
VoiceRecord_SDL *voice = (VoiceRecord_SDL*)userdata;
|
||||||
|
voice->RenderBuffer( (char*)stream, len );
|
||||||
|
}
|
||||||
|
|
||||||
|
VoiceRecord_SDL::VoiceRecord_SDL() :
|
||||||
|
m_nSampleRate( 0 ) ,m_Device( 0 )
|
||||||
|
{
|
||||||
|
m_AudioBuffer.data = NULL;
|
||||||
|
m_AudioBuffer.readPtr = NULL;
|
||||||
|
m_AudioBuffer.writePtr = NULL;
|
||||||
|
|
||||||
|
ClearInterfaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
VoiceRecord_SDL::~VoiceRecord_SDL()
|
||||||
|
{
|
||||||
|
ReleaseInterfaces();
|
||||||
|
ClearInterfaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VoiceRecord_SDL::Release()
|
||||||
|
{
|
||||||
|
ReleaseInterfaces();
|
||||||
|
ClearInterfaces();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoiceRecord_SDL::RecordStart()
|
||||||
|
{
|
||||||
|
if ( !m_Device )
|
||||||
|
InitalizeInterfaces();
|
||||||
|
|
||||||
|
if ( !m_Device )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SDL_PauseAudioDevice( m_Device, SDL_FALSE );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VoiceRecord_SDL::RecordStop()
|
||||||
|
{
|
||||||
|
// Stop capturing.
|
||||||
|
if ( m_Device )
|
||||||
|
SDL_PauseAudioDevice( m_Device, SDL_TRUE );
|
||||||
|
|
||||||
|
// Release the capture buffer interface and any other resources that are no
|
||||||
|
// longer needed
|
||||||
|
ReleaseInterfaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoiceRecord_SDL::InitalizeInterfaces()
|
||||||
|
{
|
||||||
|
//Default audio spec
|
||||||
|
SDL_AudioSpec desiredRecordingSpec;
|
||||||
|
SDL_zero(desiredRecordingSpec);
|
||||||
|
desiredRecordingSpec.freq = m_nSampleRate;
|
||||||
|
desiredRecordingSpec.format = AUDIO_S16;
|
||||||
|
desiredRecordingSpec.channels = 1;
|
||||||
|
desiredRecordingSpec.samples = SAMPLE_COUNT;
|
||||||
|
desiredRecordingSpec.callback = audioRecordingCallback;
|
||||||
|
desiredRecordingSpec.userdata = (void*)this;
|
||||||
|
|
||||||
|
//Open recording device
|
||||||
|
m_Device = SDL_OpenAudioDevice( NULL, SDL_TRUE, &desiredRecordingSpec, &m_ReceivedRecordingSpec, 0 );
|
||||||
|
|
||||||
|
if( m_Device != 0 )
|
||||||
|
{
|
||||||
|
//Calculate per sample bytes
|
||||||
|
m_BytesPerSample = m_ReceivedRecordingSpec.channels * ( SDL_AUDIO_BITSIZE( m_ReceivedRecordingSpec.format ) / 8 );
|
||||||
|
|
||||||
|
//Calculate bytes per second
|
||||||
|
int bytesPerSecond = m_ReceivedRecordingSpec.freq * m_BytesPerSample;
|
||||||
|
|
||||||
|
//Allocate and initialize byte buffer
|
||||||
|
m_AudioBuffer.size = RECORDING_BUFFER_SECONDS * bytesPerSecond;
|
||||||
|
|
||||||
|
if( !m_AudioBuffer.data )
|
||||||
|
m_AudioBuffer.data = (char *)malloc( m_AudioBuffer.size );
|
||||||
|
|
||||||
|
m_AudioBuffer.readPtr = m_AudioBuffer.data;
|
||||||
|
m_AudioBuffer.writePtr = m_AudioBuffer.data + SAMPLE_COUNT*m_BytesPerSample*2;
|
||||||
|
|
||||||
|
memset( m_AudioBuffer.data, 0, m_AudioBuffer.size );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoiceRecord_SDL::Init(int sampleRate)
|
||||||
|
{
|
||||||
|
m_nSampleRate = sampleRate;
|
||||||
|
ReleaseInterfaces();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VoiceRecord_SDL::ReleaseInterfaces()
|
||||||
|
{
|
||||||
|
if( m_Device != 0 )
|
||||||
|
SDL_CloseAudioDevice( m_Device );
|
||||||
|
|
||||||
|
m_Device = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VoiceRecord_SDL::ClearInterfaces()
|
||||||
|
{
|
||||||
|
if( m_AudioBuffer.data )
|
||||||
|
{
|
||||||
|
free( m_AudioBuffer.data );
|
||||||
|
m_AudioBuffer.data = NULL;
|
||||||
|
m_AudioBuffer.readPtr = NULL;
|
||||||
|
m_AudioBuffer.writePtr = NULL;
|
||||||
|
}
|
||||||
|
m_Device = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VoiceRecord_SDL::RenderBuffer( char *pszBuf, int size )
|
||||||
|
{
|
||||||
|
m_AudioBuffer.Write( pszBuf, size );
|
||||||
|
}
|
||||||
|
|
||||||
|
int VoiceRecord_SDL::GetRecordedData(short *pOut, int nSamples )
|
||||||
|
{
|
||||||
|
if ( !m_AudioBuffer.data || nSamples == 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int cbSamples = nSamples * m_BytesPerSample;
|
||||||
|
|
||||||
|
return m_AudioBuffer.Read( (char*)pOut, cbSamples )/m_BytesPerSample;
|
||||||
|
}
|
||||||
|
|
||||||
|
IVoiceRecord* CreateVoiceRecord_SDL(int sampleRate)
|
||||||
|
{
|
||||||
|
VoiceRecord_SDL *pRecord = new VoiceRecord_SDL;
|
||||||
|
if ( pRecord && pRecord->Init(sampleRate) )
|
||||||
|
return pRecord;
|
||||||
|
else if( pRecord )
|
||||||
|
pRecord->Release();
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
@ -1098,10 +1098,10 @@ void CBaseClient::EndTrace( bf_write &msg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( sv_netspike_output.GetInt() & 1 )
|
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 )
|
if ( sv_netspike_output.GetInt() & 2 )
|
||||||
Log( "%s", logData.String() );
|
Log( "%s", (const char*)logData.String() );
|
||||||
ETWMark1S( "netspike", logData.String() );
|
ETWMark1S( "netspike", (const char*)logData.String() );
|
||||||
m_Trace.m_Records.RemoveAll();
|
m_Trace.m_Records.RemoveAll();
|
||||||
m_iTracing = 0;
|
m_iTracing = 0;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ bool CBaseClientState::PrepareSteamConnectResponse( uint64 unGSSteamID, bool bGS
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( NO_STEAM ) && !defined( SWDS )
|
#if 0 //!defined( NO_STEAM ) && !defined( SWDS )
|
||||||
if ( !Steam3Client().SteamUser() )
|
if ( !Steam3Client().SteamUser() )
|
||||||
{
|
{
|
||||||
COM_ExplainDisconnection( true, "#GameUI_ServerRequireSteam" );
|
COM_ExplainDisconnection( true, "#GameUI_ServerRequireSteam" );
|
||||||
@ -578,14 +578,14 @@ bool CBaseClientState::PrepareSteamConnectResponse( uint64 unGSSteamID, bool bGS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
netadr_t checkAdr = adr;
|
netadr_t checkAdr = adr;
|
||||||
if ( adr.GetType() == NA_LOOPBACK || adr.IsLocalhost() )
|
if ( adr.GetType() == NA_LOOPBACK || adr.IsLocalhost() )
|
||||||
{
|
{
|
||||||
checkAdr.SetIP( net_local_adr.GetIPHostByteOrder() );
|
checkAdr.SetIP( net_local_adr.GetIPHostByteOrder() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SWDS
|
#if 0 // #ifndef SWDS
|
||||||
// now append the steam3 cookie
|
// now append the steam3 cookie
|
||||||
char steam3Cookie[ STEAM_KEYSIZE ];
|
char steam3Cookie[ STEAM_KEYSIZE ];
|
||||||
uint32 steam3CookieLen = 0;
|
uint32 steam3CookieLen = 0;
|
||||||
@ -936,6 +936,7 @@ bool CBaseClientState::ProcessConnectionlessPacket( netpacket_t *packet )
|
|||||||
int authprotocol = msg.ReadLong();
|
int authprotocol = msg.ReadLong();
|
||||||
uint64 unGSSteamID = 0;
|
uint64 unGSSteamID = 0;
|
||||||
bool bGSSecure = false;
|
bool bGSSecure = false;
|
||||||
|
#if 0
|
||||||
if ( authprotocol == PROTOCOL_STEAM )
|
if ( authprotocol == PROTOCOL_STEAM )
|
||||||
{
|
{
|
||||||
if ( msg.ReadShort() != 0 )
|
if ( msg.ReadShort() != 0 )
|
||||||
@ -963,6 +964,7 @@ bool CBaseClientState::ProcessConnectionlessPacket( netpacket_t *packet )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
SendConnectPacket( challenge, authprotocol, unGSSteamID, bGSSecure );
|
SendConnectPacket( challenge, authprotocol, unGSSteamID, bGSSecure );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -741,7 +741,7 @@ bool CBaseServer::ProcessConnectionlessPacket(netpacket_t * packet)
|
|||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if ( authProtocol == PROTOCOL_STEAM )
|
/* if ( authProtocol == PROTOCOL_STEAM )
|
||||||
{
|
{
|
||||||
int keyLen = msg.ReadShort();
|
int keyLen = msg.ReadShort();
|
||||||
if ( keyLen < 0 || keyLen > sizeof(cdkey) )
|
if ( keyLen < 0 || keyLen > sizeof(cdkey) )
|
||||||
@ -753,7 +753,7 @@ bool CBaseServer::ProcessConnectionlessPacket(netpacket_t * packet)
|
|||||||
|
|
||||||
ConnectClient( packet->from, protocol, challengeNr, clientChallenge, authProtocol, name, password, cdkey, keyLen ); // cd key is actually a raw encrypted key
|
ConnectClient( packet->from, protocol, challengeNr, clientChallenge, authProtocol, name, password, cdkey, keyLen ); // cd key is actually a raw encrypted key
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
msg.ReadString( cdkey, sizeof(cdkey) );
|
msg.ReadString( cdkey, sizeof(cdkey) );
|
||||||
ConnectClient( packet->from, protocol, challengeNr, clientChallenge, authProtocol, name, password, cdkey, strlen(cdkey) );
|
ConnectClient( packet->from, protocol, challengeNr, clientChallenge, authProtocol, name, password, cdkey, strlen(cdkey) );
|
||||||
@ -1434,11 +1434,13 @@ bool CBaseServer::CheckChallengeType( CBaseClient * client, int nNewUserID, neta
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if ( ( nAuthProtocol == PROTOCOL_HASHEDCDKEY ) && (Q_strlen( pchLogonCookie ) <= 0 || Q_strlen(pchLogonCookie) != 32 ) )
|
if ( ( nAuthProtocol == PROTOCOL_HASHEDCDKEY ) && (Q_strlen( pchLogonCookie ) <= 0 || Q_strlen(pchLogonCookie) != 32 ) )
|
||||||
{
|
{
|
||||||
RejectConnection( adr, clientChallenge, "#GameUI_ServerRejectInvalidCertLen" );
|
RejectConnection( adr, clientChallenge, "#GameUI_ServerRejectInvalidCertLen" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Assert( !IsReplay() );
|
Assert( !IsReplay() );
|
||||||
|
|
||||||
@ -1470,23 +1472,24 @@ bool CBaseServer::CheckChallengeType( CBaseClient * client, int nNewUserID, neta
|
|||||||
client->SetSteamID( CSteamID() ); // set an invalid SteamID
|
client->SetSteamID( CSteamID() ); // set an invalid SteamID
|
||||||
|
|
||||||
// Convert raw certificate back into data
|
// Convert raw certificate back into data
|
||||||
if ( cbCookie <= 0 || cbCookie >= STEAM_KEYSIZE )
|
/* if ( cbCookie <= 0 || cbCookie >= STEAM_KEYSIZE )
|
||||||
{
|
{
|
||||||
RejectConnection( adr, clientChallenge, "#GameUI_ServerRejectInvalidSteamCertLen" );
|
RejectConnection( adr, clientChallenge, "#GameUI_ServerRejectInvalidSteamCertLen" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
netadr_t checkAdr = adr;
|
netadr_t checkAdr = adr;
|
||||||
if ( adr.GetType() == NA_LOOPBACK || adr.IsLocalhost() )
|
if ( adr.GetType() == NA_LOOPBACK || adr.IsLocalhost() )
|
||||||
{
|
{
|
||||||
checkAdr.SetIP( net_local_adr.GetIPHostByteOrder() );
|
checkAdr.SetIP( net_local_adr.GetIPHostByteOrder() );
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
if ( !Steam3Server().NotifyClientConnect( client, nNewUserID, checkAdr, pchLogonCookie, cbCookie )
|
if ( !Steam3Server().NotifyClientConnect( client, nNewUserID, checkAdr, pchLogonCookie, cbCookie )
|
||||||
&& !Steam3Server().BLanOnly() ) // the userID isn't alloc'd yet so we need to fill it in manually
|
&& !Steam3Server().BLanOnly() ) // the userID isn't alloc'd yet so we need to fill it in manually
|
||||||
{
|
{
|
||||||
RejectConnection( adr, clientChallenge, "#GameUI_ServerRejectSteam" );
|
RejectConnection( adr, clientChallenge, "#GameUI_ServerRejectSteam" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Any rejections below this must call SendUserDisconnect
|
// Any rejections below this must call SendUserDisconnect
|
||||||
|
@ -1042,7 +1042,7 @@ void R_BuildCubemapSamples( int numIterations )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bSupportsHDR = g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
|
bool bSupportsHDR = true; //g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
|
||||||
|
|
||||||
for( i = 0; i < pWorldModel->brush.pShared->m_nCubemapSamples; i++ )
|
for( i = 0; i < pWorldModel->brush.pShared->m_nCubemapSamples; i++ )
|
||||||
{
|
{
|
||||||
@ -1080,7 +1080,7 @@ void R_BuildCubemapSamples( int numIterations )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
iBSPPack->SetHDRMode( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE );
|
iBSPPack->SetHDRMode( true /*g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE*/ );
|
||||||
|
|
||||||
iBSPPack->LoadBSPFile( g_pFileSystem, cl.m_szLevelFileName );
|
iBSPPack->LoadBSPFile( g_pFileSystem, cl.m_szLevelFileName );
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ void CL_PreserveExistingEntity( int nOldEntity )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pEnt->OnDataUnchangedInPVS();
|
// pEnt->OnDataUnchangedInPVS();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_CopyExistingEntity( CEntityReadInfo &u )
|
void CL_CopyExistingEntity( CEntityReadInfo &u )
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
#include "replay_internal.h"
|
#include "replay_internal.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "language.h"
|
||||||
#include "igame.h"
|
#include "igame.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
@ -892,7 +893,7 @@ CON_COMMAND_F( connect, "Connect to specified server.", FCVAR_DONTRECORD )
|
|||||||
{
|
{
|
||||||
ConMsg( "Usage: connect <server>\n" );
|
ConMsg( "Usage: connect <server>\n" );
|
||||||
}
|
}
|
||||||
vecArgs.PurgeAndDeleteElements();
|
vecArgs.PurgeAndDeleteElementsArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
CON_COMMAND_F( redirect, "Redirect client to specified server.", FCVAR_DONTRECORD | FCVAR_SERVER_CAN_EXECUTE )
|
CON_COMMAND_F( redirect, "Redirect client to specified server.", FCVAR_DONTRECORD | FCVAR_SERVER_CAN_EXECUTE )
|
||||||
@ -2743,14 +2744,18 @@ void CL_InitLanguageCvar()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *szLang = getenv("LANG");
|
||||||
|
|
||||||
if ( CommandLine()->CheckParm( "-language" ) )
|
if ( CommandLine()->CheckParm( "-language" ) )
|
||||||
{
|
|
||||||
cl_language.SetValue( CommandLine()->ParmValue( "-language", "english") );
|
cl_language.SetValue( CommandLine()->ParmValue( "-language", "english") );
|
||||||
|
else if( szLang )
|
||||||
|
{
|
||||||
|
ELanguage lang = PchLanguageICUCodeToELanguage(szLang, k_Lang_English);
|
||||||
|
const char *szShortLang = GetLanguageShortName(lang);
|
||||||
|
cl_language.SetValue( szShortLang );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
cl_language.SetValue( "english" );
|
cl_language.SetValue( "english" );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ static ConVar cl_showevents ( "cl_showevents", "0", FCVAR_CHEAT, "Print event fi
|
|||||||
// Input : slot -
|
// Input : slot -
|
||||||
// *eventname -
|
// *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);
|
int idx = (slot & 31);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void CL_FireEvents( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i, next;
|
intp i, next;
|
||||||
for ( i = cl.events.Head(); i != cl.events.InvalidIndex(); i = next )
|
for ( i = cl.events.Head(); i != cl.events.InvalidIndex(); i = next )
|
||||||
{
|
{
|
||||||
next = cl.events.Next( i );
|
next = cl.events.Next( i );
|
||||||
|
@ -56,12 +56,10 @@ public:
|
|||||||
// Immediately try to start vprofiling
|
// Immediately try to start vprofiling
|
||||||
// Also, enable cheats on this client only
|
// Also, enable cheats on this client only
|
||||||
Cmd_SetRptActive( true );
|
Cmd_SetRptActive( true );
|
||||||
StartVProfData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnSocketClosed( SocketHandle_t hSocket, const netadr_t & netAdr, void* pData )
|
virtual void OnSocketClosed( SocketHandle_t hSocket, const netadr_t & netAdr, void* pData )
|
||||||
{
|
{
|
||||||
StopVProfData();
|
|
||||||
Cmd_SetRptActive( false );
|
Cmd_SetRptActive( false );
|
||||||
BaseClass::OnSocketClosed( hSocket, netAdr, pData );
|
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 );
|
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
|
#ifdef ENABLE_RPT
|
||||||
CON_COMMAND_F( rpt_screenshot, "", FCVAR_HIDDEN | FCVAR_DONTRECORD )
|
CON_COMMAND_F( rpt_screenshot, "", FCVAR_HIDDEN | FCVAR_DONTRECORD )
|
||||||
{
|
{
|
||||||
@ -454,22 +323,6 @@ void CRConClient::ParseReceivedData()
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
case SERVERDATA_RESPONSE_STRING:
|
||||||
{
|
{
|
||||||
char pBuf[2048];
|
char pBuf[2048];
|
||||||
@ -706,45 +559,6 @@ void CRConClient::SendCmd( const char *msg )
|
|||||||
SendResponse( response );
|
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
|
// Purpose: get data from the server
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -27,47 +27,6 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#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
|
class CRConClient : public ISocketCreatorListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -89,10 +48,6 @@ public:
|
|||||||
bool IsConnected() const;
|
bool IsConnected() const;
|
||||||
bool IsAuthenticated() const { return m_bAuthenticated; }
|
bool IsAuthenticated() const { return m_bAuthenticated; }
|
||||||
|
|
||||||
void RegisterVProfDataCallback( IVProfData *callback );
|
|
||||||
void StopVProfData();
|
|
||||||
void StartVProfData();
|
|
||||||
|
|
||||||
void TakeScreenshot();
|
void TakeScreenshot();
|
||||||
void GrabConsoleLog();
|
void GrabConsoleLog();
|
||||||
|
|
||||||
@ -116,7 +71,6 @@ private:
|
|||||||
void SaveRemoteScreenshot( const void* pBuffer, int nBufLen );
|
void SaveRemoteScreenshot( const void* pBuffer, int nBufLen );
|
||||||
void SaveRemoteConsoleLog( const void* pBuffer, int nBufLen );
|
void SaveRemoteConsoleLog( const void* pBuffer, int nBufLen );
|
||||||
|
|
||||||
CRConVProfExport m_VProfExport;
|
|
||||||
CSocketCreator m_Socket;
|
CSocketCreator m_Socket;
|
||||||
netadr_t m_Address;
|
netadr_t m_Address;
|
||||||
int m_iAuthRequestID;
|
int m_iAuthRequestID;
|
||||||
|
@ -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
|
// 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)
|
// less likely to trigger OS "not responding" warnings)
|
||||||
extern void V_RenderVGuiOnly();
|
// extern void V_RenderVGuiOnly();
|
||||||
V_RenderVGuiOnly();
|
// V_RenderVGuiOnly();
|
||||||
|
|
||||||
// Before we do anything with the whitelist, make sure we have the proper map pack mounted
|
// 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.
|
// this will load the .bsp by setting the world model the string list at the hardcoded index 1.
|
||||||
cl.SetModel( 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,
|
// 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.
|
// the client may have loaded some files w/o the proper whitelist restrictions and we'd have to reload them.
|
||||||
|
@ -579,7 +579,7 @@ void Cmd_Exec_f( const CCommand &args )
|
|||||||
|
|
||||||
const char *szFile = args[1];
|
const char *szFile = args[1];
|
||||||
|
|
||||||
const char *pPathID = "MOD";
|
const char *pPathID = "*";
|
||||||
|
|
||||||
Q_snprintf( fileName, sizeof( fileName ), "//%s/cfg/%s", pPathID, szFile );
|
Q_snprintf( fileName, sizeof( fileName ), "//%s/cfg/%s", pPathID, szFile );
|
||||||
Q_DefaultExtension( fileName, ".cfg", sizeof( fileName ) );
|
Q_DefaultExtension( fileName, ".cfg", sizeof( fileName ) );
|
||||||
@ -624,12 +624,13 @@ void Cmd_Exec_f( const CCommand &args )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[16384] = { 0 };
|
char *buf = new char[16384];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
char *f = (char *)COM_LoadStackFile( fileName, buf, sizeof( buf ), len );
|
char *f = (char *)COM_LoadStackFile( fileName, buf, 16384, len );
|
||||||
if ( !f )
|
if ( !f )
|
||||||
{
|
{
|
||||||
ConMsg( "exec: couldn't exec %s\n", szFile );
|
ConMsg( "exec: couldn't exec %s\n", szFile );
|
||||||
|
delete[] buf;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,7 +646,7 @@ void Cmd_Exec_f( const CCommand &args )
|
|||||||
ConDMsg( "execing %s\n", szFile );
|
ConDMsg( "execing %s\n", szFile );
|
||||||
|
|
||||||
// check to make sure we're not going to overflow the cmd_text buffer
|
// 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
|
// Execute each command immediately
|
||||||
const char *pszDataPtr = f;
|
const char *pszDataPtr = f;
|
||||||
@ -684,6 +685,9 @@ void Cmd_Exec_f( const CCommand &args )
|
|||||||
free( f );
|
free( f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] buf;
|
||||||
|
|
||||||
// force any queued convar changes to flush before reading/writing them
|
// force any queued convar changes to flush before reading/writing them
|
||||||
UpdateMaterialSystemConfig();
|
UpdateMaterialSystemConfig();
|
||||||
}
|
}
|
||||||
|
@ -2677,6 +2677,9 @@ int CM_BoxVisible( const Vector& mins, const Vector& maxs, const byte *visbi
|
|||||||
int cluster = CM_LeafCluster( leafList[i] );
|
int cluster = CM_LeafCluster( leafList[i] );
|
||||||
int offset = cluster>>3;
|
int offset = cluster>>3;
|
||||||
|
|
||||||
|
if( offset == -1 )
|
||||||
|
return true;
|
||||||
|
|
||||||
if ( offset > vissize )
|
if ( offset > vissize )
|
||||||
{
|
{
|
||||||
Sys_Error( "CM_BoxVisible: cluster %i, offset %i out of bounds %i\n", cluster, offset, vissize );
|
Sys_Error( "CM_BoxVisible: cluster %i, offset %i out of bounds %i\n", cluster, offset, vissize );
|
||||||
|
@ -288,7 +288,7 @@ bool CollisionBSPData_Load( const char *pName, CCollisionBSPData *pBSPData )
|
|||||||
CollisionBSPData_LoadPhysics( pBSPData );
|
CollisionBSPData_LoadPhysics( pBSPData );
|
||||||
|
|
||||||
COM_TimestampedLog( " CollisionBSPData_LoadDispInfo" );
|
COM_TimestampedLog( " CollisionBSPData_LoadDispInfo" );
|
||||||
CollisionBSPData_LoadDispInfo( pBSPData );
|
CollisionBSPData_LoadDispInfo( pBSPData );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1110,7 +1110,7 @@ void CollisionBSPData_LoadDispInfo( CCollisionBSPData *pBSPData )
|
|||||||
// get face data
|
// get face data
|
||||||
//
|
//
|
||||||
int face_lump_to_load = LUMP_FACES;
|
int face_lump_to_load = LUMP_FACES;
|
||||||
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
|
if ( g_pMaterialSystemHardwareConfig->GetHDREnabled() && /*g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&*/
|
||||||
CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
|
CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
|
||||||
{
|
{
|
||||||
face_lump_to_load = LUMP_FACES_HDR;
|
face_lump_to_load = LUMP_FACES_HDR;
|
||||||
|
@ -228,7 +228,7 @@ public:
|
|||||||
// Fill out the meshlist for this terrain patch
|
// Fill out the meshlist for this terrain patch
|
||||||
virtual void GetVirtualMesh( void *userData, virtualmeshlist_t *pList )
|
virtual void GetVirtualMesh( void *userData, virtualmeshlist_t *pList )
|
||||||
{
|
{
|
||||||
int index = (int)userData;
|
intp index = (intp)userData;
|
||||||
Assert(index >= 0 && index < g_DispCollTreeCount );
|
Assert(index >= 0 && index < g_DispCollTreeCount );
|
||||||
g_pDispCollTrees[index].GetVirtualMeshList( pList );
|
g_pDispCollTrees[index].GetVirtualMeshList( pList );
|
||||||
pList->pHull = NULL;
|
pList->pHull = NULL;
|
||||||
@ -243,14 +243,14 @@ public:
|
|||||||
// returns the bounds for the terrain patch
|
// returns the bounds for the terrain patch
|
||||||
virtual void GetWorldspaceBounds( void *userData, Vector *pMins, Vector *pMaxs )
|
virtual void GetWorldspaceBounds( void *userData, Vector *pMins, Vector *pMaxs )
|
||||||
{
|
{
|
||||||
int index = (int)userData;
|
intp index = (intp)userData;
|
||||||
*pMins = g_pDispBounds[index].mins;
|
*pMins = g_pDispBounds[index].mins;
|
||||||
*pMaxs = g_pDispBounds[index].maxs;
|
*pMaxs = g_pDispBounds[index].maxs;
|
||||||
}
|
}
|
||||||
// Query against the AABB tree to find the list of triangles for this patch in a sphere
|
// Query against the AABB tree to find the list of triangles for this patch in a sphere
|
||||||
virtual void GetTrianglesInSphere( void *userData, const Vector ¢er, float radius, virtualmeshtrianglelist_t *pList )
|
virtual void GetTrianglesInSphere( void *userData, const Vector ¢er, float radius, virtualmeshtrianglelist_t *pList )
|
||||||
{
|
{
|
||||||
int index = (int)userData;
|
intp index = (intp)userData;
|
||||||
pList->triangleCount = g_pDispCollTrees[index].AABBTree_GetTrisInSphere( center, radius, pList->triangleIndices, ARRAYSIZE(pList->triangleIndices) );
|
pList->triangleCount = g_pDispCollTrees[index].AABBTree_GetTrisInSphere( center, radius, pList->triangleIndices, ARRAYSIZE(pList->triangleIndices) );
|
||||||
}
|
}
|
||||||
void LevelInit( dphysdisp_t *pLump, int lumpSize )
|
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_VirtualTerrain.LevelInit(pDispLump, dispLumpSize);
|
||||||
g_TerrainList.SetCount( g_DispCollTreeCount );
|
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.
|
// Don't create a physics collision model for displacements that have been tagged as such.
|
||||||
CDispCollTree *pDispTree = &g_pDispCollTrees[i];
|
CDispCollTree *pDispTree = &g_pDispCollTrees[i];
|
||||||
|
@ -4895,7 +4895,7 @@ void CColorOperationListPanel::PopulateList( )
|
|||||||
KeyValues *kv = new KeyValues( "operation", "layer", op->GetName() );
|
KeyValues *kv = new KeyValues( "operation", "layer", op->GetName() );
|
||||||
kv->SetInt( "image", (op->IsEnabled())?1:0 );
|
kv->SetInt( "image", (op->IsEnabled())?1:0 );
|
||||||
|
|
||||||
m_pOperationListPanel->AddItem( kv, (unsigned int)op, false, false );
|
m_pOperationListPanel->AddItem( kv, (uintp)op, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,11 @@
|
|||||||
#include <characterset.h>
|
#include <characterset.h>
|
||||||
#include <bitbuf.h>
|
#include <bitbuf.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#ifdef OSX
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#include "traceinit.h"
|
#include "traceinit.h"
|
||||||
#include <filesystem.h>
|
#include <filesystem.h>
|
||||||
#include "filesystem_engine.h"
|
#include "filesystem_engine.h"
|
||||||
|
@ -479,7 +479,7 @@ Handles cursor positioning, line wrapping, etc
|
|||||||
*/
|
*/
|
||||||
static bool g_fColorPrintf = false;
|
static bool g_fColorPrintf = false;
|
||||||
static bool g_bInColorPrint = false;
|
static bool g_bInColorPrint = false;
|
||||||
extern CThreadLocalInt<> g_bInSpew;
|
extern CTHREADLOCALINT g_bInSpew;
|
||||||
|
|
||||||
void Con_Printf( const char *fmt, ... );
|
void Con_Printf( const char *fmt, ... );
|
||||||
|
|
||||||
@ -865,6 +865,7 @@ CConPanel::CConPanel( vgui::Panel *parent ) : CBasePanel( parent, "CConPanel" )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
CConPanel::~CConPanel( void )
|
CConPanel::~CConPanel( void )
|
||||||
{
|
{
|
||||||
|
g_pConPanel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConPanel::Con_NPrintf( int idx, const char *msg )
|
void CConPanel::Con_NPrintf( int idx, const char *msg )
|
||||||
|
@ -14,7 +14,11 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "filesystem_engine.h"
|
#include "filesystem_engine.h"
|
||||||
#include "materialsystem/imaterial.h"
|
#include "materialsystem/imaterial.h"
|
||||||
|
#ifdef OSX
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#include "utldict.h"
|
#include "utldict.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
|
@ -547,9 +547,9 @@ bool CDispInfo::Render( CGroupMesh *pGroup, bool bAllowDebugModes )
|
|||||||
VectorAdd( bbMin, bbMax, vecCenter );
|
VectorAdd( bbMin, bbMax, vecCenter );
|
||||||
vecCenter *= 0.5f;
|
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];
|
char buf[32];
|
||||||
Q_snprintf( buf, sizeof( buf ), "%d", nInt );
|
Q_snprintf( buf, sizeof( buf ), "%d", (int)nInt );
|
||||||
CDebugOverlay::AddTextOverlay( vecCenter, 0, buf );
|
CDebugOverlay::AddTextOverlay( vecCenter, 0, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ void DispInfo_BatchDecals( CDispInfo **pVisibleDisps, int nVisibleDisps )
|
|||||||
// There is only one group at a time.
|
// There is only one group at a time.
|
||||||
int iGroup = 0;
|
int iGroup = 0;
|
||||||
|
|
||||||
int iPool = g_aDispDecalSortPool.Alloc( true );
|
intp iPool = g_aDispDecalSortPool.Alloc( true );
|
||||||
g_aDispDecalSortPool[iPool] = decal.m_pDecal;
|
g_aDispDecalSortPool[iPool] = decal.m_pDecal;
|
||||||
|
|
||||||
int iSortTree = decal.m_pDecal->m_iSortTree;
|
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 );
|
DecalMaterialBucket_t &materialBucket = g_aDispDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iSortMaterial );
|
||||||
if ( materialBucket.m_nCheckCount == g_nDispDecalSortCheckCount )
|
if ( materialBucket.m_nCheckCount == g_nDispDecalSortCheckCount )
|
||||||
{
|
{
|
||||||
int iHead = materialBucket.m_iHead;
|
intp iHead = materialBucket.m_iHead;
|
||||||
g_aDispDecalSortPool.LinkBefore( iHead, iPool );
|
g_aDispDecalSortPool.LinkBefore( iHead, iPool );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,7 +844,7 @@ void DispInfo_DrawDecalsGroup( int iGroup, int iTreeType )
|
|||||||
if ( materialBucketList.Element( iBucket ).m_nCheckCount != g_nDispDecalSortCheckCount )
|
if ( materialBucketList.Element( iBucket ).m_nCheckCount != g_nDispDecalSortCheckCount )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int iHead = materialBucketList.Element( iBucket ).m_iHead;
|
intp iHead = materialBucketList.Element( iBucket ).m_iHead;
|
||||||
if ( !g_aDispDecalSortPool.IsValidIndex( iHead ) )
|
if ( !g_aDispDecalSortPool.IsValidIndex( iHead ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -863,7 +863,7 @@ void DispInfo_DrawDecalsGroup( int iGroup, int iTreeType )
|
|||||||
bool bBatchInit = true;
|
bool bBatchInit = true;
|
||||||
|
|
||||||
int nCount;
|
int nCount;
|
||||||
int iElement = iHead;
|
intp iElement = iHead;
|
||||||
while ( iElement != g_aDispDecalSortPool.InvalidIndex() )
|
while ( iElement != g_aDispDecalSortPool.InvalidIndex() )
|
||||||
{
|
{
|
||||||
decal_t *pDecal = g_aDispDecalSortPool.Element( iElement );
|
decal_t *pDecal = g_aDispDecalSortPool.Element( iElement );
|
||||||
@ -1300,7 +1300,7 @@ int DispInfo_ComputeIndex( HDISPINFOARRAY hArray, IDispInfo* pInfo )
|
|||||||
if( !pArray )
|
if( !pArray )
|
||||||
return NULL;
|
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 );
|
Assert( iElement >= 0 && iElement < pArray->m_nDispInfos );
|
||||||
return iElement;
|
return iElement;
|
||||||
|
@ -924,14 +924,14 @@ void CDownloadManager::StartNewDownload()
|
|||||||
m_lastPercent = 0;
|
m_lastPercent = 0;
|
||||||
|
|
||||||
// Start the thread
|
// Start the thread
|
||||||
DWORD threadID;
|
uintp threadID;
|
||||||
VCRHook_CreateThread(NULL, 0,
|
VCRHook_CreateThread(NULL, 0,
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
(void *)
|
(void *)
|
||||||
#endif
|
#endif
|
||||||
DownloadThread, m_activeRequest, 0, (unsigned long int *)&threadID );
|
DownloadThread, m_activeRequest, 0, &threadID );
|
||||||
|
|
||||||
ThreadDetach( ( ThreadHandle_t )threadID );
|
ReleaseThreadHandle( ( ThreadHandle_t )threadID );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1070,16 +1070,16 @@ bool CL_IsGamePathValidAndSafeForDownload( const char *pGamePath )
|
|||||||
class CDownloadSystem : public IDownloadSystem
|
class CDownloadSystem : public IDownloadSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual DWORD CreateDownloadThread( RequestContext_t *pContext )
|
virtual uintp CreateDownloadThread( RequestContext_t *pContext )
|
||||||
{
|
{
|
||||||
DWORD nThreadID;
|
uintp nThreadID;
|
||||||
VCRHook_CreateThread(NULL, 0,
|
VCRHook_CreateThread(NULL, 0,
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
(void*)
|
(void*)
|
||||||
#endif
|
#endif
|
||||||
DownloadThread, pContext, 0, (unsigned long int *)&nThreadID );
|
DownloadThread, pContext, 0, (uintp *)&nThreadID );
|
||||||
|
|
||||||
ThreadDetach( ( ThreadHandle_t )nThreadID );
|
ReleaseThreadHandle( ( ThreadHandle_t )nThreadID );
|
||||||
return nThreadID;
|
return nThreadID;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ void EncodeFloat( const SendProp *pProp, float fVal, bf_write *pOut, int objectI
|
|||||||
}
|
}
|
||||||
else // standard clamped-range float
|
else // standard clamped-range float
|
||||||
{
|
{
|
||||||
unsigned long ulVal;
|
unsigned int ulVal;
|
||||||
int nBits = pProp->m_nBits;
|
int nBits = pProp->m_nBits;
|
||||||
if ( flags & SPROP_NOSCALE )
|
if ( flags & SPROP_NOSCALE )
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ static float DecodeFloat(SendProp const *pProp, bf_read *pIn)
|
|||||||
}
|
}
|
||||||
else // standard clamped-range float
|
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);
|
float fVal = (float)dwInterp / ((1 << pProp->m_nBits) - 1);
|
||||||
fVal = pProp->m_fLowValue + (pProp->m_fHighValue - pProp->m_fLowValue) * fVal;
|
fVal = pProp->m_fLowValue + (pProp->m_fHighValue - pProp->m_fLowValue) * fVal;
|
||||||
return fVal;
|
return fVal;
|
||||||
@ -281,7 +281,7 @@ void Int_Decode( DecodeInfo *pInfo )
|
|||||||
{
|
{
|
||||||
if ( flags & SPROP_UNSIGNED )
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -295,7 +295,7 @@ void Int_Decode( DecodeInfo *pInfo )
|
|||||||
|
|
||||||
if( bits != 32 && (flags & SPROP_UNSIGNED) == 0 )
|
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 )
|
if ( pInfo->m_Value.m_Int & highbit )
|
||||||
{
|
{
|
||||||
pInfo->m_Value.m_Int -= highbit; // strip high bit...
|
pInfo->m_Value.m_Int -= highbit; // strip high bit...
|
||||||
|
@ -175,12 +175,12 @@ void BuildPropOffsetToIndexMap( CSendTablePrecalc *pPrecalc, const CStandardSend
|
|||||||
{
|
{
|
||||||
const SendProp *pProp = pPrecalc->m_Props[i];
|
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 elementCount = 1;
|
||||||
int elementStride = 0;
|
int elementStride = 0;
|
||||||
if ( pProp->GetType() == DPT_Array )
|
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;
|
elementCount = pProp->m_nElements;
|
||||||
elementStride = pProp->m_ElementStride;
|
elementStride = pProp->m_ElementStride;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ inline unsigned char* UpdateRoutesExplicit_Template( DTStack *pStack, ProxyCalle
|
|||||||
// Early out.
|
// Early out.
|
||||||
unsigned short iPropProxyIndex = pStack->m_pPrecalc->m_PropProxyIndices[pStack->m_iCurProp];
|
unsigned short iPropProxyIndex = pStack->m_pPrecalc->m_PropProxyIndices[pStack->m_iCurProp];
|
||||||
unsigned char **pTest = &pStack->m_pProxies[iPropProxyIndex];
|
unsigned char **pTest = &pStack->m_pProxies[iPropProxyIndex];
|
||||||
if ( *pTest != (unsigned char*)0xFFFFFFFF )
|
if ( *pTest != (unsigned char*)-1 )
|
||||||
return *pTest;
|
return *pTest;
|
||||||
|
|
||||||
// Ok.. setup this proxy.
|
// 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];
|
CSendTablePrecalc::CProxyPathEntry *pEntry = &pStack->m_pPrecalc->m_ProxyPathEntries[proxyPath.m_iFirstEntry + i];
|
||||||
int iProxy = pEntry->m_iProxy;
|
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 );
|
pStack->m_pProxies[iProxy] = ProxyCaller::CallProxy( pStack, pStructBase, pEntry->m_iDatatableProp );
|
||||||
if ( !pStack->m_pProxies[iProxy] )
|
if ( !pStack->m_pProxies[iProxy] )
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
{
|
{
|
||||||
if ( pData )
|
if ( pData )
|
||||||
{
|
{
|
||||||
delete pData;
|
delete[] pData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
pSendTable = src.pSendTable;
|
pSendTable = src.pSendTable;
|
||||||
pClientClass = src.pClientClass;
|
pClientClass = src.pClientClass;
|
||||||
filter.AddPlayersFromFilter( &src.filter );
|
filter.AddPlayersFromFilter( &src.filter );
|
||||||
|
|
||||||
if ( src.pData )
|
if ( src.pData )
|
||||||
{
|
{
|
||||||
int size = Bits2Bytes( src.bits );
|
int size = Bits2Bytes( src.bits );
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "quakedef.h" // for MAX_OSPATH
|
#include "quakedef.h" // for MAX_OSPATH
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "bitmap/tgawriter.h"
|
#include "bitmap/tgawriter.h"
|
||||||
#include <tier2/tier2.h>
|
#include <tier2/tier2.h>
|
||||||
|
@ -4099,7 +4099,9 @@ CBrushBatchRender::brushrender_t *CBrushBatchRender::FindOrCreateRenderBatch( mo
|
|||||||
surfaceList.Sort( SurfaceCmp );
|
surfaceList.Sort( SurfaceCmp );
|
||||||
renderT.pPlanes = new cplane_t *[planeList.Count()];
|
renderT.pPlanes = new cplane_t *[planeList.Count()];
|
||||||
renderT.planeCount = 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.pSurfaces = new brushrendersurface_t[surfaceList.Count()];
|
||||||
renderT.surfaceCount = surfaceList.Count();
|
renderT.surfaceCount = surfaceList.Count();
|
||||||
|
|
||||||
@ -4745,7 +4747,7 @@ struct EnumLeafBoxInfo_t
|
|||||||
VectorAligned m_vecBoxCenter;
|
VectorAligned m_vecBoxCenter;
|
||||||
VectorAligned m_vecBoxHalfDiagonal;
|
VectorAligned m_vecBoxHalfDiagonal;
|
||||||
ISpatialLeafEnumerator *m_pIterator;
|
ISpatialLeafEnumerator *m_pIterator;
|
||||||
int m_nContext;
|
intp m_nContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EnumLeafSphereInfo_t
|
struct EnumLeafSphereInfo_t
|
||||||
@ -4755,7 +4757,7 @@ struct EnumLeafSphereInfo_t
|
|||||||
Vector m_vecBoxCenter;
|
Vector m_vecBoxCenter;
|
||||||
Vector m_vecBoxHalfDiagonal;
|
Vector m_vecBoxHalfDiagonal;
|
||||||
ISpatialLeafEnumerator *m_pIterator;
|
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,
|
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)
|
// no polygons in solid nodes (don't report these leaves either)
|
||||||
if (node->contents == CONTENTS_SOLID)
|
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,
|
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)
|
// no polygons in solid nodes (don't report these leaves either)
|
||||||
if (node->contents == CONTENTS_SOLID)
|
if (node->contents == CONTENTS_SOLID)
|
||||||
@ -5274,10 +5276,10 @@ public:
|
|||||||
int LeafCount() const;
|
int LeafCount() const;
|
||||||
|
|
||||||
// Enumerates the leaves along a ray, box, etc.
|
// Enumerates the leaves along a ray, box, etc.
|
||||||
bool EnumerateLeavesAtPoint( const Vector& pt, ISpatialLeafEnumerator* pEnum, int context );
|
bool EnumerateLeavesAtPoint( const Vector& pt, ISpatialLeafEnumerator* pEnum, intp context );
|
||||||
bool EnumerateLeavesInBox( const Vector& mins, const Vector& maxs, ISpatialLeafEnumerator* pEnum, int context );
|
bool EnumerateLeavesInBox( const Vector& mins, const Vector& maxs, ISpatialLeafEnumerator* pEnum, intp context );
|
||||||
bool EnumerateLeavesInSphere( const Vector& center, float radius, ISpatialLeafEnumerator* pEnum, int context );
|
bool EnumerateLeavesInSphere( const Vector& center, float radius, ISpatialLeafEnumerator* pEnum, intp context );
|
||||||
bool EnumerateLeavesAlongRay( Ray_t const& ray, ISpatialLeafEnumerator* pEnum, int 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,
|
bool CEngineBSPTree::EnumerateLeavesAtPoint( const Vector& pt,
|
||||||
ISpatialLeafEnumerator* pEnum, int context )
|
ISpatialLeafEnumerator* pEnum, intp context )
|
||||||
{
|
{
|
||||||
int leaf = CM_PointLeafnum( pt );
|
int leaf = CM_PointLeafnum( pt );
|
||||||
return pEnum->EnumerateLeaf( leaf, context );
|
return pEnum->EnumerateLeaf( leaf, context );
|
||||||
@ -5313,7 +5315,7 @@ static ConVar opt_EnumerateLeavesFastAlgorithm( "opt_EnumerateLeavesFastAlgorith
|
|||||||
|
|
||||||
|
|
||||||
bool CEngineBSPTree::EnumerateLeavesInBox( const Vector& mins, const Vector& maxs,
|
bool CEngineBSPTree::EnumerateLeavesInBox( const Vector& mins, const Vector& maxs,
|
||||||
ISpatialLeafEnumerator* pEnum, int context )
|
ISpatialLeafEnumerator* pEnum, intp context )
|
||||||
{
|
{
|
||||||
if ( !host_state.worldmodel )
|
if ( !host_state.worldmodel )
|
||||||
return false;
|
return false;
|
||||||
@ -5338,7 +5340,7 @@ bool CEngineBSPTree::EnumerateLeavesInBox( const Vector& mins, const Vector& max
|
|||||||
|
|
||||||
|
|
||||||
bool CEngineBSPTree::EnumerateLeavesInSphere( const Vector& center, float radius,
|
bool CEngineBSPTree::EnumerateLeavesInSphere( const Vector& center, float radius,
|
||||||
ISpatialLeafEnumerator* pEnum, int context )
|
ISpatialLeafEnumerator* pEnum, intp context )
|
||||||
{
|
{
|
||||||
EnumLeafSphereInfo_t info;
|
EnumLeafSphereInfo_t info;
|
||||||
info.m_vecCenter = center;
|
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)
|
if (!ray.m_IsSwept)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "networkstringtableclient.h"
|
#include "networkstringtableclient.h"
|
||||||
|
#include "vcrmode.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
@ -2750,10 +2750,6 @@ void CheckSpecialCheatVars()
|
|||||||
if ( !mat_picmip )
|
if ( !mat_picmip )
|
||||||
mat_picmip = g_pCVar->FindVar( "mat_picmip" );
|
mat_picmip = g_pCVar->FindVar( "mat_picmip" );
|
||||||
|
|
||||||
// In multiplayer, don't allow them to set mat_picmip > 2.
|
|
||||||
if ( mat_picmip )
|
|
||||||
CheckVarRange_Generic( mat_picmip, -1, 2 );
|
|
||||||
|
|
||||||
CheckVarRange_r_rootlod();
|
CheckVarRange_r_rootlod();
|
||||||
CheckVarRange_r_lod();
|
CheckVarRange_r_lod();
|
||||||
HandleServerAllowColorCorrection();
|
HandleServerAllowColorCorrection();
|
||||||
@ -4850,7 +4846,9 @@ void Host_FreeToLowMark( bool server )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Host_Shutdown(void)
|
void Host_Shutdown(void)
|
||||||
{
|
{
|
||||||
|
#ifndef ANDROID
|
||||||
extern void ShutdownMixerControls();
|
extern void ShutdownMixerControls();
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( host_checkheap )
|
if ( host_checkheap )
|
||||||
{
|
{
|
||||||
@ -4962,7 +4960,7 @@ void Host_Shutdown(void)
|
|||||||
|
|
||||||
#ifndef SWDS
|
#ifndef SWDS
|
||||||
TRACESHUTDOWN( Key_Shutdown() );
|
TRACESHUTDOWN( Key_Shutdown() );
|
||||||
#ifndef _X360
|
#if !defined _X360 && !defined ANDROID
|
||||||
TRACESHUTDOWN( ShutdownMixerControls() );
|
TRACESHUTDOWN( ShutdownMixerControls() );
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -806,7 +806,8 @@ int CSaveRestore::SaveGameSlot( const char *pSaveName, const char *pSaveComment,
|
|||||||
m_bWaitingForSafeDangerousSave = bIsAutosaveDangerous;
|
m_bWaitingForSafeDangerousSave = bIsAutosaveDangerous;
|
||||||
|
|
||||||
int iHeaderBufferSize = 64 + tokenSize + pSaveData->GetCurPos();
|
int iHeaderBufferSize = 64 + tokenSize + pSaveData->GetCurPos();
|
||||||
void *pMem = malloc(iHeaderBufferSize);
|
void *pMem = new char[iHeaderBufferSize];
|
||||||
|
|
||||||
CUtlBuffer saveHeader( pMem, iHeaderBufferSize );
|
CUtlBuffer saveHeader( pMem, iHeaderBufferSize );
|
||||||
|
|
||||||
// Write the header -- THIS SHOULD NEVER CHANGE STRUCTURE, USE SAVE_HEADER FOR NEW HEADER INFORMATION
|
// Write the header -- THIS SHOULD NEVER CHANGE STRUCTURE, USE SAVE_HEADER FOR NEW HEADER INFORMATION
|
||||||
|
@ -872,7 +872,7 @@ public:
|
|||||||
virtual void SetupLighting( const Vector &vecCenter );
|
virtual void SetupLighting( const Vector &vecCenter );
|
||||||
virtual void SuppressEngineLighting( bool bSuppress );
|
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();
|
bool Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
@ -3637,12 +3637,12 @@ void CModelRender::ValidateStaticPropColorData( ModelInstanceHandle_t handle )
|
|||||||
// fetch the header
|
// fetch the header
|
||||||
CUtlBuffer utlBuf;
|
CUtlBuffer utlBuf;
|
||||||
char fileName[MAX_PATH];
|
char fileName[MAX_PATH];
|
||||||
if ( g_pMaterialSystemHardwareConfig->GetHDRType() == HDR_TYPE_NONE || g_bBakedPropLightingNoSeparateHDR )
|
if ( !g_pMaterialSystemHardwareConfig->GetHDREnabled() || g_bBakedPropLightingNoSeparateHDR )
|
||||||
{
|
{
|
||||||
Q_snprintf( fileName, sizeof( fileName ), "sp_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
Q_snprintf( fileName, sizeof( fileName ), "sp_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Q_snprintf( fileName, sizeof( fileName ), "sp_hdr_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
Q_snprintf( fileName, sizeof( fileName ), "sp_hdr_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3930,13 +3930,13 @@ bool CModelRender::LoadStaticPropColorData( IHandleEntity *pProp, DataCacheHandl
|
|||||||
|
|
||||||
// each static prop has its own compiled color mesh
|
// each static prop has its own compiled color mesh
|
||||||
char fileName[MAX_PATH];
|
char fileName[MAX_PATH];
|
||||||
if ( g_pMaterialSystemHardwareConfig->GetHDRType() == HDR_TYPE_NONE || g_bBakedPropLightingNoSeparateHDR )
|
if ( !g_pMaterialSystemHardwareConfig->GetHDREnabled() || g_bBakedPropLightingNoSeparateHDR )
|
||||||
{
|
{
|
||||||
Q_snprintf( fileName, sizeof( fileName ), "sp_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
Q_snprintf( fileName, sizeof( fileName ), "sp_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Q_snprintf( fileName, sizeof( fileName ), "sp_hdr_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
Q_snprintf( fileName, sizeof( fileName ), "sp_hdr_%d%s.vhv", StaticPropMgr()->GetStaticPropIndex( pProp ), GetPlatformExt() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark as invalid, async callback will set upon completion
|
// mark as invalid, async callback will set upon completion
|
||||||
@ -4121,7 +4121,7 @@ bool CModelRender::UpdateStaticPropColorData( IHandleEntity *pProp, ModelInstanc
|
|||||||
if ( !bDebugColor )
|
if ( !bDebugColor )
|
||||||
{
|
{
|
||||||
// vertexes must be available for lighting calculation
|
// 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 )
|
if ( !pVertexHdr )
|
||||||
{
|
{
|
||||||
// data not available yet
|
// data not available yet
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
//=============================================================================//
|
//=============================================================================//
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "materialsystem/imaterialproxy.h"
|
#include "materialsystem/imaterialproxy.h"
|
||||||
#include "materialproxyfactory.h"
|
#include "materialproxyfactory.h"
|
||||||
|
@ -251,6 +251,9 @@ static const char *s_pRegistryConVars[] =
|
|||||||
#if defined( OSX )
|
#if defined( OSX )
|
||||||
#define MOD_VIDEO_CONFIG_SETTINGS "videoconfig_mac.cfg"
|
#define MOD_VIDEO_CONFIG_SETTINGS "videoconfig_mac.cfg"
|
||||||
#define USE_VIDEOCONFIG_FILE 1
|
#define USE_VIDEOCONFIG_FILE 1
|
||||||
|
#elif defined( ANDROID )
|
||||||
|
#define MOD_VIDEO_CONFIG_SETTINGS "videoconfig_android.cfg"
|
||||||
|
#define USE_VIDEOCONFIG_FILE 1
|
||||||
#elif defined( POSIX )
|
#elif defined( POSIX )
|
||||||
#define MOD_VIDEO_CONFIG_SETTINGS "videoconfig_linux.cfg"
|
#define MOD_VIDEO_CONFIG_SETTINGS "videoconfig_linux.cfg"
|
||||||
#define USE_VIDEOCONFIG_FILE 1
|
#define USE_VIDEOCONFIG_FILE 1
|
||||||
|
@ -483,7 +483,8 @@ void CMapLoadHelper::Init( model_t *pMapModel, const char *loadname )
|
|||||||
|
|
||||||
s_pMap = &g_ModelLoader.m_worldBrushData;
|
s_pMap = &g_ModelLoader.m_worldBrushData;
|
||||||
|
|
||||||
#if 0
|
// nillerusr: Fuck you johns
|
||||||
|
|
||||||
// XXX(johns): There are security issues with this system currently. sv_pure doesn't handle unexpected/mismatched
|
// XXX(johns): There are security issues with this system currently. sv_pure doesn't handle unexpected/mismatched
|
||||||
// lumps, so players can create lumps for maps not using them to wallhack/etc.. Currently unused,
|
// lumps, so players can create lumps for maps not using them to wallhack/etc.. Currently unused,
|
||||||
// disabling until we have time to make a proper security pass.
|
// disabling until we have time to make a proper security pass.
|
||||||
@ -530,7 +531,6 @@ void CMapLoadHelper::Init( model_t *pMapModel, const char *loadname )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1038,7 +1038,7 @@ bool Map_CheckForHDR( model_t *pModel, const char *pLoadName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool bEnableHDR = ( IsX360() && bHasHDR ) ||
|
bool bEnableHDR = ( IsX360() && bHasHDR ) ||
|
||||||
( bHasHDR && ( mat_hdr_level.GetInt() >= 2 ) &&
|
( bHasHDR &&
|
||||||
( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 90 ) );
|
( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 90 ) );
|
||||||
|
|
||||||
EnableHDR( bEnableHDR );
|
EnableHDR( bEnableHDR );
|
||||||
@ -1831,7 +1831,7 @@ void *Hunk_AllocNameAlignedClear_( int size, int alignment, const char *pHunkNam
|
|||||||
Assert(IsPowerOfTwo(alignment));
|
Assert(IsPowerOfTwo(alignment));
|
||||||
void *pMem = Hunk_AllocName( alignment + size, pHunkName );
|
void *pMem = Hunk_AllocName( alignment + size, pHunkName );
|
||||||
memset( pMem, 0, size + alignment );
|
memset( pMem, 0, size + alignment );
|
||||||
pMem = (void *)( ( ( ( unsigned long )pMem ) + (alignment-1) ) & ~(alignment-1) );
|
pMem = (void *)( ( ( ( uintp )pMem ) + (alignment-1) ) & ~(alignment-1) );
|
||||||
|
|
||||||
return pMem;
|
return pMem;
|
||||||
}
|
}
|
||||||
@ -1856,8 +1856,7 @@ void Mod_LoadFaces( void )
|
|||||||
int ti, di;
|
int ti, di;
|
||||||
|
|
||||||
int face_lump_to_load = LUMP_FACES;
|
int face_lump_to_load = LUMP_FACES;
|
||||||
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
|
if ( g_pMaterialSystemHardwareConfig->GetHDREnabled() && CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
|
||||||
CMapLoadHelper::LumpSize( LUMP_FACES_HDR ) > 0 )
|
|
||||||
{
|
{
|
||||||
face_lump_to_load = LUMP_FACES_HDR;
|
face_lump_to_load = LUMP_FACES_HDR;
|
||||||
}
|
}
|
||||||
@ -1870,6 +1869,12 @@ void Mod_LoadFaces( void )
|
|||||||
|
|
||||||
// align these allocations
|
// align these allocations
|
||||||
// If you trip one of these, you need to rethink the alignment of the struct
|
// 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(msurface1_t) == 16 );
|
||||||
Assert( sizeof(msurface2_t) == 32 );
|
Assert( sizeof(msurface2_t) == 32 );
|
||||||
Assert( sizeof(msurfacelighting_t) == 32 );
|
Assert( sizeof(msurfacelighting_t) == 32 );
|
||||||
@ -1878,6 +1883,7 @@ void Mod_LoadFaces( void )
|
|||||||
msurface2_t *out2 = Hunk_AllocNameAlignedClear< msurface2_t >( count, 32, va( "%s [%s]", lh.GetLoadName(), "surface2" ) );
|
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" ) );
|
msurfacelighting_t *pLighting = Hunk_AllocNameAlignedClear< msurfacelighting_t >( count, 32, va( "%s [%s]", lh.GetLoadName(), "surfacelighting" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
lh.GetMap()->surfaces1 = out1;
|
lh.GetMap()->surfaces1 = out1;
|
||||||
lh.GetMap()->surfaces2 = out2;
|
lh.GetMap()->surfaces2 = out2;
|
||||||
@ -2289,8 +2295,7 @@ void Mod_LoadLeafs( void )
|
|||||||
Mod_LoadLeafs_Version_0( lh );
|
Mod_LoadLeafs_Version_0( lh );
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
|
if( g_pMaterialSystemHardwareConfig->GetHDREnabled() && CMapLoadHelper::LumpSize( LUMP_LEAF_AMBIENT_LIGHTING_HDR ) > 0 )
|
||||||
CMapLoadHelper::LumpSize( LUMP_LEAF_AMBIENT_LIGHTING_HDR ) > 0 )
|
|
||||||
{
|
{
|
||||||
CMapLoadHelper mlh( LUMP_LEAF_AMBIENT_LIGHTING_HDR );
|
CMapLoadHelper mlh( LUMP_LEAF_AMBIENT_LIGHTING_HDR );
|
||||||
CMapLoadHelper mlhTable( LUMP_LEAF_AMBIENT_INDEX_HDR );
|
CMapLoadHelper mlhTable( LUMP_LEAF_AMBIENT_INDEX_HDR );
|
||||||
@ -2385,7 +2390,7 @@ void Mod_LoadCubemapSamples( void )
|
|||||||
lh.GetMap()->m_pCubemapSamples = out;
|
lh.GetMap()->m_pCubemapSamples = out;
|
||||||
lh.GetMap()->m_nCubemapSamples = count;
|
lh.GetMap()->m_nCubemapSamples = count;
|
||||||
|
|
||||||
bool bHDR = g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
|
bool bHDR = g_pMaterialSystemHardwareConfig->GetHDREnabled(); //g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE;
|
||||||
int nCreateFlags = bHDR ? 0 : TEXTUREFLAGS_SRGB;
|
int nCreateFlags = bHDR ? 0 : TEXTUREFLAGS_SRGB;
|
||||||
|
|
||||||
// We have separate HDR versions of the textures. In order to deal with this,
|
// We have separate HDR versions of the textures. In order to deal with this,
|
||||||
@ -2862,7 +2867,7 @@ void Mod_TouchAllData( model_t *pModel, int nServerCount )
|
|||||||
// skip self, start at children
|
// skip self, start at children
|
||||||
for ( int i=1; i<pVirtualModel->m_group.Count(); ++i )
|
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 );
|
model_t *pChildModel = (model_t *)g_pMDLCache->GetUserData( childHandle );
|
||||||
if ( pChildModel )
|
if ( pChildModel )
|
||||||
{
|
{
|
||||||
@ -4327,7 +4332,7 @@ public:
|
|||||||
m_pShared = pBrush->brush.pShared;
|
m_pShared = pBrush->brush.pShared;
|
||||||
m_count = 0;
|
m_count = 0;
|
||||||
}
|
}
|
||||||
bool EnumerateLeaf( int leaf, int )
|
bool EnumerateLeaf( int leaf, intp )
|
||||||
{
|
{
|
||||||
// garymcthack - need to test identity brush models
|
// garymcthack - need to test identity brush models
|
||||||
int flags = ( m_pShared->leafs[leaf].leafWaterDataID == -1 ) ? SURFDRAW_ABOVEWATER : SURFDRAW_UNDERWATER;
|
int flags = ( m_pShared->leafs[leaf].leafWaterDataID == -1 ) ? SURFDRAW_ABOVEWATER : SURFDRAW_UNDERWATER;
|
||||||
@ -4374,7 +4379,7 @@ static void MarkBrushModelWaterSurfaces( model_t* world,
|
|||||||
model_t* pTemp = host_state.worldmodel;
|
model_t* pTemp = host_state.worldmodel;
|
||||||
CBrushBSPIterator brushIterator( world, brush );
|
CBrushBSPIterator brushIterator( world, brush );
|
||||||
host_state.SetWorldModel( world );
|
host_state.SetWorldModel( world );
|
||||||
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, &brushIterator, (int)brush );
|
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, &brushIterator, (intp)brush );
|
||||||
brushIterator.CheckSurfaces();
|
brushIterator.CheckSurfaces();
|
||||||
host_state.SetWorldModel( pTemp );
|
host_state.SetWorldModel( pTemp );
|
||||||
}
|
}
|
||||||
@ -4453,8 +4458,7 @@ void CModelLoader::Map_LoadModel( model_t *mod )
|
|||||||
|
|
||||||
// Until BSP version 19, this must occur after loading texinfo
|
// Until BSP version 19, this must occur after loading texinfo
|
||||||
COM_TimestampedLog( " Mod_LoadLighting" );
|
COM_TimestampedLog( " Mod_LoadLighting" );
|
||||||
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
|
if ( g_pMaterialSystemHardwareConfig->GetHDREnabled() && CMapLoadHelper::LumpSize( LUMP_LIGHTING_HDR ) > 0 )
|
||||||
CMapLoadHelper::LumpSize( LUMP_LIGHTING_HDR ) > 0 )
|
|
||||||
{
|
{
|
||||||
CMapLoadHelper mlh( LUMP_LIGHTING_HDR );
|
CMapLoadHelper mlh( LUMP_LIGHTING_HDR );
|
||||||
Mod_LoadLighting( mlh );
|
Mod_LoadLighting( mlh );
|
||||||
@ -4546,8 +4550,7 @@ void CModelLoader::Map_LoadModel( model_t *mod )
|
|||||||
&m_worldBrushData.m_nAreas );
|
&m_worldBrushData.m_nAreas );
|
||||||
|
|
||||||
COM_TimestampedLog( " Mod_LoadWorldlights" );
|
COM_TimestampedLog( " Mod_LoadWorldlights" );
|
||||||
if ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE &&
|
if ( g_pMaterialSystemHardwareConfig->GetHDREnabled() && CMapLoadHelper::LumpSize( LUMP_WORLDLIGHTS_HDR ) > 0 )
|
||||||
CMapLoadHelper::LumpSize( LUMP_WORLDLIGHTS_HDR ) > 0 )
|
|
||||||
{
|
{
|
||||||
CMapLoadHelper mlh( LUMP_WORLDLIGHTS_HDR );
|
CMapLoadHelper mlh( LUMP_WORLDLIGHTS_HDR );
|
||||||
Mod_LoadWorldlights( mlh, true );
|
Mod_LoadWorldlights( mlh, true );
|
||||||
|
@ -417,7 +417,7 @@ bool NET_StringToAdr ( const char *s, netadr_t *a)
|
|||||||
|
|
||||||
CNetChan *NET_FindNetChannel(int socket, netadr_t &adr)
|
CNetChan *NET_FindNetChannel(int socket, netadr_t &adr)
|
||||||
{
|
{
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
|
|
||||||
int numChannels = s_NetChannels.Count();
|
int numChannels = s_NetChannels.Count();
|
||||||
|
|
||||||
@ -798,7 +798,7 @@ INetChannel *NET_CreateNetChannel(int socket, netadr_t *adr, const char * name,
|
|||||||
// create new channel
|
// create new channel
|
||||||
chan = new CNetChan();
|
chan = new CNetChan();
|
||||||
|
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
s_NetChannels.AddToTail( chan );
|
s_NetChannels.AddToTail( chan );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +817,7 @@ void NET_RemoveNetChannel(INetChannel *netchan, bool bDeleteNetChan)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
if ( s_NetChannels.Find( static_cast<CNetChan*>(netchan) ) == s_NetChannels.InvalidIndex() )
|
if ( s_NetChannels.Find( static_cast<CNetChan*>(netchan) ) == s_NetChannels.InvalidIndex() )
|
||||||
{
|
{
|
||||||
DevMsg(1, "NET_CloseNetChannel: unknown channel.\n");
|
DevMsg(1, "NET_CloseNetChannel: unknown channel.\n");
|
||||||
@ -1389,7 +1389,7 @@ bool NET_GetLoopPacket ( netpacket_t * packet )
|
|||||||
|
|
||||||
if ( loop->data != loop->defbuffer )
|
if ( loop->data != loop->defbuffer )
|
||||||
{
|
{
|
||||||
delete loop->data;
|
delete[] loop->data;
|
||||||
loop->data = loop->defbuffer;
|
loop->data = loop->defbuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1677,7 +1677,7 @@ netpacket_t *NET_GetPacket (int sock, byte *scratch )
|
|||||||
|
|
||||||
void NET_ProcessPending( void )
|
void NET_ProcessPending( void )
|
||||||
{
|
{
|
||||||
AUTO_LOCK( s_PendingSockets );
|
AUTO_LOCK_FM( s_PendingSockets );
|
||||||
for ( int i=0; i<s_PendingSockets.Count();i++ )
|
for ( int i=0; i<s_PendingSockets.Count();i++ )
|
||||||
{
|
{
|
||||||
pendingsocket_t * psock = &s_PendingSockets[i];
|
pendingsocket_t * psock = &s_PendingSockets[i];
|
||||||
@ -1712,7 +1712,7 @@ void NET_ProcessPending( void )
|
|||||||
|
|
||||||
if ( cmd == STREAM_CMD_ACKN )
|
if ( cmd == STREAM_CMD_ACKN )
|
||||||
{
|
{
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
for ( int j = 0; j < s_NetChannels.Count(); j++ )
|
for ( int j = 0; j < s_NetChannels.Count(); j++ )
|
||||||
{
|
{
|
||||||
CNetChan * chan = s_NetChannels[j];
|
CNetChan * chan = s_NetChannels[j];
|
||||||
@ -1792,7 +1792,7 @@ void NET_ProcessListen(int sock)
|
|||||||
psock.addr.SetFromSockadr( &sa );
|
psock.addr.SetFromSockadr( &sa );
|
||||||
psock.time = net_time;
|
psock.time = net_time;
|
||||||
|
|
||||||
AUTO_LOCK( s_PendingSockets );
|
AUTO_LOCK_FM( s_PendingSockets );
|
||||||
s_PendingSockets.AddToTail( psock );
|
s_PendingSockets.AddToTail( psock );
|
||||||
|
|
||||||
// tell client to send challenge number to identify
|
// tell client to send challenge number to identify
|
||||||
@ -1823,7 +1823,7 @@ void NET_ProcessSocket( int sock, IConnectionlessPacketHandler *handler )
|
|||||||
|
|
||||||
// Scope for the auto_lock
|
// Scope for the auto_lock
|
||||||
{
|
{
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
|
|
||||||
// get streaming data from channel sockets
|
// get streaming data from channel sockets
|
||||||
int numChannels = s_NetChannels.Count();
|
int numChannels = s_NetChannels.Count();
|
||||||
@ -2553,7 +2553,7 @@ void NET_CloseAllSockets (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// shut down all pending sockets
|
// shut down all pending sockets
|
||||||
AUTO_LOCK( s_PendingSockets );
|
AUTO_LOCK_FM( s_PendingSockets );
|
||||||
for(int j=0; j<s_PendingSockets.Count();j++ )
|
for(int j=0; j<s_PendingSockets.Count();j++ )
|
||||||
{
|
{
|
||||||
NET_CloseSocket( s_PendingSockets[j].newsock );
|
NET_CloseSocket( s_PendingSockets[j].newsock );
|
||||||
@ -2836,7 +2836,7 @@ void NET_LogServerStatus( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
int numChannels = s_NetChannels.Count();
|
int numChannels = s_NetChannels.Count();
|
||||||
|
|
||||||
if ( numChannels == 0 )
|
if ( numChannels == 0 )
|
||||||
@ -3376,7 +3376,7 @@ CON_COMMAND( net_channels, "Shows net channel info" )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
for ( int i = 0; i < numChannels; i++ )
|
for ( int i = 0; i < numChannels; i++ )
|
||||||
{
|
{
|
||||||
NET_PrintChannelStatus( s_NetChannels[i] );
|
NET_PrintChannelStatus( s_NetChannels[i] );
|
||||||
@ -3391,7 +3391,7 @@ CON_COMMAND( net_start, "Inits multiplayer network sockets" )
|
|||||||
|
|
||||||
CON_COMMAND( net_status, "Shows current network status" )
|
CON_COMMAND( net_status, "Shows current network status" )
|
||||||
{
|
{
|
||||||
AUTO_LOCK( s_NetChannels );
|
AUTO_LOCK_FM( s_NetChannels );
|
||||||
int numChannels = s_NetChannels.Count();
|
int numChannels = s_NetChannels.Count();
|
||||||
|
|
||||||
ConMsg("Net status for host %s:\n",
|
ConMsg("Net status for host %s:\n",
|
||||||
|
@ -5,7 +5,11 @@
|
|||||||
// $NoKeywords: $
|
// $NoKeywords: $
|
||||||
//
|
//
|
||||||
//=============================================================================//
|
//=============================================================================//
|
||||||
|
#ifdef OSX
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "packed_entity.h"
|
#include "packed_entity.h"
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
#ifdef OSX
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
#endif // _DEBUG
|
#endif // _DEBUG
|
||||||
|
|
||||||
static ConVar sv_useexplicitdelete( "sv_useexplicitdelete", "1", FCVAR_DEVELOPMENTONLY, "Explicitly delete dormant client entities caused by AllowImmediateReuse()." );
|
static ConVar sv_useexplicitdelete( "sv_useexplicitdelete", "1", FCVAR_DEVELOPMENTONLY, "Explicitly delete dormant client entities caused by AllowImmediateReuse()." );
|
||||||
|
@ -96,7 +96,7 @@ private:
|
|||||||
CPureServerWhitelist::CCommand *pBestEntry );
|
CPureServerWhitelist::CCommand *pBestEntry );
|
||||||
|
|
||||||
unsigned short m_LoadCounter; // Incremented as we load things so their m_LoadOrder increases.
|
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.
|
// Commands are applied to files in order.
|
||||||
CUtlDict<CCommand*,int> m_FileCommands; // file commands
|
CUtlDict<CCommand*,int> m_FileCommands; // file commands
|
||||||
|
@ -2001,9 +2001,9 @@ void R_DrawDecalsAllImmediate_GatherDecals( IMatRenderContext *pRenderContext, i
|
|||||||
if ( g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_nCheckCount != nCheckCount )
|
if ( g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_nCheckCount != nCheckCount )
|
||||||
continue;
|
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() )
|
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||||
{
|
{
|
||||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
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 )
|
if ( g_aDecalSortTrees[iSortTree].m_aDecalSortBuckets[iGroup][iTreeType].Element( iBucket ).m_nCheckCount != nCheckCount )
|
||||||
continue;
|
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 nCount;
|
||||||
int iElement = iHead;
|
intp iElement = iHead;
|
||||||
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||||
{
|
{
|
||||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
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_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 )
|
if ( bucket.m_nCheckCount != nCheckCount )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int iHead = bucket.m_iHead;
|
intp iHead = bucket.m_iHead;
|
||||||
if ( !g_aDecalSortPool.IsValidIndex( iHead ) )
|
if ( !g_aDecalSortPool.IsValidIndex( iHead ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -2346,7 +2346,7 @@ void R_DrawDecalsAll_GatherDecals( IMatRenderContext *pRenderContext, int iGroup
|
|||||||
|
|
||||||
DrawDecals.AddToTail( DECALMARKERS_SWITCHBUCKET );
|
DrawDecals.AddToTail( DECALMARKERS_SWITCHBUCKET );
|
||||||
|
|
||||||
int iElement = iHead;
|
intp iElement = iHead;
|
||||||
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||||
{
|
{
|
||||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
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 )
|
if ( bucket.m_nCheckCount != nCheckCount )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int iHead = bucket.m_iHead;
|
intp iHead = bucket.m_iHead;
|
||||||
if ( !g_aDecalSortPool.IsValidIndex( iHead ) )
|
if ( !g_aDecalSortPool.IsValidIndex( iHead ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -2666,7 +2666,7 @@ void R_DrawDecalsAll( IMatRenderContext *pRenderContext, int iGroup, int iTreeTy
|
|||||||
bool bBatchInit = true;
|
bool bBatchInit = true;
|
||||||
|
|
||||||
int nCount;
|
int nCount;
|
||||||
int iElement = iHead;
|
intp iElement = iHead;
|
||||||
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
while ( iElement != g_aDecalSortPool.InvalidIndex() )
|
||||||
{
|
{
|
||||||
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
decal_t *pDecal = g_aDecalSortPool.Element( iElement );
|
||||||
@ -3015,7 +3015,7 @@ void DecalSurfaceAdd( SurfaceHandle_t surfID, int iGroup )
|
|||||||
}
|
}
|
||||||
|
|
||||||
pDecal->flags &= ~FDECAL_HASUPDATED;
|
pDecal->flags &= ~FDECAL_HASUPDATED;
|
||||||
int iPool = g_aDecalSortPool.Alloc( true );
|
intp iPool = g_aDecalSortPool.Alloc( true );
|
||||||
if ( iPool != g_aDecalSortPool.InvalidIndex() )
|
if ( iPool != g_aDecalSortPool.InvalidIndex() )
|
||||||
{
|
{
|
||||||
g_aDecalSortPool[iPool] = pDecal;
|
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 );
|
DecalMaterialBucket_t &bucket = sortTree.m_aDecalSortBuckets[iGroup][iTreeType].Element( pDecal->m_iSortMaterial );
|
||||||
if ( bucket.m_nCheckCount == nCheckCount )
|
if ( bucket.m_nCheckCount == nCheckCount )
|
||||||
{
|
{
|
||||||
int iHead = bucket.m_iHead;
|
intp iHead = bucket.m_iHead;
|
||||||
g_aDecalSortPool.LinkBefore( iHead, iPool );
|
g_aDecalSortPool.LinkBefore( iHead, iPool );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ struct DecalMaterialSortData_t
|
|||||||
|
|
||||||
struct DecalMaterialBucket_t
|
struct DecalMaterialBucket_t
|
||||||
{
|
{
|
||||||
int m_iHead;
|
intp m_iHead;
|
||||||
int m_nCheckCount;
|
int m_nCheckCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,16 +82,16 @@ inline bool DecalSortTreeSortLessFunc( const DecalMaterialSortData_t &decal1, co
|
|||||||
{
|
{
|
||||||
if ( ( decal1.m_iLightmapPage == -1 ) || ( decal2.m_iLightmapPage == -1 ) )
|
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 );
|
return ( decal1.m_iLightmapPage < decal2.m_iLightmapPage );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ( ( int )decal1.m_pMaterial < ( int )decal2.m_pMaterial );
|
return ( ( intp )decal1.m_pMaterial < ( intp )decal2.m_pMaterial );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ private:
|
|||||||
CSaveDirectory *m_pSaveDirectory;
|
CSaveDirectory *m_pSaveDirectory;
|
||||||
CUtlMap<CUtlSymbol, SaveFile_t> &GetDirectory( void ) { return m_pSaveDirectory->m_Files; }
|
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 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 );
|
FileHandle_t GetFileHandle( const char *pFileName );
|
||||||
int GetFileIndex( 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 )
|
FileHandle_t CSaveRestoreFileSystem::GetFileHandle( const char *filename )
|
||||||
{
|
{
|
||||||
int idx = GetFileIndex( filename );
|
intp idx = GetFileIndex( filename );
|
||||||
if ( idx == INVALID_INDEX )
|
if ( idx == INVALID_INDEX )
|
||||||
{
|
{
|
||||||
idx = 0;
|
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 )
|
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 )
|
void CSaveRestoreFileSystem::RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID )
|
||||||
{
|
{
|
||||||
int idx = GetFileIndex( pOldPath );
|
intp idx = GetFileIndex( pOldPath );
|
||||||
if ( idx != INVALID_INDEX )
|
if ( idx != INVALID_INDEX )
|
||||||
{
|
{
|
||||||
CUtlSymbol newID = AddString( Q_UnqualifiedFileName( pNewPath ) );
|
CUtlSymbol newID = AddString( Q_UnqualifiedFileName( pNewPath ) );
|
||||||
@ -369,7 +369,7 @@ FileHandle_t CSaveRestoreFileSystem::Open( const char *pFullName, const char *pO
|
|||||||
{
|
{
|
||||||
SaveFile_t *pFile = NULL;
|
SaveFile_t *pFile = NULL;
|
||||||
CUtlSymbol id = AddString( Q_UnqualifiedFileName( pFullName ) );
|
CUtlSymbol id = AddString( Q_UnqualifiedFileName( pFullName ) );
|
||||||
int idx = GetDirectory().Find( id );
|
intp idx = GetDirectory().Find( id );
|
||||||
if ( idx == INVALID_INDEX )
|
if ( idx == INVALID_INDEX )
|
||||||
{
|
{
|
||||||
// Don't create a read-only file
|
// 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" );
|
FileHandle_t hFile = Open( pFileName, "wb" );
|
||||||
if ( hFile )
|
if ( hFile )
|
||||||
{
|
{
|
||||||
SaveFile_t &file = GetFile( (unsigned int)hFile );
|
SaveFile_t &file = GetFile( (uintp)hFile );
|
||||||
|
|
||||||
if( file.eType == WRITE_ONLY )
|
if( file.eType == WRITE_ONLY )
|
||||||
{
|
{
|
||||||
@ -1289,7 +1289,7 @@ public:
|
|||||||
|
|
||||||
SaveMsg( "DirectoryCopy: AsyncAppend %s, %s\n", szName, pDestFileName );
|
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, 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 );
|
g_pFileSystem->AsyncAppendFile( pDestFileName, szName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ public:
|
|||||||
virtual unsigned short InvalidShadowIndex( );
|
virtual unsigned short InvalidShadowIndex( );
|
||||||
|
|
||||||
// Methods of ISpatialLeafEnumerator
|
// 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...
|
// Sets the texture coordinate range for a shadow...
|
||||||
virtual void SetShadowTexCoord( ShadowHandle_t handle, float x, float y, float w, float h );
|
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
|
// 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();
|
for (unsigned short i = m_SortOrderIds.Head(); i != m_SortOrderIds.InvalidIndex();
|
||||||
i = m_SortOrderIds.Next(i) )
|
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 )
|
for ( int i = 0; i < nLeafCount; ++i )
|
||||||
{
|
{
|
||||||
// NOTE: Scope specifier eliminates virtual function call
|
// 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 )
|
for ( int i = 0; i < nLeafCount; ++i )
|
||||||
{
|
{
|
||||||
// NOTE: Scope specifier eliminates virtual function call
|
// 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
|
// 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" );
|
VPROF( "CShadowMgr::EnumerateLeaf" );
|
||||||
ShadowBuildInfo_t* pBuild = (ShadowBuildInfo_t*)context;
|
ShadowBuildInfo_t* pBuild = (ShadowBuildInfo_t*)context;
|
||||||
@ -2048,34 +2048,34 @@ public:
|
|||||||
class CClipPlane
|
class CClipPlane
|
||||||
{
|
{
|
||||||
public:
|
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;
|
Vector dir;
|
||||||
VectorSubtract( two, one, 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 IsAbove() {return false;}
|
||||||
static inline bool IsPlane() {return true;}
|
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;
|
m_Dist = dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const Vector *m_pNormal;
|
static Vector m_pNormal;
|
||||||
static float m_Dist;
|
static float m_Dist;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Vector *CClipPlane::m_pNormal;
|
Vector CClipPlane::m_pNormal;
|
||||||
float CClipPlane::m_Dist;
|
float CClipPlane::m_Dist;
|
||||||
|
|
||||||
static inline void ClampTexCoord( ShadowVertex_t *pInVertex, ShadowVertex_t *pOutVertex )
|
static inline void ClampTexCoord( ShadowVertex_t *pInVertex, ShadowVertex_t *pOutVertex )
|
||||||
|
@ -20,17 +20,17 @@
|
|||||||
class COM_IOReadBinary : public IFileReadBinary
|
class COM_IOReadBinary : public IFileReadBinary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int open( const char *pFileName );
|
intp open( const char *pFileName );
|
||||||
int read( void *pOutput, int size, int file );
|
int read( void *pOutput, int size, intp file );
|
||||||
void seek( int file, int pos );
|
void seek( intp file, int pos );
|
||||||
unsigned int tell( int file );
|
unsigned int tell( intp file );
|
||||||
unsigned int size( int file );
|
unsigned int size( intp file );
|
||||||
void close( int file );
|
void close( intp file );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// prepend sound/ to the filename -- all sounds are loaded from the sound/ directory
|
// 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];
|
char namebuffer[512];
|
||||||
FileHandle_t hFile;
|
FileHandle_t hFile;
|
||||||
@ -46,10 +46,10 @@ int COM_IOReadBinary::open( const char *pFileName )
|
|||||||
|
|
||||||
hFile = g_pFileSystem->Open( namebuffer, "rb", "GAME" );
|
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 )
|
if ( !file )
|
||||||
return 0;
|
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 );
|
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 )
|
if ( !file )
|
||||||
return;
|
return;
|
||||||
@ -65,7 +65,7 @@ void COM_IOReadBinary::seek( int file, int pos )
|
|||||||
g_pFileSystem->Seek( (FileHandle_t)file, pos, FILESYSTEM_SEEK_HEAD );
|
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 )
|
if ( !file )
|
||||||
return 0;
|
return 0;
|
||||||
@ -73,7 +73,7 @@ unsigned int COM_IOReadBinary::tell( int file )
|
|||||||
return g_pFileSystem->Tell( (FileHandle_t)file );
|
return g_pFileSystem->Tell( (FileHandle_t)file );
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int COM_IOReadBinary::size( int file )
|
unsigned int COM_IOReadBinary::size( intp file )
|
||||||
{
|
{
|
||||||
if (!file)
|
if (!file)
|
||||||
return 0;
|
return 0;
|
||||||
@ -81,7 +81,7 @@ unsigned int COM_IOReadBinary::size( int file )
|
|||||||
return g_pFileSystem->Size( (FileHandle_t)file );
|
return g_pFileSystem->Size( (FileHandle_t)file );
|
||||||
}
|
}
|
||||||
|
|
||||||
void COM_IOReadBinary::close( int file )
|
void COM_IOReadBinary::close( intp file )
|
||||||
{
|
{
|
||||||
if (!file)
|
if (!file)
|
||||||
return;
|
return;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -75,6 +75,7 @@
|
|||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
#include "tier0/memalloc.h"
|
||||||
|
|
||||||
extern CNetworkStringTableContainer *networkStringTableContainerServer;
|
extern CNetworkStringTableContainer *networkStringTableContainerServer;
|
||||||
extern CNetworkStringTableContainer *networkStringTableContainerClient;
|
extern CNetworkStringTableContainer *networkStringTableContainerClient;
|
||||||
|
@ -284,53 +284,6 @@ void CServerRemoteAccess::WriteDataRequest( CRConServer *pNetworkListener, ra_li
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
Assert(!("Unknown requestType in CServerRemoteAccess::WriteDataRequest()"));
|
Assert(!("Unknown requestType in CServerRemoteAccess::WriteDataRequest()"));
|
||||||
cmd.Purge();
|
cmd.Purge();
|
||||||
@ -911,16 +864,6 @@ void CServerRemoteAccess::SendResponseToClient( ra_listener_id listenerID, Serve
|
|||||||
response.Put( pData, nDataLen );
|
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
|
// Purpose: C function for rest of engine to access CServerRemoteAccess class
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1099,7 +1099,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
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 QueueData( char const *szMapName, uint uiBlobVersion, uint uiBlobSize, const void *pvBlob );
|
||||||
void TerminateAndSelfDelete();
|
void TerminateAndSelfDelete();
|
||||||
};
|
};
|
||||||
|
@ -797,7 +797,7 @@ void Sys_ShutdownAuthentication( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Debug library spew output
|
// Debug library spew output
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
CThreadLocalInt<> g_bInSpew;
|
CTHREADLOCALINT g_bInSpew;
|
||||||
|
|
||||||
#include "tier1/fmtstr.h"
|
#include "tier1/fmtstr.h"
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
#include "tier0/memalloc.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Globals
|
// Globals
|
||||||
@ -2260,7 +2261,7 @@ bool EnableLongTickWatcher()
|
|||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
(void*)
|
(void*)
|
||||||
#endif
|
#endif
|
||||||
LongTickWatcherThread, NULL, 0, (unsigned long int *)&nThreadID );
|
LongTickWatcherThread, NULL, 0, (uintp *)&nThreadID );
|
||||||
|
|
||||||
bRet = true;
|
bRet = true;
|
||||||
}
|
}
|
||||||
|
@ -2286,7 +2286,9 @@ bool CVideoMode_MaterialSystem::Init( )
|
|||||||
int bitsperpixel = 32;
|
int bitsperpixel = 32;
|
||||||
|
|
||||||
bool bAllowSmallModes = false;
|
bool bAllowSmallModes = false;
|
||||||
|
#ifndef ANDROID
|
||||||
if ( CommandLine()->FindParm( "-small" ) )
|
if ( CommandLine()->FindParm( "-small" ) )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bAllowSmallModes = true;
|
bAllowSmallModes = true;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ void CGame::HandleMsg_Close( const InputEvent_t &event )
|
|||||||
|
|
||||||
void CGame::DispatchInputEvent( const InputEvent_t &event )
|
void CGame::DispatchInputEvent( const InputEvent_t &event )
|
||||||
{
|
{
|
||||||
switch( event.m_nType )
|
switch( event.m_nType & 0xFFFF )
|
||||||
{
|
{
|
||||||
// Handle button events specially,
|
// Handle button events specially,
|
||||||
// since we have all manner of crazy filtering going on when dealing with them
|
// since we have all manner of crazy filtering going on when dealing with them
|
||||||
@ -1566,7 +1566,7 @@ void *CGame::GetMainWindowPlatformSpecificHandle( void )
|
|||||||
#ifdef OSX
|
#ifdef OSX
|
||||||
id nsWindow = (id)pInfo.info.cocoa.window;
|
id nsWindow = (id)pInfo.info.cocoa.window;
|
||||||
SEL selector = sel_registerName("windowRef");
|
SEL selector = sel_registerName("windowRef");
|
||||||
id windowRef = objc_msgSend( nsWindow, selector );
|
id windowRef = ((id(*)(id, SEL))objc_msgSend)( nsWindow, selector );
|
||||||
return windowRef;
|
return windowRef;
|
||||||
#else
|
#else
|
||||||
// Not used on Linux.
|
// Not used on Linux.
|
||||||
|
@ -192,7 +192,7 @@ int ParseString( char const *pText, char *buf, size_t bufsize )
|
|||||||
char const *pStart = pTemp;
|
char const *pStart = pTemp;
|
||||||
pTemp = SkipText( 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 );
|
Q_strncpy( buf, pStart, len );
|
||||||
buf[ len ] = 0;
|
buf[ len ] = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -367,7 +367,8 @@ void TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
|
|
||||||
client_textmessage_t textMessages[ MAX_MESSAGES ];
|
client_textmessage_t textMessages[ MAX_MESSAGES ];
|
||||||
|
|
||||||
int i, nameHeapSize, textHeapSize, messageSize, nameOffset;
|
int i, nameHeapSize, textHeapSize, messageSize;
|
||||||
|
intp nameOffset;
|
||||||
|
|
||||||
lastNamePos = 0;
|
lastNamePos = 0;
|
||||||
lineNumber = 0;
|
lineNumber = 0;
|
||||||
@ -633,4 +634,4 @@ client_textmessage_t *TextMessageGet( const char *pName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "replay_internal.h"
|
#include "replay_internal.h"
|
||||||
#include "replayserver.h"
|
#include "replayserver.h"
|
||||||
#include "replay/iserverengine.h"
|
#include "replay/iserverengine.h"
|
||||||
|
#include "vcrmode.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
@ -696,10 +696,9 @@ void CEngineVGui::Init()
|
|||||||
COM_TimestampedLog( "Building Panels (staticGameUIPanel)" );
|
COM_TimestampedLog( "Building Panels (staticGameUIPanel)" );
|
||||||
|
|
||||||
staticGameUIPanel = new CEnginePanel( staticPanel, "GameUI Panel" );
|
staticGameUIPanel = new CEnginePanel( staticPanel, "GameUI Panel" );
|
||||||
if (IsAndroid() || CommandLine()->CheckParm("-gameuiproportionality"))
|
|
||||||
{
|
if(NeedProportional())
|
||||||
staticGameUIPanel->SetProportional(true);
|
staticGameUIPanel->SetProportional(true);
|
||||||
}
|
|
||||||
|
|
||||||
staticGameUIPanel->SetBounds( 0, 0, videomode->GetModeUIWidth(), videomode->GetModeUIHeight() );
|
staticGameUIPanel->SetBounds( 0, 0, videomode->GetModeUIWidth(), videomode->GetModeUIHeight() );
|
||||||
staticGameUIPanel->SetPaintBorderEnabled(false);
|
staticGameUIPanel->SetPaintBorderEnabled(false);
|
||||||
|
@ -523,7 +523,7 @@ public:
|
|||||||
int m_nLeafWaterDataID;
|
int m_nLeafWaterDataID;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool EnumerateLeaf( int leaf, int context )
|
bool EnumerateLeaf( int leaf, intp context )
|
||||||
{
|
{
|
||||||
BoxIntersectWaterContext_t *pSearchContext = ( BoxIntersectWaterContext_t * )context;
|
BoxIntersectWaterContext_t *pSearchContext = ( BoxIntersectWaterContext_t * )context;
|
||||||
mleaf_t *pLeaf = &host_state.worldmodel->brush.pShared->leafs[leaf];
|
mleaf_t *pLeaf = &host_state.worldmodel->brush.pShared->leafs[leaf];
|
||||||
@ -541,7 +541,7 @@ public:
|
|||||||
BoxIntersectWaterContext_t context;
|
BoxIntersectWaterContext_t context;
|
||||||
context.m_bFoundWaterLeaf = false;
|
context.m_bFoundWaterLeaf = false;
|
||||||
context.m_nLeafWaterDataID = leafWaterDataID;
|
context.m_nLeafWaterDataID = leafWaterDataID;
|
||||||
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, this, ( int )&context );
|
g_pToolBSPTree->EnumerateLeavesInBox( mins, maxs, this, ( intp )&context );
|
||||||
return context.m_bFoundWaterLeaf;
|
return context.m_bFoundWaterLeaf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
981
engine/voice_codecs/celt/opus/opus.h
Normal file
981
engine/voice_codecs/celt/opus/opus.h
Normal file
@ -0,0 +1,981 @@
|
|||||||
|
/* Copyright (c) 2010-2011 Xiph.Org Foundation, Skype Limited
|
||||||
|
Written by Jean-Marc Valin and Koen Vos */
|
||||||
|
/*
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file opus.h
|
||||||
|
* @brief Opus reference implementation API
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPUS_H
|
||||||
|
#define OPUS_H
|
||||||
|
|
||||||
|
#include "opus_types.h"
|
||||||
|
#include "opus_defines.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mainpage Opus
|
||||||
|
*
|
||||||
|
* The Opus codec is designed for interactive speech and audio transmission over the Internet.
|
||||||
|
* It is designed by the IETF Codec Working Group and incorporates technology from
|
||||||
|
* Skype's SILK codec and Xiph.Org's CELT codec.
|
||||||
|
*
|
||||||
|
* The Opus codec is designed to handle a wide range of interactive audio applications,
|
||||||
|
* including Voice over IP, videoconferencing, in-game chat, and even remote live music
|
||||||
|
* performances. It can scale from low bit-rate narrowband speech to very high quality
|
||||||
|
* stereo music. Its main features are:
|
||||||
|
|
||||||
|
* @li Sampling rates from 8 to 48 kHz
|
||||||
|
* @li Bit-rates from 6 kb/s to 510 kb/s
|
||||||
|
* @li Support for both constant bit-rate (CBR) and variable bit-rate (VBR)
|
||||||
|
* @li Audio bandwidth from narrowband to full-band
|
||||||
|
* @li Support for speech and music
|
||||||
|
* @li Support for mono and stereo
|
||||||
|
* @li Support for multichannel (up to 255 channels)
|
||||||
|
* @li Frame sizes from 2.5 ms to 60 ms
|
||||||
|
* @li Good loss robustness and packet loss concealment (PLC)
|
||||||
|
* @li Floating point and fixed-point implementation
|
||||||
|
*
|
||||||
|
* Documentation sections:
|
||||||
|
* @li @ref opus_encoder
|
||||||
|
* @li @ref opus_decoder
|
||||||
|
* @li @ref opus_repacketizer
|
||||||
|
* @li @ref opus_multistream
|
||||||
|
* @li @ref opus_libinfo
|
||||||
|
* @li @ref opus_custom
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup opus_encoder Opus Encoder
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @brief This page describes the process and functions used to encode Opus.
|
||||||
|
*
|
||||||
|
* Since Opus is a stateful codec, the encoding process starts with creating an encoder
|
||||||
|
* state. This can be done with:
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* int error;
|
||||||
|
* OpusEncoder *enc;
|
||||||
|
* enc = opus_encoder_create(Fs, channels, application, &error);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* From this point, @c enc can be used for encoding an audio stream. An encoder state
|
||||||
|
* @b must @b not be used for more than one stream at the same time. Similarly, the encoder
|
||||||
|
* state @b must @b not be re-initialized for each frame.
|
||||||
|
*
|
||||||
|
* While opus_encoder_create() allocates memory for the state, it's also possible
|
||||||
|
* to initialize pre-allocated memory:
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* int size;
|
||||||
|
* int error;
|
||||||
|
* OpusEncoder *enc;
|
||||||
|
* size = opus_encoder_get_size(channels);
|
||||||
|
* enc = malloc(size);
|
||||||
|
* error = opus_encoder_init(enc, Fs, channels, application);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* where opus_encoder_get_size() returns the required size for the encoder state. Note that
|
||||||
|
* future versions of this code may change the size, so no assuptions should be made about it.
|
||||||
|
*
|
||||||
|
* The encoder state is always continuous in memory and only a shallow copy is sufficient
|
||||||
|
* to copy it (e.g. memcpy())
|
||||||
|
*
|
||||||
|
* It is possible to change some of the encoder's settings using the opus_encoder_ctl()
|
||||||
|
* interface. All these settings already default to the recommended value, so they should
|
||||||
|
* only be changed when necessary. The most common settings one may want to change are:
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate));
|
||||||
|
* opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(complexity));
|
||||||
|
* opus_encoder_ctl(enc, OPUS_SET_SIGNAL(signal_type));
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* where
|
||||||
|
*
|
||||||
|
* @arg bitrate is in bits per second (b/s)
|
||||||
|
* @arg complexity is a value from 1 to 10, where 1 is the lowest complexity and 10 is the highest
|
||||||
|
* @arg signal_type is either OPUS_AUTO (default), OPUS_SIGNAL_VOICE, or OPUS_SIGNAL_MUSIC
|
||||||
|
*
|
||||||
|
* See @ref opus_encoderctls and @ref opus_genericctls for a complete list of parameters that can be set or queried. Most parameters can be set or changed at any time during a stream.
|
||||||
|
*
|
||||||
|
* To encode a frame, opus_encode() or opus_encode_float() must be called with exactly one frame (2.5, 5, 10, 20, 40 or 60 ms) of audio data:
|
||||||
|
* @code
|
||||||
|
* len = opus_encode(enc, audio_frame, frame_size, packet, max_packet);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* where
|
||||||
|
* <ul>
|
||||||
|
* <li>audio_frame is the audio data in opus_int16 (or float for opus_encode_float())</li>
|
||||||
|
* <li>frame_size is the duration of the frame in samples (per channel)</li>
|
||||||
|
* <li>packet is the byte array to which the compressed data is written</li>
|
||||||
|
* <li>max_packet is the maximum number of bytes that can be written in the packet (4000 bytes is recommended).
|
||||||
|
* Do not use max_packet to control VBR target bitrate, instead use the #OPUS_SET_BITRATE CTL.</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* opus_encode() and opus_encode_float() return the number of bytes actually written to the packet.
|
||||||
|
* The return value <b>can be negative</b>, which indicates that an error has occurred. If the return value
|
||||||
|
* is 2 bytes or less, then the packet does not need to be transmitted (DTX).
|
||||||
|
*
|
||||||
|
* Once the encoder state if no longer needed, it can be destroyed with
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* opus_encoder_destroy(enc);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* If the encoder was created with opus_encoder_init() rather than opus_encoder_create(),
|
||||||
|
* then no action is required aside from potentially freeing the memory that was manually
|
||||||
|
* allocated for it (calling free(enc) for the example above)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Opus encoder state.
|
||||||
|
* This contains the complete state of an Opus encoder.
|
||||||
|
* It is position independent and can be freely copied.
|
||||||
|
* @see opus_encoder_create,opus_encoder_init
|
||||||
|
*/
|
||||||
|
typedef struct OpusEncoder OpusEncoder;
|
||||||
|
|
||||||
|
/** Gets the size of an <code>OpusEncoder</code> structure.
|
||||||
|
* @param[in] channels <tt>int</tt>: Number of channels.
|
||||||
|
* This must be 1 or 2.
|
||||||
|
* @returns The size in bytes.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_encoder_get_size(int channels);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Allocates and initializes an encoder state.
|
||||||
|
* There are three coding modes:
|
||||||
|
*
|
||||||
|
* @ref OPUS_APPLICATION_VOIP gives best quality at a given bitrate for voice
|
||||||
|
* signals. It enhances the input signal by high-pass filtering and
|
||||||
|
* emphasizing formants and harmonics. Optionally it includes in-band
|
||||||
|
* forward error correction to protect against packet loss. Use this
|
||||||
|
* mode for typical VoIP applications. Because of the enhancement,
|
||||||
|
* even at high bitrates the output may sound different from the input.
|
||||||
|
*
|
||||||
|
* @ref OPUS_APPLICATION_AUDIO gives best quality at a given bitrate for most
|
||||||
|
* non-voice signals like music. Use this mode for music and mixed
|
||||||
|
* (music/voice) content, broadcast, and applications requiring less
|
||||||
|
* than 15 ms of coding delay.
|
||||||
|
*
|
||||||
|
* @ref OPUS_APPLICATION_RESTRICTED_LOWDELAY configures low-delay mode that
|
||||||
|
* disables the speech-optimized mode in exchange for slightly reduced delay.
|
||||||
|
* This mode can only be set on an newly initialized or freshly reset encoder
|
||||||
|
* because it changes the codec delay.
|
||||||
|
*
|
||||||
|
* This is useful when the caller knows that the speech-optimized modes will not be needed (use with caution).
|
||||||
|
* @param [in] Fs <tt>opus_int32</tt>: Sampling rate of input signal (Hz)
|
||||||
|
* This must be one of 8000, 12000, 16000,
|
||||||
|
* 24000, or 48000.
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
|
||||||
|
* @param [in] application <tt>int</tt>: Coding mode (@ref OPUS_APPLICATION_VOIP/@ref OPUS_APPLICATION_AUDIO/@ref OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|
||||||
|
* @param [out] error <tt>int*</tt>: @ref opus_errorcodes
|
||||||
|
* @note Regardless of the sampling rate and number channels selected, the Opus encoder
|
||||||
|
* can switch to a lower audio bandwidth or number of channels if the bitrate
|
||||||
|
* selected is too low. This also means that it is safe to always use 48 kHz stereo input
|
||||||
|
* and let the encoder optimize the encoding.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusEncoder *opus_encoder_create(
|
||||||
|
opus_int32 Fs,
|
||||||
|
int channels,
|
||||||
|
int application,
|
||||||
|
int *error
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Initializes a previously allocated encoder state
|
||||||
|
* The memory pointed to by st must be at least the size returned by opus_encoder_get_size().
|
||||||
|
* This is intended for applications which use their own allocator instead of malloc.
|
||||||
|
* @see opus_encoder_create(),opus_encoder_get_size()
|
||||||
|
* To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
|
||||||
|
* @param [in] st <tt>OpusEncoder*</tt>: Encoder state
|
||||||
|
* @param [in] Fs <tt>opus_int32</tt>: Sampling rate of input signal (Hz)
|
||||||
|
* This must be one of 8000, 12000, 16000,
|
||||||
|
* 24000, or 48000.
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
|
||||||
|
* @param [in] application <tt>int</tt>: Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO/OPUS_APPLICATION_RESTRICTED_LOWDELAY)
|
||||||
|
* @retval #OPUS_OK Success or @ref opus_errorcodes
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_encoder_init(
|
||||||
|
OpusEncoder *st,
|
||||||
|
opus_int32 Fs,
|
||||||
|
int channels,
|
||||||
|
int application
|
||||||
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Encodes an Opus frame.
|
||||||
|
* @param [in] st <tt>OpusEncoder*</tt>: Encoder state
|
||||||
|
* @param [in] pcm <tt>opus_int16*</tt>: Input signal (interleaved if 2 channels). length is frame_size*channels*sizeof(opus_int16)
|
||||||
|
* @param [in] frame_size <tt>int</tt>: Number of samples per channel in the
|
||||||
|
* input signal.
|
||||||
|
* This must be an Opus frame size for
|
||||||
|
* the encoder's sampling rate.
|
||||||
|
* For example, at 48 kHz the permitted
|
||||||
|
* values are 120, 240, 480, 960, 1920,
|
||||||
|
* and 2880.
|
||||||
|
* Passing in a duration of less than
|
||||||
|
* 10 ms (480 samples at 48 kHz) will
|
||||||
|
* prevent the encoder from using the LPC
|
||||||
|
* or hybrid modes.
|
||||||
|
* @param [out] data <tt>unsigned char*</tt>: Output payload.
|
||||||
|
* This must contain storage for at
|
||||||
|
* least \a max_data_bytes.
|
||||||
|
* @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
|
||||||
|
* memory for the output
|
||||||
|
* payload. This may be
|
||||||
|
* used to impose an upper limit on
|
||||||
|
* the instant bitrate, but should
|
||||||
|
* not be used as the only bitrate
|
||||||
|
* control. Use #OPUS_SET_BITRATE to
|
||||||
|
* control the bitrate.
|
||||||
|
* @returns The length of the encoded packet (in bytes) on success or a
|
||||||
|
* negative error code (see @ref opus_errorcodes) on failure.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode(
|
||||||
|
OpusEncoder *st,
|
||||||
|
const opus_int16 *pcm,
|
||||||
|
int frame_size,
|
||||||
|
unsigned char *data,
|
||||||
|
opus_int32 max_data_bytes
|
||||||
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
|
||||||
|
|
||||||
|
/** Encodes an Opus frame from floating point input.
|
||||||
|
* @param [in] st <tt>OpusEncoder*</tt>: Encoder state
|
||||||
|
* @param [in] pcm <tt>float*</tt>: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0.
|
||||||
|
* Samples with a range beyond +/-1.0 are supported but will
|
||||||
|
* be clipped by decoders using the integer API and should
|
||||||
|
* only be used if it is known that the far end supports
|
||||||
|
* extended dynamic range.
|
||||||
|
* length is frame_size*channels*sizeof(float)
|
||||||
|
* @param [in] frame_size <tt>int</tt>: Number of samples per channel in the
|
||||||
|
* input signal.
|
||||||
|
* This must be an Opus frame size for
|
||||||
|
* the encoder's sampling rate.
|
||||||
|
* For example, at 48 kHz the permitted
|
||||||
|
* values are 120, 240, 480, 960, 1920,
|
||||||
|
* and 2880.
|
||||||
|
* Passing in a duration of less than
|
||||||
|
* 10 ms (480 samples at 48 kHz) will
|
||||||
|
* prevent the encoder from using the LPC
|
||||||
|
* or hybrid modes.
|
||||||
|
* @param [out] data <tt>unsigned char*</tt>: Output payload.
|
||||||
|
* This must contain storage for at
|
||||||
|
* least \a max_data_bytes.
|
||||||
|
* @param [in] max_data_bytes <tt>opus_int32</tt>: Size of the allocated
|
||||||
|
* memory for the output
|
||||||
|
* payload. This may be
|
||||||
|
* used to impose an upper limit on
|
||||||
|
* the instant bitrate, but should
|
||||||
|
* not be used as the only bitrate
|
||||||
|
* control. Use #OPUS_SET_BITRATE to
|
||||||
|
* control the bitrate.
|
||||||
|
* @returns The length of the encoded packet (in bytes) on success or a
|
||||||
|
* negative error code (see @ref opus_errorcodes) on failure.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_encode_float(
|
||||||
|
OpusEncoder *st,
|
||||||
|
const float *pcm,
|
||||||
|
int frame_size,
|
||||||
|
unsigned char *data,
|
||||||
|
opus_int32 max_data_bytes
|
||||||
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
|
||||||
|
|
||||||
|
/** Frees an <code>OpusEncoder</code> allocated by opus_encoder_create().
|
||||||
|
* @param[in] st <tt>OpusEncoder*</tt>: State to be freed.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT void opus_encoder_destroy(OpusEncoder *st);
|
||||||
|
|
||||||
|
/** Perform a CTL function on an Opus encoder.
|
||||||
|
*
|
||||||
|
* Generally the request and subsequent arguments are generated
|
||||||
|
* by a convenience macro.
|
||||||
|
* @param st <tt>OpusEncoder*</tt>: Encoder state.
|
||||||
|
* @param request This and all remaining parameters should be replaced by one
|
||||||
|
* of the convenience macros in @ref opus_genericctls or
|
||||||
|
* @ref opus_encoderctls.
|
||||||
|
* @see opus_genericctls
|
||||||
|
* @see opus_encoderctls
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_encoder_ctl(OpusEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
|
/** @defgroup opus_decoder Opus Decoder
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* @brief This page describes the process and functions used to decode Opus.
|
||||||
|
*
|
||||||
|
* The decoding process also starts with creating a decoder
|
||||||
|
* state. This can be done with:
|
||||||
|
* @code
|
||||||
|
* int error;
|
||||||
|
* OpusDecoder *dec;
|
||||||
|
* dec = opus_decoder_create(Fs, channels, &error);
|
||||||
|
* @endcode
|
||||||
|
* where
|
||||||
|
* @li Fs is the sampling rate and must be 8000, 12000, 16000, 24000, or 48000
|
||||||
|
* @li channels is the number of channels (1 or 2)
|
||||||
|
* @li error will hold the error code in case of failure (or #OPUS_OK on success)
|
||||||
|
* @li the return value is a newly created decoder state to be used for decoding
|
||||||
|
*
|
||||||
|
* While opus_decoder_create() allocates memory for the state, it's also possible
|
||||||
|
* to initialize pre-allocated memory:
|
||||||
|
* @code
|
||||||
|
* int size;
|
||||||
|
* int error;
|
||||||
|
* OpusDecoder *dec;
|
||||||
|
* size = opus_decoder_get_size(channels);
|
||||||
|
* dec = malloc(size);
|
||||||
|
* error = opus_decoder_init(dec, Fs, channels);
|
||||||
|
* @endcode
|
||||||
|
* where opus_decoder_get_size() returns the required size for the decoder state. Note that
|
||||||
|
* future versions of this code may change the size, so no assuptions should be made about it.
|
||||||
|
*
|
||||||
|
* The decoder state is always continuous in memory and only a shallow copy is sufficient
|
||||||
|
* to copy it (e.g. memcpy())
|
||||||
|
*
|
||||||
|
* To decode a frame, opus_decode() or opus_decode_float() must be called with a packet of compressed audio data:
|
||||||
|
* @code
|
||||||
|
* frame_size = opus_decode(dec, packet, len, decoded, max_size, 0);
|
||||||
|
* @endcode
|
||||||
|
* where
|
||||||
|
*
|
||||||
|
* @li packet is the byte array containing the compressed data
|
||||||
|
* @li len is the exact number of bytes contained in the packet
|
||||||
|
* @li decoded is the decoded audio data in opus_int16 (or float for opus_decode_float())
|
||||||
|
* @li max_size is the max duration of the frame in samples (per channel) that can fit into the decoded_frame array
|
||||||
|
*
|
||||||
|
* opus_decode() and opus_decode_float() return the number of samples (per channel) decoded from the packet.
|
||||||
|
* If that value is negative, then an error has occurred. This can occur if the packet is corrupted or if the audio
|
||||||
|
* buffer is too small to hold the decoded audio.
|
||||||
|
*
|
||||||
|
* Opus is a stateful codec with overlapping blocks and as a result Opus
|
||||||
|
* packets are not coded independently of each other. Packets must be
|
||||||
|
* passed into the decoder serially and in the correct order for a correct
|
||||||
|
* decode. Lost packets can be replaced with loss concealment by calling
|
||||||
|
* the decoder with a null pointer and zero length for the missing packet.
|
||||||
|
*
|
||||||
|
* A single codec state may only be accessed from a single thread at
|
||||||
|
* a time and any required locking must be performed by the caller. Separate
|
||||||
|
* streams must be decoded with separate decoder states and can be decoded
|
||||||
|
* in parallel unless the library was compiled with NONTHREADSAFE_PSEUDOSTACK
|
||||||
|
* defined.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Opus decoder state.
|
||||||
|
* This contains the complete state of an Opus decoder.
|
||||||
|
* It is position independent and can be freely copied.
|
||||||
|
* @see opus_decoder_create,opus_decoder_init
|
||||||
|
*/
|
||||||
|
typedef struct OpusDecoder OpusDecoder;
|
||||||
|
|
||||||
|
/** Gets the size of an <code>OpusDecoder</code> structure.
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels.
|
||||||
|
* This must be 1 or 2.
|
||||||
|
* @returns The size in bytes.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_size(int channels);
|
||||||
|
|
||||||
|
/** Allocates and initializes a decoder state.
|
||||||
|
* @param [in] Fs <tt>opus_int32</tt>: Sample rate to decode at (Hz).
|
||||||
|
* This must be one of 8000, 12000, 16000,
|
||||||
|
* 24000, or 48000.
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels (1 or 2) to decode
|
||||||
|
* @param [out] error <tt>int*</tt>: #OPUS_OK Success or @ref opus_errorcodes
|
||||||
|
*
|
||||||
|
* Internally Opus stores data at 48000 Hz, so that should be the default
|
||||||
|
* value for Fs. However, the decoder can efficiently decode to buffers
|
||||||
|
* at 8, 12, 16, and 24 kHz so if for some reason the caller cannot use
|
||||||
|
* data at the full sample rate, or knows the compressed data doesn't
|
||||||
|
* use the full frequency range, it can request decoding at a reduced
|
||||||
|
* rate. Likewise, the decoder is capable of filling in either mono or
|
||||||
|
* interleaved stereo pcm buffers, at the caller's request.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusDecoder *opus_decoder_create(
|
||||||
|
opus_int32 Fs,
|
||||||
|
int channels,
|
||||||
|
int *error
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Initializes a previously allocated decoder state.
|
||||||
|
* The state must be at least the size returned by opus_decoder_get_size().
|
||||||
|
* This is intended for applications which use their own allocator instead of malloc. @see opus_decoder_create,opus_decoder_get_size
|
||||||
|
* To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
|
||||||
|
* @param [in] st <tt>OpusDecoder*</tt>: Decoder state.
|
||||||
|
* @param [in] Fs <tt>opus_int32</tt>: Sampling rate to decode to (Hz).
|
||||||
|
* This must be one of 8000, 12000, 16000,
|
||||||
|
* 24000, or 48000.
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels (1 or 2) to decode
|
||||||
|
* @retval #OPUS_OK Success or @ref opus_errorcodes
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_decoder_init(
|
||||||
|
OpusDecoder *st,
|
||||||
|
opus_int32 Fs,
|
||||||
|
int channels
|
||||||
|
) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Decode an Opus packet.
|
||||||
|
* @param [in] st <tt>OpusDecoder*</tt>: Decoder state
|
||||||
|
* @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indicate packet loss
|
||||||
|
* @param [in] len <tt>opus_int32</tt>: Number of bytes in payload*
|
||||||
|
* @param [out] pcm <tt>opus_int16*</tt>: Output signal (interleaved if 2 channels). length
|
||||||
|
* is frame_size*channels*sizeof(opus_int16)
|
||||||
|
* @param [in] frame_size Number of samples per channel of available space in \a pcm.
|
||||||
|
* If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
|
||||||
|
* not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
|
||||||
|
* then frame_size needs to be exactly the duration of audio that is missing, otherwise the
|
||||||
|
* decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
|
||||||
|
* FEC cases, frame_size <b>must</b> be a multiple of 2.5 ms.
|
||||||
|
* @param [in] decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band forward error correction data be
|
||||||
|
* decoded. If no such data is available, the frame is decoded as if it were lost.
|
||||||
|
* @returns Number of decoded samples or @ref opus_errorcodes
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode(
|
||||||
|
OpusDecoder *st,
|
||||||
|
const unsigned char *data,
|
||||||
|
opus_int32 len,
|
||||||
|
opus_int16 *pcm,
|
||||||
|
int frame_size,
|
||||||
|
int decode_fec
|
||||||
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
|
||||||
|
|
||||||
|
/** Decode an Opus packet with floating point output.
|
||||||
|
* @param [in] st <tt>OpusDecoder*</tt>: Decoder state
|
||||||
|
* @param [in] data <tt>char*</tt>: Input payload. Use a NULL pointer to indicate packet loss
|
||||||
|
* @param [in] len <tt>opus_int32</tt>: Number of bytes in payload
|
||||||
|
* @param [out] pcm <tt>float*</tt>: Output signal (interleaved if 2 channels). length
|
||||||
|
* is frame_size*channels*sizeof(float)
|
||||||
|
* @param [in] frame_size Number of samples per channel of available space in \a pcm.
|
||||||
|
* If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
|
||||||
|
* not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
|
||||||
|
* then frame_size needs to be exactly the duration of audio that is missing, otherwise the
|
||||||
|
* decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
|
||||||
|
* FEC cases, frame_size <b>must</b> be a multiple of 2.5 ms.
|
||||||
|
* @param [in] decode_fec <tt>int</tt>: Flag (0 or 1) to request that any in-band forward error correction data be
|
||||||
|
* decoded. If no such data is available the frame is decoded as if it were lost.
|
||||||
|
* @returns Number of decoded samples or @ref opus_errorcodes
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decode_float(
|
||||||
|
OpusDecoder *st,
|
||||||
|
const unsigned char *data,
|
||||||
|
opus_int32 len,
|
||||||
|
float *pcm,
|
||||||
|
int frame_size,
|
||||||
|
int decode_fec
|
||||||
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
|
||||||
|
|
||||||
|
/** Perform a CTL function on an Opus decoder.
|
||||||
|
*
|
||||||
|
* Generally the request and subsequent arguments are generated
|
||||||
|
* by a convenience macro.
|
||||||
|
* @param st <tt>OpusDecoder*</tt>: Decoder state.
|
||||||
|
* @param request This and all remaining parameters should be replaced by one
|
||||||
|
* of the convenience macros in @ref opus_genericctls or
|
||||||
|
* @ref opus_decoderctls.
|
||||||
|
* @see opus_genericctls
|
||||||
|
* @see opus_decoderctls
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_decoder_ctl(OpusDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Frees an <code>OpusDecoder</code> allocated by opus_decoder_create().
|
||||||
|
* @param[in] st <tt>OpusDecoder*</tt>: State to be freed.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT void opus_decoder_destroy(OpusDecoder *st);
|
||||||
|
|
||||||
|
/** Parse an opus packet into one or more frames.
|
||||||
|
* Opus_decode will perform this operation internally so most applications do
|
||||||
|
* not need to use this function.
|
||||||
|
* This function does not copy the frames, the returned pointers are pointers into
|
||||||
|
* the input packet.
|
||||||
|
* @param [in] data <tt>char*</tt>: Opus packet to be parsed
|
||||||
|
* @param [in] len <tt>opus_int32</tt>: size of data
|
||||||
|
* @param [out] out_toc <tt>char*</tt>: TOC pointer
|
||||||
|
* @param [out] frames <tt>char*[48]</tt> encapsulated frames
|
||||||
|
* @param [out] size <tt>opus_int16[48]</tt> sizes of the encapsulated frames
|
||||||
|
* @param [out] payload_offset <tt>int*</tt>: returns the position of the payload within the packet (in bytes)
|
||||||
|
* @returns number of frames
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_packet_parse(
|
||||||
|
const unsigned char *data,
|
||||||
|
opus_int32 len,
|
||||||
|
unsigned char *out_toc,
|
||||||
|
const unsigned char *frames[48],
|
||||||
|
opus_int16 size[48],
|
||||||
|
int *payload_offset
|
||||||
|
) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(5);
|
||||||
|
|
||||||
|
/** Gets the bandwidth of an Opus packet.
|
||||||
|
* @param [in] data <tt>char*</tt>: Opus packet
|
||||||
|
* @retval OPUS_BANDWIDTH_NARROWBAND Narrowband (4kHz bandpass)
|
||||||
|
* @retval OPUS_BANDWIDTH_MEDIUMBAND Mediumband (6kHz bandpass)
|
||||||
|
* @retval OPUS_BANDWIDTH_WIDEBAND Wideband (8kHz bandpass)
|
||||||
|
* @retval OPUS_BANDWIDTH_SUPERWIDEBAND Superwideband (12kHz bandpass)
|
||||||
|
* @retval OPUS_BANDWIDTH_FULLBAND Fullband (20kHz bandpass)
|
||||||
|
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_bandwidth(const unsigned char *data) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Gets the number of samples per frame from an Opus packet.
|
||||||
|
* @param [in] data <tt>char*</tt>: Opus packet.
|
||||||
|
* This must contain at least one byte of
|
||||||
|
* data.
|
||||||
|
* @param [in] Fs <tt>opus_int32</tt>: Sampling rate in Hz.
|
||||||
|
* This must be a multiple of 400, or
|
||||||
|
* inaccurate results will be returned.
|
||||||
|
* @returns Number of samples per frame.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_samples_per_frame(const unsigned char *data, opus_int32 Fs) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Gets the number of channels from an Opus packet.
|
||||||
|
* @param [in] data <tt>char*</tt>: Opus packet
|
||||||
|
* @returns Number of channels
|
||||||
|
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_channels(const unsigned char *data) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Gets the number of frames in an Opus packet.
|
||||||
|
* @param [in] packet <tt>char*</tt>: Opus packet
|
||||||
|
* @param [in] len <tt>opus_int32</tt>: Length of packet
|
||||||
|
* @returns Number of frames
|
||||||
|
* @retval OPUS_BAD_ARG Insufficient data was passed to the function
|
||||||
|
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_frames(const unsigned char packet[], opus_int32 len) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Gets the number of samples of an Opus packet.
|
||||||
|
* @param [in] packet <tt>char*</tt>: Opus packet
|
||||||
|
* @param [in] len <tt>opus_int32</tt>: Length of packet
|
||||||
|
* @param [in] Fs <tt>opus_int32</tt>: Sampling rate in Hz.
|
||||||
|
* This must be a multiple of 400, or
|
||||||
|
* inaccurate results will be returned.
|
||||||
|
* @returns Number of samples
|
||||||
|
* @retval OPUS_BAD_ARG Insufficient data was passed to the function
|
||||||
|
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_packet_get_nb_samples(const unsigned char packet[], opus_int32 len, opus_int32 Fs) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Gets the number of samples of an Opus packet.
|
||||||
|
* @param [in] dec <tt>OpusDecoder*</tt>: Decoder state
|
||||||
|
* @param [in] packet <tt>char*</tt>: Opus packet
|
||||||
|
* @param [in] len <tt>opus_int32</tt>: Length of packet
|
||||||
|
* @returns Number of samples
|
||||||
|
* @retval OPUS_BAD_ARG Insufficient data was passed to the function
|
||||||
|
* @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsigned char packet[], opus_int32 len) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
||||||
|
|
||||||
|
/** Applies soft-clipping to bring a float signal within the [-1,1] range. If
|
||||||
|
* the signal is already in that range, nothing is done. If there are values
|
||||||
|
* outside of [-1,1], then the signal is clipped as smoothly as possible to
|
||||||
|
* both fit in the range and avoid creating excessive distortion in the
|
||||||
|
* process.
|
||||||
|
* @param [in,out] pcm <tt>float*</tt>: Input PCM and modified PCM
|
||||||
|
* @param [in] frame_size <tt>int</tt> Number of samples per channel to process
|
||||||
|
* @param [in] channels <tt>int</tt>: Number of channels
|
||||||
|
* @param [in,out] softclip_mem <tt>float*</tt>: State memory for the soft clipping process (one float per channel, initialized to zero)
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT void opus_pcm_soft_clip(float *pcm, int frame_size, int channels, float *softclip_mem);
|
||||||
|
|
||||||
|
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
|
/** @defgroup opus_repacketizer Repacketizer
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* The repacketizer can be used to merge multiple Opus packets into a single
|
||||||
|
* packet or alternatively to split Opus packets that have previously been
|
||||||
|
* merged. Splitting valid Opus packets is always guaranteed to succeed,
|
||||||
|
* whereas merging valid packets only succeeds if all frames have the same
|
||||||
|
* mode, bandwidth, and frame size, and when the total duration of the merged
|
||||||
|
* packet is no more than 120 ms. The 120 ms limit comes from the
|
||||||
|
* specification and limits decoder memory requirements at a point where
|
||||||
|
* framing overhead becomes negligible.
|
||||||
|
*
|
||||||
|
* The repacketizer currently only operates on elementary Opus
|
||||||
|
* streams. It will not manipualte multistream packets successfully, except in
|
||||||
|
* the degenerate case where they consist of data from a single stream.
|
||||||
|
*
|
||||||
|
* The repacketizing process starts with creating a repacketizer state, either
|
||||||
|
* by calling opus_repacketizer_create() or by allocating the memory yourself,
|
||||||
|
* e.g.,
|
||||||
|
* @code
|
||||||
|
* OpusRepacketizer *rp;
|
||||||
|
* rp = (OpusRepacketizer*)malloc(opus_repacketizer_get_size());
|
||||||
|
* if (rp != NULL)
|
||||||
|
* opus_repacketizer_init(rp);
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* Then the application should submit packets with opus_repacketizer_cat(),
|
||||||
|
* extract new packets with opus_repacketizer_out() or
|
||||||
|
* opus_repacketizer_out_range(), and then reset the state for the next set of
|
||||||
|
* input packets via opus_repacketizer_init().
|
||||||
|
*
|
||||||
|
* For example, to split a sequence of packets into individual frames:
|
||||||
|
* @code
|
||||||
|
* unsigned char *data;
|
||||||
|
* int len;
|
||||||
|
* while (get_next_packet(&data, &len))
|
||||||
|
* {
|
||||||
|
* unsigned char out[1276];
|
||||||
|
* opus_int32 out_len;
|
||||||
|
* int nb_frames;
|
||||||
|
* int err;
|
||||||
|
* int i;
|
||||||
|
* err = opus_repacketizer_cat(rp, data, len);
|
||||||
|
* if (err != OPUS_OK)
|
||||||
|
* {
|
||||||
|
* release_packet(data);
|
||||||
|
* return err;
|
||||||
|
* }
|
||||||
|
* nb_frames = opus_repacketizer_get_nb_frames(rp);
|
||||||
|
* for (i = 0; i < nb_frames; i++)
|
||||||
|
* {
|
||||||
|
* out_len = opus_repacketizer_out_range(rp, i, i+1, out, sizeof(out));
|
||||||
|
* if (out_len < 0)
|
||||||
|
* {
|
||||||
|
* release_packet(data);
|
||||||
|
* return (int)out_len;
|
||||||
|
* }
|
||||||
|
* output_next_packet(out, out_len);
|
||||||
|
* }
|
||||||
|
* opus_repacketizer_init(rp);
|
||||||
|
* release_packet(data);
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* Alternatively, to combine a sequence of frames into packets that each
|
||||||
|
* contain up to <code>TARGET_DURATION_MS</code> milliseconds of data:
|
||||||
|
* @code
|
||||||
|
* // The maximum number of packets with duration TARGET_DURATION_MS occurs
|
||||||
|
* // when the frame size is 2.5 ms, for a total of (TARGET_DURATION_MS*2/5)
|
||||||
|
* // packets.
|
||||||
|
* unsigned char *data[(TARGET_DURATION_MS*2/5)+1];
|
||||||
|
* opus_int32 len[(TARGET_DURATION_MS*2/5)+1];
|
||||||
|
* int nb_packets;
|
||||||
|
* unsigned char out[1277*(TARGET_DURATION_MS*2/2)];
|
||||||
|
* opus_int32 out_len;
|
||||||
|
* int prev_toc;
|
||||||
|
* nb_packets = 0;
|
||||||
|
* while (get_next_packet(data+nb_packets, len+nb_packets))
|
||||||
|
* {
|
||||||
|
* int nb_frames;
|
||||||
|
* int err;
|
||||||
|
* nb_frames = opus_packet_get_nb_frames(data[nb_packets], len[nb_packets]);
|
||||||
|
* if (nb_frames < 1)
|
||||||
|
* {
|
||||||
|
* release_packets(data, nb_packets+1);
|
||||||
|
* return nb_frames;
|
||||||
|
* }
|
||||||
|
* nb_frames += opus_repacketizer_get_nb_frames(rp);
|
||||||
|
* // If adding the next packet would exceed our target, or it has an
|
||||||
|
* // incompatible TOC sequence, output the packets we already have before
|
||||||
|
* // submitting it.
|
||||||
|
* // N.B., The nb_packets > 0 check ensures we've submitted at least one
|
||||||
|
* // packet since the last call to opus_repacketizer_init(). Otherwise a
|
||||||
|
* // single packet longer than TARGET_DURATION_MS would cause us to try to
|
||||||
|
* // output an (invalid) empty packet. It also ensures that prev_toc has
|
||||||
|
* // been set to a valid value. Additionally, len[nb_packets] > 0 is
|
||||||
|
* // guaranteed by the call to opus_packet_get_nb_frames() above, so the
|
||||||
|
* // reference to data[nb_packets][0] should be valid.
|
||||||
|
* if (nb_packets > 0 && (
|
||||||
|
* ((prev_toc & 0xFC) != (data[nb_packets][0] & 0xFC)) ||
|
||||||
|
* opus_packet_get_samples_per_frame(data[nb_packets], 48000)*nb_frames >
|
||||||
|
* TARGET_DURATION_MS*48))
|
||||||
|
* {
|
||||||
|
* out_len = opus_repacketizer_out(rp, out, sizeof(out));
|
||||||
|
* if (out_len < 0)
|
||||||
|
* {
|
||||||
|
* release_packets(data, nb_packets+1);
|
||||||
|
* return (int)out_len;
|
||||||
|
* }
|
||||||
|
* output_next_packet(out, out_len);
|
||||||
|
* opus_repacketizer_init(rp);
|
||||||
|
* release_packets(data, nb_packets);
|
||||||
|
* data[0] = data[nb_packets];
|
||||||
|
* len[0] = len[nb_packets];
|
||||||
|
* nb_packets = 0;
|
||||||
|
* }
|
||||||
|
* err = opus_repacketizer_cat(rp, data[nb_packets], len[nb_packets]);
|
||||||
|
* if (err != OPUS_OK)
|
||||||
|
* {
|
||||||
|
* release_packets(data, nb_packets+1);
|
||||||
|
* return err;
|
||||||
|
* }
|
||||||
|
* prev_toc = data[nb_packets][0];
|
||||||
|
* nb_packets++;
|
||||||
|
* }
|
||||||
|
* // Output the final, partial packet.
|
||||||
|
* if (nb_packets > 0)
|
||||||
|
* {
|
||||||
|
* out_len = opus_repacketizer_out(rp, out, sizeof(out));
|
||||||
|
* release_packets(data, nb_packets);
|
||||||
|
* if (out_len < 0)
|
||||||
|
* return (int)out_len;
|
||||||
|
* output_next_packet(out, out_len);
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* An alternate way of merging packets is to simply call opus_repacketizer_cat()
|
||||||
|
* unconditionally until it fails. At that point, the merged packet can be
|
||||||
|
* obtained with opus_repacketizer_out() and the input packet for which
|
||||||
|
* opus_repacketizer_cat() needs to be re-added to a newly reinitialized
|
||||||
|
* repacketizer state.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct OpusRepacketizer OpusRepacketizer;
|
||||||
|
|
||||||
|
/** Gets the size of an <code>OpusRepacketizer</code> structure.
|
||||||
|
* @returns The size in bytes.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_size(void);
|
||||||
|
|
||||||
|
/** (Re)initializes a previously allocated repacketizer state.
|
||||||
|
* The state must be at least the size returned by opus_repacketizer_get_size().
|
||||||
|
* This can be used for applications which use their own allocator instead of
|
||||||
|
* malloc().
|
||||||
|
* It must also be called to reset the queue of packets waiting to be
|
||||||
|
* repacketized, which is necessary if the maximum packet duration of 120 ms
|
||||||
|
* is reached or if you wish to submit packets with a different Opus
|
||||||
|
* configuration (coding mode, audio bandwidth, frame size, or channel count).
|
||||||
|
* Failure to do so will prevent a new packet from being added with
|
||||||
|
* opus_repacketizer_cat().
|
||||||
|
* @see opus_repacketizer_create
|
||||||
|
* @see opus_repacketizer_get_size
|
||||||
|
* @see opus_repacketizer_cat
|
||||||
|
* @param rp <tt>OpusRepacketizer*</tt>: The repacketizer state to
|
||||||
|
* (re)initialize.
|
||||||
|
* @returns A pointer to the same repacketizer state that was passed in.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OpusRepacketizer *opus_repacketizer_init(OpusRepacketizer *rp) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Allocates memory and initializes the new repacketizer with
|
||||||
|
* opus_repacketizer_init().
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusRepacketizer *opus_repacketizer_create(void);
|
||||||
|
|
||||||
|
/** Frees an <code>OpusRepacketizer</code> allocated by
|
||||||
|
* opus_repacketizer_create().
|
||||||
|
* @param[in] rp <tt>OpusRepacketizer*</tt>: State to be freed.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT void opus_repacketizer_destroy(OpusRepacketizer *rp);
|
||||||
|
|
||||||
|
/** Add a packet to the current repacketizer state.
|
||||||
|
* This packet must match the configuration of any packets already submitted
|
||||||
|
* for repacketization since the last call to opus_repacketizer_init().
|
||||||
|
* This means that it must have the same coding mode, audio bandwidth, frame
|
||||||
|
* size, and channel count.
|
||||||
|
* This can be checked in advance by examining the top 6 bits of the first
|
||||||
|
* byte of the packet, and ensuring they match the top 6 bits of the first
|
||||||
|
* byte of any previously submitted packet.
|
||||||
|
* The total duration of audio in the repacketizer state also must not exceed
|
||||||
|
* 120 ms, the maximum duration of a single packet, after adding this packet.
|
||||||
|
*
|
||||||
|
* The contents of the current repacketizer state can be extracted into new
|
||||||
|
* packets using opus_repacketizer_out() or opus_repacketizer_out_range().
|
||||||
|
*
|
||||||
|
* In order to add a packet with a different configuration or to add more
|
||||||
|
* audio beyond 120 ms, you must clear the repacketizer state by calling
|
||||||
|
* opus_repacketizer_init().
|
||||||
|
* If a packet is too large to add to the current repacketizer state, no part
|
||||||
|
* of it is added, even if it contains multiple frames, some of which might
|
||||||
|
* fit.
|
||||||
|
* If you wish to be able to add parts of such packets, you should first use
|
||||||
|
* another repacketizer to split the packet into pieces and add them
|
||||||
|
* individually.
|
||||||
|
* @see opus_repacketizer_out_range
|
||||||
|
* @see opus_repacketizer_out
|
||||||
|
* @see opus_repacketizer_init
|
||||||
|
* @param rp <tt>OpusRepacketizer*</tt>: The repacketizer state to which to
|
||||||
|
* add the packet.
|
||||||
|
* @param[in] data <tt>const unsigned char*</tt>: The packet data.
|
||||||
|
* The application must ensure
|
||||||
|
* this pointer remains valid
|
||||||
|
* until the next call to
|
||||||
|
* opus_repacketizer_init() or
|
||||||
|
* opus_repacketizer_destroy().
|
||||||
|
* @param len <tt>opus_int32</tt>: The number of bytes in the packet data.
|
||||||
|
* @returns An error code indicating whether or not the operation succeeded.
|
||||||
|
* @retval #OPUS_OK The packet's contents have been added to the repacketizer
|
||||||
|
* state.
|
||||||
|
* @retval #OPUS_INVALID_PACKET The packet did not have a valid TOC sequence,
|
||||||
|
* the packet's TOC sequence was not compatible
|
||||||
|
* with previously submitted packets (because
|
||||||
|
* the coding mode, audio bandwidth, frame size,
|
||||||
|
* or channel count did not match), or adding
|
||||||
|
* this packet would increase the total amount of
|
||||||
|
* audio stored in the repacketizer state to more
|
||||||
|
* than 120 ms.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2);
|
||||||
|
|
||||||
|
|
||||||
|
/** Construct a new packet from data previously submitted to the repacketizer
|
||||||
|
* state via opus_repacketizer_cat().
|
||||||
|
* @param rp <tt>OpusRepacketizer*</tt>: The repacketizer state from which to
|
||||||
|
* construct the new packet.
|
||||||
|
* @param begin <tt>int</tt>: The index of the first frame in the current
|
||||||
|
* repacketizer state to include in the output.
|
||||||
|
* @param end <tt>int</tt>: One past the index of the last frame in the
|
||||||
|
* current repacketizer state to include in the
|
||||||
|
* output.
|
||||||
|
* @param[out] data <tt>const unsigned char*</tt>: The buffer in which to
|
||||||
|
* store the output packet.
|
||||||
|
* @param maxlen <tt>opus_int32</tt>: The maximum number of bytes to store in
|
||||||
|
* the output buffer. In order to guarantee
|
||||||
|
* success, this should be at least
|
||||||
|
* <code>1276</code> for a single frame,
|
||||||
|
* or for multiple frames,
|
||||||
|
* <code>1277*(end-begin)</code>.
|
||||||
|
* However, <code>1*(end-begin)</code> plus
|
||||||
|
* the size of all packet data submitted to
|
||||||
|
* the repacketizer since the last call to
|
||||||
|
* opus_repacketizer_init() or
|
||||||
|
* opus_repacketizer_create() is also
|
||||||
|
* sufficient, and possibly much smaller.
|
||||||
|
* @returns The total size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG <code>[begin,end)</code> was an invalid range of
|
||||||
|
* frames (begin < 0, begin >= end, or end >
|
||||||
|
* opus_repacketizer_get_nb_frames()).
|
||||||
|
* @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain the
|
||||||
|
* complete output packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out_range(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
|
||||||
|
|
||||||
|
/** Return the total number of frames contained in packet data submitted to
|
||||||
|
* the repacketizer state so far via opus_repacketizer_cat() since the last
|
||||||
|
* call to opus_repacketizer_init() or opus_repacketizer_create().
|
||||||
|
* This defines the valid range of packets that can be extracted with
|
||||||
|
* opus_repacketizer_out_range() or opus_repacketizer_out().
|
||||||
|
* @param rp <tt>OpusRepacketizer*</tt>: The repacketizer state containing the
|
||||||
|
* frames.
|
||||||
|
* @returns The total number of frames contained in the packet data submitted
|
||||||
|
* to the repacketizer state.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Construct a new packet from data previously submitted to the repacketizer
|
||||||
|
* state via opus_repacketizer_cat().
|
||||||
|
* This is a convenience routine that returns all the data submitted so far
|
||||||
|
* in a single packet.
|
||||||
|
* It is equivalent to calling
|
||||||
|
* @code
|
||||||
|
* opus_repacketizer_out_range(rp, 0, opus_repacketizer_get_nb_frames(rp),
|
||||||
|
* data, maxlen)
|
||||||
|
* @endcode
|
||||||
|
* @param rp <tt>OpusRepacketizer*</tt>: The repacketizer state from which to
|
||||||
|
* construct the new packet.
|
||||||
|
* @param[out] data <tt>const unsigned char*</tt>: The buffer in which to
|
||||||
|
* store the output packet.
|
||||||
|
* @param maxlen <tt>opus_int32</tt>: The maximum number of bytes to store in
|
||||||
|
* the output buffer. In order to guarantee
|
||||||
|
* success, this should be at least
|
||||||
|
* <code>1277*opus_repacketizer_get_nb_frames(rp)</code>.
|
||||||
|
* However,
|
||||||
|
* <code>1*opus_repacketizer_get_nb_frames(rp)</code>
|
||||||
|
* plus the size of all packet data
|
||||||
|
* submitted to the repacketizer since the
|
||||||
|
* last call to opus_repacketizer_init() or
|
||||||
|
* opus_repacketizer_create() is also
|
||||||
|
* sufficient, and possibly much smaller.
|
||||||
|
* @returns The total size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain the
|
||||||
|
* complete output packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_repacketizer_out(OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen) OPUS_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/** Pads a given Opus packet to a larger size (possibly changing the TOC sequence).
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to pad.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding.
|
||||||
|
* This must be at least as large as len.
|
||||||
|
* @returns an error code
|
||||||
|
* @retval #OPUS_OK \a on success.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len);
|
||||||
|
|
||||||
|
/** Remove all padding from a given Opus packet and rewrite the TOC sequence to
|
||||||
|
* minimize space usage.
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to strip.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @returns The new size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_packet_unpad(unsigned char *data, opus_int32 len);
|
||||||
|
|
||||||
|
/** Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence).
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to pad.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param new_len <tt>opus_int32</tt>: The desired size of the packet after padding.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet.
|
||||||
|
* This must be at least as large as len.
|
||||||
|
* @returns an error code
|
||||||
|
* @retval #OPUS_OK \a on success.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT int opus_multistream_packet_pad(unsigned char *data, opus_int32 len, opus_int32 new_len, int nb_streams);
|
||||||
|
|
||||||
|
/** Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to
|
||||||
|
* minimize space usage.
|
||||||
|
* @param[in,out] data <tt>const unsigned char*</tt>: The buffer containing the
|
||||||
|
* packet to strip.
|
||||||
|
* @param len <tt>opus_int32</tt>: The size of the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @param nb_streams <tt>opus_int32</tt>: The number of streams (not channels) in the packet.
|
||||||
|
* This must be at least 1.
|
||||||
|
* @returns The new size of the output packet on success, or an error code
|
||||||
|
* on failure.
|
||||||
|
* @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
|
||||||
|
* @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
|
||||||
|
*/
|
||||||
|
OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, int nb_streams);
|
||||||
|
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OPUS_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user