diff --git a/engine/sys_getmodes.cpp b/engine/sys_getmodes.cpp index 939b010f..43dce4d0 100644 --- a/engine/sys_getmodes.cpp +++ b/engine/sys_getmodes.cpp @@ -819,10 +819,13 @@ void CVideoMode_Common::SetupStartupGraphic() // loading.vtf buf.Clear(); // added this Clear() because we saw cases where LoadVTF was not emptying the buf fully in the above section - m_pLoadingTexture = LoadVTF( buf, "materials/console/startup_loading.vtf" ); + const char* loading = "materials/console/startup_loading.vtf"; + if ( IsSteamDeck() ) + loading = "materials/gamepadui/game_logo.vtf"; + m_pLoadingTexture = LoadVTF( buf, loading ); if ( !m_pLoadingTexture ) { - Error( "Can't find background image materials/console/startup_loading.vtf\n" ); + Error( "Can't find background image '%s'\n", loading ); return; } } @@ -883,8 +886,12 @@ void CVideoMode_Common::DrawStartupGraphic() pVMTKeyValues->SetInt( "$nocull", 1 ); IMaterial *pMaterial = g_pMaterialSystem->CreateMaterial( "__background", pVMTKeyValues ); + const char* loading = "console/startup_loading.vtf"; + if ( IsSteamDeck() ) + loading = "gamepadui/game_logo.vtf"; + pVMTKeyValues = new KeyValues( "UnlitGeneric" ); - pVMTKeyValues->SetString( "$basetexture", "Console/startup_loading.vtf" ); + pVMTKeyValues->SetString( "$basetexture", loading ); pVMTKeyValues->SetInt( "$translucent", 1 ); pVMTKeyValues->SetInt( "$ignorez", 1 ); pVMTKeyValues->SetInt( "$nofog", 1 ); @@ -922,7 +929,11 @@ void CVideoMode_Common::DrawStartupGraphic() slide = 0; DrawScreenSpaceRectangle( pMaterial, 0, 0+slide, w, h-50, 0, 0, tw-1, th-1, tw, th, NULL,1,1,depth ); - DrawScreenSpaceRectangle( pLoadingMaterial, w-lw, h-lh+slide/2, lw, lh, 0, 0, lw-1, lh-1, lw, lh, NULL,1,1,depth-0.1 ); + if ( !IsSteamDeck() ) + DrawScreenSpaceRectangle( pLoadingMaterial, w-lw, h-lh+slide/2, lw, lh, 0, 0, lw-1, lh-1, lw, lh, NULL,1,1,depth-0.1 ); + else + // TODO: Steam Deck + DrawScreenSpaceRectangle( pLoadingMaterial, w-lw, h-lh+slide/2, lw, lh, 0, 0, lw-1, lh-1, lw, lh, NULL,1,1,depth-0.1 ); } if(0) diff --git a/engine/vgui_baseui_interface.cpp b/engine/vgui_baseui_interface.cpp index 2f29683c..9fa8c899 100644 --- a/engine/vgui_baseui_interface.cpp +++ b/engine/vgui_baseui_interface.cpp @@ -613,7 +613,7 @@ void CEngineVGui::Init() return; } - if ( IsX360() ) + if ( IsX360() || IsSteamDeck() ) { CCommand ccommand; if ( CL_ShouldLoadBackgroundLevel( ccommand ) ) @@ -1273,7 +1273,7 @@ void CEngineVGui::OnLevelLoadingStarted() } } - if ( IsX360() ) + if ( IsX360() || IsSteamDeck() ) { // TCR requirement, always!!! m_bShowProgressDialog = true; diff --git a/game/client/hud_crosshair.cpp b/game/client/hud_crosshair.cpp index fc7714fe..6dd5e2f6 100644 --- a/game/client/hud_crosshair.cpp +++ b/game/client/hud_crosshair.cpp @@ -258,7 +258,15 @@ void CHudCrosshair::Paint( void ) pWeapon->GetWeaponCrosshairScale( flWeaponScale ); } - float flPlayerScale = 1.0f; + int iScreenDiv = 1600; + if ( IsSteamDeck() ) + iScreenDiv = 1440; + + float flPlayerScale; + if ( !m_pCrosshair->bRenderUsingFont ) + flPlayerScale = (ScreenHeight() / iScreenDiv) + 1; + else + flPlayerScale = 1.0f; #ifdef TF_CLIENT_DLL Color clr( cl_crosshair_red.GetInt(), cl_crosshair_green.GetInt(), cl_crosshair_blue.GetInt(), 255 ); flPlayerScale = cl_crosshair_scale.GetFloat() / 32.0f; // the player can change the scale in the options/multiplayer tab diff --git a/gameui/BasePanel.cpp b/gameui/BasePanel.cpp index c6e4051e..41d52d63 100644 --- a/gameui/BasePanel.cpp +++ b/gameui/BasePanel.cpp @@ -1801,8 +1801,11 @@ void CBasePanel::ApplySchemeSettings(IScheme *pScheme) // load the loading icon if ( m_iLoadingImageID == -1 ) { + const char* loading = "console/startup_loading"; + if ( IsSteamDeck() ) + loading = "gamepadui/game_logo"; m_iLoadingImageID = surface()->CreateNewTextureID(); - surface()->DrawSetTextureFile( m_iLoadingImageID, "Console/startup_loading", false, false ); + surface()->DrawSetTextureFile( m_iLoadingImageID, loading, false, false ); } } } diff --git a/public/tier1/KeyValues.h b/public/tier1/KeyValues.h index 151aa281..3a6af814 100644 --- a/public/tier1/KeyValues.h +++ b/public/tier1/KeyValues.h @@ -428,6 +428,8 @@ inline bool KeyValues::IsEmpty( int keySymbol ) return dat ? dat->IsEmpty( ) : true; } +bool IsSteamDeck(); + bool EvaluateConditional( const char *str ); class CUtlSortVectorKeyValuesByName diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index 8e855a78..75664e43 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -2179,6 +2179,34 @@ void KeyValues::RecursiveMergeKeyValues( KeyValues *baseKV ) } } +static int s_nSteamDeckCached = -1; + +bool IsSteamDeck() +{ + if (s_nSteamDeckCached == -1) { + if ( CommandLine()->CheckParm( "-nogamepadui" ) != 0 ) + { + s_nSteamDeckCached = 0; + } + else + { + if ( CommandLine()->CheckParm( "-gamepadui" ) != 0 ) + { + s_nSteamDeckCached = 1; + } + else + { + char *deck = getenv("SteamDeck"); + if ( deck == 0 || *deck == 0 ) + s_nSteamDeckCached = 0; + else + s_nSteamDeckCached = atoi(deck) != 0; + } + } + } + return s_nSteamDeckCached; +} + //----------------------------------------------------------------------------- // Returns whether a keyvalues conditional evaluates to true or false // Needs more flexibility with conditionals, checking convars would be nice. @@ -2195,8 +2223,8 @@ bool EvaluateConditional( const char *str ) if ( *str == '!' ) bNot = true; - if( Q_stristr( str, "$DECK" ) ) - return false ^ bNot; // Steam deck unsupported + if ( Q_stristr( str, "$DECK" ) ) + return IsSteamDeck() ^ bNot; if ( Q_stristr( str, "$X360" ) ) return IsX360() ^ bNot;