Last active
October 1, 2019 17:02
-
-
Save slouken/c6f38059e747306742cb6aa1908682ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool BSteamRemotePlayActive() | |
{ | |
uint32 unSessionCount = SteamRemotePlay()->GetSessionCount(); | |
for ( uint32 iIndex = 0; iIndex < unSessionCount; iIndex++ ) | |
{ | |
RemotePlaySessionID_t unSessionID = SteamRemotePlay()->GetSessionID( iIndex ); | |
if ( !unSessionID ) | |
{ | |
continue; | |
} | |
return true; | |
} | |
return false; | |
} | |
bool BSteamRemotePlayToPhone() | |
{ | |
uint32 unSessionCount = SteamRemotePlay()->GetSessionCount(); | |
for ( uint32 iIndex = 0; iIndex < unSessionCount; iIndex++ ) | |
{ | |
RemotePlaySessionID_t unSessionID = SteamRemotePlay()->GetSessionID( iIndex ); | |
if ( !unSessionID ) | |
{ | |
continue; | |
} | |
ESteamDeviceFormFactor eFormFactor = SteamRemotePlay()->GetSessionClientFormFactor( unSessionID ); | |
if ( eFormFactor == k_ESteamDeviceFormFactorPhone ) | |
{ | |
return true; | |
} | |
} | |
return false; | |
} | |
// This can return false if the remote device doesn't provide device resolution information | |
bool BGetSteamRemotePlayResolution( int *pnX, int *pnY ) | |
{ | |
int nMaxResolutionX = 0, nMaxResolutionY = 0; | |
uint32 unSessionCount = SteamRemotePlay()->GetSessionCount(); | |
for ( uint32 iIndex = 0; iIndex < unSessionCount; iIndex++ ) | |
{ | |
RemotePlaySessionID_t unSessionID = SteamRemotePlay()->GetSessionID( iIndex ); | |
if ( !unSessionID ) | |
{ | |
continue; | |
} | |
int nResolutionX = 0, nResolutionY = 0; | |
SteamRemotePlay()->BGetSessionClientResolution( unSessionID, &nResolutionX, &nResolutionY ); | |
if ( nResolutionX > nMaxResolutionX ) | |
{ | |
nMaxResolutionX = nResolutionX; | |
nMaxResolutionY = nResolutionY; | |
} | |
} | |
if ( pnX ) | |
{ | |
*pnX = nMaxResolutionX; | |
} | |
if ( pnY ) | |
{ | |
*pnY = nMaxResolutionY; | |
} | |
return ( nMaxResolutionX > 0 && nMaxResolutionY > 0 ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment