Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions engine/sys_getmodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions engine/vgui_baseui_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ void CEngineVGui::Init()
return;
}

if ( IsX360() )
if ( IsX360() || IsSteamDeck() )
{
CCommand ccommand;
if ( CL_ShouldLoadBackgroundLevel( ccommand ) )
Expand Down Expand Up @@ -1273,7 +1273,7 @@ void CEngineVGui::OnLevelLoadingStarted()
}
}

if ( IsX360() )
if ( IsX360() || IsSteamDeck() )
{
// TCR requirement, always!!!
m_bShowProgressDialog = true;
Expand Down
10 changes: 9 additions & 1 deletion game/client/hud_crosshair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion gameui/BasePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions public/tier1/KeyValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ inline bool KeyValues::IsEmpty( int keySymbol )
return dat ? dat->IsEmpty( ) : true;
}

bool IsSteamDeck();

bool EvaluateConditional( const char *str );

class CUtlSortVectorKeyValuesByName
Expand Down
32 changes: 30 additions & 2 deletions tier1/KeyValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down