diff --git a/mp/game/mod_hl2mp/gameinfo.txt b/mp/game/mod_hl2mp/gameinfo.txt index 14900d01..2f49bead 100644 --- a/mp/game/mod_hl2mp/gameinfo.txt +++ b/mp/game/mod_hl2mp/gameinfo.txt @@ -12,6 +12,7 @@ "test_speakers" 1 "test_hardware" 1 } + supportsvr 1 FileSystem diff --git a/mp/src/common/qlimits.h b/mp/src/common/qlimits.h index 59bdde2f..205053a8 100644 --- a/mp/src/common/qlimits.h +++ b/mp/src/common/qlimits.h @@ -24,7 +24,7 @@ // Resource counts; -#define MAX_MODEL_INDEX_BITS 11 // sent as a short +#define MAX_MODEL_INDEX_BITS 12 // sent as a short #define MAX_MODELS (1<pSeqdesc( GetSequence() ) ); diff --git a/mp/src/game/client/c_colorcorrection.cpp b/mp/src/game/client/c_colorcorrection.cpp index 56f1a65e..6960031d 100644 --- a/mp/src/game/client/c_colorcorrection.cpp +++ b/mp/src/game/client/c_colorcorrection.cpp @@ -122,7 +122,7 @@ void C_ColorCorrection::ClientThink() return; } - CBaseEntity *pPlayer = UTIL_PlayerByIndex(1); + C_BaseEntity *pPlayer = C_BasePlayer::GetLocalPlayer(); if( !pPlayer ) return; diff --git a/mp/src/game/client/c_func_breakablesurf.cpp b/mp/src/game/client/c_func_breakablesurf.cpp index 03176315..3118cd5e 100644 --- a/mp/src/game/client/c_func_breakablesurf.cpp +++ b/mp/src/game/client/c_func_breakablesurf.cpp @@ -154,7 +154,7 @@ private: Assert( type < NUM_EDGE_STYLES ); Assert( type >= 0 ); // Clear old value - m_nPanelBits[ w ][ h ] &= ( ~0x03 << 2 ); + m_nPanelBits[ w ][ h ] &= 0xF0; // ( ~0x03 << 2 ); Left shifting a negative value has undefined behavior. Use the constant 0xF0 instead. // Insert new value m_nPanelBits[ w ][ h ] |= ( type << 2 ); } diff --git a/mp/src/game/client/c_te_bloodstream.cpp b/mp/src/game/client/c_te_bloodstream.cpp index 2c16e3a1..d543d111 100644 --- a/mp/src/game/client/c_te_bloodstream.cpp +++ b/mp/src/game/client/c_te_bloodstream.cpp @@ -114,7 +114,7 @@ void TE_BloodStream( IRecipientFilter& filter, float delay, float arc = 0.05; int count, count2; float num; - int speedCopy = amount; + float speedCopy = amount; Vector dir; VectorCopy( *direction, dir ); diff --git a/mp/src/game/client/c_te_decal.cpp b/mp/src/game/client/c_te_decal.cpp index 4ea42e5e..f0212ee1 100644 --- a/mp/src/game/client/c_te_decal.cpp +++ b/mp/src/game/client/c_te_decal.cpp @@ -139,7 +139,7 @@ void TE_Decal( IRecipientFilter& filter, float delay, // Only decal the world + brush models // Here we deal with decals on entities. C_BaseEntity* ent; - if ( ( ent = cl_entitylist->GetEnt( entity ) ) == false ) + if ( ( ent = cl_entitylist->GetEnt( entity ) ) == NULL ) return; ent->AddDecal( *start, *pos, *pos, hitbox, diff --git a/mp/src/game/client/cdll_client_int.cpp b/mp/src/game/client/cdll_client_int.cpp index b5a53e72..10cce078 100644 --- a/mp/src/game/client/cdll_client_int.cpp +++ b/mp/src/game/client/cdll_client_int.cpp @@ -1717,7 +1717,11 @@ void CHLClient::LevelShutdown( void ) messagechars->Clear(); +#ifndef TF_CLIENT_DLL + // don't want to do this for TF2 because we have particle systems in our + // character loadout screen that can be viewed when we're not connected to a server g_pParticleSystemMgr->UncacheAllParticleSystems(); +#endif UncacheAllMaterials(); #ifdef _XBOX diff --git a/mp/src/game/client/client_virtualreality.cpp b/mp/src/game/client/client_virtualreality.cpp index d729210e..fb6e4417 100644 --- a/mp/src/game/client/client_virtualreality.cpp +++ b/mp/src/game/client/client_virtualreality.cpp @@ -21,6 +21,7 @@ #include "vgui_controls/Controls.h" #include "tier0/vprof_telemetry.h" #include +#include "steam/steam_api.h" const char *COM_GetModDirectory(); // return the mod dir (rather than the complete -game param, which can be a path) @@ -260,6 +261,8 @@ CClientVirtualReality::CClientVirtualReality() m_rtLastMotionSample = 0; m_bMotionUpdated = false; + m_bForceVRMode = false; + #if defined( USE_SDL ) m_nNonVRSDLDisplayIndex = 0; #endif @@ -1363,28 +1366,32 @@ void CClientVirtualReality::Activate() if( !g_pSourceVR ) return; - // see if VR mode is even enabled - if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) + // These checks don't apply if we're in VR mode because Steam said so. + if ( !m_bForceVRMode ) { - Warning( "Enable VR mode in the video options before trying to use it.\n" ); - return; - } + // see if VR mode is even enabled + if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) + { + Warning( "Enable VR mode in the video options before trying to use it.\n" ); + return; + } - // See if we have an actual adapter - int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter(); - if( nVRModeAdapter == -1 ) - { - Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" ); - return; - } + // See if we have an actual adapter + int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter(); + if ( nVRModeAdapter == -1 ) + { + Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" ); + return; + } - // we can only activate if we've got a VR device - if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter ) - { - Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n", - nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter ); - engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" ); - return; + // we can only activate if we've got a VR device + if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter ) + { + Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n", + nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter ); + engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" ); + return; + } } @@ -1429,18 +1436,22 @@ void CClientVirtualReality::Activate() int nViewportWidth, nViewportHeight; g_pSourceVR->GetViewportBounds( ISourceVirtualReality::VREye_Left, NULL, NULL, &nViewportWidth, &nViewportHeight ); - vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) ); vgui::ivgui()->SetVRMode( true ); - VRRect_t rect; - if( g_pSourceVR->GetDisplayBounds( &rect ) ) + // we can skip this extra mode change if we've always been in VR mode + if ( !m_bForceVRMode ) { + VRRect_t rect; + if ( g_pSourceVR->GetDisplayBounds( &rect ) ) + { - // set mode - char szCmd[ 256 ]; - Q_snprintf( szCmd, sizeof( szCmd ), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool()? 1 : 0 ); - engine->ClientCmd_Unrestricted( szCmd ); + // set mode + char szCmd[256]; + Q_snprintf( szCmd, sizeof(szCmd), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool() ? 1 : 0 ); + engine->ClientCmd_Unrestricted( szCmd ); + } } } @@ -1455,7 +1466,7 @@ void CClientVirtualReality::Deactivate() g_pMatSystemSurface->ForceScreenSizeOverride(false, 0, 0 ); g_pMaterialSystem->GetRenderContext()->Viewport( 0, 0, m_nNonVRWidth, m_nNonVRHeight ); - vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL ); static ConVarRef cl_software_cursor( "cl_software_cursor" ); vgui::surface()->SetSoftwareCursor( cl_software_cursor.GetBool() ); @@ -1499,7 +1510,10 @@ void CClientVirtualReality::Deactivate() // Called when startup is complete void CClientVirtualReality::StartupComplete() { - if( vr_activate_default.GetBool() ) + if ( g_pSourceVR ) + m_bForceVRMode = g_pSourceVR->ShouldForceVRMode(); + + if ( vr_activate_default.GetBool( ) || m_bForceVRMode ) Activate(); } diff --git a/mp/src/game/client/client_virtualreality.h b/mp/src/game/client/client_virtualreality.h index 9aadfeb3..3a8c9469 100644 --- a/mp/src/game/client/client_virtualreality.h +++ b/mp/src/game/client/client_virtualreality.h @@ -147,6 +147,7 @@ private: int m_iAlignTorsoAndViewToWeaponCountdown; bool m_bMotionUpdated; + bool m_bForceVRMode; RTime32 m_rtLastMotionSample; diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index b6dee29c..5d10db6c 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -228,9 +228,9 @@ static void __MsgFunc_VGUIMenu( bf_read &msg ) && keys->GetInt( "type", 0 ) == 2 // URL message type ) { const char *pszURL = keys->GetString( "msg", "" ); - if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 ) + if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 && Q_stricmp( pszURL, "about:blank" ) != 0 ) { - Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://'\n", pszURL ); + Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://' or be about:blank\n", pszURL ); keys->deleteThis(); return; } diff --git a/mp/src/game/client/detailobjectsystem.cpp b/mp/src/game/client/detailobjectsystem.cpp index 7aa871ea..3e211bb0 100644 --- a/mp/src/game/client/detailobjectsystem.cpp +++ b/mp/src/game/client/detailobjectsystem.cpp @@ -1477,7 +1477,7 @@ void CDetailObjectSystem::LevelInitPreEntity() PrecacheMaterial( DETAIL_SPRITE_MATERIAL ); IMaterial *pMat = m_DetailSpriteMaterial; // adjust for non-square textures (cropped) - float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight(); + float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight(); if ( flRatio > 1.0 ) { for( int i = 0; i MAX_WEAPON_SLOTS ) + if ( iSlot >= MAX_WEAPON_SLOTS ) return; // Make sure the player's allowed to switch weapons diff --git a/mp/src/game/client/hud.cpp b/mp/src/game/client/hud.cpp index 1baad2e1..af50b187 100644 --- a/mp/src/game/client/hud.cpp +++ b/mp/src/game/client/hud.cpp @@ -512,7 +512,7 @@ void CHud::Shutdown( void ) //----------------------------------------------------------------------------- -// Purpose: LevelInit's called whenever a new level's starting +// Purpose: LevelInit's called whenever a new level is starting //----------------------------------------------------------------------------- void CHud::LevelInit( void ) { @@ -533,11 +533,11 @@ void CHud::LevelInit( void ) } //----------------------------------------------------------------------------- -// Purpose: LevelShutdown's called whenever a level's finishing +// Purpose: LevelShutdown's called whenever a level is finishing //----------------------------------------------------------------------------- void CHud::LevelShutdown( void ) { - // Tell all the registered hud elements to LevelInit + // Tell all the registered hud elements to LevelShutdown for ( int i = 0; i < m_HudList.Size(); i++ ) { m_HudList[i]->LevelShutdown(); diff --git a/mp/src/game/client/hud.h b/mp/src/game/client/hud.h index 7b637c64..b623a3eb 100644 --- a/mp/src/game/client/hud.h +++ b/mp/src/game/client/hud.h @@ -107,9 +107,9 @@ public: void VidInit( void ); // Shutdown's called when the engine's shutting down void Shutdown( void ); - // LevelInit's called whenever a new level's starting + // LevelInit's called whenever a new level is starting void LevelInit( void ); - // LevelShutdown's called whenever a level's finishing + // LevelShutdown's called whenever a level is finishing void LevelShutdown( void ); void ResetHUD( void ); diff --git a/mp/src/game/client/hud_vote.cpp b/mp/src/game/client/hud_vote.cpp index 55b8f389..659669a0 100644 --- a/mp/src/game/client/hud_vote.cpp +++ b/mp/src/game/client/hud_vote.cpp @@ -662,7 +662,8 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel ) for ( int index = 0; index < m_VoteIssuesPopFiles.Count(); index++ ) { // Don't show the current pop file - if ( TFObjectiveResource()->GetMvMPopFileName() == '\0' ) + const char *pszPopFileName = TFObjectiveResource()->GetMvMPopFileName(); + if ( !pszPopFileName || !pszPopFileName[0] ) { // Use the map name char szShortMapName[ MAX_MAP_NAME ]; diff --git a/mp/src/game/client/hudelement.h b/mp/src/game/client/hudelement.h index e6de48b9..b903de5d 100644 --- a/mp/src/game/client/hudelement.h +++ b/mp/src/game/client/hudelement.h @@ -36,9 +36,9 @@ public: // called whenever the video mode changes, and whenever Init() would be called, so the hud can vid init itself virtual void VidInit( void ) { return; } - // LevelInit's called whenever a new level's starting + // LevelInit's called whenever a new level is starting virtual void LevelInit( void ) { return; }; - // LevelShutdown's called whenever a level's finishing + // LevelShutdown's called whenever a level is finishing virtual void LevelShutdown( void ) { return; }; // called whenever the hud receives "reset" message, which is (usually) every time the client respawns after getting killed diff --git a/mp/src/game/client/in_joystick.cpp b/mp/src/game/client/in_joystick.cpp index 2f0e3dad..71d03a08 100644 --- a/mp/src/game/client/in_joystick.cpp +++ b/mp/src/game/client/in_joystick.cpp @@ -846,6 +846,8 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd ) { angle = m_flPreviousJoystickYaw * joy_yawsensitivity.GetFloat() * aspeed * 180.0; } + + angle = JoyStickAdjustYaw( angle ); viewangles[YAW] += angle; cmd->mousedx = angle; diff --git a/mp/src/game/client/input.h b/mp/src/game/client/input.h index 356c7532..e34b82db 100644 --- a/mp/src/game/client/input.h +++ b/mp/src/game/client/input.h @@ -141,6 +141,7 @@ private: void ControllerMove ( float frametime, CUserCmd *cmd ); void JoyStickMove ( float frametime, CUserCmd *cmd ); float ScaleAxisValue( const float axisValue, const float axisThreshold ); + virtual float JoyStickAdjustYaw( float flSpeed ) { return flSpeed; } // Call this to get the cursor position. The call will be logged in the VCR file if there is one. void GetMousePos(int &x, int &y); diff --git a/mp/src/game/client/prediction.cpp b/mp/src/game/client/prediction.cpp index 7e00732c..6646f8f9 100644 --- a/mp/src/game/client/prediction.cpp +++ b/mp/src/game/client/prediction.cpp @@ -931,7 +931,8 @@ void CPrediction::SetIdealPitch ( C_BasePlayer *player, const Vector& origin, co Vector top, bottom; float floor_height[MAX_FORWARD]; int i, j; - int step, dir, steps; + float step, dir; + int steps; trace_t tr; if ( player->GetGroundEntity() == NULL ) diff --git a/mp/src/game/client/replay/replayyoutubeapi.cpp b/mp/src/game/client/replay/replayyoutubeapi.cpp index 399d12ca..faab2e95 100644 --- a/mp/src/game/client/replay/replayyoutubeapi.cpp +++ b/mp/src/game/client/replay/replayyoutubeapi.cpp @@ -24,7 +24,7 @@ #include "confirm_dialog.h" #include "replay/vgui/replaybrowserdetailspanel.h" -#include "base_gcmessages.h" +#include "base_gcmessages.pb.h" #include "youtubeapi.h" #include "steamworks_gamestats.h" diff --git a/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp b/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp index 7ede9ba5..0f0f7105 100644 --- a/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp +++ b/mp/src/game/client/sixense/in_sixense_gesture_bindings.cpp @@ -879,10 +879,6 @@ bool SixenseGestureBindings::ActionTokenToStr( sixenseUtils::IButtonStates::Acti { Q_snprintf( buf, buflen, "tilt_gesture" ); } - else if( action == sixenseUtils::IButtonStates::ACTION_BUTTON_PRESS ) - { - Q_snprintf( buf, buflen, "button_press" ); - } else if( action == sixenseUtils::IButtonStates::ACTION_TRIGGER_PRESS ) { Q_snprintf( buf, buflen, "trigger_press" ); diff --git a/mp/src/game/client/vgui_fpspanel.cpp b/mp/src/game/client/vgui_fpspanel.cpp index a44dde34..aec28add 100644 --- a/mp/src/game/client/vgui_fpspanel.cpp +++ b/mp/src/game/client/vgui_fpspanel.cpp @@ -189,12 +189,12 @@ void GetFPSColor( int nFps, unsigned char ucColor[3] ) if ( IsPC() && g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 95 ) { nFPSThreshold1 = 60; - nFPSThreshold1 = 50; + nFPSThreshold2 = 50; } else if ( IsX360() || g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 90 ) { nFPSThreshold1 = 30; - nFPSThreshold1 = 25; + nFPSThreshold2 = 25; } if ( nFps >= nFPSThreshold1 ) diff --git a/mp/src/game/client/vgui_messagechars.cpp b/mp/src/game/client/vgui_messagechars.cpp index 547164f6..1d1410f1 100644 --- a/mp/src/game/client/vgui_messagechars.cpp +++ b/mp/src/game/client/vgui_messagechars.cpp @@ -235,9 +235,10 @@ int CMessageCharsPanel::AddText( Assert( !msg->text ); - msg->text = new char[ Q_strlen( data ) + 1 ]; + int textLength = Q_strlen( data ) + 1; + msg->text = new char[ textLength ]; Assert( msg->text ); - Q_strncpy( msg->text, data, sizeof( msg->text ) ); + Q_strncpy( msg->text, data, textLength ); if ( flTime ) msg->fTTL = gpGlobals->curtime + flTime; diff --git a/mp/src/game/client/viewpostprocess.cpp b/mp/src/game/client/viewpostprocess.cpp index 3f74acdc..39c2237e 100644 --- a/mp/src/game/client/viewpostprocess.cpp +++ b/mp/src/game/client/viewpostprocess.cpp @@ -1885,7 +1885,8 @@ static void DrawPyroVignette( int nDestX, int nDestY, int nWidth, int nHeight, / if ( pyro_vignette.GetInt() > 1 ) { - Vector2D vMaxSize( ( float )nScreenWidth / ( float )nScreenWidth / NUM_PYRO_SEGMENTS * 2.0f, ( float )nScreenHeight / ( float )nScreenHeight / NUM_PYRO_SEGMENTS * 2.0f ); + float flPyroSegments = 2.0f / NUM_PYRO_SEGMENTS; + Vector2D vMaxSize( flPyroSegments, flPyroSegments ); if ( !bInit ) { diff --git a/mp/src/game/client/viewrender.cpp b/mp/src/game/client/viewrender.cpp index a9ef4eb8..a629071b 100644 --- a/mp/src/game/client/viewrender.cpp +++ b/mp/src/game/client/viewrender.cpp @@ -2248,7 +2248,7 @@ void CViewRender::RenderView( const CViewSetup &view, int nClearFlags, int whatT // let vgui know where to render stuff for the forced-to-framebuffer panels if( UseVR() ) { - vgui::surface()->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget ); } // clear the render target if we need to @@ -3885,7 +3885,7 @@ static void DrawOpaqueRenderables_DrawStaticProps( CClientRenderablesList::CEntr for( CClientRenderablesList::CEntry *itEntity = pEntitiesBegin; itEntity < pEntitiesEnd; ++ itEntity ) { if ( itEntity->m_pRenderable ) - NULL; + /**/; else continue; @@ -3935,7 +3935,7 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode ) RopeManager()->ResetRenderCache(); g_pParticleSystemMgr->ResetRenderCache(); - bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool(); + //bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool(); // @@ -4101,16 +4101,20 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode ) for ( int bucket = 0; bucket < RENDER_GROUP_CFG_NUM_OPAQUE_ENT_BUCKETS; ++ bucket ) { - if ( bDrawopaquestaticpropslast ) + // PVS-Studio pointed out that the two sides of the if/else were identical. Fixing + // this long-broken behavior would change rendering, so I fixed the code but + // commented out the new behavior. Uncomment the if statement and else block + // when needed. + //if ( bDrawopaquestaticpropslast ) { DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode ); } - else + /*else { - DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode ); - } + DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); + }*/ } diff --git a/mp/src/game/protobuf_include.vpc b/mp/src/game/protobuf_include.vpc index c4fe5022..74c2ada4 100644 --- a/mp/src/game/protobuf_include.vpc +++ b/mp/src/game/protobuf_include.vpc @@ -8,10 +8,10 @@ $MacroRequired "PLATFORM" $Project { - $Folder "Libraries" + $Folder "Link Libraries" { - $Libexternal libprotobuf [!$VS2012 && !$VS2013] + $Libexternal $SRCDIR\lib\public\2010\libprotobuf [$VS2010] $Libexternal 2012\libprotobuf [$VS2012] - $Libexternal 2013\libprotobuf [$VS2013] + $Libexternal libprotobuf [$VS2013 || !$WINDOWS] } } diff --git a/mp/src/game/server/BaseAnimatingOverlay.cpp b/mp/src/game/server/BaseAnimatingOverlay.cpp index 50c94361..36534bc0 100644 --- a/mp/src/game/server/BaseAnimatingOverlay.cpp +++ b/mp/src/game/server/BaseAnimatingOverlay.cpp @@ -104,9 +104,14 @@ void CAnimationLayer::Init( CBaseAnimatingOverlay *pOverlay ) m_nSequence = 0; m_nPriority = 0; m_nOrder.Set( CBaseAnimatingOverlay::MAX_OVERLAYS ); + + m_flBlendIn = 0.0; + m_flBlendOut = 0.0; + m_flKillRate = 100.0; m_flKillDelay = 0.0; m_flPlaybackRate = 1.0; + m_flLastEventCheck = 0.0; m_flLastAccess = gpGlobals->curtime; m_flLayerAnimtime = 0; m_flLayerFadeOuttime = 0; diff --git a/mp/src/game/server/EnvFade.cpp b/mp/src/game/server/EnvFade.cpp index b3ed4b2c..fa0185d5 100644 --- a/mp/src/game/server/EnvFade.cpp +++ b/mp/src/game/server/EnvFade.cpp @@ -95,7 +95,7 @@ void CEnvFade::InputFade( inputdata_t &inputdata ) if ( m_spawnflags & SF_FADE_ONLYONE ) { - if ( inputdata.pActivator->IsNetClient() ) + if ( inputdata.pActivator && inputdata.pActivator->IsNetClient() ) { UTIL_ScreenFade( inputdata.pActivator, m_clrRender, Duration(), HoldTime(), fadeFlags ); } diff --git a/mp/src/game/server/ai_utils.cpp b/mp/src/game/server/ai_utils.cpp index 802a1c10..83847479 100644 --- a/mp/src/game/server/ai_utils.cpp +++ b/mp/src/game/server/ai_utils.cpp @@ -46,7 +46,7 @@ END_DATADESC() CAI_ShotRegulator::CAI_ShotRegulator() : m_nMinBurstShots(1), m_nMaxBurstShots(1) { m_flMinRestInterval = 0.0f; - m_flMinRestInterval = 0.0f; + m_flMaxRestInterval = 0.0f; m_flMinBurstInterval = 0.0f; m_flMaxBurstInterval = 0.0f; m_flNextShotTime = -1; diff --git a/mp/src/game/server/baseentity.cpp b/mp/src/game/server/baseentity.cpp index 52316924..b42f2abe 100644 --- a/mp/src/game/server/baseentity.cpp +++ b/mp/src/game/server/baseentity.cpp @@ -303,7 +303,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity ) SendPropBool( SENDINFO( m_bAlternateSorting )), #ifdef TF_DLL - SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, SPROP_UNSIGNED ) ), + SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, 0 ) ), #endif END_SEND_TABLE() diff --git a/mp/src/game/server/baseflex.cpp b/mp/src/game/server/baseflex.cpp index 8e17fa75..4e6b4629 100644 --- a/mp/src/game/server/baseflex.cpp +++ b/mp/src/game/server/baseflex.cpp @@ -1318,9 +1318,9 @@ static Activity DetermineExpressionMoveActivity( CChoreoEvent *event, CAI_BaseNP // Custom distance styles are appended to param2 with a space as a separator const char *pszAct = Q_strstr( sParam2, " " ); + char szActName[256]; if ( pszAct ) { - char szActName[256]; Q_strncpy( szActName, sParam2, sizeof(szActName) ); szActName[ (pszAct-sParam2) ] = '\0'; pszAct = szActName; diff --git a/mp/src/game/server/env_tonemap_controller.cpp b/mp/src/game/server/env_tonemap_controller.cpp index 807e39ac..613d4548 100644 --- a/mp/src/game/server/env_tonemap_controller.cpp +++ b/mp/src/game/server/env_tonemap_controller.cpp @@ -169,7 +169,7 @@ void CEnvTonemapController::InputSetBloomScaleRange( inputdata_t &inputdata ) return; } m_flCustomBloomScale=bloom_max; - m_flCustomBloomScale=bloom_min; + m_flCustomBloomScaleMinimum=bloom_min; } //----------------------------------------------------------------------------- diff --git a/mp/src/game/server/gameinterface.cpp b/mp/src/game/server/gameinterface.cpp index c9357138..ff077ea5 100644 --- a/mp/src/game/server/gameinterface.cpp +++ b/mp/src/game/server/gameinterface.cpp @@ -1888,9 +1888,13 @@ void CServerGameDLL::SetServerHibernation( bool bHibernating ) const char *CServerGameDLL::GetServerBrowserMapOverride() { #ifdef TF_DLL - if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && g_pPopulationManager && g_pPopulationManager->GetPopulationFilenameShort() != '\0' ) + if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() ) { - return g_pPopulationManager->GetPopulationFilenameShort(); + const char *pszFilenameShort = g_pPopulationManager ? g_pPopulationManager->GetPopulationFilenameShort() : NULL; + if ( pszFilenameShort && pszFilenameShort[0] ) + { + return pszFilenameShort; + } } #endif return NULL; @@ -2964,17 +2968,20 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p // Flush the remaining areaportal states. engine->SetAreaPortalStates( portalNums, isOpen, iOutPortal ); - // Update the area bits that get sent to the client. - pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); + if ( pPlayer ) + { + // Update the area bits that get sent to the client. + pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); #ifdef PORTAL - // *After* the player's view has updated its area bits, add on any other areas seen by portals - CPortal_Player* pPortalPlayer = dynamic_cast( pPlayer ); - if ( pPortalPlayer ) - { - pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize ); - } + // *After* the player's view has updated its area bits, add on any other areas seen by portals + CPortal_Player* pPortalPlayer = dynamic_cast( pPlayer ); + if ( pPortalPlayer ) + { + pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize ); + } #endif //PORTAL + } } diff --git a/mp/src/game/server/hl2/npc_strider.cpp b/mp/src/game/server/hl2/npc_strider.cpp index b0cb2edf..60d37cdf 100644 --- a/mp/src/game/server/hl2/npc_strider.cpp +++ b/mp/src/game/server/hl2/npc_strider.cpp @@ -1130,7 +1130,7 @@ void CNPC_Strider::GatherConditions() !WeaponLOSCondition( GetAdjustedOrigin(), GetEnemy()->BodyTarget( GetAdjustedOrigin() ), false ) ) ) { #if 0 - if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) && !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) + if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) SetIdealHeight( MIN( GetMaxHeight(), GetHeight() + 75.0 * 0.1 ) ); // default to rising up #endif GatherHeightConditions( GetAdjustedOrigin(), GetEnemy() ); @@ -1161,7 +1161,7 @@ void CNPC_Strider::GatherConditions() //--------------------------------------------------------- void CNPC_Strider::GatherHeightConditions( const Vector &vTestPos, CBaseEntity *pEntity ) { - if ( HasCondition( COND_STRIDER_SHOULD_CROUCH ) && HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) + if ( HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) return; float maxZ = (GetAbsOrigin().z - (GetMaxHeightModel() - GetMaxHeight())); diff --git a/mp/src/game/server/player.cpp b/mp/src/game/server/player.cpp index 73aab6d6..0538f90a 100644 --- a/mp/src/game/server/player.cpp +++ b/mp/src/game/server/player.cpp @@ -7409,6 +7409,13 @@ void CBasePlayer::RemoveWearable( CEconWearable *pItem ) m_hMyWearables.Remove( i ); break; } + + // Integrety is failing, remove NULLs + if ( !pWearable ) + { + m_hMyWearables.Remove( i ); + break; + } } #ifdef DEBUG diff --git a/mp/src/game/server/props.cpp b/mp/src/game/server/props.cpp index 4d121d71..648191db 100644 --- a/mp/src/game/server/props.cpp +++ b/mp/src/game/server/props.cpp @@ -1517,7 +1517,7 @@ void CBreakableProp::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Rea SetPhysicsAttacker( pPhysGunUser, gpGlobals->curtime ); - if( Reason == PUNTED_BY_CANNON ) + if( (int)Reason == (int)PUNTED_BY_CANNON ) { PlayPuntSound(); } diff --git a/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp b/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp index 975eec17..4d1ad4fe 100644 --- a/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp +++ b/mp/src/game/shared/Multiplayer/multiplayer_animstate.cpp @@ -358,16 +358,21 @@ void CMultiPlayerAnimState::PlayFlinchGesture( Activity iActivity ) //----------------------------------------------------------------------------- bool CMultiPlayerAnimState::InitGestureSlots( void ) { - // Get the base player. - CBasePlayer *pPlayer = GetBasePlayer(); - if( pPlayer ) + // Setup the number of gesture slots. + m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT ); + + // Assign all of the the CAnimationLayer pointers to null early in case we bail. + for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture ) { - // Set the number of animation overlays we will use. - pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT ); + m_aGestureSlots[iGesture].m_pAnimLayer = NULL; } - // Setup the number of gesture slots. - m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT ); + // Get the base player. + CBasePlayer *pPlayer = GetBasePlayer(); + + // Set the number of animation overlays we will use. + pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT ); + for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture ) { m_aGestureSlots[iGesture].m_pAnimLayer = pPlayer->GetAnimOverlay( iGesture ); @@ -409,6 +414,9 @@ void CMultiPlayerAnimState::ResetGestureSlot( int iGestureSlot ) // Sanity Check Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT ); + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + GestureSlot_t *pGestureSlot = &m_aGestureSlots[iGestureSlot]; if ( pGestureSlot ) { @@ -486,6 +494,36 @@ bool CMultiPlayerAnimState::IsGestureSlotActive( int iGestureSlot ) return m_aGestureSlots[iGestureSlot].m_bActive; } + +//----------------------------------------------------------------------------- +// Purpose: Track down a crash +//----------------------------------------------------------------------------- +bool CMultiPlayerAnimState::VerifyAnimLayerInSlot( int iGestureSlot ) +{ + if ( iGestureSlot < 0 || iGestureSlot >= GESTURE_SLOT_COUNT ) + { + return false; + } + + if ( GetBasePlayer()->GetNumAnimOverlays() < iGestureSlot + 1 ) + { + AssertMsg2( false, "Player %d doesn't have gesture slot %d any more.", GetBasePlayer()->entindex(), iGestureSlot ); + Msg( "Player %d doesn't have gesture slot %d any more.\n", GetBasePlayer()->entindex(), iGestureSlot ); + m_aGestureSlots[iGestureSlot].m_pAnimLayer = NULL; + return false; + } + + CAnimationLayer *pExpected = GetBasePlayer()->GetAnimOverlay( iGestureSlot ); + if ( m_aGestureSlots[iGestureSlot].m_pAnimLayer != pExpected ) + { + AssertMsg3( false, "Gesture slot %d pointing to wrong address %p. Updating to new address %p.", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected ); + Msg( "Gesture slot %d pointing to wrong address %p. Updating to new address %p.\n", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected ); + m_aGestureSlots[iGestureSlot].m_pAnimLayer = pExpected; + } + + return true; +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -509,6 +547,9 @@ void CMultiPlayerAnimState::RestartGesture( int iGestureSlot, Activity iGestureA // Sanity Check Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT ); + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + if ( !IsGestureSlotPlaying( iGestureSlot, iGestureActivity ) ) { #ifdef CLIENT_DLL @@ -549,6 +590,9 @@ void CMultiPlayerAnimState::AddToGestureSlot( int iGestureSlot, Activity iGestur if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer ) return; + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + // Get the sequence. int iGestureSequence = pPlayer->SelectWeightedSequence( iGestureActivity ); if ( iGestureSequence <= 0 ) @@ -623,6 +667,9 @@ void CMultiPlayerAnimState::AddVCDSequenceToGestureSlot( int iGestureSlot, int i if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer ) return; + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + // Set the activity. Activity iGestureActivity = ACT_MP_VCD; @@ -1154,6 +1201,9 @@ void CMultiPlayerAnimState::ComputeGestureSequence( CStudioHdr *pStudioHdr ) if ( !m_aGestureSlots[iGesture].m_bActive ) continue; + if ( !VerifyAnimLayerInSlot( iGesture ) ) + continue; + UpdateGestureLayer( pStudioHdr, &m_aGestureSlots[iGesture] ); } } diff --git a/mp/src/game/shared/Multiplayer/multiplayer_animstate.h b/mp/src/game/shared/Multiplayer/multiplayer_animstate.h index 5407e4bd..007533a1 100644 --- a/mp/src/game/shared/Multiplayer/multiplayer_animstate.h +++ b/mp/src/game/shared/Multiplayer/multiplayer_animstate.h @@ -200,6 +200,7 @@ public: void AddVCDSequenceToGestureSlot( int iGestureSlot, int iGestureSequence, float flCycle = 0.0f, bool bAutoKill = true ); CAnimationLayer* GetGestureSlotLayer( int iGestureSlot ); bool IsGestureSlotActive( int iGestureSlot ); + bool VerifyAnimLayerInSlot( int iGestureSlot ); // Feet. bool m_bForceAimYaw; diff --git a/mp/src/game/shared/base_playeranimstate.cpp b/mp/src/game/shared/base_playeranimstate.cpp index a25d773c..d90655ac 100644 --- a/mp/src/game/shared/base_playeranimstate.cpp +++ b/mp/src/game/shared/base_playeranimstate.cpp @@ -65,7 +65,7 @@ CBasePlayerAnimState::CBasePlayerAnimState() m_flEyePitch = 0.0f; m_bCurrentFeetYawInitialized = false; m_flCurrentTorsoYaw = 0.0f; - m_flCurrentTorsoYaw = TURN_NONE; + m_nTurningInPlace = TURN_NONE; m_flMaxGroundSpeed = 0.0f; m_flStoredCycle = 0.0f; diff --git a/mp/src/game/shared/baseachievement.cpp b/mp/src/game/shared/baseachievement.cpp index 494133c1..ebc5876e 100644 --- a/mp/src/game/shared/baseachievement.cpp +++ b/mp/src/game/shared/baseachievement.cpp @@ -427,13 +427,7 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber ) // new component, set the bit and increment the count SetComponentBits( m_iComponentBits | iBitMask ); - Assert( m_iCount <= m_iGoal ); - if ( m_iCount == m_iGoal ) - { - // all components found, award the achievement (and save state) - AwardAchievement(); - } - else + if ( m_iCount != m_iGoal ) { // save our state at the next good opportunity m_pAchievementMgr->SetDirty( true ); @@ -453,6 +447,15 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber ) Msg( "Component %d for achievement %s found, but already had that component\n", iBitNumber, GetName() ); } } + + // Check to see if we've achieved our goal even if the bit is already set + // (this fixes some older achievements that are stuck in the 9/9 state and could never be evaluated) + Assert( m_iCount <= m_iGoal ); + if ( m_iCount == m_iGoal ) + { + // all components found, award the achievement (and save state) + AwardAchievement(); + } } //----------------------------------------------------------------------------- diff --git a/mp/src/game/shared/baseachievement.h b/mp/src/game/shared/baseachievement.h index 893055a3..2074f81d 100644 --- a/mp/src/game/shared/baseachievement.h +++ b/mp/src/game/shared/baseachievement.h @@ -105,6 +105,9 @@ public: virtual void Think( void ) { return; } + const char *GetMapNameFilter( void ){ return m_pMapNameFilter; } + CAchievementMgr *GetAchievementMgr( void ){ return m_pAchievementMgr; } + protected: virtual void FireGameEvent( IGameEvent *event ); virtual void FireGameEvent_Internal( IGameEvent *event ) {}; diff --git a/mp/src/game/shared/multiplay_gamerules.cpp b/mp/src/game/shared/multiplay_gamerules.cpp index 07932e92..abecba9e 100644 --- a/mp/src/game/shared/multiplay_gamerules.cpp +++ b/mp/src/game/shared/multiplay_gamerules.cpp @@ -857,9 +857,9 @@ ConVarRef suitcharger( "sk_suitcharger" ); { killer_weapon_name += 7; } - else if ( strncmp( killer_weapon_name, "NPC_", 8 ) == 0 ) + else if ( strncmp( killer_weapon_name, "NPC_", 4 ) == 0 ) { - killer_weapon_name += 8; + killer_weapon_name += 4; } else if ( strncmp( killer_weapon_name, "func_", 5 ) == 0 ) { diff --git a/mp/src/game/shared/particle_parse.cpp b/mp/src/game/shared/particle_parse.cpp index 9d3b4245..db15685d 100644 --- a/mp/src/game/shared/particle_parse.cpp +++ b/mp/src/game/shared/particle_parse.cpp @@ -309,7 +309,7 @@ void DispatchParticleEffect( const char *pszParticleName, ParticleAttachment_t i if ( ( data.m_fFlags & PARTICLE_DISPATCH_FROM_ENTITY ) != 0 && ( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW ) ) { - CReliableBroadcastRecipientFilter filter; + CBroadcastRecipientFilter filter; DispatchEffect( "ParticleEffect", data, filter ); } else diff --git a/mp/src/game/shared/particle_property.cpp b/mp/src/game/shared/particle_property.cpp index 8ddc9784..c1c44a1a 100644 --- a/mp/src/game/shared/particle_property.cpp +++ b/mp/src/game/shared/particle_property.cpp @@ -200,8 +200,23 @@ void CParticleProperty::AddControlPoint( int iEffectIndex, int iPoint, C_BaseEnt ParticleEffectList_t *pEffect = &m_ParticleEffects[iEffectIndex]; Assert( pEffect->pControlPoints.Count() < MAX_PARTICLE_CONTROL_POINTS ); - int iIndex = pEffect->pControlPoints.AddToTail(); - ParticleControlPoint_t *pNewPoint = &pEffect->pControlPoints[iIndex]; + // If the control point is already used, override it + ParticleControlPoint_t *pNewPoint = NULL; + int iIndex = iPoint; + FOR_EACH_VEC( pEffect->pControlPoints, i ) + { + if ( pEffect->pControlPoints[i].iControlPoint == iPoint ) + { + pNewPoint = &pEffect->pControlPoints[i]; + } + } + + if ( !pNewPoint ) + { + iIndex = pEffect->pControlPoints.AddToTail(); + pNewPoint = &pEffect->pControlPoints[iIndex]; + } + pNewPoint->iControlPoint = iPoint; pNewPoint->hEntity = pEntity; pNewPoint->iAttachType = iAttachType; @@ -553,7 +568,7 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i if ( pAnimating ) { int bUseHeadOrigin = 0; - CALL_ATTRIB_HOOK_INT_ON_OTHER( pPoint->hEntity.Get(), bUseHeadOrigin, particle_effect_use_head_origin ); + CALL_ATTRIB_HOOK_INT_ON_OTHER( pAnimating, bUseHeadOrigin, particle_effect_use_head_origin ); if ( bUseHeadOrigin > 0 ) { int iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "bip_head" ); @@ -565,15 +580,17 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "prp_hat" ); } } - if ( iBone >= 0 ) + if ( iBone < 0 ) { - bUsingHeadOrigin = true; - const matrix3x4_t headBone = pAnimating->GetBone( iBone ); - MatrixVectors( headBone, &vecForward, &vecRight, &vecUp ); - MatrixPosition( headBone, vecOrigin ); - - CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPoint->hEntity.Get(), flOffset, particle_effect_vertical_offset ); + iBone = 0; } + + bUsingHeadOrigin = true; + const matrix3x4_t headBone = pAnimating->GetBone( iBone ); + MatrixVectors( headBone, &vecForward, &vecRight, &vecUp ); + MatrixPosition( headBone, vecOrigin ); + + CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pAnimating, flOffset, particle_effect_vertical_offset ); } } } diff --git a/mp/src/lib/public/2012/libprotobuf.lib b/mp/src/lib/public/2012/libprotobuf.lib new file mode 100644 index 00000000..155ad189 Binary files /dev/null and b/mp/src/lib/public/2012/libprotobuf.lib differ diff --git a/mp/src/lib/public/appframework.lib b/mp/src/lib/public/appframework.lib index 91edb5ab..e1f5a180 100644 Binary files a/mp/src/lib/public/appframework.lib and b/mp/src/lib/public/appframework.lib differ diff --git a/mp/src/lib/public/bitmap.lib b/mp/src/lib/public/bitmap.lib index a7b09953..2e69345a 100644 Binary files a/mp/src/lib/public/bitmap.lib and b/mp/src/lib/public/bitmap.lib differ diff --git a/mp/src/lib/public/choreoobjects.lib b/mp/src/lib/public/choreoobjects.lib index 7aaab186..92b3d56d 100644 Binary files a/mp/src/lib/public/choreoobjects.lib and b/mp/src/lib/public/choreoobjects.lib differ diff --git a/mp/src/lib/public/dmxloader.lib b/mp/src/lib/public/dmxloader.lib index fa36c08d..373ada82 100644 Binary files a/mp/src/lib/public/dmxloader.lib and b/mp/src/lib/public/dmxloader.lib differ diff --git a/mp/src/lib/public/libprotobuf.lib b/mp/src/lib/public/libprotobuf.lib index e25942c5..59ffc578 100644 Binary files a/mp/src/lib/public/libprotobuf.lib and b/mp/src/lib/public/libprotobuf.lib differ diff --git a/mp/src/lib/public/libz.lib b/mp/src/lib/public/libz.lib index 41afc354..3924b4e9 100644 Binary files a/mp/src/lib/public/libz.lib and b/mp/src/lib/public/libz.lib differ diff --git a/mp/src/lib/public/linux32/bitmap.a b/mp/src/lib/public/linux32/bitmap.a index 82ae893c..74bf4cbb 100644 Binary files a/mp/src/lib/public/linux32/bitmap.a and b/mp/src/lib/public/linux32/bitmap.a differ diff --git a/mp/src/lib/public/linux32/choreoobjects.a b/mp/src/lib/public/linux32/choreoobjects.a index 91d9c90c..281cf899 100644 Binary files a/mp/src/lib/public/linux32/choreoobjects.a and b/mp/src/lib/public/linux32/choreoobjects.a differ diff --git a/mp/src/lib/public/linux32/dmxloader.a b/mp/src/lib/public/linux32/dmxloader.a index 889405c9..e8c1ee35 100644 Binary files a/mp/src/lib/public/linux32/dmxloader.a and b/mp/src/lib/public/linux32/dmxloader.a differ diff --git a/mp/src/lib/public/linux32/libsteam_api.so b/mp/src/lib/public/linux32/libsteam_api.so index 6238c83e..ffc51e86 100755 Binary files a/mp/src/lib/public/linux32/libsteam_api.so and b/mp/src/lib/public/linux32/libsteam_api.so differ diff --git a/mp/src/lib/public/linux32/libtier0.so b/mp/src/lib/public/linux32/libtier0.so index 574e0a88..492e3a48 100644 Binary files a/mp/src/lib/public/linux32/libtier0.so and b/mp/src/lib/public/linux32/libtier0.so differ diff --git a/mp/src/lib/public/linux32/libvstdlib.so b/mp/src/lib/public/linux32/libvstdlib.so index 0a460bb5..c1eb6e3f 100644 Binary files a/mp/src/lib/public/linux32/libvstdlib.so and b/mp/src/lib/public/linux32/libvstdlib.so differ diff --git a/mp/src/lib/public/linux32/matsys_controls.a b/mp/src/lib/public/linux32/matsys_controls.a index 9ae25dd0..c488deb3 100644 Binary files a/mp/src/lib/public/linux32/matsys_controls.a and b/mp/src/lib/public/linux32/matsys_controls.a differ diff --git a/mp/src/lib/public/linux32/particles.a b/mp/src/lib/public/linux32/particles.a index 6d1a8f91..8e911d22 100644 Binary files a/mp/src/lib/public/linux32/particles.a and b/mp/src/lib/public/linux32/particles.a differ diff --git a/mp/src/lib/public/linux32/shaderlib.a b/mp/src/lib/public/linux32/shaderlib.a index 327f13be..97ddf45b 100644 Binary files a/mp/src/lib/public/linux32/shaderlib.a and b/mp/src/lib/public/linux32/shaderlib.a differ diff --git a/mp/src/lib/public/linux32/tier2.a b/mp/src/lib/public/linux32/tier2.a index 1ac5c0c5..064905fc 100644 Binary files a/mp/src/lib/public/linux32/tier2.a and b/mp/src/lib/public/linux32/tier2.a differ diff --git a/mp/src/lib/public/linux32/tier3.a b/mp/src/lib/public/linux32/tier3.a index 9bc1bf1f..92111fbc 100644 Binary files a/mp/src/lib/public/linux32/tier3.a and b/mp/src/lib/public/linux32/tier3.a differ diff --git a/mp/src/lib/public/linux32/vtf.a b/mp/src/lib/public/linux32/vtf.a index 30858deb..d5e8eb27 100644 Binary files a/mp/src/lib/public/linux32/vtf.a and b/mp/src/lib/public/linux32/vtf.a differ diff --git a/mp/src/lib/public/matsys_controls.lib b/mp/src/lib/public/matsys_controls.lib index 6663600a..b0e1826f 100644 Binary files a/mp/src/lib/public/matsys_controls.lib and b/mp/src/lib/public/matsys_controls.lib differ diff --git a/mp/src/lib/public/nvtristrip.lib b/mp/src/lib/public/nvtristrip.lib index ed2478a8..7796d461 100644 Binary files a/mp/src/lib/public/nvtristrip.lib and b/mp/src/lib/public/nvtristrip.lib differ diff --git a/mp/src/lib/public/osx32/bitmap.a b/mp/src/lib/public/osx32/bitmap.a index ffc0a58c..3abb16d1 100644 Binary files a/mp/src/lib/public/osx32/bitmap.a and b/mp/src/lib/public/osx32/bitmap.a differ diff --git a/mp/src/lib/public/osx32/choreoobjects.a b/mp/src/lib/public/osx32/choreoobjects.a index 58fb4a96..ac54957d 100644 Binary files a/mp/src/lib/public/osx32/choreoobjects.a and b/mp/src/lib/public/osx32/choreoobjects.a differ diff --git a/mp/src/lib/public/osx32/dmxloader.a b/mp/src/lib/public/osx32/dmxloader.a index 53748abc..120119bd 100644 Binary files a/mp/src/lib/public/osx32/dmxloader.a and b/mp/src/lib/public/osx32/dmxloader.a differ diff --git a/mp/src/lib/public/osx32/libsteam_api.dylib b/mp/src/lib/public/osx32/libsteam_api.dylib index 3eed40fe..dfa1ae2d 100755 Binary files a/mp/src/lib/public/osx32/libsteam_api.dylib and b/mp/src/lib/public/osx32/libsteam_api.dylib differ diff --git a/mp/src/lib/public/osx32/libtier0.dylib b/mp/src/lib/public/osx32/libtier0.dylib index b56e4889..75037b68 100755 Binary files a/mp/src/lib/public/osx32/libtier0.dylib and b/mp/src/lib/public/osx32/libtier0.dylib differ diff --git a/mp/src/lib/public/osx32/libvstdlib.dylib b/mp/src/lib/public/osx32/libvstdlib.dylib index fcd2a9f7..90110d1a 100755 Binary files a/mp/src/lib/public/osx32/libvstdlib.dylib and b/mp/src/lib/public/osx32/libvstdlib.dylib differ diff --git a/mp/src/lib/public/osx32/matsys_controls.a b/mp/src/lib/public/osx32/matsys_controls.a index 26d42570..8d9fb9a6 100644 Binary files a/mp/src/lib/public/osx32/matsys_controls.a and b/mp/src/lib/public/osx32/matsys_controls.a differ diff --git a/mp/src/lib/public/osx32/particles.a b/mp/src/lib/public/osx32/particles.a index 3745aab4..c2e23b12 100644 Binary files a/mp/src/lib/public/osx32/particles.a and b/mp/src/lib/public/osx32/particles.a differ diff --git a/mp/src/lib/public/osx32/shaderlib.a b/mp/src/lib/public/osx32/shaderlib.a index a9507a01..d90ac5cc 100644 Binary files a/mp/src/lib/public/osx32/shaderlib.a and b/mp/src/lib/public/osx32/shaderlib.a differ diff --git a/mp/src/lib/public/osx32/tier2.a b/mp/src/lib/public/osx32/tier2.a index ccbbb325..04c97436 100644 Binary files a/mp/src/lib/public/osx32/tier2.a and b/mp/src/lib/public/osx32/tier2.a differ diff --git a/mp/src/lib/public/osx32/tier3.a b/mp/src/lib/public/osx32/tier3.a index a3a76ccd..c2ba0cf3 100644 Binary files a/mp/src/lib/public/osx32/tier3.a and b/mp/src/lib/public/osx32/tier3.a differ diff --git a/mp/src/lib/public/osx32/vtf.a b/mp/src/lib/public/osx32/vtf.a index 74130122..33a2571c 100644 Binary files a/mp/src/lib/public/osx32/vtf.a and b/mp/src/lib/public/osx32/vtf.a differ diff --git a/mp/src/lib/public/particles.lib b/mp/src/lib/public/particles.lib index 2e6f9359..18d3b0eb 100644 Binary files a/mp/src/lib/public/particles.lib and b/mp/src/lib/public/particles.lib differ diff --git a/mp/src/lib/public/raytrace.lib b/mp/src/lib/public/raytrace.lib index 507ced28..424ae054 100644 Binary files a/mp/src/lib/public/raytrace.lib and b/mp/src/lib/public/raytrace.lib differ diff --git a/mp/src/lib/public/shaderlib.lib b/mp/src/lib/public/shaderlib.lib index ee4b05f6..9b885f6f 100644 Binary files a/mp/src/lib/public/shaderlib.lib and b/mp/src/lib/public/shaderlib.lib differ diff --git a/mp/src/lib/public/steam_api.lib b/mp/src/lib/public/steam_api.lib index 2d77e960..c8959232 100644 Binary files a/mp/src/lib/public/steam_api.lib and b/mp/src/lib/public/steam_api.lib differ diff --git a/mp/src/lib/public/tier0.lib b/mp/src/lib/public/tier0.lib index 4b3b77d5..40de9b57 100644 Binary files a/mp/src/lib/public/tier0.lib and b/mp/src/lib/public/tier0.lib differ diff --git a/mp/src/lib/public/tier2.lib b/mp/src/lib/public/tier2.lib index b7cfafbb..7676d1cf 100644 Binary files a/mp/src/lib/public/tier2.lib and b/mp/src/lib/public/tier2.lib differ diff --git a/mp/src/lib/public/tier3.lib b/mp/src/lib/public/tier3.lib index ecf4544c..4da05505 100644 Binary files a/mp/src/lib/public/tier3.lib and b/mp/src/lib/public/tier3.lib differ diff --git a/mp/src/lib/public/vmpi.lib b/mp/src/lib/public/vmpi.lib index e9012f2f..e8066c7f 100644 Binary files a/mp/src/lib/public/vmpi.lib and b/mp/src/lib/public/vmpi.lib differ diff --git a/mp/src/lib/public/vstdlib.lib b/mp/src/lib/public/vstdlib.lib index f0789a8d..d502a87c 100644 Binary files a/mp/src/lib/public/vstdlib.lib and b/mp/src/lib/public/vstdlib.lib differ diff --git a/mp/src/lib/public/vtf.lib b/mp/src/lib/public/vtf.lib index c7bf352c..683977cf 100644 Binary files a/mp/src/lib/public/vtf.lib and b/mp/src/lib/public/vtf.lib differ diff --git a/mp/src/public/VGuiMatSurface/IMatSystemSurface.h b/mp/src/public/VGuiMatSurface/IMatSystemSurface.h index 03ff33b0..7e9d90fe 100644 --- a/mp/src/public/VGuiMatSurface/IMatSystemSurface.h +++ b/mp/src/public/VGuiMatSurface/IMatSystemSurface.h @@ -106,9 +106,8 @@ public: // Gets a material bound to a surface texture ID virtual IMaterial *DrawGetTextureMaterial( int id ) = 0; - // The matching method is in ISurface, but we can't add anything there and remain mod-compatible. - // So this goes here instead. virtual void GetFullscreenViewportAndRenderTarget( int & x, int & y, int & w, int & h, ITexture **ppRenderTarget ) = 0; + virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0; }; diff --git a/mp/src/public/XUnzip.cpp b/mp/src/public/XUnzip.cpp index cea57582..fbeb595e 100644 --- a/mp/src/public/XUnzip.cpp +++ b/mp/src/public/XUnzip.cpp @@ -4075,7 +4075,8 @@ ZRESULT TUnzip::Find(const TCHAR *name, bool ic, int *index, ZIPENTRY *ze) return ZR_NOTFOUND; } if (currentfile!=-1) - unzCloseCurrentFile(uf); currentfile=-1; + unzCloseCurrentFile(uf); + currentfile=-1; int i = (int)uf->num_file; if (index!=NULL) *index=i; diff --git a/mp/src/public/XZip.cpp b/mp/src/public/XZip.cpp index fa20631f..2b187a85 100644 --- a/mp/src/public/XZip.cpp +++ b/mp/src/public/XZip.cpp @@ -2705,7 +2705,8 @@ ZRESULT TZip::Add(const char *odstzn, void *src,unsigned int len, DWORD flags) while (*d != 0) { if (*d == '\\') - *d = '/'; d++; + *d = '/'; + d++; } bool isdir = (flags==ZIP_FOLDER); bool needs_trailing_slash = (isdir && dstzn[strlen(dstzn)-1]!='/'); diff --git a/mp/src/public/const.h b/mp/src/public/const.h index 1444b959..98293c08 100644 --- a/mp/src/public/const.h +++ b/mp/src/public/const.h @@ -51,7 +51,7 @@ // BUGBUG: Reconcile with or derive this from the engine's internal definition! // FIXME: I added an extra bit because I needed to make it signed -#define SP_MODEL_INDEX_BITS 12 +#define SP_MODEL_INDEX_BITS 13 // How many bits to use to encode an edict. #define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts diff --git a/mp/src/public/matsys_controls/mdlpanel.h b/mp/src/public/matsys_controls/mdlpanel.h index 91f936e7..070fb973 100644 --- a/mp/src/public/matsys_controls/mdlpanel.h +++ b/mp/src/public/matsys_controls/mdlpanel.h @@ -130,6 +130,7 @@ private: virtual void OnPaint3D(); virtual void PrePaint3D( IMatRenderContext *pRenderContext ) { }; virtual void PostPaint3D( IMatRenderContext *pRenderContext ) { }; + virtual void RenderingRootModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { }; virtual void RenderingMergedModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { }; void OnMouseDoublePressed( vgui::MouseCode code ); diff --git a/mp/src/public/networkvar.h b/mp/src/public/networkvar.h index 027f2b65..142b35e9 100644 --- a/mp/src/public/networkvar.h +++ b/mp/src/public/networkvar.h @@ -455,7 +455,7 @@ public: SetX( ix ); SetY( iy ); SetZ( iz ); - SetZ( iw ); + SetW( iw ); } const Type& operator=( const Type &val ) diff --git a/mp/src/public/sourcevr/isourcevirtualreality.h b/mp/src/public/sourcevr/isourcevirtualreality.h index 3e438455..7b88a8b8 100644 --- a/mp/src/public/sourcevr/isourcevirtualreality.h +++ b/mp/src/public/sourcevr/isourcevirtualreality.h @@ -150,7 +150,9 @@ public: // ---------------------------------------------------------------------- virtual bool Activate() = 0; virtual void Deactivate() = 0; - + + virtual bool ShouldForceVRMode() = 0; + virtual void SetShouldForceVRMode() = 0; }; diff --git a/mp/src/public/steam/isteamapplist.h b/mp/src/public/steam/isteamapplist.h new file mode 100644 index 00000000..b9d71136 --- /dev/null +++ b/mp/src/public/steam/isteamapplist.h @@ -0,0 +1,63 @@ +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to app data in Steam +// +//============================================================================= + +#ifndef ISTEAMAPPLIST_H +#define ISTEAMAPPLIST_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam/isteamclient.h" +#include "steam/steamtypes.h" + +//----------------------------------------------------------------------------- +// Purpose: This is a restricted interface that can only be used by previously approved apps, +// contact your Steam Account Manager if you believe you need access to this API. +// This interface lets you detect installed apps for the local Steam client, useful for debugging tools +// to offer lists of apps to debug via Steam. +//----------------------------------------------------------------------------- +class ISteamAppList +{ +public: + virtual uint32 GetNumInstalledApps() = 0; + virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0; + + virtual int GetAppName( AppId_t nAppID, char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found + virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found + + virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game +}; + +#define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +//--------------------------------------------------------------------------------- +// Purpose: Sent when a new app is installed +//--------------------------------------------------------------------------------- +DEFINE_CALLBACK( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 ); + CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +END_DEFINE_CALLBACK_1() + + +//--------------------------------------------------------------------------------- +// Purpose: Sent when an app is uninstalled +//--------------------------------------------------------------------------------- +DEFINE_CALLBACK( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 ); + CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +END_DEFINE_CALLBACK_1() + + +#pragma pack( pop ) +#endif // ISTEAMAPPLIST_H diff --git a/mp/src/public/steam/isteamapps.h b/mp/src/public/steam/isteamapps.h index 7021a352..7070e2e9 100644 --- a/mp/src/public/steam/isteamapps.h +++ b/mp/src/public/steam/isteamapps.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to app data in Steam // @@ -59,10 +59,19 @@ public: virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing - virtual uint32 GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order + virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order // returns current app install folder for AppID, returns folder name length virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; + virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned) + + virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed + + // Returns the associated launch param if the game is run via steam://run///?param1=value1;param2=value2;param3=value3 etc. + // Parameter names starting with the character '@' are reserved for internal use and will always return and empty string. + // Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, + // but it is advised that you not param names beginning with an underscore for your own features. + virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0; #ifdef _PS3 // Result returned in a RegisterActivationCodeResponse_t callresult @@ -70,7 +79,7 @@ public: #endif }; -#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION005" +#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION006" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) @@ -123,5 +132,18 @@ struct AppProofOfPurchaseKeyResponse_t uint32 m_nAppID; char m_rgchKey[ k_cubAppProofOfPurchaseKeyMax ]; }; + +//--------------------------------------------------------------------------------- +// Purpose: posted after the user gains executes a steam url with query parameters +// such as steam://run///?param1=value1;param2=value2;param3=value3; etc +// while the game is already running. The new params can be queried +// with GetLaunchQueryParam. +//--------------------------------------------------------------------------------- +struct NewLaunchQueryParameters_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 14 }; +}; + + #pragma pack( pop ) #endif // ISTEAMAPPS_H diff --git a/mp/src/public/steam/isteamclient.h b/mp/src/public/steam/isteamclient.h index 43a2076e..b54ad3dc 100644 --- a/mp/src/public/steam/isteamclient.h +++ b/mp/src/public/steam/isteamclient.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: Main interface for loading and accessing Steamworks API's from the // Steam client. @@ -17,6 +17,10 @@ // Define compile time assert macros to let us validate the structure sizes. #define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1]; +#ifndef REFERENCE +#define REFERENCE(arg) ((void)arg) +#endif + #if defined(__linux__) || defined(__APPLE__) // The 32-bit version of gcc has the alignment requirement for uint64 and double set to // 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. @@ -83,10 +87,14 @@ class ISteamApps; class ISteamNetworking; class ISteamRemoteStorage; class ISteamScreenshots; +class ISteamMusic; class ISteamGameServerStats; class ISteamPS3OverlayRender; class ISteamHTTP; class ISteamUnifiedMessages; +class ISteamController; +class ISteamUGC; +class ISteamAppList; //----------------------------------------------------------------------------- // Purpose: Interface to creating a new steam instance, or to @@ -189,9 +197,20 @@ public: // Exposes the ISteamUnifiedMessages interface virtual ISteamUnifiedMessages *GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + // Exposes the ISteamController interface + virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Exposes the ISteamUGC interface + virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns app list interface, only available on specially registered apps + virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Music Player + virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; }; -#define STEAMCLIENT_INTERFACE_VERSION "SteamClient012" +#define STEAMCLIENT_INTERFACE_VERSION "SteamClient014" //----------------------------------------------------------------------------- // Purpose: Base values for callback identifiers, each callback must @@ -228,6 +247,15 @@ enum { k_iSteamControllerCallbacks = 2800 }; enum { k_iClientParentalSettingsCallbacks = 2900 }; enum { k_iClientDeviceAuthCallbacks = 3000 }; enum { k_iClientNetworkDeviceManagerCallbacks = 3100 }; +enum { k_iClientMusicCallbacks = 3200 }; +enum { k_iClientRemoteClientManagerCallbacks = 3300 }; +enum { k_iClientUGCCallbacks = 3400 }; +enum { k_iSteamStreamClientCallbacks = 3500 }; +enum { k_IClientProductBuilderCallbacks = 3600 }; +enum { k_iClientShortcutsCallbacks = 3700 }; +enum { k_iClientRemoteControlManagerCallbacks = 3800 }; +enum { k_iSteamAppListCallbacks = 3900 }; +enum { k_iSteamMusicCallbacks = 4000 }; //----------------------------------------------------------------------------- @@ -236,21 +264,18 @@ enum { k_iClientNetworkDeviceManagerCallbacks = 3100 }; // Do not change any of these. //----------------------------------------------------------------------------- -class CSteamCallback +struct SteamCallback_t { public: - virtual const char *GetCallbackName() const = 0; - virtual uint32 GetCallbackID() const = 0; - virtual uint8 *GetFixedData() const = 0; - virtual uint32 GetFixedSize() const = 0; - virtual uint32 GetNumMemberVariables() const = 0; - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const = 0; + SteamCallback_t() {} }; #define DEFINE_CALLBACK( callbackname, callbackid ) \ -struct callbackname##_t { \ +struct callbackname : SteamCallback_t { \ enum { k_iCallback = callbackid }; \ - static callbackname##_t *GetNullPointer() { return 0; } + static callbackname *GetNullPointer() { return 0; } \ + static const char *GetCallbackName() { return #callbackname; } \ + static uint32 GetCallbackID() { return callbackname::k_iCallback; } #define CALLBACK_MEMBER( varidx, vartype, varname ) \ public: vartype varname ; \ @@ -269,64 +294,60 @@ struct callbackname##_t { \ *pszName = #varname; *pszType = #vartype; } -#define END_CALLBACK_INTERNAL_BEGIN( callbackname, numvars ) }; \ -class C##callbackname : public CSteamCallback { \ -public: callbackname##_t m_Data; \ - C##callbackname () { memset( &m_Data, 0, sizeof(m_Data) ); } \ - virtual const char *GetCallbackName() const { return #callbackname; } \ - virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \ - virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \ - virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \ - virtual uint32 GetNumMemberVariables() const { return numvars; } \ - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { \ +#define END_CALLBACK_INTERNAL_BEGIN( numvars ) \ + static uint32 GetNumMemberVariables() { return numvars; } \ + static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ switch ( index ) { default : return false; -#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : m_Data.GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true; +#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true; -#define END_CALLBACK_INTERNAL_END() }; }; }; +#define END_CALLBACK_INTERNAL_END() }; } }; -#define END_DEFINE_CALLBACK_0( callbackname ) }; \ -class C##callbackname : public CSteamCallback { \ -public: callbackname##_t m_Data; \ - virtual const char *GetCallbackName() const { return #callbackname; } \ - virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \ - virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \ - virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \ - virtual uint32 GetNumMemberVariables() const { return 0; } \ - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { return false; } \ - }; \ +#define END_DEFINE_CALLBACK_0() \ + static uint32 GetNumMemberVariables() { return 0; } \ + static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { REFERENCE( pszType ); REFERENCE( pszName ); REFERENCE( varCount ); REFERENCE( varSize ); REFERENCE( varOffset ); REFERENCE( index ); return false; } \ + }; -#define END_DEFINE_CALLBACK_1( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 1 ) \ +#define END_DEFINE_CALLBACK_1() \ + END_CALLBACK_INTERNAL_BEGIN( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_2( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 2 ) \ +#define END_DEFINE_CALLBACK_2() \ + END_CALLBACK_INTERNAL_BEGIN( 2 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_3( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 3 ) \ +#define END_DEFINE_CALLBACK_3() \ + END_CALLBACK_INTERNAL_BEGIN( 3 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_4( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 4 ) \ +#define END_DEFINE_CALLBACK_4() \ + END_CALLBACK_INTERNAL_BEGIN( 4 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ END_CALLBACK_INTERNAL_SWITCH( 3 ) \ END_CALLBACK_INTERNAL_END() +#define END_DEFINE_CALLBACK_5() \ + END_CALLBACK_INTERNAL_BEGIN( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_6( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 6 ) \ + +#define END_DEFINE_CALLBACK_6() \ + END_CALLBACK_INTERNAL_BEGIN( 6 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ @@ -335,8 +356,8 @@ public: callbackname##_t m_Data; \ END_CALLBACK_INTERNAL_SWITCH( 5 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_7( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 7 ) \ +#define END_DEFINE_CALLBACK_7() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ @@ -346,4 +367,29 @@ public: callbackname##_t m_Data; \ END_CALLBACK_INTERNAL_SWITCH( 6 ) \ END_CALLBACK_INTERNAL_END() +#define END_DEFINE_CALLBACK_8() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_9() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_END() + #endif // ISTEAMCLIENT_H diff --git a/mp/src/public/steam/isteamcontroller.h b/mp/src/public/steam/isteamcontroller.h index 6975e565..6a97a6fc 100644 --- a/mp/src/public/steam/isteamcontroller.h +++ b/mp/src/public/steam/isteamcontroller.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= // // Purpose: interface to valve controller // @@ -11,6 +11,7 @@ #endif #include "isteamclient.h" +#include "steamcontrollerpublic.h" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) @@ -21,16 +22,44 @@ #error isteamclient.h must be included #endif +#define MAX_STEAM_CONTROLLERS 16 #pragma pack( pop ) +enum ESteamControllerPad +{ + k_ESteamControllerPad_Left, + k_ESteamControllerPad_Right +}; + + //----------------------------------------------------------------------------- -// Purpose: Functions for accessing stats, achievements, and leaderboard information +// Purpose: Native Steam controller support API //----------------------------------------------------------------------------- class ISteamController { public: - + + // + // Native controller support API + // + + // Must call init and shutdown when starting/ending use of the interface + virtual bool Init( const char *pchAbsolutePathToControllerConfigVDF ) = 0; + virtual bool Shutdown() = 0; + + // Pump callback/callresult events, SteamAPI_RunCallbacks will do this for you, + // normally never need to call directly. + virtual void RunFrame() = 0; + + // Get the state of the specified controller, returns false if that controller is not connected + virtual bool GetControllerState( uint32 unControllerIndex, SteamControllerState_t *pState ) = 0; + + // Trigger a haptic pulse on the controller + virtual void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; + + // Set the override mode which is used to choose to use different base/legacy bindings from your config file + virtual void SetOverrideMode( const char *pchMode ) = 0; }; #define STEAMCONTROLLER_INTERFACE_VERSION "STEAMCONTROLLER_INTERFACE_VERSION" diff --git a/mp/src/public/steam/isteamfriends.h b/mp/src/public/steam/isteamfriends.h index fc0a8e79..16a2aa5a 100644 --- a/mp/src/public/steam/isteamfriends.h +++ b/mp/src/public/steam/isteamfriends.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright (C) 1996-2008, Valve Corporation, All rights reserved. ===== // // Purpose: interface to both friends list data and general information about users // @@ -203,6 +203,9 @@ public: // accesses old friends names - returns an empty string when their are no more items in the history virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0; + // Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player. + virtual const char *GetPlayerNickname( CSteamID steamIDPlayer ) = 0; + // returns true if the specified user meets any of the criteria specified in iFriendFlags // iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0; @@ -340,7 +343,7 @@ public: virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0; virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0; virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0; - virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *, CSteamID * ) = 0; + virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, CSteamID *psteamidChatter ) = 0; virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0; // interact with the Steam (game overlay / desktop) @@ -360,7 +363,7 @@ public: virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0; }; -#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends013" +#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends014" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) diff --git a/mp/src/public/steam/isteamgameserver.h b/mp/src/public/steam/isteamgameserver.h index c5667c10..cc109985 100644 --- a/mp/src/public/steam/isteamgameserver.h +++ b/mp/src/public/steam/isteamgameserver.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to steam for game servers // @@ -56,10 +56,7 @@ public: /// @see SteamServersConnected_t /// @see SteamServerConnectFailure_t /// @see SteamServersDisconnected_t - virtual void LogOn( - const char *pszAccountName, - const char *pszPassword - ) = 0; + virtual void LogOn( const char *pszToken ) = 0; /// Login to a generic, anonymous account. /// @@ -121,7 +118,7 @@ public: /// it allows users to filter in the matchmaking/server-browser interfaces based on the value /// /// @see k_cbMaxGameServerTags - virtual void SetGameTags( const char *pchGameTags ) = 0; + virtual void SetGameTags( const char *pchGameTags ) = 0; /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set /// it allows users to filter in the matchmaking/server-browser interfaces based on the value @@ -129,7 +126,7 @@ public: /// acknowledged) /// /// @see k_cbMaxGameServerGameData - virtual void SetGameData( const char *pchGameData) = 0; + virtual void SetGameData( const char *pchGameData ) = 0; /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region virtual void SetRegion( const char *pszRegion ) = 0; @@ -192,15 +189,10 @@ public: // returns false if we're not connected to the steam servers and thus cannot ask virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0; -// -// Query steam for server data -// - // Ask for the gameplay stats for the server. Results returned in a callback + // these two functions s are deprecated, and will not return results + // they will be removed in a future version of the SDK virtual void GetGameplayStats( ) = 0; - - // Gets the reputation score for the game server. This API also checks if the server or some - // other server on the same IP is banned from the Steam master servers. virtual SteamAPICall_t GetServerReputation( ) = 0; // Returns the public IP of the server according to Steam, useful when the server is @@ -255,7 +247,7 @@ public: }; -#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer011" +#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012" // game server flags const uint32 k_unServerFlagNone = 0x00; @@ -284,7 +276,8 @@ const uint32 k_unServerFlagPrivate = 0x20; // server shouldn't list on master struct GSClientApprove_t { enum { k_iCallback = k_iSteamGameServerCallbacks + 1 }; - CSteamID m_SteamID; + CSteamID m_SteamID; // SteamID of approved player + CSteamID m_OwnerSteamID; // SteamID of original owner for game license }; diff --git a/mp/src/public/steam/isteammatchmaking.h b/mp/src/public/steam/isteammatchmaking.h index 3d664f52..ca381b81 100644 --- a/mp/src/public/steam/isteammatchmaking.h +++ b/mp/src/public/steam/isteammatchmaking.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to steam managing game server/client match making // @@ -74,7 +74,7 @@ public: virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0; // removes the game server from the local storage; returns true if one was removed - virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; + virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; /////// // Game lobby functions @@ -563,6 +563,7 @@ struct FavoritesListChanged_t uint32 m_nAppID; uint32 m_nFlags; bool m_bAdd; // true if this is adding the entry, otherwise it is a remove + AccountID_t m_unAccountId; }; @@ -725,6 +726,21 @@ struct PSNGameBootInviteResult_t bool m_bGameBootInviteExists; CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true }; + + +//----------------------------------------------------------------------------- +// Purpose: Result of our request to create a Lobby +// m_eResult == k_EResultOK on success +// at this point, the lobby has been joined and is ready for use +// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) +//----------------------------------------------------------------------------- +struct FavoritesListAccountsUpdated_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 16 }; + + EResult m_eResult; +}; + #pragma pack( pop ) diff --git a/mp/src/public/steam/isteammusic.h b/mp/src/public/steam/isteammusic.h new file mode 100644 index 00000000..23f0b85c --- /dev/null +++ b/mp/src/public/steam/isteammusic.h @@ -0,0 +1,67 @@ +//============ Copyright (c) Valve Corporation, All rights reserved. ============ + +#ifndef ISTEAMMUSIC_H +#define ISTEAMMUSIC_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam/isteamclient.h" + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +enum AudioPlayback_Status +{ + AudioPlayback_Undefined = 0, + AudioPlayback_Playing = 1, + AudioPlayback_Paused = 2, + AudioPlayback_Idle = 3 +}; + + +//----------------------------------------------------------------------------- +// Purpose: Functions to control music playback in the steam client +//----------------------------------------------------------------------------- +class ISteamMusic +{ +public: + virtual bool BIsEnabled() = 0; + virtual bool BIsPlaying() = 0; + + virtual AudioPlayback_Status GetPlaybackStatus() = 0; + + virtual void Play() = 0; + virtual void Pause() = 0; + virtual void PlayPrevious() = 0; + virtual void PlayNext() = 0; + + // volume is between 0.0 and 1.0 + virtual void SetVolume( float flVolume ) = 0; + virtual float GetVolume() = 0; + +}; + +#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 ) + CALLBACK_MEMBER( 0, float, m_flNewVolume ) +END_DEFINE_CALLBACK_1() + +#pragma pack( pop ) + + +#endif // #define ISTEAMMUSIC_H diff --git a/mp/src/public/steam/isteamremotestorage.h b/mp/src/public/steam/isteamremotestorage.h index 68f0f7e0..ed5aa526 100644 --- a/mp/src/public/steam/isteamremotestorage.h +++ b/mp/src/public/steam/isteamremotestorage.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: public interface to user remote file storage in Steam // @@ -41,6 +41,7 @@ struct SteamParamStringArray_t typedef uint64 UGCHandle_t; typedef uint64 PublishedFileUpdateHandle_t; typedef uint64 PublishedFileId_t; +const PublishedFileId_t k_PublishedFileIdInvalid = 0; const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull; const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull; @@ -87,21 +88,23 @@ enum EWorkshopFileType { k_EWorkshopFileTypeFirst = 0, - k_EWorkshopFileTypeCommunity = 0, - k_EWorkshopFileTypeMicrotransaction = 1, - k_EWorkshopFileTypeCollection = 2, - k_EWorkshopFileTypeArt = 3, - k_EWorkshopFileTypeVideo = 4, - k_EWorkshopFileTypeScreenshot = 5, - k_EWorkshopFileTypeGame = 6, - k_EWorkshopFileTypeSoftware = 7, - k_EWorkshopFileTypeConcept = 8, - k_EWorkshopFileTypeWebGuide = 9, - k_EWorkshopFileTypeIntegratedGuide = 10, - k_EWorkshopFileTypeMerch = 11, + k_EWorkshopFileTypeCommunity = 0, + k_EWorkshopFileTypeMicrotransaction = 1, + k_EWorkshopFileTypeCollection = 2, + k_EWorkshopFileTypeArt = 3, + k_EWorkshopFileTypeVideo = 4, + k_EWorkshopFileTypeScreenshot = 5, + k_EWorkshopFileTypeGame = 6, + k_EWorkshopFileTypeSoftware = 7, + k_EWorkshopFileTypeConcept = 8, + k_EWorkshopFileTypeWebGuide = 9, + k_EWorkshopFileTypeIntegratedGuide = 10, + k_EWorkshopFileTypeMerch = 11, + k_EWorkshopFileTypeControllerBinding = 12, + k_EWorkshopFileTypeSteamworksAccessInvite = 13, // Update k_EWorkshopFileTypeMax if you add values - k_EWorkshopFileTypeMax = 12 + k_EWorkshopFileTypeMax = 14 }; @@ -135,6 +138,28 @@ enum EWorkshopVideoProvider k_EWorkshopVideoProviderYoutube = 1 }; +enum +{ + k_WorkshopForceLoadPublishedFileDetailsFromCache = -1 +}; + +enum EUGCReadAction +{ + // Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks. + // If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading. + // This value maintains the same behavior as before the EUGCReadAction parameter was introduced. + k_EUGCRead_ContinueReadingUntilFinished = 0, + + // Keeps the file handle open. Use this when using UGCRead to seek to different parts of the file. + // When you are done seeking around the file, make a final call with k_EUGCRead_Close to close it. + k_EUGCRead_ContinueReading = 1, + + // Frees the file handle. Use this when you're done reading the content. + // To read the file from Steam again you will need to call UGCDownload again. + k_EUGCRead_Close = 2, +}; + + //----------------------------------------------------------------------------- // Purpose: Functions for accessing, reading and writing files stored remotely // and cached locally @@ -200,7 +225,7 @@ class ISteamRemoteStorage // enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail // unless UGCDownload is called again. // For especially large files (anything over 100MB) it is a requirement that the file is read in chunks. - virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset ) = 0; + virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0; // Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead() virtual int32 GetCachedUGCCount() = 0; @@ -235,8 +260,8 @@ class ISteamRemoteStorage virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0; virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0; // Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0, - // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh, - // a value of -1 will use cached data if it exists, no matter how old it is. + // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh. + // A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is. virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0; virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; // enumerate the files that the current user published with this app @@ -258,7 +283,7 @@ class ISteamRemoteStorage virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; }; -#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION011" +#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION012" // callbacks @@ -342,6 +367,7 @@ struct RemoteStorageFileShareResult_t enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 }; EResult m_eResult; // The result of the operation UGCHandle_t m_hFile; // The handle that can be shared with users and features + char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared }; @@ -480,6 +506,7 @@ struct RemoteStorageGetPublishedFileDetailsResult_t int32 m_nPreviewFileSize; // Size of the preview file char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) EWorkshopFileType m_eFileType; // Type of the file + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop }; @@ -491,6 +518,8 @@ struct RemoteStorageEnumerateWorkshopFilesResult_t int32 m_nTotalResultCount; PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ]; + AppId_t m_nAppId; + uint32 m_unStartIndex; }; @@ -603,6 +632,18 @@ struct RemoteStoragePublishFileProgress_t }; +//----------------------------------------------------------------------------- +// Purpose: Called when the content for a published file is updated +//----------------------------------------------------------------------------- +struct RemoteStoragePublishedFileUpdated_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 30 }; + PublishedFileId_t m_nPublishedFileId; // The published file id + AppId_t m_nAppID; // ID of the app that will consume this file. + UGCHandle_t m_hFile; // The new content +}; + + #pragma pack( pop ) diff --git a/mp/src/public/steam/isteamugc.h b/mp/src/public/steam/isteamugc.h new file mode 100644 index 00000000..ceee8f75 --- /dev/null +++ b/mp/src/public/steam/isteamugc.h @@ -0,0 +1,205 @@ +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to steam ugc +// +//============================================================================= + +#ifndef ISTEAMUGC_H +#define ISTEAMUGC_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +typedef uint64 UGCQueryHandle_t; +typedef uint64 UGCUpdateHandle_t; + + +const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull; +const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull; + + +// Matching UGC types for queries +enum EUGCMatchingUGCType +{ + k_EUGCMatchingUGCType_Items = 0, // both mtx items and ready-to-use items + k_EUGCMatchingUGCType_Items_Mtx = 1, + k_EUGCMatchingUGCType_Items_ReadyToUse = 2, + k_EUGCMatchingUGCType_Collections = 3, + k_EUGCMatchingUGCType_Artwork = 4, + k_EUGCMatchingUGCType_Videos = 5, + k_EUGCMatchingUGCType_Screenshots = 6, + k_EUGCMatchingUGCType_AllGuides = 7, // both web guides and integrated guides + k_EUGCMatchingUGCType_WebGuides = 8, + k_EUGCMatchingUGCType_IntegratedGuides = 9, + k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides + k_EUGCMatchingUGCType_ControllerBindings = 11, +}; + +// Different lists of published UGC for a user. +// If the current logged in user is different than the specified user, then some options may not be allowed. +enum EUserUGCList +{ + k_EUserUGCList_Published, + k_EUserUGCList_VotedOn, + k_EUserUGCList_VotedUp, + k_EUserUGCList_VotedDown, + k_EUserUGCList_WillVoteLater, + k_EUserUGCList_Favorited, + k_EUserUGCList_Subscribed, + k_EUserUGCList_UsedOrPlayed, + k_EUserUGCList_Followed, +}; + +// Sort order for user published UGC lists (defaults to creation order descending) +enum EUserUGCListSortOrder +{ + k_EUserUGCListSortOrder_CreationOrderDesc, + k_EUserUGCListSortOrder_CreationOrderAsc, + k_EUserUGCListSortOrder_TitleAsc, + k_EUserUGCListSortOrder_LastUpdatedDesc, + k_EUserUGCListSortOrder_SubscriptionDateDesc, + k_EUserUGCListSortOrder_VoteScoreDesc, + k_EUserUGCListSortOrder_ForModeration, +}; + +// Combination of sorting and filtering for queries across all UGC +enum EUGCQuery +{ + k_EUGCQuery_RankedByVote = 0, + k_EUGCQuery_RankedByPublicationDate = 1, + k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2, + k_EUGCQuery_RankedByTrend = 3, + k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate = 4, + k_EUGCQuery_CreatedByFriendsRankedByPublicationDate = 5, + k_EUGCQuery_RankedByNumTimesReported = 6, + k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate = 7, + k_EUGCQuery_NotYetRated = 8, + k_EUGCQuery_RankedByTotalVotesAsc = 9, + k_EUGCQuery_RankedByVotesUp = 10, + k_EUGCQuery_RankedByTextSearch = 11, +}; + + +const uint32 kNumUGCResultsPerPage = 50; + +// Details for a single published file/UGC +struct SteamUGCDetails_t +{ + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; // The result of the operation. + EWorkshopFileType m_eFileType; // Type of the file + AppId_t m_nCreatorAppID; // ID of the app that created this file. + AppId_t m_nConsumerAppID; // ID of the app that will consume this file. + char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document + char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document + uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. + uint32 m_rtimeCreated; // time when the published file was created + uint32 m_rtimeUpdated; // time when the published file was last updated + uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable) + ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility + bool m_bBanned; // whether the file was banned + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop + bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer + char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file + // file/url information + UGCHandle_t m_hFile; // The handle of the primary file + UGCHandle_t m_hPreviewFile; // The handle of the preview file + char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file + int32 m_nFileSize; // Size of the primary file + int32 m_nPreviewFileSize; // Size of the preview file + char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) + // voting information + uint32 m_unVotesUp; // number of votes up + uint32 m_unVotesDown; // number of votes down + float m_flScore; // calculated score +}; + +//----------------------------------------------------------------------------- +// Purpose: Steam UGC support API +//----------------------------------------------------------------------------- +class ISteamUGC +{ +public: + + // Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1. + virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0; + + // Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1. + virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0; + + // Send the query to Steam + virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; + + // Retrieve an individual result after receiving the callback for querying UGC + virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + + // Release the request to free up memory, after retrieving results + virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; + + // Options to set for querying UGC + virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; + virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; + virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0; + virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0; + virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0; + + // Options only for querying user UGC + virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0; + + // Options only for querying all UGC + virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0; + virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0; + virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; + + // Request full details for one piece of UGC + virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + +}; + +#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION002" + +//----------------------------------------------------------------------------- +// Purpose: Callback for querying UGC +//----------------------------------------------------------------------------- +struct SteamUGCQueryCompleted_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 1 }; + UGCQueryHandle_t m_handle; + EResult m_eResult; + uint32 m_unNumResultsReturned; + uint32 m_unTotalMatchingResults; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback for requesting details on one piece of UGC +//----------------------------------------------------------------------------- +struct SteamUGCRequestUGCDetailsResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 2 }; + SteamUGCDetails_t m_details; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + +//----------------------------------------------------------------------------- +// Purpose: k_iClientUGCCallbacks + 3 to k_iClientUGCCallbacks + 6 in use +//----------------------------------------------------------------------------- + + +#pragma pack( pop ) + +#endif // ISTEAMUGC_H diff --git a/mp/src/public/steam/isteamuser.h b/mp/src/public/steam/isteamuser.h index 5470acb7..a670849e 100644 --- a/mp/src/public/steam/isteamuser.h +++ b/mp/src/public/steam/isteamuser.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to user account information in Steam // @@ -97,7 +97,7 @@ public: // levels of speech are detected. // nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case) // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate - virtual EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate) = 0; + virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate ) = 0; // Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to // DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format. @@ -158,6 +158,14 @@ public: // retrieve a finished ticket virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + // Trading Card badges data access + // if you only have one set of cards, the series will be 1 + // the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1) + virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0; + + // gets the Steam Level of the user, as shown on their profile + virtual int GetPlayerSteamLevel() = 0; + #ifdef _PS3 // Initiates PS3 Logon request using just PSN ticket. // @@ -197,7 +205,7 @@ public: }; -#define STEAMUSER_INTERFACE_VERSION "SteamUser016" +#define STEAMUSER_INTERFACE_VERSION "SteamUser017" // callbacks @@ -287,6 +295,7 @@ struct ValidateAuthTicketResponse_t enum { k_iCallback = k_iSteamUserCallbacks + 43 }; CSteamID m_SteamID; EAuthSessionResponse m_eAuthSessionResponse; + CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed }; diff --git a/mp/src/public/steam/isteamutils.h b/mp/src/public/steam/isteamutils.h index b40677c5..7f8d6bf0 100644 --- a/mp/src/public/steam/isteamutils.h +++ b/mp/src/public/steam/isteamutils.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to utility functions in Steam // @@ -149,17 +149,20 @@ public: #endif // Activates the Big Picture text input dialog which only supports gamepad input - virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax ) = 0; + virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0; // Returns previously entered text & length virtual uint32 GetEnteredGamepadTextLength() = 0; - virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0; + virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0; // returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases virtual const char *GetSteamUILanguage() = 0; + + // returns true if Steam itself is running in VR mode + virtual bool IsSteamRunningInVR() = 0; }; -#define STEAMUTILS_INTERFACE_VERSION "SteamUtils006" +#define STEAMUTILS_INTERFACE_VERSION "SteamUtils007" // callbacks diff --git a/mp/src/public/steam/matchmakingtypes.h b/mp/src/public/steam/matchmakingtypes.h index fae9fe7a..df6a2d4f 100644 --- a/mp/src/public/steam/matchmakingtypes.h +++ b/mp/src/public/steam/matchmakingtypes.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -32,6 +32,11 @@ const int k_cbMaxGameServerName = 64; const int k_cbMaxGameServerTags = 128; const int k_cbMaxGameServerGameData = 2048; +/// Store key/value pair used in matchmaking queries. +/// +/// Actually, the name Key/Value is a bit misleading. The "key" is better +/// understood as "filter operation code" and the "value" is the operand to this +/// filter operation. The meaning of the operand depends upon the filter. struct MatchMakingKeyValuePair_t { MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; } diff --git a/mp/src/public/steam/steam_api.h b/mp/src/public/steam/steam_api.h index 4f4f5a52..d1ebd2c2 100644 --- a/mp/src/public/steam/steam_api.h +++ b/mp/src/public/steam/steam_api.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: // @@ -20,9 +20,12 @@ #include "isteamnetworking.h" #include "isteamremotestorage.h" #include "isteamscreenshots.h" +#include "isteammusic.h" #include "isteamhttp.h" #include "isteamunifiedmessages.h" #include "isteamcontroller.h" +#include "isteamugc.h" +#include "isteamapplist.h" #if defined( _PS3 ) #include "steamps3params.h" @@ -59,10 +62,10 @@ //----------------------------------------------------------------------------------------------------------------------------------------------------------// // S_API void SteamAPI_Init(); (see below) -S_API void SteamAPI_Shutdown(); +S_API void S_CALLTYPE SteamAPI_Shutdown(); // checks if a local Steam client is running -S_API bool SteamAPI_IsSteamRunning(); +S_API bool S_CALLTYPE SteamAPI_IsSteamRunning(); // Detects if your executable was launched through the Steam client, and restarts your game through // the client if necessary. The Steam client will be started if it is not running. @@ -75,14 +78,14 @@ S_API bool SteamAPI_IsSteamRunning(); // // NOTE: This function should be used only if you are using CEG or not using Steam's DRM. Once applied // to your executable, Steam's DRM will handle restarting through Steam if necessary. -S_API bool SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ); +S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ); // crash dump recording functions -S_API void SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); -S_API void SteamAPI_SetMiniDumpComment( const char *pchMsg ); +S_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); +S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg ); // interface pointers, configured by SteamAPI_Init() -S_API ISteamClient *SteamClient(); +S_API ISteamClient *S_CALLTYPE SteamClient(); // @@ -96,29 +99,33 @@ S_API ISteamClient *SteamClient(); // functions below to get at the Steam interfaces. // #ifdef VERSION_SAFE_STEAM_API_INTERFACES -S_API bool SteamAPI_InitSafe(); +S_API bool S_CALLTYPE SteamAPI_InitSafe(); #else #if defined(_PS3) -S_API bool SteamAPI_Init( SteamPS3Params_t *pParams ); +S_API bool S_CALLTYPE SteamAPI_Init( SteamPS3Params_t *pParams ); #else -S_API bool SteamAPI_Init(); +S_API bool S_CALLTYPE SteamAPI_Init(); #endif -S_API ISteamUser *SteamUser(); -S_API ISteamFriends *SteamFriends(); -S_API ISteamUtils *SteamUtils(); -S_API ISteamMatchmaking *SteamMatchmaking(); -S_API ISteamUserStats *SteamUserStats(); -S_API ISteamApps *SteamApps(); -S_API ISteamNetworking *SteamNetworking(); -S_API ISteamMatchmakingServers *SteamMatchmakingServers(); -S_API ISteamRemoteStorage *SteamRemoteStorage(); -S_API ISteamScreenshots *SteamScreenshots(); -S_API ISteamHTTP *SteamHTTP(); -S_API ISteamUnifiedMessages *SteamUnifiedMessages(); +S_API ISteamUser *S_CALLTYPE SteamUser(); +S_API ISteamFriends *S_CALLTYPE SteamFriends(); +S_API ISteamUtils *S_CALLTYPE SteamUtils(); +S_API ISteamMatchmaking *S_CALLTYPE SteamMatchmaking(); +S_API ISteamUserStats *S_CALLTYPE SteamUserStats(); +S_API ISteamApps *S_CALLTYPE SteamApps(); +S_API ISteamNetworking *S_CALLTYPE SteamNetworking(); +S_API ISteamMatchmakingServers *S_CALLTYPE SteamMatchmakingServers(); +S_API ISteamRemoteStorage *S_CALLTYPE SteamRemoteStorage(); +S_API ISteamScreenshots *S_CALLTYPE SteamScreenshots(); +S_API ISteamHTTP *S_CALLTYPE SteamHTTP(); +S_API ISteamUnifiedMessages *S_CALLTYPE SteamUnifiedMessages(); +S_API ISteamController *S_CALLTYPE SteamController(); +S_API ISteamUGC *S_CALLTYPE SteamUGC(); +S_API ISteamAppList *S_CALLTYPE SteamAppList(); +S_API ISteamMusic *S_CALLTYPE SteamMusic(); #ifdef _PS3 -S_API ISteamPS3OverlayRender * SteamPS3OverlayRender(); +S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender(); #endif #endif // VERSION_SAFE_STEAM_API_INTERFACES @@ -132,16 +139,16 @@ S_API ISteamPS3OverlayRender * SteamPS3OverlayRender(); // to as many functions/objects as are registered to it //----------------------------------------------------------------------------------------------------------------------------------------------------------// -S_API void SteamAPI_RunCallbacks(); +S_API void S_CALLTYPE SteamAPI_RunCallbacks(); // functions used by the utility CCallback objects to receive callbacks -S_API void SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); -S_API void SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); +S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); +S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); // functions used by the utility CCallResult objects to receive async call results -S_API void SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); -S_API void SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); +S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); +S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); //----------------------------------------------------------------------------- @@ -397,6 +404,10 @@ public: ISteamScreenshots* SteamScreenshots() { return m_pSteamScreenshots; } ISteamHTTP* SteamHTTP() { return m_pSteamHTTP; } ISteamUnifiedMessages* SteamUnifiedMessages() { return m_pSteamUnifiedMessages; } + ISteamController* SteamController() { return m_pController; } + ISteamUGC* SteamUGC() { return m_pSteamUGC; } + ISteamAppList* SteamAppList() { return m_pSteamAppList; } + ISteamMusic* SteamMusic() { return m_pSteamMusic; } #ifdef _PS3 ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; } #endif @@ -415,6 +426,9 @@ private: ISteamHTTP *m_pSteamHTTP; ISteamUnifiedMessages*m_pSteamUnifiedMessages; ISteamController *m_pController; + ISteamUGC *m_pSteamUGC; + ISteamAppList *m_pSteamAppList; + ISteamMusic *m_pSteamMusic; #ifdef _PS3 ISteamPS3OverlayRender *m_pSteamPS3OverlayRender; #endif @@ -438,7 +452,11 @@ inline void CSteamAPIContext::Clear() m_pSteamRemoteStorage = NULL; m_pSteamHTTP = NULL; m_pSteamScreenshots = NULL; + m_pSteamMusic = NULL; m_pSteamUnifiedMessages = NULL; + m_pController = NULL; + m_pSteamUGC = NULL; + m_pSteamAppList = NULL; #ifdef _PS3 m_pSteamPS3OverlayRender = NULL; #endif @@ -501,6 +519,24 @@ inline bool CSteamAPIContext::Init() if ( !m_pSteamUnifiedMessages ) return false; + m_pController = SteamClient()->GetISteamController( hSteamUser, hSteamPipe, STEAMCONTROLLER_INTERFACE_VERSION ); + if ( !m_pController ) + return false; + + m_pSteamUGC = SteamClient()->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION ); + if ( !m_pSteamUGC ) + return false; + + m_pSteamAppList = SteamClient()->GetISteamAppList( hSteamUser, hSteamPipe, STEAMAPPLIST_INTERFACE_VERSION ); + if ( !m_pSteamAppList ) + return false; + + m_pSteamMusic = SteamClient()->GetISteamMusic( hSteamUser, hSteamPipe, STEAMMUSIC_INTERFACE_VERSION ); + if ( !m_pSteamMusic ) + { + return false; + } + #ifdef _PS3 m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender(); #endif @@ -512,13 +548,13 @@ inline bool CSteamAPIContext::Init() #if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS) // this should be called before the game initialized the steam APIs -// pchDate should be of the format "Mmm dd yyyy" (such as from the __DATE __ macro ) -// pchTime should be of the format "hh:mm:ss" (such as from the __TIME __ macro ) +// pchDate should be of the format "Mmm dd yyyy" (such as from the __DATE__ macro ) +// pchTime should be of the format "hh:mm:ss" (such as from the __TIME__ macro ) // bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder // pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback // PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream. -S_API void SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ); -S_API void SteamAPI_SetBreakpadAppID( uint32 unAppID ); +S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ); +S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID ); #endif #endif // STEAM_API_H diff --git a/mp/src/public/steam/steamclientpublic.h b/mp/src/public/steam/steamclientpublic.h index b1292673..62eddb76 100644 --- a/mp/src/public/steam/steamclientpublic.h +++ b/mp/src/public/steam/steamclientpublic.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -20,7 +20,7 @@ // interface layer, no need to include anything about the implementation. #include "steamtypes.h" - +#include "steamuniverse.h" // General result codes enum EResult @@ -102,7 +102,13 @@ enum EResult k_EResultNoMatchingURL = 75, k_EResultBadResponse = 76, // parse failure, missing field, etc. k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password - k_EResultValueOutOfRange = 78 // the value entered is outside the acceptable range + k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range + k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen + k_EResultDisabled = 80, // The requested service has been configured to be unavailable + k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid ! + k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action + k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted + k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent }; // Error codes for use with the voice functions @@ -178,18 +184,6 @@ typedef enum } EUserHasLicenseForAppResult; -// Steam universes. Each universe is a self-contained Steam instance. -enum EUniverse -{ - k_EUniverseInvalid = 0, - k_EUniversePublic = 1, - k_EUniverseBeta = 2, - k_EUniverseInternal = 3, - k_EUniverseDev = 4, - // k_EUniverseRC = 5, // no such universe anymore - k_EUniverseMax -}; - // Steam account types enum EAccountType { @@ -227,15 +221,21 @@ enum EAppReleaseState //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -enum EAppOwernshipFlags +enum EAppOwnershipFlags { - k_EAppOwernshipFlags_None = 0, // unknown - k_EAppOwernshipFlags_OwnsLicense = 1, // owns license for this game - k_EAppOwernshipFlags_FreeLicense = 2, // not paid for game - k_EAppOwernshipFlags_RegionRestricted = 4, // owns app, but not allowed to play in current region - k_EAppOwernshipFlags_LowViolence = 8, // only low violence version - k_EAppOwernshipFlags_InvalidPlatform = 16, // app not supported on current platform - k_EAppOwernshipFlags_DeviceLicense = 32, // license was granted by authorized local device + k_EAppOwnershipFlags_None = 0x000, // unknown + k_EAppOwnershipFlags_OwnsLicense = 0x001, // owns license for this game + k_EAppOwnershipFlags_FreeLicense = 0x002, // not paid for game + k_EAppOwnershipFlags_RegionRestricted = 0x004, // owns app, but not allowed to play in current region + k_EAppOwnershipFlags_LowViolence = 0x008, // only low violence version + k_EAppOwnershipFlags_InvalidPlatform = 0x010, // app not supported on current platform + k_EAppOwnershipFlags_SharedLicense = 0x020, // license was granted by authorized local device + k_EAppOwnershipFlags_FreeWeekend = 0x040, // owned by a free weekend licenses + k_EAppOwnershipFlags_LicenseLocked = 0x080, // shared license is locked (in use) by other user + k_EAppOwnershipFlags_LicensePending = 0x100, // owns app, but transaction is still pending. Can't install or play + k_EAppOwnershipFlags_LicenseExpired = 0x200, // doesn't own app anymore since license expired + k_EAppOwnershipFlags_LicensePermanent = 0x400, // permanent license, not borrowed, or guest or freeweekend etc + k_EAppOwnershipFlags_LicenseRecurring = 0x800, // Recurring license, user is charged periodically }; @@ -253,7 +253,8 @@ enum EAppType k_EAppType_DLC = 0x020, // down loadable content k_EAppType_Guide = 0x040, // game guide, PDF etc k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc) - + k_EAppType_Config = 0x100, // hidden app used to config Steam features (backpack, sales, etc) + k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace }; @@ -449,6 +450,12 @@ public: { SetFromUint64( ulSteamID ); } +#ifdef INT64_DIFFERENT_FROM_INT64_T + CSteamID( uint64_t ulSteamID ) + { + SetFromUint64( (uint64)ulSteamID ); + } +#endif //----------------------------------------------------------------------------- @@ -463,7 +470,7 @@ public: m_steamid.m_comp.m_EUniverse = eUniverse; m_steamid.m_comp.m_EAccountType = eAccountType; - if ( eAccountType == k_EAccountTypeClan ) + if ( eAccountType == k_EAccountTypeClan || eAccountType == k_EAccountTypeGameServer ) { m_steamid.m_comp.m_unAccountInstance = 0; } @@ -720,6 +727,9 @@ public: const char * Render() const; // renders this steam ID to string static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string + const char * RenderLink() const; // renders this steam ID to an admin console link string + static const char * RenderLink( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string + void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse ); // SetFromString allows many partially-correct strings, constraining how // we might be able to change things in the future. @@ -845,6 +855,12 @@ public: { m_ulGameID = ulGameID; } +#ifdef INT64_DIFFERENT_FROM_INT64_T + CGameID( uint64_t ulGameID ) + { + m_ulGameID = (uint64)ulGameID; + } +#endif explicit CGameID( int32 nAppID ) { diff --git a/mp/src/public/steam/steamcontrollerpublic.h b/mp/src/public/steam/steamcontrollerpublic.h new file mode 100644 index 00000000..04493332 --- /dev/null +++ b/mp/src/public/steam/steamcontrollerpublic.h @@ -0,0 +1,76 @@ +//========= Copyright © 1996-2013, Valve LLC, All rights reserved. ============ +// +// Purpose: Controller related public types/constants +// +//============================================================================= + +#ifndef STEAMCONTROLLERPUBLIC_H +#define STEAMCONTROLLERPUBLIC_H +#ifdef _WIN32 +#pragma once +#endif + + +#if defined( STEAM ) || defined( ISTEAMCONTROLLER_H ) +// This file should only be included by the Steam build or directly from +// isteamcontroller.h. +#include "steamtypes.h" +#else +// Otherwise, we assume it's a firmware build, which doesn't deal with all the +// things that exist in steamtypes.h, and hardcode the typedefs we need. +typedef unsigned int uint32; +typedef unsigned __int64 uint64; +#endif + +#pragma pack(1) + +// Safe to add new bitfields at the end of this list for new buttons/actions, +// but never re-use or re-number an existing flag as old client code will be +// confused. +#define STEAM_RIGHT_TRIGGER_MASK 0x0000000000000001l +#define STEAM_LEFT_TRIGGER_MASK 0x0000000000000002l +#define STEAM_RIGHT_BUMPER_MASK 0x0000000000000004l +#define STEAM_LEFT_BUMPER_MASK 0x0000000000000008l +#define STEAM_BUTTON_0_MASK 0x0000000000000010l +#define STEAM_BUTTON_1_MASK 0x0000000000000020l +#define STEAM_BUTTON_2_MASK 0x0000000000000040l +#define STEAM_BUTTON_3_MASK 0x0000000000000080l +#define STEAM_TOUCH_0_MASK 0x0000000000000100l +#define STEAM_TOUCH_1_MASK 0x0000000000000200l +#define STEAM_TOUCH_2_MASK 0x0000000000000400l +#define STEAM_TOUCH_3_MASK 0x0000000000000800l +#define STEAM_BUTTON_MENU_MASK 0x0000000000001000l +#define STEAM_BUTTON_STEAM_MASK 0x0000000000002000l +#define STEAM_BUTTON_ESCAPE_MASK 0x0000000000004000l +#define STEAM_BUTTON_BACK_LEFT_MASK 0x0000000000008000l +#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0000000000010000l +#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0000000000020000l +#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0000000000040000l +#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0000000000080000l +#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0000000000100000l + +// Only add fields to the end of this struct, or if you need to change it in a larger +// way add a new message id and new struct completely so as to not break old clients. +typedef struct +{ + // If packet num matches that on your prior call, then the controller state hasn't been changed since + // your last call and there is no need to process it + uint32 unPacketNum; + + // bit flags for each of the buttons + uint64 ulButtons; + + // Left pad coordinates + short sLeftPadX; + short sLeftPadY; + + // Right pad coordinates + short sRightPadX; + short sRightPadY; + +} SteamControllerState_t; + +#pragma pack() + +#endif // STEAMCONTROLLERPUBLIC_H + diff --git a/mp/src/public/steam/steamhttpenums.h b/mp/src/public/steam/steamhttpenums.h index c75b59cd..9ac2eeaf 100644 --- a/mp/src/public/steam/steamhttpenums.h +++ b/mp/src/public/steam/steamhttpenums.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. ======= // // Purpose: HTTP related enums, stuff that is shared by both clients and servers, and our // UI projects goes here. @@ -20,13 +20,13 @@ enum EHTTPMethod k_EHTTPMethodGET, k_EHTTPMethodHEAD, k_EHTTPMethodPOST, + k_EHTTPMethodPUT, + k_EHTTPMethodDELETE, + k_EHTTPMethodOPTIONS, // The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for // a compliant general purpose server. We'll likely add more as we find uses for them. - // k_EHTTPMethodOPTIONS, - k_EHTTPMethodPUT, - k_EHTTPMethodDELETE, // k_EHTTPMethodTRACE, // k_EHTTPMethodCONNECT }; diff --git a/mp/src/public/steam/steamtypes.h b/mp/src/public/steam/steamtypes.h index 5525c925..b26990da 100644 --- a/mp/src/public/steam/steamtypes.h +++ b/mp/src/public/steam/steamtypes.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -10,6 +10,8 @@ #pragma once #endif +#define S_CALLTYPE __cdecl + // Steam-specific types. Defined here so this header file can be included in other code bases. #ifndef WCHARTYPES_H typedef unsigned char uint8; @@ -43,6 +45,9 @@ typedef unsigned __int32 uint32; typedef __int64 int64; typedef unsigned __int64 uint64; +typedef int64 lint64; +typedef uint64 ulint64; + #ifdef X64BITS typedef __int64 intp; // intp is an integer that can accomodate a pointer typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) @@ -59,6 +64,16 @@ typedef int int32; typedef unsigned int uint32; typedef long long int64; typedef unsigned long long uint64; + +// [u]int64 are actually defined as 'long long' and gcc 64-bit +// doesn't automatically consider them the same as 'long int'. +// Changing the types for [u]int64 is complicated by +// there being many definitions, so we just +// define a 'long int' here and use it in places that would +// otherwise confuse the compiler. +typedef long int lint64; +typedef unsigned long int ulint64; + #ifdef X64BITS typedef long long intp; typedef unsigned long long uintp; diff --git a/mp/src/public/steam/steamuniverse.h b/mp/src/public/steam/steamuniverse.h new file mode 100644 index 00000000..dd384dcc --- /dev/null +++ b/mp/src/public/steam/steamuniverse.h @@ -0,0 +1,27 @@ +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMUNIVERSE_H +#define STEAMUNIVERSE_H +#ifdef _WIN32 +#pragma once +#endif + + +// Steam universes. Each universe is a self-contained Steam instance. +enum EUniverse +{ + k_EUniverseInvalid = 0, + k_EUniversePublic = 1, + k_EUniverseBeta = 2, + k_EUniverseInternal = 3, + k_EUniverseDev = 4, + // k_EUniverseRC = 5, // no such universe anymore + k_EUniverseMax +}; + + +#endif // STEAMUNIVERSE_H diff --git a/mp/src/public/steam/steamvr.h b/mp/src/public/steam/steamvr.h new file mode 100644 index 00000000..68a932dd --- /dev/null +++ b/mp/src/public/steam/steamvr.h @@ -0,0 +1,242 @@ +#pragma once + +#include + +namespace vr +{ + +#if defined(__linux__) || defined(__APPLE__) + // The 32-bit version of gcc has the alignment requirement for uint64 and double set to + // 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. + // The 64-bit version of gcc has the alignment requirement for these types set to + // 8 meaning that unless we use #pragma pack(4) our structures will get bigger. + // The 64-bit structure packing has to match the 32-bit structure packing for each platform. +#pragma pack( push, 4 ) +#else +#pragma pack( push, 8 ) +#endif + + +// right-handed system +// +y is up +// +x is to the right +// -z is going away from you +// Distance unit is meters +struct HmdMatrix34_t +{ + float m[3][4]; +}; + +struct HmdMatrix44_t +{ + float m[4][4]; +}; + + +/** Used to return the post-distortion UVs for each color channel. +* UVs range from 0 to 1 with 0,0 in the upper left corner of the +* source render target. The 0,0 to 1,1 range covers a single eye. */ +struct DistortionCoordinates_t +{ + float rfRed[2]; + float rfGreen[2]; + float rfBlue[2]; +}; + + +enum Hmd_Eye +{ + Eye_Left = 0, + Eye_Right = 1 +}; + +enum GraphicsAPIConvention +{ + API_DirectX = 0, // Normalized Z goes from 0 at the viewer to 1 at the far clip plane + API_OpenGL = 1, // Normalized Z goes from 1 at the viewer to -1 at the far clip plane +}; + +enum HmdTrackingResult +{ + TrackingResult_Uninitialized = 1, + + TrackingResult_Calibrating_InProgress = 100, + TrackingResult_Calibrating_OutOfRange = 101, + + TrackingResult_Running_OK = 200, + TrackingResult_Running_OutOfRange = 201, +}; + +class IHmd +{ +public: + + + // ------------------------------------ + // Display Methods + // ------------------------------------ + + /** Size and position that the window needs to be on the VR display. */ + virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Suggested size for the intermediate render target that the distortion pulls from. */ + virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Gets the viewport in the frame buffer to draw the output of the distortion into */ + virtual void GetEyeOutputViewport( Hmd_Eye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** The projection matrix for the specified eye */ + virtual HmdMatrix44_t GetProjectionMatrix( Hmd_Eye eEye, float fNearZ, float fFarZ, GraphicsAPIConvention eProjType ) = 0; + + /** The components necessary to build your own projection matrix in case your + * application is doing something fancy like infinite Z */ + virtual void GetProjectionRaw( Hmd_Eye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0; + + /** Returns the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in + * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. */ + virtual DistortionCoordinates_t ComputeDistortion( Hmd_Eye eEye, float fU, float fV ) = 0; + + /** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head + * space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection. + * Normally View and Eye^-1 will be multiplied together and treated as View in your application. + */ + virtual HmdMatrix34_t GetHeadFromEyePose( Hmd_Eye eEye ) = 0; + + /** For use in simple VR apps, this method returns the concatenation of the + * tracking pose and the eye matrix to get a full view matrix for each eye. + * This is ( GetEyeMatrix() ) * (GetWorldFromHeadPose() ^ -1 ) */ + virtual bool GetViewMatrix( float fSecondsFromNow, HmdMatrix44_t *pMatLeftView, HmdMatrix44_t *pMatRightView, HmdTrackingResult *peResult ) = 0; + + /** [D3D9 Only] + * Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such + * a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error. + */ + virtual int32_t GetD3D9AdapterIndex() = 0; + + /** [D3D10/11 Only] + * Returns the adapter index and output index that the user should pass into EnumAdapters adn EnumOutputs + * to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1. + */ + virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0; + + // ------------------------------------ + // Tracking Methods + // ------------------------------------ + + /** The pose that the tracker thinks that the HMD will be in at the specified + * number of seconds into the future. Pass 0 to get the current state. + * + * This is roughly analogous to the inverse of the view matrix in most applications, though + * many games will need to do some additional rotation or translation on top of the rotation + * and translation provided by the head pose. + * + * If this function returns true the pose has been populated with a pose that can be used by the application. + * Check peResult for details about the pose, including messages that should be displayed to the user. + */ + virtual bool GetTrackerFromHeadPose( float fPredictedSecondsFromNow, HmdMatrix34_t *pmPose, HmdTrackingResult *peResult ) = 0; + + /** Passes back the pose matrix from the last successful call to GetWorldFromHeadPose(). Returns true if that matrix is + * valid (because there has been a previous successful pose.) */ + virtual bool GetLastTrackerFromHeadPose( HmdMatrix34_t *pmPose ) = 0; + + /** Returns true if the tracker for this HMD will drift the Yaw component of its pose over time regardless of + * actual head motion. This is true for gyro-based trackers with no ground truth. */ + virtual bool WillDriftInYaw() = 0; + + /** Sets the zero pose for the tracker coordinate system. After this call all WorldFromHead poses will be relative + * to the pose whenever this was called. The new zero coordinate system will not change the fact that the Y axis is + * up in the real world, so the next pose returned from GetWorldFromHeadPose after a call to ZeroTracker may not be + * exactly an identity matrix. */ + virtual void ZeroTracker() = 0; + + /** Returns the zero pose for the tracker coordinate system. If the tracker has never had a valid pose, this + * will be an identity matrix. */ + virtual HmdMatrix34_t GetTrackerZeroPose() = 0; + + // ------------------------------------ + // Administrative methods + // ------------------------------------ + + /** The ID of the driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If + * the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes + * will be enough to fit any ID. */ + virtual uint32_t GetDriverId( char *pchBuffer, uint32_t unBufferLen ) = 0; + + /** The ID of this display within its driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If + * the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes + * will be enough to fit any ID. */ + virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0; +}; + +static const char * const IHmd_Version = "IHmd_004"; + +/** error codes returned by Vr_Init */ +enum HmdError +{ + HmdError_None = 0, + + HmdError_Init_InstallationNotFound = 100, + HmdError_Init_InstallationCorrupt = 101, + HmdError_Init_VRClientDLLNotFound = 102, + HmdError_Init_FileNotFound = 103, + HmdError_Init_FactoryNotFound = 104, + HmdError_Init_InterfaceNotFound = 105, + HmdError_Init_InvalidInterface = 106, + HmdError_Init_UserConfigDirectoryInvalid = 107, + HmdError_Init_HmdNotFound = 108, + HmdError_Init_NotInitialized = 109, + + HmdError_Driver_Failed = 200, + + HmdError_IPC_ServerInitFailed = 300, + HmdError_IPC_ConnectFailed = 301, + HmdError_IPC_SharedStateInitFailed = 302, + +}; + + +// figure out how to import from the VR API dll +#if defined(_WIN32) + +#ifdef VR_API_EXPORT +#define VR_INTERFACE extern "C" __declspec( dllexport ) +#else +#define VR_INTERFACE extern "C" __declspec( dllimport ) +#endif + +#elif defined(GNUC) || defined(COMPILER_GCC) + +#ifdef VR_API_EXPORT +#define VR_INTERFACE extern "C" __attribute__((visibility("default"))) +#else +#define VR_INTERFACE extern "C" +#endif + +#else +#error "Unsupported Platform." +#endif + + + + +/** Finds the active installation of the VR API and initializes it. The priority for figuring +* out where to load vrclient from are: +* 1. The convar "VR_OVERRIDE", which should contain an absolute path to the root of +* an vr API directory. +* 2. The pchVROverride argument. This should be an absolute path or a path relative to +* the current executable. +* 3. The path "./vr" relative to the current executable's path. +* +* Each of these paths are to the "root" of the VR API install. That's the directory with +* the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself. +*/ +VR_INTERFACE IHmd *VR_Init( HmdError *peError ); + +/** unloads vrclient.dll. Any interface pointers from the interface are +* invalid after this point */ +VR_INTERFACE void VR_Shutdown( ); + +#pragma pack( pop ) + + +} \ No newline at end of file diff --git a/mp/src/public/tier0/annotations.h b/mp/src/public/tier0/annotations.h index f81cea32..25537821 100644 --- a/mp/src/public/tier0/annotations.h +++ b/mp/src/public/tier0/annotations.h @@ -13,44 +13,6 @@ // Include the annotation header file. #include -// /Analyze warnings can only be suppressed when using a compiler that supports them, which VS 2010 -// Professional does not. - -// We don't care about these warnings because they are bugs that can only occur during resource -// exhaustion or other unexpected API failure, which we are nowhere near being able to handle. -#pragma warning(disable : 6308) // warning C6308: 'realloc' might return null pointer: assigning null pointer to 's_ppTestCases', which is passed as an argument to 'realloc', will cause the original memory block to be leaked -#pragma warning(disable : 6255) // warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead -#pragma warning(disable : 6387) // warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'GetProcAddress' -#pragma warning(disable : 6309) // warning C6309: Argument '1' is null: this does not adhere to function specification of 'GetProcAddress' -#pragma warning(disable : 6011) // warning C6011: Dereferencing NULL pointer 'm_ppTestCases' -#pragma warning(disable : 6211) // warning C6211: Leaking memory 'newKeyValue' due to an exception. Consider using a local catch block to clean up memory -#pragma warning(disable : 6031) // warning C6031: Return value ignored: '_getcwd' - -// These warnings are because /analyze doesn't like our use of constants, especially things like IsPC() -#pragma warning(disable : 6326) // warning C6326: Potential comparison of a constant with another constant -#pragma warning(disable : 6239) // warning C6239: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? -#pragma warning(disable : 6285) // warning C6285: ( || ) is always a non-zero constant. Did you intend to use the bitwise-and operator? -#pragma warning(disable : 6237) // warning C6237: ( && ) is always zero. is never evaluated and might have side effects -#pragma warning(disable : 6235) // warning C6235: ( || ) is always a non-zero constant -#pragma warning(disable : 6240) // warning C6240: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? - -// These warnings aren't really important: -#pragma warning(disable : 6323) // warning C6323: Use of arithmetic operator on Boolean type(s) - -// Miscellaneous other /analyze warnings. We should consider fixing these at some point. -//#pragma warning(disable : 6204) // warning C6204: Possible buffer overrun in call to 'memcpy': use of unchecked parameter 'src' -//#pragma warning(disable : 6262) // warning C6262: Function uses '16464' bytes of stack: exceeds /analyze:stacksize'16384'. Consider moving some data to heap -// This is a serious warning. Don't suppress it. -//#pragma warning(disable : 6263) // warning C6263: Using _alloca in a loop: this can quickly overflow stack -// 6328 is also used for passing __int64 to printf when int is expected so we can't suppress it. -//#pragma warning(disable : 6328) // warning C6328: 'char' passed as parameter '1' when 'unsigned char' is required in call to 'V_isdigit' -// /analyze doesn't like GCOMPILER_ASSERT's implementation of compile-time asserts -#pragma warning(disable : 6326) // warning C6326: Potential comparison of a constant with another constant -#pragma warning(disable : 6335) // warning C6335: Leaking process information handle 'pi.hThread' -#pragma warning(disable : 6320) // warning C6320: Exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were not intended to be handled -#pragma warning(disable : 6250) // warning C6250: Calling 'VirtualFree' without the MEM_RELEASE flag might free memory but not address descriptors (VADs). This causes address space leaks -#pragma warning(disable : 6384) // ientity2_class_h_schema_gen.cpp(76): warning C6384: Dividing sizeof a pointer by another value - // For temporarily suppressing warnings -- the warnings are suppressed for the next source line. #define ANALYZE_SUPPRESS(wnum) __pragma(warning(suppress: wnum)) #define ANALYZE_SUPPRESS2(wnum1, wnum2) __pragma(warning(supress: wnum1 wnum2)) diff --git a/mp/src/public/tier0/dbg.h b/mp/src/public/tier0/dbg.h index 5fe45a1c..9fd38d0a 100644 --- a/mp/src/public/tier0/dbg.h +++ b/mp/src/public/tier0/dbg.h @@ -285,7 +285,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define AssertFatal( _exp ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), ((void)0), true ) #define AssertFatalOnce( _exp ) _AssertMsgOnce( _exp, _T("Assertion Failed: ") _T(#_exp), true ) -#define AssertFatalMsg( _exp, _msg ) _AssertMsg( _exp, _msg, ((void)0), true ) +#define AssertFatalMsg( _exp, _msg, ... ) _AssertMsg( _exp, (const tchar *)CDbgFmtMsg( _msg, ##__VA_ARGS__ ), ((void)0), true ) #define AssertFatalMsgOnce( _exp, _msg ) _AssertMsgOnce( _exp, _msg, true ) #define AssertFatalFunc( _exp, _f ) _AssertMsg( _exp, _T("Assertion Failed: " _T(#_exp), _f, true ) #define AssertFatalEquals( _exp, _expectedValue ) AssertFatalMsg2( (_exp) == (_expectedValue), _T("Expected %d but got %d!"), (_expectedValue), (_exp) ) @@ -293,16 +293,15 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define VerifyFatal( _exp ) AssertFatal( _exp ) #define VerifyEqualsFatal( _exp, _expectedValue ) AssertFatalEquals( _exp, _expectedValue ) -#define AssertFatalMsg1( _exp, _msg, a1 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1 ))) -#define AssertFatalMsg2( _exp, _msg, a1, a2 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2 ))) -#define AssertFatalMsg3( _exp, _msg, a1, a2, a3 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3 ))) -#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4 ))) -#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 ))) -#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 ))) -#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 ))) -#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 ))) -#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 ))) -#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ))) +#define AssertFatalMsg1( _exp, _msg, a1 ) AssertFatalMsg( _exp, _msg, a1 ) +#define AssertFatalMsg2( _exp, _msg, a1, a2 ) AssertFatalMsg( _exp, _msg, a1, a2 ) +#define AssertFatalMsg3( _exp, _msg, a1, a2, a3 ) AssertFatalMsg( _exp, _msg, a1, a2, a3 ) +#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4 ) +#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5 ) +#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6 ) +#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) +#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) #else // DBGFLAG_ASSERTFATAL @@ -322,7 +321,6 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) ((void)0) #define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) ((void)0) #define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0) -#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0) #define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) ((void)0) #define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) ((void)0) #define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) ((void)0) @@ -336,7 +334,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #ifdef DBGFLAG_ASSERT #define Assert( _exp ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), ((void)0), false ) -#define AssertMsg( _exp, _msg ) _AssertMsg( _exp, _msg, ((void)0), false ) +#define AssertMsg( _exp, _msg, ... ) _AssertMsg( _exp, (const tchar *)CDbgFmtMsg( _msg, ##__VA_ARGS__ ), ((void)0), false ) #define AssertOnce( _exp ) _AssertMsgOnce( _exp, _T("Assertion Failed: ") _T(#_exp), false ) #define AssertMsgOnce( _exp, _msg ) _AssertMsgOnce( _exp, _msg, false ) #define AssertFunc( _exp, _f ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), _f, false ) @@ -349,21 +347,21 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define VerifyEquals( _exp, _expectedValue ) AssertEquals( _exp, _expectedValue ) #define DbgVerify( _exp ) Assert( _exp ) -#define AssertMsg1( _exp, _msg, a1 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1 )) ) -#define AssertMsg2( _exp, _msg, a1, a2 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2 )) ) -#define AssertMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3 )) ) -#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4 )) ) -#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 )) ) -#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 )) ) -#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 )) ) -#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 )) ) -#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 )) ) +#define AssertMsg1( _exp, _msg, a1 ) AssertMsg( _exp, _msg, a1 ) +#define AssertMsg2( _exp, _msg, a1, a2 ) AssertMsg( _exp, _msg, a1, a2 ) +#define AssertMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg( _exp, _msg, a1, a2, a3 ) +#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertMsg( _exp, _msg, a1, a2, a3, a4 ) +#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5 ) +#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6 ) +#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) +#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) #else // DBGFLAG_ASSERT #define Assert( _exp ) ((void)0) #define AssertOnce( _exp ) ((void)0) -#define AssertMsg( _exp, _msg ) ((void)0) +#define AssertMsg( _exp, _msg, ... ) ((void)0) #define AssertMsgOnce( _exp, _msg ) ((void)0) #define AssertFunc( _exp, _f ) ((void)0) #define AssertEquals( _exp, _expectedValue ) ((void)0) diff --git a/mp/src/public/tier0/fasttimer.h b/mp/src/public/tier0/fasttimer.h index 0f49a43e..79496a9e 100644 --- a/mp/src/public/tier0/fasttimer.h +++ b/mp/src/public/tier0/fasttimer.h @@ -499,10 +499,10 @@ public: CLimitTimer() {} CLimitTimer( uint64 cMicroSecDuration ) { SetLimit( cMicroSecDuration ); } void SetLimit( uint64 m_cMicroSecDuration ); - bool BLimitReached(); + bool BLimitReached() const; - int CMicroSecOverage(); - uint64 CMicroSecLeft(); + int CMicroSecOverage() const; + uint64 CMicroSecLeft() const; private: uint64 m_lCycleLimit; @@ -526,7 +526,7 @@ inline void CLimitTimer::SetLimit( uint64 cMicroSecDuration ) // Purpose: Determines whether our specified time period has passed // Output: true if at least the specified time period has passed //----------------------------------------------------------------------------- -inline bool CLimitTimer::BLimitReached( ) +inline bool CLimitTimer::BLimitReached() const { CCycleCount cycleCount; cycleCount.Sample( ); @@ -538,7 +538,7 @@ inline bool CLimitTimer::BLimitReached( ) // Purpose: If we're over our specified time period, return the amount of the overage. // Output: # of microseconds since we reached our specified time period. //----------------------------------------------------------------------------- -inline int CLimitTimer::CMicroSecOverage() +inline int CLimitTimer::CMicroSecOverage() const { CCycleCount cycleCount; cycleCount.Sample(); @@ -555,7 +555,7 @@ inline int CLimitTimer::CMicroSecOverage() // Purpose: If we're under our specified time period, return the amount under. // Output: # of microseconds until we reached our specified time period, 0 if we've passed it //----------------------------------------------------------------------------- -inline uint64 CLimitTimer::CMicroSecLeft() +inline uint64 CLimitTimer::CMicroSecLeft() const { CCycleCount cycleCount; cycleCount.Sample(); diff --git a/mp/src/public/tier1/UtlSortVector.h b/mp/src/public/tier1/UtlSortVector.h index 76026925..b5bfef53 100644 --- a/mp/src/public/tier1/UtlSortVector.h +++ b/mp/src/public/tier1/UtlSortVector.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // $Header: $ // $NoKeywords: $ @@ -45,31 +45,49 @@ public: template , class BaseVector = CUtlVector > class CUtlSortVector : public BaseVector { + typedef BaseVector BaseClass; public: - - // constructor + /// constructor CUtlSortVector( int nGrowSize = 0, int initSize = 0 ); CUtlSortVector( T* pMemory, int numElements ); - // inserts (copy constructs) an element in sorted order into the list + /// inserts (copy constructs) an element in sorted order into the list int Insert( const T& src ); - // Finds an element within the list using a binary search - int Find( const T& search ) const; - int FindLessOrEqual( const T& search ) const; - int FindLess( const T& search ) const; + /// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list + int InsertIfNotFound( const T& src ); + + /// Finds an element within the list using a binary search. These are templatized based upon the key + /// in which case the less function must handle the Less function for key, T and T, key + template< typename TKey > + int Find( const TKey& search ) const; + template< typename TKey > + int FindLessOrEqual( const TKey& search ) const; + template< typename TKey > + int FindLess( const TKey& search ) const; - // Removes a particular element + /// Removes a particular element void Remove( const T& search ); void Remove( int i ); - // Allows methods to set a context to be used with the less function.. + /// Allows methods to set a context to be used with the less function.. void SetLessContext( void *pCtx ); - // Note that you can only use this index until sorting is redone!!! + /// A version of insertion that will produce an un-ordered list. + /// Note that you can only use this index until sorting is redone with RedoSort!!! int InsertNoSort( const T& src ); void RedoSort( bool bForceSort = false ); + /// Use this to insert at a specific insertion point; using FindLessOrEqual + /// is required for use this this. This will test that what you've inserted + /// produces a correctly ordered list. + int InsertAfter( int nElemIndex, const T &src ); + + /// finds a particular element using a linear search. Useful when used + /// in between calls to InsertNoSort and RedoSort + template< typename TKey > + int FindUnsorted( const TKey &src ) const; + protected: // No copy constructor CUtlSortVector( const CUtlSortVector & ); @@ -79,10 +97,9 @@ protected: int AddToTail(); int InsertBefore( int elem ); int InsertAfter( int elem ); + int InsertBefore( int elem, const T& src ); int AddToHead( const T& src ); int AddToTail( const T& src ); - int InsertBefore( int elem, const T& src ); - int InsertAfter( int elem, const T& src ); int AddMultipleToHead( int num ); int AddMultipleToTail( int num, const T *pToCopy=NULL ); int InsertMultipleBefore( int elem, int num, const T *pToCopy=NULL ); @@ -121,6 +138,10 @@ protected: bool m_bNeedsSort; private: +private: + template< typename TKey > + int FindLessOrEqual( const TKey& search, bool *pFound ) const; + void QuickSort( LessFunc& less, int X, int I ); }; @@ -176,6 +197,43 @@ int CUtlSortVector::InsertNoSort( const T& src ) return lastElement; } +/// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list +template +int CUtlSortVector::InsertIfNotFound( const T& src ) +{ + AssertFatal( !m_bNeedsSort ); + bool bFound; + int pos = FindLessOrEqual( src, &bFound ); + if ( bFound ) + return pos; + + ++pos; + this->GrowVector(); + this->ShiftElementsRight(pos); + CopyConstruct( &this->Element(pos), src ); + return pos; +} + +template +int CUtlSortVector::InsertAfter( int nIndex, const T &src ) +{ + int nInsertedIndex = this->BaseClass::InsertAfter( nIndex, src ); + +#ifdef DEBUG + LessFunc less; + if ( nInsertedIndex > 0 ) + { + Assert( less.Less( this->Element(nInsertedIndex-1), src, m_pLessContext ) ); + } + if ( nInsertedIndex < BaseClass::Count()-1 ) + { + Assert( less.Less( src, this->Element(nInsertedIndex+1), m_pLessContext ) ); + } +#endif + return nInsertedIndex; +} + + template void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUpper ) { @@ -218,7 +276,8 @@ void CUtlSortVector::RedoSort( bool bForceSort /*= fals // finds a particular element //----------------------------------------------------------------------------- template -int CUtlSortVector::Find( const T& src ) const +template < typename TKey > +int CUtlSortVector::Find( const TKey& src ) const { AssertFatal( !m_bNeedsSort ); @@ -245,11 +304,34 @@ int CUtlSortVector::Find( const T& src ) const } +//----------------------------------------------------------------------------- +// finds a particular element using a linear search. Useful when used +// in between calls to InsertNoSort and RedoSort +//----------------------------------------------------------------------------- +template< class T, class LessFunc, class BaseVector > +template < typename TKey > +int CUtlSortVector::FindUnsorted( const TKey &src ) const +{ + LessFunc less; + int nCount = this->Count(); + for ( int i = 0; i < nCount; ++i ) + { + if ( less.Less( this->Element(i), src, m_pLessContext ) ) + continue; + if ( less.Less( src, this->Element(i), m_pLessContext ) ) + continue; + return i; + } + return -1; +} + + //----------------------------------------------------------------------------- // finds a particular element //----------------------------------------------------------------------------- template -int CUtlSortVector::FindLessOrEqual( const T& src ) const +template < typename TKey > +int CUtlSortVector::FindLessOrEqual( const TKey& src, bool *pFound ) const { AssertFatal( !m_bNeedsSort ); @@ -268,14 +350,26 @@ int CUtlSortVector::FindLessOrEqual( const T& src ) con } else { + *pFound = true; return mid; } } + + *pFound = false; return end; } template -int CUtlSortVector::FindLess( const T& src ) const +template < typename TKey > +int CUtlSortVector::FindLessOrEqual( const TKey& src ) const +{ + bool bFound; + return FindLessOrEqual( src, &bFound ); +} + +template +template < typename TKey > +int CUtlSortVector::FindLess( const TKey& src ) const { AssertFatal( !m_bNeedsSort ); diff --git a/mp/src/public/tier1/convar.h b/mp/src/public/tier1/convar.h index 2174e1f9..4bff787e 100644 --- a/mp/src/public/tier1/convar.h +++ b/mp/src/public/tier1/convar.h @@ -66,7 +66,7 @@ void ConVar_PublishToVXConsole(); //----------------------------------------------------------------------------- // Called when a ConCommand needs to execute //----------------------------------------------------------------------------- -typedef void ( *FnCommandCallbackV1_t )( void ); +typedef void ( *FnCommandCallbackVoid_t )( void ); typedef void ( *FnCommandCallback_t )( const CCommand &command ); #define COMMAND_COMPLETION_MAXITEMS 64 @@ -265,7 +265,7 @@ friend class CCvar; public: typedef ConCommandBase BaseClass; - ConCommand( const char *pName, FnCommandCallbackV1_t callback, + ConCommand( const char *pName, FnCommandCallbackVoid_t callback, const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ); ConCommand( const char *pName, FnCommandCallback_t callback, const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ); @@ -295,7 +295,7 @@ private: // Call this function when executing the command union { - FnCommandCallbackV1_t m_fnCommandCallbackV1; + FnCommandCallbackVoid_t m_fnCommandCallbackV1; FnCommandCallback_t m_fnCommandCallback; ICommandCallback *m_pCommandCallback; }; diff --git a/mp/src/public/tier1/fmtstr.h b/mp/src/public/tier1/fmtstr.h index 31ee23c7..556fc130 100644 --- a/mp/src/public/tier1/fmtstr.h +++ b/mp/src/public/tier1/fmtstr.h @@ -31,28 +31,52 @@ int result; \ va_list arg_ptr; \ bool bTruncated = false; \ - static unsigned int scAsserted = 0; \ + static int scAsserted = 0; \ \ va_start(arg_ptr, lastArg); \ - result = Q_vsnprintfRet( (szBuf), nBufSize, (*(ppszFormat)), arg_ptr, &bTruncated ); \ + result = V_vsnprintfRet( (szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr, &bTruncated ); \ va_end(arg_ptr); \ \ + (szBuf)[(nBufSize)-1] = 0; \ if ( bTruncated && !(bQuietTruncation) && scAsserted < 5 ) \ { \ - Assert( !bTruncated ); \ + Warning( "FmtStrVSNPrintf truncated to %d without QUIET_TRUNCATION specified!\n", ( int )( nBufSize ) ); \ + AssertMsg( 0, "FmtStrVSNPrintf truncated without QUIET_TRUNCATION specified!\n" ); \ scAsserted++; \ } \ m_nLength = nPrevLen + result; \ } \ while (0) +// using macro to be compatable with GCC +#define FmtStrVSNPrintfNoLengthFixup( szBuf, nBufSize, bQuietTruncation, ppszFormat, nPrevLen, lastArg ) \ + do \ + { \ + int result; \ + va_list arg_ptr; \ + bool bTruncated = false; \ + static int scAsserted = 0; \ + \ + va_start(arg_ptr, lastArg); \ + result = V_vsnprintfRet( (szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr, &bTruncated ); \ + va_end(arg_ptr); \ + \ + (szBuf)[(nBufSize)-1] = 0; \ + if ( bTruncated && !(bQuietTruncation) && scAsserted < 5 ) \ + { \ + Warning( "FmtStrVSNPrintf truncated to %d without QUIET_TRUNCATION specified!\n", ( int )( nBufSize ) ); \ + AssertMsg( 0, "FmtStrVSNPrintf truncated without QUIET_TRUNCATION specified!\n" ); \ + scAsserted++; \ + } \ + } \ + while (0) //----------------------------------------------------------------------------- // // Purpose: String formatter with specified size // -template +template class CFmtStrN { public: @@ -80,14 +104,36 @@ public: // Explicit reformat const char *sprintf(PRINTF_FORMAT_STRING const char *pszFormat, ...) FMTFUNCTION( 2, 3 ) { - FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, &pszFormat, 0, pszFormat ); + InitQuietTruncation(); + FmtStrVSNPrintf(m_szBuf, SIZE_BUF, m_bQuietTruncation, &pszFormat, 0, pszFormat ); + return m_szBuf; + } + + // Use this for va_list formatting + const char *sprintf_argv(const char *pszFormat, va_list arg_ptr) + { + int result; + bool bTruncated = false; + static int s_nWarned = 0; + + InitQuietTruncation(); + result = V_vsnprintfRet( m_szBuf, SIZE_BUF - 1, pszFormat, arg_ptr, &bTruncated ); + m_szBuf[SIZE_BUF - 1] = 0; + if ( bTruncated && !m_bQuietTruncation && ( s_nWarned < 5 ) ) + { + Warning( "CFmtStr truncated to %d without QUIET_TRUNCATION specified!\n", SIZE_BUF ); + AssertMsg( 0, "CFmtStr truncated without QUIET_TRUNCATION specified!\n" ); + s_nWarned++; + } + m_nLength = V_strlen( m_szBuf ); return m_szBuf; } // Use this for pass-through formatting void VSprintf(const char **ppszFormat, ...) { - FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, ppszFormat, 0, ppszFormat); + InitQuietTruncation(); + FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, ppszFormat, 0, ppszFormat ); } // Compatible API with CUtlString for converting to const char* @@ -97,14 +143,17 @@ public: operator const char *() const { return m_szBuf; } char *Access() { return m_szBuf; } - CFmtStrN & operator=( const char *pchValue ) + // Access template argument + static inline int GetMaxLength() { return SIZE_BUF-1; } + + CFmtStrN & operator=( const char *pchValue ) { V_strncpy( m_szBuf, pchValue, SIZE_BUF ); m_nLength = V_strlen( m_szBuf ); return *this; } - CFmtStrN & operator+=( const char *pchValue ) + CFmtStrN & operator+=( const char *pchValue ) { Append( pchValue ); return *this; @@ -112,13 +161,19 @@ public: int Length() const { return m_nLength; } + void SetLength( int nLength ) + { + m_nLength = Min( nLength, SIZE_BUF - 1 ); + m_szBuf[m_nLength] = '\0'; + } + void Clear() { m_szBuf[0] = 0; m_nLength = 0; } - void AppendFormat(PRINTF_FORMAT_STRING const char *pchFormat, ... ) FMTFUNCTION( 2, 3 ) + void AppendFormat( PRINTF_FORMAT_STRING const char *pchFormat, ... ) { char *pchEnd = m_szBuf + m_nLength; FmtStrVSNPrintf( pchEnd, SIZE_BUF - m_nLength, m_bQuietTruncation, &pchFormat, m_nLength, pchFormat ); @@ -163,14 +218,12 @@ public: void AppendIndent( uint32 unCount, char chIndent = '\t' ); + void SetQuietTruncation( bool bQuiet ) { m_bQuietTruncation = bQuiet; } + protected: virtual void InitQuietTruncation() { -#ifdef _DEBUG - m_bQuietTruncation = false; -#else - m_bQuietTruncation = true; // Force quiet for release builds -#endif + m_bQuietTruncation = QUIET_TRUNCATION; } bool m_bQuietTruncation; @@ -183,16 +236,14 @@ private: // Version which will not assert if strings are truncated -template -class CFmtStrQuietTruncationN : public CFmtStrN +template < int SIZE_BUF > +class CFmtStrQuietTruncationN : public CFmtStrN { -protected: - virtual void InitQuietTruncation() { this->m_bQuietTruncation = true; } }; -template< int SIZE_BUF > -void CFmtStrN::AppendIndent( uint32 unCount, char chIndent ) +template< int SIZE_BUF, bool QUIET_TRUNCATION > +void CFmtStrN< SIZE_BUF, QUIET_TRUNCATION >::AppendIndent( uint32 unCount, char chIndent ) { Assert( Length() + unCount < SIZE_BUF ); if( Length() + unCount >= SIZE_BUF ) @@ -204,8 +255,8 @@ void CFmtStrN::AppendIndent( uint32 unCount, char chIndent ) m_szBuf[ m_nLength ] = '\0'; } -template< int SIZE_BUF > -void CFmtStrN::AppendFormatV( const char *pchFormat, va_list args ) +template< int SIZE_BUF, bool QUIET_TRUNCATION > +void CFmtStrN< SIZE_BUF, QUIET_TRUNCATION >::AppendFormatV( const char *pchFormat, va_list args ) { int cubPrinted = V_vsnprintf( m_szBuf+Length(), SIZE_BUF - Length(), pchFormat, args ); m_nLength += cubPrinted; diff --git a/mp/src/public/tier1/mempool.h b/mp/src/public/tier1/mempool.h index 88406fbf..01d3a33f 100644 --- a/mp/src/public/tier1/mempool.h +++ b/mp/src/public/tier1/mempool.h @@ -30,19 +30,27 @@ typedef void (*MemoryPoolReportFunc_t)( PRINTF_FORMAT_STRING char const* pMsg, ... ); +// Ways a memory pool can grow when it needs to make a new blob: +enum MemoryPoolGrowType_t +{ + UTLMEMORYPOOL_GROW_NONE=0, // Don't allow new blobs. + UTLMEMORYPOOL_GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates + // get larger and larger each time it allocates one). + UTLMEMORYPOOL_GROW_SLOW=2 // New blob size is numElements. +}; + class CUtlMemoryPool { public: - // Ways the memory pool can grow when it needs to make a new blob. + // !KLUDGE! For legacy code support, import the global enum into this scope enum MemoryPoolGrowType_t { - GROW_NONE=0, // Don't allow new blobs. - GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates - // get larger and larger each time it allocates one). - GROW_SLOW=2 // New blob size is numElements. + GROW_NONE=UTLMEMORYPOOL_GROW_NONE, + GROW_FAST=UTLMEMORYPOOL_GROW_FAST, + GROW_SLOW=UTLMEMORYPOOL_GROW_SLOW }; - CUtlMemoryPool( int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); + CUtlMemoryPool( int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); ~CUtlMemoryPool(); void* Alloc(); // Allocate the element size you specified in the constructor. @@ -103,7 +111,7 @@ protected: class CMemoryPoolMT : public CUtlMemoryPool { public: - CMemoryPoolMT(int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} + CMemoryPoolMT(int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} void* Alloc() { AUTO_LOCK( m_mutex ); return CUtlMemoryPool::Alloc(); } diff --git a/mp/src/public/tier1/strtools.h b/mp/src/public/tier1/strtools.h index 93d0af6d..d3f1c65b 100644 --- a/mp/src/public/tier1/strtools.h +++ b/mp/src/public/tier1/strtools.h @@ -765,6 +765,29 @@ private: }; +// Encodes a string (or binary data) in URL encoding format, see rfc1738 section 2.2. +// Dest buffer should be 3 times the size of source buffer to guarantee it has room to encode. +void Q_URLEncodeRaw( OUT_Z_CAP(nDestLen) char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + +// Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// Dest buffer should be at least as large as source buffer to gurantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +// +// Returns the amount of space actually used in the output buffer. +size_t Q_URLDecodeRaw( OUT_CAP(nDecodeDestLen) char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); + +// Encodes a string (or binary data) in URL encoding format, this isn't the strict rfc1738 format, but instead uses + for spaces. +// This is for historical reasons and HTML spec foolishness that lead to + becoming a de facto standard for spaces when encoding form data. +// Dest buffer should be 3 times the size of source buffer to guarantee it has room to encode. +void Q_URLEncode( OUT_Z_CAP(nDestLen) char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + +// Decodes a string (or binary data) in URL encoding format, this isn't the strict rfc1738 format, but instead uses + for spaces. +// This is for historical reasons and HTML spec foolishness that lead to + becoming a de facto standard for spaces when encoding form data. +// Dest buffer should be at least as large as source buffer to gurantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +// +// Returns the amount of space actually used in the output buffer. +size_t Q_URLDecode( OUT_CAP(nDecodeDestLen) char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); // NOTE: This is for backward compatability! diff --git a/mp/src/public/tier1/utlblockmemory.h b/mp/src/public/tier1/utlblockmemory.h index 69885060..b4a254ff 100644 --- a/mp/src/public/tier1/utlblockmemory.h +++ b/mp/src/public/tier1/utlblockmemory.h @@ -247,15 +247,16 @@ void CUtlBlockMemory::ChangeSize( int nBlocks ) UTLBLOCKMEMORY_TRACK_ALLOC(); // this must stay after the recalculation of m_nBlocks, since it implicitly uses the new value - // free old blocks if shrinking - for ( int i = m_nBlocks; i < nBlocksOld; ++i ) - { - UTLBLOCKMEMORY_TRACK_FREE(); - free( (void*)m_pMemory[ i ] ); - } - if ( m_pMemory ) { + // free old blocks if shrinking + // Only possible if m_pMemory is non-NULL (and avoids PVS-Studio warning) + for ( int i = m_nBlocks; i < nBlocksOld; ++i ) + { + UTLBLOCKMEMORY_TRACK_FREE(); + free( (void*)m_pMemory[ i ] ); + } + MEM_ALLOC_CREDIT_CLASS(); m_pMemory = (T**)realloc( m_pMemory, m_nBlocks * sizeof(T*) ); Assert( m_pMemory ); diff --git a/mp/src/public/tier1/utlpair.h b/mp/src/public/tier1/utlpair.h new file mode 100644 index 00000000..d306f324 --- /dev/null +++ b/mp/src/public/tier1/utlpair.h @@ -0,0 +1,52 @@ +//========= Copyright, Valve Corporation, All rights reserved. ================// +// +// std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes +// +//=============================================================================// + +#ifndef UTLPAIR_H +#define UTLPAIR_H + +#ifdef _WIN32 +#pragma once +#endif + + +// std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes +template +class CUtlPair +{ +public: + CUtlPair() {} + CUtlPair( T1 t1, T2 t2 ) : first( t1 ), second( t2 ) {} + + bool operator<( const CUtlPair &rhs ) const { + if ( first != rhs.first ) + return first < rhs.first; + return second < rhs.second; + } + + bool operator==( const CUtlPair &rhs ) const { + return first == rhs.first && second == rhs.second; + } + + T1 first; + T2 second; +}; + +// utility to make a CUtlPair without having to specify template parameters +template +inline CUtlPair MakeUtlPair( T1 t1, T2 t2 ) +{ + return CUtlPair(t1, t2); +} + +//// HashItem() overload that works automatically with our hash containers +//template +//inline uint32 HashItem( const CUtlPair &item ) +//{ +// return HashItem( (uint64)HashItem( item.first ) + ((uint64)HashItem( item.second ) << 32) ); +//} + + +#endif // UTLPAIR_H diff --git a/mp/src/public/tier1/utlstring.h b/mp/src/public/tier1/utlstring.h index f425b271..c50765fa 100644 --- a/mp/src/public/tier1/utlstring.h +++ b/mp/src/public/tier1/utlstring.h @@ -332,6 +332,7 @@ public: void Clear() { Set( NULL ); } const T *Get() const { return m_pString ? m_pString : StringFuncs::EmptyString(); } + operator const T*() const { return m_pString ? m_pString : StringFuncs::EmptyString(); } bool IsEmpty() const { return m_pString == NULL; } // Note: empty strings are never stored by Set diff --git a/mp/src/public/tier1/utlvector.h b/mp/src/public/tier1/utlvector.h index 1f2fe6e1..180b51e4 100644 --- a/mp/src/public/tier1/utlvector.h +++ b/mp/src/public/tier1/utlvector.h @@ -80,6 +80,12 @@ public: int Count() const; int Size() const; // don't use me! + /// are there no elements? For compatibility with lists. + inline bool IsEmpty( void ) const + { + return ( Count() == 0 ); + } + // Is element index valid? bool IsValidIndex( int i ) const; static int InvalidIndex(); diff --git a/mp/src/public/togl/osx/glmgrbasics.h b/mp/src/public/togl/osx/glmgrbasics.h index 78e41464..dbed35dd 100644 --- a/mp/src/public/togl/osx/glmgrbasics.h +++ b/mp/src/public/togl/osx/glmgrbasics.h @@ -1,299 +1,299 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// glmgrbasics.h -// types, common headers, forward declarations, utilities -// -//=============================================================================== - -#ifndef GLMBASICS_H -#define GLMBASICS_H - -#pragma once - -#ifdef OSX -#include -#include -#include -#include -#include -#include -#include -//#include -#elif defined(LINUX) -#include -#include -#else -#error -#endif - -#include "tier0/platform.h" - -#include "bitmap/imageformat.h" -#include "bitvec.h" -#include "tier1/checksum_md5.h" -#include "tier1/utlvector.h" -#include "tier1/convar.h" - -#include - -#include "dxabstract_types.h" - -// types -struct GLMRect; -typedef void *PseudoGLContextPtr; - - - // 3-d integer box (used for texture lock/unlock etc) -struct GLMRegion -{ - int xmin,xmax; - int ymin,ymax; - int zmin,zmax; -}; - -struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's -{ - int xmin; // left - int ymin; // bottom - int xmax; // right - int ymax; // top -}; - -// macros - -//#define GLMassert(x) assert(x) - -// forward decls -class GLMgr; // singleton -class GLMContext; // GL context -class CGLMContextTester; // testing class -class CGLMTex; -class CGLMFBO; -class CGLMProgram; -class CGLMBuffer; - - -// utilities - -typedef enum -{ - // D3D codes - eD3D_DEVTYPE, - eD3D_FORMAT, - eD3D_RTYPE, - eD3D_USAGE, - eD3D_RSTATE, // render state - eD3D_SIO, // D3D shader bytecode - eD3D_VTXDECLUSAGE, - - // CGL codes - eCGL_RENDID, - - // OpenGL error codes - eGL_ERROR, - - // OpenGL enums - eGL_ENUM, - eGL_RENDERER - -} GLMThing_t; - -const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const -const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask - -void GLMStop( void ); // aka Debugger() -void GLMCheckError( bool noStop = false, bool noLog= false ); -void GLMEnableTrace( bool on ); - -// expose these in release now -// Mimic PIX events so we can decorate debug spew -void GLMBeginPIXEvent( const char *str ); -void GLMEndPIXEvent( void ); - -//=============================================================================== -// knob twiddling -float GLMKnob( char *knobname, float *setvalue ); // Pass NULL to not-set the knob value -float GLMKnobToggle( char *knobname ); - -//=============================================================================== -// other stuff - -// helpers for CGLSetOption - no op if no profiler -void GLMProfilerClearTrace( void ); -void GLMProfilerEnableTrace( bool enable ); - -// helpers for CGLSetParameter - no op if no profiler -void GLMProfilerDumpState( void ); - - -//=============================================================================== -// classes - -// helper class making function tracking easier to wire up -#if GLMDEBUG -class GLMFuncLogger -{ - public: - - // simple function log - GLMFuncLogger( const char *funcName ) - { - m_funcName = funcName; - m_earlyOut = false; - - GLMPrintf( ">%s", m_funcName ); - }; - - // more advanced version lets you pass args (i.e. called parameters or anything else of interest) - // no macro for this one, since no easy way to pass through the args as well as the funcname - GLMFuncLogger( const char *funcName, char *fmt, ... ) - { - m_funcName = funcName; - m_earlyOut = false; - - // this acts like GLMPrintf here - // all the indent policy is down in GLMPrintfVA - // which means we need to inject a ">" at the front of the format string to make this work... sigh. - - char modifiedFmt[2000]; - modifiedFmt[0] = '>'; - strcpy( modifiedFmt+1, fmt ); - - va_list vargs; - va_start(vargs, fmt); - GLMPrintfVA( modifiedFmt, vargs ); - va_end( vargs ); - } - - ~GLMFuncLogger( ) - { - if (m_earlyOut) - { - GLMPrintf( "<%s (early out)", m_funcName ); - } - else - { - GLMPrintf( "<%s", m_funcName ); - } - }; - - void EarlyOut( void ) - { - m_earlyOut = true; - }; - - const char *m_funcName; // set at construction time - bool m_earlyOut; -}; - -// handy macro to go with the function tracking class -#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ ) -#else -#define GLM_FUNC -#endif - - -// class to keep an in-memory mirror of a file which may be getting edited during run -class CGLMFileMirror -{ -public: - CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read. - //if non existent it will be created with size zero - ~CGLMFileMirror( ); - - bool HasData( void ); // see if data avail - void GetData( char **dataPtr, uint *dataSizePtr ); // read it out - void SetData( char *data, uint dataSize ); // put data in (and write it to disk) - bool PollForChanges( void ); // check disk copy. If different, read it back in and return true. - - void UpdateStatInfo( void ); // make sure stat info is current for our file - void ReadFile( void ); - void WriteFile( void ); - - void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground - - /// how about a "wait for change" method.. - - char *m_path; // fullpath to file - bool m_exists; - struct stat m_stat; // stat results for the file (last time checked) - - char *m_data; // content of file - uint m_size; // length of content - -}; - -// class based on the file mirror, that makes it easy to edit them outside the app. - -// it receives an initial block of text from the engine, and hashes it. ("orig") -// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged") -// a mirror file is activated, using a filename based on the hash from the orig text. -// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set. -// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text) - - -class CGLMEditableTextItem -{ -public: - CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix - ~CGLMEditableTextItem( ); - - bool HasData( void ); - bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition - void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy) - void OpenInEditor( bool foreground=false ); // call user attention to this text - - // internal methods - void GenHashOfOrigText( void ); - void GenBaseNameAndFullPath( char *prefix, char *suffix ); - void GenMungedText( bool fromMirror ); - - // members - // orig - uint m_origSize; - char *m_origText; // what was submitted - unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted - - // munged - uint m_mungedSize; - char *m_mungedText; // re-processed edition, initial content submission to the file mirror - - // mirror - char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix - char *m_mirrorFullPath; // base name - CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return. -}; - - -// debug font -extern unsigned char g_glmDebugFontMap[16384]; - -// class for cracking multi-part text blobs -// sections are demarcated by beginning-of-line markers submitted in a table by the caller - -struct GLMTextSection -{ - int m_markerIndex; // based on table of markers passed in to constructor - uint m_textOffset; // where is the text - offset - int m_textLength; // how big is the section -}; - -class CGLMTextSectioner -{ -public: - CGLMTextSectioner( char *text, int textSize, char **markers ); // constructor finds all the sections - ~CGLMTextSectioner( ); - - int Count( void ); // how many sections found - void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut ); - // find section, size, what marker - // note that more than one section can be marked similarly. - // so policy isn't made here, you walk the sections and decide what to do if there are dupes. - - //members - - //section table - CUtlVector< GLMTextSection > m_sectionTable; -}; - -#endif +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// glmgrbasics.h +// types, common headers, forward declarations, utilities +// +//=============================================================================== + +#ifndef GLMBASICS_H +#define GLMBASICS_H + +#pragma once + +#ifdef OSX +#include +#include +#include +#include +#include +#include +//#include +//#include +#elif defined(LINUX) +#include +#include +#else +#error +#endif + +#include "tier0/platform.h" + +#include "bitmap/imageformat.h" +#include "bitvec.h" +#include "tier1/checksum_md5.h" +#include "tier1/utlvector.h" +#include "tier1/convar.h" + +#include + +#include "dxabstract_types.h" + +// types +struct GLMRect; +typedef void *PseudoGLContextPtr; + + + // 3-d integer box (used for texture lock/unlock etc) +struct GLMRegion +{ + int xmin,xmax; + int ymin,ymax; + int zmin,zmax; +}; + +struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's +{ + int xmin; // left + int ymin; // bottom + int xmax; // right + int ymax; // top +}; + +// macros + +//#define GLMassert(x) assert(x) + +// forward decls +class GLMgr; // singleton +class GLMContext; // GL context +class CGLMContextTester; // testing class +class CGLMTex; +class CGLMFBO; +class CGLMProgram; +class CGLMBuffer; + + +// utilities + +typedef enum +{ + // D3D codes + eD3D_DEVTYPE, + eD3D_FORMAT, + eD3D_RTYPE, + eD3D_USAGE, + eD3D_RSTATE, // render state + eD3D_SIO, // D3D shader bytecode + eD3D_VTXDECLUSAGE, + + // CGL codes + eCGL_RENDID, + + // OpenGL error codes + eGL_ERROR, + + // OpenGL enums + eGL_ENUM, + eGL_RENDERER + +} GLMThing_t; + +const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const +const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask + +void GLMStop( void ); // aka Debugger() +void GLMCheckError( bool noStop = false, bool noLog= false ); +void GLMEnableTrace( bool on ); + +// expose these in release now +// Mimic PIX events so we can decorate debug spew +void GLMBeginPIXEvent( const char *str ); +void GLMEndPIXEvent( void ); + +//=============================================================================== +// knob twiddling +//float GLMKnob( char *knobname, float *setvalue ); // Pass NULL to not-set the knob value +//float GLMKnobToggle( char *knobname ); + +//=============================================================================== +// other stuff + +// helpers for CGLSetOption - no op if no profiler +void GLMProfilerClearTrace( void ); +void GLMProfilerEnableTrace( bool enable ); + +// helpers for CGLSetParameter - no op if no profiler +void GLMProfilerDumpState( void ); + + +//=============================================================================== +// classes + +// helper class making function tracking easier to wire up +#if GLMDEBUG +class GLMFuncLogger +{ + public: + + // simple function log + GLMFuncLogger( const char *funcName ) + { + m_funcName = funcName; + m_earlyOut = false; + + GLMPrintf( ">%s", m_funcName ); + }; + + // more advanced version lets you pass args (i.e. called parameters or anything else of interest) + // no macro for this one, since no easy way to pass through the args as well as the funcname + GLMFuncLogger( const char *funcName, char *fmt, ... ) + { + m_funcName = funcName; + m_earlyOut = false; + + // this acts like GLMPrintf here + // all the indent policy is down in GLMPrintfVA + // which means we need to inject a ">" at the front of the format string to make this work... sigh. + + char modifiedFmt[2000]; + modifiedFmt[0] = '>'; + strcpy( modifiedFmt+1, fmt ); + + va_list vargs; + va_start(vargs, fmt); + GLMPrintfVA( modifiedFmt, vargs ); + va_end( vargs ); + } + + ~GLMFuncLogger( ) + { + if (m_earlyOut) + { + GLMPrintf( "<%s (early out)", m_funcName ); + } + else + { + GLMPrintf( "<%s", m_funcName ); + } + }; + + void EarlyOut( void ) + { + m_earlyOut = true; + }; + + const char *m_funcName; // set at construction time + bool m_earlyOut; +}; + +// handy macro to go with the function tracking class +#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ ) +#else +#define GLM_FUNC +#endif + + +// class to keep an in-memory mirror of a file which may be getting edited during run +class CGLMFileMirror +{ +public: + CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read. + //if non existent it will be created with size zero + ~CGLMFileMirror( ); + + bool HasData( void ); // see if data avail + void GetData( char **dataPtr, uint *dataSizePtr ); // read it out + void SetData( char *data, uint dataSize ); // put data in (and write it to disk) + bool PollForChanges( void ); // check disk copy. If different, read it back in and return true. + + void UpdateStatInfo( void ); // make sure stat info is current for our file + void ReadFile( void ); + void WriteFile( void ); + + void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground + + /// how about a "wait for change" method.. + + char *m_path; // fullpath to file + bool m_exists; + struct stat m_stat; // stat results for the file (last time checked) + + char *m_data; // content of file + uint m_size; // length of content + +}; + +// class based on the file mirror, that makes it easy to edit them outside the app. + +// it receives an initial block of text from the engine, and hashes it. ("orig") +// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged") +// a mirror file is activated, using a filename based on the hash from the orig text. +// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set. +// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text) + + +class CGLMEditableTextItem +{ +public: + CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix + ~CGLMEditableTextItem( ); + + bool HasData( void ); + bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition + void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy) + void OpenInEditor( bool foreground=false ); // call user attention to this text + + // internal methods + void GenHashOfOrigText( void ); + void GenBaseNameAndFullPath( char *prefix, char *suffix ); + void GenMungedText( bool fromMirror ); + + // members + // orig + uint m_origSize; + char *m_origText; // what was submitted + unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted + + // munged + uint m_mungedSize; + char *m_mungedText; // re-processed edition, initial content submission to the file mirror + + // mirror + char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix + char *m_mirrorFullPath; // base name + CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return. +}; + + +// debug font +extern unsigned char g_glmDebugFontMap[16384]; + +// class for cracking multi-part text blobs +// sections are demarcated by beginning-of-line markers submitted in a table by the caller + +struct GLMTextSection +{ + int m_markerIndex; // based on table of markers passed in to constructor + uint m_textOffset; // where is the text - offset + int m_textLength; // how big is the section +}; + +class CGLMTextSectioner +{ +public: + CGLMTextSectioner( char *text, int textSize, char **markers ); // constructor finds all the sections + ~CGLMTextSectioner( ); + + int Count( void ); // how many sections found + void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut ); + // find section, size, what marker + // note that more than one section can be marked similarly. + // so policy isn't made here, you walk the sections and decide what to do if there are dupes. + + //members + + //section table + CUtlVector< GLMTextSection > m_sectionTable; +}; + +#endif diff --git a/mp/src/public/vgui/ISurface.h b/mp/src/public/vgui/ISurface.h index 0ccc8157..6289bd59 100644 --- a/mp/src/public/vgui/ISurface.h +++ b/mp/src/public/vgui/ISurface.h @@ -387,7 +387,7 @@ public: virtual IHTMLChromeController *AccessChromeHTMLController() = 0; // the origin of the viewport on the framebuffer (Which might not be 0,0 for stereo) - virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0; + virtual void SetFullscreenViewport( int x, int y, int w, int h ) = 0; // this uses NULL for the render target. virtual void GetFullscreenViewport( int & x, int & y, int & w, int & h ) = 0; virtual void PushFullscreenViewport() = 0; virtual void PopFullscreenViewport() = 0; diff --git a/mp/src/public/vgui/IVGui.h b/mp/src/public/vgui/IVGui.h index 18d90bd8..6a4c4371 100644 --- a/mp/src/public/vgui/IVGui.h +++ b/mp/src/public/vgui/IVGui.h @@ -99,6 +99,9 @@ public: // enables VR mode virtual void SetVRMode( bool bVRMode ) = 0; virtual bool GetVRMode() = 0; + + // add a tick signal like above, but to the head of the list of tick signals + virtual void AddTickSignalToHead( VPANEL panel, int intervalMilliseconds = 0 ) = 0; }; #define VGUI_IVGUI_INTERFACE_VERSION "VGUI_ivgui008" diff --git a/mp/src/public/vgui_controls/PanelListPanel.h b/mp/src/public/vgui_controls/PanelListPanel.h index 98292079..c4a647e3 100644 --- a/mp/src/public/vgui_controls/PanelListPanel.h +++ b/mp/src/public/vgui_controls/PanelListPanel.h @@ -24,8 +24,8 @@ namespace vgui //----------------------------------------------------------------------------- // Purpose: A list of variable height child panels -// each list item consists of a label-panel pair. Height of the item is -// determined from the lable. +// each list item consists of a label-panel pair. Height of the item is +// determined from the label. //----------------------------------------------------------------------------- class PanelListPanel : public EditablePanel { @@ -83,6 +83,8 @@ public: return &m_SortedItems; } + int ComputeVPixelsNeeded(); + protected: // overrides virtual void OnSizeChanged(int wide, int tall); @@ -92,7 +94,7 @@ protected: virtual void OnMouseWheeled(int delta); private: - int ComputeVPixelsNeeded(); + enum { DEFAULT_HEIGHT = 24, PANELBUFFER = 5 }; diff --git a/mp/src/raytrace/trace2.cpp b/mp/src/raytrace/trace2.cpp index f419cc76..4b1d19f6 100644 --- a/mp/src/raytrace/trace2.cpp +++ b/mp/src/raytrace/trace2.cpp @@ -186,7 +186,7 @@ void RayTracingEnvironment::RenderScene( AndNotSIMD(no_hit_mask,intens.x)); intens.y=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask), AndNotSIMD(no_hit_mask,intens.y)); - intens.z=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask), + intens.z=OrSIMD(AndSIMD(BackgroundColor.z,no_hit_mask), AndNotSIMD(no_hit_mask,intens.z)); MapLinearIntensities(intens,dest,dest+1,dest+stride,dest+stride+1); diff --git a/mp/src/thirdparty/protobuf-2.3.0/vsprojects/make.bat b/mp/src/thirdparty/protobuf-2.3.0/vsprojects/build.bat similarity index 100% rename from mp/src/thirdparty/protobuf-2.3.0/vsprojects/make.bat rename to mp/src/thirdparty/protobuf-2.3.0/vsprojects/build.bat diff --git a/mp/src/tier1/KeyValues.cpp b/mp/src/tier1/KeyValues.cpp index 6319d8df..19d6d66c 100644 --- a/mp/src/tier1/KeyValues.cpp +++ b/mp/src/tier1/KeyValues.cpp @@ -1952,9 +1952,8 @@ void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoi Q_strncpy( fullpath, resourceName, sizeof( fullpath ) ); // Strip off characters back to start or first / - bool done = false; int len = Q_strlen( fullpath ); - while ( !done ) + for (;;) { if ( len <= 0 ) { diff --git a/mp/src/tier1/convar.cpp b/mp/src/tier1/convar.cpp index 3cfff35d..c49a6efb 100644 --- a/mp/src/tier1/convar.cpp +++ b/mp/src/tier1/convar.cpp @@ -269,7 +269,7 @@ char *ConCommandBase::CopyString( const char *from ) int len; char *to; - len = strlen( from ); + len = V_strlen( from ); if ( len <= 0 ) { to = new char[1]; @@ -507,7 +507,7 @@ int DefaultCompletionFunc( const char *partial, char commands[ COMMAND_COMPLETIO // m_bIsNewConCommand = true; //} -ConCommand::ConCommand( const char *pName, FnCommandCallbackV1_t callback, const char *pHelpString /*= 0*/, int flags /*= 0*/, FnCommandCompletionCallback completionFunc /*= 0*/ ) +ConCommand::ConCommand( const char *pName, FnCommandCallbackVoid_t callback, const char *pHelpString /*= 0*/, int flags /*= 0*/, FnCommandCompletionCallback completionFunc /*= 0*/ ) { // Set the callback m_fnCommandCallbackV1 = callback; @@ -951,7 +951,7 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*= // Name should be static data SetDefault( pDefaultValue ); - m_StringLength = strlen( m_pszDefaultValue ) + 1; + m_StringLength = V_strlen( m_pszDefaultValue ) + 1; m_pszString = new char[m_StringLength]; memcpy( m_pszString, m_pszDefaultValue, m_StringLength ); @@ -963,6 +963,7 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*= m_fnChangeCallback = callback; m_fValue = ( float )atof( m_pszString ); + m_nValue = atoi( m_pszString ); // dont convert from float to int and lose bits // Bounds Check, should never happen, if it does, no big deal if ( m_bHasMin && ( m_fValue < m_fMinVal ) ) @@ -975,8 +976,6 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*= Assert( 0 ); } - m_nValue = ( int )m_fValue; - BaseClass::Create( pName, pHelpString, flags ); } diff --git a/mp/src/tier1/generichash.cpp b/mp/src/tier1/generichash.cpp index 492190b2..a3a4a8a5 100644 --- a/mp/src/tier1/generichash.cpp +++ b/mp/src/tier1/generichash.cpp @@ -364,7 +364,7 @@ uint32 MurmurHash2( const void * key, int len, uint32 seed ) #define TOLOWERU( c ) ( ( uint32 ) ( ( ( c >= 'A' ) && ( c <= 'Z' ) )? c + 32 : c ) ) uint32 MurmurHash2LowerCase( char const *pString, uint32 nSeed ) { - int nLen = strlen( pString ); + int nLen = ( int )strlen( pString ); char *p = ( char * ) stackalloc( nLen + 1 ); for( int i = 0; i < nLen ; i++ ) { diff --git a/mp/src/tier1/ilocalize.cpp b/mp/src/tier1/ilocalize.cpp index 182efd16..d95bbf29 100644 --- a/mp/src/tier1/ilocalize.cpp +++ b/mp/src/tier1/ilocalize.cpp @@ -112,7 +112,7 @@ void ConstructStringVArgsInternal_Impl(T *unicodeOutput, int unicodeBufferSizeIn } else { - AssertMsg( argindex < numFormatParameters, "ConstructStringVArgsInternal_Impl() - Found a %s# escape sequence whose index was more than the number of args." ); + AssertMsg( argindex < numFormatParameters, "ConstructStringVArgsInternal_Impl() - Found a %%s# escape sequence whose index was more than the number of args." ); //copy it over, char by char *outputPos = *searchPos; diff --git a/mp/src/tier1/mempool.cpp b/mp/src/tier1/mempool.cpp index 7ebbbf0b..fa49edb5 100644 --- a/mp/src/tier1/mempool.cpp +++ b/mp/src/tier1/mempool.cpp @@ -32,7 +32,7 @@ void CUtlMemoryPool::SetErrorReportFunc( MemoryPoolReportFunc_t func ) CUtlMemoryPool::CUtlMemoryPool( int blockSize, int numElements, int growMode, const char *pszAllocOwner, int nAlignment ) { #ifdef _X360 - if( numElements > 0 && growMode != GROW_NONE ) + if( numElements > 0 && growMode != UTLMEMORYPOOL_GROW_NONE ) { numElements = 1; } @@ -157,18 +157,18 @@ void CUtlMemoryPool::AddNewBlob() int sizeMultiplier; - if( m_GrowMode == GROW_SLOW ) + if( m_GrowMode == UTLMEMORYPOOL_GROW_SLOW ) { sizeMultiplier = 1; } else { - if ( m_GrowMode == GROW_NONE ) + if ( m_GrowMode == UTLMEMORYPOOL_GROW_NONE ) { // Can only have one allocation when we're in this mode if( m_NumBlobs != 0 ) { - Assert( !"CUtlMemoryPool::AddNewBlob: mode == GROW_NONE" ); + Assert( !"CUtlMemoryPool::AddNewBlob: mode == UTLMEMORYPOOL_GROW_NONE" ); return; } } @@ -231,10 +231,10 @@ void *CUtlMemoryPool::Alloc( size_t amount ) if( !m_pHeadOfFreeList ) { - // returning NULL is fine in GROW_NONE - if( m_GrowMode == GROW_NONE ) + // returning NULL is fine in UTLMEMORYPOOL_GROW_NONE + if( m_GrowMode == UTLMEMORYPOOL_GROW_NONE ) { - //Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with GROW_NONE" ); + //Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with UTLMEMORYPOOL_GROW_NONE" ); return NULL; } diff --git a/mp/src/tier1/strtools.cpp b/mp/src/tier1/strtools.cpp index 13097e39..9b1bfa84 100644 --- a/mp/src/tier1/strtools.cpp +++ b/mp/src/tier1/strtools.cpp @@ -1824,7 +1824,18 @@ void V_DefaultExtension( char *path, const char *extension, int pathStringLength void V_SetExtension( char *path, const char *extension, int pathStringLength ) { V_StripExtension( path, path, pathStringLength ); - V_DefaultExtension( path, extension, pathStringLength ); + + // We either had an extension and stripped it, or didn't have an extension + // at all. Either way, we need to concatenate our extension now. + + // extension is not required to start with '.', so if it's not there, + // then append that first. + if ( extension[0] != '.' ) + { + V_strncat( path, ".", pathStringLength, COPY_ALL_CHARACTERS ); + } + + V_strncat( path, extension, pathStringLength, COPY_ALL_CHARACTERS ); } //----------------------------------------------------------------------------- @@ -2663,6 +2674,217 @@ char *V_AddBackSlashesToSpecialChars( char const *pSrc ) *( pOut++ ) = 0; return pRet; } + +//----------------------------------------------------------------------------- +// Purpose: Helper for converting a numeric value to a hex digit, value should be 0-15. +//----------------------------------------------------------------------------- +char cIntToHexDigit( int nValue ) +{ + Assert( nValue >= 0 && nValue <= 15 ); + return "0123456789ABCDEF"[ nValue & 15 ]; +} + +//----------------------------------------------------------------------------- +// Purpose: Helper for converting a hex char value to numeric, return -1 if the char +// is not a valid hex digit. +//----------------------------------------------------------------------------- +int iHexCharToInt( char cValue ) +{ + int32 iValue = cValue; + if ( (uint32)( iValue - '0' ) < 10 ) + return iValue - '0'; + + iValue |= 0x20; + if ( (uint32)( iValue - 'a' ) < 6 ) + return iValue - 'a' + 10; + + return -1; +} + +//----------------------------------------------------------------------------- +// Purpose: Internal implementation of encode, works in the strict RFC manner, or +// with spaces turned to + like HTML form encoding. +//----------------------------------------------------------------------------- +void Q_URLEncodeInternal( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen, bool bUsePlusForSpace ) +{ + if ( nDestLen < 3*nSourceLen ) + { + pchDest[0] = '\0'; + AssertMsg( false, "Target buffer for Q_URLEncode needs to be 3 times larger than source to guarantee enough space\n" ); + return; + } + + int iDestPos = 0; + for ( int i=0; i < nSourceLen; ++i ) + { + // We allow only a-z, A-Z, 0-9, period, underscore, and hyphen to pass through unescaped. + // These are the characters allowed by both the original RFC 1738 and the latest RFC 3986. + // Current specs also allow '~', but that is forbidden under original RFC 1738. + if ( !( pchSource[i] >= 'a' && pchSource[i] <= 'z' ) && !( pchSource[i] >= 'A' && pchSource[i] <= 'Z' ) && !(pchSource[i] >= '0' && pchSource[i] <= '9' ) + && pchSource[i] != '-' && pchSource[i] != '_' && pchSource[i] != '.' + ) + { + if ( bUsePlusForSpace && pchSource[i] == ' ' ) + { + pchDest[iDestPos++] = '+'; + } + else + { + pchDest[iDestPos++] = '%'; + uint8 iValue = pchSource[i]; + if ( iValue == 0 ) + { + pchDest[iDestPos++] = '0'; + pchDest[iDestPos++] = '0'; + } + else + { + char cHexDigit1 = cIntToHexDigit( iValue % 16 ); + iValue /= 16; + char cHexDigit2 = cIntToHexDigit( iValue ); + pchDest[iDestPos++] = cHexDigit2; + pchDest[iDestPos++] = cHexDigit1; + } + } + } + else + { + pchDest[iDestPos++] = pchSource[i]; + } + } + + // Null terminate + pchDest[iDestPos++] = 0; +} + + +//----------------------------------------------------------------------------- +// Purpose: Internal implementation of decode, works in the strict RFC manner, or +// with spaces turned to + like HTML form encoding. +// +// Returns the amount of space used in the output buffer. +//----------------------------------------------------------------------------- +size_t Q_URLDecodeInternal( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen, bool bUsePlusForSpace ) +{ + if ( nDecodeDestLen < nEncodedSourceLen ) + { + AssertMsg( false, "Q_URLDecode needs a dest buffer at least as large as the source" ); + return 0; + } + + int iDestPos = 0; + for( int i=0; i < nEncodedSourceLen; ++i ) + { + if ( bUsePlusForSpace && pchEncodedSource[i] == '+' ) + { + pchDecodeDest[ iDestPos++ ] = ' '; + } + else if ( pchEncodedSource[i] == '%' ) + { + // Percent signifies an encoded value, look ahead for the hex code, convert to numeric, and use that + + // First make sure we have 2 more chars + if ( i < nEncodedSourceLen - 2 ) + { + char cHexDigit1 = pchEncodedSource[i+1]; + char cHexDigit2 = pchEncodedSource[i+2]; + + // Turn the chars into a hex value, if they are not valid, then we'll + // just place the % and the following two chars direct into the string, + // even though this really shouldn't happen, who knows what bad clients + // may do with encoding. + bool bValid = false; + int iValue = iHexCharToInt( cHexDigit1 ); + if ( iValue != -1 ) + { + iValue *= 16; + int iValue2 = iHexCharToInt( cHexDigit2 ); + if ( iValue2 != -1 ) + { + iValue += iValue2; + pchDecodeDest[ iDestPos++ ] = iValue; + bValid = true; + } + } + + if ( !bValid ) + { + pchDecodeDest[ iDestPos++ ] = '%'; + pchDecodeDest[ iDestPos++ ] = cHexDigit1; + pchDecodeDest[ iDestPos++ ] = cHexDigit2; + } + } + + // Skip ahead + i += 2; + } + else + { + pchDecodeDest[ iDestPos++ ] = pchEncodedSource[i]; + } + } + + // We may not have extra room to NULL terminate, since this can be used on raw data, but if we do + // go ahead and do it as this can avoid bugs. + if ( iDestPos < nDecodeDestLen ) + { + pchDecodeDest[iDestPos] = 0; + } + + return (size_t)iDestPos; +} + +//----------------------------------------------------------------------------- +// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +//----------------------------------------------------------------------------- +void Q_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return Q_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, true ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +//----------------------------------------------------------------------------- +size_t Q_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return Q_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, true ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version will not encode space as + (which HTML form encoding uses despite not being part of the RFC) +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +//----------------------------------------------------------------------------- +void Q_URLEncodeRaw( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return Q_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, false ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version will not recognize + as a space (which HTML form encoding uses despite not being part of the RFC) +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +//----------------------------------------------------------------------------- +size_t Q_URLDecodeRaw( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return Q_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, false ); +} + #if defined( LINUX ) || defined( _PS3 ) extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void * context ); #endif diff --git a/mp/src/tier1/utlbuffer.cpp b/mp/src/tier1/utlbuffer.cpp index ff086171..55dd8f6b 100644 --- a/mp/src/tier1/utlbuffer.cpp +++ b/mp/src/tier1/utlbuffer.cpp @@ -1730,7 +1730,6 @@ void CUtlBuffer::Swap( CUtlMemory &mem ) CUtlInplaceBuffer::CUtlInplaceBuffer( int growSize /* = 0 */, int initSize /* = 0 */, int nFlags /* = 0 */ ) : CUtlBuffer( growSize, initSize, nFlags ) { - NULL; } bool CUtlInplaceBuffer::InplaceGetLinePtr( char **ppszInBufferPtr, int *pnLineLength ) diff --git a/mp/src/tier1/utlsymbol.cpp b/mp/src/tier1/utlsymbol.cpp index 4023156d..d75eaa52 100644 --- a/mp/src/tier1/utlsymbol.cpp +++ b/mp/src/tier1/utlsymbol.cpp @@ -225,7 +225,7 @@ CUtlSymbol CUtlSymbolTable::AddString( const char* pString ) if (id.IsValid()) return id; - int len = strlen(pString) + 1; + int len = V_strlen(pString) + 1; // Find a pool with space for this string, or allocate a new one. int iPool = FindPoolWithSpace( len ); diff --git a/mp/src/utils/captioncompiler/captioncompiler.cpp b/mp/src/utils/captioncompiler/captioncompiler.cpp index 0fee3529..e7369c18 100644 --- a/mp/src/utils/captioncompiler/captioncompiler.cpp +++ b/mp/src/utils/captioncompiler/captioncompiler.cpp @@ -91,7 +91,7 @@ void vprint( int depth, const char *fmt, ... ) } } - ::printf( string ); + ::printf( "%s", string ); OutputDebugString( string ); if ( fp ) diff --git a/mp/src/utils/glview/glview.vpc b/mp/src/utils/glview/glview.vpc index fa7f180c..4a519e8b 100644 --- a/mp/src/utils/glview/glview.vpc +++ b/mp/src/utils/glview/glview.vpc @@ -20,7 +20,6 @@ $Configuration $Linker { $AdditionalDependencies "$BASE glu32.lib opengl32.lib odbc32.lib odbccp32.lib winmm.lib" - $AdditionalDependencies "$BASE glaux.lib" [!$VS2010] } } diff --git a/mp/src/utils/vice/vice.cpp b/mp/src/utils/vice/vice.cpp index 56c6d069..1697c60d 100644 --- a/mp/src/utils/vice/vice.cpp +++ b/mp/src/utils/vice/vice.cpp @@ -49,7 +49,7 @@ static void Pause( void ) static void Exit(const char *msg) { - fprintf( stderr, msg ); + fprintf( stderr, "%s", msg ); Pause(); exit( -1 ); } diff --git a/mp/src/utils/vrad/disp_vrad.cpp b/mp/src/utils/vrad/disp_vrad.cpp index b254b9d7..b1d63b6e 100644 --- a/mp/src/utils/vrad/disp_vrad.cpp +++ b/mp/src/utils/vrad/disp_vrad.cpp @@ -46,7 +46,7 @@ int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vTest ) } -int GetAllNeighbors( const CCoreDispInfo *pDisp, int iNeighbors[512] ) +int GetAllNeighbors( const CCoreDispInfo *pDisp, int (&iNeighbors)[512] ) { int nNeighbors = 0; @@ -57,7 +57,7 @@ int GetAllNeighbors( const CCoreDispInfo *pDisp, int iNeighbors[512] ) for ( int i=0; i < pCorner->m_nNeighbors; i++ ) { - if ( nNeighbors < _ARRAYSIZE( iNeighbors ) ) + if ( nNeighbors < ARRAYSIZE( iNeighbors ) ) iNeighbors[nNeighbors++] = pCorner->m_Neighbors[i]; } } diff --git a/mp/src/utils/vrad/vrad.cpp b/mp/src/utils/vrad/vrad.cpp index 70e481fb..a7cba1c0 100644 --- a/mp/src/utils/vrad/vrad.cpp +++ b/mp/src/utils/vrad/vrad.cpp @@ -34,7 +34,7 @@ every surface must be divided into at least two patches each axis */ CUtlVector g_Patches; -CUtlVector g_FacePatches; // constains all patches, children first +CUtlVector g_FacePatches; // contains all patches, children first CUtlVector faceParents; // contains only root patches, use next parent to iterate CUtlVector clusterChildren; CUtlVector emitlight; @@ -2408,12 +2408,13 @@ int ParseCommandLine( int argc, char **argv, bool *onlydetail ) { if ( ++i < argc ) { - numbounce = atoi (argv[i]); - if ( numbounce < 0 ) + int bounceParam = atoi (argv[i]); + if ( bounceParam < 0 ) { Warning("Error: expected non-negative value after '-bounce'\n" ); return 1; } + numbounce = (unsigned)bounceParam; } else { diff --git a/mp/src/utils/vtf2tga/vtf2tga.cpp b/mp/src/utils/vtf2tga/vtf2tga.cpp index acdace83..c06999b0 100644 --- a/mp/src/utils/vtf2tga/vtf2tga.cpp +++ b/mp/src/utils/vtf2tga/vtf2tga.cpp @@ -37,7 +37,7 @@ static void PFMWrite( float *pFloatImage, const char *pFilename, int width, int SpewRetval_t VTF2TGAOutputFunc( SpewType_t spewType, char const *pMsg ) { - printf( pMsg ); + printf( "%s", pMsg ); fflush( stdout ); if (spewType == SPEW_ERROR) diff --git a/mp/src/vgui2/chromehtml/html_chrome.cpp b/mp/src/vgui2/chromehtml/html_chrome.cpp index 37ba4f74..83ea654c 100644 --- a/mp/src/vgui2/chromehtml/html_chrome.cpp +++ b/mp/src/vgui2/chromehtml/html_chrome.cpp @@ -2079,7 +2079,12 @@ void CClientHandler::OnLoadEnd(CefRefPtr browser, { CHTMLProtoBufMsg cmd( eHTMLCommands_FinishedRequest ); - cmd.Body().set_url( CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ); + + if ( browser->GetMainFrame()->GetURL().size() > 0 ) + cmd.Body().set_url( CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ); + else + cmd.Body().set_url( "" ); + CefString frameName = browser->GetMainFrame()->GetName(); if ( !frameName.empty() ) cmd.Body().set_pagetitle( frameName.c_str() ); @@ -2221,6 +2226,9 @@ bool CClientHandler::OnBeforeResourceLoad(CefRefPtr browser, CefRefPtr response, int loadFlags) { + if ( request->GetURL().size() == 0 ) + return false; + CHTMLProtoBufMsg cmd( eHTMLCommands_LoadingResource ); cmd.Body().set_url( CStrAutoEncode( request->GetURL().c_str() ).ToString() ); DISPATCH_MESSAGE( eHTMLCommands_LoadingResource ); @@ -3022,42 +3030,43 @@ void CClientHandler::RequestScreenShot( const CHTMLProtoBufMsg browser, const byte *pRGBA, int wide, int tall ) { - if ( m_Snapshot.m_sURLSnapshot.IsValid() && wide && tall - && m_Snapshot.m_sURLSnapshot == CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ) + if ( m_Snapshot.m_sURLSnapshot.IsValid() && wide && tall && ( browser->GetMainFrame()->GetURL().size() > 0 ) ) { - VPROF_BUDGET( "CClientHandler::SavePageToJPEGIfNeeded", VPROF_BUDGETGROUP_TENFOOT ); - - CUtlBuffer bufRGB; - - bufRGB.Put( pRGBA, wide * tall *4 ); - if ( !BConvertRGBAToRGB( bufRGB, wide, tall ) ) - return; - - BResizeImageRGB( bufRGB, wide, tall, m_Snapshot.m_nWide, m_Snapshot.m_nTall ); - // input format is actually BGRA so now swizzle to rgb - byte *pBGR = (byte *)bufRGB.Base(); - for ( int i = 0; i < m_Snapshot.m_nTall; i++ ) + if ( m_Snapshot.m_sURLSnapshot == CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ) { - for ( int j = 0; j < m_Snapshot.m_nWide; j++ ) + VPROF_BUDGET( "CClientHandler::SavePageToJPEGIfNeeded", VPROF_BUDGETGROUP_TENFOOT ); + + CUtlBuffer bufRGB; + + bufRGB.Put( pRGBA, wide * tall *4 ); + if ( !BConvertRGBAToRGB( bufRGB, wide, tall ) ) + return; + + BResizeImageRGB( bufRGB, wide, tall, m_Snapshot.m_nWide, m_Snapshot.m_nTall ); + // input format is actually BGRA so now swizzle to rgb + byte *pBGR = (byte *)bufRGB.Base(); + for ( int i = 0; i < m_Snapshot.m_nTall; i++ ) { - char cR = pBGR[0]; - pBGR[0] = pBGR[2]; - pBGR[2] = cR; - pBGR += 3; + for ( int j = 0; j < m_Snapshot.m_nWide; j++ ) + { + char cR = pBGR[0]; + pBGR[0] = pBGR[2]; + pBGR[2] = cR; + pBGR += 3; + } } - } - if ( !ConvertRGBToJpeg( m_Snapshot.m_sFileNameSnapshot, k_ScreenshotQuality, m_Snapshot.m_nWide, m_Snapshot.m_nTall, bufRGB ) ) - return; + if ( !ConvertRGBToJpeg( m_Snapshot.m_sFileNameSnapshot, k_ScreenshotQuality, m_Snapshot.m_nWide, m_Snapshot.m_nTall, bufRGB ) ) + return; - CHTMLProtoBufMsg cmd( eHTMLCommands_SavePageToJPEGResponse ); - cmd.Body().set_url( m_Snapshot.m_sURLSnapshot ); - cmd.Body().set_filename( m_Snapshot.m_sFileNameSnapshot ); - DISPATCH_MESSAGE( eHTMLCommands_SavePageToJPEGResponse ); - - m_Snapshot.m_sURLSnapshot.Clear(); - m_Snapshot.m_flRequestTimeout = 0.0f; + CHTMLProtoBufMsg cmd( eHTMLCommands_SavePageToJPEGResponse ); + cmd.Body().set_url( m_Snapshot.m_sURLSnapshot ); + cmd.Body().set_filename( m_Snapshot.m_sFileNameSnapshot ); + DISPATCH_MESSAGE( eHTMLCommands_SavePageToJPEGResponse ); + m_Snapshot.m_sURLSnapshot.Clear(); + m_Snapshot.m_flRequestTimeout = 0.0f; + } } } diff --git a/mp/src/vgui2/vgui_controls/Panel.cpp b/mp/src/vgui2/vgui_controls/Panel.cpp index 3f3634fe..369e00c4 100644 --- a/mp/src/vgui2/vgui_controls/Panel.cpp +++ b/mp/src/vgui2/vgui_controls/Panel.cpp @@ -3911,7 +3911,7 @@ void Panel::PinToSibling( const char *pszSibling, PinCorner_e pinOurCorner, PinC _pinCornerToSibling = pinOurCorner; _pinToSiblingCorner = pinSibling; - if ( _pinToSibling && pszSibling && !Q_strcmp( _pinToSibling, pszSibling ) ) + if ( m_pinSibling.Get() && _pinToSibling && pszSibling && !Q_strcmp( _pinToSibling, pszSibling ) ) return; if (_pinToSibling) diff --git a/mp/src/vgui2/vgui_controls/PanelListPanel.cpp b/mp/src/vgui2/vgui_controls/PanelListPanel.cpp index 51fe8ab9..355ac08f 100644 --- a/mp/src/vgui2/vgui_controls/PanelListPanel.cpp +++ b/mp/src/vgui2/vgui_controls/PanelListPanel.cpp @@ -24,6 +24,8 @@ using namespace vgui; +DECLARE_BUILD_FACTORY( PanelListPanel ); + //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- @@ -135,7 +137,7 @@ Panel *PanelListPanel::GetCellRenderer( int row ) // data->GetName() is used to uniquely identify an item // data sub items are matched against column header name to be used in the table //----------------------------------------------------------------------------- -int PanelListPanel::AddItem( Panel *labelPanel, Panel *panel) +int PanelListPanel::AddItem( Panel *labelPanel, Panel *panel ) { Assert(panel); diff --git a/mp/src/vgui2/vgui_controls/RadioButton.cpp b/mp/src/vgui2/vgui_controls/RadioButton.cpp index 5d0dbeef..0b5d81d2 100644 --- a/mp/src/vgui2/vgui_controls/RadioButton.cpp +++ b/mp/src/vgui2/vgui_controls/RadioButton.cpp @@ -115,7 +115,7 @@ void RadioButton::ApplySchemeSettings(IScheme *pScheme) SetContentAlignment(a_west); // reloading the scheme wipes out lists of images - _radioBoxImage->SetFont( pScheme->GetFont("Marlett", IsProportional()) ); + _radioBoxImage->SetFont( pScheme->GetFont("MarlettSmall", IsProportional()) ); _radioBoxImage->ResizeImageToContent(); SetImageAtIndex(0, _radioBoxImage, 0); diff --git a/mp/src/vgui2/vgui_controls/TextEntry.cpp b/mp/src/vgui2/vgui_controls/TextEntry.cpp index 7a4f2d8c..825cb4ab 100644 --- a/mp/src/vgui2/vgui_controls/TextEntry.cpp +++ b/mp/src/vgui2/vgui_controls/TextEntry.cpp @@ -1637,7 +1637,7 @@ void TextEntry::OnKeyCodePressed(KeyCode code) // Pass on the joystick and mouse codes if ( IsMouseCode(code) || IsNovintButtonCode(code) || IsJoystickCode(code) || IsJoystickButtonCode(code) || - IsJoystickPOVCode(code) || IsJoystickPOVCode(code) || IsJoystickAxisCode(code) ) + IsJoystickPOVCode(code) || IsJoystickAxisCode(code) ) { Panel::OnKeyCodePressed( code ); return; diff --git a/mp/src/vpc_scripts/source_dll_base.vpc b/mp/src/vpc_scripts/source_dll_base.vpc index 16e565ec..f8d90184 100644 --- a/mp/src/vpc_scripts/source_dll_base.vpc +++ b/mp/src/vpc_scripts/source_dll_base.vpc @@ -10,7 +10,7 @@ $Include "$SRCDIR\vpc_scripts\source_video_base.vpc" $Configuration { - $General [$VS2010] + $General { $TargetExtension "$OUTDLLEXT" } @@ -20,6 +20,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } diff --git a/mp/src/vpc_scripts/source_dll_win32_base.vpc b/mp/src/vpc_scripts/source_dll_win32_base.vpc index 1507687e..cec539ad 100644 --- a/mp/src/vpc_scripts/source_dll_win32_base.vpc +++ b/mp/src/vpc_scripts/source_dll_win32_base.vpc @@ -24,7 +24,7 @@ $IgnoreRedundancyWarning "ON" // Common Configuration $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTBINNAME" } @@ -50,6 +50,7 @@ $Configuration // Suppress this pointless warning using the undocumented /ignore linker switch // schemalib.lib(schemaclassinfo.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library $AdditionalOptions "$BASE /ignore:4221" + $AdditionalOptions "$BASE $SRCDIR\lib\public\ftol3.obj" [$VS2013 && $WIN32 && !$DISABLE_FTOL3_OVERRIDE && !$SOURCESDK] // Work around CRT bug https://connect.microsoft.com/VisualStudio/feedback/details/806362/vc12-pollutes-the-floating-point-stack-when-casting-infinity-nan-to-unsigned-long# } $PreBuildEvent @@ -105,8 +106,8 @@ $Project } // Implement __imp__EncodePointer and __imp__DecodePointer so that we can run on XP SP1 - // when building with VS 2010. - $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32 && $VS2010] + // when building with VS 2010 and higher. + $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32] { $Configuration { diff --git a/mp/src/vpc_scripts/source_dll_win32_debug.vpc b/mp/src/vpc_scripts/source_dll_win32_debug.vpc index aa8ebf13..c5b786d2 100644 --- a/mp/src/vpc_scripts/source_dll_win32_debug.vpc +++ b/mp/src/vpc_scripts/source_dll_win32_debug.vpc @@ -166,7 +166,6 @@ $Configuration "Debug" $ManifestFile $AdditionalManifestDependencies $AllowIsolation - //$UACExecutionLevel [$VS2010] // Debugging $GenerateDebugInfo "Yes (/DEBUG)" diff --git a/mp/src/vpc_scripts/source_dll_win32_release.vpc b/mp/src/vpc_scripts/source_dll_win32_release.vpc index 916045f5..880e5efc 100644 --- a/mp/src/vpc_scripts/source_dll_win32_release.vpc +++ b/mp/src/vpc_scripts/source_dll_win32_release.vpc @@ -82,7 +82,7 @@ $Configuration "Release" // Preprocessor $PreprocessorDefinitions "$BASE;WIN32;_WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions)" - $PreprocessorDefinitions "$BASE;RELEASE_ASSERTS" [$RELEASEASSERTS] + $PreprocessorDefinitions "$BASE;RELEASEASSERTS" [$RELEASEASSERTS] $IgnoreStandardIncludePath $GeneratePreprocessedFile $KeepComments @@ -143,7 +143,7 @@ $Configuration "Release" $AdditionalOptions "/Zm200" // Enable extra debugging information. - $AdditionalOptions "$BASE /d2Zi+" [$VS2010] + $AdditionalOptions "$BASE /d2Zi+" $AdditionalOptions "$BASE /Oy-" [$NOFPO] } diff --git a/mp/src/vpc_scripts/source_exe_base.vpc b/mp/src/vpc_scripts/source_exe_base.vpc index e19d07f8..c6ffafaa 100644 --- a/mp/src/vpc_scripts/source_exe_base.vpc +++ b/mp/src/vpc_scripts/source_exe_base.vpc @@ -15,6 +15,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } \ No newline at end of file diff --git a/mp/src/vpc_scripts/source_exe_con_base.vpc b/mp/src/vpc_scripts/source_exe_con_base.vpc index 04c3f4e1..f1521ecd 100644 --- a/mp/src/vpc_scripts/source_exe_con_base.vpc +++ b/mp/src/vpc_scripts/source_exe_con_base.vpc @@ -13,6 +13,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } diff --git a/mp/src/vpc_scripts/source_exe_con_win32_base.vpc b/mp/src/vpc_scripts/source_exe_con_win32_base.vpc index 3dfa9e29..bd9736e6 100644 --- a/mp/src/vpc_scripts/source_exe_con_win32_base.vpc +++ b/mp/src/vpc_scripts/source_exe_con_win32_base.vpc @@ -14,7 +14,7 @@ $Include "$SRCDIR\vpc_scripts\source_exe_win_win32_base.vpc" $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTBINNAME" } diff --git a/mp/src/vpc_scripts/source_exe_win_win32_base.vpc b/mp/src/vpc_scripts/source_exe_win_win32_base.vpc index 22b3896f..47ce40fd 100644 --- a/mp/src/vpc_scripts/source_exe_win_win32_base.vpc +++ b/mp/src/vpc_scripts/source_exe_win_win32_base.vpc @@ -24,7 +24,7 @@ $IgnoreRedundancyWarning "ON" // Common Configuration $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTBINNAME" } @@ -53,6 +53,7 @@ $Configuration // Suppress this pointless warning using the undocumented /ignore linker switch // schemalib.lib(schemaclassinfo.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library $AdditionalOptions "$BASE /ignore:4221" + $AdditionalOptions "$BASE $SRCDIR\lib\public\ftol3.obj" [$VS2013 && $WIN32 && !$DISABLE_FTOL3_OVERRIDE && !$SOURCESDK] // Work around CRT bug https://connect.microsoft.com/VisualStudio/feedback/details/806362/vc12-pollutes-the-floating-point-stack-when-casting-infinity-nan-to-unsigned-long# } $PreBuildEvent @@ -100,8 +101,8 @@ $Project } // Implement __imp__EncodePointer and __imp__DecodePointer so that we can run on XP SP1 - // when building with VS 2010. - $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32 && $VS2010] + // when building with VS 2010 and higher. + $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32] { $Configuration { diff --git a/mp/src/vpc_scripts/source_exe_win_win32_debug.vpc b/mp/src/vpc_scripts/source_exe_win_win32_debug.vpc index 302d80e9..399d1761 100644 --- a/mp/src/vpc_scripts/source_exe_win_win32_debug.vpc +++ b/mp/src/vpc_scripts/source_exe_win_win32_debug.vpc @@ -246,7 +246,7 @@ $Configuration "Debug" $UseFAT32WorkAround // Input And Output - $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [$VS2010 && !$SOURCESDK] + $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [!$SOURCESDK] $InputResourceManifests $EmbedManifest $OutputManifestFile diff --git a/mp/src/vpc_scripts/source_exe_win_win32_release.vpc b/mp/src/vpc_scripts/source_exe_win_win32_release.vpc index d3370146..6cb5c335 100644 --- a/mp/src/vpc_scripts/source_exe_win_win32_release.vpc +++ b/mp/src/vpc_scripts/source_exe_win_win32_release.vpc @@ -142,7 +142,7 @@ $Configuration "Release" $ErrorReporting "Prompt Immediately (/errorReport:prompt)" // Enable extra debugging information. - $AdditionalOptions "$BASE /d2Zi+" [$VS2010] + $AdditionalOptions "$BASE /d2Zi+" // Command Line $AdditionalOptions "$BASE /Oy-" [$NOFPO] } @@ -264,7 +264,7 @@ $Configuration "Release" $UseFAT32WorkAround // Input And Output - $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [$VS2010 && !$SOURCESDK] + $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [!$SOURCESDK] $InputResourceManifests $EmbedManifest $OutputManifestFile diff --git a/mp/src/vpc_scripts/source_lib_base.vpc b/mp/src/vpc_scripts/source_lib_base.vpc index 07014b44..851609eb 100644 --- a/mp/src/vpc_scripts/source_lib_base.vpc +++ b/mp/src/vpc_scripts/source_lib_base.vpc @@ -17,6 +17,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } diff --git a/mp/src/vpc_scripts/source_lib_win32_base.vpc b/mp/src/vpc_scripts/source_lib_win32_base.vpc index c5f8e0b5..02caa800 100644 --- a/mp/src/vpc_scripts/source_lib_win32_base.vpc +++ b/mp/src/vpc_scripts/source_lib_win32_base.vpc @@ -22,7 +22,7 @@ $IgnoreRedundancyWarning "ON" // Common Configuration $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTLIBNAME" } diff --git a/mp/src/vpc_scripts/source_lib_win32_debug.vpc b/mp/src/vpc_scripts/source_lib_win32_debug.vpc index cefc44f4..d179ecef 100644 --- a/mp/src/vpc_scripts/source_lib_win32_debug.vpc +++ b/mp/src/vpc_scripts/source_lib_win32_debug.vpc @@ -23,8 +23,7 @@ $Configuration "Debug" $General { // General - $OutputDirectory ".\Debug$_SUBDIRSUFFIX" [!$VS2010] - $OutputDirectory "$OUTLIBDIR" [$VS2010] + $OutputDirectory "$OUTLIBDIR" $IntermediateDirectory ".\Debug$_SUBDIRSUFFIX" $ExtensionsToDeleteOnClean $BuildLogFile diff --git a/mp/src/vpc_scripts/source_lib_win32_release.vpc b/mp/src/vpc_scripts/source_lib_win32_release.vpc index b6f54059..cbfe4cab 100644 --- a/mp/src/vpc_scripts/source_lib_win32_release.vpc +++ b/mp/src/vpc_scripts/source_lib_win32_release.vpc @@ -27,10 +27,7 @@ $Configuration "Release" $General { // General - $OutputDirectory ".\Release$_SUBDIRSUFFIX" [!$VS2010 && !$RETAIL && !$PROFILE] - $OutputDirectory ".\Retail$_SUBDIRSUFFIX" [!$VS2010 && $RETAIL] - $OutputDirectory ".\Profile$_SUBDIRSUFFIX" [!$VS2010 && !$RETAIL && $PROFILE] - $OutputDirectory "$OUTLIBDIR" [$VS2010] + $OutputDirectory "$OUTLIBDIR" $IntermediateDirectory ".\Release$_SUBDIRSUFFIX" [!$RETAIL && !$PROFILE] $IntermediateDirectory ".\Retail$_SUBDIRSUFFIX" [$RETAIL] $IntermediateDirectory ".\Profile$_SUBDIRSUFFIX" [!$RETAIL && $PROFILE] @@ -83,7 +80,7 @@ $Configuration "Release" // Preprocessor $PreprocessorDefinitions "$BASE;WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions)" - $PreprocessorDefinitions "$BASE;RELEASE_ASSERTS" [$RELEASEASSERTS] + $PreprocessorDefinitions "$BASE;RELEASEASSERTS" [$RELEASEASSERTS] $IgnoreStandardIncludePath $GeneratePreprocessedFile $KeepComments @@ -143,7 +140,7 @@ $Configuration "Release" $ErrorReporting "Prompt Immediately (/errorReport:prompt)" // Enable extra debugging information. - $AdditionalOptions "/d2Zi+" [$VS2010] + $AdditionalOptions "/d2Zi+" $AdditionalOptions "$BASE /Oy-" [$NOFPO] } diff --git a/mp/src/vpc_scripts/source_win32_analyze.vpc b/mp/src/vpc_scripts/source_win32_analyze.vpc new file mode 100644 index 00000000..ceb6e0b0 --- /dev/null +++ b/mp/src/vpc_scripts/source_win32_analyze.vpc @@ -0,0 +1,65 @@ +// /analyze specific settings. Placed here so that they can be changed without triggering rebuilds of the entire world. + +$Configuration +{ + $Compiler + { + // When using /analyze (triggered with /define:ANALYZE on the vpc command line) we want to forcibly disable lots + // of warnings. + // warning C6308: 'realloc' might return null pointer, cause the original memory block to be leaked + // warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead + // warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'GetProcAddress' + // warning C6309: Argument '1' is null: this does not adhere to function specification of 'GetProcAddress' + // warning C6011: Dereferencing NULL pointer 'm_ppTestCases' + // warning C6211: Leaking memory 'newKeyValue' due to an exception. Consider using a local catch block to clean up memory + // These warnings are because /analyze doesn't like our use of constants, especially things like IsPC() + // warning C6326: Potential comparison of a constant with another constant + // warning C6239: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? + // warning C6285: ( || ) is always a non-zero constant. Did you intend to use the bitwise-and operator? + // warning C6237: ( && ) is always zero. is never evaluated and might have side effects + // warning C6235: ( || ) is always a non-zero constant + // warning C6240: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? + // These warnings aren't really important: + // warning C6323: Use of arithmetic operator on Boolean type(s) + // /analyze doesn't like GCOMPILER_ASSERT's implementation of compile-time asserts + // warning C6326: Potential comparison of a constant with another constant + // warning C6335: Leaking process information handle 'pi.hThread' + // warning C6320: Exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were not intended to be handled + // warning C6250: Calling 'VirtualFree' without the MEM_RELEASE flag might free memory but not address descriptors (VADs). This causes address space leaks + // warning C6384: Dividing sizeof a pointer by another value + // warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH -- bogus + // warning C6322: Empty _except block + + // Set the stack size threshold to 100,000 to avoid noisy warnings on functions with modest stack usage + // Note that /analyze for VS 2010 only works with the 32-bit compiler, but for VS 2012 it works on 64-bit + // as well. + $DisableSpecificWarnings "$BASE;6308;6255;6387;6309;6011;6211;6326;6239;6285;6237;6235;6240;6323;6326;6335;6320;6250;6384;6318;6322" [$ANALYZE] + // See http://randomascii.wordpress.com/2011/10/04/analyzecommand-line-options/ for details on these options. + // /analyze:only may result in fewer warnings being reported, but the warnings it misses should show up in the regular build. + $AdditionalOptions "$BASE /analyze /analyze:only /analyze:stacksize100000" [$ANALYZE] + + // Specify /define:ALLOWSHADOWING to suppress variable shadowing warnings + $DisableSpecificWarnings "$BASE;6244;6246" [$ANALYZE && $ALLOWSHADOWING] + + // New warnings in VS 2012 that we want to ignore. + // warning C4005: 'DXGI_STATUS_OCCLUDED' : macro redefinition + // warning C6014: Leaking memory 'pThinkParams'. + // warning C28159: Consider using 'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount overflows roughly every 49 days. + // warning C28182: Dereferencing NULL pointer. 'pPropMesh' contains the same NULL value as '(CMesh *)=(pPropMesh)' did. + // warning C28183: 'entropy->ac_count_ptrs[actbl]' could be '0', and is a copy of the value found in 'entropy->dc_count_ptrs[dctbl]': this does not adhere to the specification for the function 'memset'. + // warning C28197: Possibly leaking memory 'pInfo'. + // warning C28198: Possibly leaking memory 'kvFrame1' due to an exception. Is a local catch block needed to clean up memory? + // warning C28204: 'QueryInterface' : Only one of this overload and the one at c:\program files (x86)\windows kits\8.0\include\um\unknwnbase.h(114) are annotated for _Param_(2): both or neither must be annotated. + // warning C28247: Model file annotation for function '_vsnprintf': annotation on _Param_(1)/SAL_post, 'RequiresZeroTermination' duplicates header file annotation 'SAL_nullTerminated'. Remove the duplicated annotations from the model file. (Header: c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(349).) + // warning C28251: Inconsistent annotation for 'WinMain': this instance has no annotations. See c:\program files (x86)\windows kits\8.0\include\um\winbase.h(2286). + // warning C28301: No annotations for first declaration of 'InitializeCriticalSection'. See d:\clients\tf3\staging\src\public\tier0\threadtools.h(1373). + // warning C28195: The function was declared as acquiring memory in 'return' and exited without doing so. + // warning C6340: Mismatch on sign: 'unsigned short' passed as parameter '6' when some signed type is required in call to 'V_snprintf'. + // This warning only applies to Windows XP in low-memory situations: + // warning C28125: The function 'InitializeCriticalSection' must be called from within a try\except block + // warning C28160: Error annotation: Calling VirtualFreeEx without the MEM_RELEASE flag frees memory but not address descriptors (VADs); results in address space leaks. + // warning C6248: Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. + // warning C6102: Using value from failed function call + $DisableSpecificWarnings "$BASE;6014;28159;28182;28183;28197;28198;28204;28247;28251;28301;28195;6340;28125;28160;6248;6102" [$ANALYZE && ($VS2012 || $VS2013)] + } +} diff --git a/mp/src/vpc_scripts/source_win32_base.vpc b/mp/src/vpc_scripts/source_win32_base.vpc index 3749a07a..245366f4 100644 --- a/mp/src/vpc_scripts/source_win32_base.vpc +++ b/mp/src/vpc_scripts/source_win32_base.vpc @@ -1,3 +1,8 @@ +// Settings for /analyze are in a separate .vpc file so that they can be +// changed without triggering a full rebuild of non-analyze builds. On non-analyze +// builds the analyze.vpc file will not be listed as a dependency. +$Include "$SRCDIR\vpc_scripts\source_win32_analyze.vpc" [$ANALYZE] + $Configuration { $General @@ -27,45 +32,23 @@ $Configuration // warning C4316: object allocated on the heap may not be aligned 16 $DisableSpecificWarnings "$BASE;4316" [$VS2013] - // When using /analyze (triggered with /define:ANALYZE on the vpc command line) we want to forcibly disable lots - // of warnings (also disabled in platform.h but not everybody includes that). - // See platform.h for the list of warnings with explanations. - // warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH -- bogus - // warning C6322: Empty _except block - // Set the stack size threshold to 100,000 to avoid noisy warnings on functions with modest stack usage - // Note that /analyze for VS 2010 only works with the 32-bit compiler, but for VS 2012 it works on 64-bit - // as well. - $DisableSpecificWarnings "$BASE;6308;6255;6387;6309;6011;6211;6031;6326;6239;6285;6237;6235;6240;6323;6326;6335;6320;6250;6384;6318;6322" [$ANALYZE] - // See http://randomascii.wordpress.com/2011/10/04/analyzecommand-line-options/ for details on these options. - // /analyze:only may result in fewer warnings being reported, but the warnings it misses should show up in the regular build. - $AdditionalOptions "$BASE /analyze /analyze:only /analyze:stacksize100000" [$ANALYZE] - - // Specify /define:ALLOWSHADOWING to suppress variable shadowing warnings - $DisableSpecificWarnings "$BASE;6244;6246" [$ANALYZE && $ALLOWSHADOWING] - - // New warnings in VS 2012 that we want to ignore. - // warning C4005: 'DXGI_STATUS_OCCLUDED' : macro redefinition - // warning C6014: Leaking memory 'pThinkParams'. - // warning C28159: Consider using 'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount overflows roughly every 49 days. - // warning C28182: Dereferencing NULL pointer. 'pPropMesh' contains the same NULL value as '(CMesh *)=(pPropMesh)' did. - // warning C28183: 'entropy->ac_count_ptrs[actbl]' could be '0', and is a copy of the value found in 'entropy->dc_count_ptrs[dctbl]': this does not adhere to the specification for the function 'memset'. - // warning C28197: Possibly leaking memory 'pInfo'. - // warning C28198: Possibly leaking memory 'kvFrame1' due to an exception. Is a local catch block needed to clean up memory? - // warning C28204: 'QueryInterface' : Only one of this overload and the one at c:\program files (x86)\windows kits\8.0\include\um\unknwnbase.h(114) are annotated for _Param_(2): both or neither must be annotated. - // warning C28247: Model file annotation for function '_vsnprintf': annotation on _Param_(1)/SAL_post, 'RequiresZeroTermination' duplicates header file annotation 'SAL_nullTerminated'. Remove the duplicated annotations from the model file. (Header: c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(349).) - // warning C28251: Inconsistent annotation for 'WinMain': this instance has no annotations. See c:\program files (x86)\windows kits\8.0\include\um\winbase.h(2286). - // warning C28301: No annotations for first declaration of 'InitializeCriticalSection'. See d:\clients\tf3\staging\src\public\tier0\threadtools.h(1373). - // warning C28195: The function was declared as acquiring memory in 'return' and exited without doing so. - // warning C6340: Mismatch on sign: 'unsigned short' passed as parameter '6' when some signed type is required in call to 'V_snprintf'. - // This warning only applies to Windows XP in low-memory situations: - // warning C28125: The function 'InitializeCriticalSection' must be called from within a try\except block - // warning C28160: Error annotation: Calling VirtualFreeEx without the MEM_RELEASE flag frees memory but not address descriptors (VADs); results in address space leaks. - // warning C6248: Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. - // warning C6102: Using value from failed function call - $DisableSpecificWarnings "$BASE;6014;28159;28182;28183;28197;28198;28204;28247;28251;28301;28195;6340;28125;28160;6248;6102" [$ANALYZE && ($VS2012 || $VS2013)] + // Having lots of warnings makes it harder to notice new, and possibly + // important warnings, both on buildbot and in the output window. Lots + // of warnings also makes it harder to skip through errors in the output + // window since F8 stops on both warnings and errors. The only way to + // keep the warning count down is to have warnings-as-errors. + // We will not be warning free on 64-bit for a while... + $TreatWarningsAsErrors "Yes (/WX)" [!$ANALYZE && !$WIN64] // Defines to differentiate 32 from 64 bit builds $PreprocessorDefinitions "$BASE;PLATFORM_64BITS;WIN64;_WIN64;COMPILER_MSVC64" [$WIN64] $PreprocessorDefinitions "$BASE;COMPILER_MSVC32" [$WIN32] + + // /Gw is a VS 2013 option that puts global and static variables in individual sections so that the + // linker can discard unreferenced data. When building @client /dota with linker optimizations this + // reduces the client.dll size by about 1.14%. When linker optimizations are disabled this has no + // effect. This option does not show up in the IDE so we need to add it in $AdditionalOptions. + // http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx + $AdditionalOptions "$BASE /Gw" [$VS2013] } } diff --git a/sp/game/mod_episodic/gameinfo.txt b/sp/game/mod_episodic/gameinfo.txt index 0f815c52..7a3d1853 100644 --- a/sp/game/mod_episodic/gameinfo.txt +++ b/sp/game/mod_episodic/gameinfo.txt @@ -3,6 +3,7 @@ game "My First Episodic Mod" title "HALF-LIFE'" title2 "" + supportsvr 1 type singleplayer_only diff --git a/sp/game/mod_hl2/gameinfo.txt b/sp/game/mod_hl2/gameinfo.txt index 5a23e26a..daecc352 100644 --- a/sp/game/mod_hl2/gameinfo.txt +++ b/sp/game/mod_hl2/gameinfo.txt @@ -3,6 +3,7 @@ game "My First HL2 Mod" title "HALF-LIFE'" title2 "" + supportsvr 1 type singleplayer_only diff --git a/sp/src/common/qlimits.h b/sp/src/common/qlimits.h index 59bdde2f..205053a8 100644 --- a/sp/src/common/qlimits.h +++ b/sp/src/common/qlimits.h @@ -24,7 +24,7 @@ // Resource counts; -#define MAX_MODEL_INDEX_BITS 11 // sent as a short +#define MAX_MODEL_INDEX_BITS 12 // sent as a short #define MAX_MODELS (1<pSeqdesc( GetSequence() ) ); diff --git a/sp/src/game/client/c_colorcorrection.cpp b/sp/src/game/client/c_colorcorrection.cpp index 56f1a65e..6960031d 100644 --- a/sp/src/game/client/c_colorcorrection.cpp +++ b/sp/src/game/client/c_colorcorrection.cpp @@ -122,7 +122,7 @@ void C_ColorCorrection::ClientThink() return; } - CBaseEntity *pPlayer = UTIL_PlayerByIndex(1); + C_BaseEntity *pPlayer = C_BasePlayer::GetLocalPlayer(); if( !pPlayer ) return; diff --git a/sp/src/game/client/c_func_breakablesurf.cpp b/sp/src/game/client/c_func_breakablesurf.cpp index 03176315..3118cd5e 100644 --- a/sp/src/game/client/c_func_breakablesurf.cpp +++ b/sp/src/game/client/c_func_breakablesurf.cpp @@ -154,7 +154,7 @@ private: Assert( type < NUM_EDGE_STYLES ); Assert( type >= 0 ); // Clear old value - m_nPanelBits[ w ][ h ] &= ( ~0x03 << 2 ); + m_nPanelBits[ w ][ h ] &= 0xF0; // ( ~0x03 << 2 ); Left shifting a negative value has undefined behavior. Use the constant 0xF0 instead. // Insert new value m_nPanelBits[ w ][ h ] |= ( type << 2 ); } diff --git a/sp/src/game/client/c_te_bloodstream.cpp b/sp/src/game/client/c_te_bloodstream.cpp index 2c16e3a1..d543d111 100644 --- a/sp/src/game/client/c_te_bloodstream.cpp +++ b/sp/src/game/client/c_te_bloodstream.cpp @@ -114,7 +114,7 @@ void TE_BloodStream( IRecipientFilter& filter, float delay, float arc = 0.05; int count, count2; float num; - int speedCopy = amount; + float speedCopy = amount; Vector dir; VectorCopy( *direction, dir ); diff --git a/sp/src/game/client/c_te_decal.cpp b/sp/src/game/client/c_te_decal.cpp index 4ea42e5e..f0212ee1 100644 --- a/sp/src/game/client/c_te_decal.cpp +++ b/sp/src/game/client/c_te_decal.cpp @@ -139,7 +139,7 @@ void TE_Decal( IRecipientFilter& filter, float delay, // Only decal the world + brush models // Here we deal with decals on entities. C_BaseEntity* ent; - if ( ( ent = cl_entitylist->GetEnt( entity ) ) == false ) + if ( ( ent = cl_entitylist->GetEnt( entity ) ) == NULL ) return; ent->AddDecal( *start, *pos, *pos, hitbox, diff --git a/sp/src/game/client/cdll_client_int.cpp b/sp/src/game/client/cdll_client_int.cpp index b5a53e72..10cce078 100644 --- a/sp/src/game/client/cdll_client_int.cpp +++ b/sp/src/game/client/cdll_client_int.cpp @@ -1717,7 +1717,11 @@ void CHLClient::LevelShutdown( void ) messagechars->Clear(); +#ifndef TF_CLIENT_DLL + // don't want to do this for TF2 because we have particle systems in our + // character loadout screen that can be viewed when we're not connected to a server g_pParticleSystemMgr->UncacheAllParticleSystems(); +#endif UncacheAllMaterials(); #ifdef _XBOX diff --git a/sp/src/game/client/client_virtualreality.cpp b/sp/src/game/client/client_virtualreality.cpp index d729210e..fb6e4417 100644 --- a/sp/src/game/client/client_virtualreality.cpp +++ b/sp/src/game/client/client_virtualreality.cpp @@ -21,6 +21,7 @@ #include "vgui_controls/Controls.h" #include "tier0/vprof_telemetry.h" #include +#include "steam/steam_api.h" const char *COM_GetModDirectory(); // return the mod dir (rather than the complete -game param, which can be a path) @@ -260,6 +261,8 @@ CClientVirtualReality::CClientVirtualReality() m_rtLastMotionSample = 0; m_bMotionUpdated = false; + m_bForceVRMode = false; + #if defined( USE_SDL ) m_nNonVRSDLDisplayIndex = 0; #endif @@ -1363,28 +1366,32 @@ void CClientVirtualReality::Activate() if( !g_pSourceVR ) return; - // see if VR mode is even enabled - if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) + // These checks don't apply if we're in VR mode because Steam said so. + if ( !m_bForceVRMode ) { - Warning( "Enable VR mode in the video options before trying to use it.\n" ); - return; - } + // see if VR mode is even enabled + if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter == -1 ) + { + Warning( "Enable VR mode in the video options before trying to use it.\n" ); + return; + } - // See if we have an actual adapter - int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter(); - if( nVRModeAdapter == -1 ) - { - Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" ); - return; - } + // See if we have an actual adapter + int32 nVRModeAdapter = g_pSourceVR->GetVRModeAdapter(); + if ( nVRModeAdapter == -1 ) + { + Warning( "Unable to get VRMode adapter from OpenVR. VR mode cannot be enabled. Try restarting and then enabling VR again.\n" ); + return; + } - // we can only activate if we've got a VR device - if( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter ) - { - Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n", - nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter ); - engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" ); - return; + // we can only activate if we've got a VR device + if ( materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter != nVRModeAdapter ) + { + Warning( "VR Mode expects adapter %d which is different from %d which we are currently using. Try restarting and enabling VR mode again.\n", + nVRModeAdapter, materials->GetCurrentConfigForVideoCard().m_nVRModeAdapter ); + engine->ExecuteClientCmd( "mat_enable_vrmode 0\n" ); + return; + } } @@ -1429,18 +1436,22 @@ void CClientVirtualReality::Activate() int nViewportWidth, nViewportHeight; g_pSourceVR->GetViewportBounds( ISourceVirtualReality::VREye_Left, NULL, NULL, &nViewportWidth, &nViewportHeight ); - vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, nViewportWidth, nViewportHeight, g_pSourceVR->GetRenderTarget( ISourceVirtualReality::VREye_Left, ISourceVirtualReality::RT_Color ) ); vgui::ivgui()->SetVRMode( true ); - VRRect_t rect; - if( g_pSourceVR->GetDisplayBounds( &rect ) ) + // we can skip this extra mode change if we've always been in VR mode + if ( !m_bForceVRMode ) { + VRRect_t rect; + if ( g_pSourceVR->GetDisplayBounds( &rect ) ) + { - // set mode - char szCmd[ 256 ]; - Q_snprintf( szCmd, sizeof( szCmd ), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool()? 1 : 0 ); - engine->ClientCmd_Unrestricted( szCmd ); + // set mode + char szCmd[256]; + Q_snprintf( szCmd, sizeof(szCmd), "mat_setvideomode %i %i %i\n", rect.nWidth, rect.nHeight, vr_force_windowed.GetBool() ? 1 : 0 ); + engine->ClientCmd_Unrestricted( szCmd ); + } } } @@ -1455,7 +1466,7 @@ void CClientVirtualReality::Deactivate() g_pMatSystemSurface->ForceScreenSizeOverride(false, 0, 0 ); g_pMaterialSystem->GetRenderContext()->Viewport( 0, 0, m_nNonVRWidth, m_nNonVRHeight ); - vgui::surface()->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( 0, 0, m_nNonVRWidth, m_nNonVRHeight, NULL ); static ConVarRef cl_software_cursor( "cl_software_cursor" ); vgui::surface()->SetSoftwareCursor( cl_software_cursor.GetBool() ); @@ -1499,7 +1510,10 @@ void CClientVirtualReality::Deactivate() // Called when startup is complete void CClientVirtualReality::StartupComplete() { - if( vr_activate_default.GetBool() ) + if ( g_pSourceVR ) + m_bForceVRMode = g_pSourceVR->ShouldForceVRMode(); + + if ( vr_activate_default.GetBool( ) || m_bForceVRMode ) Activate(); } diff --git a/sp/src/game/client/client_virtualreality.h b/sp/src/game/client/client_virtualreality.h index 9aadfeb3..3a8c9469 100644 --- a/sp/src/game/client/client_virtualreality.h +++ b/sp/src/game/client/client_virtualreality.h @@ -147,6 +147,7 @@ private: int m_iAlignTorsoAndViewToWeaponCountdown; bool m_bMotionUpdated; + bool m_bForceVRMode; RTime32 m_rtLastMotionSample; diff --git a/sp/src/game/client/clientmode_shared.cpp b/sp/src/game/client/clientmode_shared.cpp index b6dee29c..5d10db6c 100644 --- a/sp/src/game/client/clientmode_shared.cpp +++ b/sp/src/game/client/clientmode_shared.cpp @@ -228,9 +228,9 @@ static void __MsgFunc_VGUIMenu( bf_read &msg ) && keys->GetInt( "type", 0 ) == 2 // URL message type ) { const char *pszURL = keys->GetString( "msg", "" ); - if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 ) + if ( Q_strncmp( pszURL, "http://", 7 ) != 0 && Q_strncmp( pszURL, "https://", 8 ) != 0 && Q_stricmp( pszURL, "about:blank" ) != 0 ) { - Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://'\n", pszURL ); + Warning( "Blocking MOTD URL '%s'; must begin with 'http://' or 'https://' or be about:blank\n", pszURL ); keys->deleteThis(); return; } diff --git a/sp/src/game/client/detailobjectsystem.cpp b/sp/src/game/client/detailobjectsystem.cpp index 7aa871ea..3e211bb0 100644 --- a/sp/src/game/client/detailobjectsystem.cpp +++ b/sp/src/game/client/detailobjectsystem.cpp @@ -1477,7 +1477,7 @@ void CDetailObjectSystem::LevelInitPreEntity() PrecacheMaterial( DETAIL_SPRITE_MATERIAL ); IMaterial *pMat = m_DetailSpriteMaterial; // adjust for non-square textures (cropped) - float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight(); + float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight(); if ( flRatio > 1.0 ) { for( int i = 0; i MAX_WEAPON_SLOTS ) + if ( iSlot >= MAX_WEAPON_SLOTS ) return; // Make sure the player's allowed to switch weapons diff --git a/sp/src/game/client/hud.cpp b/sp/src/game/client/hud.cpp index 1baad2e1..af50b187 100644 --- a/sp/src/game/client/hud.cpp +++ b/sp/src/game/client/hud.cpp @@ -512,7 +512,7 @@ void CHud::Shutdown( void ) //----------------------------------------------------------------------------- -// Purpose: LevelInit's called whenever a new level's starting +// Purpose: LevelInit's called whenever a new level is starting //----------------------------------------------------------------------------- void CHud::LevelInit( void ) { @@ -533,11 +533,11 @@ void CHud::LevelInit( void ) } //----------------------------------------------------------------------------- -// Purpose: LevelShutdown's called whenever a level's finishing +// Purpose: LevelShutdown's called whenever a level is finishing //----------------------------------------------------------------------------- void CHud::LevelShutdown( void ) { - // Tell all the registered hud elements to LevelInit + // Tell all the registered hud elements to LevelShutdown for ( int i = 0; i < m_HudList.Size(); i++ ) { m_HudList[i]->LevelShutdown(); diff --git a/sp/src/game/client/hud.h b/sp/src/game/client/hud.h index 7b637c64..b623a3eb 100644 --- a/sp/src/game/client/hud.h +++ b/sp/src/game/client/hud.h @@ -107,9 +107,9 @@ public: void VidInit( void ); // Shutdown's called when the engine's shutting down void Shutdown( void ); - // LevelInit's called whenever a new level's starting + // LevelInit's called whenever a new level is starting void LevelInit( void ); - // LevelShutdown's called whenever a level's finishing + // LevelShutdown's called whenever a level is finishing void LevelShutdown( void ); void ResetHUD( void ); diff --git a/sp/src/game/client/hud_vote.cpp b/sp/src/game/client/hud_vote.cpp index 55b8f389..659669a0 100644 --- a/sp/src/game/client/hud_vote.cpp +++ b/sp/src/game/client/hud_vote.cpp @@ -662,7 +662,8 @@ void CVoteSetupDialog::OnItemSelected( vgui::Panel *panel ) for ( int index = 0; index < m_VoteIssuesPopFiles.Count(); index++ ) { // Don't show the current pop file - if ( TFObjectiveResource()->GetMvMPopFileName() == '\0' ) + const char *pszPopFileName = TFObjectiveResource()->GetMvMPopFileName(); + if ( !pszPopFileName || !pszPopFileName[0] ) { // Use the map name char szShortMapName[ MAX_MAP_NAME ]; diff --git a/sp/src/game/client/hudelement.h b/sp/src/game/client/hudelement.h index e6de48b9..b903de5d 100644 --- a/sp/src/game/client/hudelement.h +++ b/sp/src/game/client/hudelement.h @@ -36,9 +36,9 @@ public: // called whenever the video mode changes, and whenever Init() would be called, so the hud can vid init itself virtual void VidInit( void ) { return; } - // LevelInit's called whenever a new level's starting + // LevelInit's called whenever a new level is starting virtual void LevelInit( void ) { return; }; - // LevelShutdown's called whenever a level's finishing + // LevelShutdown's called whenever a level is finishing virtual void LevelShutdown( void ) { return; }; // called whenever the hud receives "reset" message, which is (usually) every time the client respawns after getting killed diff --git a/sp/src/game/client/in_joystick.cpp b/sp/src/game/client/in_joystick.cpp index 2f0e3dad..71d03a08 100644 --- a/sp/src/game/client/in_joystick.cpp +++ b/sp/src/game/client/in_joystick.cpp @@ -846,6 +846,8 @@ void CInput::JoyStickMove( float frametime, CUserCmd *cmd ) { angle = m_flPreviousJoystickYaw * joy_yawsensitivity.GetFloat() * aspeed * 180.0; } + + angle = JoyStickAdjustYaw( angle ); viewangles[YAW] += angle; cmd->mousedx = angle; diff --git a/sp/src/game/client/input.h b/sp/src/game/client/input.h index 356c7532..e34b82db 100644 --- a/sp/src/game/client/input.h +++ b/sp/src/game/client/input.h @@ -141,6 +141,7 @@ private: void ControllerMove ( float frametime, CUserCmd *cmd ); void JoyStickMove ( float frametime, CUserCmd *cmd ); float ScaleAxisValue( const float axisValue, const float axisThreshold ); + virtual float JoyStickAdjustYaw( float flSpeed ) { return flSpeed; } // Call this to get the cursor position. The call will be logged in the VCR file if there is one. void GetMousePos(int &x, int &y); diff --git a/sp/src/game/client/prediction.cpp b/sp/src/game/client/prediction.cpp index 7e00732c..6646f8f9 100644 --- a/sp/src/game/client/prediction.cpp +++ b/sp/src/game/client/prediction.cpp @@ -931,7 +931,8 @@ void CPrediction::SetIdealPitch ( C_BasePlayer *player, const Vector& origin, co Vector top, bottom; float floor_height[MAX_FORWARD]; int i, j; - int step, dir, steps; + float step, dir; + int steps; trace_t tr; if ( player->GetGroundEntity() == NULL ) diff --git a/sp/src/game/client/replay/replayyoutubeapi.cpp b/sp/src/game/client/replay/replayyoutubeapi.cpp index 399d12ca..faab2e95 100644 --- a/sp/src/game/client/replay/replayyoutubeapi.cpp +++ b/sp/src/game/client/replay/replayyoutubeapi.cpp @@ -24,7 +24,7 @@ #include "confirm_dialog.h" #include "replay/vgui/replaybrowserdetailspanel.h" -#include "base_gcmessages.h" +#include "base_gcmessages.pb.h" #include "youtubeapi.h" #include "steamworks_gamestats.h" diff --git a/sp/src/game/client/sixense/in_sixense_gesture_bindings.cpp b/sp/src/game/client/sixense/in_sixense_gesture_bindings.cpp index 7ede9ba5..0f0f7105 100644 --- a/sp/src/game/client/sixense/in_sixense_gesture_bindings.cpp +++ b/sp/src/game/client/sixense/in_sixense_gesture_bindings.cpp @@ -879,10 +879,6 @@ bool SixenseGestureBindings::ActionTokenToStr( sixenseUtils::IButtonStates::Acti { Q_snprintf( buf, buflen, "tilt_gesture" ); } - else if( action == sixenseUtils::IButtonStates::ACTION_BUTTON_PRESS ) - { - Q_snprintf( buf, buflen, "button_press" ); - } else if( action == sixenseUtils::IButtonStates::ACTION_TRIGGER_PRESS ) { Q_snprintf( buf, buflen, "trigger_press" ); diff --git a/sp/src/game/client/vgui_fpspanel.cpp b/sp/src/game/client/vgui_fpspanel.cpp index a44dde34..aec28add 100644 --- a/sp/src/game/client/vgui_fpspanel.cpp +++ b/sp/src/game/client/vgui_fpspanel.cpp @@ -189,12 +189,12 @@ void GetFPSColor( int nFps, unsigned char ucColor[3] ) if ( IsPC() && g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 95 ) { nFPSThreshold1 = 60; - nFPSThreshold1 = 50; + nFPSThreshold2 = 50; } else if ( IsX360() || g_pMaterialSystemHardwareConfig->GetDXSupportLevel() >= 90 ) { nFPSThreshold1 = 30; - nFPSThreshold1 = 25; + nFPSThreshold2 = 25; } if ( nFps >= nFPSThreshold1 ) diff --git a/sp/src/game/client/vgui_messagechars.cpp b/sp/src/game/client/vgui_messagechars.cpp index 547164f6..1d1410f1 100644 --- a/sp/src/game/client/vgui_messagechars.cpp +++ b/sp/src/game/client/vgui_messagechars.cpp @@ -235,9 +235,10 @@ int CMessageCharsPanel::AddText( Assert( !msg->text ); - msg->text = new char[ Q_strlen( data ) + 1 ]; + int textLength = Q_strlen( data ) + 1; + msg->text = new char[ textLength ]; Assert( msg->text ); - Q_strncpy( msg->text, data, sizeof( msg->text ) ); + Q_strncpy( msg->text, data, textLength ); if ( flTime ) msg->fTTL = gpGlobals->curtime + flTime; diff --git a/sp/src/game/client/viewpostprocess.cpp b/sp/src/game/client/viewpostprocess.cpp index 3f74acdc..39c2237e 100644 --- a/sp/src/game/client/viewpostprocess.cpp +++ b/sp/src/game/client/viewpostprocess.cpp @@ -1885,7 +1885,8 @@ static void DrawPyroVignette( int nDestX, int nDestY, int nWidth, int nHeight, / if ( pyro_vignette.GetInt() > 1 ) { - Vector2D vMaxSize( ( float )nScreenWidth / ( float )nScreenWidth / NUM_PYRO_SEGMENTS * 2.0f, ( float )nScreenHeight / ( float )nScreenHeight / NUM_PYRO_SEGMENTS * 2.0f ); + float flPyroSegments = 2.0f / NUM_PYRO_SEGMENTS; + Vector2D vMaxSize( flPyroSegments, flPyroSegments ); if ( !bInit ) { diff --git a/sp/src/game/client/viewrender.cpp b/sp/src/game/client/viewrender.cpp index a9ef4eb8..a629071b 100644 --- a/sp/src/game/client/viewrender.cpp +++ b/sp/src/game/client/viewrender.cpp @@ -2248,7 +2248,7 @@ void CViewRender::RenderView( const CViewSetup &view, int nClearFlags, int whatT // let vgui know where to render stuff for the forced-to-framebuffer panels if( UseVR() ) { - vgui::surface()->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget ); + g_pMatSystemSurface->SetFullscreenViewportAndRenderTarget( viewFramebufferX, viewFramebufferY, viewFramebufferWidth, viewFramebufferHeight, saveRenderTarget ); } // clear the render target if we need to @@ -3885,7 +3885,7 @@ static void DrawOpaqueRenderables_DrawStaticProps( CClientRenderablesList::CEntr for( CClientRenderablesList::CEntry *itEntity = pEntitiesBegin; itEntity < pEntitiesEnd; ++ itEntity ) { if ( itEntity->m_pRenderable ) - NULL; + /**/; else continue; @@ -3935,7 +3935,7 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode ) RopeManager()->ResetRenderCache(); g_pParticleSystemMgr->ResetRenderCache(); - bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool(); + //bool const bDrawopaquestaticpropslast = r_drawopaquestaticpropslast.GetBool(); // @@ -4101,16 +4101,20 @@ void CRendering3dView::DrawOpaqueRenderables( ERenderDepthMode DepthMode ) for ( int bucket = 0; bucket < RENDER_GROUP_CFG_NUM_OPAQUE_ENT_BUCKETS; ++ bucket ) { - if ( bDrawopaquestaticpropslast ) + // PVS-Studio pointed out that the two sides of the if/else were identical. Fixing + // this long-broken behavior would change rendering, so I fixed the code but + // commented out the new behavior. Uncomment the if statement and else block + // when needed. + //if ( bDrawopaquestaticpropslast ) { DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode ); } - else + /*else { - DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); DrawOpaqueRenderables_DrawStaticProps( pProps[bucket][0], pProps[bucket][1], DepthMode ); - } + DrawOpaqueRenderables_Range( pEnts[bucket][0], pEnts[bucket][1], DepthMode ); + }*/ } diff --git a/sp/src/game/protobuf_include.vpc b/sp/src/game/protobuf_include.vpc index c4fe5022..74c2ada4 100644 --- a/sp/src/game/protobuf_include.vpc +++ b/sp/src/game/protobuf_include.vpc @@ -8,10 +8,10 @@ $MacroRequired "PLATFORM" $Project { - $Folder "Libraries" + $Folder "Link Libraries" { - $Libexternal libprotobuf [!$VS2012 && !$VS2013] + $Libexternal $SRCDIR\lib\public\2010\libprotobuf [$VS2010] $Libexternal 2012\libprotobuf [$VS2012] - $Libexternal 2013\libprotobuf [$VS2013] + $Libexternal libprotobuf [$VS2013 || !$WINDOWS] } } diff --git a/sp/src/game/server/BaseAnimatingOverlay.cpp b/sp/src/game/server/BaseAnimatingOverlay.cpp index 50c94361..36534bc0 100644 --- a/sp/src/game/server/BaseAnimatingOverlay.cpp +++ b/sp/src/game/server/BaseAnimatingOverlay.cpp @@ -104,9 +104,14 @@ void CAnimationLayer::Init( CBaseAnimatingOverlay *pOverlay ) m_nSequence = 0; m_nPriority = 0; m_nOrder.Set( CBaseAnimatingOverlay::MAX_OVERLAYS ); + + m_flBlendIn = 0.0; + m_flBlendOut = 0.0; + m_flKillRate = 100.0; m_flKillDelay = 0.0; m_flPlaybackRate = 1.0; + m_flLastEventCheck = 0.0; m_flLastAccess = gpGlobals->curtime; m_flLayerAnimtime = 0; m_flLayerFadeOuttime = 0; diff --git a/sp/src/game/server/EnvFade.cpp b/sp/src/game/server/EnvFade.cpp index b3ed4b2c..fa0185d5 100644 --- a/sp/src/game/server/EnvFade.cpp +++ b/sp/src/game/server/EnvFade.cpp @@ -95,7 +95,7 @@ void CEnvFade::InputFade( inputdata_t &inputdata ) if ( m_spawnflags & SF_FADE_ONLYONE ) { - if ( inputdata.pActivator->IsNetClient() ) + if ( inputdata.pActivator && inputdata.pActivator->IsNetClient() ) { UTIL_ScreenFade( inputdata.pActivator, m_clrRender, Duration(), HoldTime(), fadeFlags ); } diff --git a/sp/src/game/server/ai_utils.cpp b/sp/src/game/server/ai_utils.cpp index 802a1c10..83847479 100644 --- a/sp/src/game/server/ai_utils.cpp +++ b/sp/src/game/server/ai_utils.cpp @@ -46,7 +46,7 @@ END_DATADESC() CAI_ShotRegulator::CAI_ShotRegulator() : m_nMinBurstShots(1), m_nMaxBurstShots(1) { m_flMinRestInterval = 0.0f; - m_flMinRestInterval = 0.0f; + m_flMaxRestInterval = 0.0f; m_flMinBurstInterval = 0.0f; m_flMaxBurstInterval = 0.0f; m_flNextShotTime = -1; diff --git a/sp/src/game/server/baseentity.cpp b/sp/src/game/server/baseentity.cpp index 52316924..b42f2abe 100644 --- a/sp/src/game/server/baseentity.cpp +++ b/sp/src/game/server/baseentity.cpp @@ -303,7 +303,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CBaseEntity, DT_BaseEntity ) SendPropBool( SENDINFO( m_bAlternateSorting )), #ifdef TF_DLL - SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, SPROP_UNSIGNED ) ), + SendPropArray3( SENDINFO_ARRAY3(m_nModelIndexOverrides), SendPropInt( SENDINFO_ARRAY(m_nModelIndexOverrides), SP_MODEL_INDEX_BITS, 0 ) ), #endif END_SEND_TABLE() diff --git a/sp/src/game/server/baseflex.cpp b/sp/src/game/server/baseflex.cpp index 8e17fa75..4e6b4629 100644 --- a/sp/src/game/server/baseflex.cpp +++ b/sp/src/game/server/baseflex.cpp @@ -1318,9 +1318,9 @@ static Activity DetermineExpressionMoveActivity( CChoreoEvent *event, CAI_BaseNP // Custom distance styles are appended to param2 with a space as a separator const char *pszAct = Q_strstr( sParam2, " " ); + char szActName[256]; if ( pszAct ) { - char szActName[256]; Q_strncpy( szActName, sParam2, sizeof(szActName) ); szActName[ (pszAct-sParam2) ] = '\0'; pszAct = szActName; diff --git a/sp/src/game/server/env_tonemap_controller.cpp b/sp/src/game/server/env_tonemap_controller.cpp index 807e39ac..613d4548 100644 --- a/sp/src/game/server/env_tonemap_controller.cpp +++ b/sp/src/game/server/env_tonemap_controller.cpp @@ -169,7 +169,7 @@ void CEnvTonemapController::InputSetBloomScaleRange( inputdata_t &inputdata ) return; } m_flCustomBloomScale=bloom_max; - m_flCustomBloomScale=bloom_min; + m_flCustomBloomScaleMinimum=bloom_min; } //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/gameinterface.cpp b/sp/src/game/server/gameinterface.cpp index c9357138..ff077ea5 100644 --- a/sp/src/game/server/gameinterface.cpp +++ b/sp/src/game/server/gameinterface.cpp @@ -1888,9 +1888,13 @@ void CServerGameDLL::SetServerHibernation( bool bHibernating ) const char *CServerGameDLL::GetServerBrowserMapOverride() { #ifdef TF_DLL - if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() && g_pPopulationManager && g_pPopulationManager->GetPopulationFilenameShort() != '\0' ) + if ( TFGameRules() && TFGameRules()->IsMannVsMachineMode() ) { - return g_pPopulationManager->GetPopulationFilenameShort(); + const char *pszFilenameShort = g_pPopulationManager ? g_pPopulationManager->GetPopulationFilenameShort() : NULL; + if ( pszFilenameShort && pszFilenameShort[0] ) + { + return pszFilenameShort; + } } #endif return NULL; @@ -2964,17 +2968,20 @@ void CServerGameClients::ClientSetupVisibility( edict_t *pViewEntity, edict_t *p // Flush the remaining areaportal states. engine->SetAreaPortalStates( portalNums, isOpen, iOutPortal ); - // Update the area bits that get sent to the client. - pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); + if ( pPlayer ) + { + // Update the area bits that get sent to the client. + pPlayer->m_Local.UpdateAreaBits( pPlayer, portalBits ); #ifdef PORTAL - // *After* the player's view has updated its area bits, add on any other areas seen by portals - CPortal_Player* pPortalPlayer = dynamic_cast( pPlayer ); - if ( pPortalPlayer ) - { - pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize ); - } + // *After* the player's view has updated its area bits, add on any other areas seen by portals + CPortal_Player* pPortalPlayer = dynamic_cast( pPlayer ); + if ( pPortalPlayer ) + { + pPortalPlayer->UpdatePortalViewAreaBits( pvs, pvssize ); + } #endif //PORTAL + } } diff --git a/sp/src/game/server/hl2/npc_strider.cpp b/sp/src/game/server/hl2/npc_strider.cpp index b0cb2edf..60d37cdf 100644 --- a/sp/src/game/server/hl2/npc_strider.cpp +++ b/sp/src/game/server/hl2/npc_strider.cpp @@ -1130,7 +1130,7 @@ void CNPC_Strider::GatherConditions() !WeaponLOSCondition( GetAdjustedOrigin(), GetEnemy()->BodyTarget( GetAdjustedOrigin() ), false ) ) ) { #if 0 - if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) && !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) + if ( !HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) SetIdealHeight( MIN( GetMaxHeight(), GetHeight() + 75.0 * 0.1 ) ); // default to rising up #endif GatherHeightConditions( GetAdjustedOrigin(), GetEnemy() ); @@ -1161,7 +1161,7 @@ void CNPC_Strider::GatherConditions() //--------------------------------------------------------- void CNPC_Strider::GatherHeightConditions( const Vector &vTestPos, CBaseEntity *pEntity ) { - if ( HasCondition( COND_STRIDER_SHOULD_CROUCH ) && HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) + if ( HasCondition( COND_STRIDER_SHOULD_CROUCH ) ) return; float maxZ = (GetAbsOrigin().z - (GetMaxHeightModel() - GetMaxHeight())); diff --git a/sp/src/game/server/player.cpp b/sp/src/game/server/player.cpp index 73aab6d6..0538f90a 100644 --- a/sp/src/game/server/player.cpp +++ b/sp/src/game/server/player.cpp @@ -7409,6 +7409,13 @@ void CBasePlayer::RemoveWearable( CEconWearable *pItem ) m_hMyWearables.Remove( i ); break; } + + // Integrety is failing, remove NULLs + if ( !pWearable ) + { + m_hMyWearables.Remove( i ); + break; + } } #ifdef DEBUG diff --git a/sp/src/game/server/props.cpp b/sp/src/game/server/props.cpp index 4d121d71..648191db 100644 --- a/sp/src/game/server/props.cpp +++ b/sp/src/game/server/props.cpp @@ -1517,7 +1517,7 @@ void CBreakableProp::OnPhysGunDrop( CBasePlayer *pPhysGunUser, PhysGunDrop_t Rea SetPhysicsAttacker( pPhysGunUser, gpGlobals->curtime ); - if( Reason == PUNTED_BY_CANNON ) + if( (int)Reason == (int)PUNTED_BY_CANNON ) { PlayPuntSound(); } diff --git a/sp/src/game/shared/Multiplayer/multiplayer_animstate.cpp b/sp/src/game/shared/Multiplayer/multiplayer_animstate.cpp index 975eec17..4d1ad4fe 100644 --- a/sp/src/game/shared/Multiplayer/multiplayer_animstate.cpp +++ b/sp/src/game/shared/Multiplayer/multiplayer_animstate.cpp @@ -358,16 +358,21 @@ void CMultiPlayerAnimState::PlayFlinchGesture( Activity iActivity ) //----------------------------------------------------------------------------- bool CMultiPlayerAnimState::InitGestureSlots( void ) { - // Get the base player. - CBasePlayer *pPlayer = GetBasePlayer(); - if( pPlayer ) + // Setup the number of gesture slots. + m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT ); + + // Assign all of the the CAnimationLayer pointers to null early in case we bail. + for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture ) { - // Set the number of animation overlays we will use. - pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT ); + m_aGestureSlots[iGesture].m_pAnimLayer = NULL; } - // Setup the number of gesture slots. - m_aGestureSlots.AddMultipleToTail( GESTURE_SLOT_COUNT ); + // Get the base player. + CBasePlayer *pPlayer = GetBasePlayer(); + + // Set the number of animation overlays we will use. + pPlayer->SetNumAnimOverlays( GESTURE_SLOT_COUNT ); + for ( int iGesture = 0; iGesture < GESTURE_SLOT_COUNT; ++iGesture ) { m_aGestureSlots[iGesture].m_pAnimLayer = pPlayer->GetAnimOverlay( iGesture ); @@ -409,6 +414,9 @@ void CMultiPlayerAnimState::ResetGestureSlot( int iGestureSlot ) // Sanity Check Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT ); + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + GestureSlot_t *pGestureSlot = &m_aGestureSlots[iGestureSlot]; if ( pGestureSlot ) { @@ -486,6 +494,36 @@ bool CMultiPlayerAnimState::IsGestureSlotActive( int iGestureSlot ) return m_aGestureSlots[iGestureSlot].m_bActive; } + +//----------------------------------------------------------------------------- +// Purpose: Track down a crash +//----------------------------------------------------------------------------- +bool CMultiPlayerAnimState::VerifyAnimLayerInSlot( int iGestureSlot ) +{ + if ( iGestureSlot < 0 || iGestureSlot >= GESTURE_SLOT_COUNT ) + { + return false; + } + + if ( GetBasePlayer()->GetNumAnimOverlays() < iGestureSlot + 1 ) + { + AssertMsg2( false, "Player %d doesn't have gesture slot %d any more.", GetBasePlayer()->entindex(), iGestureSlot ); + Msg( "Player %d doesn't have gesture slot %d any more.\n", GetBasePlayer()->entindex(), iGestureSlot ); + m_aGestureSlots[iGestureSlot].m_pAnimLayer = NULL; + return false; + } + + CAnimationLayer *pExpected = GetBasePlayer()->GetAnimOverlay( iGestureSlot ); + if ( m_aGestureSlots[iGestureSlot].m_pAnimLayer != pExpected ) + { + AssertMsg3( false, "Gesture slot %d pointing to wrong address %p. Updating to new address %p.", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected ); + Msg( "Gesture slot %d pointing to wrong address %p. Updating to new address %p.\n", iGestureSlot, m_aGestureSlots[iGestureSlot].m_pAnimLayer, pExpected ); + m_aGestureSlots[iGestureSlot].m_pAnimLayer = pExpected; + } + + return true; +} + //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -509,6 +547,9 @@ void CMultiPlayerAnimState::RestartGesture( int iGestureSlot, Activity iGestureA // Sanity Check Assert( iGestureSlot >= 0 && iGestureSlot < GESTURE_SLOT_COUNT ); + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + if ( !IsGestureSlotPlaying( iGestureSlot, iGestureActivity ) ) { #ifdef CLIENT_DLL @@ -549,6 +590,9 @@ void CMultiPlayerAnimState::AddToGestureSlot( int iGestureSlot, Activity iGestur if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer ) return; + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + // Get the sequence. int iGestureSequence = pPlayer->SelectWeightedSequence( iGestureActivity ); if ( iGestureSequence <= 0 ) @@ -623,6 +667,9 @@ void CMultiPlayerAnimState::AddVCDSequenceToGestureSlot( int iGestureSlot, int i if ( !m_aGestureSlots[iGestureSlot].m_pAnimLayer ) return; + if ( !VerifyAnimLayerInSlot( iGestureSlot ) ) + return; + // Set the activity. Activity iGestureActivity = ACT_MP_VCD; @@ -1154,6 +1201,9 @@ void CMultiPlayerAnimState::ComputeGestureSequence( CStudioHdr *pStudioHdr ) if ( !m_aGestureSlots[iGesture].m_bActive ) continue; + if ( !VerifyAnimLayerInSlot( iGesture ) ) + continue; + UpdateGestureLayer( pStudioHdr, &m_aGestureSlots[iGesture] ); } } diff --git a/sp/src/game/shared/Multiplayer/multiplayer_animstate.h b/sp/src/game/shared/Multiplayer/multiplayer_animstate.h index 5407e4bd..007533a1 100644 --- a/sp/src/game/shared/Multiplayer/multiplayer_animstate.h +++ b/sp/src/game/shared/Multiplayer/multiplayer_animstate.h @@ -200,6 +200,7 @@ public: void AddVCDSequenceToGestureSlot( int iGestureSlot, int iGestureSequence, float flCycle = 0.0f, bool bAutoKill = true ); CAnimationLayer* GetGestureSlotLayer( int iGestureSlot ); bool IsGestureSlotActive( int iGestureSlot ); + bool VerifyAnimLayerInSlot( int iGestureSlot ); // Feet. bool m_bForceAimYaw; diff --git a/sp/src/game/shared/base_playeranimstate.cpp b/sp/src/game/shared/base_playeranimstate.cpp index a25d773c..d90655ac 100644 --- a/sp/src/game/shared/base_playeranimstate.cpp +++ b/sp/src/game/shared/base_playeranimstate.cpp @@ -65,7 +65,7 @@ CBasePlayerAnimState::CBasePlayerAnimState() m_flEyePitch = 0.0f; m_bCurrentFeetYawInitialized = false; m_flCurrentTorsoYaw = 0.0f; - m_flCurrentTorsoYaw = TURN_NONE; + m_nTurningInPlace = TURN_NONE; m_flMaxGroundSpeed = 0.0f; m_flStoredCycle = 0.0f; diff --git a/sp/src/game/shared/baseachievement.cpp b/sp/src/game/shared/baseachievement.cpp index 494133c1..ebc5876e 100644 --- a/sp/src/game/shared/baseachievement.cpp +++ b/sp/src/game/shared/baseachievement.cpp @@ -427,13 +427,7 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber ) // new component, set the bit and increment the count SetComponentBits( m_iComponentBits | iBitMask ); - Assert( m_iCount <= m_iGoal ); - if ( m_iCount == m_iGoal ) - { - // all components found, award the achievement (and save state) - AwardAchievement(); - } - else + if ( m_iCount != m_iGoal ) { // save our state at the next good opportunity m_pAchievementMgr->SetDirty( true ); @@ -453,6 +447,15 @@ void CBaseAchievement::EnsureComponentBitSetAndEvaluate( int iBitNumber ) Msg( "Component %d for achievement %s found, but already had that component\n", iBitNumber, GetName() ); } } + + // Check to see if we've achieved our goal even if the bit is already set + // (this fixes some older achievements that are stuck in the 9/9 state and could never be evaluated) + Assert( m_iCount <= m_iGoal ); + if ( m_iCount == m_iGoal ) + { + // all components found, award the achievement (and save state) + AwardAchievement(); + } } //----------------------------------------------------------------------------- diff --git a/sp/src/game/shared/baseachievement.h b/sp/src/game/shared/baseachievement.h index 893055a3..2074f81d 100644 --- a/sp/src/game/shared/baseachievement.h +++ b/sp/src/game/shared/baseachievement.h @@ -105,6 +105,9 @@ public: virtual void Think( void ) { return; } + const char *GetMapNameFilter( void ){ return m_pMapNameFilter; } + CAchievementMgr *GetAchievementMgr( void ){ return m_pAchievementMgr; } + protected: virtual void FireGameEvent( IGameEvent *event ); virtual void FireGameEvent_Internal( IGameEvent *event ) {}; diff --git a/sp/src/game/shared/multiplay_gamerules.cpp b/sp/src/game/shared/multiplay_gamerules.cpp index 07932e92..abecba9e 100644 --- a/sp/src/game/shared/multiplay_gamerules.cpp +++ b/sp/src/game/shared/multiplay_gamerules.cpp @@ -857,9 +857,9 @@ ConVarRef suitcharger( "sk_suitcharger" ); { killer_weapon_name += 7; } - else if ( strncmp( killer_weapon_name, "NPC_", 8 ) == 0 ) + else if ( strncmp( killer_weapon_name, "NPC_", 4 ) == 0 ) { - killer_weapon_name += 8; + killer_weapon_name += 4; } else if ( strncmp( killer_weapon_name, "func_", 5 ) == 0 ) { diff --git a/sp/src/game/shared/particle_parse.cpp b/sp/src/game/shared/particle_parse.cpp index 9d3b4245..db15685d 100644 --- a/sp/src/game/shared/particle_parse.cpp +++ b/sp/src/game/shared/particle_parse.cpp @@ -309,7 +309,7 @@ void DispatchParticleEffect( const char *pszParticleName, ParticleAttachment_t i if ( ( data.m_fFlags & PARTICLE_DISPATCH_FROM_ENTITY ) != 0 && ( iAttachType == PATTACH_ABSORIGIN_FOLLOW || iAttachType == PATTACH_POINT_FOLLOW || iAttachType == PATTACH_ROOTBONE_FOLLOW ) ) { - CReliableBroadcastRecipientFilter filter; + CBroadcastRecipientFilter filter; DispatchEffect( "ParticleEffect", data, filter ); } else diff --git a/sp/src/game/shared/particle_property.cpp b/sp/src/game/shared/particle_property.cpp index 8ddc9784..c1c44a1a 100644 --- a/sp/src/game/shared/particle_property.cpp +++ b/sp/src/game/shared/particle_property.cpp @@ -200,8 +200,23 @@ void CParticleProperty::AddControlPoint( int iEffectIndex, int iPoint, C_BaseEnt ParticleEffectList_t *pEffect = &m_ParticleEffects[iEffectIndex]; Assert( pEffect->pControlPoints.Count() < MAX_PARTICLE_CONTROL_POINTS ); - int iIndex = pEffect->pControlPoints.AddToTail(); - ParticleControlPoint_t *pNewPoint = &pEffect->pControlPoints[iIndex]; + // If the control point is already used, override it + ParticleControlPoint_t *pNewPoint = NULL; + int iIndex = iPoint; + FOR_EACH_VEC( pEffect->pControlPoints, i ) + { + if ( pEffect->pControlPoints[i].iControlPoint == iPoint ) + { + pNewPoint = &pEffect->pControlPoints[i]; + } + } + + if ( !pNewPoint ) + { + iIndex = pEffect->pControlPoints.AddToTail(); + pNewPoint = &pEffect->pControlPoints[iIndex]; + } + pNewPoint->iControlPoint = iPoint; pNewPoint->hEntity = pEntity; pNewPoint->iAttachType = iAttachType; @@ -553,7 +568,7 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i if ( pAnimating ) { int bUseHeadOrigin = 0; - CALL_ATTRIB_HOOK_INT_ON_OTHER( pPoint->hEntity.Get(), bUseHeadOrigin, particle_effect_use_head_origin ); + CALL_ATTRIB_HOOK_INT_ON_OTHER( pAnimating, bUseHeadOrigin, particle_effect_use_head_origin ); if ( bUseHeadOrigin > 0 ) { int iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "bip_head" ); @@ -565,15 +580,17 @@ void CParticleProperty::UpdateControlPoint( ParticleEffectList_t *pEffect, int i iBone = Studio_BoneIndexByName( pAnimating->GetModelPtr(), "prp_hat" ); } } - if ( iBone >= 0 ) + if ( iBone < 0 ) { - bUsingHeadOrigin = true; - const matrix3x4_t headBone = pAnimating->GetBone( iBone ); - MatrixVectors( headBone, &vecForward, &vecRight, &vecUp ); - MatrixPosition( headBone, vecOrigin ); - - CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPoint->hEntity.Get(), flOffset, particle_effect_vertical_offset ); + iBone = 0; } + + bUsingHeadOrigin = true; + const matrix3x4_t headBone = pAnimating->GetBone( iBone ); + MatrixVectors( headBone, &vecForward, &vecRight, &vecUp ); + MatrixPosition( headBone, vecOrigin ); + + CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pAnimating, flOffset, particle_effect_vertical_offset ); } } } diff --git a/sp/src/game/shared/util_shared.cpp b/sp/src/game/shared/util_shared.cpp index de7aea4e..67f46825 100644 --- a/sp/src/game/shared/util_shared.cpp +++ b/sp/src/game/shared/util_shared.cpp @@ -39,7 +39,7 @@ bool NPC_CheckBrushExclude( CBaseEntity *pEntity, CBaseEntity *pBrush ); #include "tier0/memdbgon.h" ConVar r_visualizetraces( "r_visualizetraces", "0", FCVAR_CHEAT ); -ConVar developer("developer", "0", 0, "Set developer message level" ); // developer mode +ConVar developer("developer", "0", 0, "Set developer message level." ); // developer mode float UTIL_VecToYaw( const Vector &vec ) { diff --git a/sp/src/lib/public/2012/libprotobuf.lib b/sp/src/lib/public/2012/libprotobuf.lib new file mode 100644 index 00000000..155ad189 Binary files /dev/null and b/sp/src/lib/public/2012/libprotobuf.lib differ diff --git a/sp/src/lib/public/appframework.lib b/sp/src/lib/public/appframework.lib index 2884a22e..5feb460f 100644 Binary files a/sp/src/lib/public/appframework.lib and b/sp/src/lib/public/appframework.lib differ diff --git a/sp/src/lib/public/bitmap.lib b/sp/src/lib/public/bitmap.lib index 3f842c0b..f33f3808 100644 Binary files a/sp/src/lib/public/bitmap.lib and b/sp/src/lib/public/bitmap.lib differ diff --git a/sp/src/lib/public/choreoobjects.lib b/sp/src/lib/public/choreoobjects.lib index b295be49..0525652a 100644 Binary files a/sp/src/lib/public/choreoobjects.lib and b/sp/src/lib/public/choreoobjects.lib differ diff --git a/sp/src/lib/public/dmxloader.lib b/sp/src/lib/public/dmxloader.lib index ffe58400..b28cff99 100644 Binary files a/sp/src/lib/public/dmxloader.lib and b/sp/src/lib/public/dmxloader.lib differ diff --git a/sp/src/lib/public/libprotobuf.lib b/sp/src/lib/public/libprotobuf.lib index e25942c5..59ffc578 100644 Binary files a/sp/src/lib/public/libprotobuf.lib and b/sp/src/lib/public/libprotobuf.lib differ diff --git a/sp/src/lib/public/libz.lib b/sp/src/lib/public/libz.lib index 4920f823..6be40c06 100644 Binary files a/sp/src/lib/public/libz.lib and b/sp/src/lib/public/libz.lib differ diff --git a/sp/src/lib/public/linux32/bitmap.a b/sp/src/lib/public/linux32/bitmap.a index a03e746b..65b36182 100644 Binary files a/sp/src/lib/public/linux32/bitmap.a and b/sp/src/lib/public/linux32/bitmap.a differ diff --git a/sp/src/lib/public/linux32/choreoobjects.a b/sp/src/lib/public/linux32/choreoobjects.a index d60beca8..b03e7fc0 100644 Binary files a/sp/src/lib/public/linux32/choreoobjects.a and b/sp/src/lib/public/linux32/choreoobjects.a differ diff --git a/sp/src/lib/public/linux32/dmxloader.a b/sp/src/lib/public/linux32/dmxloader.a index 80f085c0..0a03b727 100644 Binary files a/sp/src/lib/public/linux32/dmxloader.a and b/sp/src/lib/public/linux32/dmxloader.a differ diff --git a/sp/src/lib/public/linux32/libsteam_api.so b/sp/src/lib/public/linux32/libsteam_api.so index 6238c83e..ffc51e86 100755 Binary files a/sp/src/lib/public/linux32/libsteam_api.so and b/sp/src/lib/public/linux32/libsteam_api.so differ diff --git a/sp/src/lib/public/linux32/libtier0.so b/sp/src/lib/public/linux32/libtier0.so index bece6f75..16196052 100644 Binary files a/sp/src/lib/public/linux32/libtier0.so and b/sp/src/lib/public/linux32/libtier0.so differ diff --git a/sp/src/lib/public/linux32/libvstdlib.so b/sp/src/lib/public/linux32/libvstdlib.so index 2640250d..d2ac6226 100644 Binary files a/sp/src/lib/public/linux32/libvstdlib.so and b/sp/src/lib/public/linux32/libvstdlib.so differ diff --git a/sp/src/lib/public/linux32/matsys_controls.a b/sp/src/lib/public/linux32/matsys_controls.a index c999a735..ee74c95d 100644 Binary files a/sp/src/lib/public/linux32/matsys_controls.a and b/sp/src/lib/public/linux32/matsys_controls.a differ diff --git a/sp/src/lib/public/linux32/particles.a b/sp/src/lib/public/linux32/particles.a index f8bdb0f6..5cfa0656 100644 Binary files a/sp/src/lib/public/linux32/particles.a and b/sp/src/lib/public/linux32/particles.a differ diff --git a/sp/src/lib/public/linux32/shaderlib.a b/sp/src/lib/public/linux32/shaderlib.a index 41b693c7..e6473968 100644 Binary files a/sp/src/lib/public/linux32/shaderlib.a and b/sp/src/lib/public/linux32/shaderlib.a differ diff --git a/sp/src/lib/public/linux32/tier2.a b/sp/src/lib/public/linux32/tier2.a index 869c3c84..4eb8d2a2 100644 Binary files a/sp/src/lib/public/linux32/tier2.a and b/sp/src/lib/public/linux32/tier2.a differ diff --git a/sp/src/lib/public/linux32/tier3.a b/sp/src/lib/public/linux32/tier3.a index b99b4f81..e4b10ae5 100644 Binary files a/sp/src/lib/public/linux32/tier3.a and b/sp/src/lib/public/linux32/tier3.a differ diff --git a/sp/src/lib/public/linux32/vtf.a b/sp/src/lib/public/linux32/vtf.a index c5accec5..29252318 100644 Binary files a/sp/src/lib/public/linux32/vtf.a and b/sp/src/lib/public/linux32/vtf.a differ diff --git a/sp/src/lib/public/matsys_controls.lib b/sp/src/lib/public/matsys_controls.lib index 167517c6..542caf90 100644 Binary files a/sp/src/lib/public/matsys_controls.lib and b/sp/src/lib/public/matsys_controls.lib differ diff --git a/sp/src/lib/public/nvtristrip.lib b/sp/src/lib/public/nvtristrip.lib index 92ac3d4e..4fab84fa 100644 Binary files a/sp/src/lib/public/nvtristrip.lib and b/sp/src/lib/public/nvtristrip.lib differ diff --git a/sp/src/lib/public/osx32/bitmap.a b/sp/src/lib/public/osx32/bitmap.a index a1b496a8..12566428 100644 Binary files a/sp/src/lib/public/osx32/bitmap.a and b/sp/src/lib/public/osx32/bitmap.a differ diff --git a/sp/src/lib/public/osx32/choreoobjects.a b/sp/src/lib/public/osx32/choreoobjects.a index b3fa1ff4..8310380a 100644 Binary files a/sp/src/lib/public/osx32/choreoobjects.a and b/sp/src/lib/public/osx32/choreoobjects.a differ diff --git a/sp/src/lib/public/osx32/dmxloader.a b/sp/src/lib/public/osx32/dmxloader.a index cb1729fb..8186dc79 100644 Binary files a/sp/src/lib/public/osx32/dmxloader.a and b/sp/src/lib/public/osx32/dmxloader.a differ diff --git a/sp/src/lib/public/osx32/libsteam_api.dylib b/sp/src/lib/public/osx32/libsteam_api.dylib index 3eed40fe..dfa1ae2d 100755 Binary files a/sp/src/lib/public/osx32/libsteam_api.dylib and b/sp/src/lib/public/osx32/libsteam_api.dylib differ diff --git a/sp/src/lib/public/osx32/libtier0.dylib b/sp/src/lib/public/osx32/libtier0.dylib index cdd1e710..a4500268 100755 Binary files a/sp/src/lib/public/osx32/libtier0.dylib and b/sp/src/lib/public/osx32/libtier0.dylib differ diff --git a/sp/src/lib/public/osx32/libvstdlib.dylib b/sp/src/lib/public/osx32/libvstdlib.dylib index 5d461998..c46a5301 100755 Binary files a/sp/src/lib/public/osx32/libvstdlib.dylib and b/sp/src/lib/public/osx32/libvstdlib.dylib differ diff --git a/sp/src/lib/public/osx32/matsys_controls.a b/sp/src/lib/public/osx32/matsys_controls.a index e83b37a0..d05fc3a3 100644 Binary files a/sp/src/lib/public/osx32/matsys_controls.a and b/sp/src/lib/public/osx32/matsys_controls.a differ diff --git a/sp/src/lib/public/osx32/particles.a b/sp/src/lib/public/osx32/particles.a index c5dda2d6..4247a3e4 100644 Binary files a/sp/src/lib/public/osx32/particles.a and b/sp/src/lib/public/osx32/particles.a differ diff --git a/sp/src/lib/public/osx32/shaderlib.a b/sp/src/lib/public/osx32/shaderlib.a index 52c298ae..0acc7b2f 100644 Binary files a/sp/src/lib/public/osx32/shaderlib.a and b/sp/src/lib/public/osx32/shaderlib.a differ diff --git a/sp/src/lib/public/osx32/tier2.a b/sp/src/lib/public/osx32/tier2.a index cc1f50d8..8e3a9507 100644 Binary files a/sp/src/lib/public/osx32/tier2.a and b/sp/src/lib/public/osx32/tier2.a differ diff --git a/sp/src/lib/public/osx32/tier3.a b/sp/src/lib/public/osx32/tier3.a index 2795e730..61ebb2eb 100644 Binary files a/sp/src/lib/public/osx32/tier3.a and b/sp/src/lib/public/osx32/tier3.a differ diff --git a/sp/src/lib/public/osx32/vtf.a b/sp/src/lib/public/osx32/vtf.a index c36609ae..fe056c0e 100644 Binary files a/sp/src/lib/public/osx32/vtf.a and b/sp/src/lib/public/osx32/vtf.a differ diff --git a/sp/src/lib/public/particles.lib b/sp/src/lib/public/particles.lib index 5e61c7a0..2f7bb64e 100644 Binary files a/sp/src/lib/public/particles.lib and b/sp/src/lib/public/particles.lib differ diff --git a/sp/src/lib/public/raytrace.lib b/sp/src/lib/public/raytrace.lib index 32b25be2..9df258b9 100644 Binary files a/sp/src/lib/public/raytrace.lib and b/sp/src/lib/public/raytrace.lib differ diff --git a/sp/src/lib/public/shaderlib.lib b/sp/src/lib/public/shaderlib.lib index da6df422..c7c0047c 100644 Binary files a/sp/src/lib/public/shaderlib.lib and b/sp/src/lib/public/shaderlib.lib differ diff --git a/sp/src/lib/public/steam_api.lib b/sp/src/lib/public/steam_api.lib index 2d77e960..c8959232 100644 Binary files a/sp/src/lib/public/steam_api.lib and b/sp/src/lib/public/steam_api.lib differ diff --git a/sp/src/lib/public/tier0.lib b/sp/src/lib/public/tier0.lib index 1a09ee27..8804c7e7 100644 Binary files a/sp/src/lib/public/tier0.lib and b/sp/src/lib/public/tier0.lib differ diff --git a/sp/src/lib/public/tier2.lib b/sp/src/lib/public/tier2.lib index 3d22c36e..3af8be1a 100644 Binary files a/sp/src/lib/public/tier2.lib and b/sp/src/lib/public/tier2.lib differ diff --git a/sp/src/lib/public/tier3.lib b/sp/src/lib/public/tier3.lib index 5aecf6e0..93e83805 100644 Binary files a/sp/src/lib/public/tier3.lib and b/sp/src/lib/public/tier3.lib differ diff --git a/sp/src/lib/public/vmpi.lib b/sp/src/lib/public/vmpi.lib index df1e7483..f769c2fb 100644 Binary files a/sp/src/lib/public/vmpi.lib and b/sp/src/lib/public/vmpi.lib differ diff --git a/sp/src/lib/public/vstdlib.lib b/sp/src/lib/public/vstdlib.lib index 94b81f56..a85308d5 100644 Binary files a/sp/src/lib/public/vstdlib.lib and b/sp/src/lib/public/vstdlib.lib differ diff --git a/sp/src/lib/public/vtf.lib b/sp/src/lib/public/vtf.lib index 47ba0e4a..700975e2 100644 Binary files a/sp/src/lib/public/vtf.lib and b/sp/src/lib/public/vtf.lib differ diff --git a/sp/src/public/VGuiMatSurface/IMatSystemSurface.h b/sp/src/public/VGuiMatSurface/IMatSystemSurface.h index 03ff33b0..7e9d90fe 100644 --- a/sp/src/public/VGuiMatSurface/IMatSystemSurface.h +++ b/sp/src/public/VGuiMatSurface/IMatSystemSurface.h @@ -106,9 +106,8 @@ public: // Gets a material bound to a surface texture ID virtual IMaterial *DrawGetTextureMaterial( int id ) = 0; - // The matching method is in ISurface, but we can't add anything there and remain mod-compatible. - // So this goes here instead. virtual void GetFullscreenViewportAndRenderTarget( int & x, int & y, int & w, int & h, ITexture **ppRenderTarget ) = 0; + virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0; }; diff --git a/sp/src/public/XUnzip.cpp b/sp/src/public/XUnzip.cpp index cea57582..fbeb595e 100644 --- a/sp/src/public/XUnzip.cpp +++ b/sp/src/public/XUnzip.cpp @@ -4075,7 +4075,8 @@ ZRESULT TUnzip::Find(const TCHAR *name, bool ic, int *index, ZIPENTRY *ze) return ZR_NOTFOUND; } if (currentfile!=-1) - unzCloseCurrentFile(uf); currentfile=-1; + unzCloseCurrentFile(uf); + currentfile=-1; int i = (int)uf->num_file; if (index!=NULL) *index=i; diff --git a/sp/src/public/XZip.cpp b/sp/src/public/XZip.cpp index fa20631f..2b187a85 100644 --- a/sp/src/public/XZip.cpp +++ b/sp/src/public/XZip.cpp @@ -2705,7 +2705,8 @@ ZRESULT TZip::Add(const char *odstzn, void *src,unsigned int len, DWORD flags) while (*d != 0) { if (*d == '\\') - *d = '/'; d++; + *d = '/'; + d++; } bool isdir = (flags==ZIP_FOLDER); bool needs_trailing_slash = (isdir && dstzn[strlen(dstzn)-1]!='/'); diff --git a/sp/src/public/const.h b/sp/src/public/const.h index 1444b959..98293c08 100644 --- a/sp/src/public/const.h +++ b/sp/src/public/const.h @@ -51,7 +51,7 @@ // BUGBUG: Reconcile with or derive this from the engine's internal definition! // FIXME: I added an extra bit because I needed to make it signed -#define SP_MODEL_INDEX_BITS 12 +#define SP_MODEL_INDEX_BITS 13 // How many bits to use to encode an edict. #define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts diff --git a/sp/src/public/matsys_controls/mdlpanel.h b/sp/src/public/matsys_controls/mdlpanel.h index 91f936e7..070fb973 100644 --- a/sp/src/public/matsys_controls/mdlpanel.h +++ b/sp/src/public/matsys_controls/mdlpanel.h @@ -130,6 +130,7 @@ private: virtual void OnPaint3D(); virtual void PrePaint3D( IMatRenderContext *pRenderContext ) { }; virtual void PostPaint3D( IMatRenderContext *pRenderContext ) { }; + virtual void RenderingRootModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { }; virtual void RenderingMergedModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) { }; void OnMouseDoublePressed( vgui::MouseCode code ); diff --git a/sp/src/public/networkvar.h b/sp/src/public/networkvar.h index 027f2b65..142b35e9 100644 --- a/sp/src/public/networkvar.h +++ b/sp/src/public/networkvar.h @@ -455,7 +455,7 @@ public: SetX( ix ); SetY( iy ); SetZ( iz ); - SetZ( iw ); + SetW( iw ); } const Type& operator=( const Type &val ) diff --git a/sp/src/public/sourcevr/isourcevirtualreality.h b/sp/src/public/sourcevr/isourcevirtualreality.h index 3e438455..7b88a8b8 100644 --- a/sp/src/public/sourcevr/isourcevirtualreality.h +++ b/sp/src/public/sourcevr/isourcevirtualreality.h @@ -150,7 +150,9 @@ public: // ---------------------------------------------------------------------- virtual bool Activate() = 0; virtual void Deactivate() = 0; - + + virtual bool ShouldForceVRMode() = 0; + virtual void SetShouldForceVRMode() = 0; }; diff --git a/sp/src/public/steam/isteamapplist.h b/sp/src/public/steam/isteamapplist.h new file mode 100644 index 00000000..b9d71136 --- /dev/null +++ b/sp/src/public/steam/isteamapplist.h @@ -0,0 +1,63 @@ +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to app data in Steam +// +//============================================================================= + +#ifndef ISTEAMAPPLIST_H +#define ISTEAMAPPLIST_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam/isteamclient.h" +#include "steam/steamtypes.h" + +//----------------------------------------------------------------------------- +// Purpose: This is a restricted interface that can only be used by previously approved apps, +// contact your Steam Account Manager if you believe you need access to this API. +// This interface lets you detect installed apps for the local Steam client, useful for debugging tools +// to offer lists of apps to debug via Steam. +//----------------------------------------------------------------------------- +class ISteamAppList +{ +public: + virtual uint32 GetNumInstalledApps() = 0; + virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0; + + virtual int GetAppName( AppId_t nAppID, char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found + virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found + + virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game +}; + +#define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +//--------------------------------------------------------------------------------- +// Purpose: Sent when a new app is installed +//--------------------------------------------------------------------------------- +DEFINE_CALLBACK( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 ); + CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +END_DEFINE_CALLBACK_1() + + +//--------------------------------------------------------------------------------- +// Purpose: Sent when an app is uninstalled +//--------------------------------------------------------------------------------- +DEFINE_CALLBACK( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 ); + CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs +END_DEFINE_CALLBACK_1() + + +#pragma pack( pop ) +#endif // ISTEAMAPPLIST_H diff --git a/sp/src/public/steam/isteamapps.h b/sp/src/public/steam/isteamapps.h index 7021a352..7070e2e9 100644 --- a/sp/src/public/steam/isteamapps.h +++ b/sp/src/public/steam/isteamapps.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to app data in Steam // @@ -59,10 +59,19 @@ public: virtual bool GetCurrentBetaName( char *pchName, int cchNameBufferSize ) = 0; // returns current beta branch name, 'public' is the default branch virtual bool MarkContentCorrupt( bool bMissingFilesOnly ) = 0; // signal Steam that game files seems corrupt or missing - virtual uint32 GetInstalledDepots( DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order + virtual uint32 GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) = 0; // return installed depots in mount order // returns current app install folder for AppID, returns folder name length virtual uint32 GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize ) = 0; + virtual bool BIsAppInstalled( AppId_t appID ) = 0; // returns true if that app is installed (not necessarily owned) + + virtual CSteamID GetAppOwner() = 0; // returns the SteamID of the original owner. If different from current user, it's borrowed + + // Returns the associated launch param if the game is run via steam://run///?param1=value1;param2=value2;param3=value3 etc. + // Parameter names starting with the character '@' are reserved for internal use and will always return and empty string. + // Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, + // but it is advised that you not param names beginning with an underscore for your own features. + virtual const char *GetLaunchQueryParam( const char *pchKey ) = 0; #ifdef _PS3 // Result returned in a RegisterActivationCodeResponse_t callresult @@ -70,7 +79,7 @@ public: #endif }; -#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION005" +#define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION006" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) @@ -123,5 +132,18 @@ struct AppProofOfPurchaseKeyResponse_t uint32 m_nAppID; char m_rgchKey[ k_cubAppProofOfPurchaseKeyMax ]; }; + +//--------------------------------------------------------------------------------- +// Purpose: posted after the user gains executes a steam url with query parameters +// such as steam://run///?param1=value1;param2=value2;param3=value3; etc +// while the game is already running. The new params can be queried +// with GetLaunchQueryParam. +//--------------------------------------------------------------------------------- +struct NewLaunchQueryParameters_t +{ + enum { k_iCallback = k_iSteamAppsCallbacks + 14 }; +}; + + #pragma pack( pop ) #endif // ISTEAMAPPS_H diff --git a/sp/src/public/steam/isteamclient.h b/sp/src/public/steam/isteamclient.h index 43a2076e..b54ad3dc 100644 --- a/sp/src/public/steam/isteamclient.h +++ b/sp/src/public/steam/isteamclient.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: Main interface for loading and accessing Steamworks API's from the // Steam client. @@ -17,6 +17,10 @@ // Define compile time assert macros to let us validate the structure sizes. #define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1]; +#ifndef REFERENCE +#define REFERENCE(arg) ((void)arg) +#endif + #if defined(__linux__) || defined(__APPLE__) // The 32-bit version of gcc has the alignment requirement for uint64 and double set to // 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. @@ -83,10 +87,14 @@ class ISteamApps; class ISteamNetworking; class ISteamRemoteStorage; class ISteamScreenshots; +class ISteamMusic; class ISteamGameServerStats; class ISteamPS3OverlayRender; class ISteamHTTP; class ISteamUnifiedMessages; +class ISteamController; +class ISteamUGC; +class ISteamAppList; //----------------------------------------------------------------------------- // Purpose: Interface to creating a new steam instance, or to @@ -189,9 +197,20 @@ public: // Exposes the ISteamUnifiedMessages interface virtual ISteamUnifiedMessages *GetISteamUnifiedMessages( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + // Exposes the ISteamController interface + virtual ISteamController *GetISteamController( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Exposes the ISteamUGC interface + virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // returns app list interface, only available on specially registered apps + virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; + + // Music Player + virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0; }; -#define STEAMCLIENT_INTERFACE_VERSION "SteamClient012" +#define STEAMCLIENT_INTERFACE_VERSION "SteamClient014" //----------------------------------------------------------------------------- // Purpose: Base values for callback identifiers, each callback must @@ -228,6 +247,15 @@ enum { k_iSteamControllerCallbacks = 2800 }; enum { k_iClientParentalSettingsCallbacks = 2900 }; enum { k_iClientDeviceAuthCallbacks = 3000 }; enum { k_iClientNetworkDeviceManagerCallbacks = 3100 }; +enum { k_iClientMusicCallbacks = 3200 }; +enum { k_iClientRemoteClientManagerCallbacks = 3300 }; +enum { k_iClientUGCCallbacks = 3400 }; +enum { k_iSteamStreamClientCallbacks = 3500 }; +enum { k_IClientProductBuilderCallbacks = 3600 }; +enum { k_iClientShortcutsCallbacks = 3700 }; +enum { k_iClientRemoteControlManagerCallbacks = 3800 }; +enum { k_iSteamAppListCallbacks = 3900 }; +enum { k_iSteamMusicCallbacks = 4000 }; //----------------------------------------------------------------------------- @@ -236,21 +264,18 @@ enum { k_iClientNetworkDeviceManagerCallbacks = 3100 }; // Do not change any of these. //----------------------------------------------------------------------------- -class CSteamCallback +struct SteamCallback_t { public: - virtual const char *GetCallbackName() const = 0; - virtual uint32 GetCallbackID() const = 0; - virtual uint8 *GetFixedData() const = 0; - virtual uint32 GetFixedSize() const = 0; - virtual uint32 GetNumMemberVariables() const = 0; - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const = 0; + SteamCallback_t() {} }; #define DEFINE_CALLBACK( callbackname, callbackid ) \ -struct callbackname##_t { \ +struct callbackname : SteamCallback_t { \ enum { k_iCallback = callbackid }; \ - static callbackname##_t *GetNullPointer() { return 0; } + static callbackname *GetNullPointer() { return 0; } \ + static const char *GetCallbackName() { return #callbackname; } \ + static uint32 GetCallbackID() { return callbackname::k_iCallback; } #define CALLBACK_MEMBER( varidx, vartype, varname ) \ public: vartype varname ; \ @@ -269,64 +294,60 @@ struct callbackname##_t { \ *pszName = #varname; *pszType = #vartype; } -#define END_CALLBACK_INTERNAL_BEGIN( callbackname, numvars ) }; \ -class C##callbackname : public CSteamCallback { \ -public: callbackname##_t m_Data; \ - C##callbackname () { memset( &m_Data, 0, sizeof(m_Data) ); } \ - virtual const char *GetCallbackName() const { return #callbackname; } \ - virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \ - virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \ - virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \ - virtual uint32 GetNumMemberVariables() const { return numvars; } \ - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { \ +#define END_CALLBACK_INTERNAL_BEGIN( numvars ) \ + static uint32 GetNumMemberVariables() { return numvars; } \ + static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { \ switch ( index ) { default : return false; -#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : m_Data.GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true; +#define END_CALLBACK_INTERNAL_SWITCH( varidx ) case varidx : GetMemberVar_##varidx( varOffset, varSize, varCount, pszName, pszType ); return true; -#define END_CALLBACK_INTERNAL_END() }; }; }; +#define END_CALLBACK_INTERNAL_END() }; } }; -#define END_DEFINE_CALLBACK_0( callbackname ) }; \ -class C##callbackname : public CSteamCallback { \ -public: callbackname##_t m_Data; \ - virtual const char *GetCallbackName() const { return #callbackname; } \ - virtual uint32 GetCallbackID() const { return callbackname##_t::k_iCallback; } \ - virtual uint32 GetFixedSize() const { return sizeof( m_Data ); } \ - virtual uint8 *GetFixedData() const { return (uint8*)&m_Data; } \ - virtual uint32 GetNumMemberVariables() const { return 0; } \ - virtual bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) const { return false; } \ - }; \ +#define END_DEFINE_CALLBACK_0() \ + static uint32 GetNumMemberVariables() { return 0; } \ + static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { REFERENCE( pszType ); REFERENCE( pszName ); REFERENCE( varCount ); REFERENCE( varSize ); REFERENCE( varOffset ); REFERENCE( index ); return false; } \ + }; -#define END_DEFINE_CALLBACK_1( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 1 ) \ +#define END_DEFINE_CALLBACK_1() \ + END_CALLBACK_INTERNAL_BEGIN( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_2( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 2 ) \ +#define END_DEFINE_CALLBACK_2() \ + END_CALLBACK_INTERNAL_BEGIN( 2 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_3( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 3 ) \ +#define END_DEFINE_CALLBACK_3() \ + END_CALLBACK_INTERNAL_BEGIN( 3 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_4( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 4 ) \ +#define END_DEFINE_CALLBACK_4() \ + END_CALLBACK_INTERNAL_BEGIN( 4 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ END_CALLBACK_INTERNAL_SWITCH( 3 ) \ END_CALLBACK_INTERNAL_END() +#define END_DEFINE_CALLBACK_5() \ + END_CALLBACK_INTERNAL_BEGIN( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_6( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 6 ) \ + +#define END_DEFINE_CALLBACK_6() \ + END_CALLBACK_INTERNAL_BEGIN( 6 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ @@ -335,8 +356,8 @@ public: callbackname##_t m_Data; \ END_CALLBACK_INTERNAL_SWITCH( 5 ) \ END_CALLBACK_INTERNAL_END() -#define END_DEFINE_CALLBACK_7( callbackname ) \ - END_CALLBACK_INTERNAL_BEGIN( callbackname, 7 ) \ +#define END_DEFINE_CALLBACK_7() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ END_CALLBACK_INTERNAL_SWITCH( 0 ) \ END_CALLBACK_INTERNAL_SWITCH( 1 ) \ END_CALLBACK_INTERNAL_SWITCH( 2 ) \ @@ -346,4 +367,29 @@ public: callbackname##_t m_Data; \ END_CALLBACK_INTERNAL_SWITCH( 6 ) \ END_CALLBACK_INTERNAL_END() +#define END_DEFINE_CALLBACK_8() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_END() + +#define END_DEFINE_CALLBACK_9() \ + END_CALLBACK_INTERNAL_BEGIN( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 0 ) \ + END_CALLBACK_INTERNAL_SWITCH( 1 ) \ + END_CALLBACK_INTERNAL_SWITCH( 2 ) \ + END_CALLBACK_INTERNAL_SWITCH( 3 ) \ + END_CALLBACK_INTERNAL_SWITCH( 4 ) \ + END_CALLBACK_INTERNAL_SWITCH( 5 ) \ + END_CALLBACK_INTERNAL_SWITCH( 6 ) \ + END_CALLBACK_INTERNAL_SWITCH( 7 ) \ + END_CALLBACK_INTERNAL_SWITCH( 8 ) \ + END_CALLBACK_INTERNAL_END() + #endif // ISTEAMCLIENT_H diff --git a/sp/src/public/steam/isteamcontroller.h b/sp/src/public/steam/isteamcontroller.h index 6975e565..6a97a6fc 100644 --- a/sp/src/public/steam/isteamcontroller.h +++ b/sp/src/public/steam/isteamcontroller.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= // // Purpose: interface to valve controller // @@ -11,6 +11,7 @@ #endif #include "isteamclient.h" +#include "steamcontrollerpublic.h" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) @@ -21,16 +22,44 @@ #error isteamclient.h must be included #endif +#define MAX_STEAM_CONTROLLERS 16 #pragma pack( pop ) +enum ESteamControllerPad +{ + k_ESteamControllerPad_Left, + k_ESteamControllerPad_Right +}; + + //----------------------------------------------------------------------------- -// Purpose: Functions for accessing stats, achievements, and leaderboard information +// Purpose: Native Steam controller support API //----------------------------------------------------------------------------- class ISteamController { public: - + + // + // Native controller support API + // + + // Must call init and shutdown when starting/ending use of the interface + virtual bool Init( const char *pchAbsolutePathToControllerConfigVDF ) = 0; + virtual bool Shutdown() = 0; + + // Pump callback/callresult events, SteamAPI_RunCallbacks will do this for you, + // normally never need to call directly. + virtual void RunFrame() = 0; + + // Get the state of the specified controller, returns false if that controller is not connected + virtual bool GetControllerState( uint32 unControllerIndex, SteamControllerState_t *pState ) = 0; + + // Trigger a haptic pulse on the controller + virtual void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; + + // Set the override mode which is used to choose to use different base/legacy bindings from your config file + virtual void SetOverrideMode( const char *pchMode ) = 0; }; #define STEAMCONTROLLER_INTERFACE_VERSION "STEAMCONTROLLER_INTERFACE_VERSION" diff --git a/sp/src/public/steam/isteamfriends.h b/sp/src/public/steam/isteamfriends.h index fc0a8e79..16a2aa5a 100644 --- a/sp/src/public/steam/isteamfriends.h +++ b/sp/src/public/steam/isteamfriends.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright (C) 1996-2008, Valve Corporation, All rights reserved. ===== // // Purpose: interface to both friends list data and general information about users // @@ -203,6 +203,9 @@ public: // accesses old friends names - returns an empty string when their are no more items in the history virtual const char *GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName ) = 0; + // Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player. + virtual const char *GetPlayerNickname( CSteamID steamIDPlayer ) = 0; + // returns true if the specified user meets any of the criteria specified in iFriendFlags // iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values virtual bool HasFriend( CSteamID steamIDFriend, int iFriendFlags ) = 0; @@ -340,7 +343,7 @@ public: virtual int GetClanChatMemberCount( CSteamID steamIDClan ) = 0; virtual CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser ) = 0; virtual bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText ) = 0; - virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *, CSteamID * ) = 0; + virtual int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, CSteamID *psteamidChatter ) = 0; virtual bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser ) = 0; // interact with the Steam (game overlay / desktop) @@ -360,7 +363,7 @@ public: virtual SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex ) = 0; }; -#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends013" +#define STEAMFRIENDS_INTERFACE_VERSION "SteamFriends014" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) diff --git a/sp/src/public/steam/isteamgameserver.h b/sp/src/public/steam/isteamgameserver.h index c5667c10..cc109985 100644 --- a/sp/src/public/steam/isteamgameserver.h +++ b/sp/src/public/steam/isteamgameserver.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to steam for game servers // @@ -56,10 +56,7 @@ public: /// @see SteamServersConnected_t /// @see SteamServerConnectFailure_t /// @see SteamServersDisconnected_t - virtual void LogOn( - const char *pszAccountName, - const char *pszPassword - ) = 0; + virtual void LogOn( const char *pszToken ) = 0; /// Login to a generic, anonymous account. /// @@ -121,7 +118,7 @@ public: /// it allows users to filter in the matchmaking/server-browser interfaces based on the value /// /// @see k_cbMaxGameServerTags - virtual void SetGameTags( const char *pchGameTags ) = 0; + virtual void SetGameTags( const char *pchGameTags ) = 0; /// Sets a string defining the "gamedata" for this server, this is optional, but if it is set /// it allows users to filter in the matchmaking/server-browser interfaces based on the value @@ -129,7 +126,7 @@ public: /// acknowledged) /// /// @see k_cbMaxGameServerGameData - virtual void SetGameData( const char *pchGameData) = 0; + virtual void SetGameData( const char *pchGameData ) = 0; /// Region identifier. This is an optional field, the default value is empty, meaning the "world" region virtual void SetRegion( const char *pszRegion ) = 0; @@ -192,15 +189,10 @@ public: // returns false if we're not connected to the steam servers and thus cannot ask virtual bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup ) = 0; -// -// Query steam for server data -// - // Ask for the gameplay stats for the server. Results returned in a callback + // these two functions s are deprecated, and will not return results + // they will be removed in a future version of the SDK virtual void GetGameplayStats( ) = 0; - - // Gets the reputation score for the game server. This API also checks if the server or some - // other server on the same IP is banned from the Steam master servers. virtual SteamAPICall_t GetServerReputation( ) = 0; // Returns the public IP of the server according to Steam, useful when the server is @@ -255,7 +247,7 @@ public: }; -#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer011" +#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012" // game server flags const uint32 k_unServerFlagNone = 0x00; @@ -284,7 +276,8 @@ const uint32 k_unServerFlagPrivate = 0x20; // server shouldn't list on master struct GSClientApprove_t { enum { k_iCallback = k_iSteamGameServerCallbacks + 1 }; - CSteamID m_SteamID; + CSteamID m_SteamID; // SteamID of approved player + CSteamID m_OwnerSteamID; // SteamID of original owner for game license }; diff --git a/sp/src/public/steam/isteammatchmaking.h b/sp/src/public/steam/isteammatchmaking.h index 3d664f52..ca381b81 100644 --- a/sp/src/public/steam/isteammatchmaking.h +++ b/sp/src/public/steam/isteammatchmaking.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to steam managing game server/client match making // @@ -74,7 +74,7 @@ public: virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0; // removes the game server from the local storage; returns true if one was removed - virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; + virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0; /////// // Game lobby functions @@ -563,6 +563,7 @@ struct FavoritesListChanged_t uint32 m_nAppID; uint32 m_nFlags; bool m_bAdd; // true if this is adding the entry, otherwise it is a remove + AccountID_t m_unAccountId; }; @@ -725,6 +726,21 @@ struct PSNGameBootInviteResult_t bool m_bGameBootInviteExists; CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true }; + + +//----------------------------------------------------------------------------- +// Purpose: Result of our request to create a Lobby +// m_eResult == k_EResultOK on success +// at this point, the lobby has been joined and is ready for use +// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby) +//----------------------------------------------------------------------------- +struct FavoritesListAccountsUpdated_t +{ + enum { k_iCallback = k_iSteamMatchmakingCallbacks + 16 }; + + EResult m_eResult; +}; + #pragma pack( pop ) diff --git a/sp/src/public/steam/isteammusic.h b/sp/src/public/steam/isteammusic.h new file mode 100644 index 00000000..23f0b85c --- /dev/null +++ b/sp/src/public/steam/isteammusic.h @@ -0,0 +1,67 @@ +//============ Copyright (c) Valve Corporation, All rights reserved. ============ + +#ifndef ISTEAMMUSIC_H +#define ISTEAMMUSIC_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam/isteamclient.h" + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +enum AudioPlayback_Status +{ + AudioPlayback_Undefined = 0, + AudioPlayback_Playing = 1, + AudioPlayback_Paused = 2, + AudioPlayback_Idle = 3 +}; + + +//----------------------------------------------------------------------------- +// Purpose: Functions to control music playback in the steam client +//----------------------------------------------------------------------------- +class ISteamMusic +{ +public: + virtual bool BIsEnabled() = 0; + virtual bool BIsPlaying() = 0; + + virtual AudioPlayback_Status GetPlaybackStatus() = 0; + + virtual void Play() = 0; + virtual void Pause() = 0; + virtual void PlayPrevious() = 0; + virtual void PlayNext() = 0; + + // volume is between 0.0 and 1.0 + virtual void SetVolume( float flVolume ) = 0; + virtual float GetVolume() = 0; + +}; + +#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 ) +END_DEFINE_CALLBACK_0() + +DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 ) + CALLBACK_MEMBER( 0, float, m_flNewVolume ) +END_DEFINE_CALLBACK_1() + +#pragma pack( pop ) + + +#endif // #define ISTEAMMUSIC_H diff --git a/sp/src/public/steam/isteamremotestorage.h b/sp/src/public/steam/isteamremotestorage.h index 68f0f7e0..ed5aa526 100644 --- a/sp/src/public/steam/isteamremotestorage.h +++ b/sp/src/public/steam/isteamremotestorage.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: public interface to user remote file storage in Steam // @@ -41,6 +41,7 @@ struct SteamParamStringArray_t typedef uint64 UGCHandle_t; typedef uint64 PublishedFileUpdateHandle_t; typedef uint64 PublishedFileId_t; +const PublishedFileId_t k_PublishedFileIdInvalid = 0; const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull; const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull; @@ -87,21 +88,23 @@ enum EWorkshopFileType { k_EWorkshopFileTypeFirst = 0, - k_EWorkshopFileTypeCommunity = 0, - k_EWorkshopFileTypeMicrotransaction = 1, - k_EWorkshopFileTypeCollection = 2, - k_EWorkshopFileTypeArt = 3, - k_EWorkshopFileTypeVideo = 4, - k_EWorkshopFileTypeScreenshot = 5, - k_EWorkshopFileTypeGame = 6, - k_EWorkshopFileTypeSoftware = 7, - k_EWorkshopFileTypeConcept = 8, - k_EWorkshopFileTypeWebGuide = 9, - k_EWorkshopFileTypeIntegratedGuide = 10, - k_EWorkshopFileTypeMerch = 11, + k_EWorkshopFileTypeCommunity = 0, + k_EWorkshopFileTypeMicrotransaction = 1, + k_EWorkshopFileTypeCollection = 2, + k_EWorkshopFileTypeArt = 3, + k_EWorkshopFileTypeVideo = 4, + k_EWorkshopFileTypeScreenshot = 5, + k_EWorkshopFileTypeGame = 6, + k_EWorkshopFileTypeSoftware = 7, + k_EWorkshopFileTypeConcept = 8, + k_EWorkshopFileTypeWebGuide = 9, + k_EWorkshopFileTypeIntegratedGuide = 10, + k_EWorkshopFileTypeMerch = 11, + k_EWorkshopFileTypeControllerBinding = 12, + k_EWorkshopFileTypeSteamworksAccessInvite = 13, // Update k_EWorkshopFileTypeMax if you add values - k_EWorkshopFileTypeMax = 12 + k_EWorkshopFileTypeMax = 14 }; @@ -135,6 +138,28 @@ enum EWorkshopVideoProvider k_EWorkshopVideoProviderYoutube = 1 }; +enum +{ + k_WorkshopForceLoadPublishedFileDetailsFromCache = -1 +}; + +enum EUGCReadAction +{ + // Keeps the file handle open unless the last byte is read. You can use this when reading large files (over 100MB) in sequential chunks. + // If the last byte is read, this will behave the same as k_EUGCRead_Close. Otherwise, it behaves the same as k_EUGCRead_ContinueReading. + // This value maintains the same behavior as before the EUGCReadAction parameter was introduced. + k_EUGCRead_ContinueReadingUntilFinished = 0, + + // Keeps the file handle open. Use this when using UGCRead to seek to different parts of the file. + // When you are done seeking around the file, make a final call with k_EUGCRead_Close to close it. + k_EUGCRead_ContinueReading = 1, + + // Frees the file handle. Use this when you're done reading the content. + // To read the file from Steam again you will need to call UGCDownload again. + k_EUGCRead_Close = 2, +}; + + //----------------------------------------------------------------------------- // Purpose: Functions for accessing, reading and writing files stored remotely // and cached locally @@ -200,7 +225,7 @@ class ISteamRemoteStorage // enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail // unless UGCDownload is called again. // For especially large files (anything over 100MB) it is a requirement that the file is read in chunks. - virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset ) = 0; + virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0; // Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead() virtual int32 GetCachedUGCCount() = 0; @@ -235,8 +260,8 @@ class ISteamRemoteStorage virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0; virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0; // Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0, - // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh, - // a value of -1 will use cached data if it exists, no matter how old it is. + // cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh. + // A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is. virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0; virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0; // enumerate the files that the current user published with this app @@ -258,7 +283,7 @@ class ISteamRemoteStorage virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; }; -#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION011" +#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION012" // callbacks @@ -342,6 +367,7 @@ struct RemoteStorageFileShareResult_t enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 }; EResult m_eResult; // The result of the operation UGCHandle_t m_hFile; // The handle that can be shared with users and features + char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared }; @@ -480,6 +506,7 @@ struct RemoteStorageGetPublishedFileDetailsResult_t int32 m_nPreviewFileSize; // Size of the preview file char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) EWorkshopFileType m_eFileType; // Type of the file + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop }; @@ -491,6 +518,8 @@ struct RemoteStorageEnumerateWorkshopFilesResult_t int32 m_nTotalResultCount; PublishedFileId_t m_rgPublishedFileId[ k_unEnumeratePublishedFilesMaxResults ]; float m_rgScore[ k_unEnumeratePublishedFilesMaxResults ]; + AppId_t m_nAppId; + uint32 m_unStartIndex; }; @@ -603,6 +632,18 @@ struct RemoteStoragePublishFileProgress_t }; +//----------------------------------------------------------------------------- +// Purpose: Called when the content for a published file is updated +//----------------------------------------------------------------------------- +struct RemoteStoragePublishedFileUpdated_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 30 }; + PublishedFileId_t m_nPublishedFileId; // The published file id + AppId_t m_nAppID; // ID of the app that will consume this file. + UGCHandle_t m_hFile; // The new content +}; + + #pragma pack( pop ) diff --git a/sp/src/public/steam/isteamugc.h b/sp/src/public/steam/isteamugc.h new file mode 100644 index 00000000..ceee8f75 --- /dev/null +++ b/sp/src/public/steam/isteamugc.h @@ -0,0 +1,205 @@ +//====== Copyright 1996-2013, Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to steam ugc +// +//============================================================================= + +#ifndef ISTEAMUGC_H +#define ISTEAMUGC_H +#ifdef _WIN32 +#pragma once +#endif + +#include "isteamclient.h" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error isteamclient.h must be included +#endif + + +typedef uint64 UGCQueryHandle_t; +typedef uint64 UGCUpdateHandle_t; + + +const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull; +const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull; + + +// Matching UGC types for queries +enum EUGCMatchingUGCType +{ + k_EUGCMatchingUGCType_Items = 0, // both mtx items and ready-to-use items + k_EUGCMatchingUGCType_Items_Mtx = 1, + k_EUGCMatchingUGCType_Items_ReadyToUse = 2, + k_EUGCMatchingUGCType_Collections = 3, + k_EUGCMatchingUGCType_Artwork = 4, + k_EUGCMatchingUGCType_Videos = 5, + k_EUGCMatchingUGCType_Screenshots = 6, + k_EUGCMatchingUGCType_AllGuides = 7, // both web guides and integrated guides + k_EUGCMatchingUGCType_WebGuides = 8, + k_EUGCMatchingUGCType_IntegratedGuides = 9, + k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides + k_EUGCMatchingUGCType_ControllerBindings = 11, +}; + +// Different lists of published UGC for a user. +// If the current logged in user is different than the specified user, then some options may not be allowed. +enum EUserUGCList +{ + k_EUserUGCList_Published, + k_EUserUGCList_VotedOn, + k_EUserUGCList_VotedUp, + k_EUserUGCList_VotedDown, + k_EUserUGCList_WillVoteLater, + k_EUserUGCList_Favorited, + k_EUserUGCList_Subscribed, + k_EUserUGCList_UsedOrPlayed, + k_EUserUGCList_Followed, +}; + +// Sort order for user published UGC lists (defaults to creation order descending) +enum EUserUGCListSortOrder +{ + k_EUserUGCListSortOrder_CreationOrderDesc, + k_EUserUGCListSortOrder_CreationOrderAsc, + k_EUserUGCListSortOrder_TitleAsc, + k_EUserUGCListSortOrder_LastUpdatedDesc, + k_EUserUGCListSortOrder_SubscriptionDateDesc, + k_EUserUGCListSortOrder_VoteScoreDesc, + k_EUserUGCListSortOrder_ForModeration, +}; + +// Combination of sorting and filtering for queries across all UGC +enum EUGCQuery +{ + k_EUGCQuery_RankedByVote = 0, + k_EUGCQuery_RankedByPublicationDate = 1, + k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate = 2, + k_EUGCQuery_RankedByTrend = 3, + k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate = 4, + k_EUGCQuery_CreatedByFriendsRankedByPublicationDate = 5, + k_EUGCQuery_RankedByNumTimesReported = 6, + k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate = 7, + k_EUGCQuery_NotYetRated = 8, + k_EUGCQuery_RankedByTotalVotesAsc = 9, + k_EUGCQuery_RankedByVotesUp = 10, + k_EUGCQuery_RankedByTextSearch = 11, +}; + + +const uint32 kNumUGCResultsPerPage = 50; + +// Details for a single published file/UGC +struct SteamUGCDetails_t +{ + PublishedFileId_t m_nPublishedFileId; + EResult m_eResult; // The result of the operation. + EWorkshopFileType m_eFileType; // Type of the file + AppId_t m_nCreatorAppID; // ID of the app that created this file. + AppId_t m_nConsumerAppID; // ID of the app that will consume this file. + char m_rgchTitle[k_cchPublishedDocumentTitleMax]; // title of document + char m_rgchDescription[k_cchPublishedDocumentDescriptionMax]; // description of document + uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content. + uint32 m_rtimeCreated; // time when the published file was created + uint32 m_rtimeUpdated; // time when the published file was last updated + uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable) + ERemoteStoragePublishedFileVisibility m_eVisibility; // visibility + bool m_bBanned; // whether the file was banned + bool m_bAcceptedForUse; // developer has specifically flagged this item as accepted in the Workshop + bool m_bTagsTruncated; // whether the list of tags was too long to be returned in the provided buffer + char m_rgchTags[k_cchTagListMax]; // comma separated list of all tags associated with this file + // file/url information + UGCHandle_t m_hFile; // The handle of the primary file + UGCHandle_t m_hPreviewFile; // The handle of the preview file + char m_pchFileName[k_cchFilenameMax]; // The cloud filename of the primary file + int32 m_nFileSize; // Size of the primary file + int32 m_nPreviewFileSize; // Size of the preview file + char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) + // voting information + uint32 m_unVotesUp; // number of votes up + uint32 m_unVotesDown; // number of votes down + float m_flScore; // calculated score +}; + +//----------------------------------------------------------------------------- +// Purpose: Steam UGC support API +//----------------------------------------------------------------------------- +class ISteamUGC +{ +public: + + // Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1. + virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0; + + // Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1. + virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0; + + // Send the query to Steam + virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0; + + // Retrieve an individual result after receiving the callback for querying UGC + virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0; + + // Release the request to free up memory, after retrieving results + virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0; + + // Options to set for querying UGC + virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; + virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0; + virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0; + virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0; + virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0; + + // Options only for querying user UGC + virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0; + + // Options only for querying all UGC + virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0; + virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0; + virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0; + + // Request full details for one piece of UGC + virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0; + +}; + +#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION002" + +//----------------------------------------------------------------------------- +// Purpose: Callback for querying UGC +//----------------------------------------------------------------------------- +struct SteamUGCQueryCompleted_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 1 }; + UGCQueryHandle_t m_handle; + EResult m_eResult; + uint32 m_unNumResultsReturned; + uint32 m_unTotalMatchingResults; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + +//----------------------------------------------------------------------------- +// Purpose: Callback for requesting details on one piece of UGC +//----------------------------------------------------------------------------- +struct SteamUGCRequestUGCDetailsResult_t +{ + enum { k_iCallback = k_iClientUGCCallbacks + 2 }; + SteamUGCDetails_t m_details; + bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache +}; + + +//----------------------------------------------------------------------------- +// Purpose: k_iClientUGCCallbacks + 3 to k_iClientUGCCallbacks + 6 in use +//----------------------------------------------------------------------------- + + +#pragma pack( pop ) + +#endif // ISTEAMUGC_H diff --git a/sp/src/public/steam/isteamuser.h b/sp/src/public/steam/isteamuser.h index 5470acb7..a670849e 100644 --- a/sp/src/public/steam/isteamuser.h +++ b/sp/src/public/steam/isteamuser.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to user account information in Steam // @@ -97,7 +97,7 @@ public: // levels of speech are detected. // nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case) // If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate - virtual EVoiceResult GetAvailableVoice(uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate) = 0; + virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate ) = 0; // Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to // DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format. @@ -158,6 +158,14 @@ public: // retrieve a finished ticket virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0; + // Trading Card badges data access + // if you only have one set of cards, the series will be 1 + // the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1) + virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0; + + // gets the Steam Level of the user, as shown on their profile + virtual int GetPlayerSteamLevel() = 0; + #ifdef _PS3 // Initiates PS3 Logon request using just PSN ticket. // @@ -197,7 +205,7 @@ public: }; -#define STEAMUSER_INTERFACE_VERSION "SteamUser016" +#define STEAMUSER_INTERFACE_VERSION "SteamUser017" // callbacks @@ -287,6 +295,7 @@ struct ValidateAuthTicketResponse_t enum { k_iCallback = k_iSteamUserCallbacks + 43 }; CSteamID m_SteamID; EAuthSessionResponse m_eAuthSessionResponse; + CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed }; diff --git a/sp/src/public/steam/isteamutils.h b/sp/src/public/steam/isteamutils.h index b40677c5..7f8d6bf0 100644 --- a/sp/src/public/steam/isteamutils.h +++ b/sp/src/public/steam/isteamutils.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: interface to utility functions in Steam // @@ -149,17 +149,20 @@ public: #endif // Activates the Big Picture text input dialog which only supports gamepad input - virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax ) = 0; + virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0; // Returns previously entered text & length virtual uint32 GetEnteredGamepadTextLength() = 0; - virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0; + virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0; // returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases virtual const char *GetSteamUILanguage() = 0; + + // returns true if Steam itself is running in VR mode + virtual bool IsSteamRunningInVR() = 0; }; -#define STEAMUTILS_INTERFACE_VERSION "SteamUtils006" +#define STEAMUTILS_INTERFACE_VERSION "SteamUtils007" // callbacks diff --git a/sp/src/public/steam/matchmakingtypes.h b/sp/src/public/steam/matchmakingtypes.h index fae9fe7a..df6a2d4f 100644 --- a/sp/src/public/steam/matchmakingtypes.h +++ b/sp/src/public/steam/matchmakingtypes.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -32,6 +32,11 @@ const int k_cbMaxGameServerName = 64; const int k_cbMaxGameServerTags = 128; const int k_cbMaxGameServerGameData = 2048; +/// Store key/value pair used in matchmaking queries. +/// +/// Actually, the name Key/Value is a bit misleading. The "key" is better +/// understood as "filter operation code" and the "value" is the operand to this +/// filter operation. The meaning of the operand depends upon the filter. struct MatchMakingKeyValuePair_t { MatchMakingKeyValuePair_t() { m_szKey[0] = m_szValue[0] = 0; } diff --git a/sp/src/public/steam/steam_api.h b/sp/src/public/steam/steam_api.h index 4f4f5a52..d1ebd2c2 100644 --- a/sp/src/public/steam/steam_api.h +++ b/sp/src/public/steam/steam_api.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright 1996-2008, Valve Corporation, All rights reserved. ======= // // Purpose: // @@ -20,9 +20,12 @@ #include "isteamnetworking.h" #include "isteamremotestorage.h" #include "isteamscreenshots.h" +#include "isteammusic.h" #include "isteamhttp.h" #include "isteamunifiedmessages.h" #include "isteamcontroller.h" +#include "isteamugc.h" +#include "isteamapplist.h" #if defined( _PS3 ) #include "steamps3params.h" @@ -59,10 +62,10 @@ //----------------------------------------------------------------------------------------------------------------------------------------------------------// // S_API void SteamAPI_Init(); (see below) -S_API void SteamAPI_Shutdown(); +S_API void S_CALLTYPE SteamAPI_Shutdown(); // checks if a local Steam client is running -S_API bool SteamAPI_IsSteamRunning(); +S_API bool S_CALLTYPE SteamAPI_IsSteamRunning(); // Detects if your executable was launched through the Steam client, and restarts your game through // the client if necessary. The Steam client will be started if it is not running. @@ -75,14 +78,14 @@ S_API bool SteamAPI_IsSteamRunning(); // // NOTE: This function should be used only if you are using CEG or not using Steam's DRM. Once applied // to your executable, Steam's DRM will handle restarting through Steam if necessary. -S_API bool SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ); +S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary( uint32 unOwnAppID ); // crash dump recording functions -S_API void SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); -S_API void SteamAPI_SetMiniDumpComment( const char *pchMsg ); +S_API void S_CALLTYPE SteamAPI_WriteMiniDump( uint32 uStructuredExceptionCode, void* pvExceptionInfo, uint32 uBuildID ); +S_API void S_CALLTYPE SteamAPI_SetMiniDumpComment( const char *pchMsg ); // interface pointers, configured by SteamAPI_Init() -S_API ISteamClient *SteamClient(); +S_API ISteamClient *S_CALLTYPE SteamClient(); // @@ -96,29 +99,33 @@ S_API ISteamClient *SteamClient(); // functions below to get at the Steam interfaces. // #ifdef VERSION_SAFE_STEAM_API_INTERFACES -S_API bool SteamAPI_InitSafe(); +S_API bool S_CALLTYPE SteamAPI_InitSafe(); #else #if defined(_PS3) -S_API bool SteamAPI_Init( SteamPS3Params_t *pParams ); +S_API bool S_CALLTYPE SteamAPI_Init( SteamPS3Params_t *pParams ); #else -S_API bool SteamAPI_Init(); +S_API bool S_CALLTYPE SteamAPI_Init(); #endif -S_API ISteamUser *SteamUser(); -S_API ISteamFriends *SteamFriends(); -S_API ISteamUtils *SteamUtils(); -S_API ISteamMatchmaking *SteamMatchmaking(); -S_API ISteamUserStats *SteamUserStats(); -S_API ISteamApps *SteamApps(); -S_API ISteamNetworking *SteamNetworking(); -S_API ISteamMatchmakingServers *SteamMatchmakingServers(); -S_API ISteamRemoteStorage *SteamRemoteStorage(); -S_API ISteamScreenshots *SteamScreenshots(); -S_API ISteamHTTP *SteamHTTP(); -S_API ISteamUnifiedMessages *SteamUnifiedMessages(); +S_API ISteamUser *S_CALLTYPE SteamUser(); +S_API ISteamFriends *S_CALLTYPE SteamFriends(); +S_API ISteamUtils *S_CALLTYPE SteamUtils(); +S_API ISteamMatchmaking *S_CALLTYPE SteamMatchmaking(); +S_API ISteamUserStats *S_CALLTYPE SteamUserStats(); +S_API ISteamApps *S_CALLTYPE SteamApps(); +S_API ISteamNetworking *S_CALLTYPE SteamNetworking(); +S_API ISteamMatchmakingServers *S_CALLTYPE SteamMatchmakingServers(); +S_API ISteamRemoteStorage *S_CALLTYPE SteamRemoteStorage(); +S_API ISteamScreenshots *S_CALLTYPE SteamScreenshots(); +S_API ISteamHTTP *S_CALLTYPE SteamHTTP(); +S_API ISteamUnifiedMessages *S_CALLTYPE SteamUnifiedMessages(); +S_API ISteamController *S_CALLTYPE SteamController(); +S_API ISteamUGC *S_CALLTYPE SteamUGC(); +S_API ISteamAppList *S_CALLTYPE SteamAppList(); +S_API ISteamMusic *S_CALLTYPE SteamMusic(); #ifdef _PS3 -S_API ISteamPS3OverlayRender * SteamPS3OverlayRender(); +S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender(); #endif #endif // VERSION_SAFE_STEAM_API_INTERFACES @@ -132,16 +139,16 @@ S_API ISteamPS3OverlayRender * SteamPS3OverlayRender(); // to as many functions/objects as are registered to it //----------------------------------------------------------------------------------------------------------------------------------------------------------// -S_API void SteamAPI_RunCallbacks(); +S_API void S_CALLTYPE SteamAPI_RunCallbacks(); // functions used by the utility CCallback objects to receive callbacks -S_API void SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); -S_API void SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); +S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); +S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); // functions used by the utility CCallResult objects to receive async call results -S_API void SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); -S_API void SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); +S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); +S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); //----------------------------------------------------------------------------- @@ -397,6 +404,10 @@ public: ISteamScreenshots* SteamScreenshots() { return m_pSteamScreenshots; } ISteamHTTP* SteamHTTP() { return m_pSteamHTTP; } ISteamUnifiedMessages* SteamUnifiedMessages() { return m_pSteamUnifiedMessages; } + ISteamController* SteamController() { return m_pController; } + ISteamUGC* SteamUGC() { return m_pSteamUGC; } + ISteamAppList* SteamAppList() { return m_pSteamAppList; } + ISteamMusic* SteamMusic() { return m_pSteamMusic; } #ifdef _PS3 ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; } #endif @@ -415,6 +426,9 @@ private: ISteamHTTP *m_pSteamHTTP; ISteamUnifiedMessages*m_pSteamUnifiedMessages; ISteamController *m_pController; + ISteamUGC *m_pSteamUGC; + ISteamAppList *m_pSteamAppList; + ISteamMusic *m_pSteamMusic; #ifdef _PS3 ISteamPS3OverlayRender *m_pSteamPS3OverlayRender; #endif @@ -438,7 +452,11 @@ inline void CSteamAPIContext::Clear() m_pSteamRemoteStorage = NULL; m_pSteamHTTP = NULL; m_pSteamScreenshots = NULL; + m_pSteamMusic = NULL; m_pSteamUnifiedMessages = NULL; + m_pController = NULL; + m_pSteamUGC = NULL; + m_pSteamAppList = NULL; #ifdef _PS3 m_pSteamPS3OverlayRender = NULL; #endif @@ -501,6 +519,24 @@ inline bool CSteamAPIContext::Init() if ( !m_pSteamUnifiedMessages ) return false; + m_pController = SteamClient()->GetISteamController( hSteamUser, hSteamPipe, STEAMCONTROLLER_INTERFACE_VERSION ); + if ( !m_pController ) + return false; + + m_pSteamUGC = SteamClient()->GetISteamUGC( hSteamUser, hSteamPipe, STEAMUGC_INTERFACE_VERSION ); + if ( !m_pSteamUGC ) + return false; + + m_pSteamAppList = SteamClient()->GetISteamAppList( hSteamUser, hSteamPipe, STEAMAPPLIST_INTERFACE_VERSION ); + if ( !m_pSteamAppList ) + return false; + + m_pSteamMusic = SteamClient()->GetISteamMusic( hSteamUser, hSteamPipe, STEAMMUSIC_INTERFACE_VERSION ); + if ( !m_pSteamMusic ) + { + return false; + } + #ifdef _PS3 m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender(); #endif @@ -512,13 +548,13 @@ inline bool CSteamAPIContext::Init() #if defined(USE_BREAKPAD_HANDLER) || defined(STEAM_API_EXPORTS) // this should be called before the game initialized the steam APIs -// pchDate should be of the format "Mmm dd yyyy" (such as from the __DATE __ macro ) -// pchTime should be of the format "hh:mm:ss" (such as from the __TIME __ macro ) +// pchDate should be of the format "Mmm dd yyyy" (such as from the __DATE__ macro ) +// pchTime should be of the format "hh:mm:ss" (such as from the __TIME__ macro ) // bFullMemoryDumps (Win32 only) -- writes out a uuid-full.dmp in the client/dumps folder // pvContext-- can be NULL, will be the void * context passed into m_pfnPreMinidumpCallback // PFNPreMinidumpCallback m_pfnPreMinidumpCallback -- optional callback which occurs just before a .dmp file is written during a crash. Applications can hook this to allow adding additional information into the .dmp comment stream. -S_API void SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ); -S_API void SteamAPI_SetBreakpadAppID( uint32 unAppID ); +S_API void S_CALLTYPE SteamAPI_UseBreakpadCrashHandler( char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback ); +S_API void S_CALLTYPE SteamAPI_SetBreakpadAppID( uint32 unAppID ); #endif #endif // STEAM_API_H diff --git a/sp/src/public/steam/steamclientpublic.h b/sp/src/public/steam/steamclientpublic.h index b1292673..62eddb76 100644 --- a/sp/src/public/steam/steamclientpublic.h +++ b/sp/src/public/steam/steamclientpublic.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -20,7 +20,7 @@ // interface layer, no need to include anything about the implementation. #include "steamtypes.h" - +#include "steamuniverse.h" // General result codes enum EResult @@ -102,7 +102,13 @@ enum EResult k_EResultNoMatchingURL = 75, k_EResultBadResponse = 76, // parse failure, missing field, etc. k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password - k_EResultValueOutOfRange = 78 // the value entered is outside the acceptable range + k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range + k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen + k_EResultDisabled = 80, // The requested service has been configured to be unavailable + k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid ! + k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action + k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted + k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent }; // Error codes for use with the voice functions @@ -178,18 +184,6 @@ typedef enum } EUserHasLicenseForAppResult; -// Steam universes. Each universe is a self-contained Steam instance. -enum EUniverse -{ - k_EUniverseInvalid = 0, - k_EUniversePublic = 1, - k_EUniverseBeta = 2, - k_EUniverseInternal = 3, - k_EUniverseDev = 4, - // k_EUniverseRC = 5, // no such universe anymore - k_EUniverseMax -}; - // Steam account types enum EAccountType { @@ -227,15 +221,21 @@ enum EAppReleaseState //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -enum EAppOwernshipFlags +enum EAppOwnershipFlags { - k_EAppOwernshipFlags_None = 0, // unknown - k_EAppOwernshipFlags_OwnsLicense = 1, // owns license for this game - k_EAppOwernshipFlags_FreeLicense = 2, // not paid for game - k_EAppOwernshipFlags_RegionRestricted = 4, // owns app, but not allowed to play in current region - k_EAppOwernshipFlags_LowViolence = 8, // only low violence version - k_EAppOwernshipFlags_InvalidPlatform = 16, // app not supported on current platform - k_EAppOwernshipFlags_DeviceLicense = 32, // license was granted by authorized local device + k_EAppOwnershipFlags_None = 0x000, // unknown + k_EAppOwnershipFlags_OwnsLicense = 0x001, // owns license for this game + k_EAppOwnershipFlags_FreeLicense = 0x002, // not paid for game + k_EAppOwnershipFlags_RegionRestricted = 0x004, // owns app, but not allowed to play in current region + k_EAppOwnershipFlags_LowViolence = 0x008, // only low violence version + k_EAppOwnershipFlags_InvalidPlatform = 0x010, // app not supported on current platform + k_EAppOwnershipFlags_SharedLicense = 0x020, // license was granted by authorized local device + k_EAppOwnershipFlags_FreeWeekend = 0x040, // owned by a free weekend licenses + k_EAppOwnershipFlags_LicenseLocked = 0x080, // shared license is locked (in use) by other user + k_EAppOwnershipFlags_LicensePending = 0x100, // owns app, but transaction is still pending. Can't install or play + k_EAppOwnershipFlags_LicenseExpired = 0x200, // doesn't own app anymore since license expired + k_EAppOwnershipFlags_LicensePermanent = 0x400, // permanent license, not borrowed, or guest or freeweekend etc + k_EAppOwnershipFlags_LicenseRecurring = 0x800, // Recurring license, user is charged periodically }; @@ -253,7 +253,8 @@ enum EAppType k_EAppType_DLC = 0x020, // down loadable content k_EAppType_Guide = 0x040, // game guide, PDF etc k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc) - + k_EAppType_Config = 0x100, // hidden app used to config Steam features (backpack, sales, etc) + k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace }; @@ -449,6 +450,12 @@ public: { SetFromUint64( ulSteamID ); } +#ifdef INT64_DIFFERENT_FROM_INT64_T + CSteamID( uint64_t ulSteamID ) + { + SetFromUint64( (uint64)ulSteamID ); + } +#endif //----------------------------------------------------------------------------- @@ -463,7 +470,7 @@ public: m_steamid.m_comp.m_EUniverse = eUniverse; m_steamid.m_comp.m_EAccountType = eAccountType; - if ( eAccountType == k_EAccountTypeClan ) + if ( eAccountType == k_EAccountTypeClan || eAccountType == k_EAccountTypeGameServer ) { m_steamid.m_comp.m_unAccountInstance = 0; } @@ -720,6 +727,9 @@ public: const char * Render() const; // renders this steam ID to string static const char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string + const char * RenderLink() const; // renders this steam ID to an admin console link string + static const char * RenderLink( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string + void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse ); // SetFromString allows many partially-correct strings, constraining how // we might be able to change things in the future. @@ -845,6 +855,12 @@ public: { m_ulGameID = ulGameID; } +#ifdef INT64_DIFFERENT_FROM_INT64_T + CGameID( uint64_t ulGameID ) + { + m_ulGameID = (uint64)ulGameID; + } +#endif explicit CGameID( int32 nAppID ) { diff --git a/sp/src/public/steam/steamcontrollerpublic.h b/sp/src/public/steam/steamcontrollerpublic.h new file mode 100644 index 00000000..04493332 --- /dev/null +++ b/sp/src/public/steam/steamcontrollerpublic.h @@ -0,0 +1,76 @@ +//========= Copyright © 1996-2013, Valve LLC, All rights reserved. ============ +// +// Purpose: Controller related public types/constants +// +//============================================================================= + +#ifndef STEAMCONTROLLERPUBLIC_H +#define STEAMCONTROLLERPUBLIC_H +#ifdef _WIN32 +#pragma once +#endif + + +#if defined( STEAM ) || defined( ISTEAMCONTROLLER_H ) +// This file should only be included by the Steam build or directly from +// isteamcontroller.h. +#include "steamtypes.h" +#else +// Otherwise, we assume it's a firmware build, which doesn't deal with all the +// things that exist in steamtypes.h, and hardcode the typedefs we need. +typedef unsigned int uint32; +typedef unsigned __int64 uint64; +#endif + +#pragma pack(1) + +// Safe to add new bitfields at the end of this list for new buttons/actions, +// but never re-use or re-number an existing flag as old client code will be +// confused. +#define STEAM_RIGHT_TRIGGER_MASK 0x0000000000000001l +#define STEAM_LEFT_TRIGGER_MASK 0x0000000000000002l +#define STEAM_RIGHT_BUMPER_MASK 0x0000000000000004l +#define STEAM_LEFT_BUMPER_MASK 0x0000000000000008l +#define STEAM_BUTTON_0_MASK 0x0000000000000010l +#define STEAM_BUTTON_1_MASK 0x0000000000000020l +#define STEAM_BUTTON_2_MASK 0x0000000000000040l +#define STEAM_BUTTON_3_MASK 0x0000000000000080l +#define STEAM_TOUCH_0_MASK 0x0000000000000100l +#define STEAM_TOUCH_1_MASK 0x0000000000000200l +#define STEAM_TOUCH_2_MASK 0x0000000000000400l +#define STEAM_TOUCH_3_MASK 0x0000000000000800l +#define STEAM_BUTTON_MENU_MASK 0x0000000000001000l +#define STEAM_BUTTON_STEAM_MASK 0x0000000000002000l +#define STEAM_BUTTON_ESCAPE_MASK 0x0000000000004000l +#define STEAM_BUTTON_BACK_LEFT_MASK 0x0000000000008000l +#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0000000000010000l +#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0000000000020000l +#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0000000000040000l +#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0000000000080000l +#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0000000000100000l + +// Only add fields to the end of this struct, or if you need to change it in a larger +// way add a new message id and new struct completely so as to not break old clients. +typedef struct +{ + // If packet num matches that on your prior call, then the controller state hasn't been changed since + // your last call and there is no need to process it + uint32 unPacketNum; + + // bit flags for each of the buttons + uint64 ulButtons; + + // Left pad coordinates + short sLeftPadX; + short sLeftPadY; + + // Right pad coordinates + short sRightPadX; + short sRightPadY; + +} SteamControllerState_t; + +#pragma pack() + +#endif // STEAMCONTROLLERPUBLIC_H + diff --git a/sp/src/public/steam/steamhttpenums.h b/sp/src/public/steam/steamhttpenums.h index c75b59cd..9ac2eeaf 100644 --- a/sp/src/public/steam/steamhttpenums.h +++ b/sp/src/public/steam/steamhttpenums.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. ======= // // Purpose: HTTP related enums, stuff that is shared by both clients and servers, and our // UI projects goes here. @@ -20,13 +20,13 @@ enum EHTTPMethod k_EHTTPMethodGET, k_EHTTPMethodHEAD, k_EHTTPMethodPOST, + k_EHTTPMethodPUT, + k_EHTTPMethodDELETE, + k_EHTTPMethodOPTIONS, // The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for // a compliant general purpose server. We'll likely add more as we find uses for them. - // k_EHTTPMethodOPTIONS, - k_EHTTPMethodPUT, - k_EHTTPMethodDELETE, // k_EHTTPMethodTRACE, // k_EHTTPMethodCONNECT }; diff --git a/sp/src/public/steam/steamtypes.h b/sp/src/public/steam/steamtypes.h index 5525c925..b26990da 100644 --- a/sp/src/public/steam/steamtypes.h +++ b/sp/src/public/steam/steamtypes.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -10,6 +10,8 @@ #pragma once #endif +#define S_CALLTYPE __cdecl + // Steam-specific types. Defined here so this header file can be included in other code bases. #ifndef WCHARTYPES_H typedef unsigned char uint8; @@ -43,6 +45,9 @@ typedef unsigned __int32 uint32; typedef __int64 int64; typedef unsigned __int64 uint64; +typedef int64 lint64; +typedef uint64 ulint64; + #ifdef X64BITS typedef __int64 intp; // intp is an integer that can accomodate a pointer typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) @@ -59,6 +64,16 @@ typedef int int32; typedef unsigned int uint32; typedef long long int64; typedef unsigned long long uint64; + +// [u]int64 are actually defined as 'long long' and gcc 64-bit +// doesn't automatically consider them the same as 'long int'. +// Changing the types for [u]int64 is complicated by +// there being many definitions, so we just +// define a 'long int' here and use it in places that would +// otherwise confuse the compiler. +typedef long int lint64; +typedef unsigned long int ulint64; + #ifdef X64BITS typedef long long intp; typedef unsigned long long uintp; diff --git a/sp/src/public/steam/steamuniverse.h b/sp/src/public/steam/steamuniverse.h new file mode 100644 index 00000000..dd384dcc --- /dev/null +++ b/sp/src/public/steam/steamuniverse.h @@ -0,0 +1,27 @@ +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ +// +// Purpose: +// +//============================================================================= + +#ifndef STEAMUNIVERSE_H +#define STEAMUNIVERSE_H +#ifdef _WIN32 +#pragma once +#endif + + +// Steam universes. Each universe is a self-contained Steam instance. +enum EUniverse +{ + k_EUniverseInvalid = 0, + k_EUniversePublic = 1, + k_EUniverseBeta = 2, + k_EUniverseInternal = 3, + k_EUniverseDev = 4, + // k_EUniverseRC = 5, // no such universe anymore + k_EUniverseMax +}; + + +#endif // STEAMUNIVERSE_H diff --git a/sp/src/public/steam/steamvr.h b/sp/src/public/steam/steamvr.h new file mode 100644 index 00000000..68a932dd --- /dev/null +++ b/sp/src/public/steam/steamvr.h @@ -0,0 +1,242 @@ +#pragma once + +#include + +namespace vr +{ + +#if defined(__linux__) || defined(__APPLE__) + // The 32-bit version of gcc has the alignment requirement for uint64 and double set to + // 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned. + // The 64-bit version of gcc has the alignment requirement for these types set to + // 8 meaning that unless we use #pragma pack(4) our structures will get bigger. + // The 64-bit structure packing has to match the 32-bit structure packing for each platform. +#pragma pack( push, 4 ) +#else +#pragma pack( push, 8 ) +#endif + + +// right-handed system +// +y is up +// +x is to the right +// -z is going away from you +// Distance unit is meters +struct HmdMatrix34_t +{ + float m[3][4]; +}; + +struct HmdMatrix44_t +{ + float m[4][4]; +}; + + +/** Used to return the post-distortion UVs for each color channel. +* UVs range from 0 to 1 with 0,0 in the upper left corner of the +* source render target. The 0,0 to 1,1 range covers a single eye. */ +struct DistortionCoordinates_t +{ + float rfRed[2]; + float rfGreen[2]; + float rfBlue[2]; +}; + + +enum Hmd_Eye +{ + Eye_Left = 0, + Eye_Right = 1 +}; + +enum GraphicsAPIConvention +{ + API_DirectX = 0, // Normalized Z goes from 0 at the viewer to 1 at the far clip plane + API_OpenGL = 1, // Normalized Z goes from 1 at the viewer to -1 at the far clip plane +}; + +enum HmdTrackingResult +{ + TrackingResult_Uninitialized = 1, + + TrackingResult_Calibrating_InProgress = 100, + TrackingResult_Calibrating_OutOfRange = 101, + + TrackingResult_Running_OK = 200, + TrackingResult_Running_OutOfRange = 201, +}; + +class IHmd +{ +public: + + + // ------------------------------------ + // Display Methods + // ------------------------------------ + + /** Size and position that the window needs to be on the VR display. */ + virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Suggested size for the intermediate render target that the distortion pulls from. */ + virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Gets the viewport in the frame buffer to draw the output of the distortion into */ + virtual void GetEyeOutputViewport( Hmd_Eye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** The projection matrix for the specified eye */ + virtual HmdMatrix44_t GetProjectionMatrix( Hmd_Eye eEye, float fNearZ, float fFarZ, GraphicsAPIConvention eProjType ) = 0; + + /** The components necessary to build your own projection matrix in case your + * application is doing something fancy like infinite Z */ + virtual void GetProjectionRaw( Hmd_Eye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0; + + /** Returns the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in + * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. */ + virtual DistortionCoordinates_t ComputeDistortion( Hmd_Eye eEye, float fU, float fV ) = 0; + + /** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head + * space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection. + * Normally View and Eye^-1 will be multiplied together and treated as View in your application. + */ + virtual HmdMatrix34_t GetHeadFromEyePose( Hmd_Eye eEye ) = 0; + + /** For use in simple VR apps, this method returns the concatenation of the + * tracking pose and the eye matrix to get a full view matrix for each eye. + * This is ( GetEyeMatrix() ) * (GetWorldFromHeadPose() ^ -1 ) */ + virtual bool GetViewMatrix( float fSecondsFromNow, HmdMatrix44_t *pMatLeftView, HmdMatrix44_t *pMatRightView, HmdTrackingResult *peResult ) = 0; + + /** [D3D9 Only] + * Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such + * a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error. + */ + virtual int32_t GetD3D9AdapterIndex() = 0; + + /** [D3D10/11 Only] + * Returns the adapter index and output index that the user should pass into EnumAdapters adn EnumOutputs + * to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1. + */ + virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0; + + // ------------------------------------ + // Tracking Methods + // ------------------------------------ + + /** The pose that the tracker thinks that the HMD will be in at the specified + * number of seconds into the future. Pass 0 to get the current state. + * + * This is roughly analogous to the inverse of the view matrix in most applications, though + * many games will need to do some additional rotation or translation on top of the rotation + * and translation provided by the head pose. + * + * If this function returns true the pose has been populated with a pose that can be used by the application. + * Check peResult for details about the pose, including messages that should be displayed to the user. + */ + virtual bool GetTrackerFromHeadPose( float fPredictedSecondsFromNow, HmdMatrix34_t *pmPose, HmdTrackingResult *peResult ) = 0; + + /** Passes back the pose matrix from the last successful call to GetWorldFromHeadPose(). Returns true if that matrix is + * valid (because there has been a previous successful pose.) */ + virtual bool GetLastTrackerFromHeadPose( HmdMatrix34_t *pmPose ) = 0; + + /** Returns true if the tracker for this HMD will drift the Yaw component of its pose over time regardless of + * actual head motion. This is true for gyro-based trackers with no ground truth. */ + virtual bool WillDriftInYaw() = 0; + + /** Sets the zero pose for the tracker coordinate system. After this call all WorldFromHead poses will be relative + * to the pose whenever this was called. The new zero coordinate system will not change the fact that the Y axis is + * up in the real world, so the next pose returned from GetWorldFromHeadPose after a call to ZeroTracker may not be + * exactly an identity matrix. */ + virtual void ZeroTracker() = 0; + + /** Returns the zero pose for the tracker coordinate system. If the tracker has never had a valid pose, this + * will be an identity matrix. */ + virtual HmdMatrix34_t GetTrackerZeroPose() = 0; + + // ------------------------------------ + // Administrative methods + // ------------------------------------ + + /** The ID of the driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If + * the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes + * will be enough to fit any ID. */ + virtual uint32_t GetDriverId( char *pchBuffer, uint32_t unBufferLen ) = 0; + + /** The ID of this display within its driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If + * the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes + * will be enough to fit any ID. */ + virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0; +}; + +static const char * const IHmd_Version = "IHmd_004"; + +/** error codes returned by Vr_Init */ +enum HmdError +{ + HmdError_None = 0, + + HmdError_Init_InstallationNotFound = 100, + HmdError_Init_InstallationCorrupt = 101, + HmdError_Init_VRClientDLLNotFound = 102, + HmdError_Init_FileNotFound = 103, + HmdError_Init_FactoryNotFound = 104, + HmdError_Init_InterfaceNotFound = 105, + HmdError_Init_InvalidInterface = 106, + HmdError_Init_UserConfigDirectoryInvalid = 107, + HmdError_Init_HmdNotFound = 108, + HmdError_Init_NotInitialized = 109, + + HmdError_Driver_Failed = 200, + + HmdError_IPC_ServerInitFailed = 300, + HmdError_IPC_ConnectFailed = 301, + HmdError_IPC_SharedStateInitFailed = 302, + +}; + + +// figure out how to import from the VR API dll +#if defined(_WIN32) + +#ifdef VR_API_EXPORT +#define VR_INTERFACE extern "C" __declspec( dllexport ) +#else +#define VR_INTERFACE extern "C" __declspec( dllimport ) +#endif + +#elif defined(GNUC) || defined(COMPILER_GCC) + +#ifdef VR_API_EXPORT +#define VR_INTERFACE extern "C" __attribute__((visibility("default"))) +#else +#define VR_INTERFACE extern "C" +#endif + +#else +#error "Unsupported Platform." +#endif + + + + +/** Finds the active installation of the VR API and initializes it. The priority for figuring +* out where to load vrclient from are: +* 1. The convar "VR_OVERRIDE", which should contain an absolute path to the root of +* an vr API directory. +* 2. The pchVROverride argument. This should be an absolute path or a path relative to +* the current executable. +* 3. The path "./vr" relative to the current executable's path. +* +* Each of these paths are to the "root" of the VR API install. That's the directory with +* the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself. +*/ +VR_INTERFACE IHmd *VR_Init( HmdError *peError ); + +/** unloads vrclient.dll. Any interface pointers from the interface are +* invalid after this point */ +VR_INTERFACE void VR_Shutdown( ); + +#pragma pack( pop ) + + +} \ No newline at end of file diff --git a/sp/src/public/tier0/annotations.h b/sp/src/public/tier0/annotations.h index f81cea32..25537821 100644 --- a/sp/src/public/tier0/annotations.h +++ b/sp/src/public/tier0/annotations.h @@ -13,44 +13,6 @@ // Include the annotation header file. #include -// /Analyze warnings can only be suppressed when using a compiler that supports them, which VS 2010 -// Professional does not. - -// We don't care about these warnings because they are bugs that can only occur during resource -// exhaustion or other unexpected API failure, which we are nowhere near being able to handle. -#pragma warning(disable : 6308) // warning C6308: 'realloc' might return null pointer: assigning null pointer to 's_ppTestCases', which is passed as an argument to 'realloc', will cause the original memory block to be leaked -#pragma warning(disable : 6255) // warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead -#pragma warning(disable : 6387) // warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'GetProcAddress' -#pragma warning(disable : 6309) // warning C6309: Argument '1' is null: this does not adhere to function specification of 'GetProcAddress' -#pragma warning(disable : 6011) // warning C6011: Dereferencing NULL pointer 'm_ppTestCases' -#pragma warning(disable : 6211) // warning C6211: Leaking memory 'newKeyValue' due to an exception. Consider using a local catch block to clean up memory -#pragma warning(disable : 6031) // warning C6031: Return value ignored: '_getcwd' - -// These warnings are because /analyze doesn't like our use of constants, especially things like IsPC() -#pragma warning(disable : 6326) // warning C6326: Potential comparison of a constant with another constant -#pragma warning(disable : 6239) // warning C6239: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? -#pragma warning(disable : 6285) // warning C6285: ( || ) is always a non-zero constant. Did you intend to use the bitwise-and operator? -#pragma warning(disable : 6237) // warning C6237: ( && ) is always zero. is never evaluated and might have side effects -#pragma warning(disable : 6235) // warning C6235: ( || ) is always a non-zero constant -#pragma warning(disable : 6240) // warning C6240: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? - -// These warnings aren't really important: -#pragma warning(disable : 6323) // warning C6323: Use of arithmetic operator on Boolean type(s) - -// Miscellaneous other /analyze warnings. We should consider fixing these at some point. -//#pragma warning(disable : 6204) // warning C6204: Possible buffer overrun in call to 'memcpy': use of unchecked parameter 'src' -//#pragma warning(disable : 6262) // warning C6262: Function uses '16464' bytes of stack: exceeds /analyze:stacksize'16384'. Consider moving some data to heap -// This is a serious warning. Don't suppress it. -//#pragma warning(disable : 6263) // warning C6263: Using _alloca in a loop: this can quickly overflow stack -// 6328 is also used for passing __int64 to printf when int is expected so we can't suppress it. -//#pragma warning(disable : 6328) // warning C6328: 'char' passed as parameter '1' when 'unsigned char' is required in call to 'V_isdigit' -// /analyze doesn't like GCOMPILER_ASSERT's implementation of compile-time asserts -#pragma warning(disable : 6326) // warning C6326: Potential comparison of a constant with another constant -#pragma warning(disable : 6335) // warning C6335: Leaking process information handle 'pi.hThread' -#pragma warning(disable : 6320) // warning C6320: Exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were not intended to be handled -#pragma warning(disable : 6250) // warning C6250: Calling 'VirtualFree' without the MEM_RELEASE flag might free memory but not address descriptors (VADs). This causes address space leaks -#pragma warning(disable : 6384) // ientity2_class_h_schema_gen.cpp(76): warning C6384: Dividing sizeof a pointer by another value - // For temporarily suppressing warnings -- the warnings are suppressed for the next source line. #define ANALYZE_SUPPRESS(wnum) __pragma(warning(suppress: wnum)) #define ANALYZE_SUPPRESS2(wnum1, wnum2) __pragma(warning(supress: wnum1 wnum2)) diff --git a/sp/src/public/tier0/dbg.h b/sp/src/public/tier0/dbg.h index 5fe45a1c..9fd38d0a 100644 --- a/sp/src/public/tier0/dbg.h +++ b/sp/src/public/tier0/dbg.h @@ -285,7 +285,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define AssertFatal( _exp ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), ((void)0), true ) #define AssertFatalOnce( _exp ) _AssertMsgOnce( _exp, _T("Assertion Failed: ") _T(#_exp), true ) -#define AssertFatalMsg( _exp, _msg ) _AssertMsg( _exp, _msg, ((void)0), true ) +#define AssertFatalMsg( _exp, _msg, ... ) _AssertMsg( _exp, (const tchar *)CDbgFmtMsg( _msg, ##__VA_ARGS__ ), ((void)0), true ) #define AssertFatalMsgOnce( _exp, _msg ) _AssertMsgOnce( _exp, _msg, true ) #define AssertFatalFunc( _exp, _f ) _AssertMsg( _exp, _T("Assertion Failed: " _T(#_exp), _f, true ) #define AssertFatalEquals( _exp, _expectedValue ) AssertFatalMsg2( (_exp) == (_expectedValue), _T("Expected %d but got %d!"), (_expectedValue), (_exp) ) @@ -293,16 +293,15 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define VerifyFatal( _exp ) AssertFatal( _exp ) #define VerifyEqualsFatal( _exp, _expectedValue ) AssertFatalEquals( _exp, _expectedValue ) -#define AssertFatalMsg1( _exp, _msg, a1 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1 ))) -#define AssertFatalMsg2( _exp, _msg, a1, a2 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2 ))) -#define AssertFatalMsg3( _exp, _msg, a1, a2, a3 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3 ))) -#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4 ))) -#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 ))) -#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 ))) -#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 ))) -#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 ))) -#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 ))) -#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertFatalMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ))) +#define AssertFatalMsg1( _exp, _msg, a1 ) AssertFatalMsg( _exp, _msg, a1 ) +#define AssertFatalMsg2( _exp, _msg, a1, a2 ) AssertFatalMsg( _exp, _msg, a1, a2 ) +#define AssertFatalMsg3( _exp, _msg, a1, a2, a3 ) AssertFatalMsg( _exp, _msg, a1, a2, a3 ) +#define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4 ) +#define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5 ) +#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6 ) +#define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) +#define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertFatalMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) #else // DBGFLAG_ASSERTFATAL @@ -322,7 +321,6 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define AssertFatalMsg4( _exp, _msg, a1, a2, a3, a4 ) ((void)0) #define AssertFatalMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) ((void)0) #define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0) -#define AssertFatalMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0) #define AssertFatalMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) ((void)0) #define AssertFatalMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) ((void)0) #define AssertFatalMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) ((void)0) @@ -336,7 +334,7 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #ifdef DBGFLAG_ASSERT #define Assert( _exp ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), ((void)0), false ) -#define AssertMsg( _exp, _msg ) _AssertMsg( _exp, _msg, ((void)0), false ) +#define AssertMsg( _exp, _msg, ... ) _AssertMsg( _exp, (const tchar *)CDbgFmtMsg( _msg, ##__VA_ARGS__ ), ((void)0), false ) #define AssertOnce( _exp ) _AssertMsgOnce( _exp, _T("Assertion Failed: ") _T(#_exp), false ) #define AssertMsgOnce( _exp, _msg ) _AssertMsgOnce( _exp, _msg, false ) #define AssertFunc( _exp, _f ) _AssertMsg( _exp, _T("Assertion Failed: ") _T(#_exp), _f, false ) @@ -349,21 +347,21 @@ DBG_INTERFACE struct SDL_Window * GetAssertDialogParent(); #define VerifyEquals( _exp, _expectedValue ) AssertEquals( _exp, _expectedValue ) #define DbgVerify( _exp ) Assert( _exp ) -#define AssertMsg1( _exp, _msg, a1 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1 )) ) -#define AssertMsg2( _exp, _msg, a1, a2 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2 )) ) -#define AssertMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3 )) ) -#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4 )) ) -#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 )) ) -#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 )) ) -#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 )) ) -#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 )) ) -#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertMsg( _exp, (const tchar *)(CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 )) ) +#define AssertMsg1( _exp, _msg, a1 ) AssertMsg( _exp, _msg, a1 ) +#define AssertMsg2( _exp, _msg, a1, a2 ) AssertMsg( _exp, _msg, a1, a2 ) +#define AssertMsg3( _exp, _msg, a1, a2, a3 ) AssertMsg( _exp, _msg, a1, a2, a3 ) +#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) AssertMsg( _exp, _msg, a1, a2, a3, a4 ) +#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5 ) +#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6 ) +#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) +#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) +#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) AssertMsg( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) #else // DBGFLAG_ASSERT #define Assert( _exp ) ((void)0) #define AssertOnce( _exp ) ((void)0) -#define AssertMsg( _exp, _msg ) ((void)0) +#define AssertMsg( _exp, _msg, ... ) ((void)0) #define AssertMsgOnce( _exp, _msg ) ((void)0) #define AssertFunc( _exp, _f ) ((void)0) #define AssertEquals( _exp, _expectedValue ) ((void)0) diff --git a/sp/src/public/tier0/fasttimer.h b/sp/src/public/tier0/fasttimer.h index 0f49a43e..79496a9e 100644 --- a/sp/src/public/tier0/fasttimer.h +++ b/sp/src/public/tier0/fasttimer.h @@ -499,10 +499,10 @@ public: CLimitTimer() {} CLimitTimer( uint64 cMicroSecDuration ) { SetLimit( cMicroSecDuration ); } void SetLimit( uint64 m_cMicroSecDuration ); - bool BLimitReached(); + bool BLimitReached() const; - int CMicroSecOverage(); - uint64 CMicroSecLeft(); + int CMicroSecOverage() const; + uint64 CMicroSecLeft() const; private: uint64 m_lCycleLimit; @@ -526,7 +526,7 @@ inline void CLimitTimer::SetLimit( uint64 cMicroSecDuration ) // Purpose: Determines whether our specified time period has passed // Output: true if at least the specified time period has passed //----------------------------------------------------------------------------- -inline bool CLimitTimer::BLimitReached( ) +inline bool CLimitTimer::BLimitReached() const { CCycleCount cycleCount; cycleCount.Sample( ); @@ -538,7 +538,7 @@ inline bool CLimitTimer::BLimitReached( ) // Purpose: If we're over our specified time period, return the amount of the overage. // Output: # of microseconds since we reached our specified time period. //----------------------------------------------------------------------------- -inline int CLimitTimer::CMicroSecOverage() +inline int CLimitTimer::CMicroSecOverage() const { CCycleCount cycleCount; cycleCount.Sample(); @@ -555,7 +555,7 @@ inline int CLimitTimer::CMicroSecOverage() // Purpose: If we're under our specified time period, return the amount under. // Output: # of microseconds until we reached our specified time period, 0 if we've passed it //----------------------------------------------------------------------------- -inline uint64 CLimitTimer::CMicroSecLeft() +inline uint64 CLimitTimer::CMicroSecLeft() const { CCycleCount cycleCount; cycleCount.Sample(); diff --git a/sp/src/public/tier1/UtlSortVector.h b/sp/src/public/tier1/UtlSortVector.h index 76026925..b5bfef53 100644 --- a/sp/src/public/tier1/UtlSortVector.h +++ b/sp/src/public/tier1/UtlSortVector.h @@ -1,4 +1,4 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // $Header: $ // $NoKeywords: $ @@ -45,31 +45,49 @@ public: template , class BaseVector = CUtlVector > class CUtlSortVector : public BaseVector { + typedef BaseVector BaseClass; public: - - // constructor + /// constructor CUtlSortVector( int nGrowSize = 0, int initSize = 0 ); CUtlSortVector( T* pMemory, int numElements ); - // inserts (copy constructs) an element in sorted order into the list + /// inserts (copy constructs) an element in sorted order into the list int Insert( const T& src ); - // Finds an element within the list using a binary search - int Find( const T& search ) const; - int FindLessOrEqual( const T& search ) const; - int FindLess( const T& search ) const; + /// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list + int InsertIfNotFound( const T& src ); + + /// Finds an element within the list using a binary search. These are templatized based upon the key + /// in which case the less function must handle the Less function for key, T and T, key + template< typename TKey > + int Find( const TKey& search ) const; + template< typename TKey > + int FindLessOrEqual( const TKey& search ) const; + template< typename TKey > + int FindLess( const TKey& search ) const; - // Removes a particular element + /// Removes a particular element void Remove( const T& search ); void Remove( int i ); - // Allows methods to set a context to be used with the less function.. + /// Allows methods to set a context to be used with the less function.. void SetLessContext( void *pCtx ); - // Note that you can only use this index until sorting is redone!!! + /// A version of insertion that will produce an un-ordered list. + /// Note that you can only use this index until sorting is redone with RedoSort!!! int InsertNoSort( const T& src ); void RedoSort( bool bForceSort = false ); + /// Use this to insert at a specific insertion point; using FindLessOrEqual + /// is required for use this this. This will test that what you've inserted + /// produces a correctly ordered list. + int InsertAfter( int nElemIndex, const T &src ); + + /// finds a particular element using a linear search. Useful when used + /// in between calls to InsertNoSort and RedoSort + template< typename TKey > + int FindUnsorted( const TKey &src ) const; + protected: // No copy constructor CUtlSortVector( const CUtlSortVector & ); @@ -79,10 +97,9 @@ protected: int AddToTail(); int InsertBefore( int elem ); int InsertAfter( int elem ); + int InsertBefore( int elem, const T& src ); int AddToHead( const T& src ); int AddToTail( const T& src ); - int InsertBefore( int elem, const T& src ); - int InsertAfter( int elem, const T& src ); int AddMultipleToHead( int num ); int AddMultipleToTail( int num, const T *pToCopy=NULL ); int InsertMultipleBefore( int elem, int num, const T *pToCopy=NULL ); @@ -121,6 +138,10 @@ protected: bool m_bNeedsSort; private: +private: + template< typename TKey > + int FindLessOrEqual( const TKey& search, bool *pFound ) const; + void QuickSort( LessFunc& less, int X, int I ); }; @@ -176,6 +197,43 @@ int CUtlSortVector::InsertNoSort( const T& src ) return lastElement; } +/// inserts (copy constructs) an element in sorted order into the list if it isn't already in the list +template +int CUtlSortVector::InsertIfNotFound( const T& src ) +{ + AssertFatal( !m_bNeedsSort ); + bool bFound; + int pos = FindLessOrEqual( src, &bFound ); + if ( bFound ) + return pos; + + ++pos; + this->GrowVector(); + this->ShiftElementsRight(pos); + CopyConstruct( &this->Element(pos), src ); + return pos; +} + +template +int CUtlSortVector::InsertAfter( int nIndex, const T &src ) +{ + int nInsertedIndex = this->BaseClass::InsertAfter( nIndex, src ); + +#ifdef DEBUG + LessFunc less; + if ( nInsertedIndex > 0 ) + { + Assert( less.Less( this->Element(nInsertedIndex-1), src, m_pLessContext ) ); + } + if ( nInsertedIndex < BaseClass::Count()-1 ) + { + Assert( less.Less( src, this->Element(nInsertedIndex+1), m_pLessContext ) ); + } +#endif + return nInsertedIndex; +} + + template void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUpper ) { @@ -218,7 +276,8 @@ void CUtlSortVector::RedoSort( bool bForceSort /*= fals // finds a particular element //----------------------------------------------------------------------------- template -int CUtlSortVector::Find( const T& src ) const +template < typename TKey > +int CUtlSortVector::Find( const TKey& src ) const { AssertFatal( !m_bNeedsSort ); @@ -245,11 +304,34 @@ int CUtlSortVector::Find( const T& src ) const } +//----------------------------------------------------------------------------- +// finds a particular element using a linear search. Useful when used +// in between calls to InsertNoSort and RedoSort +//----------------------------------------------------------------------------- +template< class T, class LessFunc, class BaseVector > +template < typename TKey > +int CUtlSortVector::FindUnsorted( const TKey &src ) const +{ + LessFunc less; + int nCount = this->Count(); + for ( int i = 0; i < nCount; ++i ) + { + if ( less.Less( this->Element(i), src, m_pLessContext ) ) + continue; + if ( less.Less( src, this->Element(i), m_pLessContext ) ) + continue; + return i; + } + return -1; +} + + //----------------------------------------------------------------------------- // finds a particular element //----------------------------------------------------------------------------- template -int CUtlSortVector::FindLessOrEqual( const T& src ) const +template < typename TKey > +int CUtlSortVector::FindLessOrEqual( const TKey& src, bool *pFound ) const { AssertFatal( !m_bNeedsSort ); @@ -268,14 +350,26 @@ int CUtlSortVector::FindLessOrEqual( const T& src ) con } else { + *pFound = true; return mid; } } + + *pFound = false; return end; } template -int CUtlSortVector::FindLess( const T& src ) const +template < typename TKey > +int CUtlSortVector::FindLessOrEqual( const TKey& src ) const +{ + bool bFound; + return FindLessOrEqual( src, &bFound ); +} + +template +template < typename TKey > +int CUtlSortVector::FindLess( const TKey& src ) const { AssertFatal( !m_bNeedsSort ); diff --git a/sp/src/public/tier1/convar.h b/sp/src/public/tier1/convar.h index 2174e1f9..4bff787e 100644 --- a/sp/src/public/tier1/convar.h +++ b/sp/src/public/tier1/convar.h @@ -66,7 +66,7 @@ void ConVar_PublishToVXConsole(); //----------------------------------------------------------------------------- // Called when a ConCommand needs to execute //----------------------------------------------------------------------------- -typedef void ( *FnCommandCallbackV1_t )( void ); +typedef void ( *FnCommandCallbackVoid_t )( void ); typedef void ( *FnCommandCallback_t )( const CCommand &command ); #define COMMAND_COMPLETION_MAXITEMS 64 @@ -265,7 +265,7 @@ friend class CCvar; public: typedef ConCommandBase BaseClass; - ConCommand( const char *pName, FnCommandCallbackV1_t callback, + ConCommand( const char *pName, FnCommandCallbackVoid_t callback, const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ); ConCommand( const char *pName, FnCommandCallback_t callback, const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ); @@ -295,7 +295,7 @@ private: // Call this function when executing the command union { - FnCommandCallbackV1_t m_fnCommandCallbackV1; + FnCommandCallbackVoid_t m_fnCommandCallbackV1; FnCommandCallback_t m_fnCommandCallback; ICommandCallback *m_pCommandCallback; }; diff --git a/sp/src/public/tier1/fmtstr.h b/sp/src/public/tier1/fmtstr.h index 31ee23c7..556fc130 100644 --- a/sp/src/public/tier1/fmtstr.h +++ b/sp/src/public/tier1/fmtstr.h @@ -31,28 +31,52 @@ int result; \ va_list arg_ptr; \ bool bTruncated = false; \ - static unsigned int scAsserted = 0; \ + static int scAsserted = 0; \ \ va_start(arg_ptr, lastArg); \ - result = Q_vsnprintfRet( (szBuf), nBufSize, (*(ppszFormat)), arg_ptr, &bTruncated ); \ + result = V_vsnprintfRet( (szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr, &bTruncated ); \ va_end(arg_ptr); \ \ + (szBuf)[(nBufSize)-1] = 0; \ if ( bTruncated && !(bQuietTruncation) && scAsserted < 5 ) \ { \ - Assert( !bTruncated ); \ + Warning( "FmtStrVSNPrintf truncated to %d without QUIET_TRUNCATION specified!\n", ( int )( nBufSize ) ); \ + AssertMsg( 0, "FmtStrVSNPrintf truncated without QUIET_TRUNCATION specified!\n" ); \ scAsserted++; \ } \ m_nLength = nPrevLen + result; \ } \ while (0) +// using macro to be compatable with GCC +#define FmtStrVSNPrintfNoLengthFixup( szBuf, nBufSize, bQuietTruncation, ppszFormat, nPrevLen, lastArg ) \ + do \ + { \ + int result; \ + va_list arg_ptr; \ + bool bTruncated = false; \ + static int scAsserted = 0; \ + \ + va_start(arg_ptr, lastArg); \ + result = V_vsnprintfRet( (szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr, &bTruncated ); \ + va_end(arg_ptr); \ + \ + (szBuf)[(nBufSize)-1] = 0; \ + if ( bTruncated && !(bQuietTruncation) && scAsserted < 5 ) \ + { \ + Warning( "FmtStrVSNPrintf truncated to %d without QUIET_TRUNCATION specified!\n", ( int )( nBufSize ) ); \ + AssertMsg( 0, "FmtStrVSNPrintf truncated without QUIET_TRUNCATION specified!\n" ); \ + scAsserted++; \ + } \ + } \ + while (0) //----------------------------------------------------------------------------- // // Purpose: String formatter with specified size // -template +template class CFmtStrN { public: @@ -80,14 +104,36 @@ public: // Explicit reformat const char *sprintf(PRINTF_FORMAT_STRING const char *pszFormat, ...) FMTFUNCTION( 2, 3 ) { - FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, &pszFormat, 0, pszFormat ); + InitQuietTruncation(); + FmtStrVSNPrintf(m_szBuf, SIZE_BUF, m_bQuietTruncation, &pszFormat, 0, pszFormat ); + return m_szBuf; + } + + // Use this for va_list formatting + const char *sprintf_argv(const char *pszFormat, va_list arg_ptr) + { + int result; + bool bTruncated = false; + static int s_nWarned = 0; + + InitQuietTruncation(); + result = V_vsnprintfRet( m_szBuf, SIZE_BUF - 1, pszFormat, arg_ptr, &bTruncated ); + m_szBuf[SIZE_BUF - 1] = 0; + if ( bTruncated && !m_bQuietTruncation && ( s_nWarned < 5 ) ) + { + Warning( "CFmtStr truncated to %d without QUIET_TRUNCATION specified!\n", SIZE_BUF ); + AssertMsg( 0, "CFmtStr truncated without QUIET_TRUNCATION specified!\n" ); + s_nWarned++; + } + m_nLength = V_strlen( m_szBuf ); return m_szBuf; } // Use this for pass-through formatting void VSprintf(const char **ppszFormat, ...) { - FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, ppszFormat, 0, ppszFormat); + InitQuietTruncation(); + FmtStrVSNPrintf( m_szBuf, SIZE_BUF, m_bQuietTruncation, ppszFormat, 0, ppszFormat ); } // Compatible API with CUtlString for converting to const char* @@ -97,14 +143,17 @@ public: operator const char *() const { return m_szBuf; } char *Access() { return m_szBuf; } - CFmtStrN & operator=( const char *pchValue ) + // Access template argument + static inline int GetMaxLength() { return SIZE_BUF-1; } + + CFmtStrN & operator=( const char *pchValue ) { V_strncpy( m_szBuf, pchValue, SIZE_BUF ); m_nLength = V_strlen( m_szBuf ); return *this; } - CFmtStrN & operator+=( const char *pchValue ) + CFmtStrN & operator+=( const char *pchValue ) { Append( pchValue ); return *this; @@ -112,13 +161,19 @@ public: int Length() const { return m_nLength; } + void SetLength( int nLength ) + { + m_nLength = Min( nLength, SIZE_BUF - 1 ); + m_szBuf[m_nLength] = '\0'; + } + void Clear() { m_szBuf[0] = 0; m_nLength = 0; } - void AppendFormat(PRINTF_FORMAT_STRING const char *pchFormat, ... ) FMTFUNCTION( 2, 3 ) + void AppendFormat( PRINTF_FORMAT_STRING const char *pchFormat, ... ) { char *pchEnd = m_szBuf + m_nLength; FmtStrVSNPrintf( pchEnd, SIZE_BUF - m_nLength, m_bQuietTruncation, &pchFormat, m_nLength, pchFormat ); @@ -163,14 +218,12 @@ public: void AppendIndent( uint32 unCount, char chIndent = '\t' ); + void SetQuietTruncation( bool bQuiet ) { m_bQuietTruncation = bQuiet; } + protected: virtual void InitQuietTruncation() { -#ifdef _DEBUG - m_bQuietTruncation = false; -#else - m_bQuietTruncation = true; // Force quiet for release builds -#endif + m_bQuietTruncation = QUIET_TRUNCATION; } bool m_bQuietTruncation; @@ -183,16 +236,14 @@ private: // Version which will not assert if strings are truncated -template -class CFmtStrQuietTruncationN : public CFmtStrN +template < int SIZE_BUF > +class CFmtStrQuietTruncationN : public CFmtStrN { -protected: - virtual void InitQuietTruncation() { this->m_bQuietTruncation = true; } }; -template< int SIZE_BUF > -void CFmtStrN::AppendIndent( uint32 unCount, char chIndent ) +template< int SIZE_BUF, bool QUIET_TRUNCATION > +void CFmtStrN< SIZE_BUF, QUIET_TRUNCATION >::AppendIndent( uint32 unCount, char chIndent ) { Assert( Length() + unCount < SIZE_BUF ); if( Length() + unCount >= SIZE_BUF ) @@ -204,8 +255,8 @@ void CFmtStrN::AppendIndent( uint32 unCount, char chIndent ) m_szBuf[ m_nLength ] = '\0'; } -template< int SIZE_BUF > -void CFmtStrN::AppendFormatV( const char *pchFormat, va_list args ) +template< int SIZE_BUF, bool QUIET_TRUNCATION > +void CFmtStrN< SIZE_BUF, QUIET_TRUNCATION >::AppendFormatV( const char *pchFormat, va_list args ) { int cubPrinted = V_vsnprintf( m_szBuf+Length(), SIZE_BUF - Length(), pchFormat, args ); m_nLength += cubPrinted; diff --git a/sp/src/public/tier1/mempool.h b/sp/src/public/tier1/mempool.h index 88406fbf..01d3a33f 100644 --- a/sp/src/public/tier1/mempool.h +++ b/sp/src/public/tier1/mempool.h @@ -30,19 +30,27 @@ typedef void (*MemoryPoolReportFunc_t)( PRINTF_FORMAT_STRING char const* pMsg, ... ); +// Ways a memory pool can grow when it needs to make a new blob: +enum MemoryPoolGrowType_t +{ + UTLMEMORYPOOL_GROW_NONE=0, // Don't allow new blobs. + UTLMEMORYPOOL_GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates + // get larger and larger each time it allocates one). + UTLMEMORYPOOL_GROW_SLOW=2 // New blob size is numElements. +}; + class CUtlMemoryPool { public: - // Ways the memory pool can grow when it needs to make a new blob. + // !KLUDGE! For legacy code support, import the global enum into this scope enum MemoryPoolGrowType_t { - GROW_NONE=0, // Don't allow new blobs. - GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates - // get larger and larger each time it allocates one). - GROW_SLOW=2 // New blob size is numElements. + GROW_NONE=UTLMEMORYPOOL_GROW_NONE, + GROW_FAST=UTLMEMORYPOOL_GROW_FAST, + GROW_SLOW=UTLMEMORYPOOL_GROW_SLOW }; - CUtlMemoryPool( int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); + CUtlMemoryPool( int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); ~CUtlMemoryPool(); void* Alloc(); // Allocate the element size you specified in the constructor. @@ -103,7 +111,7 @@ protected: class CMemoryPoolMT : public CUtlMemoryPool { public: - CMemoryPoolMT(int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} + CMemoryPoolMT(int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} void* Alloc() { AUTO_LOCK( m_mutex ); return CUtlMemoryPool::Alloc(); } diff --git a/sp/src/public/tier1/strtools.h b/sp/src/public/tier1/strtools.h index 93d0af6d..d3f1c65b 100644 --- a/sp/src/public/tier1/strtools.h +++ b/sp/src/public/tier1/strtools.h @@ -765,6 +765,29 @@ private: }; +// Encodes a string (or binary data) in URL encoding format, see rfc1738 section 2.2. +// Dest buffer should be 3 times the size of source buffer to guarantee it has room to encode. +void Q_URLEncodeRaw( OUT_Z_CAP(nDestLen) char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + +// Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// Dest buffer should be at least as large as source buffer to gurantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +// +// Returns the amount of space actually used in the output buffer. +size_t Q_URLDecodeRaw( OUT_CAP(nDecodeDestLen) char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); + +// Encodes a string (or binary data) in URL encoding format, this isn't the strict rfc1738 format, but instead uses + for spaces. +// This is for historical reasons and HTML spec foolishness that lead to + becoming a de facto standard for spaces when encoding form data. +// Dest buffer should be 3 times the size of source buffer to guarantee it has room to encode. +void Q_URLEncode( OUT_Z_CAP(nDestLen) char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + +// Decodes a string (or binary data) in URL encoding format, this isn't the strict rfc1738 format, but instead uses + for spaces. +// This is for historical reasons and HTML spec foolishness that lead to + becoming a de facto standard for spaces when encoding form data. +// Dest buffer should be at least as large as source buffer to gurantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +// +// Returns the amount of space actually used in the output buffer. +size_t Q_URLDecode( OUT_CAP(nDecodeDestLen) char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); // NOTE: This is for backward compatability! diff --git a/sp/src/public/tier1/utlblockmemory.h b/sp/src/public/tier1/utlblockmemory.h index 69885060..b4a254ff 100644 --- a/sp/src/public/tier1/utlblockmemory.h +++ b/sp/src/public/tier1/utlblockmemory.h @@ -247,15 +247,16 @@ void CUtlBlockMemory::ChangeSize( int nBlocks ) UTLBLOCKMEMORY_TRACK_ALLOC(); // this must stay after the recalculation of m_nBlocks, since it implicitly uses the new value - // free old blocks if shrinking - for ( int i = m_nBlocks; i < nBlocksOld; ++i ) - { - UTLBLOCKMEMORY_TRACK_FREE(); - free( (void*)m_pMemory[ i ] ); - } - if ( m_pMemory ) { + // free old blocks if shrinking + // Only possible if m_pMemory is non-NULL (and avoids PVS-Studio warning) + for ( int i = m_nBlocks; i < nBlocksOld; ++i ) + { + UTLBLOCKMEMORY_TRACK_FREE(); + free( (void*)m_pMemory[ i ] ); + } + MEM_ALLOC_CREDIT_CLASS(); m_pMemory = (T**)realloc( m_pMemory, m_nBlocks * sizeof(T*) ); Assert( m_pMemory ); diff --git a/sp/src/public/tier1/utlpair.h b/sp/src/public/tier1/utlpair.h new file mode 100644 index 00000000..d306f324 --- /dev/null +++ b/sp/src/public/tier1/utlpair.h @@ -0,0 +1,52 @@ +//========= Copyright, Valve Corporation, All rights reserved. ================// +// +// std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes +// +//=============================================================================// + +#ifndef UTLPAIR_H +#define UTLPAIR_H + +#ifdef _WIN32 +#pragma once +#endif + + +// std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes +template +class CUtlPair +{ +public: + CUtlPair() {} + CUtlPair( T1 t1, T2 t2 ) : first( t1 ), second( t2 ) {} + + bool operator<( const CUtlPair &rhs ) const { + if ( first != rhs.first ) + return first < rhs.first; + return second < rhs.second; + } + + bool operator==( const CUtlPair &rhs ) const { + return first == rhs.first && second == rhs.second; + } + + T1 first; + T2 second; +}; + +// utility to make a CUtlPair without having to specify template parameters +template +inline CUtlPair MakeUtlPair( T1 t1, T2 t2 ) +{ + return CUtlPair(t1, t2); +} + +//// HashItem() overload that works automatically with our hash containers +//template +//inline uint32 HashItem( const CUtlPair &item ) +//{ +// return HashItem( (uint64)HashItem( item.first ) + ((uint64)HashItem( item.second ) << 32) ); +//} + + +#endif // UTLPAIR_H diff --git a/sp/src/public/tier1/utlstring.h b/sp/src/public/tier1/utlstring.h index f425b271..c50765fa 100644 --- a/sp/src/public/tier1/utlstring.h +++ b/sp/src/public/tier1/utlstring.h @@ -332,6 +332,7 @@ public: void Clear() { Set( NULL ); } const T *Get() const { return m_pString ? m_pString : StringFuncs::EmptyString(); } + operator const T*() const { return m_pString ? m_pString : StringFuncs::EmptyString(); } bool IsEmpty() const { return m_pString == NULL; } // Note: empty strings are never stored by Set diff --git a/sp/src/public/tier1/utlvector.h b/sp/src/public/tier1/utlvector.h index 1f2fe6e1..180b51e4 100644 --- a/sp/src/public/tier1/utlvector.h +++ b/sp/src/public/tier1/utlvector.h @@ -80,6 +80,12 @@ public: int Count() const; int Size() const; // don't use me! + /// are there no elements? For compatibility with lists. + inline bool IsEmpty( void ) const + { + return ( Count() == 0 ); + } + // Is element index valid? bool IsValidIndex( int i ) const; static int InvalidIndex(); diff --git a/sp/src/public/togl/osx/glmgrbasics.h b/sp/src/public/togl/osx/glmgrbasics.h index 78e41464..dbed35dd 100644 --- a/sp/src/public/togl/osx/glmgrbasics.h +++ b/sp/src/public/togl/osx/glmgrbasics.h @@ -1,299 +1,299 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// glmgrbasics.h -// types, common headers, forward declarations, utilities -// -//=============================================================================== - -#ifndef GLMBASICS_H -#define GLMBASICS_H - -#pragma once - -#ifdef OSX -#include -#include -#include -#include -#include -#include -#include -//#include -#elif defined(LINUX) -#include -#include -#else -#error -#endif - -#include "tier0/platform.h" - -#include "bitmap/imageformat.h" -#include "bitvec.h" -#include "tier1/checksum_md5.h" -#include "tier1/utlvector.h" -#include "tier1/convar.h" - -#include - -#include "dxabstract_types.h" - -// types -struct GLMRect; -typedef void *PseudoGLContextPtr; - - - // 3-d integer box (used for texture lock/unlock etc) -struct GLMRegion -{ - int xmin,xmax; - int ymin,ymax; - int zmin,zmax; -}; - -struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's -{ - int xmin; // left - int ymin; // bottom - int xmax; // right - int ymax; // top -}; - -// macros - -//#define GLMassert(x) assert(x) - -// forward decls -class GLMgr; // singleton -class GLMContext; // GL context -class CGLMContextTester; // testing class -class CGLMTex; -class CGLMFBO; -class CGLMProgram; -class CGLMBuffer; - - -// utilities - -typedef enum -{ - // D3D codes - eD3D_DEVTYPE, - eD3D_FORMAT, - eD3D_RTYPE, - eD3D_USAGE, - eD3D_RSTATE, // render state - eD3D_SIO, // D3D shader bytecode - eD3D_VTXDECLUSAGE, - - // CGL codes - eCGL_RENDID, - - // OpenGL error codes - eGL_ERROR, - - // OpenGL enums - eGL_ENUM, - eGL_RENDERER - -} GLMThing_t; - -const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const -const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask - -void GLMStop( void ); // aka Debugger() -void GLMCheckError( bool noStop = false, bool noLog= false ); -void GLMEnableTrace( bool on ); - -// expose these in release now -// Mimic PIX events so we can decorate debug spew -void GLMBeginPIXEvent( const char *str ); -void GLMEndPIXEvent( void ); - -//=============================================================================== -// knob twiddling -float GLMKnob( char *knobname, float *setvalue ); // Pass NULL to not-set the knob value -float GLMKnobToggle( char *knobname ); - -//=============================================================================== -// other stuff - -// helpers for CGLSetOption - no op if no profiler -void GLMProfilerClearTrace( void ); -void GLMProfilerEnableTrace( bool enable ); - -// helpers for CGLSetParameter - no op if no profiler -void GLMProfilerDumpState( void ); - - -//=============================================================================== -// classes - -// helper class making function tracking easier to wire up -#if GLMDEBUG -class GLMFuncLogger -{ - public: - - // simple function log - GLMFuncLogger( const char *funcName ) - { - m_funcName = funcName; - m_earlyOut = false; - - GLMPrintf( ">%s", m_funcName ); - }; - - // more advanced version lets you pass args (i.e. called parameters or anything else of interest) - // no macro for this one, since no easy way to pass through the args as well as the funcname - GLMFuncLogger( const char *funcName, char *fmt, ... ) - { - m_funcName = funcName; - m_earlyOut = false; - - // this acts like GLMPrintf here - // all the indent policy is down in GLMPrintfVA - // which means we need to inject a ">" at the front of the format string to make this work... sigh. - - char modifiedFmt[2000]; - modifiedFmt[0] = '>'; - strcpy( modifiedFmt+1, fmt ); - - va_list vargs; - va_start(vargs, fmt); - GLMPrintfVA( modifiedFmt, vargs ); - va_end( vargs ); - } - - ~GLMFuncLogger( ) - { - if (m_earlyOut) - { - GLMPrintf( "<%s (early out)", m_funcName ); - } - else - { - GLMPrintf( "<%s", m_funcName ); - } - }; - - void EarlyOut( void ) - { - m_earlyOut = true; - }; - - const char *m_funcName; // set at construction time - bool m_earlyOut; -}; - -// handy macro to go with the function tracking class -#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ ) -#else -#define GLM_FUNC -#endif - - -// class to keep an in-memory mirror of a file which may be getting edited during run -class CGLMFileMirror -{ -public: - CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read. - //if non existent it will be created with size zero - ~CGLMFileMirror( ); - - bool HasData( void ); // see if data avail - void GetData( char **dataPtr, uint *dataSizePtr ); // read it out - void SetData( char *data, uint dataSize ); // put data in (and write it to disk) - bool PollForChanges( void ); // check disk copy. If different, read it back in and return true. - - void UpdateStatInfo( void ); // make sure stat info is current for our file - void ReadFile( void ); - void WriteFile( void ); - - void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground - - /// how about a "wait for change" method.. - - char *m_path; // fullpath to file - bool m_exists; - struct stat m_stat; // stat results for the file (last time checked) - - char *m_data; // content of file - uint m_size; // length of content - -}; - -// class based on the file mirror, that makes it easy to edit them outside the app. - -// it receives an initial block of text from the engine, and hashes it. ("orig") -// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged") -// a mirror file is activated, using a filename based on the hash from the orig text. -// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set. -// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text) - - -class CGLMEditableTextItem -{ -public: - CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix - ~CGLMEditableTextItem( ); - - bool HasData( void ); - bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition - void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy) - void OpenInEditor( bool foreground=false ); // call user attention to this text - - // internal methods - void GenHashOfOrigText( void ); - void GenBaseNameAndFullPath( char *prefix, char *suffix ); - void GenMungedText( bool fromMirror ); - - // members - // orig - uint m_origSize; - char *m_origText; // what was submitted - unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted - - // munged - uint m_mungedSize; - char *m_mungedText; // re-processed edition, initial content submission to the file mirror - - // mirror - char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix - char *m_mirrorFullPath; // base name - CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return. -}; - - -// debug font -extern unsigned char g_glmDebugFontMap[16384]; - -// class for cracking multi-part text blobs -// sections are demarcated by beginning-of-line markers submitted in a table by the caller - -struct GLMTextSection -{ - int m_markerIndex; // based on table of markers passed in to constructor - uint m_textOffset; // where is the text - offset - int m_textLength; // how big is the section -}; - -class CGLMTextSectioner -{ -public: - CGLMTextSectioner( char *text, int textSize, char **markers ); // constructor finds all the sections - ~CGLMTextSectioner( ); - - int Count( void ); // how many sections found - void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut ); - // find section, size, what marker - // note that more than one section can be marked similarly. - // so policy isn't made here, you walk the sections and decide what to do if there are dupes. - - //members - - //section table - CUtlVector< GLMTextSection > m_sectionTable; -}; - -#endif +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// glmgrbasics.h +// types, common headers, forward declarations, utilities +// +//=============================================================================== + +#ifndef GLMBASICS_H +#define GLMBASICS_H + +#pragma once + +#ifdef OSX +#include +#include +#include +#include +#include +#include +//#include +//#include +#elif defined(LINUX) +#include +#include +#else +#error +#endif + +#include "tier0/platform.h" + +#include "bitmap/imageformat.h" +#include "bitvec.h" +#include "tier1/checksum_md5.h" +#include "tier1/utlvector.h" +#include "tier1/convar.h" + +#include + +#include "dxabstract_types.h" + +// types +struct GLMRect; +typedef void *PseudoGLContextPtr; + + + // 3-d integer box (used for texture lock/unlock etc) +struct GLMRegion +{ + int xmin,xmax; + int ymin,ymax; + int zmin,zmax; +}; + +struct GLMRect // follows GL convention - if coming from the D3D rect you will need to fiddle the Y's +{ + int xmin; // left + int ymin; // bottom + int xmax; // right + int ymax; // top +}; + +// macros + +//#define GLMassert(x) assert(x) + +// forward decls +class GLMgr; // singleton +class GLMContext; // GL context +class CGLMContextTester; // testing class +class CGLMTex; +class CGLMFBO; +class CGLMProgram; +class CGLMBuffer; + + +// utilities + +typedef enum +{ + // D3D codes + eD3D_DEVTYPE, + eD3D_FORMAT, + eD3D_RTYPE, + eD3D_USAGE, + eD3D_RSTATE, // render state + eD3D_SIO, // D3D shader bytecode + eD3D_VTXDECLUSAGE, + + // CGL codes + eCGL_RENDID, + + // OpenGL error codes + eGL_ERROR, + + // OpenGL enums + eGL_ENUM, + eGL_RENDERER + +} GLMThing_t; + +const char* GLMDecode( GLMThing_t type, unsigned long value ); // decode a numeric const +const char* GLMDecodeMask( GLMThing_t type, unsigned long value ); // decode a bitmask + +void GLMStop( void ); // aka Debugger() +void GLMCheckError( bool noStop = false, bool noLog= false ); +void GLMEnableTrace( bool on ); + +// expose these in release now +// Mimic PIX events so we can decorate debug spew +void GLMBeginPIXEvent( const char *str ); +void GLMEndPIXEvent( void ); + +//=============================================================================== +// knob twiddling +//float GLMKnob( char *knobname, float *setvalue ); // Pass NULL to not-set the knob value +//float GLMKnobToggle( char *knobname ); + +//=============================================================================== +// other stuff + +// helpers for CGLSetOption - no op if no profiler +void GLMProfilerClearTrace( void ); +void GLMProfilerEnableTrace( bool enable ); + +// helpers for CGLSetParameter - no op if no profiler +void GLMProfilerDumpState( void ); + + +//=============================================================================== +// classes + +// helper class making function tracking easier to wire up +#if GLMDEBUG +class GLMFuncLogger +{ + public: + + // simple function log + GLMFuncLogger( const char *funcName ) + { + m_funcName = funcName; + m_earlyOut = false; + + GLMPrintf( ">%s", m_funcName ); + }; + + // more advanced version lets you pass args (i.e. called parameters or anything else of interest) + // no macro for this one, since no easy way to pass through the args as well as the funcname + GLMFuncLogger( const char *funcName, char *fmt, ... ) + { + m_funcName = funcName; + m_earlyOut = false; + + // this acts like GLMPrintf here + // all the indent policy is down in GLMPrintfVA + // which means we need to inject a ">" at the front of the format string to make this work... sigh. + + char modifiedFmt[2000]; + modifiedFmt[0] = '>'; + strcpy( modifiedFmt+1, fmt ); + + va_list vargs; + va_start(vargs, fmt); + GLMPrintfVA( modifiedFmt, vargs ); + va_end( vargs ); + } + + ~GLMFuncLogger( ) + { + if (m_earlyOut) + { + GLMPrintf( "<%s (early out)", m_funcName ); + } + else + { + GLMPrintf( "<%s", m_funcName ); + } + }; + + void EarlyOut( void ) + { + m_earlyOut = true; + }; + + const char *m_funcName; // set at construction time + bool m_earlyOut; +}; + +// handy macro to go with the function tracking class +#define GLM_FUNC GLMFuncLogger _logger_ ( __FUNCTION__ ) +#else +#define GLM_FUNC +#endif + + +// class to keep an in-memory mirror of a file which may be getting edited during run +class CGLMFileMirror +{ +public: + CGLMFileMirror( char *fullpath ); // just associates mirror with file. if file exists it will be read. + //if non existent it will be created with size zero + ~CGLMFileMirror( ); + + bool HasData( void ); // see if data avail + void GetData( char **dataPtr, uint *dataSizePtr ); // read it out + void SetData( char *data, uint dataSize ); // put data in (and write it to disk) + bool PollForChanges( void ); // check disk copy. If different, read it back in and return true. + + void UpdateStatInfo( void ); // make sure stat info is current for our file + void ReadFile( void ); + void WriteFile( void ); + + void OpenInEditor( bool foreground=false ); // pass TRUE if you would like the editor to pop to foreground + + /// how about a "wait for change" method.. + + char *m_path; // fullpath to file + bool m_exists; + struct stat m_stat; // stat results for the file (last time checked) + + char *m_data; // content of file + uint m_size; // length of content + +}; + +// class based on the file mirror, that makes it easy to edit them outside the app. + +// it receives an initial block of text from the engine, and hashes it. ("orig") +// it munges it by duplicating all the text after the "!!" line, and appending it in commented form. ("munged") +// a mirror file is activated, using a filename based on the hash from the orig text. +// if there is already content on disk matching that filename, use that content *unless* the 'blitz' parameter is set. +// (i.e. engine is instructing this subsystem to wipe out any old/modified variants of the text) + + +class CGLMEditableTextItem +{ +public: + CGLMEditableTextItem( char *text, uint size, bool forceOverwrite, char *prefix, char *suffix = NULL ); // create a text blob from text source, optional filename suffix + ~CGLMEditableTextItem( ); + + bool HasData( void ); + bool PollForChanges( void ); // return true if stale i.e. you need to get a new edition + void GetCurrentText( char **textOut, uint *sizeOut ); // query for read access to the active blob (could be the original, could be external edited copy) + void OpenInEditor( bool foreground=false ); // call user attention to this text + + // internal methods + void GenHashOfOrigText( void ); + void GenBaseNameAndFullPath( char *prefix, char *suffix ); + void GenMungedText( bool fromMirror ); + + // members + // orig + uint m_origSize; + char *m_origText; // what was submitted + unsigned char m_origDigest[MD5_DIGEST_LENGTH]; // digest of what was submitted + + // munged + uint m_mungedSize; + char *m_mungedText; // re-processed edition, initial content submission to the file mirror + + // mirror + char *m_mirrorBaseName; // generated from the hash of the orig text, plus the label / prefix + char *m_mirrorFullPath; // base name + CGLMFileMirror *m_mirror; // file mirror itself. holds "official" copy for GetCurrentText to return. +}; + + +// debug font +extern unsigned char g_glmDebugFontMap[16384]; + +// class for cracking multi-part text blobs +// sections are demarcated by beginning-of-line markers submitted in a table by the caller + +struct GLMTextSection +{ + int m_markerIndex; // based on table of markers passed in to constructor + uint m_textOffset; // where is the text - offset + int m_textLength; // how big is the section +}; + +class CGLMTextSectioner +{ +public: + CGLMTextSectioner( char *text, int textSize, char **markers ); // constructor finds all the sections + ~CGLMTextSectioner( ); + + int Count( void ); // how many sections found + void GetSection( int index, uint *offsetOut, uint *lengthOut, int *markerIndexOut ); + // find section, size, what marker + // note that more than one section can be marked similarly. + // so policy isn't made here, you walk the sections and decide what to do if there are dupes. + + //members + + //section table + CUtlVector< GLMTextSection > m_sectionTable; +}; + +#endif diff --git a/sp/src/public/vgui/ISurface.h b/sp/src/public/vgui/ISurface.h index 0ccc8157..6289bd59 100644 --- a/sp/src/public/vgui/ISurface.h +++ b/sp/src/public/vgui/ISurface.h @@ -387,7 +387,7 @@ public: virtual IHTMLChromeController *AccessChromeHTMLController() = 0; // the origin of the viewport on the framebuffer (Which might not be 0,0 for stereo) - virtual void SetFullscreenViewportAndRenderTarget( int x, int y, int w, int h, ITexture *pRenderTarget ) = 0; + virtual void SetFullscreenViewport( int x, int y, int w, int h ) = 0; // this uses NULL for the render target. virtual void GetFullscreenViewport( int & x, int & y, int & w, int & h ) = 0; virtual void PushFullscreenViewport() = 0; virtual void PopFullscreenViewport() = 0; diff --git a/sp/src/public/vgui/IVGui.h b/sp/src/public/vgui/IVGui.h index 18d90bd8..6a4c4371 100644 --- a/sp/src/public/vgui/IVGui.h +++ b/sp/src/public/vgui/IVGui.h @@ -99,6 +99,9 @@ public: // enables VR mode virtual void SetVRMode( bool bVRMode ) = 0; virtual bool GetVRMode() = 0; + + // add a tick signal like above, but to the head of the list of tick signals + virtual void AddTickSignalToHead( VPANEL panel, int intervalMilliseconds = 0 ) = 0; }; #define VGUI_IVGUI_INTERFACE_VERSION "VGUI_ivgui008" diff --git a/sp/src/public/vgui_controls/PanelListPanel.h b/sp/src/public/vgui_controls/PanelListPanel.h index 98292079..c4a647e3 100644 --- a/sp/src/public/vgui_controls/PanelListPanel.h +++ b/sp/src/public/vgui_controls/PanelListPanel.h @@ -24,8 +24,8 @@ namespace vgui //----------------------------------------------------------------------------- // Purpose: A list of variable height child panels -// each list item consists of a label-panel pair. Height of the item is -// determined from the lable. +// each list item consists of a label-panel pair. Height of the item is +// determined from the label. //----------------------------------------------------------------------------- class PanelListPanel : public EditablePanel { @@ -83,6 +83,8 @@ public: return &m_SortedItems; } + int ComputeVPixelsNeeded(); + protected: // overrides virtual void OnSizeChanged(int wide, int tall); @@ -92,7 +94,7 @@ protected: virtual void OnMouseWheeled(int delta); private: - int ComputeVPixelsNeeded(); + enum { DEFAULT_HEIGHT = 24, PANELBUFFER = 5 }; diff --git a/sp/src/raytrace/trace2.cpp b/sp/src/raytrace/trace2.cpp index f419cc76..4b1d19f6 100644 --- a/sp/src/raytrace/trace2.cpp +++ b/sp/src/raytrace/trace2.cpp @@ -186,7 +186,7 @@ void RayTracingEnvironment::RenderScene( AndNotSIMD(no_hit_mask,intens.x)); intens.y=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask), AndNotSIMD(no_hit_mask,intens.y)); - intens.z=OrSIMD(AndSIMD(BackgroundColor.y,no_hit_mask), + intens.z=OrSIMD(AndSIMD(BackgroundColor.z,no_hit_mask), AndNotSIMD(no_hit_mask,intens.z)); MapLinearIntensities(intens,dest,dest+1,dest+stride,dest+stride+1); diff --git a/sp/src/thirdparty/protobuf-2.3.0/vsprojects/make.bat b/sp/src/thirdparty/protobuf-2.3.0/vsprojects/build.bat similarity index 100% rename from sp/src/thirdparty/protobuf-2.3.0/vsprojects/make.bat rename to sp/src/thirdparty/protobuf-2.3.0/vsprojects/build.bat diff --git a/sp/src/tier1/KeyValues.cpp b/sp/src/tier1/KeyValues.cpp index 6319d8df..19d6d66c 100644 --- a/sp/src/tier1/KeyValues.cpp +++ b/sp/src/tier1/KeyValues.cpp @@ -1952,9 +1952,8 @@ void KeyValues::ParseIncludedKeys( char const *resourceName, const char *filetoi Q_strncpy( fullpath, resourceName, sizeof( fullpath ) ); // Strip off characters back to start or first / - bool done = false; int len = Q_strlen( fullpath ); - while ( !done ) + for (;;) { if ( len <= 0 ) { diff --git a/sp/src/tier1/convar.cpp b/sp/src/tier1/convar.cpp index 3cfff35d..c49a6efb 100644 --- a/sp/src/tier1/convar.cpp +++ b/sp/src/tier1/convar.cpp @@ -269,7 +269,7 @@ char *ConCommandBase::CopyString( const char *from ) int len; char *to; - len = strlen( from ); + len = V_strlen( from ); if ( len <= 0 ) { to = new char[1]; @@ -507,7 +507,7 @@ int DefaultCompletionFunc( const char *partial, char commands[ COMMAND_COMPLETIO // m_bIsNewConCommand = true; //} -ConCommand::ConCommand( const char *pName, FnCommandCallbackV1_t callback, const char *pHelpString /*= 0*/, int flags /*= 0*/, FnCommandCompletionCallback completionFunc /*= 0*/ ) +ConCommand::ConCommand( const char *pName, FnCommandCallbackVoid_t callback, const char *pHelpString /*= 0*/, int flags /*= 0*/, FnCommandCompletionCallback completionFunc /*= 0*/ ) { // Set the callback m_fnCommandCallbackV1 = callback; @@ -951,7 +951,7 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*= // Name should be static data SetDefault( pDefaultValue ); - m_StringLength = strlen( m_pszDefaultValue ) + 1; + m_StringLength = V_strlen( m_pszDefaultValue ) + 1; m_pszString = new char[m_StringLength]; memcpy( m_pszString, m_pszDefaultValue, m_StringLength ); @@ -963,6 +963,7 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*= m_fnChangeCallback = callback; m_fValue = ( float )atof( m_pszString ); + m_nValue = atoi( m_pszString ); // dont convert from float to int and lose bits // Bounds Check, should never happen, if it does, no big deal if ( m_bHasMin && ( m_fValue < m_fMinVal ) ) @@ -975,8 +976,6 @@ void ConVar::Create( const char *pName, const char *pDefaultValue, int flags /*= Assert( 0 ); } - m_nValue = ( int )m_fValue; - BaseClass::Create( pName, pHelpString, flags ); } diff --git a/sp/src/tier1/generichash.cpp b/sp/src/tier1/generichash.cpp index 492190b2..a3a4a8a5 100644 --- a/sp/src/tier1/generichash.cpp +++ b/sp/src/tier1/generichash.cpp @@ -364,7 +364,7 @@ uint32 MurmurHash2( const void * key, int len, uint32 seed ) #define TOLOWERU( c ) ( ( uint32 ) ( ( ( c >= 'A' ) && ( c <= 'Z' ) )? c + 32 : c ) ) uint32 MurmurHash2LowerCase( char const *pString, uint32 nSeed ) { - int nLen = strlen( pString ); + int nLen = ( int )strlen( pString ); char *p = ( char * ) stackalloc( nLen + 1 ); for( int i = 0; i < nLen ; i++ ) { diff --git a/sp/src/tier1/ilocalize.cpp b/sp/src/tier1/ilocalize.cpp index 182efd16..d95bbf29 100644 --- a/sp/src/tier1/ilocalize.cpp +++ b/sp/src/tier1/ilocalize.cpp @@ -112,7 +112,7 @@ void ConstructStringVArgsInternal_Impl(T *unicodeOutput, int unicodeBufferSizeIn } else { - AssertMsg( argindex < numFormatParameters, "ConstructStringVArgsInternal_Impl() - Found a %s# escape sequence whose index was more than the number of args." ); + AssertMsg( argindex < numFormatParameters, "ConstructStringVArgsInternal_Impl() - Found a %%s# escape sequence whose index was more than the number of args." ); //copy it over, char by char *outputPos = *searchPos; diff --git a/sp/src/tier1/mempool.cpp b/sp/src/tier1/mempool.cpp index 7ebbbf0b..fa49edb5 100644 --- a/sp/src/tier1/mempool.cpp +++ b/sp/src/tier1/mempool.cpp @@ -32,7 +32,7 @@ void CUtlMemoryPool::SetErrorReportFunc( MemoryPoolReportFunc_t func ) CUtlMemoryPool::CUtlMemoryPool( int blockSize, int numElements, int growMode, const char *pszAllocOwner, int nAlignment ) { #ifdef _X360 - if( numElements > 0 && growMode != GROW_NONE ) + if( numElements > 0 && growMode != UTLMEMORYPOOL_GROW_NONE ) { numElements = 1; } @@ -157,18 +157,18 @@ void CUtlMemoryPool::AddNewBlob() int sizeMultiplier; - if( m_GrowMode == GROW_SLOW ) + if( m_GrowMode == UTLMEMORYPOOL_GROW_SLOW ) { sizeMultiplier = 1; } else { - if ( m_GrowMode == GROW_NONE ) + if ( m_GrowMode == UTLMEMORYPOOL_GROW_NONE ) { // Can only have one allocation when we're in this mode if( m_NumBlobs != 0 ) { - Assert( !"CUtlMemoryPool::AddNewBlob: mode == GROW_NONE" ); + Assert( !"CUtlMemoryPool::AddNewBlob: mode == UTLMEMORYPOOL_GROW_NONE" ); return; } } @@ -231,10 +231,10 @@ void *CUtlMemoryPool::Alloc( size_t amount ) if( !m_pHeadOfFreeList ) { - // returning NULL is fine in GROW_NONE - if( m_GrowMode == GROW_NONE ) + // returning NULL is fine in UTLMEMORYPOOL_GROW_NONE + if( m_GrowMode == UTLMEMORYPOOL_GROW_NONE ) { - //Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with GROW_NONE" ); + //Assert( !"CUtlMemoryPool::Alloc: tried to make new blob with UTLMEMORYPOOL_GROW_NONE" ); return NULL; } diff --git a/sp/src/tier1/strtools.cpp b/sp/src/tier1/strtools.cpp index 13097e39..9b1bfa84 100644 --- a/sp/src/tier1/strtools.cpp +++ b/sp/src/tier1/strtools.cpp @@ -1824,7 +1824,18 @@ void V_DefaultExtension( char *path, const char *extension, int pathStringLength void V_SetExtension( char *path, const char *extension, int pathStringLength ) { V_StripExtension( path, path, pathStringLength ); - V_DefaultExtension( path, extension, pathStringLength ); + + // We either had an extension and stripped it, or didn't have an extension + // at all. Either way, we need to concatenate our extension now. + + // extension is not required to start with '.', so if it's not there, + // then append that first. + if ( extension[0] != '.' ) + { + V_strncat( path, ".", pathStringLength, COPY_ALL_CHARACTERS ); + } + + V_strncat( path, extension, pathStringLength, COPY_ALL_CHARACTERS ); } //----------------------------------------------------------------------------- @@ -2663,6 +2674,217 @@ char *V_AddBackSlashesToSpecialChars( char const *pSrc ) *( pOut++ ) = 0; return pRet; } + +//----------------------------------------------------------------------------- +// Purpose: Helper for converting a numeric value to a hex digit, value should be 0-15. +//----------------------------------------------------------------------------- +char cIntToHexDigit( int nValue ) +{ + Assert( nValue >= 0 && nValue <= 15 ); + return "0123456789ABCDEF"[ nValue & 15 ]; +} + +//----------------------------------------------------------------------------- +// Purpose: Helper for converting a hex char value to numeric, return -1 if the char +// is not a valid hex digit. +//----------------------------------------------------------------------------- +int iHexCharToInt( char cValue ) +{ + int32 iValue = cValue; + if ( (uint32)( iValue - '0' ) < 10 ) + return iValue - '0'; + + iValue |= 0x20; + if ( (uint32)( iValue - 'a' ) < 6 ) + return iValue - 'a' + 10; + + return -1; +} + +//----------------------------------------------------------------------------- +// Purpose: Internal implementation of encode, works in the strict RFC manner, or +// with spaces turned to + like HTML form encoding. +//----------------------------------------------------------------------------- +void Q_URLEncodeInternal( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen, bool bUsePlusForSpace ) +{ + if ( nDestLen < 3*nSourceLen ) + { + pchDest[0] = '\0'; + AssertMsg( false, "Target buffer for Q_URLEncode needs to be 3 times larger than source to guarantee enough space\n" ); + return; + } + + int iDestPos = 0; + for ( int i=0; i < nSourceLen; ++i ) + { + // We allow only a-z, A-Z, 0-9, period, underscore, and hyphen to pass through unescaped. + // These are the characters allowed by both the original RFC 1738 and the latest RFC 3986. + // Current specs also allow '~', but that is forbidden under original RFC 1738. + if ( !( pchSource[i] >= 'a' && pchSource[i] <= 'z' ) && !( pchSource[i] >= 'A' && pchSource[i] <= 'Z' ) && !(pchSource[i] >= '0' && pchSource[i] <= '9' ) + && pchSource[i] != '-' && pchSource[i] != '_' && pchSource[i] != '.' + ) + { + if ( bUsePlusForSpace && pchSource[i] == ' ' ) + { + pchDest[iDestPos++] = '+'; + } + else + { + pchDest[iDestPos++] = '%'; + uint8 iValue = pchSource[i]; + if ( iValue == 0 ) + { + pchDest[iDestPos++] = '0'; + pchDest[iDestPos++] = '0'; + } + else + { + char cHexDigit1 = cIntToHexDigit( iValue % 16 ); + iValue /= 16; + char cHexDigit2 = cIntToHexDigit( iValue ); + pchDest[iDestPos++] = cHexDigit2; + pchDest[iDestPos++] = cHexDigit1; + } + } + } + else + { + pchDest[iDestPos++] = pchSource[i]; + } + } + + // Null terminate + pchDest[iDestPos++] = 0; +} + + +//----------------------------------------------------------------------------- +// Purpose: Internal implementation of decode, works in the strict RFC manner, or +// with spaces turned to + like HTML form encoding. +// +// Returns the amount of space used in the output buffer. +//----------------------------------------------------------------------------- +size_t Q_URLDecodeInternal( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen, bool bUsePlusForSpace ) +{ + if ( nDecodeDestLen < nEncodedSourceLen ) + { + AssertMsg( false, "Q_URLDecode needs a dest buffer at least as large as the source" ); + return 0; + } + + int iDestPos = 0; + for( int i=0; i < nEncodedSourceLen; ++i ) + { + if ( bUsePlusForSpace && pchEncodedSource[i] == '+' ) + { + pchDecodeDest[ iDestPos++ ] = ' '; + } + else if ( pchEncodedSource[i] == '%' ) + { + // Percent signifies an encoded value, look ahead for the hex code, convert to numeric, and use that + + // First make sure we have 2 more chars + if ( i < nEncodedSourceLen - 2 ) + { + char cHexDigit1 = pchEncodedSource[i+1]; + char cHexDigit2 = pchEncodedSource[i+2]; + + // Turn the chars into a hex value, if they are not valid, then we'll + // just place the % and the following two chars direct into the string, + // even though this really shouldn't happen, who knows what bad clients + // may do with encoding. + bool bValid = false; + int iValue = iHexCharToInt( cHexDigit1 ); + if ( iValue != -1 ) + { + iValue *= 16; + int iValue2 = iHexCharToInt( cHexDigit2 ); + if ( iValue2 != -1 ) + { + iValue += iValue2; + pchDecodeDest[ iDestPos++ ] = iValue; + bValid = true; + } + } + + if ( !bValid ) + { + pchDecodeDest[ iDestPos++ ] = '%'; + pchDecodeDest[ iDestPos++ ] = cHexDigit1; + pchDecodeDest[ iDestPos++ ] = cHexDigit2; + } + } + + // Skip ahead + i += 2; + } + else + { + pchDecodeDest[ iDestPos++ ] = pchEncodedSource[i]; + } + } + + // We may not have extra room to NULL terminate, since this can be used on raw data, but if we do + // go ahead and do it as this can avoid bugs. + if ( iDestPos < nDecodeDestLen ) + { + pchDecodeDest[iDestPos] = 0; + } + + return (size_t)iDestPos; +} + +//----------------------------------------------------------------------------- +// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +//----------------------------------------------------------------------------- +void Q_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return Q_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, true ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +//----------------------------------------------------------------------------- +size_t Q_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return Q_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, true ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version will not encode space as + (which HTML form encoding uses despite not being part of the RFC) +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +//----------------------------------------------------------------------------- +void Q_URLEncodeRaw( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return Q_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, false ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version will not recognize + as a space (which HTML form encoding uses despite not being part of the RFC) +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +//----------------------------------------------------------------------------- +size_t Q_URLDecodeRaw( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return Q_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, false ); +} + #if defined( LINUX ) || defined( _PS3 ) extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(void *, const void *, const void *), void * context ); #endif diff --git a/sp/src/tier1/utlbuffer.cpp b/sp/src/tier1/utlbuffer.cpp index ff086171..55dd8f6b 100644 --- a/sp/src/tier1/utlbuffer.cpp +++ b/sp/src/tier1/utlbuffer.cpp @@ -1730,7 +1730,6 @@ void CUtlBuffer::Swap( CUtlMemory &mem ) CUtlInplaceBuffer::CUtlInplaceBuffer( int growSize /* = 0 */, int initSize /* = 0 */, int nFlags /* = 0 */ ) : CUtlBuffer( growSize, initSize, nFlags ) { - NULL; } bool CUtlInplaceBuffer::InplaceGetLinePtr( char **ppszInBufferPtr, int *pnLineLength ) diff --git a/sp/src/tier1/utlsymbol.cpp b/sp/src/tier1/utlsymbol.cpp index 4023156d..d75eaa52 100644 --- a/sp/src/tier1/utlsymbol.cpp +++ b/sp/src/tier1/utlsymbol.cpp @@ -225,7 +225,7 @@ CUtlSymbol CUtlSymbolTable::AddString( const char* pString ) if (id.IsValid()) return id; - int len = strlen(pString) + 1; + int len = V_strlen(pString) + 1; // Find a pool with space for this string, or allocate a new one. int iPool = FindPoolWithSpace( len ); diff --git a/sp/src/utils/captioncompiler/captioncompiler.cpp b/sp/src/utils/captioncompiler/captioncompiler.cpp index 0fee3529..e7369c18 100644 --- a/sp/src/utils/captioncompiler/captioncompiler.cpp +++ b/sp/src/utils/captioncompiler/captioncompiler.cpp @@ -91,7 +91,7 @@ void vprint( int depth, const char *fmt, ... ) } } - ::printf( string ); + ::printf( "%s", string ); OutputDebugString( string ); if ( fp ) diff --git a/sp/src/utils/glview/glview.vpc b/sp/src/utils/glview/glview.vpc index fa7f180c..4a519e8b 100644 --- a/sp/src/utils/glview/glview.vpc +++ b/sp/src/utils/glview/glview.vpc @@ -20,7 +20,6 @@ $Configuration $Linker { $AdditionalDependencies "$BASE glu32.lib opengl32.lib odbc32.lib odbccp32.lib winmm.lib" - $AdditionalDependencies "$BASE glaux.lib" [!$VS2010] } } diff --git a/sp/src/utils/vice/vice.cpp b/sp/src/utils/vice/vice.cpp index 56c6d069..1697c60d 100644 --- a/sp/src/utils/vice/vice.cpp +++ b/sp/src/utils/vice/vice.cpp @@ -49,7 +49,7 @@ static void Pause( void ) static void Exit(const char *msg) { - fprintf( stderr, msg ); + fprintf( stderr, "%s", msg ); Pause(); exit( -1 ); } diff --git a/sp/src/utils/vrad/disp_vrad.cpp b/sp/src/utils/vrad/disp_vrad.cpp index b254b9d7..b1d63b6e 100644 --- a/sp/src/utils/vrad/disp_vrad.cpp +++ b/sp/src/utils/vrad/disp_vrad.cpp @@ -46,7 +46,7 @@ int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vTest ) } -int GetAllNeighbors( const CCoreDispInfo *pDisp, int iNeighbors[512] ) +int GetAllNeighbors( const CCoreDispInfo *pDisp, int (&iNeighbors)[512] ) { int nNeighbors = 0; @@ -57,7 +57,7 @@ int GetAllNeighbors( const CCoreDispInfo *pDisp, int iNeighbors[512] ) for ( int i=0; i < pCorner->m_nNeighbors; i++ ) { - if ( nNeighbors < _ARRAYSIZE( iNeighbors ) ) + if ( nNeighbors < ARRAYSIZE( iNeighbors ) ) iNeighbors[nNeighbors++] = pCorner->m_Neighbors[i]; } } diff --git a/sp/src/utils/vrad/vrad.cpp b/sp/src/utils/vrad/vrad.cpp index 70e481fb..a7cba1c0 100644 --- a/sp/src/utils/vrad/vrad.cpp +++ b/sp/src/utils/vrad/vrad.cpp @@ -34,7 +34,7 @@ every surface must be divided into at least two patches each axis */ CUtlVector g_Patches; -CUtlVector g_FacePatches; // constains all patches, children first +CUtlVector g_FacePatches; // contains all patches, children first CUtlVector faceParents; // contains only root patches, use next parent to iterate CUtlVector clusterChildren; CUtlVector emitlight; @@ -2408,12 +2408,13 @@ int ParseCommandLine( int argc, char **argv, bool *onlydetail ) { if ( ++i < argc ) { - numbounce = atoi (argv[i]); - if ( numbounce < 0 ) + int bounceParam = atoi (argv[i]); + if ( bounceParam < 0 ) { Warning("Error: expected non-negative value after '-bounce'\n" ); return 1; } + numbounce = (unsigned)bounceParam; } else { diff --git a/sp/src/utils/vtf2tga/vtf2tga.cpp b/sp/src/utils/vtf2tga/vtf2tga.cpp index acdace83..c06999b0 100644 --- a/sp/src/utils/vtf2tga/vtf2tga.cpp +++ b/sp/src/utils/vtf2tga/vtf2tga.cpp @@ -37,7 +37,7 @@ static void PFMWrite( float *pFloatImage, const char *pFilename, int width, int SpewRetval_t VTF2TGAOutputFunc( SpewType_t spewType, char const *pMsg ) { - printf( pMsg ); + printf( "%s", pMsg ); fflush( stdout ); if (spewType == SPEW_ERROR) diff --git a/sp/src/vgui2/chromehtml/html_chrome.cpp b/sp/src/vgui2/chromehtml/html_chrome.cpp index 37ba4f74..83ea654c 100644 --- a/sp/src/vgui2/chromehtml/html_chrome.cpp +++ b/sp/src/vgui2/chromehtml/html_chrome.cpp @@ -2079,7 +2079,12 @@ void CClientHandler::OnLoadEnd(CefRefPtr browser, { CHTMLProtoBufMsg cmd( eHTMLCommands_FinishedRequest ); - cmd.Body().set_url( CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ); + + if ( browser->GetMainFrame()->GetURL().size() > 0 ) + cmd.Body().set_url( CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ); + else + cmd.Body().set_url( "" ); + CefString frameName = browser->GetMainFrame()->GetName(); if ( !frameName.empty() ) cmd.Body().set_pagetitle( frameName.c_str() ); @@ -2221,6 +2226,9 @@ bool CClientHandler::OnBeforeResourceLoad(CefRefPtr browser, CefRefPtr response, int loadFlags) { + if ( request->GetURL().size() == 0 ) + return false; + CHTMLProtoBufMsg cmd( eHTMLCommands_LoadingResource ); cmd.Body().set_url( CStrAutoEncode( request->GetURL().c_str() ).ToString() ); DISPATCH_MESSAGE( eHTMLCommands_LoadingResource ); @@ -3022,42 +3030,43 @@ void CClientHandler::RequestScreenShot( const CHTMLProtoBufMsg browser, const byte *pRGBA, int wide, int tall ) { - if ( m_Snapshot.m_sURLSnapshot.IsValid() && wide && tall - && m_Snapshot.m_sURLSnapshot == CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ) + if ( m_Snapshot.m_sURLSnapshot.IsValid() && wide && tall && ( browser->GetMainFrame()->GetURL().size() > 0 ) ) { - VPROF_BUDGET( "CClientHandler::SavePageToJPEGIfNeeded", VPROF_BUDGETGROUP_TENFOOT ); - - CUtlBuffer bufRGB; - - bufRGB.Put( pRGBA, wide * tall *4 ); - if ( !BConvertRGBAToRGB( bufRGB, wide, tall ) ) - return; - - BResizeImageRGB( bufRGB, wide, tall, m_Snapshot.m_nWide, m_Snapshot.m_nTall ); - // input format is actually BGRA so now swizzle to rgb - byte *pBGR = (byte *)bufRGB.Base(); - for ( int i = 0; i < m_Snapshot.m_nTall; i++ ) + if ( m_Snapshot.m_sURLSnapshot == CStrAutoEncode( browser->GetMainFrame()->GetURL().c_str() ).ToString() ) { - for ( int j = 0; j < m_Snapshot.m_nWide; j++ ) + VPROF_BUDGET( "CClientHandler::SavePageToJPEGIfNeeded", VPROF_BUDGETGROUP_TENFOOT ); + + CUtlBuffer bufRGB; + + bufRGB.Put( pRGBA, wide * tall *4 ); + if ( !BConvertRGBAToRGB( bufRGB, wide, tall ) ) + return; + + BResizeImageRGB( bufRGB, wide, tall, m_Snapshot.m_nWide, m_Snapshot.m_nTall ); + // input format is actually BGRA so now swizzle to rgb + byte *pBGR = (byte *)bufRGB.Base(); + for ( int i = 0; i < m_Snapshot.m_nTall; i++ ) { - char cR = pBGR[0]; - pBGR[0] = pBGR[2]; - pBGR[2] = cR; - pBGR += 3; + for ( int j = 0; j < m_Snapshot.m_nWide; j++ ) + { + char cR = pBGR[0]; + pBGR[0] = pBGR[2]; + pBGR[2] = cR; + pBGR += 3; + } } - } - if ( !ConvertRGBToJpeg( m_Snapshot.m_sFileNameSnapshot, k_ScreenshotQuality, m_Snapshot.m_nWide, m_Snapshot.m_nTall, bufRGB ) ) - return; + if ( !ConvertRGBToJpeg( m_Snapshot.m_sFileNameSnapshot, k_ScreenshotQuality, m_Snapshot.m_nWide, m_Snapshot.m_nTall, bufRGB ) ) + return; - CHTMLProtoBufMsg cmd( eHTMLCommands_SavePageToJPEGResponse ); - cmd.Body().set_url( m_Snapshot.m_sURLSnapshot ); - cmd.Body().set_filename( m_Snapshot.m_sFileNameSnapshot ); - DISPATCH_MESSAGE( eHTMLCommands_SavePageToJPEGResponse ); - - m_Snapshot.m_sURLSnapshot.Clear(); - m_Snapshot.m_flRequestTimeout = 0.0f; + CHTMLProtoBufMsg cmd( eHTMLCommands_SavePageToJPEGResponse ); + cmd.Body().set_url( m_Snapshot.m_sURLSnapshot ); + cmd.Body().set_filename( m_Snapshot.m_sFileNameSnapshot ); + DISPATCH_MESSAGE( eHTMLCommands_SavePageToJPEGResponse ); + m_Snapshot.m_sURLSnapshot.Clear(); + m_Snapshot.m_flRequestTimeout = 0.0f; + } } } diff --git a/sp/src/vgui2/vgui_controls/Panel.cpp b/sp/src/vgui2/vgui_controls/Panel.cpp index 3f3634fe..369e00c4 100644 --- a/sp/src/vgui2/vgui_controls/Panel.cpp +++ b/sp/src/vgui2/vgui_controls/Panel.cpp @@ -3911,7 +3911,7 @@ void Panel::PinToSibling( const char *pszSibling, PinCorner_e pinOurCorner, PinC _pinCornerToSibling = pinOurCorner; _pinToSiblingCorner = pinSibling; - if ( _pinToSibling && pszSibling && !Q_strcmp( _pinToSibling, pszSibling ) ) + if ( m_pinSibling.Get() && _pinToSibling && pszSibling && !Q_strcmp( _pinToSibling, pszSibling ) ) return; if (_pinToSibling) diff --git a/sp/src/vgui2/vgui_controls/PanelListPanel.cpp b/sp/src/vgui2/vgui_controls/PanelListPanel.cpp index 51fe8ab9..355ac08f 100644 --- a/sp/src/vgui2/vgui_controls/PanelListPanel.cpp +++ b/sp/src/vgui2/vgui_controls/PanelListPanel.cpp @@ -24,6 +24,8 @@ using namespace vgui; +DECLARE_BUILD_FACTORY( PanelListPanel ); + //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- @@ -135,7 +137,7 @@ Panel *PanelListPanel::GetCellRenderer( int row ) // data->GetName() is used to uniquely identify an item // data sub items are matched against column header name to be used in the table //----------------------------------------------------------------------------- -int PanelListPanel::AddItem( Panel *labelPanel, Panel *panel) +int PanelListPanel::AddItem( Panel *labelPanel, Panel *panel ) { Assert(panel); diff --git a/sp/src/vgui2/vgui_controls/RadioButton.cpp b/sp/src/vgui2/vgui_controls/RadioButton.cpp index 5d0dbeef..0b5d81d2 100644 --- a/sp/src/vgui2/vgui_controls/RadioButton.cpp +++ b/sp/src/vgui2/vgui_controls/RadioButton.cpp @@ -115,7 +115,7 @@ void RadioButton::ApplySchemeSettings(IScheme *pScheme) SetContentAlignment(a_west); // reloading the scheme wipes out lists of images - _radioBoxImage->SetFont( pScheme->GetFont("Marlett", IsProportional()) ); + _radioBoxImage->SetFont( pScheme->GetFont("MarlettSmall", IsProportional()) ); _radioBoxImage->ResizeImageToContent(); SetImageAtIndex(0, _radioBoxImage, 0); diff --git a/sp/src/vgui2/vgui_controls/TextEntry.cpp b/sp/src/vgui2/vgui_controls/TextEntry.cpp index 7a4f2d8c..825cb4ab 100644 --- a/sp/src/vgui2/vgui_controls/TextEntry.cpp +++ b/sp/src/vgui2/vgui_controls/TextEntry.cpp @@ -1637,7 +1637,7 @@ void TextEntry::OnKeyCodePressed(KeyCode code) // Pass on the joystick and mouse codes if ( IsMouseCode(code) || IsNovintButtonCode(code) || IsJoystickCode(code) || IsJoystickButtonCode(code) || - IsJoystickPOVCode(code) || IsJoystickPOVCode(code) || IsJoystickAxisCode(code) ) + IsJoystickPOVCode(code) || IsJoystickAxisCode(code) ) { Panel::OnKeyCodePressed( code ); return; diff --git a/sp/src/vpc_scripts/source_dll_base.vpc b/sp/src/vpc_scripts/source_dll_base.vpc index 16e565ec..f8d90184 100644 --- a/sp/src/vpc_scripts/source_dll_base.vpc +++ b/sp/src/vpc_scripts/source_dll_base.vpc @@ -10,7 +10,7 @@ $Include "$SRCDIR\vpc_scripts\source_video_base.vpc" $Configuration { - $General [$VS2010] + $General { $TargetExtension "$OUTDLLEXT" } @@ -20,6 +20,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } diff --git a/sp/src/vpc_scripts/source_dll_win32_base.vpc b/sp/src/vpc_scripts/source_dll_win32_base.vpc index 1507687e..cec539ad 100644 --- a/sp/src/vpc_scripts/source_dll_win32_base.vpc +++ b/sp/src/vpc_scripts/source_dll_win32_base.vpc @@ -24,7 +24,7 @@ $IgnoreRedundancyWarning "ON" // Common Configuration $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTBINNAME" } @@ -50,6 +50,7 @@ $Configuration // Suppress this pointless warning using the undocumented /ignore linker switch // schemalib.lib(schemaclassinfo.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library $AdditionalOptions "$BASE /ignore:4221" + $AdditionalOptions "$BASE $SRCDIR\lib\public\ftol3.obj" [$VS2013 && $WIN32 && !$DISABLE_FTOL3_OVERRIDE && !$SOURCESDK] // Work around CRT bug https://connect.microsoft.com/VisualStudio/feedback/details/806362/vc12-pollutes-the-floating-point-stack-when-casting-infinity-nan-to-unsigned-long# } $PreBuildEvent @@ -105,8 +106,8 @@ $Project } // Implement __imp__EncodePointer and __imp__DecodePointer so that we can run on XP SP1 - // when building with VS 2010. - $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32 && $VS2010] + // when building with VS 2010 and higher. + $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32] { $Configuration { diff --git a/sp/src/vpc_scripts/source_dll_win32_debug.vpc b/sp/src/vpc_scripts/source_dll_win32_debug.vpc index aa8ebf13..c5b786d2 100644 --- a/sp/src/vpc_scripts/source_dll_win32_debug.vpc +++ b/sp/src/vpc_scripts/source_dll_win32_debug.vpc @@ -166,7 +166,6 @@ $Configuration "Debug" $ManifestFile $AdditionalManifestDependencies $AllowIsolation - //$UACExecutionLevel [$VS2010] // Debugging $GenerateDebugInfo "Yes (/DEBUG)" diff --git a/sp/src/vpc_scripts/source_dll_win32_release.vpc b/sp/src/vpc_scripts/source_dll_win32_release.vpc index 916045f5..880e5efc 100644 --- a/sp/src/vpc_scripts/source_dll_win32_release.vpc +++ b/sp/src/vpc_scripts/source_dll_win32_release.vpc @@ -82,7 +82,7 @@ $Configuration "Release" // Preprocessor $PreprocessorDefinitions "$BASE;WIN32;_WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions)" - $PreprocessorDefinitions "$BASE;RELEASE_ASSERTS" [$RELEASEASSERTS] + $PreprocessorDefinitions "$BASE;RELEASEASSERTS" [$RELEASEASSERTS] $IgnoreStandardIncludePath $GeneratePreprocessedFile $KeepComments @@ -143,7 +143,7 @@ $Configuration "Release" $AdditionalOptions "/Zm200" // Enable extra debugging information. - $AdditionalOptions "$BASE /d2Zi+" [$VS2010] + $AdditionalOptions "$BASE /d2Zi+" $AdditionalOptions "$BASE /Oy-" [$NOFPO] } diff --git a/sp/src/vpc_scripts/source_exe_base.vpc b/sp/src/vpc_scripts/source_exe_base.vpc index e19d07f8..c6ffafaa 100644 --- a/sp/src/vpc_scripts/source_exe_base.vpc +++ b/sp/src/vpc_scripts/source_exe_base.vpc @@ -15,6 +15,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } \ No newline at end of file diff --git a/sp/src/vpc_scripts/source_exe_con_base.vpc b/sp/src/vpc_scripts/source_exe_con_base.vpc index 04c3f4e1..f1521ecd 100644 --- a/sp/src/vpc_scripts/source_exe_con_base.vpc +++ b/sp/src/vpc_scripts/source_exe_con_base.vpc @@ -13,6 +13,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } diff --git a/sp/src/vpc_scripts/source_exe_con_win32_base.vpc b/sp/src/vpc_scripts/source_exe_con_win32_base.vpc index 3dfa9e29..bd9736e6 100644 --- a/sp/src/vpc_scripts/source_exe_con_win32_base.vpc +++ b/sp/src/vpc_scripts/source_exe_con_win32_base.vpc @@ -14,7 +14,7 @@ $Include "$SRCDIR\vpc_scripts\source_exe_win_win32_base.vpc" $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTBINNAME" } diff --git a/sp/src/vpc_scripts/source_exe_win_win32_base.vpc b/sp/src/vpc_scripts/source_exe_win_win32_base.vpc index 22b3896f..47ce40fd 100644 --- a/sp/src/vpc_scripts/source_exe_win_win32_base.vpc +++ b/sp/src/vpc_scripts/source_exe_win_win32_base.vpc @@ -24,7 +24,7 @@ $IgnoreRedundancyWarning "ON" // Common Configuration $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTBINNAME" } @@ -53,6 +53,7 @@ $Configuration // Suppress this pointless warning using the undocumented /ignore linker switch // schemalib.lib(schemaclassinfo.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library $AdditionalOptions "$BASE /ignore:4221" + $AdditionalOptions "$BASE $SRCDIR\lib\public\ftol3.obj" [$VS2013 && $WIN32 && !$DISABLE_FTOL3_OVERRIDE && !$SOURCESDK] // Work around CRT bug https://connect.microsoft.com/VisualStudio/feedback/details/806362/vc12-pollutes-the-floating-point-stack-when-casting-infinity-nan-to-unsigned-long# } $PreBuildEvent @@ -100,8 +101,8 @@ $Project } // Implement __imp__EncodePointer and __imp__DecodePointer so that we can run on XP SP1 - // when building with VS 2010. - $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32 && $VS2010] + // when building with VS 2010 and higher. + $File "$SRCDIR\public\tier0\pointeroverride.asm" [$WIN32] { $Configuration { diff --git a/sp/src/vpc_scripts/source_exe_win_win32_debug.vpc b/sp/src/vpc_scripts/source_exe_win_win32_debug.vpc index 302d80e9..399d1761 100644 --- a/sp/src/vpc_scripts/source_exe_win_win32_debug.vpc +++ b/sp/src/vpc_scripts/source_exe_win_win32_debug.vpc @@ -246,7 +246,7 @@ $Configuration "Debug" $UseFAT32WorkAround // Input And Output - $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [$VS2010 && !$SOURCESDK] + $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [!$SOURCESDK] $InputResourceManifests $EmbedManifest $OutputManifestFile diff --git a/sp/src/vpc_scripts/source_exe_win_win32_release.vpc b/sp/src/vpc_scripts/source_exe_win_win32_release.vpc index d3370146..6cb5c335 100644 --- a/sp/src/vpc_scripts/source_exe_win_win32_release.vpc +++ b/sp/src/vpc_scripts/source_exe_win_win32_release.vpc @@ -142,7 +142,7 @@ $Configuration "Release" $ErrorReporting "Prompt Immediately (/errorReport:prompt)" // Enable extra debugging information. - $AdditionalOptions "$BASE /d2Zi+" [$VS2010] + $AdditionalOptions "$BASE /d2Zi+" // Command Line $AdditionalOptions "$BASE /Oy-" [$NOFPO] } @@ -264,7 +264,7 @@ $Configuration "Release" $UseFAT32WorkAround // Input And Output - $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [$VS2010 && !$SOURCESDK] + $AdditionalManifestFiles "$SRCDIR\public\windows_default.manifest" [!$SOURCESDK] $InputResourceManifests $EmbedManifest $OutputManifestFile diff --git a/sp/src/vpc_scripts/source_lib_base.vpc b/sp/src/vpc_scripts/source_lib_base.vpc index 07014b44..851609eb 100644 --- a/sp/src/vpc_scripts/source_lib_base.vpc +++ b/sp/src/vpc_scripts/source_lib_base.vpc @@ -17,6 +17,6 @@ $Configuration $PreprocessorDefinitions "$BASE;DEV_BUILD" [!$PUBLISH] $PreprocessorDefinitions "$BASE;_PROFILE" [$PROFILE && !$RETAIL] $PreprocessorDefinitions "$BASE;RETAIL_ASSERTS" [$RETAIL && $RETAILASSERTS] - $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" [$NOFPO || $VS2010] + $PreprocessorDefinitions "$BASE;FRAME_POINTER_OMISSION_DISABLED" // This is now always true. } } diff --git a/sp/src/vpc_scripts/source_lib_win32_base.vpc b/sp/src/vpc_scripts/source_lib_win32_base.vpc index c5f8e0b5..02caa800 100644 --- a/sp/src/vpc_scripts/source_lib_win32_base.vpc +++ b/sp/src/vpc_scripts/source_lib_win32_base.vpc @@ -22,7 +22,7 @@ $IgnoreRedundancyWarning "ON" // Common Configuration $Configuration { - $General [$VS2010] + $General { $TargetName "$OUTLIBNAME" } diff --git a/sp/src/vpc_scripts/source_lib_win32_debug.vpc b/sp/src/vpc_scripts/source_lib_win32_debug.vpc index cefc44f4..d179ecef 100644 --- a/sp/src/vpc_scripts/source_lib_win32_debug.vpc +++ b/sp/src/vpc_scripts/source_lib_win32_debug.vpc @@ -23,8 +23,7 @@ $Configuration "Debug" $General { // General - $OutputDirectory ".\Debug$_SUBDIRSUFFIX" [!$VS2010] - $OutputDirectory "$OUTLIBDIR" [$VS2010] + $OutputDirectory "$OUTLIBDIR" $IntermediateDirectory ".\Debug$_SUBDIRSUFFIX" $ExtensionsToDeleteOnClean $BuildLogFile diff --git a/sp/src/vpc_scripts/source_lib_win32_release.vpc b/sp/src/vpc_scripts/source_lib_win32_release.vpc index b6f54059..cbfe4cab 100644 --- a/sp/src/vpc_scripts/source_lib_win32_release.vpc +++ b/sp/src/vpc_scripts/source_lib_win32_release.vpc @@ -27,10 +27,7 @@ $Configuration "Release" $General { // General - $OutputDirectory ".\Release$_SUBDIRSUFFIX" [!$VS2010 && !$RETAIL && !$PROFILE] - $OutputDirectory ".\Retail$_SUBDIRSUFFIX" [!$VS2010 && $RETAIL] - $OutputDirectory ".\Profile$_SUBDIRSUFFIX" [!$VS2010 && !$RETAIL && $PROFILE] - $OutputDirectory "$OUTLIBDIR" [$VS2010] + $OutputDirectory "$OUTLIBDIR" $IntermediateDirectory ".\Release$_SUBDIRSUFFIX" [!$RETAIL && !$PROFILE] $IntermediateDirectory ".\Retail$_SUBDIRSUFFIX" [$RETAIL] $IntermediateDirectory ".\Profile$_SUBDIRSUFFIX" [!$RETAIL && $PROFILE] @@ -83,7 +80,7 @@ $Configuration "Release" // Preprocessor $PreprocessorDefinitions "$BASE;WIN32;_WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;%(PreprocessorDefinitions)" - $PreprocessorDefinitions "$BASE;RELEASE_ASSERTS" [$RELEASEASSERTS] + $PreprocessorDefinitions "$BASE;RELEASEASSERTS" [$RELEASEASSERTS] $IgnoreStandardIncludePath $GeneratePreprocessedFile $KeepComments @@ -143,7 +140,7 @@ $Configuration "Release" $ErrorReporting "Prompt Immediately (/errorReport:prompt)" // Enable extra debugging information. - $AdditionalOptions "/d2Zi+" [$VS2010] + $AdditionalOptions "/d2Zi+" $AdditionalOptions "$BASE /Oy-" [$NOFPO] } diff --git a/sp/src/vpc_scripts/source_win32_analyze.vpc b/sp/src/vpc_scripts/source_win32_analyze.vpc new file mode 100644 index 00000000..ceb6e0b0 --- /dev/null +++ b/sp/src/vpc_scripts/source_win32_analyze.vpc @@ -0,0 +1,65 @@ +// /analyze specific settings. Placed here so that they can be changed without triggering rebuilds of the entire world. + +$Configuration +{ + $Compiler + { + // When using /analyze (triggered with /define:ANALYZE on the vpc command line) we want to forcibly disable lots + // of warnings. + // warning C6308: 'realloc' might return null pointer, cause the original memory block to be leaked + // warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead + // warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'GetProcAddress' + // warning C6309: Argument '1' is null: this does not adhere to function specification of 'GetProcAddress' + // warning C6011: Dereferencing NULL pointer 'm_ppTestCases' + // warning C6211: Leaking memory 'newKeyValue' due to an exception. Consider using a local catch block to clean up memory + // These warnings are because /analyze doesn't like our use of constants, especially things like IsPC() + // warning C6326: Potential comparison of a constant with another constant + // warning C6239: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? + // warning C6285: ( || ) is always a non-zero constant. Did you intend to use the bitwise-and operator? + // warning C6237: ( && ) is always zero. is never evaluated and might have side effects + // warning C6235: ( || ) is always a non-zero constant + // warning C6240: ( && ) always evaluates to the result of . Did you intend to use the bitwise-and operator? + // These warnings aren't really important: + // warning C6323: Use of arithmetic operator on Boolean type(s) + // /analyze doesn't like GCOMPILER_ASSERT's implementation of compile-time asserts + // warning C6326: Potential comparison of a constant with another constant + // warning C6335: Leaking process information handle 'pi.hThread' + // warning C6320: Exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This might mask exceptions that were not intended to be handled + // warning C6250: Calling 'VirtualFree' without the MEM_RELEASE flag might free memory but not address descriptors (VADs). This causes address space leaks + // warning C6384: Dividing sizeof a pointer by another value + // warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH -- bogus + // warning C6322: Empty _except block + + // Set the stack size threshold to 100,000 to avoid noisy warnings on functions with modest stack usage + // Note that /analyze for VS 2010 only works with the 32-bit compiler, but for VS 2012 it works on 64-bit + // as well. + $DisableSpecificWarnings "$BASE;6308;6255;6387;6309;6011;6211;6326;6239;6285;6237;6235;6240;6323;6326;6335;6320;6250;6384;6318;6322" [$ANALYZE] + // See http://randomascii.wordpress.com/2011/10/04/analyzecommand-line-options/ for details on these options. + // /analyze:only may result in fewer warnings being reported, but the warnings it misses should show up in the regular build. + $AdditionalOptions "$BASE /analyze /analyze:only /analyze:stacksize100000" [$ANALYZE] + + // Specify /define:ALLOWSHADOWING to suppress variable shadowing warnings + $DisableSpecificWarnings "$BASE;6244;6246" [$ANALYZE && $ALLOWSHADOWING] + + // New warnings in VS 2012 that we want to ignore. + // warning C4005: 'DXGI_STATUS_OCCLUDED' : macro redefinition + // warning C6014: Leaking memory 'pThinkParams'. + // warning C28159: Consider using 'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount overflows roughly every 49 days. + // warning C28182: Dereferencing NULL pointer. 'pPropMesh' contains the same NULL value as '(CMesh *)=(pPropMesh)' did. + // warning C28183: 'entropy->ac_count_ptrs[actbl]' could be '0', and is a copy of the value found in 'entropy->dc_count_ptrs[dctbl]': this does not adhere to the specification for the function 'memset'. + // warning C28197: Possibly leaking memory 'pInfo'. + // warning C28198: Possibly leaking memory 'kvFrame1' due to an exception. Is a local catch block needed to clean up memory? + // warning C28204: 'QueryInterface' : Only one of this overload and the one at c:\program files (x86)\windows kits\8.0\include\um\unknwnbase.h(114) are annotated for _Param_(2): both or neither must be annotated. + // warning C28247: Model file annotation for function '_vsnprintf': annotation on _Param_(1)/SAL_post, 'RequiresZeroTermination' duplicates header file annotation 'SAL_nullTerminated'. Remove the duplicated annotations from the model file. (Header: c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(349).) + // warning C28251: Inconsistent annotation for 'WinMain': this instance has no annotations. See c:\program files (x86)\windows kits\8.0\include\um\winbase.h(2286). + // warning C28301: No annotations for first declaration of 'InitializeCriticalSection'. See d:\clients\tf3\staging\src\public\tier0\threadtools.h(1373). + // warning C28195: The function was declared as acquiring memory in 'return' and exited without doing so. + // warning C6340: Mismatch on sign: 'unsigned short' passed as parameter '6' when some signed type is required in call to 'V_snprintf'. + // This warning only applies to Windows XP in low-memory situations: + // warning C28125: The function 'InitializeCriticalSection' must be called from within a try\except block + // warning C28160: Error annotation: Calling VirtualFreeEx without the MEM_RELEASE flag frees memory but not address descriptors (VADs); results in address space leaks. + // warning C6248: Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. + // warning C6102: Using value from failed function call + $DisableSpecificWarnings "$BASE;6014;28159;28182;28183;28197;28198;28204;28247;28251;28301;28195;6340;28125;28160;6248;6102" [$ANALYZE && ($VS2012 || $VS2013)] + } +} diff --git a/sp/src/vpc_scripts/source_win32_base.vpc b/sp/src/vpc_scripts/source_win32_base.vpc index 3749a07a..245366f4 100644 --- a/sp/src/vpc_scripts/source_win32_base.vpc +++ b/sp/src/vpc_scripts/source_win32_base.vpc @@ -1,3 +1,8 @@ +// Settings for /analyze are in a separate .vpc file so that they can be +// changed without triggering a full rebuild of non-analyze builds. On non-analyze +// builds the analyze.vpc file will not be listed as a dependency. +$Include "$SRCDIR\vpc_scripts\source_win32_analyze.vpc" [$ANALYZE] + $Configuration { $General @@ -27,45 +32,23 @@ $Configuration // warning C4316: object allocated on the heap may not be aligned 16 $DisableSpecificWarnings "$BASE;4316" [$VS2013] - // When using /analyze (triggered with /define:ANALYZE on the vpc command line) we want to forcibly disable lots - // of warnings (also disabled in platform.h but not everybody includes that). - // See platform.h for the list of warnings with explanations. - // warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH -- bogus - // warning C6322: Empty _except block - // Set the stack size threshold to 100,000 to avoid noisy warnings on functions with modest stack usage - // Note that /analyze for VS 2010 only works with the 32-bit compiler, but for VS 2012 it works on 64-bit - // as well. - $DisableSpecificWarnings "$BASE;6308;6255;6387;6309;6011;6211;6031;6326;6239;6285;6237;6235;6240;6323;6326;6335;6320;6250;6384;6318;6322" [$ANALYZE] - // See http://randomascii.wordpress.com/2011/10/04/analyzecommand-line-options/ for details on these options. - // /analyze:only may result in fewer warnings being reported, but the warnings it misses should show up in the regular build. - $AdditionalOptions "$BASE /analyze /analyze:only /analyze:stacksize100000" [$ANALYZE] - - // Specify /define:ALLOWSHADOWING to suppress variable shadowing warnings - $DisableSpecificWarnings "$BASE;6244;6246" [$ANALYZE && $ALLOWSHADOWING] - - // New warnings in VS 2012 that we want to ignore. - // warning C4005: 'DXGI_STATUS_OCCLUDED' : macro redefinition - // warning C6014: Leaking memory 'pThinkParams'. - // warning C28159: Consider using 'GetTickCount64' instead of 'GetTickCount'. Reason: GetTickCount overflows roughly every 49 days. - // warning C28182: Dereferencing NULL pointer. 'pPropMesh' contains the same NULL value as '(CMesh *)=(pPropMesh)' did. - // warning C28183: 'entropy->ac_count_ptrs[actbl]' could be '0', and is a copy of the value found in 'entropy->dc_count_ptrs[dctbl]': this does not adhere to the specification for the function 'memset'. - // warning C28197: Possibly leaking memory 'pInfo'. - // warning C28198: Possibly leaking memory 'kvFrame1' due to an exception. Is a local catch block needed to clean up memory? - // warning C28204: 'QueryInterface' : Only one of this overload and the one at c:\program files (x86)\windows kits\8.0\include\um\unknwnbase.h(114) are annotated for _Param_(2): both or neither must be annotated. - // warning C28247: Model file annotation for function '_vsnprintf': annotation on _Param_(1)/SAL_post, 'RequiresZeroTermination' duplicates header file annotation 'SAL_nullTerminated'. Remove the duplicated annotations from the model file. (Header: c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdio.h(349).) - // warning C28251: Inconsistent annotation for 'WinMain': this instance has no annotations. See c:\program files (x86)\windows kits\8.0\include\um\winbase.h(2286). - // warning C28301: No annotations for first declaration of 'InitializeCriticalSection'. See d:\clients\tf3\staging\src\public\tier0\threadtools.h(1373). - // warning C28195: The function was declared as acquiring memory in 'return' and exited without doing so. - // warning C6340: Mismatch on sign: 'unsigned short' passed as parameter '6' when some signed type is required in call to 'V_snprintf'. - // This warning only applies to Windows XP in low-memory situations: - // warning C28125: The function 'InitializeCriticalSection' must be called from within a try\except block - // warning C28160: Error annotation: Calling VirtualFreeEx without the MEM_RELEASE flag frees memory but not address descriptors (VADs); results in address space leaks. - // warning C6248: Setting a SECURITY_DESCRIPTOR's DACL to NULL will result in an unprotected object. - // warning C6102: Using value from failed function call - $DisableSpecificWarnings "$BASE;6014;28159;28182;28183;28197;28198;28204;28247;28251;28301;28195;6340;28125;28160;6248;6102" [$ANALYZE && ($VS2012 || $VS2013)] + // Having lots of warnings makes it harder to notice new, and possibly + // important warnings, both on buildbot and in the output window. Lots + // of warnings also makes it harder to skip through errors in the output + // window since F8 stops on both warnings and errors. The only way to + // keep the warning count down is to have warnings-as-errors. + // We will not be warning free on 64-bit for a while... + $TreatWarningsAsErrors "Yes (/WX)" [!$ANALYZE && !$WIN64] // Defines to differentiate 32 from 64 bit builds $PreprocessorDefinitions "$BASE;PLATFORM_64BITS;WIN64;_WIN64;COMPILER_MSVC64" [$WIN64] $PreprocessorDefinitions "$BASE;COMPILER_MSVC32" [$WIN32] + + // /Gw is a VS 2013 option that puts global and static variables in individual sections so that the + // linker can discard unreferenced data. When building @client /dota with linker optimizations this + // reduces the client.dll size by about 1.14%. When linker optimizations are disabled this has no + // effect. This option does not show up in the IDE so we need to add it in $AdditionalOptions. + // http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx + $AdditionalOptions "$BASE /Gw" [$VS2013] } }