diff --git a/Readme.txt b/Readme.txt index 4d7e851..d8ad696 100644 --- a/Readme.txt +++ b/Readme.txt @@ -11,6 +11,19 @@ website at: http://partner.steamgames.com Revision History: +---------------------------------------------------------------- +v1.35 21st September 2015 +---------------------------------------------------------------- + +ISteamController: + * The controller API has been redesigned to work with production Steam Controllers and take advantage of the configuration panel inside of Steam. The documentation on the partner site has a full overview of the new API. + +ISteamRemoteStorage: + * Added asynchronous file read and write methods. These methods will not block your calling thread for the duration of the disk IO. Additionally, the IO is performed in a worker thread in the Steam engine, so they will not impact other Steam API calls. + - FileWriteAsync: Similar in use to FileWrite, however it returns a SteamAPICall_t handle. Use the RemoteStorageFileWriteAsyncComplete_t structure with your asynchronous Steam API handler, and that will indicate the results of the write. The data buffer passed in to FileWriteAsync is immediately copied, so you do not have to ensure it is valid throughout the entire asynchronous process. + - FileReadAsync: This function queues an asynchronous read on the file specified, and also returns a SteamAPICall_t handle. The completion event uses the new RemoteStorageFileReadAsyncComplete_t structure. Upon successful completion, you can use the new FileReadAsyncComplete function to read the data -- passing in the original call handle, a pointer to a buffer for the data, and the amount to read (which generally should be equal to the amount read as specified by the callback structure, which generally will be equal to the amount requested). Additionally, the FileReadAsync function lets you specify an offset to read at, so it is no longer necessary to read the entire file in one call. + + ---------------------------------------------------------------- v1.34 28th July 2015 ---------------------------------------------------------------- diff --git a/SteamworksExample/BaseMenu.h b/SteamworksExample/BaseMenu.h index dcdde77..5cf9545 100644 --- a/SteamworksExample/BaseMenu.h +++ b/SteamworksExample/BaseMenu.h @@ -103,39 +103,9 @@ public: // menu to "go back to main menu" you don't end up immediately registering a return in the // main menu afterwards. - bool bControllerDown = false; - bool bControllerUp = false; - bool bControllerActivate = false; - SteamControllerState_t controllerState; - - std::vector< uint32 > vecControllerUp; - std::vector< uint32 > vecControllerDown; - std::vector< uint32 > vecControllerActivate; - - for( uint32 i=0; i < MAX_STEAM_CONTROLLERS; ++i ) - { - if( SteamController()->GetControllerState( i, &controllerState ) ) - { - if ( controllerState.sLeftPadY > 10000 ) - { - vecControllerUp.push_back( i ); - bControllerUp = true; - } - else if ( controllerState.sLeftPadY < -10000 ) - { - vecControllerDown.push_back( i ); - bControllerDown = true; - } - if ( controllerState.ulButtons & STEAM_BUTTON_LEFTPAD_CLICKED_MASK ) - { - vecControllerActivate.push_back( i ); - bControllerActivate = true; - } - } - } - // check if the enter key is down, if it is take action - if ( m_pGameEngine->BIsKeyDown( VK_RETURN ) || bControllerActivate ) + if ( m_pGameEngine->BIsKeyDown( VK_RETURN ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_MenuSelect ) ) { uint64 ulCurrentTickCount = m_pGameEngine->GetGameTickCount(); if ( ulCurrentTickCount - 220 > g_ulLastReturnKeyTick ) @@ -143,23 +113,18 @@ public: g_ulLastReturnKeyTick = ulCurrentTickCount; if ( m_uSelectedItem < m_VecMenuItems.size() ) { - for( std::vector< uint32 >::iterator iter = vecControllerActivate.begin(); iter != vecControllerActivate.end(); ++iter ) - SteamController()->TriggerHapticPulse( *iter, k_ESteamControllerPad_Left, 1400 ); - SpaceWarClient()->OnMenuSelection( m_VecMenuItems[m_uSelectedItem].second ); return; } } } // Check if we need to change the selected menu item - else if ( m_pGameEngine->BIsKeyDown( VK_DOWN ) || bControllerDown ) + else if ( m_pGameEngine->BIsKeyDown( VK_DOWN ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_MenuDown ) ) { uint64 ulCurrentTickCount = m_pGameEngine->GetGameTickCount(); if ( ulCurrentTickCount - 140 > g_ulLastKeyDownTick ) { - for( std::vector< uint32 >::iterator iter = vecControllerDown.begin(); iter != vecControllerDown.end(); ++iter ) - SteamController()->TriggerHapticPulse( *iter, k_ESteamControllerPad_Left, 500 ); - g_ulLastKeyDownTick = ulCurrentTickCount; if ( m_uSelectedItem < m_VecMenuItems.size() - 1 ) m_uSelectedItem++; @@ -167,14 +132,12 @@ public: m_uSelectedItem = 0; } } - else if ( m_pGameEngine->BIsKeyDown( VK_UP ) || bControllerUp ) + else if ( m_pGameEngine->BIsKeyDown( VK_UP ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_MenuUp ) ) { uint64 ulCurrentTickCount = m_pGameEngine->GetGameTickCount(); if ( ulCurrentTickCount - 140 > g_ulLastKeyUpTick ) { - for( std::vector< uint32 >::iterator iter = vecControllerUp.begin(); iter != vecControllerUp.end(); ++iter ) - SteamController()->TriggerHapticPulse( *iter, k_ESteamControllerPad_Left, 500 ); - g_ulLastKeyUpTick = ulCurrentTickCount; if ( m_uSelectedItem > 0 ) m_uSelectedItem--; diff --git a/SteamworksExample/GameEngine.h b/SteamworksExample/GameEngine.h index 5a9886c..01502b9 100644 --- a/SteamworksExample/GameEngine.h +++ b/SteamworksExample/GameEngine.h @@ -45,6 +45,42 @@ enum ETEXTUREFORMAT eTextureFormat_BGRA16, // 16 bits per channel }; +#define MAX_CONTROLLERS 4 + +enum ECONTROLLERDIGITALACTION +{ + eControllerDigitalAction_TurnLeft, + eControllerDigitalAction_TurnRight, + eControllerDigitalAction_ForwardThrust, + eControllerDigitalAction_ReverseThrust, + eControllerDigitalAction_FireLasers, + eControllerDigitalAction_PauseMenu, + + eControllerDigitalAction_MenuUp, + eControllerDigitalAction_MenuDown, + eControllerDigitalAction_MenuLeft, + eControllerDigitalAction_MenuRight, + eControllerDigitalAction_MenuSelect, + eControllerDigitalAction_MenuCancel, + + eControllerDigitalAction_NumActions +}; + +enum ECONTROLLERANALOGACTION +{ + eControllerAnalogAction_AnalogControls, + + eControllerAnalogAction_NumActions +}; + +enum ECONTROLLERACTIONSET +{ + eControllerActionSet_ShipControls, + eControllerActionSet_MenuControls, + + eControllerActionSet_NumSets +}; + // used for VR support namespace vr { class IVRSystem; } @@ -127,6 +163,25 @@ public: // Get the first (in some arbitrary order) key down, if any virtual bool BGetFirstKeyDown( DWORD *pdwVK ) = 0; + // Return true if there is an active Steam Controller + virtual bool BIsSteamControllerActive() = 0; + + // Get the current state of a controller action + virtual bool BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ) = 0; + + // Find an active Steam controller + virtual void FindActiveSteamController() = 0; + + // Get the current state of a controller analog action + virtual void GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ) = 0; + + // Set the current Steam Controller Action set + virtual void SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ) = 0; + + // These calls return a string describing which controller button the action is currently bound to + virtual const char *GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ) = 0; + virtual const char *GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ) = 0; + // Get current tick count for the game engine virtual uint64 GetGameTickCount() = 0; diff --git a/SteamworksExample/Main.cpp b/SteamworksExample/Main.cpp index 2c2cd24..1a3bef6 100644 --- a/SteamworksExample/Main.cpp +++ b/SteamworksExample/Main.cpp @@ -10,6 +10,7 @@ #include #else #define MAX_PATH PATH_MAX +#include #define _getcwd getcwd #endif @@ -227,12 +228,6 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) #else _snprintf( rgchFullPath, sizeof( rgchFullPath ), "%s/%s", rgchCWD, "controller.vdf" ); #endif - if( !SteamController()->Init( rgchFullPath ) ) - { - OutputDebugString( "SteamController()->Init() failed\n" ); - Alert( "Fatal Error", "Steam Controller Init failed. Is controller.vdf in the current working directory?\n" ); - return EXIT_FAILURE; - } const char *pchServerAddress, *pchLobbyID; ParseCommandLine( pchCmdLine, &pchServerAddress, &pchLobbyID ); @@ -242,22 +237,28 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) // Construct a new instance of the game engine // bugbug jmccaskey - make screen resolution dynamic, maybe take it on command line? - IGameEngine *pGameEngine = + IGameEngine *pGameEngine = #if defined(_WIN32) - new CGameEngineWin32( hInstance, nCmdShow, 1024, 768 ); + new CGameEngineWin32( hInstance, nCmdShow, 1024, 768 ); #elif defined(OSX) - CreateGameEngineOSX(); + CreateGameEngineOSX(); #elif defined(SDL) - CreateGameEngineSDL( ); + CreateGameEngineSDL( ); #else #error Need CreateGameEngine() #endif + + if ( !SteamController()->Init() ) + { + OutputDebugString( "SteamController()->Init failed.\n" ); + Alert( "Fatal Error", "SteamController()->Init failed.\n" ); + return EXIT_FAILURE; + } // This call will block and run until the game exits RunGameLoop( pGameEngine, pchServerAddress, pchLobbyID ); // Shutdown the SteamAPI - SteamController()->Shutdown(); SteamAPI_Shutdown(); // Shutdown Steam CEG diff --git a/SteamworksExample/Ship.cpp b/SteamworksExample/Ship.cpp index d4b3f90..f66a9fa 100644 --- a/SteamworksExample/Ship.cpp +++ b/SteamworksExample/Ship.cpp @@ -392,29 +392,57 @@ void CShip::RunFrame() m_SpaceWarClientUpdateData.SetTurnLeftPressed( false ); m_SpaceWarClientUpdateData.SetTurnRightPressed( false ); - if ( m_pGameEngine->BIsKeyDown( m_dwVKLeft ) ) + if ( m_pGameEngine->BIsKeyDown( m_dwVKLeft ) + || m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_TurnLeft ) ) { m_SpaceWarClientUpdateData.SetTurnLeftPressed( true ); } - if ( m_pGameEngine->BIsKeyDown( m_dwVKRight ) ) + if ( m_pGameEngine->BIsKeyDown( m_dwVKRight ) + || m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_TurnRight ) ) { m_SpaceWarClientUpdateData.SetTurnRightPressed( true ); } + + // The Steam Controller can also map an anlog axis to thrust and steer + float fTurnSpeed, fUnused; + m_pGameEngine->GetControllerAnalogAction( eControllerAnalogAction_AnalogControls, &fTurnSpeed, &fUnused ); + + if ( fTurnSpeed > 0.0f ) + { + m_SpaceWarClientUpdateData.SetTurnRightPressed( true ); + m_SpaceWarClientUpdateData.SetTurnSpeed( fTurnSpeed ); + } + else if ( fTurnSpeed < 0.0f ) + { + m_SpaceWarClientUpdateData.SetTurnLeftPressed( true ); + m_SpaceWarClientUpdateData.SetTurnSpeed( fTurnSpeed ); + } } else if ( m_bIsServerInstance ) { // Server side + const float fMaxTurnSpeed = (PI_VALUE / 2.0f) * (float)m_pGameEngine->GetGameTicksFrameDelta( ) / 400.0f; + float flRotationDelta = 0.0f; - if ( m_SpaceWarClientUpdateData.GetTurnLeftPressed() ) + float fTurnSpeed = m_SpaceWarClientUpdateData.GetTurnSpeed(); + if ( fTurnSpeed != 0.0f ) { - flRotationDelta += (PI_VALUE/2.0f) * -1.0f * (float)m_pGameEngine->GetGameTicksFrameDelta()/400.0f; + flRotationDelta += fMaxTurnSpeed * fTurnSpeed; + } + else + { + if ( m_SpaceWarClientUpdateData.GetTurnLeftPressed( ) ) + { + flRotationDelta += -1.0f * fMaxTurnSpeed; + } + + if ( m_SpaceWarClientUpdateData.GetTurnRightPressed( ) ) + { + flRotationDelta += fMaxTurnSpeed; + } } - if ( m_SpaceWarClientUpdateData.GetTurnRightPressed() ) - { - flRotationDelta += (PI_VALUE/2.0f) * (float)m_pGameEngine->GetGameTicksFrameDelta()/400.0f; - } SetRotationDeltaNextFrame( flRotationDelta ); } @@ -424,18 +452,35 @@ void CShip::RunFrame() // client side m_SpaceWarClientUpdateData.SetReverseThrustersPressed( false ); m_SpaceWarClientUpdateData.SetForwardThrustersPressed( false ); - if ( m_pGameEngine->BIsKeyDown( m_dwVKForwardThrusters ) || m_pGameEngine->BIsKeyDown( m_dwVKReverseThrusters ) ) + + if ( m_pGameEngine->BIsKeyDown( m_dwVKForwardThrusters ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_ForwardThrust ) ) { - if ( m_pGameEngine->BIsKeyDown( m_dwVKReverseThrusters ) ) - { - m_SpaceWarClientUpdateData.SetReverseThrustersPressed( true ); - } - else - { - m_SpaceWarClientUpdateData.SetForwardThrustersPressed( true ); - } + m_SpaceWarClientUpdateData.SetForwardThrustersPressed( true ); } + if ( m_pGameEngine->BIsKeyDown( m_dwVKReverseThrusters ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_ReverseThrust ) ) + { + m_SpaceWarClientUpdateData.SetReverseThrustersPressed( true ); + } + + // The Steam Controller can also map an anlog axis to thrust and steer + float fThrusterLevel, fUnused; + m_pGameEngine->GetControllerAnalogAction( eControllerAnalogAction_AnalogControls, &fUnused, &fThrusterLevel ); + + if ( fThrusterLevel > 0.0f ) + { + m_SpaceWarClientUpdateData.SetForwardThrustersPressed( true ); + m_SpaceWarClientUpdateData.SetThrustersLevel( fThrusterLevel ); + } + else if ( fThrusterLevel < 0.0f ) + { + m_SpaceWarClientUpdateData.SetReverseThrustersPressed( true ); + m_SpaceWarClientUpdateData.SetThrustersLevel( fThrusterLevel ); + } + + // Hardcoded keys to choose various outfits and weapon powerups which require inventory. Note that this is not // a "secure" multiplayer model - clients can lie about what they own. A more robust solution, if your items // matter enough to bother, would be to use SerializeResult / DeserializeResult to encode the fact that your @@ -502,6 +547,12 @@ void CShip::RunFrame() m_bForwardThrustersActive = true; } + float fThrusterLevel = m_SpaceWarClientUpdateData.GetThrustersLevel(); + if ( fThrusterLevel != 0.0f ) + { + flSign = fThrusterLevel; + } + if ( m_ulLastThrustStartedTickCount == 0 ) m_ulLastThrustStartedTickCount = ulCurrentTickCount; @@ -528,7 +579,8 @@ void CShip::RunFrame() if ( m_bIsLocalPlayer ) { // client side - if ( m_pGameEngine->BIsKeyDown( m_dwVKFire ) ) + if ( m_pGameEngine->BIsKeyDown( m_dwVKFire ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_FireLasers ) ) { m_SpaceWarClientUpdateData.SetFirePressed( true ); } diff --git a/SteamworksExample/Ship.h b/SteamworksExample/Ship.h index 39237d9..a670318 100644 --- a/SteamworksExample/Ship.h +++ b/SteamworksExample/Ship.h @@ -199,6 +199,10 @@ private: // Thrusters for this ship CReverseThrusters m_ReverseThrusters; + // Thrust and rotation speed can be anlog when using a Steam Controller + float m_fThrusterLevel; + float m_fTurnSpeed; + // Track whether to draw the thrusters next render call bool m_bReverseThrustersActive; diff --git a/SteamworksExample/SpaceWar.h b/SteamworksExample/SpaceWar.h index a84e851..015023c 100644 --- a/SteamworksExample/SpaceWar.h +++ b/SteamworksExample/SpaceWar.h @@ -294,6 +294,12 @@ struct ServerShipUpdateData_t void SetShieldStrength( int nShieldStrength ) { m_nShieldStrength = nShieldStrength; } int GetShieldStrength() { return m_nShieldStrength; } + void SetThrustersLevel( float fLevel ) { m_fThrusterLevel = fLevel; } + float GetThrustersLevel( ) { return m_fThrusterLevel; } + + void SetTurnSpeed( float fSpeed ) { m_fTurnSpeed = fSpeed; } + float GetTurnSpeed( ) { return m_fTurnSpeed; } + ServerPhotonBeamUpdateData_t *AccessPhotonBeamData( int iIndex ) { return &m_PhotonBeamData[iIndex]; } private: @@ -337,6 +343,10 @@ private: // Photon beam positions and data ServerPhotonBeamUpdateData_t m_PhotonBeamData[MAX_PHOTON_BEAMS_PER_SHIP]; + + // Thrust and rotation speed can be anlog when using a Steam Controller + float m_fThrusterLevel; + float m_fTurnSpeed; }; @@ -414,6 +424,12 @@ struct ClientSpaceWarUpdateData_t void SetShieldStrength( int nShieldPower ) { m_nShieldStrength = nShieldPower; } int GetShieldStrength() { return m_nShieldStrength; } + void SetThrustersLevel( float fLevel ) { m_fThrusterLevel = fLevel; } + float GetThrustersLevel( ) { return m_fThrusterLevel; } + + void SetTurnSpeed( float fSpeed ) { m_fTurnSpeed = fSpeed; } + float GetTurnSpeed( ) { return m_fTurnSpeed; } + private: // Key's which are done bool m_bFirePressed; @@ -436,6 +452,10 @@ private: // Name of the player (needed server side to tell master server about) // bugbug jmccaskey - Really lame to send this every update instead of event driven... char m_rgchPlayerName[64]; + + // Thrust and rotation speed can be anlog when using a Steam Controller + float m_fThrusterLevel; + float m_fTurnSpeed; }; #pragma pack( pop ) diff --git a/SteamworksExample/SpaceWarClient.cpp b/SteamworksExample/SpaceWarClient.cpp index 082e8f9..a6bf934 100644 --- a/SteamworksExample/SpaceWarClient.cpp +++ b/SteamworksExample/SpaceWarClient.cpp @@ -28,6 +28,7 @@ #include #else #define MAX_PATH PATH_MAX +#include #define _getcwd getcwd #endif @@ -43,19 +44,7 @@ CSpaceWarClient* SpaceWarClient() { return g_pSpaceWarClient; } //----------------------------------------------------------------------------- // Purpose: Constructor //----------------------------------------------------------------------------- -CSpaceWarClient::CSpaceWarClient( IGameEngine *pGameEngine ) : - m_CallbackP2PSessionConnectFail( this, &CSpaceWarClient::OnP2PSessionConnectFail ), - m_LobbyGameCreated( this, &CSpaceWarClient::OnLobbyGameCreated ), - m_AvatarImageLoadedCreated( this, &CSpaceWarClient::OnAvatarImageLoaded ), - m_IPCFailureCallback( this, &CSpaceWarClient::OnIPCFailure ), - m_SteamShutdownCallback( this, &CSpaceWarClient::OnSteamShutdown ), - m_SteamServersConnected( this, &CSpaceWarClient::OnSteamServersConnected ), - m_SteamServersDisconnected( this, &CSpaceWarClient::OnSteamServersDisconnected ), - m_SteamServerConnectFailure( this, &CSpaceWarClient::OnSteamServerConnectFailure ), - m_GameJoinRequested( this, &CSpaceWarClient::OnGameJoinRequested ), - m_CallbackGameOverlayActivated( this, &CSpaceWarClient::OnGameOverlayActivated ), - m_CallbackGameWebCallback( this, &CSpaceWarClient::OnGameWebCallback ), - m_CallbackWorkshopItemInstalled( this, &CSpaceWarClient::OnWorkshopItemInstalled ) +CSpaceWarClient::CSpaceWarClient( IGameEngine *pGameEngine ) { Init( pGameEngine ); } @@ -84,7 +73,6 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine ) } #endif - m_bLastControllerStateInMenu = false; g_pSpaceWarClient = this; m_pGameEngine = pGameEngine; m_uPlayerWhoWonGame = 0; @@ -1175,7 +1163,8 @@ void CSpaceWarClient::RunFrame() // Check if escape has been pressed, we'll use that info in a couple places below bool bEscapePressed = false; - if ( m_pGameEngine->BIsKeyDown( VK_ESCAPE ) ) + if ( m_pGameEngine->BIsKeyDown( VK_ESCAPE ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_PauseMenu ) ) { static uint64 m_ulLastESCKeyTick = 0; uint64 ulCurrentTickCount = m_pGameEngine->GetGameTickCount(); @@ -1199,36 +1188,14 @@ void CSpaceWarClient::RunFrame() OnGameStateChanged( m_eGameState ); } - bool bInMenuNow = false; - switch( m_eGameState ) - { - case k_EClientGameMenu: - case k_EClientGameQuitMenu: - bInMenuNow = true; - break; - default: - bInMenuNow = false; - break; - } - - // Update steam controller override mode appropriately - if ( bInMenuNow && !m_bLastControllerStateInMenu ) - { - m_bLastControllerStateInMenu = true; - SteamController()->SetOverrideMode( "menu" ); - } - else if ( !bInMenuNow && m_bLastControllerStateInMenu ) - { - m_bLastControllerStateInMenu = false; - SteamController()->SetOverrideMode( "" ); - } - // Update state for everything switch ( m_eGameState ) { case k_EClientConnectingToSteam: m_pStarField->Render(); m_pConnectingMenu->RunFrame(); + // Make sure the Steam Controller is in the correct mode. + m_pGameEngine->SetSteamControllerActionSet( eControllerActionSet_MenuControls ); break; case k_EClientRetrySteamConnection: #ifdef _PS3 @@ -1263,6 +1230,8 @@ void CSpaceWarClient::RunFrame() case k_EClientGameMenu: m_pStarField->Render(); m_pMainMenu->RunFrame(); + // Make sure the Steam Controller is in the correct mode. + m_pGameEngine->SetSteamControllerActionSet( eControllerActionSet_MenuControls ); break; case k_EClientFindInternetServers: case k_EClientFindLANServers: @@ -1353,6 +1322,9 @@ void CSpaceWarClient::RunFrame() // Now draw the menu m_pQuitMenu->RunFrame(); + + // Make sure the Steam Controller is in the correct mode. + m_pGameEngine->SetSteamControllerActionSet( eControllerActionSet_MenuControls ); break; case k_EClientGameInstructions: m_pStarField->Render(); @@ -1461,6 +1433,9 @@ void CSpaceWarClient::RunFrame() break; case k_EClientGameActive: + // Make sure the Steam Controller is in the correct mode. + m_pGameEngine->SetSteamControllerActionSet( eControllerActionSet_ShipControls ); + m_pStarField->Render(); // SendHeartbeat is safe to call on every frame since the API is internally rate-limited. @@ -1749,6 +1724,31 @@ void CSpaceWarClient::DrawHUDText() break; } } + + // Draw a Steam Controller tooltip + if ( m_pGameEngine->BIsSteamControllerActive( ) ) + { + char rgchHint[128]; + const char *rgchFireOrigin = m_pGameEngine->GetTextStringForControllerOriginDigital( eControllerActionSet_ShipControls, eControllerDigitalAction_FireLasers ); + + if ( strcmp( rgchFireOrigin, "None" ) == 0 ) + { + sprintf_safe( rgchHint, "No Fire action bound." ); + } + else + { + sprintf_safe( rgchHint, "Press '%s' to Fire", rgchFireOrigin ); + } + + RECT rect; + int nBorder = 30; + rect.top = m_pGameEngine->GetViewportHeight( ) - nBorder; + rect.bottom = m_pGameEngine->GetViewportHeight( )*2; + rect.left = nBorder; + rect.right = m_pGameEngine->GetViewportWidth( ); + m_pGameEngine->BDrawString( m_hHUDFont, rect, D3DCOLOR_ARGB( 255, 255, 255, 255 ), TEXTPOS_LEFT | TEXTPOS_TOP, rgchHint ); + } + } diff --git a/SteamworksExample/SpaceWarClient.h b/SteamworksExample/SpaceWarClient.h index 033eac7..cfe9c44 100644 --- a/SteamworksExample/SpaceWarClient.h +++ b/SteamworksExample/SpaceWarClient.h @@ -410,21 +410,21 @@ private: CCallResult m_SteamCallResultLobbyEntered; // callback for when the lobby game server has started - STEAM_CALLBACK( CSpaceWarClient, OnLobbyGameCreated, LobbyGameCreated_t, m_LobbyGameCreated ); - STEAM_CALLBACK( CSpaceWarClient, OnGameJoinRequested, GameRichPresenceJoinRequested_t, m_GameJoinRequested ); - STEAM_CALLBACK( CSpaceWarClient, OnAvatarImageLoaded, AvatarImageLoaded_t, m_AvatarImageLoadedCreated ); + STEAM_CALLBACK( CSpaceWarClient, OnLobbyGameCreated, LobbyGameCreated_t ); + STEAM_CALLBACK( CSpaceWarClient, OnGameJoinRequested, GameRichPresenceJoinRequested_t ); + STEAM_CALLBACK( CSpaceWarClient, OnAvatarImageLoaded, AvatarImageLoaded_t ); // callbacks for Steam connection state - STEAM_CALLBACK( CSpaceWarClient, OnSteamServersConnected, SteamServersConnected_t, m_SteamServersConnected ); - STEAM_CALLBACK( CSpaceWarClient, OnSteamServersDisconnected, SteamServersDisconnected_t, m_SteamServersDisconnected ); - STEAM_CALLBACK( CSpaceWarClient, OnSteamServerConnectFailure, SteamServerConnectFailure_t, m_SteamServerConnectFailure ); - STEAM_CALLBACK( CSpaceWarClient, OnGameOverlayActivated, GameOverlayActivated_t, m_CallbackGameOverlayActivated ); + STEAM_CALLBACK( CSpaceWarClient, OnSteamServersConnected, SteamServersConnected_t ); + STEAM_CALLBACK( CSpaceWarClient, OnSteamServersDisconnected, SteamServersDisconnected_t ); + STEAM_CALLBACK( CSpaceWarClient, OnSteamServerConnectFailure, SteamServerConnectFailure_t ); + STEAM_CALLBACK( CSpaceWarClient, OnGameOverlayActivated, GameOverlayActivated_t ); // callback when getting the results of a web call - STEAM_CALLBACK( CSpaceWarClient, OnGameWebCallback, GameWebCallback_t, m_CallbackGameWebCallback ); + STEAM_CALLBACK( CSpaceWarClient, OnGameWebCallback, GameWebCallback_t ); // callback when new Workshop item was installed - STEAM_CALLBACK(CSpaceWarClient, OnWorkshopItemInstalled, ItemInstalled_t, m_CallbackWorkshopItemInstalled); + STEAM_CALLBACK(CSpaceWarClient, OnWorkshopItemInstalled, ItemInstalled_t); // lobby browser menu CLobbyBrowser *m_pLobbyBrowser; @@ -442,19 +442,17 @@ private: CHTMLSurface *m_pHTMLSurface; // connection handler - STEAM_CALLBACK( CSpaceWarClient, OnP2PSessionConnectFail, P2PSessionConnectFail_t, m_CallbackP2PSessionConnectFail ); + STEAM_CALLBACK( CSpaceWarClient, OnP2PSessionConnectFail, P2PSessionConnectFail_t ); // ipc failure handler - STEAM_CALLBACK( CSpaceWarClient, OnIPCFailure, IPCFailure_t, m_IPCFailureCallback ); + STEAM_CALLBACK( CSpaceWarClient, OnIPCFailure, IPCFailure_t ); // Steam wants to shut down, Game for Windows applications should shutdown too - STEAM_CALLBACK( CSpaceWarClient, OnSteamShutdown, SteamShutdown_t, m_SteamShutdownCallback ); + STEAM_CALLBACK( CSpaceWarClient, OnSteamShutdown, SteamShutdown_t ); // Called when SteamUser()->RequestEncryptedAppTicket() returns asynchronously void OnRequestEncryptedAppTicket( EncryptedAppTicketResponse_t *pEncryptedAppTicketResponse, bool bIOFailure ); CCallResult< CSpaceWarClient, EncryptedAppTicketResponse_t > m_SteamCallResultEncryptedAppTicket; - - bool m_bLastControllerStateInMenu; }; // Must define this stuff before BaseMenu.h as it depends on calling back into us through these accessors diff --git a/SteamworksExample/SpaceWarServer.cpp b/SteamworksExample/SpaceWarServer.cpp index 562f204..01b625a 100644 --- a/SteamworksExample/SpaceWarServer.cpp +++ b/SteamworksExample/SpaceWarServer.cpp @@ -21,14 +21,6 @@ extern SteamPS3Params_t g_SteamPS3Params; // Purpose: Constructor -- note the syntax for setting up Steam API callback handlers //----------------------------------------------------------------------------- CSpaceWarServer::CSpaceWarServer( IGameEngine *pGameEngine ) -: - m_CallbackSteamServersConnected( this, &CSpaceWarServer::OnSteamServersConnected ), - m_CallbackSteamServersDisconnected( this, &CSpaceWarServer::OnSteamServersDisconnected ), - m_CallbackSteamServersConnectFailure( this, &CSpaceWarServer::OnSteamServersConnectFailure ), - m_CallbackPolicyResponse( this, &CSpaceWarServer::OnPolicyResponse ), - m_CallbackGSAuthTicketResponse( this, &CSpaceWarServer::OnValidateAuthTicketResponse ), - m_CallbackP2PSessionConnectFail( this, &CSpaceWarServer::OnP2PSessionConnectFail ), - m_CallbackP2PSessionRequest( this, &CSpaceWarServer::OnP2PSessionRequest ) { m_bConnectedToSteam = false; diff --git a/SteamworksExample/SpaceWarServer.h b/SteamworksExample/SpaceWarServer.h index a870a2a..38d0503 100644 --- a/SteamworksExample/SpaceWarServer.h +++ b/SteamworksExample/SpaceWarServer.h @@ -65,16 +65,16 @@ private: // Tells us when we have successfully connected to Steam - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnSteamServersConnected, SteamServersConnected_t, m_CallbackSteamServersConnected ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnSteamServersConnected, SteamServersConnected_t ); // Tells us when there was a failure to connect to Steam - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnSteamServersConnectFailure, SteamServerConnectFailure_t, m_CallbackSteamServersConnectFailure ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnSteamServersConnectFailure, SteamServerConnectFailure_t ); // Tells us when we have been logged out of Steam - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnSteamServersDisconnected, SteamServersDisconnected_t, m_CallbackSteamServersDisconnected ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnSteamServersDisconnected, SteamServersDisconnected_t ); // Tells us that Steam has set our security policy (VAC on or off) - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnPolicyResponse, GSPolicyResponse_t, m_CallbackPolicyResponse ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnPolicyResponse, GSPolicyResponse_t ); // // Various callback functions that Steam will call to let us know about whether we should @@ -82,11 +82,11 @@ private: // // Tells us a client has been authenticated and approved to play by Steam (passes auth, license check, VAC status, etc...) - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnValidateAuthTicketResponse, ValidateAuthTicketResponse_t, m_CallbackGSAuthTicketResponse ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnValidateAuthTicketResponse, ValidateAuthTicketResponse_t ); // client connection state - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnP2PSessionRequest, P2PSessionRequest_t, m_CallbackP2PSessionRequest ); - STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnP2PSessionConnectFail, P2PSessionConnectFail_t, m_CallbackP2PSessionConnectFail ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnP2PSessionRequest, P2PSessionRequest_t ); + STEAM_GAMESERVER_CALLBACK( CSpaceWarServer, OnP2PSessionConnectFail, P2PSessionConnectFail_t ); // Function to tell Steam about our servers details void SendUpdatedServerDetailsToSteam(); diff --git a/client/steam.exe b/client/steam.exe index 990bb66..34db28d 100644 Binary files a/client/steam.exe and b/client/steam.exe differ diff --git a/glmgr/cglmtex.h b/glmgr/cglmtex.h index 3047037..13d7a0e 100644 --- a/glmgr/cglmtex.h +++ b/glmgr/cglmtex.h @@ -101,7 +101,7 @@ struct GLMTexLayoutKey struct LessThan_GLMTexLayoutKey { - bool operator()(const GLMTexLayoutKey &a, const GLMTexLayoutKey &b) + bool operator()(const GLMTexLayoutKey &a, const GLMTexLayoutKey &b) const { #define DO_LESS(fff) if (a.fff != b.fff) { return (a.fff< b.fff); } diff --git a/public/steam/isteamcontroller.h b/public/steam/isteamcontroller.h index 5c3d01a..a973696 100644 --- a/public/steam/isteamcontroller.h +++ b/public/steam/isteamcontroller.h @@ -12,67 +12,19 @@ #include "isteamclient.h" -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif +#define STEAM_CONTROLLER_MAX_COUNT 16 -#define MAX_STEAM_CONTROLLERS 16 +#define STEAM_CONTROLLER_MAX_ANALOG_ACTIONS 16 -#pragma pack( pop ) +#define STEAM_CONTROLLER_MAX_DIGITAL_ACTIONS 32 -#define STEAM_RIGHT_TRIGGER_MASK 0x0000001 -#define STEAM_LEFT_TRIGGER_MASK 0x0000002 -#define STEAM_RIGHT_BUMPER_MASK 0x0000004 -#define STEAM_LEFT_BUMPER_MASK 0x0000008 -#define STEAM_BUTTON_0_MASK 0x0000010 -#define STEAM_BUTTON_1_MASK 0x0000020 -#define STEAM_BUTTON_2_MASK 0x0000040 -#define STEAM_BUTTON_3_MASK 0x0000080 -#define STEAM_TOUCH_0_MASK 0x0000100 -#define STEAM_TOUCH_1_MASK 0x0000200 -#define STEAM_TOUCH_2_MASK 0x0000400 -#define STEAM_TOUCH_3_MASK 0x0000800 -#define STEAM_BUTTON_MENU_MASK 0x0001000 -#define STEAM_BUTTON_STEAM_MASK 0x0002000 -#define STEAM_BUTTON_ESCAPE_MASK 0x0004000 -#define STEAM_BUTTON_BACK_LEFT_MASK 0x0008000 -#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0010000 -#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0020000 -#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0040000 -#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0080000 -#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0100000 -#define STEAM_JOYSTICK_BUTTON_MASK 0x0400000 +#define STEAM_CONTROLLER_MAX_ORIGINS 8 +// When sending an option to a specific controller handle, you can send to all controllers via this command +#define STEAM_CONTROLLER_HANDLE_ALL_CONTROLLERS UINT64_MAX -#pragma pack( push, 1 ) - -struct SteamControllerState001_t -{ - // If packet num matches that on your prior call, then the controller state hasn't been changed since - // your last call and there is no need to process it - uint32 unPacketNum; - - // bit flags for each of the buttons - uint64 ulButtons; - - // Left pad coordinates - short sLeftPadX; - short sLeftPadY; - - // Right pad coordinates - short sRightPadX; - short sRightPadY; - -}; - -#pragma pack( pop ) - -#define SteamControllerState_t SteamControllerState001_t +#define STEAM_CONTROLLER_MIN_ANALOG_ACTION_DATA -1.0f +#define STEAM_CONTROLLER_MAX_ANALOG_ACTION_DATA 1.0f enum ESteamControllerPad { @@ -80,59 +32,179 @@ enum ESteamControllerPad k_ESteamControllerPad_Right }; +enum EControllerSource +{ + k_EControllerSource_None, + k_EControllerSource_LeftTrackpad, + k_EControllerSource_RightTrackpad, + k_EControllerSource_Joystick, + k_EControllerSource_ABXY, + k_EControllerSource_Switch, + k_EControllerSource_LeftTrigger, + k_EControllerSource_RightTrigger, + k_EControllerSource_Gyro +}; + +enum EControllerSourceMode +{ + k_EControllerSourceMode_None, + k_EControllerSourceMode_Dpad, + k_EControllerSourceMode_Buttons, + k_EControllerSourceMode_FourButtons, + k_EControllerSourceMode_AbsoluteMouse, + k_EControllerSourceMode_RelativeMouse, + k_EControllerSourceMode_JoystickMove, + k_EControllerSourceMode_JoystickCamera, + k_EControllerSourceMode_ScrollWheel, + k_EControllerSourceMode_Trigger, + k_EControllerSourceMode_TouchMenu +}; + +enum EControllerActionOrigin +{ + k_EControllerActionOrigin_None, + k_EControllerActionOrigin_A, + k_EControllerActionOrigin_B, + k_EControllerActionOrigin_X, + k_EControllerActionOrigin_Y, + k_EControllerActionOrigin_LeftBumper, + k_EControllerActionOrigin_RightBumper, + k_EControllerActionOrigin_LeftGrip, + k_EControllerActionOrigin_RightGrip, + k_EControllerActionOrigin_Start, + k_EControllerActionOrigin_Back, + k_EControllerActionOrigin_LeftPad_Touch, + k_EControllerActionOrigin_LeftPad_Swipe, + k_EControllerActionOrigin_LeftPad_Click, + k_EControllerActionOrigin_LeftPad_DPadNorth, + k_EControllerActionOrigin_LeftPad_DPadSouth, + k_EControllerActionOrigin_LeftPad_DPadWest, + k_EControllerActionOrigin_LeftPad_DPadEast, + k_EControllerActionOrigin_RightPad_Touch, + k_EControllerActionOrigin_RightPad_Swipe, + k_EControllerActionOrigin_RightPad_Click, + k_EControllerActionOrigin_RightPad_DPadNorth, + k_EControllerActionOrigin_RightPad_DPadSouth, + k_EControllerActionOrigin_RightPad_DPadWest, + k_EControllerActionOrigin_RightPad_DPadEast, + k_EControllerActionOrigin_LeftTrigger_Pull, + k_EControllerActionOrigin_LeftTrigger_Click, + k_EControllerActionOrigin_RightTrigger_Pull, + k_EControllerActionOrigin_RightTrigger_Click, + k_EControllerActionOrigin_LeftStick_Move, + k_EControllerActionOrigin_LeftStick_Click, + k_EControllerActionOrigin_LeftStick_DPadNorth, + k_EControllerActionOrigin_LeftStick_DPadSouth, + k_EControllerActionOrigin_LeftStick_DPadWest, + k_EControllerActionOrigin_LeftStick_DPadEast, + k_EControllerActionOrigin_Gyro_Move, + k_EControllerActionOrigin_Gyro_Pitch, + k_EControllerActionOrigin_Gyro_Yaw, + k_EControllerActionOrigin_Gyro_Roll, + + k_EControllerActionOrigin_Count +}; + +// ControllerHandle_t is used to refer to a specific controller. +// This handle will consistently identify a controller, even if it is disconnected and re-connected +typedef uint64 ControllerHandle_t; + + +// These handles are used to refer to a specific in-game action or action set +// All action handles should be queried during initialization for performance reasons +typedef uint64 ControllerActionSetHandle_t; +typedef uint64 ControllerDigitalActionHandle_t; +typedef uint64 ControllerAnalogActionHandle_t; + +#pragma pack( push, 1 ) + +struct ControllerAnalogActionData_t +{ + // Type of data coming from this action, this will match what got specified in the action set + EControllerSourceMode eMode; + + // The current state of this action; will be delta updates for mouse actions + float x, y; + + // Whether or not this action is currently available to be bound in the active action set + bool bActive; +}; + +struct ControllerDigitalActionData_t +{ + // The current state of this action; will be true if currently pressed + bool bState; + + // Whether or not this action is currently available to be bound in the active action set + bool bActive; +}; + +#pragma pack( pop ) + + //----------------------------------------------------------------------------- // Purpose: Native Steam controller support API //----------------------------------------------------------------------------- class ISteamController { public: - - // - // Native controller support API - // - - // Must call init and shutdown when starting/ending use of the interface - virtual bool Init( const char *pchAbsolutePathToControllerConfigVDF ) = 0; + + // Init and Shutdown must be called when starting/ending use of this interface + virtual bool Init() = 0; virtual bool Shutdown() = 0; - - // Pump callback/callresult events, SteamAPI_RunCallbacks will do this for you, - // normally never need to call directly. + + // Pump callback/callresult events + // Note: SteamAPI_RunCallbacks will do this for you, so you should never need to call this directly. virtual void RunFrame() = 0; - // Get the state of the specified controller, returns false if that controller is not connected - virtual bool GetControllerState( uint32 unControllerIndex, SteamControllerState_t *pState ) = 0; - - // Trigger a haptic pulse on the controller - virtual void TriggerHapticPulse( uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; - - // Set the override mode which is used to choose to use different base/legacy bindings from your config file - virtual void SetOverrideMode( const char *pchMode ) = 0; -}; - -#define STEAMCONTROLLER_INTERFACE_VERSION "STEAMCONTROLLER_INTERFACE_VERSION" - -// callbacks -#if defined( VALVE_CALLBACK_PACK_SMALL ) -#pragma pack( push, 4 ) -#elif defined( VALVE_CALLBACK_PACK_LARGE ) -#pragma pack( push, 8 ) -#else -#error isteamclient.h must be included -#endif - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -/* -struct ControllerCallback_t -{ - enum { k_iCallback = k_iSteamControllerCallbacks + 1 }; + // Enumerate currently connected controllers + // handlesOut should point to a STEAM_CONTROLLER_MAX_COUNT sized array of ControllerHandle_t handles + // Returns the number of handles written to handlesOut + virtual int GetConnectedControllers( ControllerHandle_t *handlesOut ) = 0; + // Invokes the Steam overlay and brings up the binding screen + // Returns false is overlay is disabled / unavailable, or the user is not in Big Picture mode + virtual bool ShowBindingPanel( ControllerHandle_t controllerHandle ) = 0; + + // ACTION SETS + // Lookup the handle for an Action Set. Best to do this once on startup, and store the handles for all future API calls. + virtual ControllerActionSetHandle_t GetActionSetHandle( const char *pszActionSetName ) = 0; + + // Reconfigure the controller to use the specified action set (ie 'Menu', 'Walk' or 'Drive') + // This is cheap, and can be safely called repeatedly. It's often easier to repeatedly call it in + // your state loops, instead of trying to place it in all of your state transitions. + virtual void ActivateActionSet( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle ) = 0; + virtual ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle ) = 0; + + // ACTIONS + // Lookup the handle for a digital action. Best to do this once on startup, and store the handles for all future API calls. + virtual ControllerDigitalActionHandle_t GetDigitalActionHandle( const char *pszActionName ) = 0; + + // Returns the current state of the supplied digital game action + virtual ControllerDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle ) = 0; + + // Get the origin(s) for a digital action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action. + // originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles + virtual int GetDigitalActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin *originsOut ) = 0; + + // Lookup the handle for an analog action. Best to do this once on startup, and store the handles for all future API calls. + virtual ControllerAnalogActionHandle_t GetAnalogActionHandle( const char *pszActionName ) = 0; + + // Returns the current state of these supplied analog game action + virtual ControllerAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle ) = 0; + + // Get the origin(s) for an analog action within an action set. Returns the number of origins supplied in originsOut. Use this to display the appropriate on-screen prompt for the action. + // originsOut should point to a STEAM_CONTROLLER_MAX_ORIGINS sized array of EControllerActionOrigin handles + virtual int GetAnalogActionOrigins( ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin *originsOut ) = 0; + + + + virtual void StopAnalogActionMomentum( ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction ) = 0; + + // Trigger a haptic pulse on a controller + virtual void TriggerHapticPulse( ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec ) = 0; }; -*/ - - -#pragma pack( pop ) +#define STEAMCONTROLLER_INTERFACE_VERSION "SteamController003" #endif // ISTEAMCONTROLLER_H diff --git a/public/steam/isteamremotestorage.h b/public/steam/isteamremotestorage.h index 6853cd6..cce39df 100644 --- a/public/steam/isteamremotestorage.h +++ b/public/steam/isteamremotestorage.h @@ -176,6 +176,12 @@ class ISteamRemoteStorage // file operations virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0; virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0; + + virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0; + + virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0; + virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0; + virtual bool FileForget( const char *pchFile ) = 0; virtual bool FileDelete( const char *pchFile ) = 0; virtual SteamAPICall_t FileShare( const char *pchFile ) = 0; @@ -282,7 +288,7 @@ class ISteamRemoteStorage virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0; }; -#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION012" +#define STEAMREMOTESTORAGE_INTERFACE_VERSION "STEAMREMOTESTORAGE_INTERFACE_VERSION013" // callbacks @@ -642,7 +648,26 @@ struct RemoteStoragePublishedFileUpdated_t UGCHandle_t m_hFile; // The new content }; +//----------------------------------------------------------------------------- +// Purpose: Called when a FileWriteAsync completes +//----------------------------------------------------------------------------- +struct RemoteStorageFileWriteAsyncComplete_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 31 }; + EResult m_eResult; // result +}; +//----------------------------------------------------------------------------- +// Purpose: Called when a FileReadAsync completes +//----------------------------------------------------------------------------- +struct RemoteStorageFileReadAsyncComplete_t +{ + enum { k_iCallback = k_iClientRemoteStorageCallbacks + 32 }; + SteamAPICall_t m_hFileReadAsync; // call handle of the async read which was made + EResult m_eResult; // result + uint32 m_nOffset; // offset in the file this read was at + uint32 m_cubRead; // amount read - will the <= the amount requested +}; #pragma pack( pop ) diff --git a/public/steam/isteamugc.h b/public/steam/isteamugc.h index ca3216b..c574bf5 100644 --- a/public/steam/isteamugc.h +++ b/public/steam/isteamugc.h @@ -46,6 +46,7 @@ enum EUGCMatchingUGCType k_EUGCMatchingUGCType_UsableInGame = 10, // ready-to-use items and integrated guides k_EUGCMatchingUGCType_ControllerBindings = 11, k_EUGCMatchingUGCType_GameManagedItems = 12, // game managed items (not managed by users) + k_EUGCMatchingUGCType_All = ~0, // return everything }; // Different lists of published UGC for a user. @@ -263,6 +264,13 @@ public: // then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time. // If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP. virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0; + + // game servers can set a specific workshop folder before issuing any UGC commands. + // This is helpful if you want to support multiple game servers running out of the same install folder + virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0; + + // SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends + virtual void SuspendDownloads( bool bSuspend ) = 0; }; #define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION007" diff --git a/public/steam/isteamuser.h b/public/steam/isteamuser.h index 989b88e..5af937d 100644 --- a/public/steam/isteamuser.h +++ b/public/steam/isteamuser.h @@ -250,6 +250,7 @@ struct SteamServerConnectFailure_t { enum { k_iCallback = k_iSteamUserCallbacks + 2 }; EResult m_eResult; + bool m_bStillRetrying; }; diff --git a/public/steam/lib/linux32/libsdkencryptedappticket.so b/public/steam/lib/linux32/libsdkencryptedappticket.so index f06d4d2..be8f430 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 e916eb7..6cfe489 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/win32/sdkencryptedappticket.dll b/public/steam/lib/win32/sdkencryptedappticket.dll index 41ee38e..f855f9f 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 f865815..67a8b41 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 84aa110..c58fea3 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 0600709..3829361 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 20f7afc..f387250 100644 --- a/public/steam/steam_api.h +++ b/public/steam/steam_api.h @@ -137,31 +137,56 @@ S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender(); #endif #endif // VERSION_SAFE_STEAM_API_INTERFACES + //----------------------------------------------------------------------------------------------------------------------------------------------------------// -// steam callback helper functions +// steam callback and call-result helpers // -// The following classes/macros are used to be able to easily multiplex callbacks -// from the Steam API into various objects in the app in a thread-safe manner +// The following macros and classes are used to register your application for +// callbacks and call-results, which are delivered in a predictable manner. // -// These functors are triggered via the SteamAPI_RunCallbacks() function, mapping the callback -// to as many functions/objects as are registered to it +// STEAM_CALLBACK macros are meant for use inside of a C++ class definition. +// They map a Steam notification callback directly to a class member function +// which is automatically prototyped as "void func( callback_type *pParam )". +// +// CCallResult is used with specific Steam APIs that return "result handles". +// The handle can be passed to a CCallResult object's Set function, along with +// an object pointer and member-function pointer. The member function will +// be executed once the results of the Steam API call are available. +// +// CCallback and CCallbackManual classes can be used instead of STEAM_CALLBACK +// macros if you require finer control over registration and unregistration. +// +// Callbacks and call-results are queued automatically and are only +// delivered/executed when your application calls SteamAPI_RunCallbacks(). //----------------------------------------------------------------------------------------------------------------------------------------------------------// S_API void S_CALLTYPE SteamAPI_RunCallbacks(); -// functions used by the utility CCallback objects to receive callbacks +// Declares a callback member function plus a helper member variable which +// registers the callback on object creation and unregisters on destruction. +// The optional fourth 'var' param exists only for backwards-compatibility +// and can be ignored. +#define STEAM_CALLBACK( thisclass, func, .../*callback_type, [deprecated] var*/ ) \ + _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) ) + +// Declares a callback function and a named CCallbackManual variable which +// has Register and Unregister functions instead of automatic registration. +#define STEAM_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \ + CCallbackManual< thisclass, callback_type > var; void func( callback_type *pParam ) + + +// Internal functions used by the utility CCallback objects to receive callbacks S_API void S_CALLTYPE SteamAPI_RegisterCallback( class CCallbackBase *pCallback, int iCallback ); S_API void S_CALLTYPE SteamAPI_UnregisterCallback( class CCallbackBase *pCallback ); -// functions used by the utility CCallResult objects to receive async call results +// Internal functions used by the utility CCallResult objects to receive async call results S_API void S_CALLTYPE SteamAPI_RegisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); S_API void S_CALLTYPE SteamAPI_UnregisterCallResult( class CCallbackBase *pCallback, SteamAPICall_t hAPICall ); //----------------------------------------------------------------------------- -// Purpose: base for callbacks, -// used only by CCallback, shouldn't be used directly +// Purpose: base for callbacks and call results - internal implementation detail //----------------------------------------------------------------------------- class CCallbackBase { @@ -178,6 +203,26 @@ protected: uint8 m_nCallbackFlags; int m_iCallback; friend class CCallbackMgr; + +private: + CCallbackBase( const CCallbackBase& ); + CCallbackBase& operator=( const CCallbackBase& ); +}; + +//----------------------------------------------------------------------------- +// Purpose: templated base for callbacks - internal implementation detail +//----------------------------------------------------------------------------- +template< int sizeof_P > +class CCallbackImpl : protected CCallbackBase +{ +public: + ~CCallbackImpl() { if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) SteamAPI_UnregisterCallback( this ); } + void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } + +protected: + virtual void Run( void *pvParam ) = 0; + virtual void Run( void *pvParam, bool /*bIOFailure*/, SteamAPICall_t /*hSteamAPICall*/ ) { Run( pvParam ); } + virtual int GetCallbackSizeBytes() { return sizeof_P; } }; @@ -239,7 +284,7 @@ private: m_hAPICall = k_uAPICallInvalid; // caller unregisters for us (m_pObj->*m_Func)( (P *)pvParam, false ); } - void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) + virtual void Run( void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall ) { if ( hSteamAPICall == m_hAPICall ) { @@ -247,7 +292,7 @@ private: (m_pObj->*m_Func)( (P *)pvParam, bIOFailure ); } } - int GetCallbackSizeBytes() + virtual int GetCallbackSizeBytes() { return sizeof( P ); } @@ -261,31 +306,24 @@ private: //----------------------------------------------------------------------------- // Purpose: maps a steam callback to a class member function -// template params: T = local class, P = parameter struct +// template params: T = local class, P = parameter struct, +// bGameserver = listen for gameserver callbacks instead of client callbacks //----------------------------------------------------------------------------- -template< class T, class P, bool bGameServer > -class CCallback : protected CCallbackBase +template< class T, class P, bool bGameserver = false > +class CCallback : public CCallbackImpl< sizeof( P ) > { public: - typedef void (T::*func_t)( P* ); + typedef void (T::*func_t)(P*); - // If you can't support constructing a callback with the correct parameters - // then uncomment the empty constructor below and manually call - // ::Register() for your object - // Or, just call the regular constructor with (NULL, NULL) - // CCallback() {} - - // constructor for initializing this object in owner's constructor - CCallback( T *pObj, func_t func ) : m_pObj( pObj ), m_Func( func ) + // NOTE: If you can't provide the correct parameters at construction time, you should + // use the CCallbackManual callback object (STEAM_CALLBACK_MANUAL macro) instead. + CCallback( T *pObj, func_t func ) : m_pObj( NULL ), m_Func( NULL ) { - if ( pObj && func ) - Register( pObj, func ); - } - - ~CCallback() - { - if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) - Unregister(); + if ( bGameserver ) + { + this->SetGameserverFlag(); + } + Register( pObj, func ); } // manual registration of the callback @@ -294,13 +332,9 @@ public: if ( !pObj || !func ) return; - if ( m_nCallbackFlags & k_ECallbackFlagsRegistered ) + if ( this->m_nCallbackFlags & CCallbackBase::k_ECallbackFlagsRegistered ) Unregister(); - if ( bGameServer ) - { - m_nCallbackFlags |= k_ECallbackFlagsGameServer; - } m_pObj = pObj; m_Func = func; // SteamAPI_RegisterCallback sets k_ECallbackFlagsRegistered @@ -313,38 +347,50 @@ public: SteamAPI_UnregisterCallback( this ); } - void SetGameserverFlag() { m_nCallbackFlags |= k_ECallbackFlagsGameServer; } protected: virtual void Run( void *pvParam ) { (m_pObj->*m_Func)( (P *)pvParam ); } - virtual void Run( void *pvParam, bool, SteamAPICall_t ) - { - (m_pObj->*m_Func)( (P *)pvParam ); - } - int GetCallbackSizeBytes() - { - return sizeof( P ); - } T *m_pObj; func_t m_Func; }; -// Allows you to defer registration of the callback -template< class T, class P, bool bGameServer > + +//----------------------------------------------------------------------------- +// Purpose: subclass of CCallback which allows default-construction in +// an unregistered state; you must call Register manually +//----------------------------------------------------------------------------- +template< class T, class P, bool bGameServer = false > class CCallbackManual : public CCallback< T, P, bGameServer > { public: CCallbackManual() : CCallback< T, P, bGameServer >( NULL, NULL ) {} + + // Inherits public Register and Unregister functions from base class }; -// utility macro for declaring the function and callback object together -#define STEAM_CALLBACK( thisclass, func, param, var ) CCallback< thisclass, param, false > var; void func( param *pParam ) -// same as above, but lets you defer the callback binding by calling Register later -#define STEAM_CALLBACK_MANUAL( thisclass, func, param, var ) CCallbackManual< thisclass, param, false > var; void func( param *pParam ) + +//----------------------------------------------------------------------------- +// The following macros are implementation details, not intended for public use +//----------------------------------------------------------------------------- +#define _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) +#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED +#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y +#define _STEAM_CALLBACK_3( extra_code, thisclass, func, param ) \ + struct CCallbackInternal_ ## func : private CCallbackImpl< sizeof( param ) > { \ + CCallbackInternal_ ## func () { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \ + CCallbackInternal_ ## func ( const CCallbackInternal_ ## func & ) { extra_code SteamAPI_RegisterCallback( this, param::k_iCallback ); } \ + CCallbackInternal_ ## func & operator=( const CCallbackInternal_ ## func & ) { return *this; } \ + private: virtual void Run( void *pvParam ) { _STEAM_CALLBACK_AUTO_HOOK( thisclass, func, param ) \ + thisclass *pOuter = reinterpret_cast( reinterpret_cast(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \ + pOuter->func( reinterpret_cast( pvParam ) ); \ + } \ + } m_steamcallback_ ## func ; void func( param *pParam ) +#define _STEAM_CALLBACK_4( _, thisclass, func, param, var ) \ + CCallback< thisclass, param > var; void func( param *pParam ) #ifdef _WIN32 diff --git a/public/steam/steam_api.json b/public/steam/steam_api.json index 8d74f7f..4d94b6b 100644 --- a/public/steam/steam_api.json +++ b/public/steam/steam_api.json @@ -57,6 +57,10 @@ ,{"typedef": "HTTPRequestHandle","type": "uint32"} ,{"typedef": "HTTPCookieContainerHandle","type": "uint32"} ,{"typedef": "ClientUnifiedMessageHandle","type": "uint64"} +,{"typedef": "ControllerHandle_t","type": "uint64"} +,{"typedef": "ControllerActionSetHandle_t","type": "uint64"} +,{"typedef": "ControllerDigitalActionHandle_t","type": "uint64"} +,{"typedef": "ControllerAnalogActionHandle_t","type": "uint64"} ,{"typedef": "UGCQueryHandle_t","type": "uint64"} ,{"typedef": "UGCUpdateHandle_t","type": "uint64"} ,{"typedef": "HHTMLBrowser","type": "uint32"} @@ -175,6 +179,7 @@ ,{"name": "k_EResultRefundToWallet","value": "98"} ,{"name": "k_EResultEmailSendFailure","value": "99"} ,{"name": "k_EResultNotSettled","value": "100"} + ,{"name": "k_EResultNeedCaptcha","value": "101"} ]} , {"enumname": "EVoiceResult","values": [ {"name": "k_EVoiceResultOK","value": "0"} @@ -269,6 +274,7 @@ ,{"name": "k_EAppOwnershipFlags_LicenseRecurring","value": "4096"} ,{"name": "k_EAppOwnershipFlags_LicenseCanceled","value": "8192"} ,{"name": "k_EAppOwnershipFlags_AutoGrant","value": "16384"} + ,{"name": "k_EAppOwnershipFlags_PendingGift","value": "32768"} ]} , {"enumname": "EAppType","values": [ {"name": "k_EAppType_Invalid","value": "0"} @@ -360,6 +366,23 @@ ,{"name": "k_EBroadcastUploadResultSettingsChanged","value": "10"} ,{"name": "k_EBroadcastUploadResultMissingAudio","value": "11"} ,{"name": "k_EBroadcastUploadResultTooFarBehind","value": "12"} + ,{"name": "k_EBroadcastUploadResultTranscodeBehind","value": "13"} +]} +, {"enumname": "ELaunchOptionType","values": [ + {"name": "k_ELaunchOptionType_None","value": "0"} + ,{"name": "k_ELaunchOptionType_Default","value": "1"} + ,{"name": "k_ELaunchOptionType_SafeMode","value": "2"} + ,{"name": "k_ELaunchOptionType_Multiplayer","value": "3"} + ,{"name": "k_ELaunchOptionType_Config","value": "4"} + ,{"name": "k_ELaunchOptionType_VR","value": "5"} + ,{"name": "k_ELaunchOptionType_Server","value": "6"} + ,{"name": "k_ELaunchOptionType_Editor","value": "7"} + ,{"name": "k_ELaunchOptionType_Manual","value": "8"} + ,{"name": "k_ELaunchOptionType_Benchmark","value": "9"} + ,{"name": "k_ELaunchOptionType_Option1","value": "10"} + ,{"name": "k_ELaunchOptionType_Option2","value": "11"} + ,{"name": "k_ELaunchOptionType_Option3","value": "12"} + ,{"name": "k_ELaunchOptionType_Dialog","value": "1000"} ]} , {"enumname": "CGameID::EGameIDType","values": [ {"name": "k_EGameIDTypeApp","value": "0"} @@ -683,6 +706,72 @@ {"name": "k_ESteamControllerPad_Left","value": "0"} ,{"name": "k_ESteamControllerPad_Right","value": "1"} ]} +, {"enumname": "EControllerSource","values": [ + {"name": "k_EControllerSource_None","value": "0"} + ,{"name": "k_EControllerSource_LeftTrackpad","value": "1"} + ,{"name": "k_EControllerSource_RightTrackpad","value": "2"} + ,{"name": "k_EControllerSource_Joystick","value": "3"} + ,{"name": "k_EControllerSource_ABXY","value": "4"} + ,{"name": "k_EControllerSource_Switch","value": "5"} + ,{"name": "k_EControllerSource_LeftTrigger","value": "6"} + ,{"name": "k_EControllerSource_RightTrigger","value": "7"} + ,{"name": "k_EControllerSource_Gyro","value": "8"} +]} +, {"enumname": "EControllerSourceMode","values": [ + {"name": "k_EControllerSourceMode_None","value": "0"} + ,{"name": "k_EControllerSourceMode_Dpad","value": "1"} + ,{"name": "k_EControllerSourceMode_Buttons","value": "2"} + ,{"name": "k_EControllerSourceMode_FourButtons","value": "3"} + ,{"name": "k_EControllerSourceMode_AbsoluteMouse","value": "4"} + ,{"name": "k_EControllerSourceMode_RelativeMouse","value": "5"} + ,{"name": "k_EControllerSourceMode_JoystickMove","value": "6"} + ,{"name": "k_EControllerSourceMode_JoystickCamera","value": "7"} + ,{"name": "k_EControllerSourceMode_ScrollWheel","value": "8"} + ,{"name": "k_EControllerSourceMode_Trigger","value": "9"} + ,{"name": "k_EControllerSourceMode_TouchMenu","value": "10"} +]} +, {"enumname": "EControllerActionOrigin","values": [ + {"name": "k_EControllerActionOrigin_None","value": "0"} + ,{"name": "k_EControllerActionOrigin_A","value": "1"} + ,{"name": "k_EControllerActionOrigin_B","value": "2"} + ,{"name": "k_EControllerActionOrigin_X","value": "3"} + ,{"name": "k_EControllerActionOrigin_Y","value": "4"} + ,{"name": "k_EControllerActionOrigin_LeftBumper","value": "5"} + ,{"name": "k_EControllerActionOrigin_RightBumper","value": "6"} + ,{"name": "k_EControllerActionOrigin_LeftGrip","value": "7"} + ,{"name": "k_EControllerActionOrigin_RightGrip","value": "8"} + ,{"name": "k_EControllerActionOrigin_Start","value": "9"} + ,{"name": "k_EControllerActionOrigin_Back","value": "10"} + ,{"name": "k_EControllerActionOrigin_LeftPad_Touch","value": "11"} + ,{"name": "k_EControllerActionOrigin_LeftPad_Swipe","value": "12"} + ,{"name": "k_EControllerActionOrigin_LeftPad_Click","value": "13"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadNorth","value": "14"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadSouth","value": "15"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadWest","value": "16"} + ,{"name": "k_EControllerActionOrigin_LeftPad_DPadEast","value": "17"} + ,{"name": "k_EControllerActionOrigin_RightPad_Touch","value": "18"} + ,{"name": "k_EControllerActionOrigin_RightPad_Swipe","value": "19"} + ,{"name": "k_EControllerActionOrigin_RightPad_Click","value": "20"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadNorth","value": "21"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadSouth","value": "22"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadWest","value": "23"} + ,{"name": "k_EControllerActionOrigin_RightPad_DPadEast","value": "24"} + ,{"name": "k_EControllerActionOrigin_LeftTrigger_Pull","value": "25"} + ,{"name": "k_EControllerActionOrigin_LeftTrigger_Click","value": "26"} + ,{"name": "k_EControllerActionOrigin_RightTrigger_Pull","value": "27"} + ,{"name": "k_EControllerActionOrigin_RightTrigger_Click","value": "28"} + ,{"name": "k_EControllerActionOrigin_LeftStick_Move","value": "29"} + ,{"name": "k_EControllerActionOrigin_LeftStick_Click","value": "30"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadNorth","value": "31"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadSouth","value": "32"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadWest","value": "33"} + ,{"name": "k_EControllerActionOrigin_LeftStick_DPadEast","value": "34"} + ,{"name": "k_EControllerActionOrigin_Gyro_Move","value": "35"} + ,{"name": "k_EControllerActionOrigin_Gyro_Pitch","value": "36"} + ,{"name": "k_EControllerActionOrigin_Gyro_Yaw","value": "37"} + ,{"name": "k_EControllerActionOrigin_Gyro_Roll","value": "38"} + ,{"name": "k_EControllerActionOrigin_Count","value": "39"} +]} , {"enumname": "EUGCMatchingUGCType","values": [ {"name": "k_EUGCMatchingUGCType_Items","value": "0"} ,{"name": "k_EUGCMatchingUGCType_Items_Mtx","value": "1"} @@ -697,6 +786,7 @@ ,{"name": "k_EUGCMatchingUGCType_UsableInGame","value": "10"} ,{"name": "k_EUGCMatchingUGCType_ControllerBindings","value": "11"} ,{"name": "k_EUGCMatchingUGCType_GameManagedItems","value": "12"} + ,{"name": "k_EUGCMatchingUGCType_All","value": "-1"} ]} , {"enumname": "EUserUGCList","values": [ {"name": "k_EUserUGCList_Published","value": "0"} @@ -966,7 +1056,8 @@ { "fieldname": "m_pubParam", "fieldtype": "uint8 *"}, { "fieldname": "m_cubParam", "fieldtype": "int"}]} ,{"struct": "SteamServerConnectFailure_t","fields": [ -{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_bStillRetrying", "fieldtype": "_Bool"}]} ,{"struct": "SteamServersDisconnected_t","fields": [ { "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} ,{"struct": "ClientGameServerDeny_t","fields": [ @@ -1287,6 +1378,13 @@ { "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, { "fieldname": "m_nAppID", "fieldtype": "AppId_t"}, { "fieldname": "m_hFile", "fieldtype": "UGCHandle_t"}]} +,{"struct": "RemoteStorageFileWriteAsyncComplete_t","fields": [ +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}]} +,{"struct": "RemoteStorageFileReadAsyncComplete_t","fields": [ +{ "fieldname": "m_hFileReadAsync", "fieldtype": "SteamAPICall_t"}, +{ "fieldname": "m_eResult", "fieldtype": "enum EResult"}, +{ "fieldname": "m_nOffset", "fieldtype": "uint32"}, +{ "fieldname": "m_cubRead", "fieldtype": "uint32"}]} ,{"struct": "LeaderboardEntry_t","fields": [ { "fieldname": "m_steamIDUser", "fieldtype": "class CSteamID"}, { "fieldname": "m_nGlobalRank", "fieldtype": "int32"}, @@ -1407,13 +1505,14 @@ { "fieldname": "m_unContext", "fieldtype": "uint64"}, { "fieldname": "m_eResult", "fieldtype": "enum EResult"}, { "fieldname": "m_unResponseSize", "fieldtype": "uint32"}]} -,{"struct": "SteamControllerState001_t","fields": [ -{ "fieldname": "unPacketNum", "fieldtype": "uint32"}, -{ "fieldname": "ulButtons", "fieldtype": "uint64"}, -{ "fieldname": "sLeftPadX", "fieldtype": "short"}, -{ "fieldname": "sLeftPadY", "fieldtype": "short"}, -{ "fieldname": "sRightPadX", "fieldtype": "short"}, -{ "fieldname": "sRightPadY", "fieldtype": "short"}]} +,{"struct": "ControllerAnalogActionData_t","fields": [ +{ "fieldname": "eMode", "fieldtype": "enum EControllerSourceMode"}, +{ "fieldname": "x", "fieldtype": "float"}, +{ "fieldname": "y", "fieldtype": "float"}, +{ "fieldname": "bActive", "fieldtype": "_Bool"}]} +,{"struct": "ControllerDigitalActionData_t","fields": [ +{ "fieldname": "bState", "fieldtype": "_Bool"}, +{ "fieldname": "bActive", "fieldtype": "_Bool"}]} ,{"struct": "SteamUGCDetails_t","fields": [ { "fieldname": "m_nPublishedFileId", "fieldtype": "PublishedFileId_t"}, { "fieldname": "m_eResult", "fieldtype": "enum EResult"}, @@ -3579,6 +3678,36 @@ { "paramname": "cubDataToRead" ,"paramtype": "int32"} ] } +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileWriteAsync", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "pvData" ,"paramtype": "const void *"}, +{ "paramname": "cubData" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileReadAsync", + "returntype": "SteamAPICall_t", + "params": [ +{ "paramname": "pchFile" ,"paramtype": "const char *"}, +{ "paramname": "nOffset" ,"paramtype": "uint32"}, +{ "paramname": "cubToRead" ,"paramtype": "uint32"} + ] +} +,{ + "classname": "ISteamRemoteStorage", + "methodname": "FileReadAsyncComplete", + "returntype": "bool", + "params": [ +{ "paramname": "hReadCall" ,"paramtype": "SteamAPICall_t"}, +{ "paramname": "pvBuffer" ,"paramtype": "void *"}, +{ "paramname": "cubToRead" ,"paramtype": "uint32"} + ] +} ,{ "classname": "ISteamRemoteStorage", "methodname": "FileForget", @@ -5415,10 +5544,7 @@ ,{ "classname": "ISteamController", "methodname": "Init", - "returntype": "bool", - "params": [ -{ "paramname": "pchAbsolutePathToControllerConfigVDF" ,"paramtype": "const char *"} - ] + "returntype": "bool" } ,{ "classname": "ISteamController", @@ -5432,11 +5558,108 @@ } ,{ "classname": "ISteamController", - "methodname": "GetControllerState", + "methodname": "GetConnectedControllers", + "returntype": "int", + "params": [ +{ "paramname": "handlesOut" ,"paramtype": "ControllerHandle_t *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "ShowBindingPanel", "returntype": "bool", "params": [ -{ "paramname": "unControllerIndex" ,"paramtype": "uint32"}, -{ "paramname": "pState" ,"paramtype": "struct SteamControllerState001_t *"} +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetActionSetHandle", + "returntype": "ControllerActionSetHandle_t", + "params": [ +{ "paramname": "pszActionSetName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "ActivateActionSet", + "returntype": "void", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "actionSetHandle" ,"paramtype": "ControllerActionSetHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetCurrentActionSet", + "returntype": "ControllerActionSetHandle_t", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetDigitalActionHandle", + "returntype": "ControllerDigitalActionHandle_t", + "params": [ +{ "paramname": "pszActionName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetDigitalActionData", + "returntype": "struct ControllerDigitalActionData_t", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "digitalActionHandle" ,"paramtype": "ControllerDigitalActionHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetDigitalActionOrigins", + "returntype": "int", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "actionSetHandle" ,"paramtype": "ControllerActionSetHandle_t"}, +{ "paramname": "digitalActionHandle" ,"paramtype": "ControllerDigitalActionHandle_t"}, +{ "paramname": "originsOut" ,"paramtype": "EControllerActionOrigin *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetAnalogActionHandle", + "returntype": "ControllerAnalogActionHandle_t", + "params": [ +{ "paramname": "pszActionName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetAnalogActionData", + "returntype": "struct ControllerAnalogActionData_t", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "analogActionHandle" ,"paramtype": "ControllerAnalogActionHandle_t"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "GetAnalogActionOrigins", + "returntype": "int", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "actionSetHandle" ,"paramtype": "ControllerActionSetHandle_t"}, +{ "paramname": "analogActionHandle" ,"paramtype": "ControllerAnalogActionHandle_t"}, +{ "paramname": "originsOut" ,"paramtype": "EControllerActionOrigin *"} + ] +} +,{ + "classname": "ISteamController", + "methodname": "StopAnalogActionMomentum", + "returntype": "void", + "params": [ +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, +{ "paramname": "eAction" ,"paramtype": "ControllerAnalogActionHandle_t"} ] } ,{ @@ -5444,19 +5667,11 @@ "methodname": "TriggerHapticPulse", "returntype": "void", "params": [ -{ "paramname": "unControllerIndex" ,"paramtype": "uint32"}, +{ "paramname": "controllerHandle" ,"paramtype": "ControllerHandle_t"}, { "paramname": "eTargetPad" ,"paramtype": "ESteamControllerPad"}, { "paramname": "usDurationMicroSec" ,"paramtype": "unsigned short"} ] } -,{ - "classname": "ISteamController", - "methodname": "SetOverrideMode", - "returntype": "void", - "params": [ -{ "paramname": "pchMode" ,"paramtype": "const char *"} - ] -} ,{ "classname": "ISteamUGC", "methodname": "CreateQueryUserUGCRequest", @@ -5984,6 +6199,23 @@ { "paramname": "bHighPriority" ,"paramtype": "bool"} ] } +,{ + "classname": "ISteamUGC", + "methodname": "BInitWorkshopForGameServer", + "returntype": "bool", + "params": [ +{ "paramname": "unWorkshopDepotID" ,"paramtype": "DepotId_t"}, +{ "paramname": "pszFolder" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "ISteamUGC", + "methodname": "SuspendDownloads", + "returntype": "void", + "params": [ +{ "paramname": "bSuspend" ,"paramtype": "bool"} + ] +} ,{ "classname": "ISteamAppList", "methodname": "GetNumInstalledApps", diff --git a/public/steam/steam_api_flat.h b/public/steam/steam_api_flat.h index ac8dd51..0039a8b 100644 --- a/public/steam/steam_api_flat.h +++ b/public/steam/steam_api_flat.h @@ -239,6 +239,9 @@ S_API HServerQuery SteamAPI_ISteamMatchmakingServers_ServerRules(intptr_t instan S_API void SteamAPI_ISteamMatchmakingServers_CancelServerQuery(intptr_t instancePtr, HServerQuery hServerQuery); S_API bool SteamAPI_ISteamRemoteStorage_FileWrite(intptr_t instancePtr, const char * pchFile, const void * pvData, int32 cubData); S_API int32 SteamAPI_ISteamRemoteStorage_FileRead(intptr_t instancePtr, const char * pchFile, void * pvData, int32 cubDataToRead); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileWriteAsync(intptr_t instancePtr, const char * pchFile, const void * pvData, uint32 cubData); +S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileReadAsync(intptr_t instancePtr, const char * pchFile, uint32 nOffset, uint32 cubToRead); +S_API bool SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete(intptr_t instancePtr, SteamAPICall_t hReadCall, void * pvBuffer, uint32 cubToRead); S_API bool SteamAPI_ISteamRemoteStorage_FileForget(intptr_t instancePtr, const char * pchFile); S_API bool SteamAPI_ISteamRemoteStorage_FileDelete(intptr_t instancePtr, const char * pchFile); S_API SteamAPICall_t SteamAPI_ISteamRemoteStorage_FileShare(intptr_t instancePtr, const char * pchFile); @@ -456,12 +459,22 @@ S_API bool SteamAPI_ISteamUnifiedMessages_GetMethodResponseInfo(intptr_t instanc S_API bool SteamAPI_ISteamUnifiedMessages_GetMethodResponseData(intptr_t instancePtr, ClientUnifiedMessageHandle hHandle, void * pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease); S_API bool SteamAPI_ISteamUnifiedMessages_ReleaseMethod(intptr_t instancePtr, ClientUnifiedMessageHandle hHandle); S_API bool SteamAPI_ISteamUnifiedMessages_SendNotification(intptr_t instancePtr, const char * pchServiceNotification, const void * pNotificationBuffer, uint32 unNotificationBufferSize); -S_API bool SteamAPI_ISteamController_Init(intptr_t instancePtr, const char * pchAbsolutePathToControllerConfigVDF); +S_API bool SteamAPI_ISteamController_Init(intptr_t instancePtr); S_API bool SteamAPI_ISteamController_Shutdown(intptr_t instancePtr); S_API void SteamAPI_ISteamController_RunFrame(intptr_t instancePtr); -S_API bool SteamAPI_ISteamController_GetControllerState(intptr_t instancePtr, uint32 unControllerIndex, struct SteamControllerState001_t * pState); -S_API void SteamAPI_ISteamController_TriggerHapticPulse(intptr_t instancePtr, uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec); -S_API void SteamAPI_ISteamController_SetOverrideMode(intptr_t instancePtr, const char * pchMode); +S_API int SteamAPI_ISteamController_GetConnectedControllers(intptr_t instancePtr, ControllerHandle_t * handlesOut); +S_API bool SteamAPI_ISteamController_ShowBindingPanel(intptr_t instancePtr, ControllerHandle_t controllerHandle); +S_API ControllerActionSetHandle_t SteamAPI_ISteamController_GetActionSetHandle(intptr_t instancePtr, const char * pszActionSetName); +S_API void SteamAPI_ISteamController_ActivateActionSet(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle); +S_API ControllerActionSetHandle_t SteamAPI_ISteamController_GetCurrentActionSet(intptr_t instancePtr, ControllerHandle_t controllerHandle); +S_API ControllerDigitalActionHandle_t SteamAPI_ISteamController_GetDigitalActionHandle(intptr_t instancePtr, const char * pszActionName); +S_API struct ControllerDigitalActionData_t SteamAPI_ISteamController_GetDigitalActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle); +S_API int SteamAPI_ISteamController_GetDigitalActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, EControllerActionOrigin * originsOut); +S_API ControllerAnalogActionHandle_t SteamAPI_ISteamController_GetAnalogActionHandle(intptr_t instancePtr, const char * pszActionName); +S_API struct ControllerAnalogActionData_t SteamAPI_ISteamController_GetAnalogActionData(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle); +S_API int SteamAPI_ISteamController_GetAnalogActionOrigins(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, EControllerActionOrigin * originsOut); +S_API void SteamAPI_ISteamController_StopAnalogActionMomentum(intptr_t instancePtr, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction); +S_API void SteamAPI_ISteamController_TriggerHapticPulse(intptr_t instancePtr, ControllerHandle_t controllerHandle, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec); S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(intptr_t instancePtr, AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage); S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(intptr_t instancePtr, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage); S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(intptr_t instancePtr, PublishedFileId_t * pvecPublishedFileID, uint32 unNumPublishedFileIDs); @@ -518,6 +531,8 @@ S_API uint32 SteamAPI_ISteamUGC_GetItemState(intptr_t instancePtr, PublishedFile S_API bool SteamAPI_ISteamUGC_GetItemInstallInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punSizeOnDisk, char * pchFolder, uint32 cchFolderSize, uint32 * punTimeStamp); S_API bool SteamAPI_ISteamUGC_GetItemDownloadInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punBytesDownloaded, uint64 * punBytesTotal); S_API bool SteamAPI_ISteamUGC_DownloadItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, bool bHighPriority); +S_API bool SteamAPI_ISteamUGC_BInitWorkshopForGameServer(intptr_t instancePtr, DepotId_t unWorkshopDepotID, const char * pszFolder); +S_API void SteamAPI_ISteamUGC_SuspendDownloads(intptr_t instancePtr, bool bSuspend); S_API uint32 SteamAPI_ISteamAppList_GetNumInstalledApps(intptr_t instancePtr); S_API uint32 SteamAPI_ISteamAppList_GetInstalledApps(intptr_t instancePtr, AppId_t * pvecAppID, uint32 unMaxAppIDs); S_API int SteamAPI_ISteamAppList_GetAppName(intptr_t instancePtr, AppId_t nAppID, char * pchName, int cchNameMax); diff --git a/public/steam/steam_api_interop.cs b/public/steam/steam_api_interop.cs index 48910ab..756186f 100644 --- a/public/steam/steam_api_interop.cs +++ b/public/steam/steam_api_interop.cs @@ -468,6 +468,12 @@ internal static extern void SteamAPI_ISteamMatchmakingServers_CancelServerQuery( internal static extern bool SteamAPI_ISteamRemoteStorage_FileWrite(IntPtr instancePtr, string pchFile, IntPtr pvData, int cubData); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileRead")] internal static extern int SteamAPI_ISteamRemoteStorage_FileRead(IntPtr instancePtr, string pchFile, IntPtr pvData, int cubDataToRead); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileWriteAsync")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_FileWriteAsync(IntPtr instancePtr, string pchFile, IntPtr pvData, uint cubData); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileReadAsync")] +internal static extern ulong SteamAPI_ISteamRemoteStorage_FileReadAsync(IntPtr instancePtr, string pchFile, uint nOffset, uint cubToRead); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete")] +internal static extern bool SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete(IntPtr instancePtr, ulong hReadCall, IntPtr pvBuffer, uint cubToRead); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileForget")] internal static extern bool SteamAPI_ISteamRemoteStorage_FileForget(IntPtr instancePtr, string pchFile); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamRemoteStorage_FileDelete")] @@ -903,17 +909,37 @@ internal static extern bool SteamAPI_ISteamUnifiedMessages_ReleaseMethod(IntPtr [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUnifiedMessages_SendNotification")] internal static extern bool SteamAPI_ISteamUnifiedMessages_SendNotification(IntPtr instancePtr, string pchServiceNotification, IntPtr pNotificationBuffer, uint unNotificationBufferSize); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_Init")] -internal static extern bool SteamAPI_ISteamController_Init(IntPtr instancePtr, string pchAbsolutePathToControllerConfigVDF); +internal static extern bool SteamAPI_ISteamController_Init(IntPtr instancePtr); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_Shutdown")] internal static extern bool SteamAPI_ISteamController_Shutdown(IntPtr instancePtr); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_RunFrame")] internal static extern void SteamAPI_ISteamController_RunFrame(IntPtr instancePtr); -[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetControllerState")] -internal static extern bool SteamAPI_ISteamController_GetControllerState(IntPtr instancePtr, uint unControllerIndex, ref SteamControllerState001_t pState); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetConnectedControllers")] +internal static extern int SteamAPI_ISteamController_GetConnectedControllers(IntPtr instancePtr, ref ulong handlesOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_ShowBindingPanel")] +internal static extern bool SteamAPI_ISteamController_ShowBindingPanel(IntPtr instancePtr, ulong controllerHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetActionSetHandle")] +internal static extern ulong SteamAPI_ISteamController_GetActionSetHandle(IntPtr instancePtr, string pszActionSetName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_ActivateActionSet")] +internal static extern void SteamAPI_ISteamController_ActivateActionSet(IntPtr instancePtr, ulong controllerHandle, ulong actionSetHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetCurrentActionSet")] +internal static extern ulong SteamAPI_ISteamController_GetCurrentActionSet(IntPtr instancePtr, ulong controllerHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetDigitalActionHandle")] +internal static extern ulong SteamAPI_ISteamController_GetDigitalActionHandle(IntPtr instancePtr, string pszActionName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetDigitalActionData")] +internal static extern ControllerDigitalActionData_t SteamAPI_ISteamController_GetDigitalActionData(IntPtr instancePtr, ulong controllerHandle, ulong digitalActionHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetDigitalActionOrigins")] +internal static extern int SteamAPI_ISteamController_GetDigitalActionOrigins(IntPtr instancePtr, ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, ref uint originsOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetAnalogActionHandle")] +internal static extern ulong SteamAPI_ISteamController_GetAnalogActionHandle(IntPtr instancePtr, string pszActionName); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetAnalogActionData")] +internal static extern ControllerAnalogActionData_t SteamAPI_ISteamController_GetAnalogActionData(IntPtr instancePtr, ulong controllerHandle, ulong analogActionHandle); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_GetAnalogActionOrigins")] +internal static extern int SteamAPI_ISteamController_GetAnalogActionOrigins(IntPtr instancePtr, ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, ref uint originsOut); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_StopAnalogActionMomentum")] +internal static extern void SteamAPI_ISteamController_StopAnalogActionMomentum(IntPtr instancePtr, ulong controllerHandle, ulong eAction); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_TriggerHapticPulse")] -internal static extern void SteamAPI_ISteamController_TriggerHapticPulse(IntPtr instancePtr, uint unControllerIndex, uint eTargetPad, char usDurationMicroSec); -[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamController_SetOverrideMode")] -internal static extern void SteamAPI_ISteamController_SetOverrideMode(IntPtr instancePtr, string pchMode); +internal static extern void SteamAPI_ISteamController_TriggerHapticPulse(IntPtr instancePtr, ulong controllerHandle, uint eTargetPad, char usDurationMicroSec); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_CreateQueryUserUGCRequest")] internal static extern ulong SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(IntPtr instancePtr, uint unAccountID, uint eListType, uint eMatchingUGCType, uint eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint unPage); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_CreateQueryAllUGCRequest")] @@ -1026,6 +1052,10 @@ internal static extern bool SteamAPI_ISteamUGC_GetItemInstallInfo(IntPtr instanc internal static extern bool SteamAPI_ISteamUGC_GetItemDownloadInfo(IntPtr instancePtr, ulong nPublishedFileID, ref ulong punBytesDownloaded, ref ulong punBytesTotal); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_DownloadItem")] internal static extern bool SteamAPI_ISteamUGC_DownloadItem(IntPtr instancePtr, ulong nPublishedFileID, bool bHighPriority); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_BInitWorkshopForGameServer")] +internal static extern bool SteamAPI_ISteamUGC_BInitWorkshopForGameServer(IntPtr instancePtr, uint unWorkshopDepotID, string pszFolder); +[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamUGC_SuspendDownloads")] +internal static extern void SteamAPI_ISteamUGC_SuspendDownloads(IntPtr instancePtr, bool bSuspend); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetNumInstalledApps")] internal static extern uint SteamAPI_ISteamAppList_GetNumInstalledApps(IntPtr instancePtr); [DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_ISteamAppList_GetInstalledApps")] @@ -1560,6 +1590,9 @@ namespace Valve.Steamworks public abstract IntPtr GetIntPtr(); public abstract bool FileWrite(string pchFile,IntPtr pvData,int cubData); public abstract int FileRead(string pchFile,IntPtr pvData,int cubDataToRead); + public abstract ulong FileWriteAsync(string pchFile,IntPtr pvData,uint cubData); + public abstract ulong FileReadAsync(string pchFile,uint nOffset,uint cubToRead); + public abstract bool FileReadAsyncComplete(ulong hReadCall,IntPtr pvBuffer,uint cubToRead); public abstract bool FileForget(string pchFile); public abstract bool FileDelete(string pchFile); public abstract ulong FileShare(string pchFile); @@ -1831,12 +1864,22 @@ namespace Valve.Steamworks public abstract class ISteamController { public abstract IntPtr GetIntPtr(); - public abstract bool Init(string pchAbsolutePathToControllerConfigVDF); + public abstract bool Init(); public abstract bool Shutdown(); public abstract void RunFrame(); - public abstract bool GetControllerState(uint unControllerIndex,ref SteamControllerState001_t pState); - public abstract void TriggerHapticPulse(uint unControllerIndex,uint eTargetPad,char usDurationMicroSec); - public abstract void SetOverrideMode(string pchMode); + public abstract int GetConnectedControllers(ref ulong handlesOut); + public abstract bool ShowBindingPanel(ulong controllerHandle); + public abstract ulong GetActionSetHandle(string pszActionSetName); + public abstract void ActivateActionSet(ulong controllerHandle,ulong actionSetHandle); + public abstract ulong GetCurrentActionSet(ulong controllerHandle); + public abstract ulong GetDigitalActionHandle(string pszActionName); + public abstract ControllerDigitalActionData_t GetDigitalActionData(ulong controllerHandle,ulong digitalActionHandle); + public abstract int GetDigitalActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong digitalActionHandle,ref uint originsOut); + public abstract ulong GetAnalogActionHandle(string pszActionName); + public abstract ControllerAnalogActionData_t GetAnalogActionData(ulong controllerHandle,ulong analogActionHandle); + public abstract int GetAnalogActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong analogActionHandle,ref uint originsOut); + public abstract void StopAnalogActionMomentum(ulong controllerHandle,ulong eAction); + public abstract void TriggerHapticPulse(ulong controllerHandle,uint eTargetPad,char usDurationMicroSec); } @@ -1899,6 +1942,8 @@ namespace Valve.Steamworks public abstract bool GetItemInstallInfo(ulong nPublishedFileID,ref ulong punSizeOnDisk,string pchFolder,uint cchFolderSize,ref uint punTimeStamp); public abstract bool GetItemDownloadInfo(ulong nPublishedFileID,ref ulong punBytesDownloaded,ref ulong punBytesTotal); public abstract bool DownloadItem(ulong nPublishedFileID,bool bHighPriority); + public abstract bool BInitWorkshopForGameServer(uint unWorkshopDepotID,string pszFolder); + public abstract void SuspendDownloads(bool bSuspend); } @@ -3604,6 +3649,24 @@ public override int FileRead(string pchFile,IntPtr pvData,int cubDataToRead) int result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileRead(m_pSteamRemoteStorage,pchFile,pvData,cubDataToRead); return result; } +public override ulong FileWriteAsync(string pchFile,IntPtr pvData,uint cubData) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileWriteAsync(m_pSteamRemoteStorage,pchFile,pvData,cubData); + return result; +} +public override ulong FileReadAsync(string pchFile,uint nOffset,uint cubToRead) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileReadAsync(m_pSteamRemoteStorage,pchFile,nOffset,cubToRead); + return result; +} +public override bool FileReadAsyncComplete(ulong hReadCall,IntPtr pvBuffer,uint cubToRead) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamRemoteStorage_FileReadAsyncComplete(m_pSteamRemoteStorage,hReadCall,pvBuffer,cubToRead); + return result; +} public override bool FileForget(string pchFile) { CheckIfUsable(); @@ -5129,10 +5192,10 @@ private void CheckIfUsable() throw new Exception("Steam Pointer not configured"); } } -public override bool Init(string pchAbsolutePathToControllerConfigVDF) +public override bool Init() { CheckIfUsable(); - bool result = NativeEntrypoints.SteamAPI_ISteamController_Init(m_pSteamController,pchAbsolutePathToControllerConfigVDF); + bool result = NativeEntrypoints.SteamAPI_ISteamController_Init(m_pSteamController); return result; } public override bool Shutdown() @@ -5146,21 +5209,83 @@ public override void RunFrame() CheckIfUsable(); NativeEntrypoints.SteamAPI_ISteamController_RunFrame(m_pSteamController); } -public override bool GetControllerState(uint unControllerIndex,ref SteamControllerState001_t pState) +public override int GetConnectedControllers(ref ulong handlesOut) { CheckIfUsable(); - bool result = NativeEntrypoints.SteamAPI_ISteamController_GetControllerState(m_pSteamController,unControllerIndex,ref pState); + handlesOut = 0; + int result = NativeEntrypoints.SteamAPI_ISteamController_GetConnectedControllers(m_pSteamController,ref handlesOut); return result; } -public override void TriggerHapticPulse(uint unControllerIndex,uint eTargetPad,char usDurationMicroSec) +public override bool ShowBindingPanel(ulong controllerHandle) { CheckIfUsable(); - NativeEntrypoints.SteamAPI_ISteamController_TriggerHapticPulse(m_pSteamController,unControllerIndex,eTargetPad,usDurationMicroSec); + bool result = NativeEntrypoints.SteamAPI_ISteamController_ShowBindingPanel(m_pSteamController,controllerHandle); + return result; } -public override void SetOverrideMode(string pchMode) +public override ulong GetActionSetHandle(string pszActionSetName) { CheckIfUsable(); - NativeEntrypoints.SteamAPI_ISteamController_SetOverrideMode(m_pSteamController,pchMode); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetActionSetHandle(m_pSteamController,pszActionSetName); + return result; +} +public override void ActivateActionSet(ulong controllerHandle,ulong actionSetHandle) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_ActivateActionSet(m_pSteamController,controllerHandle,actionSetHandle); +} +public override ulong GetCurrentActionSet(ulong controllerHandle) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetCurrentActionSet(m_pSteamController,controllerHandle); + return result; +} +public override ulong GetDigitalActionHandle(string pszActionName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetDigitalActionHandle(m_pSteamController,pszActionName); + return result; +} +public override ControllerDigitalActionData_t GetDigitalActionData(ulong controllerHandle,ulong digitalActionHandle) +{ + CheckIfUsable(); + ControllerDigitalActionData_t result = NativeEntrypoints.SteamAPI_ISteamController_GetDigitalActionData(m_pSteamController,controllerHandle,digitalActionHandle); + return result; +} +public override int GetDigitalActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong digitalActionHandle,ref uint originsOut) +{ + CheckIfUsable(); + originsOut = 0; + int result = NativeEntrypoints.SteamAPI_ISteamController_GetDigitalActionOrigins(m_pSteamController,controllerHandle,actionSetHandle,digitalActionHandle,ref originsOut); + return result; +} +public override ulong GetAnalogActionHandle(string pszActionName) +{ + CheckIfUsable(); + ulong result = NativeEntrypoints.SteamAPI_ISteamController_GetAnalogActionHandle(m_pSteamController,pszActionName); + return result; +} +public override ControllerAnalogActionData_t GetAnalogActionData(ulong controllerHandle,ulong analogActionHandle) +{ + CheckIfUsable(); + ControllerAnalogActionData_t result = NativeEntrypoints.SteamAPI_ISteamController_GetAnalogActionData(m_pSteamController,controllerHandle,analogActionHandle); + return result; +} +public override int GetAnalogActionOrigins(ulong controllerHandle,ulong actionSetHandle,ulong analogActionHandle,ref uint originsOut) +{ + CheckIfUsable(); + originsOut = 0; + int result = NativeEntrypoints.SteamAPI_ISteamController_GetAnalogActionOrigins(m_pSteamController,controllerHandle,actionSetHandle,analogActionHandle,ref originsOut); + return result; +} +public override void StopAnalogActionMomentum(ulong controllerHandle,ulong eAction) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_StopAnalogActionMomentum(m_pSteamController,controllerHandle,eAction); +} +public override void TriggerHapticPulse(ulong controllerHandle,uint eTargetPad,char usDurationMicroSec) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamController_TriggerHapticPulse(m_pSteamController,controllerHandle,eTargetPad,usDurationMicroSec); } } @@ -5529,6 +5654,17 @@ public override bool DownloadItem(ulong nPublishedFileID,bool bHighPriority) bool result = NativeEntrypoints.SteamAPI_ISteamUGC_DownloadItem(m_pSteamUGC,nPublishedFileID,bHighPriority); return result; } +public override bool BInitWorkshopForGameServer(uint unWorkshopDepotID,string pszFolder) +{ + CheckIfUsable(); + bool result = NativeEntrypoints.SteamAPI_ISteamUGC_BInitWorkshopForGameServer(m_pSteamUGC,unWorkshopDepotID,pszFolder); + return result; +} +public override void SuspendDownloads(bool bSuspend) +{ + CheckIfUsable(); + NativeEntrypoints.SteamAPI_ISteamUGC_SuspendDownloads(m_pSteamUGC,bSuspend); +} } @@ -6515,6 +6651,7 @@ public enum EResult k_EResultRefundToWallet = 98, k_EResultEmailSendFailure = 99, k_EResultNotSettled = 100, + k_EResultNeedCaptcha = 101, } public enum EVoiceResult { @@ -6617,6 +6754,7 @@ public enum EAppOwnershipFlags k_EAppOwnershipFlags_LicenseRecurring = 4096, k_EAppOwnershipFlags_LicenseCanceled = 8192, k_EAppOwnershipFlags_AutoGrant = 16384, + k_EAppOwnershipFlags_PendingGift = 32768, } public enum EAppType { @@ -6716,6 +6854,24 @@ public enum EBroadcastUploadResult k_EBroadcastUploadResultSettingsChanged = 10, k_EBroadcastUploadResultMissingAudio = 11, k_EBroadcastUploadResultTooFarBehind = 12, + k_EBroadcastUploadResultTranscodeBehind = 13, +} +public enum ELaunchOptionType +{ + k_ELaunchOptionType_None = 0, + k_ELaunchOptionType_Default = 1, + k_ELaunchOptionType_SafeMode = 2, + k_ELaunchOptionType_Multiplayer = 3, + k_ELaunchOptionType_Config = 4, + k_ELaunchOptionType_VR = 5, + k_ELaunchOptionType_Server = 6, + k_ELaunchOptionType_Editor = 7, + k_ELaunchOptionType_Manual = 8, + k_ELaunchOptionType_Benchmark = 9, + k_ELaunchOptionType_Option1 = 10, + k_ELaunchOptionType_Option2 = 11, + k_ELaunchOptionType_Option3 = 12, + k_ELaunchOptionType_Dialog = 1000, } public enum EFailureType { @@ -7071,6 +7227,75 @@ public enum ESteamControllerPad k_ESteamControllerPad_Left = 0, k_ESteamControllerPad_Right = 1, } +public enum EControllerSource +{ + k_EControllerSource_None = 0, + k_EControllerSource_LeftTrackpad = 1, + k_EControllerSource_RightTrackpad = 2, + k_EControllerSource_Joystick = 3, + k_EControllerSource_ABXY = 4, + k_EControllerSource_Switch = 5, + k_EControllerSource_LeftTrigger = 6, + k_EControllerSource_RightTrigger = 7, + k_EControllerSource_Gyro = 8, +} +public enum EControllerSourceMode +{ + k_EControllerSourceMode_None = 0, + k_EControllerSourceMode_Dpad = 1, + k_EControllerSourceMode_Buttons = 2, + k_EControllerSourceMode_FourButtons = 3, + k_EControllerSourceMode_AbsoluteMouse = 4, + k_EControllerSourceMode_RelativeMouse = 5, + k_EControllerSourceMode_JoystickMove = 6, + k_EControllerSourceMode_JoystickCamera = 7, + k_EControllerSourceMode_ScrollWheel = 8, + k_EControllerSourceMode_Trigger = 9, + k_EControllerSourceMode_TouchMenu = 10, +} +public enum EControllerActionOrigin +{ + k_EControllerActionOrigin_None = 0, + k_EControllerActionOrigin_A = 1, + k_EControllerActionOrigin_B = 2, + k_EControllerActionOrigin_X = 3, + k_EControllerActionOrigin_Y = 4, + k_EControllerActionOrigin_LeftBumper = 5, + k_EControllerActionOrigin_RightBumper = 6, + k_EControllerActionOrigin_LeftGrip = 7, + k_EControllerActionOrigin_RightGrip = 8, + k_EControllerActionOrigin_Start = 9, + k_EControllerActionOrigin_Back = 10, + k_EControllerActionOrigin_LeftPad_Touch = 11, + k_EControllerActionOrigin_LeftPad_Swipe = 12, + k_EControllerActionOrigin_LeftPad_Click = 13, + k_EControllerActionOrigin_LeftPad_DPadNorth = 14, + k_EControllerActionOrigin_LeftPad_DPadSouth = 15, + k_EControllerActionOrigin_LeftPad_DPadWest = 16, + k_EControllerActionOrigin_LeftPad_DPadEast = 17, + k_EControllerActionOrigin_RightPad_Touch = 18, + k_EControllerActionOrigin_RightPad_Swipe = 19, + k_EControllerActionOrigin_RightPad_Click = 20, + k_EControllerActionOrigin_RightPad_DPadNorth = 21, + k_EControllerActionOrigin_RightPad_DPadSouth = 22, + k_EControllerActionOrigin_RightPad_DPadWest = 23, + k_EControllerActionOrigin_RightPad_DPadEast = 24, + k_EControllerActionOrigin_LeftTrigger_Pull = 25, + k_EControllerActionOrigin_LeftTrigger_Click = 26, + k_EControllerActionOrigin_RightTrigger_Pull = 27, + k_EControllerActionOrigin_RightTrigger_Click = 28, + k_EControllerActionOrigin_LeftStick_Move = 29, + k_EControllerActionOrigin_LeftStick_Click = 30, + k_EControllerActionOrigin_LeftStick_DPadNorth = 31, + k_EControllerActionOrigin_LeftStick_DPadSouth = 32, + k_EControllerActionOrigin_LeftStick_DPadWest = 33, + k_EControllerActionOrigin_LeftStick_DPadEast = 34, + k_EControllerActionOrigin_Gyro_Move = 35, + k_EControllerActionOrigin_Gyro_Pitch = 36, + k_EControllerActionOrigin_Gyro_Yaw = 37, + k_EControllerActionOrigin_Gyro_Roll = 38, + k_EControllerActionOrigin_Count = 39, +} public enum EUGCMatchingUGCType { k_EUGCMatchingUGCType_Items = 0, @@ -7086,6 +7311,7 @@ public enum EUGCMatchingUGCType k_EUGCMatchingUGCType_UsableInGame = 10, k_EUGCMatchingUGCType_ControllerBindings = 11, k_EUGCMatchingUGCType_GameManagedItems = 12, + k_EUGCMatchingUGCType_All = -1, } public enum EUserUGCList { @@ -7258,6 +7484,7 @@ public enum ESteamItemFlags [StructLayout(LayoutKind.Sequential)] public struct SteamServerConnectFailure_t { public EResult m_eResult; + public bool m_bStillRetrying; } [StructLayout(LayoutKind.Sequential)] public struct SteamServersDisconnected_t { @@ -7758,6 +7985,17 @@ public enum ESteamItemFlags public uint m_nAppID; public ulong m_hFile; } +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageFileWriteAsyncComplete_t +{ + public EResult m_eResult; +} +[StructLayout(LayoutKind.Sequential)] public struct RemoteStorageFileReadAsyncComplete_t +{ + public ulong m_hFileReadAsync; + public EResult m_eResult; + public uint m_nOffset; + public uint m_cubRead; +} [StructLayout(LayoutKind.Sequential)] public struct LeaderboardEntry_t { public ulong m_steamIDUser; @@ -7947,14 +8185,17 @@ public enum ESteamItemFlags public EResult m_eResult; public uint m_unResponseSize; } -[StructLayout(LayoutKind.Sequential)] public struct SteamControllerState001_t +[StructLayout(LayoutKind.Sequential)] public struct ControllerAnalogActionData_t { - public uint unPacketNum; - public ulong ulButtons; - public char sLeftPadX; - public char sLeftPadY; - public char sRightPadX; - public char sRightPadY; + public EControllerSourceMode eMode; + public float x; + public float y; + public bool bActive; +} +[StructLayout(LayoutKind.Sequential)] public struct ControllerDigitalActionData_t +{ + public bool bState; + public bool bActive; } [StructLayout(LayoutKind.Sequential)] public struct SteamUGCDetails_t { diff --git a/public/steam/steam_gameserver.h b/public/steam/steam_gameserver.h index 550097a..f58791f 100644 --- a/public/steam/steam_gameserver.h +++ b/public/steam/steam_gameserver.h @@ -69,8 +69,20 @@ S_API void SteamGameServer_RunCallbacks(); S_API bool SteamGameServer_BSecure(); S_API uint64 SteamGameServer_GetSteamID(); -#define STEAM_GAMESERVER_CALLBACK( thisclass, func, param, var ) CCallback< thisclass, param, true > var; void func( param *pParam ) +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +// These macros are similar to the STEAM_CALLBACK_* macros in steam_api.h, but only trigger for gameserver callbacks +//----------------------------------------------------------------------------------------------------------------------------------------------------------// +#define STEAM_GAMESERVER_CALLBACK( thisclass, func, /*callback_type, [deprecated] var*/... ) \ + _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, GS, 3 ), ( this->SetGameserverFlag();, thisclass, func, __VA_ARGS__ ) ) + +#define STEAM_GAMESERVER_CALLBACK_MANUAL( thisclass, func, callback_type, var ) \ + CCallbackManual< thisclass, callback_type, true > var; void func( callback_type *pParam ) + + + +#define _STEAM_CALLBACK_GS( _, thisclass, func, param, var ) \ + CCallback< thisclass, param, true > var; void func( param *pParam ) //----------------------------------------------------------------------------------------------------------------------------------------------------------// // steamclient.dll private wrapper functions diff --git a/public/steam/steamclientpublic.h b/public/steam/steamclientpublic.h index 4e952dc..a90a13c 100644 --- a/public/steam/steamclientpublic.h +++ b/public/steam/steamclientpublic.h @@ -125,6 +125,7 @@ enum EResult k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet k_EResultEmailSendFailure = 99, // Cannot send an email k_EResultNotSettled = 100, // Can't perform operation till payment has settled + k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha }; // Error codes for use with the voice functions @@ -258,6 +259,7 @@ enum EAppOwnershipFlags k_EAppOwnershipFlags_LicenseRecurring = 0x1000, // Recurring license, user is charged periodically k_EAppOwnershipFlags_LicenseCanceled = 0x2000, // Mark as canceled, but might be still active if recurring k_EAppOwnershipFlags_AutoGrant = 0x4000, // Ownership is based on any kind of autogrant license + k_EAppOwnershipFlags_PendingGift = 0x8000, // user has pending gift to redeem }; @@ -427,6 +429,31 @@ enum EBroadcastUploadResult k_EBroadcastUploadResultSettingsChanged = 10, // the client changed broadcast settings k_EBroadcastUploadResultMissingAudio = 11, // client failed to send audio data k_EBroadcastUploadResultTooFarBehind = 12, // clients was too slow uploading + k_EBroadcastUploadResultTranscodeBehind = 13, // server failed to keep up with transcode +}; + + +//----------------------------------------------------------------------------- +// Purpose: codes for well defined launch options +//----------------------------------------------------------------------------- +enum ELaunchOptionType +{ + k_ELaunchOptionType_None = 0, // unknown what launch option does + k_ELaunchOptionType_Default = 1, // runs the game, app, whatever in default mode + k_ELaunchOptionType_SafeMode = 2, // runs the game in safe mode + k_ELaunchOptionType_Multiplayer = 3, // runs the game in multiplayer mode + k_ELaunchOptionType_Config = 4, // runs config tool for this game + k_ELaunchOptionType_VR = 5, // runs game in VR mode + k_ELaunchOptionType_Server = 6, // runs dedicated server for this game + k_ELaunchOptionType_Editor = 7, // runs game editor + k_ELaunchOptionType_Manual = 8, // shows game manual + k_ELaunchOptionType_Benchmark = 9, // runs game benchmark + k_ELaunchOptionType_Option1 = 10, // generic run option, uses description field for game name + k_ELaunchOptionType_Option2 = 11, // generic run option, uses description field for game name + k_ELaunchOptionType_Option3 = 12, // generic run option, uses description field for game name + + + k_ELaunchOptionType_Dialog = 1000, // show launch options dialog }; diff --git a/redistributable_bin/linux32/libsteam_api.so b/redistributable_bin/linux32/libsteam_api.so index 2bb7a59..948a794 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 357c9ab..532d116 100644 Binary files a/redistributable_bin/linux64/libsteam_api.so and b/redistributable_bin/linux64/libsteam_api.so differ diff --git a/redistributable_bin/osx32/libsteam_api.dylib b/redistributable_bin/osx32/libsteam_api.dylib index bb1fed1..337e13c 100644 Binary files a/redistributable_bin/osx32/libsteam_api.dylib and b/redistributable_bin/osx32/libsteam_api.dylib differ diff --git a/redistributable_bin/steam_api.dll b/redistributable_bin/steam_api.dll index 8ac7a97..f2a0450 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 486b9d3..591f5fd 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 e67d32e..d3c9268 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 2c3fd7c..cfc1b63 100644 Binary files a/redistributable_bin/win64/steam_api64.lib and b/redistributable_bin/win64/steam_api64.lib differ diff --git a/steamworksexample/gameengineosx.h b/steamworksexample/gameengineosx.h index 395a8fa..e7b2111 100644 --- a/steamworksexample/gameengineosx.h +++ b/steamworksexample/gameengineosx.h @@ -16,6 +16,7 @@ typedef unsigned char byte; +#include "steam/steam_api.h" #include "GameEngine.h" #include #include @@ -181,6 +182,31 @@ public: // Get the first (in some arbitrary order) key down, if any bool BGetFirstKeyDown( DWORD *pdwVK ); + // Return true if there is an active Steam Controller + bool BIsSteamControllerActive( ); + + // Find an active Steam controller + void FindActiveSteamController( ); + + // Get the current state of a controller action + bool BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ); + + // Get the current state of a controller action + void GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ); + + // Set the current Steam Controller Action set + void SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ); + + // These calls return a string describing which controller button the action is currently bound to + const char *GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ); + const char *GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ); + + // Initialize the Steam Controller interfaces + void InitSteamController( ); + + // Called each frame to update the Steam Controller interface + void PollSteamController(); + // Get current tick count for the game engine uint64 GetGameTickCount() { return m_ulGameTickCount; } @@ -455,6 +481,26 @@ public: NSOpenGLView *m_view; NSWindow *m_window; #endif + + // An array of handles to Steam Controller events that player can bind to controls + ControllerDigitalActionHandle_t m_ControllerDigitalActionHandles[eControllerDigitalAction_NumActions]; + + // An array of handles to Steam Controller events that player can bind to controls + ControllerAnalogActionHandle_t m_ControllerAnalogActionHandles[eControllerAnalogAction_NumActions]; + + // An array of handles to different Steam Controller action set configurations + ControllerActionSetHandle_t m_ControllerActionSetHandles[eControllerActionSet_NumSets]; + + // A handle to the currently active Steam Controller. + ControllerHandle_t m_ActiveControllerHandle; + + // Origins for all the Steam Controller actions. The 'origin' is where the action is currently bound to, + // ie 'jump' is currently bound to the 'A' button. + EControllerActionOrigin m_ControllerDigitalActionOrigins[eControllerDigitalAction_NumActions]; + EControllerActionOrigin m_ControllerAnalogActionOrigins[eControllerDigitalAction_NumActions]; + + static const char *pOriginStrings[k_EControllerActionOrigin_Count]; + }; #endif // GAMEENGINEOSX_H diff --git a/steamworksexample/gameengineosx.mm b/steamworksexample/gameengineosx.mm index c900e08..655622f 100644 --- a/steamworksexample/gameengineosx.mm +++ b/steamworksexample/gameengineosx.mm @@ -1,6 +1,6 @@ //========= Copyright 1996-2008, Valve LLC, All rights reserved. ============ // -// Purpose: Main class for the game engine -- win32 implementation +// Purpose: Main class for the game engine -- osx implementation // // $NoKeywords: $ //============================================================================= @@ -113,6 +113,51 @@ public: @end +// These are human-readable names for each of the origin enumerations. It is preferred to +// show the supplied icons in-game, but for a simple application these strings can be useful. +const char *CGameEngineGL::pOriginStrings[k_EControllerActionOrigin_Count] = +{ + "None", + "A Button", + "B Button", + "X Button", + "Y Button", + "Left Bumper", + "Right Bumper", + "Left Grip", + "Right Grip", + "Start Button", + "Back Button", + "Left Pad Touch", + "Left Pad Swipe", + "Left Pad Click", + "Left Pad D-Pad Up", + "Left Pad D-Pad Down", + "Left Pad D-Pad West", + "Left Pad D-Pad East", + "Right Pad Touch", + "Right Pad Swipe", + "Right Pad Click", + "Right Pad D-Pad Up", + "Right Pad D-Pad Down", + "Right Pad D-Pad West", + "Right Pad D-Pad East", + "Left Trigger Pull", + "Left Trigger Click", + "Right Trigger Pull", + "Right Trigger Click", + "Left Stick Move", + "Left Stick Click", + "Left Pad D-Pad Up", + "Left Pad D-Pad Down", + "Left Pad D-Pad Left", + "Left Pad D-Pad Right", + "Gyro Move", + "Gyro Pitch", + "Gyro Roll", + "Gyro Yaw" +}; + //----------------------------------------------------------------------------- // Purpose: Constructor for game engine instance //----------------------------------------------------------------------------- @@ -2421,6 +2466,169 @@ void CGameEngineGL::ShowPixels ( CShowPixelsParams *params ) [oldctx makeCurrentContext]; } } - #endif + +//----------------------------------------------------------------------------- +// Purpose: Return true if there is an active Steam Controller +//----------------------------------------------------------------------------- +bool CGameEngineGL::BIsSteamControllerActive( ) +{ + if ( m_ActiveControllerHandle ) + { + return true; + } + + return false; +} + +//----------------------------------------------------------------------------- +// Purpose: Initialize the steam controller actions +//----------------------------------------------------------------------------- +void CGameEngineGL::InitSteamController( ) +{ + // Digital game actions + m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnLeft] = SteamController( )->GetDigitalActionHandle( "turn_left" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnRight] = SteamController( )->GetDigitalActionHandle( "turn_right" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_ForwardThrust] = SteamController( )->GetDigitalActionHandle( "forward_thrust" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_ReverseThrust] = SteamController( )->GetDigitalActionHandle( "backward_thrust" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_FireLasers] = SteamController( )->GetDigitalActionHandle( "fire_lasers" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_PauseMenu] = SteamController( )->GetDigitalActionHandle( "pause_menu" ); + + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuUp] = SteamController( )->GetDigitalActionHandle( "menu_up" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuDown] = SteamController( )->GetDigitalActionHandle( "menu_down" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuLeft] = SteamController( )->GetDigitalActionHandle( "menu_left" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuRight] = SteamController( )->GetDigitalActionHandle( "menu_right" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuSelect] = SteamController( )->GetDigitalActionHandle( "menu_select" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuCancel] = SteamController( )->GetDigitalActionHandle( "menu_cancel" ); + + // Analog game actions + m_ControllerAnalogActionHandles[eControllerAnalogAction_AnalogControls] = SteamController( )->GetAnalogActionHandle( "analog_controls" ); + + // Action set handles + m_ControllerActionSetHandles[eControllerActionSet_ShipControls] = SteamController( )->GetActionSetHandle( "ship_controls" ); + m_ControllerActionSetHandles[eControllerActionSet_MenuControls] = SteamController( )->GetActionSetHandle( "menu_controls" ); + +} + +//----------------------------------------------------------------------------- +// Purpose: Find an active Steam controller +//----------------------------------------------------------------------------- +void CGameEngineGL::FindActiveSteamController( ) +{ + // Use the first available steam controller for all interaction. We can call this each frame to handle + // a controller disconnecting and a different one reconnecting. Handles are guaranteed to be unique for + // a given controller, even across power cycles. + + // See how many Steam Controllers are active. + ControllerHandle_t pHandles[STEAM_CONTROLLER_MAX_COUNT]; + int nNumActive = SteamController( )->GetConnectedControllers( pHandles ); + + // If there's an active controller, and if we're not already using it, select the first one. + if ( nNumActive && (m_ActiveControllerHandle != pHandles[0]) ) + { + m_ActiveControllerHandle = pHandles[0]; + } +} + + +//-------------------------------------------------------------------------------------------------------------- +// Purpose: For a given in-game action in a given action set, return a human-reaadable string to use as a prompt. +//-------------------------------------------------------------------------------------------------------------- +const char *CGameEngineGL::GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ) +{ + EControllerActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS]; + int nNumOrigins = SteamController( )->GetDigitalActionOrigins( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet], m_ControllerDigitalActionHandles[dwDigitalAction], origins ); + + if ( nNumOrigins ) + { + // We should handle the case where this action is bound to multiple buttons, but + // here we just grab the first. + return pOriginStrings[origins[0]]; + } + + return pOriginStrings[0]; // Return "None" +} + +//-------------------------------------------------------------------------------------------------------------- +// Purpose: For a given in-game action in a given action set, return a human-reaadable string to use as a prompt. +//-------------------------------------------------------------------------------------------------------------- +const char *CGameEngineGL::GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ) +{ + EControllerActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS]; + int nNumOrigins = SteamController( )->GetAnalogActionOrigins( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet], m_ControllerDigitalActionHandles[dwDigitalAction], origins ); + + if ( nNumOrigins ) + { + // We should handle the case where this action is bound to multiple buttons, but + // here we just grab the first. + return pOriginStrings[origins[0]]; + } + + return pOriginStrings[0]; // Return "None" +} + +//----------------------------------------------------------------------------- +// Purpose: Called each frame +//----------------------------------------------------------------------------- +void CGameEngineGL::PollSteamController( ) +{ + // There's a bug where the action handles aren't non-zero until a config is done loading. Soon config + // information will be available immediately. Until then try to init as long as the handles are invalid. + if ( m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnLeft] == 0 ) + { + InitSteamController( ); + return; + } + + // Each frame check our active controller handle + FindActiveSteamController( ); + +} + +//----------------------------------------------------------------------------- +// Purpose: Find out if a controller event is currently active +//----------------------------------------------------------------------------- +bool CGameEngineGL::BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ) +{ + ControllerDigitalActionData_t digitalData = SteamController( )->GetDigitalActionData( m_ActiveControllerHandle, m_ControllerDigitalActionHandles[dwAction] ); + + // Actions are only 'active' when they're assigned to a control in an action set, and that action set is active. + if ( digitalData.bActive ) + return digitalData.bState; + + return false; +} + +//--------------------------------------------------------------------------------------------------------------------------------------------------- +// Purpose: Get the current x,y state of the analog action. Examples of an analog action are a virtual joystick on the trackpad or the real joystick. +//--------------------------------------------------------------------------------------------------------------------------------------------------- +void CGameEngineGL::GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ) +{ + ControllerAnalogActionData_t analogData = SteamController( )->GetAnalogActionData( m_ActiveControllerHandle, m_ControllerAnalogActionHandles[dwAction] ); + + // Actions are only 'active' when they're assigned to a control in an action set, and that action set is active. + if ( analogData.bActive ) + { + *x = analogData.x; + *y = analogData.y; + } + else + { + *x = 0.0f; + *y = 0.0f; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------------------------- +// Purpose: Put the controller into a specific action set. Action sets are collections of game-context actions ie "walking", "flying" or "menu" +//----------------------------------------------------------------------------------------------------------------------------------------------------- +void CGameEngineGL::SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ) +{ + if ( m_ActiveControllerHandle == 0 ) + return; + + // This call is low-overhead and can be called repeatedly from game code that is active in a specific mode. + SteamController( )->ActivateActionSet( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet] ); +} + diff --git a/steamworksexample/gameenginesdl.cpp b/steamworksexample/gameenginesdl.cpp index 3d8386d..cd0c324 100644 --- a/steamworksexample/gameenginesdl.cpp +++ b/steamworksexample/gameenginesdl.cpp @@ -78,6 +78,51 @@ power_of_two(int input) return value; } +// These are human-readable names for each of the origin enumerations. It is preferred to +// show the supplied icons in-game, but for a simple application these strings can be useful. +const char *CGameEngineGL::pOriginStrings[k_EControllerActionOrigin_Count] = +{ + "None", + "A Button", + "B Button", + "X Button", + "Y Button", + "Left Bumper", + "Right Bumper", + "Left Grip", + "Right Grip", + "Start Button", + "Back Button", + "Left Pad Touch", + "Left Pad Swipe", + "Left Pad Click", + "Left Pad D-Pad Up", + "Left Pad D-Pad Down", + "Left Pad D-Pad West", + "Left Pad D-Pad East", + "Right Pad Touch", + "Right Pad Swipe", + "Right Pad Click", + "Right Pad D-Pad Up", + "Right Pad D-Pad Down", + "Right Pad D-Pad West", + "Right Pad D-Pad East", + "Left Trigger Pull", + "Left Trigger Click", + "Right Trigger Pull", + "Right Trigger Click", + "Left Stick Move", + "Left Stick Click", + "Left Pad D-Pad Up", + "Left Pad D-Pad Down", + "Left Pad D-Pad Left", + "Left Pad D-Pad Right", + "Gyro Move", + "Gyro Pitch", + "Gyro Roll", + "Gyro Yaw" +}; + //----------------------------------------------------------------------------- // Purpose: Constructor for game engine instance //----------------------------------------------------------------------------- @@ -1183,3 +1228,168 @@ bool CGameEngineGL::AddVoiceData( HGAMEVOICECHANNEL hChannel, const uint8 *pVoic return true; } +//----------------------------------------------------------------------------- +// Purpose: Return true if there is an active Steam Controller +//----------------------------------------------------------------------------- +bool CGameEngineGL::BIsSteamControllerActive( ) +{ + if ( m_ActiveControllerHandle ) + { + return true; + } + + return false; +} + +//----------------------------------------------------------------------------- +// Purpose: Initialize the steam controller actions +//----------------------------------------------------------------------------- +void CGameEngineGL::InitSteamController( ) +{ + // Digital game actions + m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnLeft] = SteamController( )->GetDigitalActionHandle( "turn_left" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnRight] = SteamController( )->GetDigitalActionHandle( "turn_right" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_ForwardThrust] = SteamController( )->GetDigitalActionHandle( "forward_thrust" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_ReverseThrust] = SteamController( )->GetDigitalActionHandle( "backward_thrust" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_FireLasers] = SteamController( )->GetDigitalActionHandle( "fire_lasers" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_PauseMenu] = SteamController( )->GetDigitalActionHandle( "pause_menu" ); + + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuUp] = SteamController( )->GetDigitalActionHandle( "menu_up" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuDown] = SteamController( )->GetDigitalActionHandle( "menu_down" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuLeft] = SteamController( )->GetDigitalActionHandle( "menu_left" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuRight] = SteamController( )->GetDigitalActionHandle( "menu_right" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuSelect] = SteamController( )->GetDigitalActionHandle( "menu_select" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuCancel] = SteamController( )->GetDigitalActionHandle( "menu_cancel" ); + + // Analog game actions + m_ControllerAnalogActionHandles[eControllerAnalogAction_AnalogControls] = SteamController( )->GetAnalogActionHandle( "analog_controls" ); + + // Action set handles + m_ControllerActionSetHandles[eControllerActionSet_ShipControls] = SteamController( )->GetActionSetHandle( "ship_controls" ); + m_ControllerActionSetHandles[eControllerActionSet_MenuControls] = SteamController( )->GetActionSetHandle( "menu_controls" ); + +} + +//----------------------------------------------------------------------------- +// Purpose: Find an active Steam controller +//----------------------------------------------------------------------------- +void CGameEngineGL::FindActiveSteamController( ) +{ + // Use the first available steam controller for all interaction. We can call this each frame to handle + // a controller disconnecting and a different one reconnecting. Handles are guaranteed to be unique for + // a given controller, even across power cycles. + + // See how many Steam Controllers are active. + ControllerHandle_t pHandles[STEAM_CONTROLLER_MAX_COUNT]; + int nNumActive = SteamController( )->GetConnectedControllers( pHandles ); + + // If there's an active controller, and if we're not already using it, select the first one. + if ( nNumActive && (m_ActiveControllerHandle != pHandles[0]) ) + { + m_ActiveControllerHandle = pHandles[0]; + } +} + + +//-------------------------------------------------------------------------------------------------------------- +// Purpose: For a given in-game action in a given action set, return a human-reaadable string to use as a prompt. +//-------------------------------------------------------------------------------------------------------------- +const char *CGameEngineGL::GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ) +{ + EControllerActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS]; + int nNumOrigins = SteamController( )->GetDigitalActionOrigins( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet], m_ControllerDigitalActionHandles[dwDigitalAction], origins ); + + if ( nNumOrigins ) + { + // We should handle the case where this action is bound to multiple buttons, but + // here we just grab the first. + return pOriginStrings[origins[0]]; + } + + return pOriginStrings[0]; // Return "None" +} + +//-------------------------------------------------------------------------------------------------------------- +// Purpose: For a given in-game action in a given action set, return a human-reaadable string to use as a prompt. +//-------------------------------------------------------------------------------------------------------------- +const char *CGameEngineGL::GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ) +{ + EControllerActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS]; + int nNumOrigins = SteamController( )->GetAnalogActionOrigins( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet], m_ControllerDigitalActionHandles[dwDigitalAction], origins ); + + if ( nNumOrigins ) + { + // We should handle the case where this action is bound to multiple buttons, but + // here we just grab the first. + return pOriginStrings[origins[0]]; + } + + return pOriginStrings[0]; // Return "None" +} + +//----------------------------------------------------------------------------- +// Purpose: Called each frame +//----------------------------------------------------------------------------- +void CGameEngineGL::PollSteamController( ) +{ + // There's a bug where the action handles aren't non-zero until a config is done loading. Soon config + // information will be available immediately. Until then try to init as long as the handles are invalid. + if ( m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnLeft] == 0 ) + { + InitSteamController( ); + return; + } + + // Each frame check our active controller handle + FindActiveSteamController( ); + +} + +//----------------------------------------------------------------------------- +// Purpose: Find out if a controller event is currently active +//----------------------------------------------------------------------------- +bool CGameEngineGL::BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ) +{ + ControllerDigitalActionData_t digitalData = SteamController( )->GetDigitalActionData( m_ActiveControllerHandle, m_ControllerDigitalActionHandles[dwAction] ); + + // Actions are only 'active' when they're assigned to a control in an action set, and that action set is active. + if ( digitalData.bActive ) + return digitalData.bState; + + return false; +} + +//--------------------------------------------------------------------------------------------------------------------------------------------------- +// Purpose: Get the current x,y state of the analog action. Examples of an analog action are a virtual joystick on the trackpad or the real joystick. +//--------------------------------------------------------------------------------------------------------------------------------------------------- +void CGameEngineGL::GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ) +{ + ControllerAnalogActionData_t analogData = SteamController( )->GetAnalogActionData( m_ActiveControllerHandle, m_ControllerAnalogActionHandles[dwAction] ); + + // Actions are only 'active' when they're assigned to a control in an action set, and that action set is active. + if ( analogData.bActive ) + { + *x = analogData.x; + *y = analogData.y; + } + else + { + *x = 0.0f; + *y = 0.0f; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------------------------- +// Purpose: Put the controller into a specific action set. Action sets are collections of game-context actions ie "walking", "flying" or "menu" +//----------------------------------------------------------------------------------------------------------------------------------------------------- +void CGameEngineGL::SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ) +{ + if ( m_ActiveControllerHandle == 0 ) + return; + + // This call is low-overhead and can be called repeatedly from game code that is active in a specific mode. + SteamController( )->ActivateActionSet( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet] ); +} + + + diff --git a/steamworksexample/gameenginesdl.h b/steamworksexample/gameenginesdl.h index 5c6d5dd..28b2f4c 100644 --- a/steamworksexample/gameenginesdl.h +++ b/steamworksexample/gameenginesdl.h @@ -139,6 +139,31 @@ public: // Get the first (in some arbitrary order) key down, if any bool BGetFirstKeyDown( DWORD *pdwVK ); + // Return true if there is an active Steam Controller + bool BIsSteamControllerActive( ); + + // Find an active Steam controller + void FindActiveSteamController( ); + + // Get the current state of a controller action + bool BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ); + + // Get the current state of a controller action + void GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ); + + // Set the current Steam Controller Action set + void SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ); + + // These calls return a string describing which controller button the action is currently bound to + const char *GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ); + const char *GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ); + + // Initialize the Steam Controller interfaces + void InitSteamController( ); + + // Called each frame to update the Steam Controller interface + void PollSteamController(); + // Get current tick count for the game engine uint64 GetGameTickCount() { return m_ulGameTickCount; } @@ -250,6 +275,25 @@ public: std::map m_MapVoiceChannel; uint32 m_unVoiceChannelCount; + // An array of handles to Steam Controller events that player can bind to controls + ControllerDigitalActionHandle_t m_ControllerDigitalActionHandles[eControllerDigitalAction_NumActions]; + + // An array of handles to Steam Controller events that player can bind to controls + ControllerAnalogActionHandle_t m_ControllerAnalogActionHandles[eControllerAnalogAction_NumActions]; + + // An array of handles to different Steam Controller action set configurations + ControllerActionSetHandle_t m_ControllerActionSetHandles[eControllerActionSet_NumSets]; + + // A handle to the currently active Steam Controller. + ControllerHandle_t m_ActiveControllerHandle; + + // Origins for all the Steam Controller actions. The 'origin' is where the action is currently bound to, + // ie 'jump' is currently bound to the 'A' button. + EControllerActionOrigin m_ControllerDigitalActionOrigins[eControllerDigitalAction_NumActions]; + EControllerActionOrigin m_ControllerAnalogActionOrigins[eControllerDigitalAction_NumActions]; + + static const char *pOriginStrings[k_EControllerActionOrigin_Count]; + }; #endif // GAMEENGINESDL_H diff --git a/steamworksexample/gameenginewin32.cpp b/steamworksexample/gameenginewin32.cpp index 9e5b7b7..f0b4d38 100644 --- a/steamworksexample/gameenginewin32.cpp +++ b/steamworksexample/gameenginewin32.cpp @@ -23,6 +23,51 @@ // Allocate static member std::map CGameEngineWin32::m_MapEngineInstances; +// These are human-readable names for each of the origin enumerations. It is preferred to +// show the supplied icons in-game, but for a simple application these strings can be useful. +const char *CGameEngineWin32::pOriginStrings[k_EControllerActionOrigin_Count] = +{ + "None", + "A Button", + "B Button", + "X Button", + "Y Button", + "Left Bumper", + "Right Bumper", + "Left Grip", + "Right Grip", + "Start Button", + "Back Button", + "Left Pad Touch", + "Left Pad Swipe", + "Left Pad Click", + "Left Pad D-Pad Up", + "Left Pad D-Pad Down", + "Left Pad D-Pad West", + "Left Pad D-Pad East", + "Right Pad Touch", + "Right Pad Swipe", + "Right Pad Click", + "Right Pad D-Pad Up", + "Right Pad D-Pad Down", + "Right Pad D-Pad West", + "Right Pad D-Pad East", + "Left Trigger Pull", + "Left Trigger Click", + "Right Trigger Pull", + "Right Trigger Click", + "Left Stick Move", + "Left Stick Click", + "Left Pad D-Pad Up", + "Left Pad D-Pad Down", + "Left Pad D-Pad Left", + "Left Pad D-Pad Right", + "Gyro Move", + "Gyro Pitch", + "Gyro Roll", + "Gyro Yaw" +}; + //----------------------------------------------------------------------------- // Purpose: WndProc //----------------------------------------------------------------------------- @@ -217,7 +262,28 @@ CGameEngineWin32::CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32 return; } + + // clear the action handles + for ( int i = 0; i TestCooperativeLevel(); if ( hRes == D3DERR_DEVICELOST ) @@ -1864,6 +1933,165 @@ void CGameEngineWin32::MessagePump() } } +//----------------------------------------------------------------------------- +// Purpose: Return true if there is an active Steam Controller +//----------------------------------------------------------------------------- +bool CGameEngineWin32::BIsSteamControllerActive( ) +{ + if ( m_ActiveControllerHandle ) + { + return true; + } + + return false; +} + +//----------------------------------------------------------------------------- +// Purpose: Initialize the steam controller actions +//----------------------------------------------------------------------------- +void CGameEngineWin32::InitSteamController( ) +{ + // Digital game actions + m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnLeft] = SteamController( )->GetDigitalActionHandle( "turn_left" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_TurnRight] = SteamController( )->GetDigitalActionHandle( "turn_right" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_ForwardThrust] = SteamController( )->GetDigitalActionHandle( "forward_thrust" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_ReverseThrust] = SteamController( )->GetDigitalActionHandle( "backward_thrust" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_FireLasers] = SteamController( )->GetDigitalActionHandle( "fire_lasers" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_PauseMenu] = SteamController( )->GetDigitalActionHandle( "pause_menu" ); + + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuUp] = SteamController( )->GetDigitalActionHandle( "menu_up" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuDown] = SteamController( )->GetDigitalActionHandle( "menu_down" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuLeft] = SteamController( )->GetDigitalActionHandle( "menu_left" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuRight] = SteamController( )->GetDigitalActionHandle( "menu_right" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuSelect] = SteamController( )->GetDigitalActionHandle( "menu_select" ); + m_ControllerDigitalActionHandles[eControllerDigitalAction_MenuCancel] = SteamController( )->GetDigitalActionHandle( "menu_cancel" ); + + // Analog game actions + m_ControllerAnalogActionHandles[eControllerAnalogAction_AnalogControls] = SteamController( )->GetAnalogActionHandle( "analog_controls" ); + + // Action set handles + m_ControllerActionSetHandles[eControllerActionSet_ShipControls] = SteamController( )->GetActionSetHandle( "ship_controls" ); + m_ControllerActionSetHandles[eControllerActionSet_MenuControls] = SteamController( )->GetActionSetHandle( "menu_controls" ); + +} + +//----------------------------------------------------------------------------- +// Purpose: Find an active Steam controller +//----------------------------------------------------------------------------- +void CGameEngineWin32::FindActiveSteamController() +{ + // Use the first available steam controller for all interaction. We can call this each frame to handle + // a controller disconnecting and a different one reconnecting. Handles are guaranteed to be unique for + // a given controller, even across power cycles. + + // See how many Steam Controllers are active. + ControllerHandle_t pHandles[STEAM_CONTROLLER_MAX_COUNT]; + int nNumActive = SteamController( )->GetConnectedControllers( pHandles ); + + // If there's an active controller, and if we're not already using it, select the first one. + if ( nNumActive && (m_ActiveControllerHandle != pHandles[0]) ) + { + m_ActiveControllerHandle = pHandles[0]; + } + + return; +} + + +//-------------------------------------------------------------------------------------------------------------- +// Purpose: For a given in-game action in a given action set, return a human-reaadable string to use as a prompt. +//-------------------------------------------------------------------------------------------------------------- +const char *CGameEngineWin32::GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ) +{ + EControllerActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS]; + int nNumOrigins = SteamController( )->GetDigitalActionOrigins( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet], m_ControllerDigitalActionHandles[dwDigitalAction], origins ); + + if ( nNumOrigins ) + { + // We should handle the case where this action is bound to multiple buttons, but + // here we just grab the first. + return pOriginStrings[origins[0]]; + } + + return pOriginStrings[0]; // Return "None" +} + +//-------------------------------------------------------------------------------------------------------------- +// Purpose: For a given in-game action in a given action set, return a human-reaadable string to use as a prompt. +//-------------------------------------------------------------------------------------------------------------- +const char *CGameEngineWin32::GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ) +{ + EControllerActionOrigin origins[STEAM_CONTROLLER_MAX_ORIGINS]; + int nNumOrigins = SteamController( )->GetAnalogActionOrigins( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet], m_ControllerDigitalActionHandles[dwDigitalAction], origins ); + + if ( nNumOrigins ) + { + // We should handle the case where this action is bound to multiple buttons, but + // here we just grab the first. + return pOriginStrings[origins[0]]; + } + + return pOriginStrings[0]; // Return "None" +} + +//----------------------------------------------------------------------------- +// Purpose: Called each frame +//----------------------------------------------------------------------------- +void CGameEngineWin32::PollSteamController() +{ + + // Each frame check our active controller handle + FindActiveSteamController(); + +} + +//----------------------------------------------------------------------------- +// Purpose: Find out if a controller event is currently active +//----------------------------------------------------------------------------- +bool CGameEngineWin32::BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ) +{ + ControllerDigitalActionData_t digitalData = SteamController( )->GetDigitalActionData( m_ActiveControllerHandle, m_ControllerDigitalActionHandles[dwAction] ); + + // Actions are only 'active' when they're assigned to a control in an action set, and that action set is active. + if ( digitalData.bActive ) + return digitalData.bState; + + return false; +} + +//--------------------------------------------------------------------------------------------------------------------------------------------------- +// Purpose: Get the current x,y state of the analog action. Examples of an analog action are a virtual joystick on the trackpad or the real joystick. +//--------------------------------------------------------------------------------------------------------------------------------------------------- +void CGameEngineWin32::GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ) +{ + ControllerAnalogActionData_t analogData = SteamController( )->GetAnalogActionData( m_ActiveControllerHandle, m_ControllerAnalogActionHandles[dwAction] ); + + // Actions are only 'active' when they're assigned to a control in an action set, and that action set is active. + if ( analogData.bActive ) + { + *x = analogData.x; + *y = analogData.y; + } + else + { + *x = 0.0f; + *y = 0.0f; + } +} + +//----------------------------------------------------------------------------------------------------------------------------------------------------- +// Purpose: Put the controller into a specific action set. Action sets are collections of game-context actions ie "walking", "flying" or "menu" +//----------------------------------------------------------------------------------------------------------------------------------------------------- +void CGameEngineWin32::SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ) +{ + if ( m_ActiveControllerHandle == 0 ) + return; + + // This call is low-overhead and can be called repeatedly from game code that is active in a specific mode. + SteamController( )->ActivateActionSet( m_ActiveControllerHandle, m_ControllerActionSetHandles[dwActionSet] ); +} + + //----------------------------------------------------------------------------- // Purpose: Track keys which are down diff --git a/steamworksexample/gameenginewin32.h b/steamworksexample/gameenginewin32.h index bd337f2..ed5564e 100644 --- a/steamworksexample/gameenginewin32.h +++ b/steamworksexample/gameenginewin32.h @@ -182,6 +182,31 @@ public: // Get the first (in some arbitrary order) key down, if any bool BGetFirstKeyDown( DWORD *pdwVK ); + // Return true if there is an active Steam Controller + bool BIsSteamControllerActive( ); + + // Find an active Steam controller + void FindActiveSteamController( ); + + // Get the current state of a controller action + bool BIsControllerActionActive( ECONTROLLERDIGITALACTION dwAction ); + + // Get the current state of a controller action + void GetControllerAnalogAction( ECONTROLLERANALOGACTION dwAction, float *x, float *y ); + + // Set the current Steam Controller Action set + void SetSteamControllerActionSet( ECONTROLLERACTIONSET dwActionSet ); + + // These calls return a string describing which controller button the action is currently bound to + const char *GetTextStringForControllerOriginDigital( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERDIGITALACTION dwDigitalAction ); + const char *GetTextStringForControllerOriginAnalog( ECONTROLLERACTIONSET dwActionSet, ECONTROLLERANALOGACTION dwDigitalAction ); + + // Initialize the Steam Controller interfaces + void InitSteamController( ); + + // Called each frame to update the Steam Controller interface + void PollSteamController(); + // Get current tick count for the game engine uint64 GetGameTickCount() { return m_ulGameTickCount; } @@ -402,6 +427,26 @@ private: // Map of font handles to font objects std::map m_MapVoiceChannel; uint32 m_unVoiceChannelCount; + + // An array of handles to Steam Controller events that player can bind to controls + ControllerDigitalActionHandle_t m_ControllerDigitalActionHandles[eControllerDigitalAction_NumActions]; + + // An array of handles to Steam Controller events that player can bind to controls + ControllerAnalogActionHandle_t m_ControllerAnalogActionHandles[eControllerAnalogAction_NumActions]; + + // An array of handles to different Steam Controller action set configurations + ControllerActionSetHandle_t m_ControllerActionSetHandles[eControllerActionSet_NumSets]; + + // A handle to the currently active Steam Controller. + ControllerHandle_t m_ActiveControllerHandle; + + // Origins for all the Steam Controller actions. The 'origin' is where the action is currently bound to, + // ie 'jump' is currently bound to the 'A' button. + EControllerActionOrigin m_ControllerDigitalActionOrigins[eControllerDigitalAction_NumActions]; + EControllerActionOrigin m_ControllerAnalogActionOrigins[eControllerDigitalAction_NumActions]; + + static const char *pOriginStrings[k_EControllerActionOrigin_Count]; + }; #endif // GAMEENGINEWIN32_H diff --git a/steamworksexample/htmlsurface.cpp b/steamworksexample/htmlsurface.cpp index 1127853..9509244 100644 --- a/steamworksexample/htmlsurface.cpp +++ b/steamworksexample/htmlsurface.cpp @@ -50,7 +50,8 @@ CHTMLSurface::~CHTMLSurface() //----------------------------------------------------------------------------- void CHTMLSurface::RunFrame() { - if ( m_pGameEngine->BIsKeyDown( VK_ESCAPE ) ) + if ( m_pGameEngine->BIsKeyDown( VK_ESCAPE ) || + m_pGameEngine->BIsControllerActionActive( eControllerDigitalAction_MenuCancel ) ) { SpaceWarClient()->SetGameState( k_EClientGameMenu ); } diff --git a/tools/drm/drmtoolp.exe b/tools/drm/drmtoolp.exe index c749ca6..cf72eec 100644 Binary files a/tools/drm/drmtoolp.exe and b/tools/drm/drmtoolp.exe differ diff --git a/tools/drm/ubuntu12_32/drmtoolp b/tools/drm/ubuntu12_32/drmtoolp index 188c6c0..70b0a1f 100644 Binary files a/tools/drm/ubuntu12_32/drmtoolp and b/tools/drm/ubuntu12_32/drmtoolp differ diff --git a/tools/drm/ubuntu12_32/drmunpackp.so b/tools/drm/ubuntu12_32/drmunpackp.so index 53320b9..3a88661 100644 Binary files a/tools/drm/ubuntu12_32/drmunpackp.so and b/tools/drm/ubuntu12_32/drmunpackp.so differ diff --git a/tools/drm/ubuntu12_32/steamdrmp.so b/tools/drm/ubuntu12_32/steamdrmp.so index 187eca5..c8f5b26 100644 Binary files a/tools/drm/ubuntu12_32/steamdrmp.so and b/tools/drm/ubuntu12_32/steamdrmp.so differ diff --git a/tools/drm/ubuntu12_64/drmtoolp b/tools/drm/ubuntu12_64/drmtoolp index b1d433c..1f9bbd5 100644 Binary files a/tools/drm/ubuntu12_64/drmtoolp and b/tools/drm/ubuntu12_64/drmtoolp differ diff --git a/tools/drm/ubuntu12_64/drmunpackp.so b/tools/drm/ubuntu12_64/drmunpackp.so index 864439b..00ca815 100644 Binary files a/tools/drm/ubuntu12_64/drmunpackp.so and b/tools/drm/ubuntu12_64/drmunpackp.so differ diff --git a/tools/drm/ubuntu12_64/steamdrmp.so b/tools/drm/ubuntu12_64/steamdrmp.so index 31a4e18..daa34ea 100644 Binary files a/tools/drm/ubuntu12_64/steamdrmp.so and b/tools/drm/ubuntu12_64/steamdrmp.so differ diff --git a/tools/goldmaster/disk_assets/Setup.exe b/tools/goldmaster/disk_assets/Setup.exe index 44b16d8..2473500 100644 Binary files a/tools/goldmaster/disk_assets/Setup.exe and b/tools/goldmaster/disk_assets/Setup.exe differ diff --git a/tools/goldmaster/disk_assets/SteamSetup.exe b/tools/goldmaster/disk_assets/SteamSetup.exe index d7186fb..e93447e 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/setup_korean.ini b/tools/goldmaster/disk_assets/resources/setup_koreana.ini similarity index 100% rename from tools/goldmaster/disk_assets/resources/setup_korean.ini rename to tools/goldmaster/disk_assets/resources/setup_koreana.ini