diff --git a/Readme.txt b/Readme.txt index 56a07e2..d505268 100644 --- a/Readme.txt +++ b/Readme.txt @@ -1,6 +1,6 @@ ================================================================ -Copyright © 1996-2022, Valve Corporation, All rights reserved. +Copyright © 1996-2024, Valve Corporation, All rights reserved. ================================================================ @@ -8,6 +8,26 @@ Copyright Welcome to the Steamworks SDK. For documentation please see our partner website at: http://partner.steamgames.com + +---------------------------------------------------------------- +v1.60 19th June 2024 +---------------------------------------------------------------- + +General +* CSteamAPIContext has been removed. Please switch to using the Steam accessors where appropriate. + +ISteamTimeline +* Added this new interface to allow games to provide information that supports the new Game Recording feature. See the [url=https://partner.steamgames.com/doc/features/timeline]Timeline[/url] documentation for more information. + +ISteamUGC +* Added 64 bit m_ulTotalFilesSize to SteamUGCDetails_t which is the correct size of the content for Workshop items are larger than 2,147,483,647 bytes. +* Added GetNumSupportedGameVersions() and GetSupportedGameVersionData() which can be used to determine what game beta branches a Workshop item supports/is valid for. +* Added SetAdminQuery() to allow ISteamUGC to be used in a tools like environment for users who have the appropriate privileges for the calling appid. + +ISteamApps +* Added API to allow the game to manage active beta branches. + + ---------------------------------------------------------------- v1.59 9th February 2024 ---------------------------------------------------------------- diff --git a/SteamworksExample/Main.cpp b/SteamworksExample/Main.cpp index ccf842b..c415676 100644 --- a/SteamworksExample/Main.cpp +++ b/SteamworksExample/Main.cpp @@ -23,7 +23,7 @@ extern IGameEngine *CreateGameEngineOSX(); #elif defined(SDL) #include "GameEngine.h" - extern IGameEngine *CreateGameEngineSDL( ); + extern IGameEngine *CreateGameEngineSDL(); #endif #include "SpaceWarClient.h" @@ -115,7 +115,7 @@ bool ParseCommandLine( const char *pchCmdLine, const char **ppchServerAddress, c //----------------------------------------------------------------------------- // Purpose: Main loop code shared between all platforms //----------------------------------------------------------------------------- -void RunGameLoop( IGameEngine *pGameEngine, const char *pchServerAddress, const char *pchLobbyID ) +void RunGameLoop( IGameEngine *pGameEngine, const char *pchServerAddress, const char *pchLobbyID, bool bShowTimer ) { // Make sure it initialized ok if ( pGameEngine->BReadyForUse() ) @@ -123,6 +123,8 @@ void RunGameLoop( IGameEngine *pGameEngine, const char *pchServerAddress, const // Initialize the game CSpaceWarClient *pGameClient = new CSpaceWarClient( pGameEngine ); + pGameClient->SetShowTimer( bShowTimer ); + // Black background pGameEngine->SetBackgroundColor( 0, 0, 0, 0 ); @@ -196,9 +198,13 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) // This will also load the in-game steam overlay dll into your process. That dll is normally // injected by steam when it launches games, but by calling this you cause it to always load, // even when not launched via steam. - if ( !SteamAPI_Init() ) + SteamErrMsg errMsg = { 0 }; + if ( SteamAPI_InitEx( &errMsg ) != k_ESteamAPIInitResult_OK ) { - OutputDebugString( "SteamAPI_Init() failed\n" ); + OutputDebugString( "SteamAPI_Init() failed: " ); + OutputDebugString( errMsg ); + OutputDebugString( "\n" ); + Alert( "Fatal Error", "Steam must be running to play this game (SteamAPI_Init() failed).\n" ); return EXIT_FAILURE; } @@ -231,6 +237,8 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) } } + bool bShowTimer = !!strstr( pchCmdLine, "-timer" ); + // do a DRM self check Steamworks_SelfCheck(); @@ -271,7 +279,7 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) SteamInput()->SetInputActionManifestFilePath( rgchFullPath ); // This call will block and run until the game exits - RunGameLoop( pGameEngine, pchServerAddress, pchLobbyID ); + RunGameLoop( pGameEngine, pchServerAddress, pchLobbyID, bShowTimer ); // Shutdown the SteamAPI SteamAPI_Shutdown(); diff --git a/SteamworksExample/OverlayExamples.cpp b/SteamworksExample/OverlayExamples.cpp index 67ebb59..01a4522 100644 --- a/SteamworksExample/OverlayExamples.cpp +++ b/SteamworksExample/OverlayExamples.cpp @@ -52,7 +52,8 @@ public: AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToUser - friendrequestaccept", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToUser, "friendrequestaccept" } ) ); AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToUser - friendrequestignore", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToUser, "friendrequestignore" } ) ); - AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToWebPage", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToWebPage, "https://tomb.valve.org/community/actions/buttons/" } ) ); + AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToWebPage", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToWebPage, "https://steamcommunity.com/" } ) ); + AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToWebPageModal", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToWebPageModal, "https://steamcommunity.com/" } ) ); AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToStore", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToStore, "" } ) ); AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToStore - Add to Cart", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToStore, "addtocart" } ) ); AddMenuItem( COverlayExamplesMenu::MenuItem_t( "ActivateGameOverlayToStore - Add to Cart & Show", { OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToStore, "addtocartandshow" } ) ); @@ -131,6 +132,12 @@ void COverlayExamples::RunFrame() } break; + case OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToWebPageModal: + { + SteamFriends()->ActivateGameOverlayToWebPage( m_delayedCommand.m_pchExtraCommandData, k_EActivateGameOverlayToWebPageMode_Modal ); + } + break; + case OverlayExample_t::k_EOverlayExampleItem_ActivateGameOverlayToStore: { if ( !strcmp( m_delayedCommand.m_pchExtraCommandData, "addtocart" ) ) diff --git a/SteamworksExample/SpaceWarClient.cpp b/SteamworksExample/SpaceWarClient.cpp index 7e62b38..fe8a34e 100644 --- a/SteamworksExample/SpaceWarClient.cpp +++ b/SteamworksExample/SpaceWarClient.cpp @@ -27,6 +27,7 @@ #include "RemotePlay.h" #include "ItemStore.h" #include "OverlayExamples.h" +#include "timeline.h" #ifdef WIN32 #include #else @@ -35,6 +36,11 @@ #define _getcwd getcwd #define _snprintf snprintf #endif +#if defined(USE_SDL2) +#include +#elif defined(SDL) +#include +#endif CSpaceWarClient *g_pSpaceWarClient = NULL; @@ -47,6 +53,21 @@ extern bool ParseCommandLine( const char *pchCmdLine, const char **ppchServerAdd #endif +//----------------------------------------------------------------------------- +// Purpose: OS-flexible function to get milliseconds of clock time +//----------------------------------------------------------------------------- +uint32 Plat_GetTicks() +{ +#if defined(USE_SDL2) + return SDL_GetTicks64(); +#elif defined(SDL) + return SDL_GetTicks(); +#else + return GetTickCount(); +#endif +} + + //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- @@ -56,7 +77,6 @@ CSpaceWarClient::CSpaceWarClient( IGameEngine *pGameEngine ) } - //----------------------------------------------------------------------------- // Purpose: initialize our client for use //----------------------------------------------------------------------------- @@ -93,7 +113,11 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine ) m_usServerPort = 0; m_ulPingSentTime = 0; m_bSentWebOpen = false; + m_bShowTimer = false; + m_unTicksAtLaunch = 0; + m_hTimerFont = 0; m_hConnServer = k_HSteamNetConnection_Invalid; + m_unTicksAtLaunch = Plat_GetTicks(); // Initialize the peer to peer connection process SteamNetworkingUtils()->InitRelayNetworkAccess(); @@ -151,6 +175,7 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine ) // Init stats m_pStatsAndAchievements = new CStatsAndAchievements( pGameEngine ); + m_pTimeline = new CTimeline( pGameEngine ); m_pLeaderboards = new CLeaderboards( pGameEngine ); m_pFriendsList = new CFriendsList( pGameEngine ); m_pMusicPlayer = new CMusicPlayer( pGameEngine ); @@ -216,6 +241,9 @@ CSpaceWarClient::~CSpaceWarClient() if ( m_pStatsAndAchievements ) delete m_pStatsAndAchievements; + if ( m_pTimeline ) + delete m_pTimeline; + if ( m_pServerBrowser ) delete m_pServerBrowser; @@ -549,6 +577,7 @@ void CSpaceWarClient::SetGameState( EClientGameState eState ) // Let the stats handler check the state (so it can detect wins, losses, etc...) m_pStatsAndAchievements->OnGameStateChange( eState ); + m_pTimeline->OnGameStateChange( eState ); // update any rich presence state UpdateRichPresenceConnectionInfo(); @@ -1270,8 +1299,8 @@ void CSpaceWarClient::OnGameStateChanged( EClientGameState eGameStateNew ) if ( pchSteamRichPresenceDisplay != NULL ) { - SteamFriends()->SetRichPresence( "steam_display", bDisplayScoreInRichPresence ? "#StatusWithScore" : "#StatusWithoutScore" ); SteamFriends()->SetRichPresence( "gamestatus", pchSteamRichPresenceDisplay ); + SteamFriends()->SetRichPresence( "steam_display", bDisplayScoreInRichPresence ? "#StatusWithScore" : "#StatusWithoutScore" ); } // steam_player_group defines who the user is playing with. Set it to the steam ID @@ -1407,6 +1436,7 @@ void CSpaceWarClient::RunOccasionally() // Service stats and achievements m_pStatsAndAchievements->RunFrame(); + m_pTimeline->RunFrame(); } @@ -1418,6 +1448,8 @@ void CSpaceWarClient::RunFrame() // Get any new data off the network to begin with ReceiveNetworkData(); + RenderTimer(); + if ( m_eConnectedStatus != k_EClientNotConnected && m_pGameEngine->GetGameTickCount() - m_ulLastNetworkDataReceivedTime > MILLISECONDS_CONNECTION_TIMEOUT ) { SetConnectionFailureText( "Game server connection failure." ); @@ -1887,6 +1919,35 @@ void CSpaceWarClient::RunFrame() } +//----------------------------------------------------------------------------- +// Purpose: Draws the timer, if -timer was present on the command line +//----------------------------------------------------------------------------- +void CSpaceWarClient::RenderTimer() +{ + if ( !m_bShowTimer ) + return; + + static const uint32 k_unTimerFontHeight = 48; + if ( !m_hTimerFont ) + { + m_hTimerFont = m_pGameEngine->HCreateFont( k_unTimerFontHeight, FW_BOLD, false, "Arial" ); + if ( !m_hTimerFont ) + OutputDebugString( "Timer font was not created properly, text won't draw\n" ); + } + uint32 unSecondsSinceLaunch = ( Plat_GetTicks() - m_unTicksAtLaunch ) / 1000; + char buf[ 128 ]; + sprintf_safe( buf, "%u:%02u", unSecondsSinceLaunch / 60, unSecondsSinceLaunch % 60 ); + + DWORD dwColor = D3DCOLOR_ARGB( 255, 255, 200, 200 ); + RECT rectHeader; + rectHeader.top = 5; + rectHeader.bottom = rectHeader.top + k_unTimerFontHeight; + rectHeader.left = 0; + rectHeader.right = m_pGameEngine->GetViewportWidth() - 5; + m_pGameEngine->BDrawString( m_hTimerFont, rectHeader, dwColor, TEXTPOS_RIGHT | TEXTPOS_TOP, buf ); +} + + //----------------------------------------------------------------------------- // Purpose: Draws some HUD text indicating game status //----------------------------------------------------------------------------- @@ -2349,7 +2410,7 @@ void CSpaceWarClient::OnRequestEncryptedAppTicket( EncryptedAppTicketResponse_t if ( pEncryptedAppTicketResponse->m_eResult == k_EResultOK ) { - uint8 rgubTicket[1024]; + uint8 rgubTicket[4096]; uint32 cubTicket; SteamUser()->GetEncryptedAppTicket( rgubTicket, sizeof( rgubTicket), &cubTicket ); @@ -2361,7 +2422,7 @@ void CSpaceWarClient::OnRequestEncryptedAppTicket( EncryptedAppTicketResponse_t // included is the "secret" key for spacewar. normally this is secret const uint8 rgubKey[k_nSteamEncryptedAppTicketSymmetricKeyLen] = { 0xed, 0x93, 0x86, 0x07, 0x36, 0x47, 0xce, 0xa5, 0x8b, 0x77, 0x21, 0x49, 0x0d, 0x59, 0xed, 0x44, 0x57, 0x23, 0xf0, 0xf6, 0x6e, 0x74, 0x14, 0xe1, 0x53, 0x3b, 0xa3, 0x3c, 0xd8, 0x03, 0xbd, 0xbd }; - uint8 rgubDecrypted[1024]; + uint8 rgubDecrypted[4096]; uint32 cubDecrypted = sizeof( rgubDecrypted ); if ( !SteamEncryptedAppTicket_BDecryptTicket( rgubTicket, cubTicket, rgubDecrypted, &cubDecrypted, rgubKey, sizeof( rgubKey ) ) ) { diff --git a/SteamworksExample/SpaceWarClient.h b/SteamworksExample/SpaceWarClient.h index 6e64af5..d2aea6b 100644 --- a/SteamworksExample/SpaceWarClient.h +++ b/SteamworksExample/SpaceWarClient.h @@ -39,6 +39,7 @@ class CHTMLSurface; class CRemotePlayList; class CItemStore; class COverlayExamples; +class CTimeline; // Height of the HUD font #define HUD_FONT_HEIGHT 18 @@ -140,6 +141,7 @@ struct OverlayExample_t k_EOverlayExampleItem_ActivateGameOverlay, k_EOverlayExampleItem_ActivateGameOverlayToUser, k_EOverlayExampleItem_ActivateGameOverlayToWebPage, + k_EOverlayExampleItem_ActivateGameOverlayToWebPageModal, k_EOverlayExampleItem_ActivateGameOverlayToStore, // k_EOverlayExampleItem_ActivateGameOverlayRemotePlayTogetherInviteDialog, k_EOverlayExampleItem_ActivateGameOverlayInviteDialogConnectString, @@ -169,6 +171,8 @@ public: // Run a game frame void RunFrame(); + void RenderTimer(); + // Service calls that need to happen less frequently than every frame (e.g. every second) void RunOccasionally(); @@ -250,6 +254,7 @@ public: void ExecCommandLineConnect( const char *pchServerAddress, const char *pchLobbyID ); + void SetShowTimer( bool bShowTimer ) { m_bShowTimer = bShowTimer; } private: // Receive a response from the server for a connection attempt @@ -374,6 +379,11 @@ private: // keep track of if we opened the overlay for a gamewebcallback bool m_bSentWebOpen; + // true if we want to show an on-screen timer in our main menu + bool m_bShowTimer; + uint32 m_unTicksAtLaunch; + HGAMEFONT m_hTimerFont; + // simple class to marshal callbacks from pinging a game server class CGameServerPing : public ISteamMatchmakingPingResponse { @@ -448,6 +458,7 @@ private: std::map m_MapSteamImagesToTextures; CStatsAndAchievements *m_pStatsAndAchievements; + CTimeline *m_pTimeline; CLeaderboards *m_pLeaderboards; CFriendsList *m_pFriendsList; diff --git a/SteamworksExample/SpaceWarServer.cpp b/SteamworksExample/SpaceWarServer.cpp index 99784f8..cf3dbc7 100644 --- a/SteamworksExample/SpaceWarServer.cpp +++ b/SteamworksExample/SpaceWarServer.cpp @@ -37,9 +37,12 @@ CSpaceWarServer::CSpaceWarServer( IGameEngine *pGameEngine ) // !FIXME! We need a way to pass the dedicated server flag here! - if ( !SteamGameServer_Init( unIP, SPACEWAR_SERVER_PORT, usMasterServerUpdaterPort, eMode, SPACEWAR_SERVER_VERSION ) ) + SteamErrMsg errMsg = { 0 }; + if ( SteamGameServer_InitEx( unIP, SPACEWAR_SERVER_PORT, usMasterServerUpdaterPort, eMode, SPACEWAR_SERVER_VERSION, &errMsg ) != k_ESteamAPIInitResult_OK ) { - OutputDebugString( "SteamGameServer_Init call failed\n" ); + OutputDebugString( "SteamGameServer_Init call failed: " ); + OutputDebugString( errMsg ); + OutputDebugString( "\n" ); } if ( SteamGameServer() ) diff --git a/SteamworksExample/SteamworksExample.sh b/SteamworksExample/SteamworksExample.sh index a10de13..86f8bac 100644 --- a/SteamworksExample/SteamworksExample.sh +++ b/SteamworksExample/SteamworksExample.sh @@ -7,14 +7,26 @@ TOP=$(cd "${0%/*}" && echo ${PWD}) PROGRAM="${TOP}/SteamworksExampleLinux" -# Steam sets this environment variable when launching games -if [ "$STEAM_RUNTIME" = "" ]; then - export STEAM_RUNTIME="${TOP}/../../tools/linux/runtime/i386" - export LD_LIBRARY_PATH="${STEAM_RUNTIME}/lib/i386-linux-gnu:${STEAM_RUNTIME}/lib:${STEAM_RUNTIME}/usr/lib/i386-linux-gnu:${STEAM_RUNTIME}/usr/lib:${LD_LIBRARY_PATH}" +log () { + ( echo "[$$]: $*" >&2 ) || : +} + +# Require LDLP scout runtime environment +if [ -n "${STEAM_RUNTIME-}" ]; then + log "Detected scout LDLP runtime." + # continue +else + log "Relaunch under scout LDLP runtime." + log exec "$HOME/.steam/bin/steam-runtime/run.sh" "$0" "$@" + exec "$HOME/.steam/bin/steam-runtime/run.sh" "$0" "$@" + # unreachable fi -# Add the current directory to the library path to pick up libsteam_api.so -export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:." +# The public SDK binary links with -Wl,--rpath=$ORIGIN and doesn't need this, +# But the binary produced in-tree at Valve does +export LD_LIBRARY_PATH=${TOP}:${LD_LIBRARY_PATH-} + +cd "${TOP}" exec "${PROGRAM}" "$@" diff --git a/SteamworksExample/SteamworksExample.sln b/SteamworksExample/SteamworksExample.sln index 55f8457..d64c8ee 100644 --- a/SteamworksExample/SteamworksExample.sln +++ b/SteamworksExample/SteamworksExample.sln @@ -1,31 +1,31 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.31911.196 +VisualStudioVersion = 16.0.34931.43 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "steamworksexample", "SteamworksExample.vcxproj", "{FC177B29-2631-C58B-D723-530DA88155B4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 + Debug|x86 = Debug|x86 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FC177B29-2631-C58B-D723-530DA88155B4}.Debug|Win32.ActiveCfg = Debug|Win32 - {FC177B29-2631-C58B-D723-530DA88155B4}.Debug|Win32.Build.0 = Debug|Win32 {FC177B29-2631-C58B-D723-530DA88155B4}.Debug|x64.ActiveCfg = Debug|x64 {FC177B29-2631-C58B-D723-530DA88155B4}.Debug|x64.Build.0 = Debug|x64 - {FC177B29-2631-C58B-D723-530DA88155B4}.Release|Win32.ActiveCfg = Release|Win32 - {FC177B29-2631-C58B-D723-530DA88155B4}.Release|Win32.Build.0 = Release|Win32 + {FC177B29-2631-C58B-D723-530DA88155B4}.Debug|x86.ActiveCfg = Debug|Win32 + {FC177B29-2631-C58B-D723-530DA88155B4}.Debug|x86.Build.0 = Debug|Win32 {FC177B29-2631-C58B-D723-530DA88155B4}.Release|x64.ActiveCfg = Release|x64 {FC177B29-2631-C58B-D723-530DA88155B4}.Release|x64.Build.0 = Release|x64 + {FC177B29-2631-C58B-D723-530DA88155B4}.Release|x86.ActiveCfg = Release|Win32 + {FC177B29-2631-C58B-D723-530DA88155B4}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {369E9D43-1FBD-44D1-985F-BE511071CD7A} + SolutionGuid = {D30502FB-58C1-4ADF-A153-A9F564A0910A} EndGlobalSection EndGlobal diff --git a/SteamworksExample/SteamworksExample.vcxproj b/SteamworksExample/SteamworksExample.vcxproj index 746feea..f3ead37 100644 --- a/SteamworksExample/SteamworksExample.vcxproj +++ b/SteamworksExample/SteamworksExample.vcxproj @@ -5,10 +5,18 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + 16.0 @@ -24,6 +32,13 @@ v142 3.15.3 + + Application + MultiByte + steamworksexample + v142 + 3.15.3 + Application MultiByte @@ -31,15 +46,28 @@ v142 3.15.3 + + Application + MultiByte + steamworksexample + v142 + 3.15.3 + + + + + + + <_ProjectFileVersion>10.0.30319.1 @@ -47,21 +75,41 @@ .\Debug\ .\Debug\ ..\devtools\vstools;$(ExecutablePath);$(Path) + ..\devtools\vstools;$(ExecutablePath);$(Path) true + true true + true true + true true + true true + true true + true .\Release\ .\Release\ ..\devtools\vstools;$(ExecutablePath);$(Path) + ..\devtools\vstools;$(ExecutablePath);$(Path) true + true true + true true + true false + false true + true true + true + + + $(SolutionDir)win64\$(Configuration)\ + + + $(SolutionDir)win64\$(Configuration)\ @@ -116,7 +164,8 @@ false $(OutDir)\$(TargetName).map Windows - + + MachineX86 PromptImmediately false @@ -144,6 +193,85 @@ true + + + + + /std:c++17 /bigobj /Zc:__cplusplus + Disabled + OnlyExplicitInline + $(DXSDK_DIR)Include;..\public; + WIN32;_CRT_SECURE_NO_WARNINGS;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);_DEBUG;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=VALVE;PROJECTDIR=D:\dev\Steam\main\src\SteamWorksExample;_DLL_EXT=.dll;VPCGAME=valve + true + false + Async + Default + MultiThreadedDebug + true + true + + + Precise + false + true + true + false + $(IntDir)\ + $(IntDir)\ + $(IntDir)\ + false + false + Level3 + true + OldStyle + CompileAsCpp + ;4577;4091 + true + $(IntDir)\ + Prompt + + + + /ignore:4221 + ;legacy_stdio_definitions.lib;%(AdditionalDependencies) + NotSet + $(OutDir)\steamworksexample.exe + true + ;$(DXSDK_DIR)Lib\x64; + libc;libcd;libcmt + DebugFastLink + $(OutDir)\$(TargetName).pdb + false + $(OutDir)\$(TargetName).map + Windows + + + PromptImmediately + false + + + + + true + $(OutDir)\steamworksexample.bsc + + + + Default + . + + + _DEBUG;%(PreprocessorDefinitions);_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE + 1033 + + + true + SteamWorksExample.exe.manifest + + + true + + @@ -201,7 +329,8 @@ Windows true true - + + MachineX86 PromptImmediately false @@ -229,35 +358,110 @@ true - - - true - - - true - - - true - - - true - - + + + + + /std:c++17 /bigobj /d2Zi+ /Zc:__cplusplus + MaxSpeed + AnySuitable + true + Speed + $(DXSDK_DIR)Include;..\public; + WIN32;_CRT_SECURE_NO_WARNINGS;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions);NDEBUG;_EXTERNAL_DLL_EXT=.dll;VPCGAMECAPS=VALVE;PROJECTDIR=D:\dev\Steam\main\src\SteamWorksExample;_DLL_EXT=.dll;VPCGAME=valve + true + Async + MultiThreaded + false + true + + + Precise + false + true + true + false + NotUsing + $(IntDir)\ + $(IntDir)\ + $(IntDir)\ + false + false + Level3 + true + OldStyle + CompileAsCpp + ;4577;4091 + false + true + $(IntDir)\ + Prompt + + + + /ignore:4221 + ;legacy_stdio_definitions.lib;%(AdditionalDependencies) + NotSet + $(OutDir)\steamworksexample.exe + true + ;$(DXSDK_DIR)Lib\x64; + libc;libcd;libcmtd + true + $(OutDir)\$(TargetName).pdb + false + $(OutDir)\$(TargetName).map + Windows + true + true + + + PromptImmediately + false + + + + + true + $(OutDir)\steamworksexample.bsc + + + + Default + . + + + NDEBUG;%(PreprocessorDefinitions);_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE + 1033 + + + true + SteamWorksExample.exe.manifest + + + true + + true + true true + true true + true true + true true + true true + true @@ -272,7 +476,9 @@ true + true true + true @@ -294,6 +500,7 @@ + @@ -301,57 +508,81 @@ true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true true + true @@ -361,7 +592,9 @@ true + true true + true @@ -380,44 +613,49 @@ + - - Running VPC CRC Check - steamworksexample.vpc - rem IncrediBuild_AllowOverlap if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "steamworksexample.vcxproj" if ERRORLEVEL 1 exit /b 1 echo crc_complete > D:\dev\Steam\main\src\SteamWorksExample\steamworksexample.vpc.sentinel - D:\dev\Steam\main\src\SteamWorksExample\steamworksexample.vpc.sentinel - Running VPC CRC Check - steamworksexample.vpc - rem IncrediBuild_AllowOverlap if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "steamworksexample.vcxproj" if ERRORLEVEL 1 exit /b 1 echo crc_complete > D:\dev\Steam\main\src\SteamWorksExample\steamworksexample.vpc.sentinel - D:\dev\Steam\main\src\SteamWorksExample\steamworksexample.vpc.sentinel - - - + + true + true + + + true + true + + + true + true + + + true + true + true + true true + true true + true true + true true + true true + true - - - - - - - - diff --git a/SteamworksExample/SteamworksExample.vcxproj.filters b/SteamworksExample/SteamworksExample.vcxproj.filters index 86278f2..6575fdf 100644 --- a/SteamworksExample/SteamworksExample.vcxproj.filters +++ b/SteamworksExample/SteamworksExample.vcxproj.filters @@ -25,21 +25,24 @@ {84F38993-4EB4-8F80-2E2C-37AA0D9C662A} - - {A40EE377-781A-C6B9-0C7C-B3BE118D248E} - Link Libraries + + Link Libraries + + + Link Libraries + Link Libraries - + Link Libraries - + Link Libraries @@ -158,6 +161,9 @@ Header Files\Game + + Header Files\Game + Header Files\Game @@ -295,6 +301,9 @@ Source Files\Game + + Source Files\Game + Source Files\Game @@ -304,11 +313,6 @@ Resource Files - - - VPC Scripts - - @@ -321,29 +325,5 @@ Source Files\Game - - VPC Scripts - - - VPC Scripts - - - VPC Scripts - - - VPC Scripts - - - VPC Scripts - - - VPC Scripts - - - VPC Scripts - - - VPC Scripts - diff --git a/SteamworksExample/timeline.cpp b/SteamworksExample/timeline.cpp new file mode 100644 index 0000000..e44576a --- /dev/null +++ b/SteamworksExample/timeline.cpp @@ -0,0 +1,121 @@ +//====== Copyright © 1996-2023 Valve Corporation, All rights reserved. ======= +// +// Purpose: Class for adding to the Game Recording Timeline for different game states +// +//============================================================================= + +#include "stdafx.h" +#include "timeline.h" +#include "SpaceWarClient.h" + +extern uint32 Plat_GetTicks(); + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +CTimeline::CTimeline( IGameEngine *pGameEngine ) : + m_pGameEngine( pGameEngine ), + m_GameID( SteamUtils()->GetAppID() ), + m_bInGame( false ) +{ + SteamTimeline()->SetTimelineGameMode( k_ETimelineGameMode_Menus ); + m_ulSessionCounter = 0; + m_ulInGameStartTime = 0; + m_unLastTimestampIndexDisplayed = 0; +} + + +//----------------------------------------------------------------------------- +// Purpose: Game state has changed +//----------------------------------------------------------------------------- +void CTimeline::OnGameStateChange( EClientGameState eNewState ) +{ + bool bInGameNow = false; + switch ( eNewState ) + { + case k_EClientGameWaitingForPlayers: + case k_EClientGameActive: + case k_EClientGameQuitMenu: + case k_EClientGameDraw: + case k_EClientGameWinner: + bInGameNow = true; + break; + + case k_EClientStatsAchievements: + case k_EClientGameStartServer: + case k_EClientGameMenu: + case k_EClientGameExiting: + case k_EClientGameInstructions: + case k_EClientGameConnecting: + case k_EClientGameConnectionFailure: + case k_EClientFindInternetServers: + default: + break; + } + + // change the timeline bar from gray to blue and add a timeline range covering the game session + if ( m_bInGame != bInGameNow ) + { + if ( bInGameNow ) + { + SteamTimeline()->SetTimelineGameMode( k_ETimelineGameMode_Playing ); + + m_unSessionStart = Plat_GetTicks(); + + // start timers for adding timeline timestamps + m_ulInGameStartTime = m_pGameEngine->GetGameTickCount(); + m_unLastTimestampIndexDisplayed = 0; + } + else + { + SteamTimeline()->SetTimelineGameMode( k_ETimelineGameMode_Menus ); + + uint32 unSessionEnd = Plat_GetTicks(); + uint32 unSessionDuration = unSessionEnd - m_unSessionStart; + + float flDurationSeconds = (float)unSessionDuration / 1000.f; + float flStartOffsetSeconds = -flDurationSeconds; + + SteamTimeline()->AddTimelineEvent( "steam_starburst", "In Match", nullptr, 100, flStartOffsetSeconds, flDurationSeconds, k_ETimelineEventClipPriority_None ); + } + + m_bInGame = bInGameNow; + } + + // add a highlight marker every time the player wins + if ( eNewState == k_EClientGameWinner && SpaceWarClient()->BLocalPlayerWonLastGame() ) + { + SteamTimeline()->AddTimelineEvent( "steam_attack", "Winner!", "You won a round!", 10, 0, 0, k_ETimelineEventClipPriority_Standard ); + } + else if ( eNewState == k_EClientGameDraw ) + { + SteamTimeline()->AddTimelineEvent( "steam_defend", "Draw", "This round was a draw.", 5, 0, 0, k_ETimelineEventClipPriority_None ); + } +} + +//----------------------------------------------------------------------------- +// Purpose: Run a frame. Does not need to run at full frame rate. +//----------------------------------------------------------------------------- +void CTimeline::RunFrame() +{ + if ( m_bInGame ) + { + // every 5 minutes, add a new timeline timestamp in the form of "05:00", "10:00", etc. + // Note: we use 5 minutes here for demo purposes, but if appropriate for your game, you + // might want to choose a larger interval to keep the Timeline less cluttered for users + const uint32 k_unMinutesBetweenTimestamps = 5; + const uint64 k_unMaxTimeToDisplayIndex = 95 / k_unMinutesBetweenTimestamps; + + uint64 ulSinceStartMS = m_pGameEngine->GetGameTickCount() - m_ulInGameStartTime; + uint32 unTimestampIndex = (int)( ulSinceStartMS / (k_unMinutesBetweenTimestamps * 60 * 1000) ); + if ( unTimestampIndex > 0 && unTimestampIndex > m_unLastTimestampIndexDisplayed && unTimestampIndex <= k_unMaxTimeToDisplayIndex ) + { + // max string length is "95:00" + char rgchBuffer[ 6 ]; + sprintf_safe( rgchBuffer, "%02d:00", unTimestampIndex * k_unMinutesBetweenTimestamps ); + SteamTimeline()->SetTimelineStateDescription( rgchBuffer, 0 ); + + m_unLastTimestampIndexDisplayed = unTimestampIndex; + } + } +} diff --git a/SteamworksExample/timeline.h b/SteamworksExample/timeline.h new file mode 100644 index 0000000..9197b77 --- /dev/null +++ b/SteamworksExample/timeline.h @@ -0,0 +1,33 @@ +//====== Copyright © 1996-2023 Valve Corporation, All rights reserved. ======= +// +// Purpose: Class for adding to the Game Recording Timeline for different game states +// +//============================================================================= + +#ifndef TIMELINE_H +#define TIMELINE_H + +#include "SpaceWar.h" +#include "GameEngine.h" + + +class CTimeline +{ +public: + CTimeline( IGameEngine *pGameEngine ); + + void RunFrame(); + void OnGameStateChange( EClientGameState eNewState ); + +private: + CGameID m_GameID; + IGameEngine *m_pGameEngine; + + bool m_bInGame; + uint64 m_ulInGameStartTime; + uint32 m_unLastTimestampIndexDisplayed; + uint64 m_ulSessionCounter; + uint32 m_unSessionStart; +}; + +#endif // TIMELINE_H diff --git a/glmgr/dx9asmtogl2.cpp b/glmgr/dx9asmtogl2.cpp index 98119f5..9c5f634 100644 --- a/glmgr/dx9asmtogl2.cpp +++ b/glmgr/dx9asmtogl2.cpp @@ -1340,6 +1340,8 @@ void D3DToGL::PrintParameterToString ( uint32 dwToken, uint32 dwSourceOrDest, ch // Optionally put on the x, y, z or w int nMasksWritten = 0; + (void)nMasksWritten; + if ( dwToken & D3DSP_WRITEMASK_0 ) { strcat_s( pRegisterName, nBufLen, "x" ); @@ -2645,6 +2647,7 @@ void D3DToGL::InsertMoveInstruction( CUtlBuffer *pCode, int nARLComponent ) void D3DToGL::InsertMoveFromAddressRegister( CUtlBuffer *pCode, int nARLComp0, int nARLComp1, int nARLComp2 /* = ARL_DEST_NONE */ ) { int nNumSwizzles = 0; + (void)nNumSwizzles; if ( nARLComp0 != ARL_DEST_NONE ) nNumSwizzles++; diff --git a/glmgr/dxabstract.cpp b/glmgr/dxabstract.cpp index 19b38d7..df45d64 100644 --- a/glmgr/dxabstract.cpp +++ b/glmgr/dxabstract.cpp @@ -3473,7 +3473,8 @@ HRESULT IDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVert // each one is a cursor that gets bumped by decls. uint streamOffsets[ D3D_MAX_STREAMS ]; uint streamCount = 0; - + (void)streamCount; + uint attribMap[16]; uint attribMapIndex = 0; memset( attribMap, 0xFF, sizeof( attribMap ) ); diff --git a/glmgr/glmgr.cpp b/glmgr/glmgr.cpp index 579d7e9..a059486 100644 --- a/glmgr/glmgr.cpp +++ b/glmgr/glmgr.cpp @@ -3381,6 +3381,9 @@ void GLMContext::FlushDrawStates( bool shadersOn ) // shadersOn = true for draw case eAttribWriteDirty: static uint hits=0,misses=0; + (void)hits; + (void)misses; + // first see if we have to do anything at all. // the equality operator checks buffer name, offset, stride, datatype and normalized. // we check buffer revision separately, submitter of vertex setup is not expected to provide it (zero is preferred). diff --git a/public/steam/isteamapps.h b/public/steam/isteamapps.h index 8a2197e..c47b183 100644 --- a/public/steam/isteamapps.h +++ b/public/steam/isteamapps.h @@ -84,7 +84,7 @@ public: // return the buildid of this app, may change at any time based on backend updates to the game virtual int GetAppBuildId() = 0; - // Request all proof of purchase keys for the calling appid and asociated DLC. + // Request all proof of purchase keys for the calling appid and associated DLC. // A series of AppProofOfPurchaseKeyResponse_t callbacks will be sent with // appropriate appid values, ending with a final callback where the m_nAppId // member is k_uAppIdInvalid (zero). @@ -110,7 +110,16 @@ public: virtual bool BIsTimedTrial( uint32* punSecondsAllowed, uint32* punSecondsPlayed ) = 0; // set current DLC AppID being played (or 0 if none). Allows Steam to track usage of major DLC extensions - virtual bool SetDlcContext( AppId_t nAppID ) = 0; + virtual bool SetDlcContext( AppId_t nAppID ) = 0; + + // returns total number of known app beta branches (including default "public" branch ) + virtual int GetNumBetas( int *pnAvailable, int *pnPrivate ) = 0; // + + // return beta branch details, name, description, current BuildID and state flags (EBetaBranchFlags) + virtual bool GetBetaInfo( int iBetaIndex, uint32 *punFlags, uint32 *punBuildID, char *pchBetaName, int cchBetaName, char *pchDescription, int cchDescription ) = 0; // iterate through + + // select this beta branch for this app as active, might need the game to restart so Steam can update to that branch + virtual bool SetActiveBeta( const char *pchBetaName ) = 0; }; #define STEAMAPPS_INTERFACE_VERSION "STEAMAPPS_INTERFACE_VERSION008" diff --git a/public/steam/isteamparentalsettings.h b/public/steam/isteamparentalsettings.h index bf3d0c6..972e355 100644 --- a/public/steam/isteamparentalsettings.h +++ b/public/steam/isteamparentalsettings.h @@ -30,6 +30,7 @@ enum EParentalFeature k_EFeatureTest = 12, k_EFeatureSiteLicense = 13, k_EFeatureKioskMode_Deprecated = 14, + k_EFeatureBlockAlways = 15, k_EFeatureMax }; diff --git a/public/steam/isteamtimeline.h b/public/steam/isteamtimeline.h new file mode 100644 index 0000000..800c6bd --- /dev/null +++ b/public/steam/isteamtimeline.h @@ -0,0 +1,118 @@ +//====== Copyright © Valve Corporation, All rights reserved. ======= +// +// Purpose: interface to Steam Timeline +// +//============================================================================= + +#ifndef ISTEAMTIMELINE_H +#define ISTEAMTIMELINE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "steam_api_common.h" + +// callbacks +#if defined( VALVE_CALLBACK_PACK_SMALL ) +#pragma pack( push, 4 ) +#elif defined( VALVE_CALLBACK_PACK_LARGE ) +#pragma pack( push, 8 ) +#else +#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx +#endif + +// Controls the color of the timeline bar segments. The value names listed here map to a multiplayer game, where +// the user starts a game (in menus), then joins a multiplayer session that first has a character selection lobby +// then finally the multiplayer session starts. However, you can also map these values to any type of game. In a single +// player game where you visit towns & dungeons, you could set k_ETimelineGameMode_Menus when the player is in a town +// buying items, k_ETimelineGameMode_Staging for when a dungeon is loading and k_ETimelineGameMode_Playing for when +// inside the dungeon fighting monsters. +enum ETimelineGameMode +{ + k_ETimelineGameMode_Invalid = 0, + k_ETimelineGameMode_Playing = 1, + k_ETimelineGameMode_Staging = 2, + k_ETimelineGameMode_Menus = 3, + k_ETimelineGameMode_LoadingScreen = 4, + + k_ETimelineGameMode_Max, // one past the last valid value +}; + +// Used in AddTimelineEvent, where Featured events will be offered before Standard events +enum ETimelineEventClipPriority +{ + k_ETimelineEventClipPriority_Invalid = 0, + k_ETimelineEventClipPriority_None = 1, + k_ETimelineEventClipPriority_Standard = 2, + k_ETimelineEventClipPriority_Featured = 3, +}; + +const uint32 k_unMaxTimelinePriority = 1000; +const float k_flMaxTimelineEventDuration = 600.f; + +//----------------------------------------------------------------------------- +// Purpose: Steam Timeline API +//----------------------------------------------------------------------------- +class ISteamTimeline +{ +public: + + // Sets a description for the current game state in the timeline. These help the user to find specific + // moments in the timeline when saving clips. Setting a new state description replaces any previous + // description. + // + // Examples could include: + // * Where the user is in the world in a single player game + // * Which round is happening in a multiplayer game + // * The current score for a sports game + // + // Parameters: + // - pchDescription: provide a localized string in the language returned by SteamUtils()->GetSteamUILanguage() + // - flTimeDelta: The time offset in seconds to apply to this event. Negative times indicate an + // event that happened in the past. + virtual void SetTimelineStateDescription( const char *pchDescription, float flTimeDelta ) = 0; + virtual void ClearTimelineStateDescription( float flTimeDelta ) = 0; + + // Use this to mark an event on the Timeline. The event can be instantaneous or take some amount of time + // to complete, depending on the value passed in flDurationSeconds + // + // Examples could include: + // * a boss battle + // * a cut scene + // * a large team fight + // * picking up a new weapon or ammunition + // * scoring a goal + // + // Parameters: + // + // - pchIcon: specify the name of the icon uploaded through the Steamworks Partner Site for your title + // or one of the provided icons that start with steam_ + // - pchTitle & pchDescription: provide a localized string in the language returned by + // SteamUtils()->GetSteamUILanguage() + // - unPriority: specify how important this range is compared to other markers provided by the game. + // Ranges with larger priority values will be displayed more prominently in the UI. This value + // may be between 0 and k_unMaxTimelinePriority. + // - flStartOffsetSeconds: The time that this range started relative to now. Negative times + // indicate an event that happened in the past. + // - flDurationSeconds: How long the time range should be in seconds. For instantaneous events, this + // should be 0 + // - ePossibleClip: By setting this parameter to Featured or Standard, the game indicates to Steam that it + // would be appropriate to offer this range as a clip to the user. For instantaneous events, the + // suggested clip will be for a short time before and after the event itself. + virtual void AddTimelineEvent( const char *pchIcon, const char *pchTitle, const char *pchDescription, uint32 unPriority, float flStartOffsetSeconds, float flDurationSeconds, ETimelineEventClipPriority ePossibleClip ) = 0; + + // Changes the color of the timeline bar. See ETimelineGameMode comments for how to use each value + virtual void SetTimelineGameMode( ETimelineGameMode eMode ) = 0; +}; + +#define STEAMTIMELINE_INTERFACE_VERSION "STEAMTIMELINE_INTERFACE_V001" + +// Global interface accessor +inline ISteamTimeline *SteamTimeline(); +STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamTimeline *, SteamTimeline, STEAMTIMELINE_INTERFACE_VERSION ); + + +#pragma pack( pop ) + + +#endif // ISTEAMTIMELINE_H diff --git a/public/steam/isteamugc.h b/public/steam/isteamugc.h index 96e9b9d..40c5947 100644 --- a/public/steam/isteamugc.h +++ b/public/steam/isteamugc.h @@ -194,7 +194,7 @@ struct SteamUGCDetails_t 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_nFileSize; // Size of the primary file (for legacy items which only support one file). This may not be accurate for non-legacy items which can be greater than 4gb in size. int32 m_nPreviewFileSize; // Size of the preview file char m_rgchURL[k_cchPublishedFileURLMax]; // URL (for a video or a website) // voting information @@ -202,7 +202,8 @@ struct SteamUGCDetails_t uint32 m_unVotesDown; // number of votes down float m_flScore; // calculated score // collection details - uint32 m_unNumChildren; + uint32 m_unNumChildren; + uint64 m_ulTotalFilesSize; // Total size of all files (non-legacy), excluding the preview file }; //----------------------------------------------------------------------------- @@ -248,6 +249,10 @@ public: STEAM_FLAT_NAME( GetQueryFirstUGCKeyValueTag ) virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, const char *pchKey, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0; + // Some items can specify that they have a version that is valid for a range of game versions (Steam branch) + virtual uint32 GetNumSupportedGameVersions( UGCQueryHandle_t handle, uint32 index ) = 0; + virtual bool GetSupportedGameVersionData( UGCQueryHandle_t handle, uint32 index, uint32 versionIndex, STEAM_OUT_STRING_COUNT( cchGameBranchSize ) char *pchGameBranchMin, STEAM_OUT_STRING_COUNT( cchGameBranchSize ) char *pchGameBranchMax, uint32 cchGameBranchSize ) = 0; + virtual uint32 GetQueryUGCContentDescriptors( UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries ) = 0; // Release the request to free up memory, after retrieving results @@ -267,6 +272,7 @@ public: virtual bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) = 0; virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0; virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0; + virtual bool SetAdminQuery( UGCUpdateHandle_t handle, bool bAdminQuery ) = 0; // admin queries return hidden items // Options only for querying user UGC virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0; @@ -308,6 +314,7 @@ public: virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted) virtual bool AddContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) = 0; virtual bool RemoveContentDescriptor( UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ) = 0; + virtual bool SetRequiredGameVersions( UGCUpdateHandle_t handle, const char *pszGameBranchMin, const char *pszGameBranchMax ) = 0; // an empty string for either parameter means that it will match any version on that end of the range. This will only be applied if the actual content has been changed. STEAM_CALL_RESULT( SubmitItemUpdateResult_t ) virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate() @@ -389,7 +396,7 @@ public: virtual uint32 GetUserContentDescriptorPreferences( EUGCContentDescriptorID *pvecDescriptors, uint32 cMaxEntries ) = 0; }; -#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION018" +#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION020" // Global interface accessor inline ISteamUGC *SteamUGC(); @@ -457,6 +464,8 @@ struct ItemInstalled_t enum { k_iCallback = k_iSteamUGCCallbacks + 5 }; AppId_t m_unAppID; PublishedFileId_t m_nPublishedFileId; + UGCHandle_t m_hLegacyContent; + uint64 m_unManifestID; }; diff --git a/public/steam/isteamvideo.h b/public/steam/isteamvideo.h index 4832d7b..cd7b197 100644 --- a/public/steam/isteamvideo.h +++ b/public/steam/isteamvideo.h @@ -21,9 +21,6 @@ #error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx #endif - - - //----------------------------------------------------------------------------- // Purpose: Steam Video API //----------------------------------------------------------------------------- @@ -41,9 +38,11 @@ public: STEAM_CALL_BACK( GetOPFSettingsResult_t ) virtual void GetOPFSettings( AppId_t unVideoAppID ) = 0; virtual bool GetOPFStringForApp( AppId_t unVideoAppID, char *pchBuffer, int32 *pnBufferSize ) = 0; + + }; -#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V002" +#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V007" // Global interface accessor inline ISteamVideo *SteamVideo(); diff --git a/public/steam/lib/linux32/libsdkencryptedappticket.so b/public/steam/lib/linux32/libsdkencryptedappticket.so index c9f8677..cdd7905 100644 Binary files a/public/steam/lib/linux32/libsdkencryptedappticket.so and b/public/steam/lib/linux32/libsdkencryptedappticket.so differ diff --git a/public/steam/lib/linux64/libsdkencryptedappticket.so b/public/steam/lib/linux64/libsdkencryptedappticket.so index 1a5eb7f..5228c96 100644 Binary files a/public/steam/lib/linux64/libsdkencryptedappticket.so and b/public/steam/lib/linux64/libsdkencryptedappticket.so differ diff --git a/public/steam/lib/osx/libsdkencryptedappticket.dylib b/public/steam/lib/osx/libsdkencryptedappticket.dylib index 2b5a8fd..4c356e7 100644 Binary files a/public/steam/lib/osx/libsdkencryptedappticket.dylib and b/public/steam/lib/osx/libsdkencryptedappticket.dylib differ diff --git a/public/steam/lib/win32/sdkencryptedappticket.dll b/public/steam/lib/win32/sdkencryptedappticket.dll index e1b5958..ff63996 100644 Binary files a/public/steam/lib/win32/sdkencryptedappticket.dll and b/public/steam/lib/win32/sdkencryptedappticket.dll differ diff --git a/public/steam/lib/win32/sdkencryptedappticket.lib b/public/steam/lib/win32/sdkencryptedappticket.lib index 9bd4fc5..0c3b4c4 100644 Binary files a/public/steam/lib/win32/sdkencryptedappticket.lib and b/public/steam/lib/win32/sdkencryptedappticket.lib differ diff --git a/public/steam/lib/win64/sdkencryptedappticket64.dll b/public/steam/lib/win64/sdkencryptedappticket64.dll index 483840e..7e8ecbb 100644 Binary files a/public/steam/lib/win64/sdkencryptedappticket64.dll and b/public/steam/lib/win64/sdkencryptedappticket64.dll differ diff --git a/public/steam/lib/win64/sdkencryptedappticket64.lib b/public/steam/lib/win64/sdkencryptedappticket64.lib index 15945f1..146f4cf 100644 Binary files a/public/steam/lib/win64/sdkencryptedappticket64.lib and b/public/steam/lib/win64/sdkencryptedappticket64.lib differ diff --git a/public/steam/steam_api.h b/public/steam/steam_api.h index 55d90e4..71d3a8b 100644 --- a/public/steam/steam_api.h +++ b/public/steam/steam_api.h @@ -38,6 +38,7 @@ #include "isteamugc.h" #include "isteamhtmlsurface.h" #include "isteaminventory.h" +#include "isteamtimeline.h" #include "isteamvideo.h" #include "isteamparentalsettings.h" #include "isteaminput.h" @@ -224,115 +225,6 @@ S_API void S_CALLTYPE SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe hStea /// only call this in a handler for SteamAPICallCompleted_t callback. S_API bool S_CALLTYPE SteamAPI_ManualDispatch_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ); -//----------------------------------------------------------------------------------------------------------------------------------------------------------// -// -// CSteamAPIContext -// -// Deprecated! This is not necessary any more. Please use the global accessors directly -// -//----------------------------------------------------------------------------------------------------------------------------------------------------------// - -#ifndef STEAM_API_EXPORTS - -inline bool CSteamAPIContext::Init() -{ - m_pSteamClient = ::SteamClient(); - if ( !m_pSteamClient ) - return false; - - m_pSteamUser = ::SteamUser(); - if ( !m_pSteamUser ) - return false; - - m_pSteamFriends = ::SteamFriends(); - if ( !m_pSteamFriends ) - return false; - - m_pSteamUtils = ::SteamUtils(); - if ( !m_pSteamUtils ) - return false; - - m_pSteamMatchmaking = ::SteamMatchmaking(); - if ( !m_pSteamMatchmaking ) - return false; - - m_pSteamGameSearch = ::SteamGameSearch(); - if ( !m_pSteamGameSearch ) - return false; - -#if !defined( IOSALL) // Not yet supported on iOS. - m_pSteamMatchmakingServers = ::SteamMatchmakingServers(); - if ( !m_pSteamMatchmakingServers ) - return false; -#endif - - m_pSteamUserStats = ::SteamUserStats(); - if ( !m_pSteamUserStats ) - return false; - - m_pSteamApps = ::SteamApps(); - if ( !m_pSteamApps ) - return false; - - m_pSteamNetworking = ::SteamNetworking(); - if ( !m_pSteamNetworking ) - return false; - - m_pSteamRemoteStorage = ::SteamRemoteStorage(); - if ( !m_pSteamRemoteStorage ) - return false; - - m_pSteamScreenshots = ::SteamScreenshots(); - if ( !m_pSteamScreenshots ) - return false; - - m_pSteamHTTP = ::SteamHTTP(); - if ( !m_pSteamHTTP ) - return false; - - m_pController = ::SteamController(); - if ( !m_pController ) - return false; - - m_pSteamUGC = ::SteamUGC(); - if ( !m_pSteamUGC ) - return false; - - m_pSteamMusic = ::SteamMusic(); - if ( !m_pSteamMusic ) - return false; - - m_pSteamMusicRemote = ::SteamMusicRemote(); - if ( !m_pSteamMusicRemote ) - return false; - -#if !defined( ANDROID ) && !defined( IOSALL) // Not yet supported on Android or ios. - m_pSteamHTMLSurface = ::SteamHTMLSurface(); - if ( !m_pSteamHTMLSurface ) - return false; -#endif - - m_pSteamInventory = ::SteamInventory(); - if ( !m_pSteamInventory ) - return false; - - m_pSteamVideo = ::SteamVideo(); - if ( !m_pSteamVideo ) - return false; - - m_pSteamParentalSettings = ::SteamParentalSettings(); - if ( !m_pSteamParentalSettings ) - return false; - - m_pSteamInput = ::SteamInput(); - if ( !m_pSteamInput ) - return false; - - return true; -} - -#endif - // Internal implementation of SteamAPI_InitEx. This is done in a way that checks // all of the versions of interfaces from headers being compiled into this code. S_API ESteamAPIInitResult S_CALLTYPE SteamInternal_SteamAPI_Init( const char *pszInternalCheckInterfaceVersions, SteamErrMsg *pOutErrMsg ); diff --git a/public/steam/steam_api.json b/public/steam/steam_api.json index 5af49b4..18ae199 100644 --- a/public/steam/steam_api.json +++ b/public/steam/steam_api.json @@ -1265,7 +1265,9 @@ "callback_id": 3405, "fields": [ { "fieldname":"m_unAppID", "fieldtype":"AppId_t" }, - { "fieldname":"m_nPublishedFileId", "fieldtype":"PublishedFileId_t" } + { "fieldname":"m_nPublishedFileId", "fieldtype":"PublishedFileId_t" }, + { "fieldname":"m_hLegacyContent", "fieldtype":"UGCHandle_t" }, + { "fieldname":"m_unManifestID", "fieldtype":"uint64" } ], "struct": "ItemInstalled_t" }, @@ -1930,7 +1932,8 @@ { "constname":"k_SteamItemInstanceIDInvalid", "consttype":"SteamItemInstanceID_t", "constval":"( SteamItemInstanceID_t ) ~ 0" }, { "constname":"k_SteamInventoryResultInvalid", "consttype":"SteamInventoryResult_t", "constval":"- 1" }, { "constname":"k_SteamInventoryUpdateHandleInvalid", "consttype":"SteamInventoryUpdateHandle_t", "constval":"0xffffffffffffffffull" }, - { "constname":"k_nMaxTimelineRangeIDLength", "consttype":"int", "constval":"64" }, + { "constname":"k_unMaxTimelinePriority", "consttype":"uint32", "constval":"1000" }, + { "constname":"k_flMaxTimelineEventDuration", "consttype":"float", "constval":"600.f" }, { "constname":"k_HSteamNetConnection_Invalid", "consttype":"HSteamNetConnection", "constval":"0" }, { "constname":"k_HSteamListenSocket_Invalid", "consttype":"HSteamListenSocket", "constval":"0" }, { "constname":"k_HSteamNetPollGroup_Invalid", "consttype":"HSteamNetPollGroup", "constval":"0" }, @@ -2350,6 +2353,17 @@ { "name":"k_EDurationControlOnlineState_OnlineHighPri", "value":"3" } ] }, + { + "enumname": "EBetaBranchFlags", + "values": [ + { "name":"k_EBetaBranch_None", "value":"0" }, + { "name":"k_EBetaBranch_Default", "value":"1" }, + { "name":"k_EBetaBranch_Available", "value":"2" }, + { "name":"k_EBetaBranch_Private", "value":"4" }, + { "name":"k_EBetaBranch_Selected", "value":"8" }, + { "name":"k_EBetaBranch_Installed", "value":"16" } + ] + }, { "enumname": "EGameSearchErrorCode_t", "values": [ @@ -4006,6 +4020,15 @@ { "name":"k_ETimelineGameMode_Max", "value":"5" } ] }, + { + "enumname": "ETimelineEventClipPriority", + "values": [ + { "name":"k_ETimelineEventClipPriority_Invalid", "value":"0" }, + { "name":"k_ETimelineEventClipPriority_None", "value":"1" }, + { "name":"k_ETimelineEventClipPriority_Standard", "value":"2" }, + { "name":"k_ETimelineEventClipPriority_Featured", "value":"3" } + ] + }, { "enumname": "EParentalFeature", "values": [ @@ -4024,7 +4047,8 @@ { "name":"k_EFeatureTest", "value":"12" }, { "name":"k_EFeatureSiteLicense", "value":"13" }, { "name":"k_EFeatureKioskMode_Deprecated", "value":"14" }, - { "name":"k_EFeatureMax", "value":"15" } + { "name":"k_EFeatureBlockAlways", "value":"15" }, + { "name":"k_EFeatureMax", "value":"16" } ] }, { @@ -4168,6 +4192,7 @@ { "name":"k_ESteamNetworkingConfig_SendRateMax", "value":"11" }, { "name":"k_ESteamNetworkingConfig_NagleTime", "value":"12" }, { "name":"k_ESteamNetworkingConfig_IP_AllowWithoutAuth", "value":"23" }, + { "name":"k_ESteamNetworkingConfig_IPLocalHost_AllowWithoutAuth", "value":"52" }, { "name":"k_ESteamNetworkingConfig_MTU_PacketSize", "value":"32" }, { "name":"k_ESteamNetworkingConfig_MTU_DataSize", "value":"33" }, { "name":"k_ESteamNetworkingConfig_Unencrypted", "value":"34" }, @@ -4554,6 +4579,16 @@ ], "returntype": "ISteamInventory *" }, + { + "methodname": "GetISteamVideo", + "methodname_flat": "SteamAPI_ISteamClient_GetISteamVideo", + "params": [ + { "paramname":"hSteamuser", "paramtype":"HSteamUser" }, + { "paramname":"hSteamPipe", "paramtype":"HSteamPipe" }, + { "paramname":"pchVersion", "paramtype":"const char *" } + ], + "returntype": "ISteamVideo *" + }, { "methodname": "GetISteamParentalSettings", "methodname_flat": "SteamAPI_ISteamClient_GetISteamParentalSettings", @@ -8095,6 +8130,40 @@ { "paramname":"nAppID", "paramtype":"AppId_t" } ], "returntype": "bool" + }, + { + "methodname": "GetNumBetas", + "methodname_flat": "SteamAPI_ISteamApps_GetNumBetas", + "params": [ + { "paramname":"unAppID", "paramtype":"AppId_t" }, + { "paramname":"pnAvailable", "paramtype":"int *" }, + { "paramname":"pnPrivate", "paramtype":"int *" } + ], + "returntype": "int" + }, + { + "methodname": "GetBetaInfo", + "methodname_flat": "SteamAPI_ISteamApps_GetBetaInfo", + "params": [ + { "paramname":"unAppID", "paramtype":"AppId_t" }, + { "paramname":"iBetaIndex", "paramtype":"int" }, + { "paramname":"punFlags", "paramtype":"uint32 *" }, + { "paramname":"punBuildID", "paramtype":"uint32 *" }, + { "paramname":"pchBetaName", "paramtype":"char *" }, + { "paramname":"cchBetaName", "paramtype":"int" }, + { "paramname":"pchDescription", "paramtype":"char *" }, + { "paramname":"cchDescription", "paramtype":"int" } + ], + "returntype": "bool" + }, + { + "methodname": "SetActiveBeta", + "methodname_flat": "SteamAPI_ISteamApps_SetActiveBeta", + "params": [ + { "paramname":"unAppID", "paramtype":"AppId_t" }, + { "paramname":"pchBetaName", "paramtype":"const char *" } + ], + "returntype": "bool" } ], "version_string": "STEAMAPPS_INTERFACE_VERSION008" @@ -9795,12 +9864,12 @@ { "kind": "user", "name": "SteamUGC", - "name_flat": "SteamAPI_SteamUGC_v018" + "name_flat": "SteamAPI_SteamUGC_v020" }, { "kind": "gameserver", "name": "SteamGameServerUGC", - "name_flat": "SteamAPI_SteamGameServerUGC_v018" + "name_flat": "SteamAPI_SteamGameServerUGC_v020" } ], "classname": "ISteamUGC", @@ -10044,6 +10113,36 @@ ], "returntype": "bool" }, + { + "methodname": "GetNumSupportedGameVersions", + "methodname_flat": "SteamAPI_ISteamUGC_GetNumSupportedGameVersions", + "params": [ + { "paramname":"handle", "paramtype":"UGCQueryHandle_t" }, + { "paramname":"index", "paramtype":"uint32" } + ], + "returntype": "uint32" + }, + { + "methodname": "GetSupportedGameVersionData", + "methodname_flat": "SteamAPI_ISteamUGC_GetSupportedGameVersionData", + "params": [ + { "paramname":"handle", "paramtype":"UGCQueryHandle_t" }, + { "paramname":"index", "paramtype":"uint32" }, + { "paramname":"versionIndex", "paramtype":"uint32" }, + { + "out_string_count": "cchGameBranchSize", + "paramname": "pchGameBranchMin", + "paramtype": "char *" + }, + { + "out_string_count": "cchGameBranchSize", + "paramname": "pchGameBranchMax", + "paramtype": "char *" + }, + { "paramname":"cchGameBranchSize", "paramtype":"uint32" } + ], + "returntype": "bool" + }, { "methodname": "GetQueryUGCContentDescriptors", "methodname_flat": "SteamAPI_ISteamUGC_GetQueryUGCContentDescriptors", @@ -10180,6 +10279,15 @@ ], "returntype": "bool" }, + { + "methodname": "SetAdminQuery", + "methodname_flat": "SteamAPI_ISteamUGC_SetAdminQuery", + "params": [ + { "paramname":"handle", "paramtype":"UGCUpdateHandle_t" }, + { "paramname":"bAdminQuery", "paramtype":"bool" } + ], + "returntype": "bool" + }, { "methodname": "SetCloudFileNameFilter", "methodname_flat": "SteamAPI_ISteamUGC_SetCloudFileNameFilter", @@ -10450,6 +10558,16 @@ ], "returntype": "bool" }, + { + "methodname": "SetRequiredGameVersions", + "methodname_flat": "SteamAPI_ISteamUGC_SetRequiredGameVersions", + "params": [ + { "paramname":"handle", "paramtype":"UGCUpdateHandle_t" }, + { "paramname":"pszGameBranchMin", "paramtype":"const char *" }, + { "paramname":"pszGameBranchMax", "paramtype":"const char *" } + ], + "returntype": "bool" + }, { "callresult": "SubmitItemUpdateResult_t", "methodname": "SubmitItemUpdate", @@ -10710,7 +10828,7 @@ "returntype": "uint32" } ], - "version_string": "STEAMUGC_INTERFACE_VERSION018" + "version_string": "STEAMUGC_INTERFACE_VERSION020" }, { "accessors": [ @@ -11628,6 +11746,108 @@ ], "version_string": "STEAMINVENTORY_INTERFACE_V003" }, + { + "accessors": [ + { + "kind": "user", + "name": "SteamTimeline", + "name_flat": "SteamAPI_SteamTimeline_v001" + } + ], + "classname": "ISteamTimeline", + "fields": [], + "methods": [ + { + "methodname": "SetTimelineStateDescription", + "methodname_flat": "SteamAPI_ISteamTimeline_SetTimelineStateDescription", + "params": [ + { "paramname":"pchDescription", "paramtype":"const char *" }, + { "paramname":"flTimeDelta", "paramtype":"float" } + ], + "returntype": "void" + }, + { + "methodname": "ClearTimelineStateDescription", + "methodname_flat": "SteamAPI_ISteamTimeline_ClearTimelineStateDescription", + "params": [ + { "paramname":"flTimeDelta", "paramtype":"float" } + ], + "returntype": "void" + }, + { + "methodname": "AddTimelineEvent", + "methodname_flat": "SteamAPI_ISteamTimeline_AddTimelineEvent", + "params": [ + { "paramname":"pchIcon", "paramtype":"const char *" }, + { "paramname":"pchTitle", "paramtype":"const char *" }, + { "paramname":"pchDescription", "paramtype":"const char *" }, + { "paramname":"unPriority", "paramtype":"uint32" }, + { "paramname":"flStartOffsetSeconds", "paramtype":"float" }, + { "paramname":"flDurationSeconds", "paramtype":"float" }, + { "paramname":"ePossibleClip", "paramtype":"ETimelineEventClipPriority" } + ], + "returntype": "void" + }, + { + "methodname": "SetTimelineGameMode", + "methodname_flat": "SteamAPI_ISteamTimeline_SetTimelineGameMode", + "params": [ + { "paramname":"eMode", "paramtype":"ETimelineGameMode" } + ], + "returntype": "void" + } + ], + "version_string": "STEAMTIMELINE_INTERFACE_V001" + }, + { + "accessors": [ + { + "kind": "user", + "name": "SteamVideo", + "name_flat": "SteamAPI_SteamVideo_v007" + } + ], + "classname": "ISteamVideo", + "fields": [], + "methods": [ + { + "methodname": "GetVideoURL", + "methodname_flat": "SteamAPI_ISteamVideo_GetVideoURL", + "params": [ + { "paramname":"unVideoAppID", "paramtype":"AppId_t" } + ], + "returntype": "void" + }, + { + "methodname": "IsBroadcasting", + "methodname_flat": "SteamAPI_ISteamVideo_IsBroadcasting", + "params": [ + { "paramname":"pnNumViewers", "paramtype":"int *" } + ], + "returntype": "bool" + }, + { + "callback": "GetOPFSettingsResult_t", + "methodname": "GetOPFSettings", + "methodname_flat": "SteamAPI_ISteamVideo_GetOPFSettings", + "params": [ + { "paramname":"unVideoAppID", "paramtype":"AppId_t" } + ], + "returntype": "void" + }, + { + "methodname": "GetOPFStringForApp", + "methodname_flat": "SteamAPI_ISteamVideo_GetOPFStringForApp", + "params": [ + { "paramname":"unVideoAppID", "paramtype":"AppId_t" }, + { "paramname":"pchBuffer", "paramtype":"char *" }, + { "paramname":"pnBufferSize", "paramtype":"int32 *" } + ], + "returntype": "bool" + } + ], + "version_string": "STEAMVIDEO_INTERFACE_V007" + }, { "accessors": [ { @@ -13464,7 +13684,8 @@ { "fieldname":"m_unVotesUp", "fieldtype":"uint32" }, { "fieldname":"m_unVotesDown", "fieldtype":"uint32" }, { "fieldname":"m_flScore", "fieldtype":"float" }, - { "fieldname":"m_unNumChildren", "fieldtype":"uint32" } + { "fieldname":"m_unNumChildren", "fieldtype":"uint32" }, + { "fieldname":"m_ulTotalFilesSize", "fieldtype":"uint64" } ], "struct": "SteamUGCDetails_t" }, diff --git a/public/steam/steam_api_flat.h b/public/steam/steam_api_flat.h index a0e7ce4..b948b94 100644 --- a/public/steam/steam_api_flat.h +++ b/public/steam/steam_api_flat.h @@ -512,6 +512,9 @@ S_API int SteamAPI_ISteamApps_GetLaunchCommandLine( ISteamApps* self, char * psz S_API bool SteamAPI_ISteamApps_BIsSubscribedFromFamilySharing( ISteamApps* self ); S_API bool SteamAPI_ISteamApps_BIsTimedTrial( ISteamApps* self, uint32 * punSecondsAllowed, uint32 * punSecondsPlayed ); S_API bool SteamAPI_ISteamApps_SetDlcContext( ISteamApps* self, AppId_t nAppID ); +S_API int SteamAPI_ISteamApps_GetNumBetas( ISteamApps* self, AppId_t unAppID, int * pnAvailable, int * pnPrivate ); +S_API bool SteamAPI_ISteamApps_GetBetaInfo( ISteamApps* self, AppId_t unAppID, int iBetaIndex, uint32 * punFlags, uint32 * punBuildID, char * pchBetaName, int cchBetaName, char * pchDescription, int cchDescription ); +S_API bool SteamAPI_ISteamApps_SetActiveBeta( ISteamApps* self, AppId_t unAppID, const char * pchBetaName ); // ISteamNetworking @@ -754,14 +757,14 @@ S_API bool SteamAPI_ISteamController_GetControllerBindingRevision( ISteamControl // ISteamUGC // A versioned accessor is exported by the library -S_API ISteamUGC *SteamAPI_SteamUGC_v018(); +S_API ISteamUGC *SteamAPI_SteamUGC_v020(); // Inline, unversioned accessor to get the current version. Essentially the same as SteamUGC(), but using this ensures that you are using a matching library. -inline ISteamUGC *SteamAPI_SteamUGC() { return SteamAPI_SteamUGC_v018(); } +inline ISteamUGC *SteamAPI_SteamUGC() { return SteamAPI_SteamUGC_v020(); } // A versioned accessor is exported by the library -S_API ISteamUGC *SteamAPI_SteamGameServerUGC_v018(); +S_API ISteamUGC *SteamAPI_SteamGameServerUGC_v020(); // Inline, unversioned accessor to get the current version. Essentially the same as SteamGameServerUGC(), but using this ensures that you are using a matching library. -inline ISteamUGC *SteamAPI_SteamGameServerUGC() { return SteamAPI_SteamGameServerUGC_v018(); } +inline ISteamUGC *SteamAPI_SteamGameServerUGC() { return SteamAPI_SteamGameServerUGC_v020(); } S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( ISteamUGC* self, AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ); S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequestPage( ISteamUGC* self, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ); S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequestCursor( ISteamUGC* self, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char * pchCursor ); @@ -780,6 +783,8 @@ S_API bool SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview( ISteamUGC* self, UGC S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index ); S_API bool SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, char * pchKey, uint32 cchKeySize, char * pchValue, uint32 cchValueSize ); S_API bool SteamAPI_ISteamUGC_GetQueryFirstUGCKeyValueTag( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, const char * pchKey, char * pchValue, uint32 cchValueSize ); +S_API uint32 SteamAPI_ISteamUGC_GetNumSupportedGameVersions( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index ); +S_API bool SteamAPI_ISteamUGC_GetSupportedGameVersionData( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, uint32 versionIndex, char * pchGameBranchMin, char * pchGameBranchMax, uint32 cchGameBranchSize ); S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCContentDescriptors( ISteamUGC* self, UGCQueryHandle_t handle, uint32 index, EUGCContentDescriptorID * pvecDescriptors, uint32 cMaxEntries ); S_API bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest( ISteamUGC* self, UGCQueryHandle_t handle ); S_API bool SteamAPI_ISteamUGC_AddRequiredTag( ISteamUGC* self, UGCQueryHandle_t handle, const char * pTagName ); @@ -795,6 +800,7 @@ S_API bool SteamAPI_ISteamUGC_SetReturnTotalOnly( ISteamUGC* self, UGCQueryHandl S_API bool SteamAPI_ISteamUGC_SetReturnPlaytimeStats( ISteamUGC* self, UGCQueryHandle_t handle, uint32 unDays ); S_API bool SteamAPI_ISteamUGC_SetLanguage( ISteamUGC* self, UGCQueryHandle_t handle, const char * pchLanguage ); S_API bool SteamAPI_ISteamUGC_SetAllowCachedResponse( ISteamUGC* self, UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ); +S_API bool SteamAPI_ISteamUGC_SetAdminQuery( ISteamUGC* self, UGCUpdateHandle_t handle, bool bAdminQuery ); S_API bool SteamAPI_ISteamUGC_SetCloudFileNameFilter( ISteamUGC* self, UGCQueryHandle_t handle, const char * pMatchCloudFileName ); S_API bool SteamAPI_ISteamUGC_SetMatchAnyTag( ISteamUGC* self, UGCQueryHandle_t handle, bool bMatchAnyTag ); S_API bool SteamAPI_ISteamUGC_SetSearchText( ISteamUGC* self, UGCQueryHandle_t handle, const char * pSearchText ); @@ -824,6 +830,7 @@ S_API bool SteamAPI_ISteamUGC_UpdateItemPreviewVideo( ISteamUGC* self, UGCUpdate S_API bool SteamAPI_ISteamUGC_RemoveItemPreview( ISteamUGC* self, UGCUpdateHandle_t handle, uint32 index ); S_API bool SteamAPI_ISteamUGC_AddContentDescriptor( ISteamUGC* self, UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ); S_API bool SteamAPI_ISteamUGC_RemoveContentDescriptor( ISteamUGC* self, UGCUpdateHandle_t handle, EUGCContentDescriptorID descid ); +S_API bool SteamAPI_ISteamUGC_SetRequiredGameVersions( ISteamUGC* self, UGCUpdateHandle_t handle, const char * pszGameBranchMin, const char * pszGameBranchMax ); S_API SteamAPICall_t SteamAPI_ISteamUGC_SubmitItemUpdate( ISteamUGC* self, UGCUpdateHandle_t handle, const char * pchChangeNote ); S_API EItemUpdateStatus SteamAPI_ISteamUGC_GetItemUpdateProgress( ISteamUGC* self, UGCUpdateHandle_t handle, uint64 * punBytesProcessed, uint64 * punBytesTotal ); S_API SteamAPICall_t SteamAPI_ISteamUGC_SetUserItemVote( ISteamUGC* self, PublishedFileId_t nPublishedFileID, bool bVoteUp ); @@ -947,12 +954,23 @@ S_API bool SteamAPI_ISteamInventory_SetPropertyFloat( ISteamInventory* self, Ste S_API bool SteamAPI_ISteamInventory_SubmitUpdateProperties( ISteamInventory* self, SteamInventoryUpdateHandle_t handle, SteamInventoryResult_t * pResultHandle ); S_API bool SteamAPI_ISteamInventory_InspectItem( ISteamInventory* self, SteamInventoryResult_t * pResultHandle, const char * pchItemToken ); +// ISteamTimeline + +// A versioned accessor is exported by the library +S_API ISteamTimeline *SteamAPI_SteamTimeline_v001(); +// Inline, unversioned accessor to get the current version. Essentially the same as SteamTimeline(), but using this ensures that you are using a matching library. +inline ISteamTimeline *SteamAPI_SteamTimeline() { return SteamAPI_SteamTimeline_v001(); } +S_API void SteamAPI_ISteamTimeline_SetTimelineStateDescription( ISteamTimeline* self, const char * pchDescription, float flTimeDelta ); +S_API void SteamAPI_ISteamTimeline_ClearTimelineStateDescription( ISteamTimeline* self, float flTimeDelta ); +S_API void SteamAPI_ISteamTimeline_AddTimelineEvent( ISteamTimeline* self, const char * pchIcon, const char * pchTitle, const char * pchDescription, uint32 unPriority, float flStartOffsetSeconds, float flDurationSeconds, ETimelineEventClipPriority ePossibleClip ); +S_API void SteamAPI_ISteamTimeline_SetTimelineGameMode( ISteamTimeline* self, ETimelineGameMode eMode ); + // ISteamVideo // A versioned accessor is exported by the library -S_API ISteamVideo *SteamAPI_SteamVideo_v002(); +S_API ISteamVideo *SteamAPI_SteamVideo_v007(); // Inline, unversioned accessor to get the current version. Essentially the same as SteamVideo(), but using this ensures that you are using a matching library. -inline ISteamVideo *SteamAPI_SteamVideo() { return SteamAPI_SteamVideo_v002(); } +inline ISteamVideo *SteamAPI_SteamVideo() { return SteamAPI_SteamVideo_v007(); } S_API void SteamAPI_ISteamVideo_GetVideoURL( ISteamVideo* self, AppId_t unVideoAppID ); S_API bool SteamAPI_ISteamVideo_IsBroadcasting( ISteamVideo* self, int * pnNumViewers ); S_API void SteamAPI_ISteamVideo_GetOPFSettings( ISteamVideo* self, AppId_t unVideoAppID ); diff --git a/public/steam/steam_api_internal.h b/public/steam/steam_api_internal.h index e3aa18f..a1a9bed 100644 --- a/public/steam/steam_api_internal.h +++ b/public/steam/steam_api_internal.h @@ -283,6 +283,7 @@ enum { k_iSteamPartiesCallbacks = 5300 }; enum { k_iSteamSTARCallbacks = 5500 }; enum { k_iSteamRemotePlayCallbacks = 5700 }; enum { k_iSteamChatCallbacks = 5900 }; +enum { k_iSteamTimelineCallbacks = 6000 }; // NOTE: Internal "IClientXxx" callback IDs go in clientenums.h // Macros used to annotate various Steamworks interfaces to generate the @@ -307,65 +308,6 @@ enum { k_iSteamChatCallbacks = 5900 }; #define STEAM_CALL_BACK(RESULT_TYPE) STEAM_CLANG_ATTR("callback:" #RESULT_TYPE ";") #define STEAM_FLAT_NAME(NAME) STEAM_CLANG_ATTR("flat_name:" #NAME ";") -// CSteamAPIContext encapsulates the Steamworks API global accessors into -// a single object. -// -// DEPRECATED: Used the global interface accessors instead! -// -// This will be removed in a future iteration of the SDK -class CSteamAPIContext -{ -public: - CSteamAPIContext() { Clear(); } - inline void Clear() { memset( this, 0, sizeof(*this) ); } - inline bool Init(); // NOTE: This is defined in steam_api.h, to avoid this file having to include everything - ISteamClient* SteamClient() const { return m_pSteamClient; } - ISteamUser* SteamUser() const { return m_pSteamUser; } - ISteamFriends* SteamFriends() const { return m_pSteamFriends; } - ISteamUtils* SteamUtils() const { return m_pSteamUtils; } - ISteamMatchmaking* SteamMatchmaking() const { return m_pSteamMatchmaking; } - ISteamGameSearch* SteamGameSearch() const { return m_pSteamGameSearch; } - ISteamUserStats* SteamUserStats() const { return m_pSteamUserStats; } - ISteamApps* SteamApps() const { return m_pSteamApps; } - ISteamMatchmakingServers* SteamMatchmakingServers() const { return m_pSteamMatchmakingServers; } - ISteamNetworking* SteamNetworking() const { return m_pSteamNetworking; } - ISteamRemoteStorage* SteamRemoteStorage() const { return m_pSteamRemoteStorage; } - ISteamScreenshots* SteamScreenshots() const { return m_pSteamScreenshots; } - ISteamHTTP* SteamHTTP() const { return m_pSteamHTTP; } - ISteamController* SteamController() const { return m_pController; } - ISteamUGC* SteamUGC() const { return m_pSteamUGC; } - ISteamMusic* SteamMusic() const { return m_pSteamMusic; } - ISteamMusicRemote* SteamMusicRemote() const { return m_pSteamMusicRemote; } - ISteamHTMLSurface* SteamHTMLSurface() const { return m_pSteamHTMLSurface; } - ISteamInventory* SteamInventory() const { return m_pSteamInventory; } - ISteamVideo* SteamVideo() const { return m_pSteamVideo; } - ISteamParentalSettings* SteamParentalSettings() const { return m_pSteamParentalSettings; } - ISteamInput* SteamInput() const { return m_pSteamInput; } -private: - ISteamClient *m_pSteamClient; - ISteamUser *m_pSteamUser; - ISteamFriends *m_pSteamFriends; - ISteamUtils *m_pSteamUtils; - ISteamMatchmaking *m_pSteamMatchmaking; - ISteamGameSearch *m_pSteamGameSearch; - ISteamUserStats *m_pSteamUserStats; - ISteamApps *m_pSteamApps; - ISteamMatchmakingServers *m_pSteamMatchmakingServers; - ISteamNetworking *m_pSteamNetworking; - ISteamRemoteStorage *m_pSteamRemoteStorage; - ISteamScreenshots *m_pSteamScreenshots; - ISteamHTTP *m_pSteamHTTP; - ISteamController *m_pController; - ISteamUGC *m_pSteamUGC; - ISteamMusic *m_pSteamMusic; - ISteamMusicRemote *m_pSteamMusicRemote; - ISteamHTMLSurface *m_pSteamHTMLSurface; - ISteamInventory *m_pSteamInventory; - ISteamVideo *m_pSteamVideo; - ISteamParentalSettings *m_pSteamParentalSettings; - ISteamInput *m_pSteamInput; -}; - class CSteamGameServerAPIContext { public: diff --git a/public/steam/steamclientpublic.h b/public/steam/steamclientpublic.h index 5cf5d4d..2bd6625 100644 --- a/public/steam/steamclientpublic.h +++ b/public/steam/steamclientpublic.h @@ -461,6 +461,16 @@ enum EDurationControlOnlineState }; +enum EBetaBranchFlags +{ + k_EBetaBranch_None = 0, + k_EBetaBranch_Default = 1, // this is the default branch ("public") + k_EBetaBranch_Available = 2, // this branch can be selected (available) + k_EBetaBranch_Private = 4, // this is a private branch (password protected) + k_EBetaBranch_Selected = 8, // this is the currently selected branch (active) + k_EBetaBranch_Installed = 16, // this is the currently installed branch (mounted) +}; + #pragma pack( push, 1 ) #define CSTEAMID_DEFINED diff --git a/public/steam/steamnetworkingtypes.h b/public/steam/steamnetworkingtypes.h index e8c38df..3bd9202 100644 --- a/public/steam/steamnetworkingtypes.h +++ b/public/steam/steamnetworkingtypes.h @@ -1247,10 +1247,19 @@ enum ESteamNetworkingConfigValue /// we won't automatically reject a connection due to a failure to authenticate. /// (You can examine the incoming connection and decide whether to accept it.) /// + /// 0: Don't attempt or accept unauthorized connections + /// 1: Attempt authorization when connecting, and allow unauthorized peers, but emit warnings + /// 2: don't attempt authentication, or complain if peer is unauthenticated + /// /// This is a dev configuration value, and you should not let users modify it in /// production. k_ESteamNetworkingConfig_IP_AllowWithoutAuth = 23, + /// [connection int32] The same as IP_AllowWithoutAuth, but will only apply + /// for connections to/from localhost addresses. Whichever value is larger + /// (more permissive) will be used. + k_ESteamNetworkingConfig_IPLocalHost_AllowWithoutAuth = 52, + /// [connection int32] Do not send UDP packets with a payload of /// larger than N bytes. If you set this, k_ESteamNetworkingConfig_MTU_DataSize /// is automatically adjusted diff --git a/redistributable_bin/linux32/libsteam_api.so b/redistributable_bin/linux32/libsteam_api.so index 05a277b..d0e9958 100644 Binary files a/redistributable_bin/linux32/libsteam_api.so and b/redistributable_bin/linux32/libsteam_api.so differ diff --git a/redistributable_bin/linux64/libsteam_api.so b/redistributable_bin/linux64/libsteam_api.so index 4a1260c..99c9164 100644 Binary files a/redistributable_bin/linux64/libsteam_api.so and b/redistributable_bin/linux64/libsteam_api.so differ diff --git a/redistributable_bin/osx/libsteam_api.dylib b/redistributable_bin/osx/libsteam_api.dylib index 1897bef..0bbdeeb 100644 Binary files a/redistributable_bin/osx/libsteam_api.dylib and b/redistributable_bin/osx/libsteam_api.dylib differ diff --git a/redistributable_bin/steam_api.dll b/redistributable_bin/steam_api.dll index 0bcfde3..7fde3a3 100644 Binary files a/redistributable_bin/steam_api.dll and b/redistributable_bin/steam_api.dll differ diff --git a/redistributable_bin/steam_api.lib b/redistributable_bin/steam_api.lib index c92b896..f163d0c 100644 Binary files a/redistributable_bin/steam_api.lib and b/redistributable_bin/steam_api.lib differ diff --git a/redistributable_bin/win64/steam_api64.dll b/redistributable_bin/win64/steam_api64.dll index 6594c50..9ad453c 100644 Binary files a/redistributable_bin/win64/steam_api64.dll and b/redistributable_bin/win64/steam_api64.dll differ diff --git a/redistributable_bin/win64/steam_api64.lib b/redistributable_bin/win64/steam_api64.lib index b8aaa87..4a9b011 100644 Binary files a/redistributable_bin/win64/steam_api64.lib and b/redistributable_bin/win64/steam_api64.lib differ diff --git a/steamworksexample/Makefile b/steamworksexample/Makefile index 0871bf3..ce64aca 100644 --- a/steamworksexample/Makefile +++ b/steamworksexample/Makefile @@ -1,7 +1,3 @@ -#Generated by VisualGDB project wizard. -#Visit http://visualgdb.com/makefiles for more details - -#VisualGDB: AutoSourceFiles #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS SOURCEFILES := \ BaseMenu.cpp \ Friends.cpp \ @@ -25,6 +21,7 @@ SOURCEFILES := \ StarField.cpp \ StatsAndAchievements.cpp \ Sun.cpp \ + timeline.cpp \ VectorEntity.cpp \ clanchatroom.cpp \ connectingmenu.cpp \ @@ -68,10 +65,21 @@ error: $(error Please specify CONFIG=DEBUG/RELEASE) endif +ARCH ?= 64 +ifeq ($(ARCH), 32) + CFLAGS += -m32 + CXXFLAGS += -m32 + LDFLAGS += -m32 +else + ifneq ($(ARCH), 64) + $(error Please specify ARCH=32/64) + endif +endif + EXTERNAL_LIBS := EXTERNAL_LIBS_COPIED := $(foreach lib, $(EXTERNAL_LIBS),$(BINARYDIR)/$(notdir $(lib))) -CXXFLAGS += -std=c++0x -Wno-invalid-offsetof +CXXFLAGS += -Wno-invalid-offsetof CFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) CXXFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) @@ -132,15 +140,15 @@ endif ifeq ($(TARGETTYPE),APP) $(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS) $(BINARYDIR)/$(STEAM_API) $(BINARYDIR)/SteamworksExample.sh $(BINARYDIR)/DejaVuSans.ttf - $(LD) -o $@ $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP) + $(LD) -o $@ $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(LDFLAGS) $(END_GROUP) @echo "You can start the game by running $(BINARYDIR)/SteamworksExample.sh" endif ifeq ($(TARGETTYPE),SHARED) $(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS) - $(LD) -shared -o $@ $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP) + $(LD) -shared -o $@ $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(LDFLAGS) $(END_GROUP) endif - + ifeq ($(TARGETTYPE),STATIC) $(BINARYDIR)/$(TARGETNAME): $(all_objs) $(AR) -r $@ $^ @@ -152,13 +160,14 @@ clean: ifeq ($(USE_DEL_TO_CLEAN),1) del /S /Q $(BINARYDIR) else - rm -f $(BINARYDIR)/*.o $(BINARYDIR)/*.dep $(BINARYDIR)/$(TARGETNAME) + rm -f $(BINARYDIR)/*.o $(BINARYDIR)/*.dep $(BINARYDIR)/$(TARGETNAME) $(BINARYDIR)/SteamworksExample.sh endif $(BINARYDIR): mkdir $(BINARYDIR) -$(BINARYDIR)/$(STEAM_API): $(STEAMWORKS_SDK)/redistributable_bin/linux32/$(STEAM_API) +$(BINARYDIR)/$(STEAM_API): $(LIBRARY_DIRS)/$(STEAM_API) + chmod +w $@ || true cp -v $< $@ chmod +x $@ @@ -169,7 +178,6 @@ $(BINARYDIR)/SteamworksExample.sh: SteamworksExample.sh $(BINARYDIR)/DejaVuSans.ttf: DejaVuSans.ttf cp -v $< $@ -#VisualGDB: FileSpecificTemplates #<--- VisualGDB will use the following lines to define rules for source files in subdirectories $(BINARYDIR)/%.o : %.cpp $(all_make_files) |$(BINARYDIR) $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep) @@ -178,5 +186,3 @@ $(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR) $(BINARYDIR)/%.o : %.S $(all_make_files) |$(BINARYDIR) $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep) - -#VisualGDB: GeneratedRules #<--- All lines below are auto-generated diff --git a/steamworksexample/flags.mak b/steamworksexample/flags.mak index 8d0bc37..a3db837 100644 --- a/steamworksexample/flags.mak +++ b/steamworksexample/flags.mak @@ -1,45 +1,53 @@ -#Generated by VisualGDB project wizard. -#Feel free to modify any flags you want -#Visit http://visualgdb.com/makefiles for more details - -# Set this variable to the location of the Steamworks SDK -ifeq ($(STEAMWORKS_SDK),) - STEAMWORKS_SDK := $(PWD)/.. +ifeq "$(DOCKER_IMAGE_ALIAS)" "" + # This is setup when using Valve's docker scripts, but not when using podman/toolbox, so try to guess + $(shell grep -q -F VARIANT_ID=\"com.valvesoftware.steamruntime.sdk-amd64_i386-scout\" /etc/os-release) + ifeq ($(.SHELLSTATUS),0) + DOCKER_IMAGE_ALIAS := steamrt-scout-amd64 + endif endif + +ifeq "$(DOCKER_IMAGE_ALIAS)" "" + $(info WARNING: No Steam for Linux runtime SDK detected - unsupported configuration.) + $(info See tools/linux/README.md) + $(info) +else + DOCKER_IMAGE_BASE:=$(DOCKER_IMAGE_ALIAS:-fastlink=) + DOCKER_IMAGE_BASE:=$(DOCKER_IMAGE_BASE:-i386=) + DOCKER_IMAGE_BASE:=$(DOCKER_IMAGE_BASE:-amd64=) + + ifeq ($(DOCKER_IMAGE_BASE), steamrt-scout) + $(info Configuring for Steam for Linux runtime 1.0 (scout)) + CC := gcc-9 + CXX := g++-9 + CXXFLAGS += -std=gnu++17 + # unlike gcc 4.8, gcc 9 is not native to the scout runtime, it is recommended to statically link + LDFLAGS += -static-libgcc -static-libstdc++ + endif +endif + +ifeq ($(ARCH), 32) + ARCH_DIR := linux32 +else + ARCH_DIR := linux64 +endif + +INCLUDE_DIRS := $(PWD)/../public +LIBRARY_DIRS := $(PWD)/../../client/$(ARCH_DIR) +LIBRARY_NAMES := steam_api STEAM_API := libsteam_api.so -# Uncomment this line to use the Steam Linux Runtime SDK -# If you do this you should run the SDK setup.sh to download updates -USE_STEAM_RUNTIME=true -ifeq ($(USE_STEAM_RUNTIME),true) - ifeq ($(STEAM_RUNTIME_SDK),) - STEAM_RUNTIME_SDK := $(STEAMWORKS_SDK)/tools/linux - endif - ifeq ($(STEAM_RUNTIME_TARGET_ARCH),) - STEAM_RUNTIME_TARGET_ARCH := i386 - export STEAM_RUNTIME_TARGET_ARCH - endif - ifeq ($(STEAM_RUNTIME_ROOT),) - STEAM_RUNTIME_ROOT := $(STEAM_RUNTIME_SDK)/runtime/$(STEAM_RUNTIME_TARGET_ARCH) - export STEAM_RUNTIME_ROOT - endif - STEAM_TOOLS_BIN := $(STEAM_RUNTIME_SDK)/bin/ +ifeq (,$(wildcard $(LIBRARY_DIRS)/$(STEAM_API))) + # Does not exist, substitue with a path valid for the public, zip version of the SDK + LIBRARY_DIRS := $(PWD)/../redistributable_bin/$(ARCH_DIR) +endif - ifeq ($(realpath $(STEAM_TOOLS_BIN)),) -steam-runtime-setup: - bash $(STEAM_RUNTIME_SDK)/setup.sh --auto-upgrade - make - - endif -endif # USE_STEAM_RUNTIME - -CC := $(STEAM_TOOLS_BIN)gcc -CXX := $(STEAM_TOOLS_BIN)g++ +CC ?= gcc +CXX ?= g++ LD := $(CXX) -AR := $(STEAM_TOOLS_BIN)ar -OBJCOPY := $(STEAM_TOOLS_BIN)objcopy +AR := ar +OBJCOPY := objcopy CP := cp -SDL_CONFIG := $(STEAM_TOOLS_BIN)sdl2-config +SDL_CONFIG := sdl2-config # Since this is an example, we'll build Debug by default CONFIG ?= DEBUG @@ -50,21 +58,21 @@ RELEASE_MACROS := NDEBUG RELEASE MCUFLAGS := -INCLUDE_DIRS := $(STEAMWORKS_SDK)/public -LIBRARY_DIRS := $(STEAMWORKS_SDK)/public/steam/lib/linux32 $(STEAMWORKS_SDK)/redistributable_bin/linux32 -LIBRARY_NAMES := steam_api +CFLAGS += -g -DPOSIX -DSDL $(shell $(SDL_CONFIG) --cflags) -DGNUC +CXXFLAGS += -g -DPOSIX -DSDL $(shell $(SDL_CONFIG) --cflags) -DGNUC + +# Valve uses SDL3 internally (the default if USE_SDL2 is not specified) +# The zip version of the SDK uses the SDL2 package from the runtime SDK +CXXFLAGS += -DUSE_SDL2 -CFLAGS := -g -DPOSIX -DSDL $(shell STEAM_RUNTIME_ROOT=$(STEAM_RUNTIME_ROOT) $(SDL_CONFIG) --cflags) -DGNUC DEBUG_CFLAGS := -O0 RELEASE_CFLAGS := -O3 - -CXXFLAGS := $(CFLAGS) DEBUG_CXXFLAGS := $(DEBUG_CFLAGS) RELEASE_CXXFLAGS := $(RELEASE_CFLAGS) MACOS_FRAMEWORKS := -LDFLAGS := $(shell STEAM_RUNTIME_ROOT=$(STEAM_RUNTIME_ROOT) $(SDL_CONFIG) --libs) -lSDL3_ttf -lfreetype -lz -lGL -lopenal +LDFLAGS := $(shell $(SDL_CONFIG) --libs) -lSDL2_ttf -lfreetype -lz -lGL -lopenal DEBUG_LDFLAGS := RELEASE_LDGLAGS := diff --git a/steamworksexample/gameengineosx.mm b/steamworksexample/gameengineosx.mm index 5851044..1c3d999 100644 --- a/steamworksexample/gameengineosx.mm +++ b/steamworksexample/gameengineosx.mm @@ -338,7 +338,9 @@ bool CGameEngineGL::BInitializeGraphics() m_view = [[NSOpenGLView alloc] initWithFrame:NSMakeRect( 0, 0, m_nWindowWidth, m_nWindowHeight ) pixelFormat:pixelFormat]; - + + m_view.wantsBestResolutionOpenGLSurface = NO; + int wherex = 50; int wherey = 50; @@ -645,13 +647,9 @@ bool CGameEngineGL::BInitializeGraphics() #else void CGameEngineGL::AdjustViewport() { - NSRect viewBounds = { { 0, 0 }, { static_cast(m_nWindowWidth), static_cast(m_nWindowHeight) } }; - - if( !NSEqualRects( [m_view bounds], viewBounds ) ) - { - m_nWindowWidth = [m_view bounds].size.width; - m_nWindowHeight = [m_view bounds].size.height; - } + NSRect viewBounds = [m_view convertRectToBacking:m_view.bounds]; + m_nWindowWidth = viewBounds.size.width; + m_nWindowHeight = viewBounds.size.height; // Perspective glMatrixMode(GL_PROJECTION); diff --git a/steamworksexample/gameenginesdl.cpp b/steamworksexample/gameenginesdl.cpp index abbf395..fa2c64a 100644 --- a/steamworksexample/gameenginesdl.cpp +++ b/steamworksexample/gameenginesdl.cpp @@ -249,8 +249,6 @@ bool CGameEngineGL::BInitializeAudio() bool CGameEngineGL::BInitializeGraphics() { - int windowX = SDL_WINDOWPOS_CENTERED; - int windowY = SDL_WINDOWPOS_CENTERED; int nWindowWidth, nWindowHeight; nWindowWidth = m_nWindowWidth = 1024; nWindowHeight = m_nWindowHeight = 768; @@ -258,12 +256,21 @@ bool CGameEngineGL::BInitializeGraphics() SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); +#if defined(USE_SDL2) + int windowX = SDL_WINDOWPOS_CENTERED; + int windowY = SDL_WINDOWPOS_CENTERED; m_window = SDL_CreateWindow( "SteamworksExample", windowX, windowY, nWindowWidth, nWindowHeight, SDL_WINDOW_OPENGL ); +#else + m_window = SDL_CreateWindow( "SteamworksExample", + nWindowWidth, + nWindowHeight, + SDL_WINDOW_OPENGL ); +#endif if ( !m_window ) { OutputDebugString( "Couldn't create SDL window: " ); OutputDebugString( SDL_GetError() ); @@ -360,7 +367,11 @@ void CGameEngineGL::AdjustViewport() void CGameEngineGL::UpdateGameTickCount() { m_ulPreviousGameTickCount = m_ulGameTickCount; +#if defined(USE_SDL2) + m_ulGameTickCount = SDL_GetTicks64(); +#else m_ulGameTickCount = SDL_GetTicks(); +#endif } @@ -374,7 +385,11 @@ bool CGameEngineGL::BSleepForFrameRateLimit( uint32 ulMaxFrameRate ) // Frame rate limiting float flDesiredFrameMilliseconds = 1000.0f/ulMaxFrameRate; +#if defined(USE_SDL2) + uint64 ulGameTickCount = SDL_GetTicks64(); +#else uint64 ulGameTickCount = SDL_GetTicks(); +#endif float flMillisecondsElapsed = (float)(ulGameTickCount - m_ulGameTickCount); if ( flMillisecondsElapsed < flDesiredFrameMilliseconds ) @@ -931,7 +946,11 @@ bool CGameEngineGL::BDrawString( HGAMEFONT hFont, RECT rect, DWORD dwColor, DWOR m_MapTextures[ hTexture ].m_uWidth = surface->w; m_MapTextures[ hTexture ].m_uHeight = surface->h; +#if defined(USE_SDL2) + SDL_FreeSurface( surface ); +#else SDL_DestroySurface( surface ); +#endif m_MapStrings[ std::string(szFontPrefix) + std::string(pchText) ] = hTexture; } @@ -989,6 +1008,11 @@ void CGameEngineGL::UpdateKey( uint32_t vkKey, int nDown ) //----------------------------------------------------------------------------- void CGameEngineGL::MessagePump() { +#if defined(USE_SDL2) + #define SDL_EVENT_KEY_DOWN SDL_KEYDOWN + #define SDL_EVENT_KEY_UP SDL_KEYUP + #define SDL_EVENT_QUIT SDL_QUIT +#endif SDL_Event event; do @@ -996,7 +1020,7 @@ void CGameEngineGL::MessagePump() if ( SDL_PollEvent(&event) <= 0 ) break; - if ( event.type == SDL_KEYDOWN || event.type == SDL_KEYUP ) + if ( event.type == SDL_EVENT_KEY_DOWN || event.type == SDL_EVENT_KEY_UP ) { DWORD dwVK = 0; switch (event.key.keysym.sym) @@ -1028,7 +1052,7 @@ void CGameEngineGL::MessagePump() if (dwVK) { - if ( event.type == SDL_KEYDOWN ) + if ( event.type == SDL_EVENT_KEY_DOWN ) { m_SetKeysDown.insert( dwVK ); } @@ -1038,7 +1062,7 @@ void CGameEngineGL::MessagePump() } } } - else if ( event.type == SDL_QUIT ) + else if ( event.type == SDL_EVENT_QUIT ) { CreateGameEngineSDL( )->Shutdown(); } diff --git a/steamworksexample/gameenginesdl.h b/steamworksexample/gameenginesdl.h index 5c7150e..e8d9033 100644 --- a/steamworksexample/gameenginesdl.h +++ b/steamworksexample/gameenginesdl.h @@ -15,9 +15,15 @@ typedef unsigned char byte; #include #include +#if defined(USE_SDL2) +#include +#include +#include +#else #include #include -#include +#include +#endif #include #include diff --git a/steamworksexample/steamworksexample.xcodeproj/project.pbxproj b/steamworksexample/steamworksexample.xcodeproj/project.pbxproj index bf11a7a..7d0f32b 100644 --- a/steamworksexample/steamworksexample.xcodeproj/project.pbxproj +++ b/steamworksexample/steamworksexample.xcodeproj/project.pbxproj @@ -52,6 +52,7 @@ 50E77DF813621991000FC072 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E77DF713621991000FC072 /* IOKit.framework */; }; 840B387019BB91C50084B9F1 /* htmlsurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840B386E19BB91C50084B9F1 /* htmlsurface.cpp */; }; 975820DB2765BE3900093F91 /* ItemStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 975820DA2765BE3900093F91 /* ItemStore.cpp */; }; + 97919DA62C22281400272343 /* timeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97919DA52C22281400272343 /* timeline.cpp */; }; A4B5A0FD24906974000E9151 /* RemotePlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A4B5A0FC24906974000E9151 /* RemotePlay.cpp */; }; A4B5A101249069C9000E9151 /* remotestoragesync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A4B5A0FF249069C9000E9151 /* remotestoragesync.cpp */; }; A4B5A10424906A0E000E9151 /* SimpleProtobuf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A4B5A10324906A0E000E9151 /* SimpleProtobuf.cpp */; }; @@ -166,6 +167,8 @@ 840B386F19BB91C50084B9F1 /* htmlsurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htmlsurface.h; sourceTree = ""; }; 975820DA2765BE3900093F91 /* ItemStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ItemStore.cpp; sourceTree = ""; }; 975820DD2765BE5000093F91 /* ItemStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ItemStore.h; sourceTree = ""; }; + 97919DA42C22280B00272343 /* timeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timeline.h; sourceTree = ""; }; + 97919DA52C22281400272343 /* timeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = timeline.cpp; sourceTree = ""; }; A46ECF6D26BE389800985AA7 /* steamworksexample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = steamworksexample.entitlements; path = osx/steamworksexample.entitlements; sourceTree = ""; }; A4B5A0FC24906974000E9151 /* RemotePlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemotePlay.cpp; sourceTree = ""; }; A4B5A0FE2490698A000E9151 /* RemotePlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemotePlay.h; sourceTree = ""; }; @@ -245,6 +248,7 @@ 503C6D051268F49F00B66E3B /* StatsAndAchievements.cpp */, 503C6D071268F49F00B66E3B /* stdafx.cpp */, 503C6D091268F49F00B66E3B /* Sun.cpp */, + 97919DA52C22281400272343 /* timeline.cpp */, 503C6D0B1268F49F00B66E3B /* VectorEntity.cpp */, 503C6D0D1268F49F00B66E3B /* voicechat.cpp */, ); @@ -319,6 +323,7 @@ 503C6D061268F49F00B66E3B /* StatsAndAchievements.h */, 503C6D081268F49F00B66E3B /* stdafx.h */, 503C6D0A1268F49F00B66E3B /* Sun.h */, + 97919DA42C22280B00272343 /* timeline.h */, 503C6D0C1268F49F00B66E3B /* VectorEntity.h */, 503C6D0E1268F49F00B66E3B /* voicechat.h */, ); @@ -461,6 +466,7 @@ 50E77DF41362190C000FC072 /* glmgrcocoa.mm in Sources */, 50E77DF51362190C000FC072 /* glmgrext.cpp in Sources */, A4B5A101249069C9000E9151 /* remotestoragesync.cpp in Sources */, + 97919DA62C22281400272343 /* timeline.cpp in Sources */, BA60B6B81A82EDD200F4AC4F /* Friends.cpp in Sources */, 50E77DF61362190C000FC072 /* mathlite.cpp in Sources */, 50D642871461EF3200A5739B /* clanchatroom.cpp in Sources */, diff --git a/tools/goldmaster/disk_assets/SteamService.exe b/tools/goldmaster/disk_assets/SteamService.exe deleted file mode 100644 index e546703..0000000 Binary files a/tools/goldmaster/disk_assets/SteamService.exe and /dev/null differ diff --git a/tools/goldmaster/disk_assets/SteamSetup.exe b/tools/goldmaster/disk_assets/SteamSetup.exe index 6454d8f..0d5e3b4 100644 Binary files a/tools/goldmaster/disk_assets/SteamSetup.exe and b/tools/goldmaster/disk_assets/SteamSetup.exe differ diff --git a/tools/goldmaster/disk_assets/resources/installscript.vdf b/tools/goldmaster/disk_assets/resources/installscript.vdf deleted file mode 100644 index 67b94ba..0000000 --- a/tools/goldmaster/disk_assets/resources/installscript.vdf +++ /dev/null @@ -1,18 +0,0 @@ -"InstallScript" -{ - - // Install scripts on the Gold Master are only necessary for Games for Windows titles. - // Otherwise this file doesn't need to be shipped on the GM and the Steam client - // will run the install script shipped with your depots at a later point - - "Run Process" - { - "VCRedist" - { - "process 1" "%INSTALLDIR%\\redist\\vcredist_x86.exe" - "command 1" "/q:a" - "Description" "Microsoft VC Redist Package" - "NoCleanUp" "1" - } - } -} \ No newline at end of file diff --git a/tools/goldmaster/disk_assets/resources/readme.txt b/tools/goldmaster/disk_assets/resources/readme.txt index 92a6650..2ac997e 100644 --- a/tools/goldmaster/disk_assets/resources/readme.txt +++ b/tools/goldmaster/disk_assets/resources/readme.txt @@ -37,10 +37,6 @@ root\resources\setup_.ini : korean, spanish, schinese, tchinese, russian, thai, japanese, portuguese, polish, danish, dutch, finnish, norwegian, swedish, hungarian, czech -root\resources\installscript.vdf : - This is a script file in KeyValues format to run 3rd party installers before - Steam and the game are installed. This file is optional and can be removed. - root\resources\eula.rtf : The end user license agreement shown before the user installs the game. This file is optional. If you have localized versions of this file, diff --git a/tools/goldmaster/disk_assets/resources/redist/vcredist_x86.exe b/tools/goldmaster/disk_assets/resources/redist/vcredist_x86.exe deleted file mode 100644 index 47f87a0..0000000 Binary files a/tools/goldmaster/disk_assets/resources/redist/vcredist_x86.exe and /dev/null differ diff --git a/tools/linux/README.md b/tools/linux/README.md new file mode 100644 index 0000000..75ff58f --- /dev/null +++ b/tools/linux/README.md @@ -0,0 +1,57 @@ +## Building Spacewars (steamworksexample) for Linux + +All native executables built for Steam for Linux should be built using the Steam for Linux runtime SDK. + +For a complete developer guide regarding the Steam for Linux runtime, see [3]. For bugs and feature requests regarding the Steam for Linux runtime, see [4]. + +## Setup + +Download, configure and open a shell in one of the Steam for Linux runtime SDKs. See [1] for details. + +``` +toolbox create -i registry.gitlab.steamos.cloud/steamrt/scout/sdk scout +toolbox enter scout +``` + +NOTE: You may also use the newer Linux runtime SDK for sniper. See [2]. + +## Build + +Enter the toolbox shell, go to the `steamworksexample/` folder and build: + +``` +timo@eta-carinae ~/D/sdk> pwd +/home/timo/Downloads/sdk +timo@eta-carinae ~/D/sdk> toolbox enter scout +[timo@toolbox sdk]$ cd steamworksexample/ +[timo@toolbox steamworksexample]$ make +g++ -g -DPOSIX -DSDL -I/usr/include/SDL2 -D_REENTRANT -DGNUC -O0 -std=c++0x -Wno-invalid-offsetof -I/home/timo/Downloads/sdk/steamworksexample/../public -DDEBUG -c BaseMenu.cpp -o debug/BaseMenu.o -MD -MF debug/BaseMenu.dep +[..] +``` + +Use `make CONFIG=RELEASE` for a release build. + +Use `ARCH=32` to build a 32 bit binary (do not use the legacy 32 bit scout SDK image, do this in the normal toolbox 64 bit container). + +## Run + +NOTE: You should not attempt to run out of your docker/podman/toolbox shell. Although it may work in some cases. + +The Steam client should be running. The test program will initialize the Steamworks API on startup. + +Launch with the `SteamworksExample.sh` script: + +``` +timo@eta-carinae ~/D/s/s/debug> pwd +/home/timo/Downloads/sdk/steamworksexample/debug +timo@eta-carinae ~/D/s/s/debug> ./SteamworksExample.sh +[S_API] SteamAPI_Init(): Loaded '/home/timo/steam/main/client/linux64/steamclient.so' OK. +Setting breakpad minidump AppID = 480 +``` + +## Reference + +1. [Steam for Linux runtime - scout SDK](https://gitlab.steamos.cloud/steamrt/scout/sdk) +2. [Steam for Linux runtime - scout SDK](https://gitlab.steamos.cloud/steamrt/sniper/sdk) +3. [Steam Linux Runtime - guide for game developers](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/slr-for-game-developers.md) +4. [Steam Linux Runtime on github](https://github.com/ValveSoftware/steam-runtime) diff --git a/tools/linux/README.txt b/tools/linux/README.txt deleted file mode 100644 index 139afe8..0000000 --- a/tools/linux/README.txt +++ /dev/null @@ -1,77 +0,0 @@ - -This is a set of tools targeting the Steam Linux Runtime. - -Setup -------------- - -The first time you install the runtime SDK, you should run the setup -script from the command line to download the set of packages you need -for development: - bash setup.sh - -You can pick your target architecture(s) and either the release or debug -version of the runtime. The debug runtime is built without optimizations -and includes full source code. - -You can re-run the script at any time to reconfigure the SDK. There are -a number of command line options for automating the script, which you can -see by running the script with the --help option. - - -Updates -------- - -You can run the setup script at any time to get the latest version of the SDK: - setup.sh --auto-update - -If you need to get an old version, you can specify it with --version: - setup.sh --version=2013-02-22 - - -Builds -------- - -Use the appropriate shell script to set up the environment for building with -the runtime, or just look to see what environment variables it sets and use -them directly in your build process. - -For example to run a shell targeting 32-bit architecture: - shell-i386.sh - -For example to run a shell targeting 64-bit architecture: - shell-amd64.sh - - -Testing -------- - -Once you have built a program that targets the runtime, you can verify -that all the dependencies are covered by the runtime with: - runtime/scripts/check-program.sh | grep " /usr" - -(note that the C library, OpenGL and 3D drivers are outside the runtime) - -You can run programs in the runtime environment for testing with: - run.sh -e.g. - run.sh ./MyGame -windowed - -You can debug your programs in the runtime environment with run.sh as well: - run.sh gdb MyGame - (gdb) r -windowed - - -Steam Depots ------------- - -When you are ready to build and upload your Steam depots, you will need to use -Steamcmd.exe on a Windows machine. - - -More Info ---------- - -You can get the scripts used to build these tools and report issues at: - https://github.com/ValveSoftware/steam-runtime - -Enjoy! diff --git a/tools/linux/setup.sh b/tools/linux/setup.sh deleted file mode 100644 index 0b6a864..0000000 --- a/tools/linux/setup.sh +++ /dev/null @@ -1,368 +0,0 @@ -#!/bin/bash -# -# This script runs a shell with the environment set up for the Steam runtime -# development environment. - -# The top level of the cross-compiler tree -ORIG_PWD="${PWD}" -TOP=$(cd "${0%/*}" 2>/dev/null; echo "${PWD}") -cd "${TOP}" - -CONFIG=.config -ARCHITECTURES="i386 amd64" -ARCHIVE_EXT="tar.xz" -RUNTIME_VERSION=latest - -exit_usage() -{ - echo "Usage: $0 [--host=] [--target=] [--debug|--release] [--version=] [--depot=] [--perforce] [--reset] [--auto-update] [--checkonly]" >&2 - exit 1 -} - -function has_command() -{ - command -v $1 >/dev/null - return $? -} - -function detect_arch() -{ - case $(uname -m) in - *64) - echo "amd64" - ;; - *) - echo "i386" - ;; - esac -} - -function reset_sdk() -{ - if [ "${AUTO_UPGRADE}" != "true" ]; then - echo "This will clean the SDK and redownload packages." - read -p "Are you sure you want to continue? [y/N]: " response - if [ "${response}" != "y" -a "${response}" != "Y" ]; then - exit 2 - fi - fi - - rm -rf checksums ${ARCHITECTURES} runtime* - echo "Reset complete." - echo -} - -declare -a ARGS=("$@") -while [ "$1" ]; do - case "$1" in - --relaunch) - RELAUNCHED=true - ;; - --host=*) - HOST_ARCH=$(expr "$1" : '[^=]*=\(.*\)') - ;; - --target=*) - TARGET_ARCH=$(expr "$1" : '[^=]*=\(.*\)') - ;; - --debug) - RUNTIME_FLAVOR="debug" - ;; - --release) - RUNTIME_FLAVOR="release" - ;; - --version=*) - RUNTIME_VERSION=$(expr "$1" : '[^=]*=\(.*\)') - ;; - --depot=*) - URL_PREFIX=$(expr "$1" : '[^=]*=\(.*\)') - ;; - --perforce) - USE_P4=true - ;; - --reset) - if [ "${RELAUNCHED}" != "true" ]; then - reset_sdk - fi - ;; - --auto-update|--auto-upgrade) - AUTO_UPGRADE=true - ;; - --checkonly) - CHECK_ONLY=true - ;; - -h|--help) - exit_usage - ;; - -*) - echo "Unknown command line parameter: $1" >&2 - exit_usage - ;; - *) - break - ;; - esac - - shift -done - -function check_curl() -{ - if ! has_command curl; then - if has_command apt-get; then - echo "Installing curl to download packages..." - sudo apt-get install curl - echo - else - echo "Please install curl to download packages." - exit 2 - fi - fi -} - -# Make sure we have curl to download packages -check_curl - -if [ -z "${HOST_ARCH}" ]; then - HOST_ARCH=$(grep HOST_ARCH ${CONFIG} 2>/dev/null | awk -F= '{print $2}') - if [ "${HOST_ARCH}" = "" ]; then - HOST_ARCH=$(detect_arch) - fi -fi - -DEFAULT_TARGET=$(grep TARGET_ARCH ${CONFIG} 2>/dev/null | awk -F= '{print $2}') -if [ "${DEFAULT_TARGET}" = "" ]; then - # Most people are targeting i386 (for now!) - DEFAULT_TARGET=i386 -fi -if [ -z "${TARGET_ARCH}" -a "${AUTO_UPGRADE}" = "true" ]; then - TARGET_ARCH="${DEFAULT_TARGET}" -fi -if [ -z "${TARGET_ARCH}" ]; then - cat <<__EOF__ -====================================== -Which architectures would you like to target? - 1) i386 (x86 32-bit) - 2) amd64 (x64 64-bit) - 3) all supported architectures -__EOF__ - read -p "Default ${DEFAULT_TARGET}: " response - case "${response}" in - 1|i386) - TARGET_ARCH=i386 - ;; - 2|amd64) - TARGET_ARCH=amd64 - ;; - 3|all) - TARGET_ARCH="${ARCHITECTURES}" - ;; - *) - TARGET_ARCH="${DEFAULT_TARGET}" - ;; - esac - echo "Set target architecture to: ${TARGET_ARCH}" - echo -fi - -DEFAULT_FLAVOR=$(grep RUNTIME_FLAVOR ${CONFIG} 2>/dev/null | awk -F= '{print $2}') -if [ "${DEFAULT_FLAVOR}" = "" ]; then - DEFAULT_FLAVOR=release -fi -if [ -z "${RUNTIME_FLAVOR}" -a "${AUTO_UPGRADE}" = "true" ]; then - RUNTIME_FLAVOR="${DEFAULT_FLAVOR}" -fi -if [ -z "${RUNTIME_FLAVOR}" ]; then - cat <<__EOF__ -====================================== -Which runtime flavor would you like to use? - 1) release - 2) debug -__EOF__ - read -p "Default ${DEFAULT_FLAVOR}: " response - case "${response}" in - 1) RUNTIME_FLAVOR=release;; - 2) RUNTIME_FLAVOR=debug;; - *) RUNTIME_FLAVOR="${DEFAULT_FLAVOR}";; - esac - echo "Set runtime flavor to: ${RUNTIME_FLAVOR}" - echo -fi - -if [ -z "${URL_PREFIX}" ]; then - URL_PREFIX="http://media.steampowered.com/client/runtime" -fi - -# Make everything writable if we're using Perforce -if [ "${USE_P4}" = "true" ]; then - chmod -R +w . -fi - -# Save our config -: >${CONFIG} -echo "HOST_ARCH=${HOST_ARCH}" >>${CONFIG} -echo "TARGET_ARCH=${TARGET_ARCH}" >>${CONFIG} -echo "RUNTIME_FLAVOR=${RUNTIME_FLAVOR}" >>${CONFIG} - - -UPDATED_FILES_RETURNCODE=42 - -function update_archive() -{ - local NAME=$1 - local DEST=$2 - - if [ -z "${NAME}" -o -z "${DEST}" ]; then - echo "Internal error: update_archive " 2>&1 - exit 255 - fi - - # Download the latest archive checksum and see if we already have it - local ARCHIVE="${NAME}_${RUNTIME_VERSION}.${ARCHIVE_EXT}" - local CHECKSUM_FILE="${ARCHIVE}.md5" - local CHECKSUM=$(curl -sf "${URL_PREFIX}/${CHECKSUM_FILE}") - if [ "${CHECKSUM}" = "" ]; then - # No updates available - return 0 - fi - if [ -f "checksums/${CHECKSUM_FILE}" ] && \ - [ "$(cat "checksums/${CHECKSUM_FILE}")" = "${CHECKSUM}" ]; then - # We're all done! - return 0 - fi - - if [ "$CHECK_ONLY" = "true" ]; then - echo "Update available: ${URL_PREFIX}/${ARCHIVE}" - return 1 - fi - - # Download and extract the archive - echo "Installing ${URL_PREFIX}/${ARCHIVE}..." - curl -#f "${URL_PREFIX}/${ARCHIVE}" | tar xJf - --strip-components=1 -C "${DEST}" - - # Update the checksum - mkdir -p checksums - rm -f checksums/${NAME}_* - echo "${CHECKSUM}" >"checksums/${CHECKSUM_FILE}" - - # All done! - return ${UPDATED_FILES_RETURNCODE} -} - -function fold_case() -{ - echo "Removing files with the same case..." - find . \( -type f -o -type l \) | sort -f | uniq -i -d | while read file; do - find "$(dirname "$file")" -iname "$(basename "$file")" | while read other; do - if [ "$other" != "$file" ]; then - rm -v "$other" - fi - done - done -} - -function p4reconcile() -{ - P4LOG=/tmp/p4.log - fold_case - p4 reconcile -f ... >"${P4LOG}" - echo "Perforce log is in ${P4LOG}" -} - -# Update SDK files and restart if necessary -if [ "${RELAUNCHED}" = "true" ]; then - response=n -elif [ "${AUTO_UPGRADE}" = "true" ]; then - response=y -else - echo "======================================" - read -p "Update base SDK? [Y/n]: " response -fi -if [ "${response}" != "n" ]; then - update_archive steam-runtime-sdk . - case $? in - 0) - if [ "${AUTO_UPGRADE}" != "true" ]; then - echo "No updates available." - fi - ;; - ${UPDATED_FILES_RETURNCODE}) - echo - cd "${ORIG_PWD}" - exec "$0" --relaunch --host="${HOST_ARCH}" --target="${TARGET_ARCH}" --${RUNTIME_FLAVOR} "${ARGS[@]}" - ;; - esac - echo -fi - -# Update tools -if [ "${AUTO_UPGRADE}" = "true" ]; then - response=y -else - echo "======================================" - read -p "Update tools? [Y/n]: " response -fi -if [ "${response}" != "n" ]; then - AVAILABLE_UPDATES=false - for host_arch in ${HOST_ARCH}; do - for target_arch in ${TARGET_ARCH}; do - update_archive x-tools-${host_arch}-${target_arch} . - case $? in - 0) - ;; - *) - AVAILABLE_UPDATES=true - ;; - esac - done - done - if [ "${AVAILABLE_UPDATES}" != "true" -a "${AUTO_UPGRADE}" != "true" ]; then - echo "No updates available." - fi - echo -fi - -# Update runtime -if [ "${AUTO_UPGRADE}" = "true" ]; then - response=y -else - echo "======================================" - read -p "Update runtime? [Y/n]: " response -fi -if [ "${response}" != "n" ]; then - AVAILABLE_UPDATES=false - for target_arch in ${TARGET_ARCH}; do - mkdir -p runtime-${RUNTIME_FLAVOR} - update_archive steam-runtime-dev-${RUNTIME_FLAVOR}-${target_arch} runtime-${RUNTIME_FLAVOR} - case $? in - 0) - ;; - *) - AVAILABLE_UPDATES=true - ;; - esac - done - if [ "${AVAILABLE_UPDATES}" != "true" -a "${AUTO_UPGRADE}" != "true" ]; then - echo "No updates available." - fi - echo -fi -rm -f runtime || exit 16 -ln -s runtime-${RUNTIME_FLAVOR} runtime - -# Set up symbolic link to automatically find source when debugging -if [ "${RUNTIME_FLAVOR}" = "debug" ]; then - rm -f /tmp/source && \ - ln -sf "${TOP}/runtime-${RUNTIME_FLAVOR}/source" /tmp/source -fi - -if [ "${USE_P4}" = "true" ]; then - echo "======================================" - echo "Creating Perforce changelist..." - p4reconcile - echo -fi - -echo "======================================" -echo "Update complete!" - -# vi: ts=4 sw=4 expandtab