Compare commits

..

27 Commits

Author SHA1 Message Date
mittorn
b9cf6b2c7e disable fov changing, add hud overlay 2023-09-19 00:13:55 +03:00
mittorn
f4e00c3159 HACK: make compositor work. Get glname from undistorted texture and put to compositor. need vr_use_offscreen_rendering enabled and multicore rendering disabled to work 2023-09-16 03:39:09 +03:00
mittorn
82d805508c Enable sourcevr build, make it build (but still not work) with modern openvr api 2023-09-15 20:31:16 +03:00
nillerusr
b7bd94c52e cstrike: fix uninitialized pointers in hud 2023-08-23 23:42:08 +03:00
nillerusr
1d4f7fb2cc change touch editor colors 2023-08-22 11:47:19 +03:00
nillerusr
b5d6051d98 cstrike: optimize flashbang 2023-08-22 11:38:13 +03:00
nillerusr
b73f3b70fa cstrike: add autojump convar 2023-08-22 11:11:39 +03:00
nillerusr
2d3f31d37e android: reset vsync after minimizing window 2023-08-18 15:40:38 +03:00
nillerusr
5ea9937457 android: fix black screen after minimizing window in materialsystem queue mode 2023-08-18 13:49:07 +03:00
nillerusr
601cfff164 game: fix touch transparency mode for cut scenes 2023-08-17 15:59:47 +03:00
nillerusr
4f10928299 inputsystem: fix UB in touch events callback, make touch more responsive 2023-08-17 14:31:43 +03:00
nillerusr
02a3c641a6 engine: fix loading static prop lump version 7 2023-08-15 16:47:35 +03:00
nillerusr
7f267853f4 vtf: fix vtf loading for windows arm( and for other platforms ) 2023-08-14 18:26:28 +03:00
nillerusr
3d0025b594 vtf: fix vtf header padding 2023-08-14 16:33:34 +03:00
nillerusr
b6cb0c2696 game: fix UB when reading mapcycle 2023-08-04 14:55:13 +03:00
nillerusr
8acf608b4d engine: optimize traces 2023-08-04 13:57:30 +03:00
nillerusr
0235b1ed4d vstdlib: remove old shitty osversion 2023-06-03 22:13:55 +03:00
nillerusr
226d22b896 waf: don't install some shared libraries when building sdk only 2023-05-24 16:46:25 +00:00
nillerusr
8b1be47f4d scripts: fix vpc_parser errror 2023-05-24 00:46:37 +03:00
nillerusr
ed901ead1a move stub steam api from thirdparty submodule 2023-05-23 22:32:30 +00:00
nillerusr
a6c26f4271 replace stlport with gnustl 2023-05-17 16:06:34 +00:00
nillerusr
523f4e9eaa vgui_controls: fix unitialized variable 2023-05-05 19:17:06 +03:00
nillerusr
697a9f34f9 Merge pull request #248 from nillerusr/mathlib-optimize
Mathlib optimize
2023-05-05 16:17:29 +00:00
nillerusr
3b1b08fd93 win32: fix sdl2 install path 2023-05-05 19:14:50 +03:00
nillerusr
1a584655d9 Merge pull request #244 from SanyaSho/dev/largeaddressaware
wscript: use "/LARGEADDRESSAWARE" on windows
2023-04-29 14:28:57 +00:00
SanyaSho
30f1e02cda wscript: use "/LARGEADDRESSAWARE" on windows 2023-04-28 19:45:47 +03:00
nillerusr
823e437005 wscript(android,windows): add sdl2 to installation path 2023-04-26 22:30:28 +03:00
46 changed files with 722 additions and 1853 deletions

View File

@@ -404,6 +404,9 @@ private:
int m_MouseButtonDownX;
int m_MouseButtonDownY;
bool m_bResetVsync;
int m_nFramesToSkip;
double m_flPrevGLSwapWindowTime;
};
@@ -584,6 +587,9 @@ InitReturnVal_t CSDLMgr::Init()
m_nWarpDelta = 0;
m_bRawInput = false;
m_nFramesToSkip = 0;
m_bResetVsync = false;
m_flPrevGLSwapWindowTime = 0.0f;
memset(m_pixelFormatAttribs, '\0', sizeof (m_pixelFormatAttribs));
@@ -1431,7 +1437,20 @@ void CSDLMgr::ShowPixels( CShowPixelsParams *params )
m_flPrevGLSwapWindowTime = tm.GetDurationInProgress().GetMillisecondsF();
#ifdef ANDROID
// ADRENO GPU MOMENT, SKIP 5 FRAMES
if( m_bResetVsync )
{
if( m_nFramesToSkip <= 0 )
{
SDL_GL_SetSwapInterval(swapInterval);
m_bResetVsync = false;
}
else
m_nFramesToSkip--;
}
#endif
CheckGLError( __LINE__ );
}
#endif // DX_TO_GL_ABSTRACTION
@@ -1887,6 +1906,7 @@ void CSDLMgr::PumpWindowsMessageLoop()
}
case SDL_WINDOWEVENT_FOCUS_GAINED:
{
m_bResetVsync = true; m_nFramesToSkip = 3;
m_bHasFocus = true;
SDL_ShowCursor( m_bCursorVisible ? 1 : 0 );
CCocoaEvent theEvent;

View File

@@ -873,9 +873,9 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush,
FPExceptionDisabler hideExceptions;
// Load the unaligned ray/box parameters into SIMD registers
fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());
fltx4 extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base());
fltx4 delta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base());
fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base());
fltx4 extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base());
fltx4 delta = LoadAlignedSIMD(pTraceInfo->m_delta.Base());
fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() );
fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() );
@@ -899,7 +899,7 @@ bool IntersectRayWithBoxBrush( TraceInfo_t *pTraceInfo, const cbrush_t *pBrush,
fltx4 crossPlane = OrSIMD(XorSIMD(startOutMins,endOutMins), XorSIMD(startOutMaxs,endOutMaxs));
// now build the per-axis interval of t for intersections
fltx4 invDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base());
fltx4 invDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base());
fltx4 tmins = MulSIMD( offsetMinsExpanded, invDelta );
fltx4 tmaxs = MulSIMD( offsetMaxsExpanded, invDelta );
// now sort the interval per axis
@@ -1037,9 +1037,9 @@ bool IntersectRayWithBox( const Ray_t &ray, const VectorAligned &inInvDelta, con
pTrace->fraction = 1.0f;
// Load the unaligned ray/box parameters into SIMD registers
fltx4 start = LoadUnaligned3SIMD(ray.m_Start.Base());
fltx4 extents = LoadUnaligned3SIMD(ray.m_Extents.Base());
fltx4 delta = LoadUnaligned3SIMD(ray.m_Delta.Base());
fltx4 start = LoadAlignedSIMD(ray.m_Start.Base());
fltx4 extents = LoadAlignedSIMD(ray.m_Extents.Base());
fltx4 delta = LoadAlignedSIMD(ray.m_Delta.Base());
fltx4 boxMins = LoadAlignedSIMD( inBoxMins.Base() );
fltx4 boxMaxs = LoadAlignedSIMD( inBoxMaxs.Base() );
@@ -1372,9 +1372,9 @@ void FASTCALL CM_ClipBoxToBrush( TraceInfo_t * RESTRICT pTraceInfo, const cbrush
inline bool IsTraceBoxIntersectingBoxBrush( TraceInfo_t *pTraceInfo, cboxbrush_t *pBox )
{
fltx4 start = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());
fltx4 mins = LoadUnaligned3SIMD(pTraceInfo->m_mins.Base());
fltx4 maxs = LoadUnaligned3SIMD(pTraceInfo->m_maxs.Base());
fltx4 start = LoadAlignedSIMD(pTraceInfo->m_start.Base());
fltx4 mins = LoadAlignedSIMD(pTraceInfo->m_mins.Base());
fltx4 maxs = LoadAlignedSIMD(pTraceInfo->m_maxs.Base());
fltx4 boxMins = LoadAlignedSIMD( pBox->mins.Base() );
fltx4 boxMaxs = LoadAlignedSIMD( pBox->maxs.Base() );
@@ -1569,15 +1569,15 @@ void FASTCALL CM_TraceToLeaf( TraceInfo_t * RESTRICT pTraceInfo, int ndxLeaf, fl
if (IsX360())
{
// set up some relatively constant variables we'll use in the loop below
fltx4 traceStart = LoadUnaligned3SIMD(pTraceInfo->m_start.Base());
fltx4 traceDelta = LoadUnaligned3SIMD(pTraceInfo->m_delta.Base());
fltx4 traceInvDelta = LoadUnaligned3SIMD(pTraceInfo->m_invDelta.Base());
fltx4 traceStart = LoadAlignedSIMD(pTraceInfo->m_start.Base());
fltx4 traceDelta = LoadAlignedSIMD(pTraceInfo->m_delta.Base());
fltx4 traceInvDelta = LoadAlignedSIMD(pTraceInfo->m_invDelta.Base());
static const fltx4 vecEpsilon = {DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON,DISPCOLL_DIST_EPSILON};
// only used in !IS_POINT version:
fltx4 extents;
if (!IS_POINT)
{
extents = LoadUnaligned3SIMD(pTraceInfo->m_extents.Base());
extents = LoadAlignedSIMD(pTraceInfo->m_extents.Base());
}
// TODO: this loop probably ought to be unrolled so that we can make a more efficient

View File

@@ -42,13 +42,13 @@ struct TraceInfo_t
m_nCheckDepth = -1;
}
Vector m_start;
Vector m_end;
Vector m_mins;
Vector m_maxs;
Vector m_extents;
Vector m_delta;
Vector m_invDelta;
VectorAligned m_start;
VectorAligned m_end;
VectorAligned m_mins;
VectorAligned m_maxs;
VectorAligned m_extents;
VectorAligned m_delta;
VectorAligned m_invDelta;
trace_t m_trace;
trace_t m_stabTrace;

View File

@@ -4934,7 +4934,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_
*/
// take advantage of high throughput/high latency
fltx4 planeNormal = LoadUnaligned3SIMD( plane->normal.Base() );
fltx4 planeNormal = LoadAlignedSIMD( plane->normal.Base() );
fltx4 vecBoxMin = LoadAlignedSIMD(pInfo->m_vecBoxMin);
fltx4 vecBoxMax = LoadAlignedSIMD(pInfo->m_vecBoxMax);
fltx4 cornermin, cornermax;

View File

@@ -987,7 +987,7 @@ private:
int m_iTree;
};
/*
class CIntersectPoint : public CPartitionVisitor
{
public:
@@ -1009,7 +1009,7 @@ public:
private:
fltx4 m_f4Point;
};
*/
class CIntersectBox : public CPartitionVisitor
{
@@ -1040,8 +1040,8 @@ class CIntersectRay : public CPartitionVisitor
public:
CIntersectRay( CVoxelTree *pPartition, const Ray_t &ray, const Vector &vecInvDelta ) : CPartitionVisitor( pPartition )
{
m_f4Start = LoadUnaligned3SIMD( ray.m_Start.Base() );
m_f4Delta = LoadUnaligned3SIMD( ray.m_Delta.Base() );
m_f4Start = LoadAlignedSIMD( ray.m_Start.Base() );
m_f4Delta = LoadAlignedSIMD( ray.m_Delta.Base() );
m_f4InvDelta = LoadUnaligned3SIMD( vecInvDelta.Base() );
}
@@ -1069,10 +1069,10 @@ class CIntersectSweptBox : public CPartitionVisitor
public:
CIntersectSweptBox( CVoxelTree *pPartition, const Ray_t &ray, const Vector &vecInvDelta ) : CPartitionVisitor( pPartition )
{
m_f4Start = LoadUnaligned3SIMD( ray.m_Start.Base() );
m_f4Delta = LoadUnaligned3SIMD( ray.m_Delta.Base() );
m_f4Start = LoadAlignedSIMD( ray.m_Start.Base() );
m_f4Delta = LoadAlignedSIMD( ray.m_Delta.Base() );
m_f4Extents = LoadAlignedSIMD( ray.m_Extents.Base() );
m_f4InvDelta = LoadUnaligned3SIMD( vecInvDelta.Base() );
m_f4Extents = LoadUnaligned3SIMD( ray.m_Extents.Base() );
}
bool Intersects( const float *pMins, const float *pMaxs ) const

View File

@@ -1339,7 +1339,6 @@ void CStaticPropMgr::UnserializeModels( CUtlBuffer& buf )
case 5: UnserializeLump<StaticPropLumpV5_t>(&lump, buf); break;
case 6: UnserializeLump<StaticPropLumpV6_t>(&lump, buf); break;
case 7: // Falls down to version 10. We promoted TF to version 10 to deal with SFM.
case 9: UnserializeLump<StaticPropLumpV9_t>(&lump, buf); break;
case 10:
{
if( s_MapVersion == 21 )
@@ -1348,7 +1347,8 @@ void CStaticPropMgr::UnserializeModels( CUtlBuffer& buf )
UnserializeLump<StaticPropLumpV10_t>(&lump, buf);
break;
}
case 11: UnserializeLump<StaticPropLumpV11_t>(&lump, buf);
case 9: UnserializeLump<StaticPropLumpV9_t>(&lump, buf); break;
case 11: UnserializeLump<StaticPropLumpV11_t>(&lump, buf); break;
default:
Assert("Unexpected version while deserializing lumps.");
}

View File

@@ -263,7 +263,6 @@ GameMessageHandler_t g_GameMessageHandlers[] =
{ IE_Quit, &CGame::HandleMsg_Close },
};
void CGame::AppActivate( bool fActive )
{
// If text mode, force it to be active.
@@ -299,8 +298,18 @@ void CGame::AppActivate( bool fActive )
// Clear keyboard states (should be cleared already but...)
// VGui_ActivateMouse will reactivate the mouse soon.
ClearIOStates();
UpdateMaterialSystemConfig();
#ifdef ANDROID
ConVarRef mat_queue_mode( "mat_queue_mode" );
// Hack to reset internal queue buffers
int nSavedQueueMode = mat_queue_mode.GetInt();
mat_queue_mode.SetValue( 0 );
materials->BeginFrame( host_frametime );
materials->EndFrame();
mat_queue_mode.SetValue( nSavedQueueMode );
#endif
}
else
{
@@ -355,7 +364,7 @@ void CGame::HandleMsg_Close( const InputEvent_t &event )
void CGame::DispatchInputEvent( const InputEvent_t &event )
{
switch( event.m_nType & 0xFFFF )
switch( event.m_nType )
{
// Handle button events specially,
// since we have all manner of crazy filtering going on when dealing with them

View File

@@ -696,6 +696,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo
int rt = _stat( path, buf );
// Workaround bug wherein stat() randomly fails on Windows XP. See comment on function.
/*
#if defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND)
if ( rt == -1 )
{
@@ -706,6 +707,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo
}
}
#endif // defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND)
*/
#if defined(LINUX) || defined(PLATFORM_BSD)
if ( rt == -1 )

View File

@@ -729,7 +729,7 @@ public:
void PrecacheMaterial( const char *pMaterialName );
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar );
virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 );
virtual void IN_TouchEvent( int type, int fingerId, int x, int y );
private:
void UncacheAllMaterials( );
@@ -1631,6 +1631,7 @@ void CHLClient::LevelInitPreEntity( char const* pMapName )
g_RagdollLVManager.SetLowViolence( pMapName );
gHUD.LevelInit();
gTouch.LevelInit();
#if defined( REPLAY_ENABLED )
// Initialize replay ragdoll recorder
@@ -2637,24 +2638,20 @@ CSteamID GetSteamIDForPlayerIndex( int iPlayerIndex )
#endif
void CHLClient::IN_TouchEvent( uint data, uint data2, uint data3, uint data4 )
void CHLClient::IN_TouchEvent( int type, int fingerId, int x, int y )
{
if( enginevgui->IsGameUIVisible() )
return;
touch_event_t ev;
ev.type = data & 0xFFFF;
ev.fingerid = (data >> 16) & 0xFFFF;
ev.x = (double)((data2 >> 16) & 0xFFFF) / 0xFFFF;
ev.y = (double)(data2 & 0xFFFF) / 0xFFFF;
ev.type = type;
ev.fingerid = fingerId;
memcpy( &ev.x, &x, sizeof(ev.x) );
memcpy( &ev.y, &y, sizeof(ev.y) );
union{uint i;float f;} ifconv;
ifconv.i = data3;
ev.dx = ifconv.f;
ifconv.i = data4;
ev.dy = ifconv.f;
if( type == IE_FingerMotion )
inputsystem->GetTouchAccumulators( fingerId, ev.dx, ev.dy );
gTouch.ProcessEvent( &ev );
}

View File

@@ -72,7 +72,7 @@ DECLARE_HUDELEMENT( CHudHealth );
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHudHealth::CHudHealth( const char *pElementName ) : CHudElement( pElementName ), CHudNumericDisplay(NULL, "HudHealth")
CHudHealth::CHudHealth( const char *pElementName ) : CHudElement( pElementName ), CHudNumericDisplay(NULL, "HudHealth"), m_pHealthIcon( NULL )
{
SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD );
}
@@ -172,4 +172,4 @@ void CHudHealth::Paint( void )
//draw the health icon
BaseClass::Paint();
}
}

View File

@@ -152,13 +152,13 @@ void CCSViewRender::PerformNightVisionEffect( const CViewSetup &view )
render->ViewDrawFade( overlaycolor, pMaterial );
// Only one pass in DX7.
if ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80 )
/* if ( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80 )
{
CMatRenderContextPtr pRenderContext( materials );
pRenderContext->DrawScreenSpaceQuad( pMaterial );
render->ViewDrawFade( overlaycolor, pMaterial );
pRenderContext->DrawScreenSpaceQuad( pMaterial );
}
}*/
}
}
}
@@ -211,6 +211,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view )
render->ViewDrawFade( overlaycolor, pMaterial );
// just do one pass for dxlevel < 80.
/*
if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80)
{
pRenderContext->DrawScreenSpaceRectangle( pMaterial, view.x, view.y, view.width, view.height,
@@ -221,6 +222,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view )
0, 0, m_pFlashTexture->GetActualWidth()-1, m_pFlashTexture->GetActualHeight()-1,
m_pFlashTexture->GetActualWidth(), m_pFlashTexture->GetActualHeight() );
}
*/
}
else if ( m_pFlashTexture )
{
@@ -233,7 +235,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view )
render->ViewDrawFade( overlaycolor, pMaterial );
// just do one pass for dxlevel < 80.
if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80)
/* if (g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 80)
{
pRenderContext->DrawScreenSpaceRectangle( pMaterial, view.x, view.y, view.width, view.height,
0, 0, m_pFlashTexture->GetActualWidth()-1, m_pFlashTexture->GetActualHeight()-1,
@@ -242,7 +244,7 @@ void CCSViewRender::PerformFlashbangEffect( const CViewSetup &view )
pRenderContext->DrawScreenSpaceRectangle( pMaterial, view.x, view.y, view.width, view.height,
0, 0, m_pFlashTexture->GetActualWidth()-1, m_pFlashTexture->GetActualHeight()-1,
m_pFlashTexture->GetActualWidth(), m_pFlashTexture->GetActualHeight() );
}
}*/
}
// this does the pure white overlay part of the flashbang effect.

View File

@@ -47,7 +47,7 @@ private:
DECLARE_HUDELEMENT( CHudArmor );
CHudArmor::CHudArmor( const char *pName ) : CHudNumericDisplay( NULL, "HudArmor" ), CHudElement( pName )
CHudArmor::CHudArmor( const char *pName ) : CHudNumericDisplay( NULL, "HudArmor" ), CHudElement( pName ), m_pArmorIcon( NULL )
{
SetHiddenBits( HIDEHUD_HEALTH | HIDEHUD_PLAYERDEAD );
}

View File

@@ -313,7 +313,7 @@ void CTouchControls::ResetToDefaults()
{
rgba_t color(255, 255, 255, 155);
char buf[MAX_PATH];
gridcolor = rgba_t(255, 0, 0, 50);
gridcolor = rgba_t(255, 0, 0, 30);
RemoveButtons();
@@ -372,7 +372,7 @@ void CTouchControls::Init()
mouse_events = 0;
move_start_x = move_start_y = 0.0f;
m_flPreviousYaw = m_flPreviousPitch = 0.f;
gridcolor = rgba_t(255, 0, 0, 50);
gridcolor = rgba_t(255, 0, 0, 30);
m_bCutScene = false;
showtexture = hidetexture = resettexture = closetexture = joytexture = 0;
@@ -425,6 +425,13 @@ void CTouchControls::Init()
initialized = true;
}
void CTouchControls::LevelInit()
{
m_bCutScene = false;
m_AlphaDiff = 0;
m_flHideTouch = 0;
}
int nextPowerOfTwo(int x)
{
if( (x & (x - 1)) == 0)
@@ -652,6 +659,8 @@ void CTouchControls::Paint()
CUtlLinkedList<CTouchButton*>::iterator it;
const rgba_t buttonEditClr = rgba_t( 61, 153, 0, 40 );
if( state == state_edit )
{
vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a*3); // 255, 0, 0, 200 <- default here
@@ -678,7 +687,7 @@ void CTouchControls::Paint()
g_pMatSystemSurface->DrawColoredText( 2, btn->x1*screen_w, btn->y1*screen_h+40, 255, 255, 255, 255, "RGBA: %d %d %d %d", btn->color.r, btn->color.g, btn->color.b, btn->color.a );// color
}
vgui::surface()->DrawSetColor(gridcolor.r, gridcolor.g, gridcolor.b, gridcolor.a); // 255, 0, 0, 50 <- default here
vgui::surface()->DrawSetColor(buttonEditClr.r, buttonEditClr.g, buttonEditClr.b, buttonEditClr.a); // 255, 0, 0, 50 <- default here
vgui::surface()->DrawFilledRect( btn->x1*screen_w, btn->y1*screen_h, btn->x2*screen_w, btn->y2*screen_h );
}
}

View File

@@ -161,6 +161,7 @@ class CTouchControls
{
public:
void Init( );
void LevelInit( );
void Shutdown( );
void Paint( );

View File

@@ -28,7 +28,7 @@ extern bool g_bMovementOptimizations;
ConVar sv_timebetweenducks( "sv_timebetweenducks", "0", FCVAR_REPLICATED, "Minimum time before recognizing consecutive duck key", true, 0.0, true, 2.0 );
ConVar sv_enableboost( "sv_enableboost", "0", FCVAR_REPLICATED | FCVAR_NOTIFY, "Allow boost exploits");
ConVar cs_autojump( "cs_autojump", "0", FCVAR_REPLICATED | FCVAR_NOTIFY );
class CCSGameMovement : public CGameMovement
{
@@ -691,8 +691,11 @@ bool CCSGameMovement::CheckJumpButton( void )
return false; // in air, so no effect
}
if ( mv->m_nOldButtons & IN_JUMP )
if ( (mv->m_nOldButtons & IN_JUMP) &&
(!cs_autojump.GetBool() && m_pCSPlayer->GetGroundEntity()) )
{
return false; // don't pogo stick
}
if ( !sv_enablebunnyhopping.GetBool() )
{

View File

@@ -1151,12 +1151,14 @@ ConVarRef suitcharger( "sk_suitcharger" );
void StripChar(char *szBuffer, const char cWhiteSpace )
{
char *src, *dst;
while ( char *pSpace = strchr( szBuffer, cWhiteSpace ) )
for (src = dst = szBuffer; *src != '\0'; src++)
{
char *pNextChar = pSpace + sizeof(char);
V_strcpy( pSpace, pNextChar );
*dst = *src;
if (*dst != cWhiteSpace) dst++;
}
*dst = '\0';
}
void CMultiplayRules::GetNextLevelName( char *pszNextMap, int bufsize, bool bRandom /* = false */ )

View File

@@ -1530,16 +1530,6 @@ bool CInputSystem::GetRawMouseAccumulators( int& accumX, int& accumY )
#endif
}
bool CInputSystem::GetTouchAccumulators( InputEventType_t &event, int &fingerId, int& accumX, int& accumY )
{
event = m_touchAccumEvent;
fingerId = m_touchAccumFingerId;
accumX = m_touchAccumX;
accumY = m_touchAccumY;
return m_bJoystickInitialized;
}
void CInputSystem::SetConsoleTextMode( bool bConsoleTextMode )
{
/* If someone calls this after init, shut it down. */

View File

@@ -44,6 +44,8 @@
#include "steam/steam_api.h"
#define TOUCH_FINGER_MAX_COUNT 10
//-----------------------------------------------------------------------------
// Implementation of the input system
//-----------------------------------------------------------------------------
@@ -101,7 +103,7 @@ public:
virtual void *GetHapticsInterfaceAddress() const { return NULL;}
#endif
bool GetRawMouseAccumulators( int& accumX, int& accumY );
bool GetTouchAccumulators( InputEventType_t &event, int &fingerId, int& accumX, int& accumY );
virtual bool GetTouchAccumulators( int fingerId, float &dx, float &dy );
virtual void SetConsoleTextMode( bool bConsoleTextMode );
@@ -458,8 +460,7 @@ public:
bool m_bRawInputSupported;
int m_mouseRawAccumX, m_mouseRawAccumY;
InputEventType_t m_touchAccumEvent;
int m_touchAccumFingerId, m_touchAccumX, m_touchAccumY;
float m_touchAccumX[TOUCH_FINGER_MAX_COUNT], m_touchAccumY[TOUCH_FINGER_MAX_COUNT];
// For the 'SleepUntilInput' feature
HANDLE m_hEvent;

View File

@@ -48,6 +48,9 @@ void CInputSystem::InitializeTouch( void )
// abort startup if user requests no touch
if ( CommandLine()->FindParm("-notouch") ) return;
memset( m_touchAccumX, 0, sizeof(m_touchAccumX) );
memset( m_touchAccumY, 0, sizeof(m_touchAccumY) );
m_bJoystickInitialized = true;
SDL_AddEventWatch(TouchSDLWatcher, this);
}
@@ -61,20 +64,35 @@ void CInputSystem::ShutdownTouch()
m_bTouchInitialized = false;
}
bool CInputSystem::GetTouchAccumulators( int fingerId, float &dx, float &dy )
{
dx = m_touchAccumX[fingerId];
dy = m_touchAccumY[fingerId];
m_touchAccumX[fingerId] = m_touchAccumY[fingerId] = 0.f;
return true;
}
void CInputSystem::FingerEvent(int eventType, int fingerId, float x, float y, float dx, float dy)
{
// Shit, but should work with arm/x86
if( fingerId >= TOUCH_FINGER_MAX_COUNT )
return;
int data0 = fingerId << 16 | eventType;
int _x = (int)((double)x*0xFFFF);
int _y = (int)((double)y*0xFFFF);
int data1 = _x << 16 | (_y & 0xFFFF);
if( eventType == IE_FingerUp )
{
m_touchAccumX[fingerId] = 0.f;
m_touchAccumY[fingerId] = 0.f;
}
else
{
m_touchAccumX[fingerId] += dx;
m_touchAccumY[fingerId] += dy;
}
union{int i;float f;} ifconv;
ifconv.f = dx;
int _dx = ifconv.i;
ifconv.f = dy;
int _dy = ifconv.i;
PostEvent(data0, m_nLastSampleTick, data1, _dx, _dy);
int _x,_y;
memcpy( &_x, &x, sizeof(float) );
memcpy( &_y, &y, sizeof(float) );
PostEvent(eventType, m_nLastSampleTick, fingerId, _x, _y);
}

View File

@@ -43,17 +43,8 @@ def build(bld):
if bld.env.DEST_OS == 'win32':
libs += ['USER32']
install_path = bld.env.LIBDIR
# Copy SDL2 dependency
if bld.env.DEST_OS == 'win32':
bld(
rule=(('cp' if 'MSYSTEM' in os.environ or sys.platform != 'win32' else 'copy')+' ${SRC} ${TGT}'),
source='../lib/win32/'+bld.env.DEST_CPU+'/SDL2.dll',
target='SDL2.dll',
install_path=install_path,
)
install_path = bld.env.LIBDIR
bld.shlib(
source = source,

View File

@@ -501,6 +501,7 @@ public:
DELEGATE_TO_OBJECT_0( bool, OnFlushBufferedPrimitives, GetRenderContextInternal() );
void OnThreadEvent( uint32 threadEvent );
ShaderAPITextureHandle_t GetShaderAPITextureBindHandle( ITexture *pTexture, int nFrame, int nTextureChannel ); // JasonM ????
uint32_t GetShaderAPIGLTexture( ITexture *pTexture, int nFrame, int nTextureChannel ); // fuck

View File

@@ -0,0 +1,53 @@
#include "pch_materialsystem.h"
#include "togl/rendermechanism.h"
#define MATSYS_INTERNAL
#include "cmaterialsystem.h"
//-----------------------------------------------------------------------------
// The Base implementation of the shader rendering interface
//-----------------------------------------------------------------------------
class CShaderAPIBase : public IShaderAPI
{
public:
// constructor, destructor
CShaderAPIBase();
virtual ~CShaderAPIBase();
// Called when the device is initializing or shutting down
virtual bool OnDeviceInit() = 0;
virtual void OnDeviceShutdown() = 0;
// Pix events
virtual void BeginPIXEvent( unsigned long color, const char *szName ) = 0;
virtual void EndPIXEvent() = 0;
virtual void AdvancePIXFrame() = 0;
// Release, reacquire objects
virtual void ReleaseShaderObjects() = 0;
virtual void RestoreShaderObjects() = 0;
// Resets the render state to its well defined initial value
virtual void ResetRenderState( bool bFullReset = true ) = 0;
// Returns a d3d texture associated with a texture handle
virtual IDirect3DBaseTexture9* GetD3DTexture( ShaderAPITextureHandle_t hTexture ) = 0;
// Queues a non-full reset of render state next BeginFrame.
virtual void QueueResetRenderState() = 0;
// Methods of IShaderDynamicAPI
public:
virtual void GetCurrentColorCorrection( ShaderColorCorrectionInfo_t* pInfo );
protected:
};
uint32_t CMaterialSystem::GetShaderAPIGLTexture( ITexture *pTexture, int nFrame, int nTextureChannel )
{
ShaderAPITextureHandle_t handle = ShaderSystem()->GetShaderAPITextureBindHandle( pTexture, nFrame, nTextureChannel );
IDirect3DTexture9* pTex = ((CShaderAPIBase*)g_pShaderAPI)->GetD3DTexture(handle);
IDirect3DSurface9* surf = pTex->m_surfZero;
CGLMTex *tex = surf->m_tex;
return tex->GetTexName();
}

View File

@@ -2276,7 +2276,7 @@ public:
{
return false;
}
virtual uint32_t GetShaderAPIGLTexture(ITexture*, int, int) {return 0;}
};

View File

@@ -45,6 +45,7 @@ def build(bld):
'cmatrendercontext.cpp',
'cmatqueuedrendercontext.cpp',
'ctexturecompositor.cpp',
'gltexturehack.cpp',
'../public/tier0/memoverride.cpp'
]

View File

@@ -790,7 +790,7 @@ public:
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0;
virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ) = 0;
virtual void IN_TouchEvent( int type, int fingerId, int x, int y ) = 0;
};
#define CLIENT_DLL_INTERFACE_VERSION "VClient017"

View File

@@ -119,6 +119,7 @@ public:
// read and clear accumulated raw input values
virtual bool GetRawMouseAccumulators( int& accumX, int& accumY ) = 0;
virtual bool GetTouchAccumulators( int fingerId, float &dx, float &dy ) = 0;
// tell the input system that we're not a game, we're console text mode.
// this is used for dedicated servers to not initialize joystick system.

View File

@@ -1093,6 +1093,7 @@ public:
// Performs final verification of all compositor templates (after they've all been initially loaded).
virtual bool VerifyTextureCompositorTemplates( ) = 0;
virtual uint32_t GetShaderAPIGLTexture( ITexture *pTexture, int nFrame, int nTextureChannel ) = 0;
};

View File

@@ -114,7 +114,7 @@ inline T clamp( T const &val, T const &minVal, T const &maxVal )
// FIXME: this should move to a different file
struct cplane_t
{
Vector normal;
VectorAligned normal;
float dist;
byte type; // for fast side tests
byte signbits; // signx + (signy<<1) + (signz<<1)

File diff suppressed because it is too large Load Diff

View File

@@ -1,130 +0,0 @@
//====== Copyright (c) 1996-2014, Valve Corporation, All rights reserved. =======
//
// Purpose: Header for flatted SteamAPI. Use this for binding to other languages.
// This file is auto-generated, do not edit it.
//
//=============================================================================
#ifndef __OPENVR_API_FLAT_H__
#define __OPENVR_API_FLAT_H__
#ifdef _WIN32
#pragma once
#endif
// OPENVR API export macro
#if defined( _WIN32 ) && !defined( _X360 )
#if defined( OPENVR_API_EXPORTS )
#define S_API extern "C" __declspec( dllexport )
#elif defined( OPENVR_API_NODLL )
#define S_API extern "C"
#else
#define S_API extern "C" __declspec( dllimport )
#endif // OPENVR_API_EXPORTS
#elif defined( GNUC )
#if defined( OPENVR_API_EXPORTS )
#define S_API extern "C" __attribute__ ((visibility("default")))
#else
#define S_API extern "C"
#endif // OPENVR_API_EXPORTS
#else // !WIN32
#if defined( OPENVR_API_EXPORTS )
#define S_API extern "C"
#else
#define S_API extern "C"
#endif // OPENVR_API_EXPORTS
#endif
#include <stdint.h>
#include "openvr.h"
#include "ivrsystem.h"
#include "ivrcameraaccess.h"
#include "ivrchaperone.h"
#include "ivrchaperonesetup.h"
#include "ivrcompositor.h"
S_API void VR_IVRSystem_GetWindowBounds(intptr_t instancePtr, int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
S_API void VR_IVRSystem_GetRecommendedRenderTargetSize(intptr_t instancePtr, uint32_t * pnWidth, uint32_t * pnHeight);
S_API void VR_IVRSystem_GetEyeOutputViewport(intptr_t instancePtr, vr::Hmd_Eye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
S_API struct vr::HmdMatrix44_t VR_IVRSystem_GetProjectionMatrix(intptr_t instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType);
S_API void VR_IVRSystem_GetProjectionRaw(intptr_t instancePtr, vr::Hmd_Eye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom);
S_API struct vr::DistortionCoordinates_t VR_IVRSystem_ComputeDistortion(intptr_t instancePtr, vr::Hmd_Eye eEye, float fU, float fV);
S_API struct vr::HmdMatrix34_t VR_IVRSystem_GetEyeToHeadTransform(intptr_t instancePtr, vr::Hmd_Eye eEye);
S_API bool VR_IVRSystem_GetTimeSinceLastVsync(intptr_t instancePtr, float * pfSecondsSinceLastVsync, uint64_t * pulFrameCounter);
S_API int32_t VR_IVRSystem_GetD3D9AdapterIndex(intptr_t instancePtr);
S_API void VR_IVRSystem_GetDXGIOutputInfo(intptr_t instancePtr, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex);
S_API bool VR_IVRSystem_AttachToWindow(intptr_t instancePtr, void * hWnd);
S_API void VR_IVRSystem_GetDeviceToAbsoluteTrackingPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, struct vr::TrackedDevicePose_t * pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount);
S_API void VR_IVRSystem_ResetSeatedZeroPose(intptr_t instancePtr);
S_API struct vr::HmdMatrix34_t VR_IVRSystem_GetSeatedZeroPoseToStandingAbsoluteTrackingPose(intptr_t instancePtr);
S_API bool VR_IVRSystem_LoadRenderModel(intptr_t instancePtr, const char * pchRenderModelName, struct vr::RenderModel_t * pRenderModel);
S_API void VR_IVRSystem_FreeRenderModel(intptr_t instancePtr, struct vr::RenderModel_t * pRenderModel);
S_API vr::TrackedDeviceClass VR_IVRSystem_GetTrackedDeviceClass(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex);
S_API bool VR_IVRSystem_IsTrackedDeviceConnected(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex);
S_API bool VR_IVRSystem_GetBoolTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API float VR_IVRSystem_GetFloatTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API int32_t VR_IVRSystem_GetInt32TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API uint64_t VR_IVRSystem_GetUint64TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API struct vr::HmdMatrix34_t VR_IVRSystem_GetMatrix34TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
S_API uint32_t VR_IVRSystem_GetStringTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, char * pchValue, uint32_t unBufferSize, vr::TrackedPropertyError * pError);
S_API const char * VR_IVRSystem_GetPropErrorNameFromEnum(intptr_t instancePtr, vr::TrackedPropertyError error);
S_API bool VR_IVRSystem_PollNextEvent(intptr_t instancePtr, struct vr::VREvent_t * pEvent);
S_API bool VR_IVRSystem_PollNextEventWithPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, vr::VREvent_t * pEvent, vr::TrackedDevicePose_t * pTrackedDevicePose);
S_API const char * VR_IVRSystem_GetEventTypeNameFromEnum(intptr_t instancePtr, vr::EVREventType eType);
S_API struct vr::HiddenAreaMesh_t VR_IVRSystem_GetHiddenAreaMesh(intptr_t instancePtr, vr::Hmd_Eye eEye);
S_API bool VR_IVRSystem_GetControllerState(intptr_t instancePtr, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t * pControllerState);
S_API bool VR_IVRSystem_GetControllerStateWithPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t * pControllerState, struct vr::TrackedDevicePose_t * pTrackedDevicePose);
S_API void VR_IVRSystem_TriggerHapticPulse(intptr_t instancePtr, vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec);
S_API const char * VR_IVRSystem_GetButtonIdNameFromEnum(intptr_t instancePtr, vr::EVRButtonId eButtonId);
S_API const char * VR_IVRSystem_GetControllerAxisTypeNameFromEnum(intptr_t instancePtr, vr::EVRControllerAxisType eAxisType);
S_API bool VR_IVRSystem_HandleControllerOverlayInteractionAsMouse(intptr_t instancePtr, const vr::Compositor_OverlaySettings & overlaySettings, vr::HmdVector2_t vecWindowClientPositionOnScreen, vr::HmdVector2_t vecWindowClientSize, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::EVRControllerEventOutputType eOutputType);
S_API bool VR_IVRSystem_CaptureInputFocus(intptr_t instancePtr);
S_API void VR_IVRSystem_ReleaseInputFocus(intptr_t instancePtr);
S_API bool VR_IVRSystem_IsInputFocusCapturedByAnotherProcess(intptr_t instancePtr);
S_API uint32_t VR_IVRCameraAccess_GetCameraCount(intptr_t instancePtr);
S_API uint32_t VR_IVRCameraAccess_GetCameraId(intptr_t instancePtr, uint32_t unCameraIndex, char * pchBuffer, uint32_t unBufferLen);
S_API bool VR_IVRCameraAccess_EnableCamera(intptr_t instancePtr, uint32_t unCameraIndex, bool bEnabled);
S_API bool VR_IVRCameraAccess_GetCameraInfo(intptr_t instancePtr, uint32_t unCameraIndex, struct vr::CameraInfo_t * pCameraInfo);
S_API bool VR_IVRCameraAccess_GetCameraImage(intptr_t instancePtr, uint32_t unCameraIndex, struct vr::CameraImage_t * pCameraImage);
S_API vr::ChaperoneCalibrationState VR_IVRChaperone_GetCalibrationState(intptr_t instancePtr);
S_API bool VR_IVRChaperone_GetSoftBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
S_API bool VR_IVRChaperone_GetHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount);
S_API bool VR_IVRChaperone_GetSeatedBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSeatedBoundsInfo_t * pInfo);
S_API bool VR_IVRChaperoneSetup_CommitWorkingCopy(intptr_t instancePtr, const char * pchCalibrationName);
S_API void VR_IVRChaperoneSetup_RevertWorkingCopy(intptr_t instancePtr);
S_API bool VR_IVRChaperoneSetup_GetWorkingSoftBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
S_API bool VR_IVRChaperoneSetup_GetWorkingHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount);
S_API bool VR_IVRChaperoneSetup_GetWorkingSeatedZeroPoseToRawTrackingPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmatSeatedZeroPoseToRawTrackingPose);
S_API bool VR_IVRChaperoneSetup_GetWorkingStandingZeroPoseToRawTrackingPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmatStandingZeroPoseToRawTrackingPose);
S_API void VR_IVRChaperoneSetup_SetWorkingSoftBoundsInfo(intptr_t instancePtr, const struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
S_API void VR_IVRChaperoneSetup_SetWorkingHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t unQuadsCount);
S_API void VR_IVRChaperoneSetup_SetWorkingSeatedZeroPoseToRawTrackingPose(intptr_t instancePtr, const struct vr::HmdMatrix34_t & matSeatedZeroPoseToRawTrackingPose);
S_API void VR_IVRChaperoneSetup_SetWorkingStandingZeroPoseToRawTrackingPose(intptr_t instancePtr, const struct vr::HmdMatrix34_t & matStandingZeroPoseToRawTrackingPose);
S_API uint32_t VR_IVRCompositor_GetLastError(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferSize);
S_API void VR_IVRCompositor_SetVSync(intptr_t instancePtr, bool bVSync);
S_API bool VR_IVRCompositor_GetVSync(intptr_t instancePtr);
S_API void VR_IVRCompositor_SetGamma(intptr_t instancePtr, float fGamma);
S_API float VR_IVRCompositor_GetGamma(intptr_t instancePtr);
S_API void VR_IVRCompositor_SetGraphicsDevice(intptr_t instancePtr, vr::Compositor_DeviceType eType, void * pDevice);
S_API void VR_IVRCompositor_WaitGetPoses(intptr_t instancePtr, struct vr::TrackedDevicePose_t * pPoseArray, uint32_t unPoseArrayCount);
S_API void VR_IVRCompositor_Submit(intptr_t instancePtr, vr::Hmd_Eye eEye, void * pTexture, struct vr::Compositor_TextureBounds * pBounds);
S_API void VR_IVRCompositor_ClearLastSubmittedFrame(intptr_t instancePtr);
S_API void VR_IVRCompositor_GetOverlayDefaults(intptr_t instancePtr, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_SetOverlay(intptr_t instancePtr, void * pTexture, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_SetOverlayRaw(intptr_t instancePtr, void * buffer, uint32_t width, uint32_t height, uint32_t depth, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_SetOverlayFromFile(intptr_t instancePtr, const char * pchFilePath, struct vr::Compositor_OverlaySettings * pSettings);
S_API void VR_IVRCompositor_ClearOverlay(intptr_t instancePtr);
S_API bool VR_IVRCompositor_GetFrameTiming(intptr_t instancePtr, struct vr::Compositor_FrameTiming * pTiming, uint32_t unFramesAgo);
S_API void VR_IVRCompositor_FadeToColor(intptr_t instancePtr, float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground);
S_API void VR_IVRCompositor_FadeGrid(intptr_t instancePtr, float fSeconds, bool bFadeIn);
S_API void VR_IVRCompositor_CompositorBringToFront(intptr_t instancePtr);
S_API void VR_IVRCompositor_CompositorGoToBack(intptr_t instancePtr);
S_API void VR_IVRCompositor_CompositorQuit(intptr_t instancePtr);
S_API bool VR_IVRCompositor_IsFullscreen(intptr_t instancePtr);
S_API bool VR_IVRCompositor_ComputeOverlayIntersection(intptr_t instancePtr, const struct vr::Compositor_OverlaySettings * pSettings, float fAspectRatio, vr::TrackingUniverseOrigin eOrigin, vr::HmdVector3_t vSource, vr::HmdVector3_t vDirection, vr::HmdVector2_t * pvecIntersectionUV, vr::HmdVector3_t * pvecIntersectionTrackingSpace);
S_API void VR_IVRCompositor_SetTrackingSpace(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin);
S_API vr::TrackingUniverseOrigin VR_IVRCompositor_GetTrackingSpace(intptr_t instancePtr);
#endif // __OPENVR_API_FLAT_H__

View File

@@ -455,7 +455,9 @@ bool GetVTFPreload360Data( const char *pDebugName, CUtlBuffer &fileBufferIn, CUt
// compiler pads, the 360 compiler does NOT.
//-----------------------------------------------------------------------------
struct VTFFileBaseHeader_t
// nillerusr: try to avoid problems with pragma pack, remove c++ inheritance to make this structs platform-independent
struct alignas(16) VTFFileBaseHeader_t
{
DECLARE_BYTESWAP_DATADESC();
char fileTypeString[4]; // "VTF" Valve texture file
@@ -463,22 +465,23 @@ struct VTFFileBaseHeader_t
int headerSize;
};
struct VTFFileHeaderV7_1_t : public VTFFileBaseHeader_t
struct alignas(16) VTFFileHeaderV7_1_t
{
DECLARE_BYTESWAP_DATADESC();
char fileTypeString[4]; // "VTF" Valve texture file
int version[2]; // version[0].version[1]
int headerSize;
unsigned short width;
unsigned short height;
unsigned int flags;
unsigned short numFrames;
unsigned short startFrame;
#if !defined( POSIX ) && !defined( _X360 )
VectorAligned reflectivity;
#else
// must manually align in order to maintain pack(1) expected layout with existing binaries
char pad1[4];
Vector reflectivity;
char pad2[4];
#endif
char pad1[4];
VectorAligned reflectivity;
float bumpScale;
ImageFormat imageFormat;
unsigned char numMipLevels;
@@ -487,13 +490,65 @@ struct VTFFileHeaderV7_1_t : public VTFFileBaseHeader_t
unsigned char lowResImageHeight;
};
struct VTFFileHeaderV7_2_t : public VTFFileHeaderV7_1_t
struct alignas(16) VTFFileHeaderV7_2_t
{
DECLARE_BYTESWAP_DATADESC();
char fileTypeString[4]; // "VTF" Valve texture file
int version[2]; // version[0].version[1]
int headerSize;
unsigned short width;
unsigned short height;
unsigned int flags;
unsigned short numFrames;
unsigned short startFrame;
// must manually align in order to maintain pack(1) expected layout with existing binaries
char pad1[4];
VectorAligned reflectivity;
float bumpScale;
ImageFormat imageFormat;
unsigned char numMipLevels;
ImageFormat lowResImageFormat;
unsigned char lowResImageWidth;
unsigned char lowResImageHeight;
unsigned short depth;
};
struct alignas(16) VTFFileHeaderV7_3_t
{
DECLARE_BYTESWAP_DATADESC();
char fileTypeString[4]; // "VTF" Valve texture file
int version[2]; // version[0].version[1]
int headerSize;
unsigned short width;
unsigned short height;
unsigned int flags;
unsigned short numFrames;
unsigned short startFrame;
// must manually align in order to maintain pack(1) expected layout with existing binaries
char pad1[4];
VectorAligned reflectivity;
float bumpScale;
ImageFormat imageFormat;
unsigned char numMipLevels;
ImageFormat lowResImageFormat;
unsigned char lowResImageWidth;
unsigned char lowResImageHeight;
unsigned short depth;
char pad4[3];
unsigned int numResources;
};
typedef VTFFileHeaderV7_3_t VTFFileHeader_t;
#define BYTE_POS( byteVal, shft ) uint32( uint32(uint8(byteVal)) << uint8(shft * 8) )
#if !defined( _X360 )
#define MK_VTF_RSRC_ID(a, b, c) uint32( BYTE_POS(a, 0) | BYTE_POS(b, 1) | BYTE_POS(c, 2) )
@@ -538,28 +593,6 @@ struct ResourceEntryInfo
unsigned int resData; // Resource data or offset from the beginning of the file
};
struct VTFFileHeaderV7_3_t : public VTFFileHeaderV7_2_t
{
DECLARE_BYTESWAP_DATADESC();
char pad4[3];
unsigned int numResources;
#if defined( _X360 ) || defined( POSIX )
// must manually align in order to maintain pack(1) expected layout with existing binaries
char pad5[8];
#endif
// AFTER THE IMPLICIT PADDING CAUSED BY THE COMPILER....
// *** followed by *** ResourceEntryInfo resources[0];
// Array of resource entry infos sorted ascending by type
};
struct VTFFileHeader_t : public VTFFileHeaderV7_3_t
{
DECLARE_BYTESWAP_DATADESC();
};
#define VTF_X360_MAJOR_VERSION 0x0360
#define VTF_X360_MINOR_VERSION 8
struct VTFFileHeaderX360_t : public VTFFileBaseHeader_t

View File

@@ -90,6 +90,9 @@ def fix_dos_path( path ):
if find_path == '': find_path = './'
else: find_path += '/'
if not os.path.exists(find_path):
return find_path+filename
dirlist = os.listdir(find_path)
for file in dirlist:
if file == filename:

View File

@@ -215,7 +215,6 @@ class Android:
# TODO: proper STL support
return [
#os.path.abspath(os.path.join(self.ndk_home, 'sources', 'cxx-stl', 'system', 'include')),
os.path.abspath(os.path.join(self.ndk_home, 'sources', 'cxx-stl', 'stlport', 'stlport')),
os.path.abspath(os.path.join(self.ndk_home, 'sources', 'android', 'support', 'include'))
]
@@ -346,8 +345,12 @@ def configure(conf):
conf.env.CXXFLAGS += android.cflags(True)
conf.env.LINKFLAGS += android.linkflags()
conf.env.LDFLAGS += android.ldflags()
conf.env.STLIBPATH += [os.path.abspath(os.path.join(android.ndk_home, 'sources','cxx-stl','stlport','libs',stlarch))]
conf.env.LDFLAGS += ['-lstlport_static']
conf.env.INCLUDES += [
os.path.abspath(os.path.join(android.ndk_home, 'sources', 'cxx-stl', 'gnu-libstdc++', '4.9', 'include')),
os.path.abspath(os.path.join(android.ndk_home, 'sources', 'cxx-stl', 'gnu-libstdc++', '4.9', 'libs', stlarch, 'include'))
]
conf.env.STLIBPATH += [os.path.abspath(os.path.join(android.ndk_home, 'sources','cxx-stl','gnu-libstdc++','4.9','libs',stlarch))]
conf.env.LDFLAGS += ['-lgnustl_static']
conf.env.HAVE_M = True
if android.is_hardfp():

View File

@@ -80,7 +80,7 @@ CSourceVirtualReality::CSourceVirtualReality()
m_textureGeneratorRight( vr::Eye_Right )
{
m_bActive = false;
m_bUsingOffscreenRenderTarget = false;
m_bUsingOffscreenRenderTarget = true;
m_pHmd = NULL;
}
@@ -207,7 +207,11 @@ void CDistortionTextureRegen::RegenerateTextureBits( ITexture *pTexture, IVTFTex
float u = ( (float)x + 0.5f) / fWidth;
float v = ( (float)y + 0.5f) / fHeight;
DistortionCoordinates_t coords = g_SourceVirtualReality.GetHmd()->ComputeDistortion( m_eEye, u, v );
DistortionCoordinates_t coords;
if(!g_SourceVirtualReality.GetHmd()->ComputeDistortion( m_eEye, u, v, &coords ))
{
Warning("ComputeDistortion failed");
}
coords.rfRed[0] = Clamp( coords.rfRed[0], 0.f, 1.f ) * fUScale + fUOffset;
coords.rfGreen[0] = Clamp( coords.rfGreen[0], 0.f, 1.f ) * fUScale + fUOffset;
@@ -277,9 +281,9 @@ bool CSourceVirtualReality::GetDisplayBounds( VRRect_t *pRect )
{
if( m_pHmd )
{
int32_t x, y;
uint32_t width, height;
m_pHmd->GetWindowBounds( &x, &y, &width, &height );
int32_t x = 0, y = 0;
uint32_t width = 1024, height = 1024;
m_pExtDisplay->GetWindowBounds( &x, &y, &width, &height );
pRect->nX = x;
pRect->nY = y;
pRect->nWidth = width;
@@ -420,8 +424,9 @@ void CSourceVirtualReality::GetViewportBounds( VREye eEye, int *pnX, int *pnY, i
}
else
{
uint32_t x, y, w, h;
m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
uint32_t x = 0, y = 0, w = 640, h = 480;
// m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
m_pExtDisplay->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
if( pnX && pnY )
{
*pnX = x;
@@ -446,14 +451,14 @@ VMatrix CSourceVirtualReality::GetMideyePose()
// ----------------------------------------------------------------------
inline static void ComposeProjectionTransform(float fLeft, float fRight, float fTop, float fBottom, float zNear, float zFar, float fovScale, VMatrix *pmProj )
{
if( fovScale != 1.0f && fovScale > 0.f )
/*if( fovScale != 1.0f && fovScale > 0.f )
{
float fFovScaleAdjusted = tan( atan( fTop ) / fovScale ) / fTop;
fRight *= fFovScaleAdjusted;
fLeft *= fFovScaleAdjusted;
fTop *= fFovScaleAdjusted;
fBottom *= fFovScaleAdjusted;
}
}*/
float idx = 1.0f / (fRight - fLeft);
float idy = 1.0f / (fBottom - fTop);
@@ -530,15 +535,21 @@ bool CSourceVirtualReality::WillDriftInYaw()
void CSourceVirtualReality::AcquireNewZeroPose()
{
// just let the next tracker update re-zero us
if( m_pHmd )
m_pHmd->ResetSeatedZeroPose();
if( m_pChap )
m_pChap->ResetZeroPose(TrackingUniverseSeated);
}
bool CSourceVirtualReality::SampleTrackingState ( float PlayerGameFov, float fPredictionSeconds )
{
if( !m_pHmd || !m_bActive )
return false;
vr::VREvent_t event;
while( m_pHmd->PollNextEvent( &event, sizeof( event ) ) )
{
//ProcessVREvent( event );
}
vr::TrackedDevicePose_t m_rTrackedDevicePose[ vr::k_unMaxTrackedDeviceCount ];
vr::VRCompositor()->WaitGetPoses(m_rTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0 );
// If tracker can't return a pose (it's possibly recalibrating itself)
// then we will freeze tracking at its current state, rather than
// snapping it back to the zero position
@@ -572,6 +583,7 @@ bool CSourceVirtualReality::SampleTrackingState ( float PlayerGameFov, float fPr
return true;
}
#include "togl/rendermechanism.h"
// ----------------------------------------------------------------------
@@ -589,10 +601,16 @@ bool CSourceVirtualReality::DoDistortionProcessing ( VREye eEye )
CMatRenderContextPtr pRenderContext( materials );
IMaterial *pDistortMaterial;
ITexture *pDistortTexture;
if( eEye == VREye_Left )
pDistortMaterial = m_DistortLeftMaterial;
else
pDistortMaterial = m_DistortRightMaterial;
if( eEye == VREye_Left )
pDistortTexture = m_pDistortionTextureLeft;
else
pDistortTexture = m_pDistortionTextureRight;
if( !UsingOffscreenRenderTarget() )
{
@@ -602,17 +620,48 @@ bool CSourceVirtualReality::DoDistortionProcessing ( VREye eEye )
return false;
Rect_t r;
r.x = !eEye?0:640;
r.y = 0;
r.width = 640;
r.height = 480;
this->GetViewportBounds( eEye, &r.x, &r.y, &r.width, &r.height );
pRenderContext->CopyRenderTargetToTextureEx( pFullFrameFB1, 0, &r, &r );
}
// This is where we are rendering to
uint32_t x, y, w, h;
m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
x = !eEye?0:640;
y = 0;
w = 640;
h = 480;
//m_pExtDisplay->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
pRenderContext->DrawScreenSpaceRectangle ( pDistortMaterial,
x, y, w, h,
0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
// pRenderContext->DrawScreenSpaceRectangle ( pDistortMaterial,
// x, y, w, h,
// 0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
static int id = -1;
//static CDynamicFunctionOpenGL< true, GLvoid ( APIENTRY *)(GLenum pname, GLint *params), GLvoid > glGetIntegerv("glGetIntegerv");
// pRenderContext->Bind(pDistortMaterial);
// pRenderContext->Flush( true );
// ShaderAPITextureHandle_t hndl = materials->GetShaderAPITextureBindHandle(pDistortTexture,0,0);
//if(id < 0)
id = materials->GetShaderAPIGLTexture(m_pPredistortRT,0,0);
static int last_tex[2] = {-1, -1};
// glGetIntegerv(GL_TEXTURE_BINDING_2D, &id);
if(id > 0)
last_tex[eEye != VREye_Left] = id;
// Msg("tex %d\n", id);
const vr::VRTextureBounds_t bounds = { 0.0f, 1.0f, 1.0f, 0.0f };
vr::Texture_t eyeTexture = {(void*)(uintptr_t)last_tex[eEye != VREye_Left], vr::TextureType_OpenGL, vr::ColorSpace_Gamma };
if(last_tex[eEye != VREye_Left] <= 0)
return true;
materials->Flush();
// if(eEye != VREye_Left)
// return 0;
glFinish();
vr::VRCompositor()->Submit(SourceEyeToHmdEye( eEye ), &eyeTexture, &bounds );
return true;
}
@@ -682,11 +731,20 @@ bool CSourceVirtualReality::CompositeHud ( VREye eEye, float ndcHudBounds[4], bo
CMatRenderContextPtr pRenderContext( materials );
uint32_t x, y, w, h;
m_pHmd->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
x = !eEye?0:640;
y = 0;
w = 640;
h = 480;
m_pExtDisplay->GetEyeOutputViewport( SourceEyeToHmdEye( eEye ), &x, &y, &w, &h );
int id = materials->GetShaderAPIGLTexture(g_StereoGuiTexture,0,0);
vr::Texture_t guiTexture = {(void*)(uintptr_t)id, vr::TextureType_OpenGL, vr::ColorSpace_Gamma };
const vr::VRTextureBounds_t bounds = { 0.0f, 1.0f, 1.0f, 0.0f };
vr::VROverlay()->SetOverlayTextureBounds(m_GuiOverlay, &bounds);
vr::VROverlay()->SetOverlayTexture(m_GuiOverlay, &guiTexture);
pRenderContext->DrawScreenSpaceRectangle ( pDistortHUDMaterial,
x, y, w, h,
0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
// pRenderContext->DrawScreenSpaceRectangle ( pDistortHUDMaterial,
// x, y, w, h,
// 0, 0, distortionTextureSize-1,distortionTextureSize-1,distortionTextureSize,distortionTextureSize);
return true;
}
@@ -706,14 +764,22 @@ bool CSourceVirtualReality::StartTracker()
// Initialize SteamVR
vr::HmdError err;
m_pHmd = vr::VR_Init( &err );
if( err != HmdError_None )
m_pHmd = vr::VR_Init( &err, vr::VRApplication_Scene );
m_pExtDisplay = vr::VRExtendedDisplay();
m_pChap = vr::VRChaperone();
if( err != vr::VRInitError_None )
{
Msg( "Unable to initialize HMD tracker. Error code %d\n", err );
return false;
}
m_pHmd->ResetSeatedZeroPose();
if( !vr::VRCompositor() )
{
Msg("Compositor initialization failed. See log file for details");
}
vr::VROverlay()->CreateOverlay("GuiOverlayKey", "GuiOverlay", &m_GuiOverlay);
vr::VROverlay()->ShowOverlay(m_GuiOverlay);
m_pChap->ResetZeroPose(TrackingUniverseSeated);
m_bHaveValidPose = false;
m_ZeroFromHeadPose.Identity();

View File

@@ -124,6 +124,8 @@ private:
CMaterialReference m_blackMaterial;
vr::IVRSystem *m_pHmd;
vr::IVRExtendedDisplay *m_pExtDisplay;
vr::IVRChaperone *m_pChap;
bool m_bHaveValidPose;
VMatrix m_ZeroFromHeadPose;

50
sourcevr/wscript Executable file
View File

@@ -0,0 +1,50 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'sourcevr'
def options(opt):
# stub
return
def configure(conf):
conf.env.append_unique('DEFINES',['strncpy=use_Q_strncpy_instead',
'_snprintf=use_Q_snprintf_instead','SOURCEVR_DLL'])
conf.check_cfg(package='openvr', uselib_store='OPENVR', args=['--cflags', '--libs'])
conf.check(lib='GL', uselib_store='GL')
def build(bld):
source = [
"sourcevirtualreality.cpp"
]
includes = [
'.',
'../public',
'../public/tier0',
'../public/tier1'
] + bld.env.INCLUDES_SDL2
defines = []
libs = ['tier0','tier1','tier2', 'tier3','vstdlib','mathlib','OPENVR', 'GL']
install_path = bld.env.LIBDIR
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

185
stub_steam/steam_api.cpp Normal file
View File

@@ -0,0 +1,185 @@
#define _CRT_SECURE_NO_WARNINGS
#define STEAM_API_EXPORTS
#if defined __GNUC__
#define S_API extern "C" __attribute__ ((visibility("default")))
#elif defined _MSC_VER
#define S_API extern "C" __declspec(dllexport)
#endif
#define NULL 0
S_API void *g_pSteamClientGameServer;
void *g_pSteamClientGameServer = NULL;
//steam_api.h
S_API bool SteamAPI_Init() {
return true;
}
S_API bool SteamAPI_InitSafe() {
return true;
}
S_API void SteamAPI_Shutdown() {
}
S_API bool SteamAPI_RestartAppIfNecessary() {
return false;
}
S_API void SteamAPI_ReleaseCurrentThreadMemory() {
}
S_API void SteamAPI_WriteMiniDump() {
}
S_API void SteamAPI_SetMiniDumpComment() {
}
S_API void SteamAPI_RunCallbacks() {
}
S_API void SteamAPI_RegisterCallback() {
}
S_API void SteamAPI_UnregisterCallback() {
}
S_API void SteamAPI_RegisterCallResult() {
}
S_API void SteamAPI_UnregisterCallResult() {
}
S_API bool SteamAPI_IsSteamRunning() {
return false;
}
S_API void Steam_RunCallbacks() {
}
S_API void Steam_RegisterInterfaceFuncs() {
}
S_API int Steam_GetHSteamUserCurrent() {
return 0;
}
S_API const char *SteamAPI_GetSteamInstallPath() {
return NULL;
}
S_API int SteamAPI_GetHSteamPipe() {
return 0;
}
S_API void SteamAPI_SetTryCatchCallbacks() {
}
S_API void SteamAPI_SetBreakpadAppID() {
}
S_API void SteamAPI_UseBreakpadCrashHandler() {
}
S_API int GetHSteamPipe() {
return 0;
}
S_API int GetHSteamUser() {
return 0;
}
S_API int SteamAPI_GetHSteamUser() {
return 0;
}
S_API void *SteamInternal_ContextInit() {
return NULL;
}
S_API void *SteamInternal_CreateInterface() {
return NULL;
}
S_API void *SteamApps() {
return NULL;
}
S_API void *SteamClient() {
return NULL;
}
S_API void *SteamFriends() {
return NULL;
}
S_API void *SteamHTTP() {
return NULL;
}
S_API void *SteamMatchmaking() {
return NULL;
}
S_API void *SteamMatchmakingServers() {
return NULL;
}
S_API void *SteamNetworking() {
return NULL;
}
S_API void *SteamRemoteStorage() {
return NULL;
}
S_API void *SteamScreenshots() {
return NULL;
}
S_API void *SteamUser() {
return NULL;
}
S_API void *SteamUserStats() {
return NULL;
}
S_API void *SteamUtils() {
return NULL;
}
S_API int SteamGameServer_GetHSteamPipe() {
return 0;
}
S_API int SteamGameServer_GetHSteamUser() {
return 0;
}
S_API int SteamGameServer_GetIPCCallCount() {
return 0;
}
S_API int SteamGameServer_InitSafe() {
return 0;
}
S_API void SteamGameServer_RunCallbacks() {
}
S_API void SteamGameServer_Shutdown() {
}

46
stub_steam/wscript Executable file
View File

@@ -0,0 +1,46 @@
#! /usr/bin/env python
# encoding: utf-8
from waflib import Utils
import os
top = '.'
PROJECT_NAME = 'steam_api'
def options(opt):
# stub
return
def configure(conf):
return
def build(bld):
source = [
'steam_api.cpp'
]
includes = [
'.',
'../public',
'../public/tier0',
] + bld.env.INCLUDES_SDL2
defines = []
libs = []
install_path = None if bld.env.BUILD_SDK else bld.env.LIBDIR
bld.shlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
install_path = install_path,
use = libs,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

View File

@@ -83,7 +83,7 @@ def build(bld):
else:
libs = ['DL', 'M', 'LOG']
install_path = bld.env.LIBDIR
install_path = None if bld.env.BUILD_SDK else bld.env.LIBDIR
bld.shlib(
source = source,

View File

@@ -95,6 +95,8 @@ TextEntry::TextEntry(Panel *parent, const char *panelName) : BaseClass(parent, p
SetEditable(true);
_dataChanged = false;
// initialize the line break array
m_LineBreaks.AddToTail(BUFFER_SIZE);

View File

@@ -376,7 +376,7 @@ static vgui::MouseCode ButtonCodeToMouseCode( ButtonCode_t buttonCode )
//-----------------------------------------------------------------------------
bool InputHandleInputEvent( const InputEvent_t &event )
{
switch( event.m_nType & 0xFFFF )
switch( event.m_nType )
{
case IE_ButtonPressed:
{
@@ -428,9 +428,10 @@ bool InputHandleInputEvent( const InputEvent_t &event )
case IE_FingerDown:
{
int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h);
uint data = (uint)event.m_nData;
x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF);
y = h*((double)(data & 0xFFFF) / 0xFFFF);
float _x, _y;
memcpy( &_x, &event.m_nData2, sizeof(_x) );
memcpy( &_y, &event.m_nData3, sizeof(_y) );
x = w*_x; y = h*_y;
g_pIInput->UpdateCursorPosInternal( x, y );
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED );
g_pIInput->InternalMousePressed( MOUSE_LEFT );
@@ -439,9 +440,10 @@ bool InputHandleInputEvent( const InputEvent_t &event )
case IE_FingerUp:
{
int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h);
uint data = (uint)event.m_nData;
x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF);
y = h*((double)(data & 0xFFFF) / 0xFFFF);
float _x, _y;
memcpy( &_x, &event.m_nData2, sizeof(_x) );
memcpy( &_y, &event.m_nData3, sizeof(_y) );
x = w*_x; y = h*_y;
g_pIInput->UpdateCursorPosInternal( x, y );
g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED );
g_pIInput->InternalMouseReleased( MOUSE_LEFT );
@@ -450,9 +452,10 @@ bool InputHandleInputEvent( const InputEvent_t &event )
case IE_FingerMotion:
{
int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h);
uint data = (uint)event.m_nData;
x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF);
y = h*((double)(data & 0xFFFF) / 0xFFFF);
float _x, _y;
memcpy( &_x, &event.m_nData2, sizeof(_x) );
memcpy( &_y, &event.m_nData3, sizeof(_y) );
x = w*_x; y = h*_y;
g_pIInput->InternalCursorMoved( x, y );
}
return true;

View File

@@ -1,427 +0,0 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "vstdlib/osversion.h"
#include "winlite.h"
#include "strtools.h"
#include "tier0/dbg.h"
#ifdef OSX
#include <CoreServices/CoreServices.h>
#endif
//-----------------------------------------------------------------------------
// Purpose: return the OS type for this machine
//-----------------------------------------------------------------------------
EOSType GetOSType()
{
static EOSType eOSVersion = k_eOSUnknown;
#if defined( _WIN32 ) && !defined( _X360 )
if ( eOSVersion == k_eOSUnknown || eOSVersion == k_eWinUnknown )
{
eOSVersion = k_eWinUnknown;
OSVERSIONINFOEX osvi;
Q_memset( &osvi, 0x00, sizeof(osvi) );
osvi.dwOSVersionInfoSize = sizeof(osvi);
if ( GetVersionEx( (OSVERSIONINFO *) &osvi ) )
{
switch ( osvi.dwPlatformId )
{
case VER_PLATFORM_WIN32_NT:
if ( osvi.dwMajorVersion <= 4 )
{
eOSVersion = k_eWinNT;
}
else if ( osvi.dwMajorVersion == 5 )
{
switch( osvi.dwMinorVersion )
{
case 0:
eOSVersion = k_eWin2000;
break;
case 1:
eOSVersion = k_eWinXP;
break;
case 2:
eOSVersion = k_eWin2003;
break;
}
}
else if ( osvi.dwMajorVersion >= 6 )
{
if ( osvi.wProductType == VER_NT_WORKSTATION )
{
switch ( osvi.dwMinorVersion )
{
case 0:
eOSVersion = k_eWinVista;
break;
case 1:
eOSVersion = k_eWindows7;
break;
}
}
else /* ( osvi.wProductType != VER_NT_WORKSTATION ) */
{
switch ( osvi.dwMinorVersion )
{
case 0:
eOSVersion = k_eWin2008; // Windows 2008, not R2
break;
case 1:
eOSVersion = k_eWin2008; // Windows 2008 R2
break;
}
}
}
break;
case VER_PLATFORM_WIN32_WINDOWS:
switch ( osvi.dwMinorVersion )
{
case 0:
eOSVersion = k_eWin95;
break;
case 10:
eOSVersion = k_eWin98;
break;
case 90:
eOSVersion = k_eWinME;
break;
}
break;
case VER_PLATFORM_WIN32s:
eOSVersion = k_eWin311;
break;
}
}
}
#elif defined(OSX)
if ( eOSVersion == k_eOSUnknown )
{
SInt32 MajorVer = 0;
SInt32 MinorVer = 0;
SInt32 PatchVer = 0;
OSErr err = noErr;
err = Gestalt( gestaltSystemVersionMajor, &MajorVer );
if ( err != noErr )
return k_eOSUnknown;
err = Gestalt( gestaltSystemVersionMinor, &MinorVer );
if ( err != noErr )
return k_eOSUnknown;
err = Gestalt( gestaltSystemVersionBugFix, &PatchVer );
if ( err != noErr )
return k_eOSUnknown;
switch ( MajorVer )
{
case 10:
{
switch( MinorVer )
{
case 4:
eOSVersion = k_eMacOS104;
break;
case 5:
eOSVersion = k_eMacOS105;
switch ( PatchVer )
{
case 8:
eOSVersion = k_eMacOS1058;
default:
break;
}
break;
case 6:
eOSVersion = k_eMacOS106;
switch ( PatchVer )
{
case 1:
case 2:
break;
case 3:
default:
// note the default here - 10.6.4 (5,6...) >= 10.6.3, so we want to
// identify as 10.6.3 for sysreqs purposes
eOSVersion = k_eMacOS1063;
break;
}
break;
case 7:
eOSVersion = k_eMacOS107;
break;
default:
break;
}
}
default:
break;
}
}
#elif defined(LINUX)
if ( eOSVersion == k_eOSUnknown )
{
FILE *fpKernelVer = fopen( "/proc/version", "r" );
if ( !fpKernelVer )
return k_eLinuxUnknown;
char rgchVersionLine[1024];
char *pchRet = fgets( rgchVersionLine, sizeof(rgchVersionLine), fpKernelVer );
fclose( fpKernelVer );
eOSVersion = k_eLinuxUnknown;
// move past "Linux version "
const char *pchVersion = rgchVersionLine + Q_strlen( "Linux version " );
if ( pchRet && *pchVersion == '2' && *(pchVersion+1) == '.' )
{
pchVersion += 2; // move past "2."
if ( *pchVersion == '2' && *(pchVersion+1) == '.' )
eOSVersion = k_eLinux22;
else if ( *pchVersion == '4' && *(pchVersion+1) == '.' )
eOSVersion = k_eLinux24;
else if ( *pchVersion == '6' && *(pchVersion+1) == '.' )
eOSVersion = k_eLinux26;
}
}
#endif
return eOSVersion;
}
//-----------------------------------------------------------------------------
// Purpose: get platform-specific OS details (distro, on linux)
// returns a pointer to the input buffer on success (for convenience),
// NULL on failure.
//-----------------------------------------------------------------------------
const char *GetOSDetailString( char *pchOutBuf, int cchOutBuf )
{
#if defined WIN32
(void)( pchOutBuf );
(void)( cchOutBuf );
// no interesting details
return NULL;
#else
#if defined LINUX
// we're about to go poking around to see if we can figure out distribution
// looking @ any /etc file is fragile (people can change 'em),
// but since this is just hardware survey data, we're not super concerned.
// a bunch of OS-specific issue files
const char *pszIssueFile[] =
{
"/etc/redhat-release",
"/etc/fedora-release",
"/etc/slackware-release",
"/etc/debian_release",
"/etc/mandrake-release",
"/etc/yellowdog-release",
"/etc/gentoo-release",
"/etc/lsb-release",
"/etc/SUSE-release",
};
if ( !pchOutBuf )
return NULL;
for (int i = 0; i < Q_ARRAYSIZE( pszIssueFile ); i++ )
{
FILE *fdInfo = fopen( pszIssueFile[i], "r" );
if ( !fdInfo )
continue;
// prepend the buffer with the name of the file we found for easier grouping
snprintf( pchOutBuf, cchOutBuf, "%s\n", pszIssueFile[i] );
int cchIssueFile = strlen( pszIssueFile[i] ) + 1;
ssize_t cubRead = fread( (void*) (pchOutBuf + cchIssueFile) , sizeof(char), cchOutBuf - cchIssueFile, fdInfo );
fclose( fdInfo );
if ( cubRead < 0 )
return NULL;
// null terminate
pchOutBuf[ MIN( cubRead, cchOutBuf-1 ) ] = '\0';
return pchOutBuf;
}
#endif
// if all else fails, just send back uname -a
if ( !pchOutBuf )
return NULL;
FILE *fpUname = popen( "uname -mrsv", "r" );
if ( !fpUname )
return NULL;
size_t cchRead = fread( pchOutBuf, sizeof(char), cchOutBuf, fpUname );
pclose( fpUname );
pchOutBuf[ MIN( cchRead, (size_t)cchOutBuf-1 ) ] = '\0';
return pchOutBuf;
#endif
}
//-----------------------------------------------------------------------------
// Purpose: get a friendly name for an OS type
//-----------------------------------------------------------------------------
const char *GetNameFromOSType( EOSType eOSType )
{
switch ( eOSType )
{
case k_eWinUnknown:
return "Windows";
case k_eWin311:
return "Windows 3.11";
case k_eWin95:
return "Windows 95";
case k_eWin98:
return "Windows 98";
case k_eWinME:
return "Windows ME";
case k_eWinNT:
return "Windows NT";
case k_eWin2000:
return "Windows 2000";
case k_eWinXP:
return "Windows XP";
case k_eWin2003:
return "Windows 2003";
case k_eWinVista:
return "Windows Vista";
case k_eWindows7:
return "Windows 7";
case k_eWin2008:
return "Windows 2008";
#ifdef POSIX
case k_eMacOSUnknown:
return "Mac OS";
case k_eMacOS104:
return "MacOS 10.4";
case k_eMacOS105:
return "MacOS 10.5";
case k_eMacOS1058:
return "MacOS 10.5.8";
case k_eMacOS106:
return "MacOS 10.6";
case k_eMacOS1063:
return "MacOS 10.6.3";
case k_eMacOS107:
return "MacOS 10.7";
case k_eLinuxUnknown:
return "Linux";
case k_eLinux22:
return "Linux 2.2";
case k_eLinux24:
return "Linux 2.4";
case k_eLinux26:
return "Linux 2.6";
#endif
default:
case k_eOSUnknown:
return "Unknown";
}
}
// friendly name to OS type, MUST be same size as EOSType enum
struct OSTypeNameTuple
{
EOSType m_OSType;
const char *m_pchOSName;
};
const OSTypeNameTuple k_rgOSTypeToName[] =
{
{ k_eOSUnknown, "unknown" },
{ k_eMacOSUnknown, "macos" },
{ k_eMacOS104, "macos104" },
{ k_eMacOS105, "macos105" },
{ k_eMacOS1058, "macos1058" },
{ k_eMacOS106, "macos106" },
{ k_eMacOS1063, "macos1063" },
{ k_eMacOS107, "macos107" },
{ k_eLinuxUnknown, "linux" },
{ k_eLinux22, "linux22" },
{ k_eLinux24, "linux24" },
{ k_eLinux26, "linux26" },
{ k_eWinUnknown, "windows" },
{ k_eWin311, "win311" },
{ k_eWin95, "win95" },
{ k_eWin98, "win98" },
{ k_eWinME, "winME" },
{ k_eWinNT, "winNT" },
{ k_eWin2000, "win200" },
{ k_eWinXP, "winXP" },
{ k_eWin2003, "win2003" },
{ k_eWinVista, "winVista" },
{ k_eWindows7, "win7" },
{ k_eWin2008, "win2008" },
};
//-----------------------------------------------------------------------------
// Purpose: convert a friendly OS name to a eostype
//-----------------------------------------------------------------------------
EOSType GetOSTypeFromString_Deprecated( const char *pchName )
{
EOSType eOSType;
#ifdef WIN32
eOSType = k_eWinUnknown;
#else
eOSType = k_eOSUnknown;
#endif
// if this fires, make sure all OS types are in the map
Assert( Q_ARRAYSIZE( k_rgOSTypeToName ) == k_eOSTypeMax );
if ( !pchName || Q_strlen( pchName ) == 0 )
return eOSType;
for ( int iOS = 0; iOS < Q_ARRAYSIZE( k_rgOSTypeToName ) ; iOS++ )
{
if ( !Q_stricmp( k_rgOSTypeToName[iOS].m_pchOSName, pchName ) )
return k_rgOSTypeToName[iOS].m_OSType;
}
return eOSType;
}
bool OSTypesAreCompatible( EOSType eOSTypeDetected, EOSType eOSTypeRequired )
{
// check windows (on the positive side of the number line)
if ( eOSTypeRequired >= k_eWinUnknown )
return ( eOSTypeDetected >= eOSTypeRequired );
if ( eOSTypeRequired == k_eOSUnknown )
return true;
// osx
if ( eOSTypeRequired >= k_eMacOSUnknown && eOSTypeRequired < k_eOSUnknown )
return ( eOSTypeDetected >= eOSTypeRequired && eOSTypeDetected < k_eOSUnknown );
// and linux
if ( eOSTypeRequired >= k_eLinuxUnknown && eOSTypeRequired < k_eMacOSUnknown )
return ( eOSTypeDetected >= eOSTypeRequired && eOSTypeDetected < k_eMacOSUnknown );
return false;
}
// these strings "windows", "macos", "linux" are part of the
// interface, which is why they're hard-coded here, rather than using
// the strings in k_rgOSTypeToName
const char *GetPlatformName( bool *pbIs64Bit )
{
if ( pbIs64Bit )
*pbIs64Bit = Is64BitOS();
EOSType eType = GetOSType();
if ( OSTypesAreCompatible( eType, k_eWinUnknown ) )
return "windows";
if ( OSTypesAreCompatible( eType, k_eMacOSUnknown ) )
return "macos";
if ( OSTypesAreCompatible( eType, k_eLinuxUnknown ) )
return "linux";
return "unknown";
}

View File

@@ -21,7 +21,6 @@ def build(bld):
'cvar.cpp',
'jobthread.cpp',
'KeyValuesSystem.cpp',
'osversion.cpp',
'random.cpp',
'vcover.cpp',
'../public/tier0/memoverride.cpp'
@@ -55,7 +54,7 @@ def build(bld):
elif bld.env.DEST_OS == 'darwin':
linkflags += ['-framework', 'CoreServices']
install_path = bld.env.LIBDIR
install_path = None if bld.env.BUILD_SDK else bld.env.LIBDIR
bld.shlib(
source = source,

View File

@@ -27,7 +27,10 @@ BEGIN_BYTESWAP_DATADESC( VTFFileBaseHeader_t )
DEFINE_FIELD( headerSize, FIELD_INTEGER ),
END_DATADESC()
BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_1_t, VTFFileBaseHeader_t )
BEGIN_BYTESWAP_DATADESC( VTFFileHeaderV7_1_t )
DEFINE_ARRAY( fileTypeString, FIELD_CHARACTER, 4 ),
DEFINE_ARRAY( version, FIELD_INTEGER, 2 ),
DEFINE_FIELD( headerSize, FIELD_INTEGER ),
DEFINE_FIELD( width, FIELD_SHORT ),
DEFINE_FIELD( height, FIELD_SHORT ),
DEFINE_FIELD( flags, FIELD_INTEGER ),
@@ -42,17 +45,45 @@ BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_1_t, VTFFileBaseHeader_t )
DEFINE_FIELD( lowResImageHeight, FIELD_CHARACTER ),
END_DATADESC()
BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_2_t, VTFFileHeaderV7_1_t )
BEGIN_BYTESWAP_DATADESC( VTFFileHeaderV7_2_t )
DEFINE_ARRAY( fileTypeString, FIELD_CHARACTER, 4 ),
DEFINE_ARRAY( version, FIELD_INTEGER, 2 ),
DEFINE_FIELD( headerSize, FIELD_INTEGER ),
DEFINE_FIELD( width, FIELD_SHORT ),
DEFINE_FIELD( height, FIELD_SHORT ),
DEFINE_FIELD( flags, FIELD_INTEGER ),
DEFINE_FIELD( numFrames, FIELD_SHORT ),
DEFINE_FIELD( startFrame, FIELD_SHORT ),
DEFINE_FIELD( reflectivity, FIELD_VECTOR ),
DEFINE_FIELD( bumpScale, FIELD_FLOAT ),
DEFINE_FIELD( imageFormat, FIELD_INTEGER ),
DEFINE_FIELD( numMipLevels, FIELD_CHARACTER ),
DEFINE_FIELD( lowResImageFormat, FIELD_INTEGER ),
DEFINE_FIELD( lowResImageWidth, FIELD_CHARACTER ),
DEFINE_FIELD( lowResImageHeight, FIELD_CHARACTER ),
DEFINE_FIELD( depth, FIELD_SHORT ),
END_DATADESC()
BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderV7_3_t, VTFFileHeaderV7_2_t )
BEGIN_BYTESWAP_DATADESC( VTFFileHeaderV7_3_t )
DEFINE_ARRAY( fileTypeString, FIELD_CHARACTER, 4 ),
DEFINE_ARRAY( version, FIELD_INTEGER, 2 ),
DEFINE_FIELD( headerSize, FIELD_INTEGER ),
DEFINE_FIELD( width, FIELD_SHORT ),
DEFINE_FIELD( height, FIELD_SHORT ),
DEFINE_FIELD( flags, FIELD_INTEGER ),
DEFINE_FIELD( numFrames, FIELD_SHORT ),
DEFINE_FIELD( startFrame, FIELD_SHORT ),
DEFINE_FIELD( reflectivity, FIELD_VECTOR ),
DEFINE_FIELD( bumpScale, FIELD_FLOAT ),
DEFINE_FIELD( imageFormat, FIELD_INTEGER ),
DEFINE_FIELD( numMipLevels, FIELD_CHARACTER ),
DEFINE_FIELD( lowResImageFormat, FIELD_INTEGER ),
DEFINE_FIELD( lowResImageWidth, FIELD_CHARACTER ),
DEFINE_FIELD( lowResImageHeight, FIELD_CHARACTER ),
DEFINE_FIELD( depth, FIELD_SHORT ),
DEFINE_FIELD( numResources, FIELD_INTEGER ),
END_DATADESC()
BEGIN_BYTESWAP_DATADESC_( VTFFileHeader_t, VTFFileHeaderV7_2_t )
END_DATADESC()
BEGIN_BYTESWAP_DATADESC_( VTFFileHeaderX360_t, VTFFileBaseHeader_t )
DEFINE_FIELD( flags, FIELD_INTEGER ),
DEFINE_FIELD( width, FIELD_SHORT ),
@@ -903,23 +934,11 @@ static bool ReadHeaderFromBufferPastBaseHeader( CUtlBuffer &buf, VTFFileHeader_t
else if ( header.version[1] == 2 )
{
buf.Get( pBuf, sizeof(VTFFileHeaderV7_2_t) - sizeof(VTFFileBaseHeader_t) );
#if defined( _X360 ) || defined (POSIX)
// read 15 dummy bytes to be properly positioned with 7.2 PC data
byte dummy[15];
buf.Get( dummy, 15 );
#endif
}
else if ( header.version[1] == 1 || header.version[1] == 0 )
{
// previous version 7.0 or 7.1
buf.Get( pBuf, sizeof(VTFFileHeaderV7_1_t) - sizeof(VTFFileBaseHeader_t) );
#if defined( _X360 ) || defined (POSIX)
// read a dummy byte to be properly positioned with 7.0/1 PC data
byte dummy;
buf.Get( &dummy, 1 );
#endif
}
else
{

30
wscript
View File

@@ -61,7 +61,7 @@ projects={
'serverbrowser',
'soundemittersystem',
'studiorender',
'thirdparty/StubSteamAPI',
'stub_steam',
'tier0',
'tier1',
'tier2',
@@ -79,6 +79,7 @@ projects={
'utils/vtex',
'unicode',
'video',
'sourcevr'
],
'tests': [
'appframework',
@@ -129,7 +130,7 @@ projects={
'vpklib',
'vstdlib',
'vtf',
'thirdparty/StubSteamAPI'
'stub_steam'
]
}
@@ -358,10 +359,10 @@ def check_deps(conf):
else:
conf.check_pkg('freetype2', 'FT2', FT2_CHECK)
conf.check_pkg('fontconfig', 'FC', FC_CHECK)
if conf.env.DEST_OS == "darwin":
conf.env.FRAMEWORK_OPENAL = "OpenAL"
else:
conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
# if conf.env.DEST_OS == "darwin":
# conf.env.FRAMEWORK_OPENAL = "OpenAL"
# else:
# conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
conf.check_cfg(package='libjpeg', uselib_store='JPEG', args=['--cflags', '--libs'])
conf.check_cfg(package='libpng', uselib_store='PNG', args=['--cflags', '--libs'])
conf.check_cfg(package='libcurl', uselib_store='CURL', args=['--cflags', '--libs'])
@@ -514,30 +515,32 @@ def configure(conf):
'/TP',
'/EHsc'
]
if conf.options.BUILD_TYPE == 'debug':
linkflags += [
'/INCREMENTAL:NO',
'/NODEFAULTLIB:libc',
'/NODEFAULTLIB:libcd',
'/NODEFAULTLIB:libcmt',
'/FORCE'
'/FORCE',
'/LARGEADDRESSAWARE'
]
else:
linkflags += [
'/INCREMENTAL',
'/NODEFAULTLIB:libc',
'/NODEFAULTLIB:libcd',
'/NODEFAULTLIB:libcmtd'
'/NODEFAULTLIB:libcmtd',
'/LARGEADDRESSAWARE'
]
linkflags += [
'/LIBPATH:'+os.path.abspath('.')+'/lib/win32/'+conf.env.DEST_CPU+'/',
'/LIBPATH:'+os.path.abspath('.')+'/dx9sdk/lib/'+conf.env.DEST_CPU+'/'
]
# And here C++ flags starts to be treated separately
cxxflags = list(cflags)
cxxflags = list(cflags)
if conf.env.DEST_OS != 'win32':
cxxflags += ['-std=c++11','-fpermissive']
@@ -591,6 +594,11 @@ def configure(conf):
def build(bld):
os.environ["CCACHE_DIR"] = os.path.abspath('.ccache/'+bld.env.COMPILER_CC+'/'+bld.env.DEST_OS+'/'+bld.env.DEST_CPU)
if bld.env.DEST_OS in ['win32', 'android']:
sdl_name = 'SDL2.dll' if bld.env.DEST_OS == 'win32' else 'libSDL2.so'
sdl_path = os.path.join('lib', bld.env.DEST_OS, bld.env.DEST_CPU, sdl_name)
bld.install_files(bld.env.LIBDIR, [sdl_path])
if bld.env.DEST_OS == 'win32':
projects['game'] += ['utils/bzip2']
projects['dedicated'] += ['utils/bzip2']