diff --git a/SteamworksExample/BaseMenu.h b/SteamworksExample/BaseMenu.h index 2715122..10bdc7b 100644 --- a/SteamworksExample/BaseMenu.h +++ b/SteamworksExample/BaseMenu.h @@ -13,6 +13,7 @@ #include "GameEngine.h" #include "SpaceWar.h" #include "SpaceWarClient.h" +#include "steam/isteamcontroller.h" #define MENU_FONT_HEIGHT 24 #define MENU_ITEM_PADDING 12 @@ -102,8 +103,39 @@ 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 ) ) + if ( m_pGameEngine->BIsKeyDown( VK_RETURN ) || bControllerActivate ) { uint64 ulCurrentTickCount = m_pGameEngine->GetGameTickCount(); if ( ulCurrentTickCount - 220 > g_ulLastReturnKeyTick ) @@ -111,17 +143,23 @@ 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 ) ) + else if ( m_pGameEngine->BIsKeyDown( VK_DOWN ) || bControllerDown ) { 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++; @@ -129,11 +167,14 @@ public: m_uSelectedItem = 0; } } - else if ( m_pGameEngine->BIsKeyDown( VK_UP ) ) + else if ( m_pGameEngine->BIsKeyDown( VK_UP ) || bControllerUp ) { 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/Main.cpp b/SteamworksExample/Main.cpp index 236bd0d..5248e1e 100644 --- a/SteamworksExample/Main.cpp +++ b/SteamworksExample/Main.cpp @@ -6,6 +6,12 @@ #include "stdafx.h" #include "steam/steam_api.h" +#ifdef WIN32 +#include +#else +#define MAX_PATH PATH_MAX +#define _getcwd getcwd +#endif #if defined(WIN32) #include "gameenginewin32.h" @@ -200,6 +206,21 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) // with important UI in your game. SteamUtils()->SetOverlayNotificationPosition( k_EPositionTopRight ); + // We are going to use the controller interface, initialize it, which is a seperate step as it + // create a new thread in the game proc and we don't want to force that on games that don't + // have native Steam controller implementations + + char rgchCWD[1024]; + _getcwd( rgchCWD, sizeof( rgchCWD ) ); + + char rgchFullPath[1024]; +#if defined(_WIN32) + _snprintf( rgchFullPath, sizeof( rgchFullPath ), "%s\\%s", rgchCWD, "controller.vdf" ); +#else + _snprintf( rgchFullPath, sizeof( rgchFullPath ), "%s/%s", rgchCWD, "controller.vdf" ); +#endif + SteamController()->Init( rgchFullPath ); + const char *pchServerAddress, *pchLobbyID; ParseCommandLine( pchCmdLine, &pchServerAddress, &pchLobbyID ); // do a DRM self check @@ -222,6 +243,7 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow ) RunGameLoop( pGameEngine, pchServerAddress, pchLobbyID ); // Shutdown the SteamAPI + SteamController()->Shutdown(); SteamAPI_Shutdown(); // Shutdown Steam CEG diff --git a/SteamworksExample/SpaceWarClient.cpp b/SteamworksExample/SpaceWarClient.cpp index f5901ac..96e2f26 100644 --- a/SteamworksExample/SpaceWarClient.cpp +++ b/SteamworksExample/SpaceWarClient.cpp @@ -79,6 +79,7 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine ) } #endif + m_bLastControllerStateInMenu = false; g_pSpaceWarClient = this; m_pGameEngine = pGameEngine; m_uPlayerWhoWonGame = 0; @@ -1132,6 +1133,30 @@ 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 ) { diff --git a/SteamworksExample/SpaceWarClient.h b/SteamworksExample/SpaceWarClient.h index 0827653..fa11a7d 100644 --- a/SteamworksExample/SpaceWarClient.h +++ b/SteamworksExample/SpaceWarClient.h @@ -395,6 +395,8 @@ private: // 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/client/steam.exe b/client/steam.exe index d84e1a2..1ed90ae 100644 Binary files a/client/steam.exe and b/client/steam.exe differ diff --git a/glmgr/cglmfbo.cpp b/glmgr/cglmfbo.cpp index 1cf1698..01d4ef1 100644 --- a/glmgr/cglmfbo.cpp +++ b/glmgr/cglmfbo.cpp @@ -72,6 +72,7 @@ static GLenum EncodeAttachmentFBO( EGLMFBOAttachment index ) default: GLMStop(); // bad news + return 0; break; } } diff --git a/glmgr/cglmprogram.cpp b/glmgr/cglmprogram.cpp index c772f39..b137523 100644 --- a/glmgr/cglmprogram.cpp +++ b/glmgr/cglmprogram.cpp @@ -396,7 +396,7 @@ bool CGLMProgram::Compile( EGLMProgramLang lang ) GetComboIndexNameString( tempname, sizeof(tempname) ); - printf("\ncompile: %s on GL name %d ", tempname, glslDesc->m_object.glsl ); + printf("\ncompile: %s on GL name %p ", tempname, glslDesc->m_object.glsl ); } result = glslDesc->m_valid; @@ -669,6 +669,8 @@ bool CGLMProgram::CheckValidity( EGLMProgramLang lang ) } break; } + + return false; } void CGLMProgram::LogSlow( EGLMProgramLang lang ) @@ -1002,11 +1004,12 @@ bool CGLMShaderPair::RefreshProgramPair ( void ) if (vpgood && fpgood) { - SetProgramPair( vp, fp ); + return SetProgramPair( vp, fp ); } else { Debugger(); + return false; } } @@ -1168,7 +1171,7 @@ CGLMShaderPair *CGLMShaderPairCache::SelectShaderPair( CGLMProgram *vp, CGLMProg if (loglevel >= 3) // hits logged at level 3 and higher { - printf("\nSSP: hit - row %05d - pair $%08x (%d'th hit on row)",rowIndex, hit->m_pair, m_hits[ rowIndex ] ); + printf("\nSSP: hit - row %05d - pair $%p (%d'th hit on row)",rowIndex, hit->m_pair, m_hits[ rowIndex ] ); } result = hit->m_pair; diff --git a/glmgr/cglmtex.cpp b/glmgr/cglmtex.cpp index cf0e044..9ee3d86 100644 --- a/glmgr/cglmtex.cpp +++ b/glmgr/cglmtex.cpp @@ -572,7 +572,7 @@ GLMTexLayout *CGLMTexLayoutTable::NewLayoutRef( GLMTexLayoutKey *key ) case GL_TEXTURE_CUBE_MAP: targetname = "CUBE"; break; } - sprintf( scratch, "[%s %s %dx%dx%d mips=%d slices=%d flags=%02X%s]", + sprintf( scratch, "[%s %s %dx%dx%d mips=%d slices=%d flags=%02lX%s]", targetname, formatDesc->m_formatSummary, layout->m_key.m_xSize, layout->m_key.m_ySize, layout->m_key.m_zSize, @@ -698,7 +698,7 @@ CGLMTex::CGLMTex( GLMContext *ctx, GLMTexLayout *layout, GLMTexSamplingParams *s if (gl_texmsaalog/* .GetInt() */) { - printf( "\n == MSAA Tex %8x %s : MSAA RBO is intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, msaaFormat ), msaaFormat ); + printf( "\n == MSAA Tex %p %s : MSAA RBO is intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, msaaFormat ), msaaFormat ); } glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 ); @@ -1406,7 +1406,7 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa { if (gl_texmsaalog/* .GetInt() */) { - printf( "\n == MSAA Tex %8x %s : glTexImage2D for flat tex using intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, intformat ), intformat ); + printf( "\n == MSAA Tex %p %s : glTexImage2D for flat tex using intformat %s (%x)", this, m_debugLabel?m_debugLabel:"", GLMDecode( eGL_ENUM, intformat ), intformat ); printf( "\n" ); } } diff --git a/glmgr/dx9asmtogl2.cpp b/glmgr/dx9asmtogl2.cpp index 110041d..cc6e831 100644 --- a/glmgr/dx9asmtogl2.cpp +++ b/glmgr/dx9asmtogl2.cpp @@ -157,7 +157,7 @@ void ReplaceParamName( const char *pSrc, const char *pNewParamName, char *pOut, const char *pDot = GetSwizzleDot( pSrc ); if ( pDot ) { - V_strncat( pOut, pDot, nOutLen ); + strncat( pOut, pDot, nOutLen - strlen( pOut ) - 1 ); } } @@ -899,7 +899,7 @@ CUtlString D3DToGL::FixGLSLSwizzle( const char *pDestRegisterName, const char *p char szFixedSrcRegister[128]; GetParamNameWithoutSwizzle( pSrcRegisterName, szFixedSrcRegister, sizeof( szFixedSrcRegister ) ); - V_strncat( szFixedSrcRegister, ".", sizeof( szFixedSrcRegister ) ); + strncat( szFixedSrcRegister, ".", sizeof(szFixedSrcRegister) - strlen(szFixedSrcRegister) - 1 ); for ( int i=0; i < nSwizzlesInDest; i++ ) { char chDestWriteMask = GetSwizzleComponent( pDestRegisterName, i ); @@ -908,7 +908,7 @@ CUtlString D3DToGL::FixGLSLSwizzle( const char *pDestRegisterName, const char *p char ch[2]; ch[0] = GetSwizzleComponent( pSrcRegisterName, nVectorIndex ); ch[1] = 0; - V_strncat( szFixedSrcRegister, ch, sizeof( szFixedSrcRegister ) ); + strncat( szFixedSrcRegister, ch, sizeof(szFixedSrcRegister) - strlen(szFixedSrcRegister) - 1 ); } SimplifyFourParamRegister( szFixedSrcRegister ); @@ -1532,9 +1532,9 @@ void D3DToGL::AddTokenHexCodeToBuffer( char *pBuffer, int nSize, int nLastStrlen { char szTemp[32]; V_snprintf( szTemp, sizeof( szTemp ), "0x%x ", m_pRecordedInputTokenStart[i] ); - V_strncat( szHex, szTemp, sizeof( szHex ) ); + strncat( szHex, szTemp, sizeof(szHex) - strlen(szHex) - 1 ); } - V_strncat( szHex, "\n", sizeof( szHex ) ); + strncat( szHex, "\n", sizeof(szHex) - strlen(szHex) - 1 ); // Insert the hex codes into the string. int nBytesToInsert = V_strlen( szHex ); @@ -1547,7 +1547,7 @@ void D3DToGL::AddTokenHexCodeToBuffer( char *pBuffer, int nSize, int nLastStrlen if ( pBuffer[nCurStrlen-1] == '\n' ) pBuffer[nCurStrlen-1] = 0; - V_strncat( pBuffer, &szHex[1], nSize ); + strncat( pBuffer, &szHex[1], nSize - strlen( pBuffer ) - 1 ); } else { @@ -1746,7 +1746,7 @@ void D3DToGL::Handle_DEF() if ( !strchr( szTemp, '.' ) ) { - V_strncat( szTemp, ".0", sizeof( szTemp ) ); + strncat( szTemp, ".0", sizeof(szTemp) - strlen(szTemp) - 1 ); } PrintToBuf( *m_pBufParamCode, i != 3 ? "%s, " : "%s", szTemp ); // end with comma-space @@ -2044,7 +2044,7 @@ void D3DToGL::Handle_TEX( uint32 dwToken, bool bIsTexLDL ) char szLOD[128], szExtra[8]; GetParamNameWithoutSwizzle( pSrc0Reg, szLOD, sizeof( szLOD ) ); V_snprintf( szExtra, sizeof( szExtra ), ".%c", GetSwizzleComponent( pSrc0Reg, 3 ) ); - V_strncat( szLOD, szExtra, sizeof( szLOD ) ); + strncat( szLOD, szExtra, sizeof(szLOD) - strlen(szLOD) - 1 ); PrintToBuf( *m_pBufALUCode, "%s = texture2DLod( %s, %s, %s );\n", pDestReg, pSrc1Reg, sCoordVar.String(), szLOD ); } @@ -2780,7 +2780,7 @@ int D3DToGL::TranslateShader( uint32* code, CUtlBuffer *pBufDisassembledCode, bo if ( ( dwToken & 0xFFFF0000 ) == 0xFFFF0000 ) { // must explicitly enable extensions if emitting GLSL - V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), m_bGLSL ? "#version 120\n%s" : "!!ARBfp1.0\n", glslBindableUniformExtText ); + V_snprintf( (char *)m_pBufHeaderCode->Base(), m_pBufHeaderCode->Size(), m_bGLSL ? "#version 120\n%s" : "!!ARBfp1.0\n%s", glslBindableUniformExtText ); m_bVertexShader = false; } else // vertex shader diff --git a/glmgr/dxabstract.cpp b/glmgr/dxabstract.cpp index f6fbdf7..5d622d9 100644 --- a/glmgr/dxabstract.cpp +++ b/glmgr/dxabstract.cpp @@ -968,6 +968,9 @@ UINT IDirect3D9::GetAdapterCount() int dxAdapterCount = db->GetFakeAdapterCount(); return dxAdapterCount; +#else + Debugger(); + return 0; #endif } @@ -1150,6 +1153,9 @@ HRESULT IDirect3D9::GetAdapterIdentifier( UINT Adapter, DWORD Flags, D3DADAPTER_ #endif return S_OK; +#else + Debugger(); + return D3DERR_INVALIDCALL; #endif } @@ -1361,6 +1367,9 @@ HRESULT IDirect3D9::CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORM } return result; +#else + Debugger(); + return D3DERR_INVALIDCALL; #endif } @@ -1387,7 +1396,9 @@ UINT IDirect3D9::GetAdapterModeCount(UINT Adapter,D3DFORMAT Format) GLMPRINTF(( "-X- --> result is %d", modeCount )); return modeCount; - +#else + Debugger(); + return 0; #endif } @@ -1424,7 +1435,9 @@ HRESULT IDirect3D9::EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3D GLMPRINTF(( "-X- IDirect3D9::EnumAdapterModes returning mode size (%d,%d) and D3DFMT_X8R8G8B8",pMode->Width,pMode->Height )); return S_OK; - +#else + Debugger(); + return D3DERR_INVALIDCALL; #endif } @@ -1475,7 +1488,9 @@ HRESULT IDirect3D9::GetAdapterDisplayMode(UINT Adapter,D3DDISPLAYMODE* pMode) pMode->Format = D3DFMT_X8R8G8B8; //FIXME, this is a SWAG return S_OK; - +#else + Debugger(); + return D3DERR_INVALIDCALL; #endif } @@ -1587,6 +1602,9 @@ HRESULT IDirect3D9::CheckDeviceMultiSampleType( UINT Adapter,D3DDEVTYPE DeviceTy break; } return D3DERR_NOTAVAILABLE; +#else + Debugger(); + return D3DERR_NOTAVAILABLE; #endif } @@ -2172,6 +2190,9 @@ HRESULT IDirect3DDevice9::Create( IDirect3DDevice9Params *params ) g_engine->RenderedSize( m_params.m_presentationParameters.BackBufferWidth, m_params.m_presentationParameters.BackBufferHeight, true ); // true = set return result; +#else + Debugger(); + return D3DERR_INVALIDCALL; #endif } @@ -2322,6 +2343,9 @@ HRESULT IDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) m_ctx->SetDisplayParams( &glmParams ); return S_OK; +#else + Debugger(); + return D3DERR_INVALIDCALL; #endif } @@ -3585,11 +3609,13 @@ HRESULT IDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDec HRESULT IDirect3DDevice9::SetFVF(DWORD FVF) { Debugger(); + return D3DERR_INVALIDCALL; } HRESULT IDirect3DDevice9::GetFVF(DWORD* pFVF) { Debugger(); + return D3DERR_INVALIDCALL; } @@ -3617,6 +3643,8 @@ HRESULT IDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffe m_streams[ StreamNumber ].m_offset = 0; m_streams[ StreamNumber ].m_stride = 0; } + + return S_OK; } #pragma mark ----- Index Buffers - (IDirect3DDevice9) @@ -3626,6 +3654,7 @@ HRESULT IDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) { // just latch it. m_indices.m_idxBuffer = pIndexData; + return S_OK; } @@ -4716,6 +4745,8 @@ HRESULT IDirect3DDevice9::FlushStates( uint mask ) m_ctx->WriteClearStencil( &gl.m_ClearStencil ); gl.m_stateDirtyMask &= (~stateHitMask); + + return S_OK; } @@ -5002,12 +5033,16 @@ HRESULT IDirect3DDevice9::FlushSamplers( uint mask ) glsamp->m_compareMode = dxsamp->m_shadowFilter ? GL_COMPARE_R_TO_TEXTURE_ARB : GL_NONE; } } + + return S_OK; } HRESULT IDirect3DDevice9::FlushIndexBindings( void ) { // push index buffer state m_ctx->SetIndexBuffer( m_indices.m_idxBuffer->m_idxBuffer ); + + return S_OK; } #if 0 @@ -5221,6 +5256,8 @@ HRESULT IDirect3DDevice9::FlushVertexBindings( uint baseVertexIndex ) memcpy( &setup.m_vtxAttribMap, m_vertexShader->m_vtxAttribMap, sizeof( m_vertexShader->m_vtxAttribMap ) ); m_ctx->SetVertexAttributes( &setup ); + + return S_OK; } @@ -5228,6 +5265,7 @@ HRESULT IDirect3DDevice9::FlushVertexBindings( uint baseVertexIndex ) HRESULT IDirect3DDevice9::FlushGLM( void ) { Debugger();// old routine not used now + return D3DERR_INVALIDCALL; } HRESULT IDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) @@ -5492,7 +5530,6 @@ void IDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARA // just slam it directly for the time being // this code is OS X specific - CGTableCount sampleCount; CGDisplayErr cgErr; CGGammaValue redt[256]; diff --git a/glmgr/glmgr.cpp b/glmgr/glmgr.cpp index 28ded31..eb3911d 100644 --- a/glmgr/glmgr.cpp +++ b/glmgr/glmgr.cpp @@ -11,6 +11,10 @@ extern CGameEngineGL *g_engine; // so glmgr (which is C++) can call up to the game engine ObjC object and ask for things.. +#ifdef __clang__ +#pragma clang diagnostic warning "-Wint-to-pointer-cast" +#endif + //=============================================================================== @@ -2310,6 +2314,7 @@ bool GLMContext::SetDisplayParams( GLMDisplayParams *params ) { m_displayParams = *params; // latch em m_displayParamsValid = true; + return true; } //extern ConVar gl_singlecontext; // single context mode go-ahead if 10.6.3 or higher @@ -2725,6 +2730,8 @@ int GLMContext::BindTexToTMU( CGLMTex *tex, int tmu, bool noCheck ) } m_samplers[tmu].m_boundTex = NULL; } + + return 0; } void GLMContext::BindFBOToCtx( CGLMFBO *fbo, GLenum bindPoint ) @@ -2871,7 +2878,7 @@ void GLMContext::FlushDrawStates( bool shadersOn ) // shadersOn = true for draw if (tex->m_rboName) // is it MSAA { // mark it dirty - tex->m_rboDirty++; + tex->m_rboDirty = true; } } } diff --git a/glmgr/glmgrbasics.h b/glmgr/glmgrbasics.h index 50fa448..f31afe3 100644 --- a/glmgr/glmgrbasics.h +++ b/glmgr/glmgrbasics.h @@ -154,7 +154,6 @@ private: #define V_vsnprintf(a,b,c,d) vsprintf(a,c,d) // double check this #define V_snprintf snprintf #define V_strncpy strncpy -#define V_strncat strncat #define V_strcmp strcmp #define V_strlen strlen #define V_strstr strstr diff --git a/glmgr/glmgrext.cpp b/glmgr/glmgrext.cpp index bf86600..33d9764 100644 --- a/glmgr/glmgrext.cpp +++ b/glmgr/glmgrext.cpp @@ -18,6 +18,9 @@ PFNglDisableIndexedEXT pfnglDisableIndexedEXT; PFNglGetFramebufferAttachmentParameteriv pfnglGetFramebufferAttachmentParameteriv; PFNglUniformBufferEXT pfnglUniformBufferEXT; +// NSSymbol was deprecated in 10.5. +#pragma clang diagnostic warning "-Wdeprecated-declarations" + void * NSGLGetProcAddress (const char *name) { NSSymbol symbol; diff --git a/public/steam/isteamcontroller.h b/public/steam/isteamcontroller.h index e7ef50d..0ca35c5 100644 --- a/public/steam/isteamcontroller.h +++ b/public/steam/isteamcontroller.h @@ -11,6 +11,7 @@ #endif #include "isteamclient.h" +#include "steamcontrollerpublic.h" // callbacks #if defined( VALVE_CALLBACK_PACK_SMALL ) @@ -21,16 +22,44 @@ #error isteamclient.h must be included #endif +#define MAX_STEAM_CONTROLLERS 8 #pragma pack( pop ) +enum ESteamControllerPad +{ + k_ESteamControllerPad_Left, + k_ESteamControllerPad_Right +}; + + //----------------------------------------------------------------------------- -// Purpose: Functions for accessing stats, achievements, and leaderboard information +// 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; + virtual bool Shutdown() = 0; + + // Pump callback/callresult events, SteamAPI_RunCallbacks will do this for you, + // normally never need to call 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" diff --git a/public/steam/lib/linux32/libsdkencryptedappticket.so b/public/steam/lib/linux32/libsdkencryptedappticket.so index cc5bee3..d204e39 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/win32/sdkencryptedappticket.dll b/public/steam/lib/win32/sdkencryptedappticket.dll index 4b6e3f8..4818c5f 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 06530bf..6081651 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 55b2f90..a2a3931 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 f3fde49..02f9e89 100644 Binary files a/public/steam/lib/win64/sdkencryptedappticket64.lib and b/public/steam/lib/win64/sdkencryptedappticket64.lib differ diff --git a/public/steam/steamclientpublic.h b/public/steam/steamclientpublic.h index abbad41..4469191 100644 --- a/public/steam/steamclientpublic.h +++ b/public/steam/steamclientpublic.h @@ -107,6 +107,7 @@ enum EResult k_EResultDisabled = 80, // The requested service has been configured to be unavailable k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid ! k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action + k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted }; // Error codes for use with the voice functions @@ -221,15 +222,17 @@ enum EAppReleaseState //----------------------------------------------------------------------------- enum EAppOwernshipFlags { - k_EAppOwernshipFlags_None = 0, // unknown - k_EAppOwernshipFlags_OwnsLicense = 1, // owns license for this game - k_EAppOwernshipFlags_FreeLicense = 2, // not paid for game - k_EAppOwernshipFlags_RegionRestricted = 4, // owns app, but not allowed to play in current region - k_EAppOwernshipFlags_LowViolence = 8, // only low violence version - k_EAppOwernshipFlags_InvalidPlatform = 16, // app not supported on current platform - k_EAppOwernshipFlags_SharedLicense = 32, // license was granted by authorized local device - k_EAppOwernshipFlags_FreeWeekend = 64, // owned by a free weekend licenses - k_EAppOwernshipFlags_LicenseLocked = 128, // shared license is locked (in use) by other user + k_EAppOwernshipFlags_None = 0x000, // unknown + k_EAppOwernshipFlags_OwnsLicense = 0x001, // owns license for this game + k_EAppOwernshipFlags_FreeLicense = 0x002, // not paid for game + k_EAppOwernshipFlags_RegionRestricted = 0x004, // owns app, but not allowed to play in current region + k_EAppOwernshipFlags_LowViolence = 0x008, // only low violence version + k_EAppOwernshipFlags_InvalidPlatform = 0x010, // app not supported on current platform + k_EAppOwernshipFlags_SharedLicense = 0x020, // license was granted by authorized local device + k_EAppOwernshipFlags_FreeWeekend = 0x040, // owned by a free weekend licenses + k_EAppOwernshipFlags_LicenseLocked = 0x080, // shared license is locked (in use) by other user + k_EAppOwernshipFlags_LicensePending = 0x100, // owns app, but transaction is still pending. Can't install or play + k_EAppOwernshipFlags_LicenseExpired = 0x200, // doesn't own app anymore since license expired }; diff --git a/public/steam/steamcontrollerpublic.h b/public/steam/steamcontrollerpublic.h new file mode 100644 index 0000000..0449333 --- /dev/null +++ b/public/steam/steamcontrollerpublic.h @@ -0,0 +1,76 @@ +//========= Copyright © 1996-2013, Valve LLC, All rights reserved. ============ +// +// Purpose: Controller related public types/constants +// +//============================================================================= + +#ifndef STEAMCONTROLLERPUBLIC_H +#define STEAMCONTROLLERPUBLIC_H +#ifdef _WIN32 +#pragma once +#endif + + +#if defined( STEAM ) || defined( ISTEAMCONTROLLER_H ) +// This file should only be included by the Steam build or directly from +// isteamcontroller.h. +#include "steamtypes.h" +#else +// Otherwise, we assume it's a firmware build, which doesn't deal with all the +// things that exist in steamtypes.h, and hardcode the typedefs we need. +typedef unsigned int uint32; +typedef unsigned __int64 uint64; +#endif + +#pragma pack(1) + +// Safe to add new bitfields at the end of this list for new buttons/actions, +// but never re-use or re-number an existing flag as old client code will be +// confused. +#define STEAM_RIGHT_TRIGGER_MASK 0x0000000000000001l +#define STEAM_LEFT_TRIGGER_MASK 0x0000000000000002l +#define STEAM_RIGHT_BUMPER_MASK 0x0000000000000004l +#define STEAM_LEFT_BUMPER_MASK 0x0000000000000008l +#define STEAM_BUTTON_0_MASK 0x0000000000000010l +#define STEAM_BUTTON_1_MASK 0x0000000000000020l +#define STEAM_BUTTON_2_MASK 0x0000000000000040l +#define STEAM_BUTTON_3_MASK 0x0000000000000080l +#define STEAM_TOUCH_0_MASK 0x0000000000000100l +#define STEAM_TOUCH_1_MASK 0x0000000000000200l +#define STEAM_TOUCH_2_MASK 0x0000000000000400l +#define STEAM_TOUCH_3_MASK 0x0000000000000800l +#define STEAM_BUTTON_MENU_MASK 0x0000000000001000l +#define STEAM_BUTTON_STEAM_MASK 0x0000000000002000l +#define STEAM_BUTTON_ESCAPE_MASK 0x0000000000004000l +#define STEAM_BUTTON_BACK_LEFT_MASK 0x0000000000008000l +#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0000000000010000l +#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0000000000020000l +#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0000000000040000l +#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0000000000080000l +#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0000000000100000l + +// Only add fields to the end of this struct, or if you need to change it in a larger +// way add a new message id and new struct completely so as to not break old clients. +typedef struct +{ + // 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; + +} SteamControllerState_t; + +#pragma pack() + +#endif // STEAMCONTROLLERPUBLIC_H + diff --git a/redistributable_bin/Steam.dll b/redistributable_bin/Steam.dll index 03c58ff..57c88d4 100644 Binary files a/redistributable_bin/Steam.dll and b/redistributable_bin/Steam.dll differ diff --git a/redistributable_bin/linux32/libSteam.so b/redistributable_bin/linux32/libSteam.so index b636e27..5cc1f8f 100644 Binary files a/redistributable_bin/linux32/libSteam.so and b/redistributable_bin/linux32/libSteam.so differ diff --git a/redistributable_bin/linux32/libsteam_api.so b/redistributable_bin/linux32/libsteam_api.so index e2931ce..21b14b8 100644 Binary files a/redistributable_bin/linux32/libsteam_api.so and b/redistributable_bin/linux32/libsteam_api.so differ diff --git a/redistributable_bin/linux32/libtier0_s.so b/redistributable_bin/linux32/libtier0_s.so index ea1227e..20890ef 100644 Binary files a/redistributable_bin/linux32/libtier0_s.so and b/redistributable_bin/linux32/libtier0_s.so differ diff --git a/redistributable_bin/linux32/libvstdlib_s.so b/redistributable_bin/linux32/libvstdlib_s.so index 80c17f5..ea6622e 100644 Binary files a/redistributable_bin/linux32/libvstdlib_s.so and b/redistributable_bin/linux32/libvstdlib_s.so differ diff --git a/redistributable_bin/linux32/steamclient.so b/redistributable_bin/linux32/steamclient.so index f18caa4..0e746de 100644 Binary files a/redistributable_bin/linux32/steamclient.so and b/redistributable_bin/linux32/steamclient.so differ diff --git a/redistributable_bin/linux64/libsteam_api.so b/redistributable_bin/linux64/libsteam_api.so index 43ca9fb..5d8562a 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.dylib b/redistributable_bin/osx32/libSteam.dylib index 24ce271..66d7a6e 100644 Binary files a/redistributable_bin/osx32/libSteam.dylib and b/redistributable_bin/osx32/libSteam.dylib differ diff --git a/redistributable_bin/osx32/libsteam_api.dylib b/redistributable_bin/osx32/libsteam_api.dylib index 15adbf1..7b55020 100644 Binary files a/redistributable_bin/osx32/libsteam_api.dylib and b/redistributable_bin/osx32/libsteam_api.dylib differ diff --git a/redistributable_bin/osx32/libtier0_s.dylib b/redistributable_bin/osx32/libtier0_s.dylib index 4e83f2b..a9a0998 100644 Binary files a/redistributable_bin/osx32/libtier0_s.dylib and b/redistributable_bin/osx32/libtier0_s.dylib differ diff --git a/redistributable_bin/osx32/libvstdlib_s.dylib b/redistributable_bin/osx32/libvstdlib_s.dylib index 7e45ad3..a353bdd 100644 Binary files a/redistributable_bin/osx32/libvstdlib_s.dylib and b/redistributable_bin/osx32/libvstdlib_s.dylib differ diff --git a/redistributable_bin/osx32/steamclient.dylib b/redistributable_bin/osx32/steamclient.dylib index 32ca7c5..af6e8d6 100644 Binary files a/redistributable_bin/osx32/steamclient.dylib and b/redistributable_bin/osx32/steamclient.dylib differ diff --git a/redistributable_bin/steam_api.dll b/redistributable_bin/steam_api.dll index e21ea26..804072a 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 5bc977d..d2e5d93 100644 Binary files a/redistributable_bin/steam_api.lib and b/redistributable_bin/steam_api.lib differ diff --git a/redistributable_bin/steamclient.dll b/redistributable_bin/steamclient.dll index 0f1e24f..fef5cc0 100644 Binary files a/redistributable_bin/steamclient.dll and b/redistributable_bin/steamclient.dll differ diff --git a/redistributable_bin/tier0_s.dll b/redistributable_bin/tier0_s.dll index 07bc974..38f16f3 100644 Binary files a/redistributable_bin/tier0_s.dll and b/redistributable_bin/tier0_s.dll differ diff --git a/redistributable_bin/vstdlib_s.dll b/redistributable_bin/vstdlib_s.dll index 4042bfb..0f334fc 100644 Binary files a/redistributable_bin/vstdlib_s.dll and b/redistributable_bin/vstdlib_s.dll differ diff --git a/redistributable_bin/win64/steam_api64.dll b/redistributable_bin/win64/steam_api64.dll index 0f18ec3..3696653 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 1508e46..e8d706c 100644 Binary files a/redistributable_bin/win64/steam_api64.lib and b/redistributable_bin/win64/steam_api64.lib differ diff --git a/steamworksexample/controller.vdf b/steamworksexample/controller.vdf new file mode 100644 index 0000000..dc1c76f --- /dev/null +++ b/steamworksexample/controller.vdf @@ -0,0 +1,96 @@ +"controller_mappings" +{ + "buttons" + { + "button_0" "" + "button_1" "" + "button_2" "" + "button_3" "" + + "right_trigger" "kb:key_space" + "left_trigger" "kb:key_space" + "right_bumper" "" + "left_bumper" "" + + "button_escape" "kb:key_esc" + "button_menu" "" + + "backside_left" "" + "backside_right" "" + } + + "touchscreen" + { + "touch_button_0" "" + "touch_button_1" "" + "touch_button_2" "" + "touch_button_3" "" + } + + "pads" + { + "left_stick_up" "" + "left_stick_right" "" + "left_stick_down" "" + "left_stick_left" "" + "left_stick_click" "" + + "left_north" "kb:key_w, W" + "left_northeast" "" + "left_east" "kb:key_d, D" + "left_southeast" "" + "left_south" "kb:key_s, S" + "left_southwest" "" + "left_west" "kb:key_a, A" + "left_northwest" "" + + "left_double_tap" "" + "left_outer_edge" "" + "left_click" "" + + "right_north" "" + "right_northeast" "" + "right_east" "" + "right_southeast" "" + "right_south" "" + "right_southwest" "" + "right_west" "" + "right_northwest" "" + + "right_double_tap" "" + "right_outer_edge" "" + "right_click" "" + + // Extra descriptions for pads as a whole rather than just individual directions + pad_rollup_descriptions + { + "left_pad" "Movement" + "right_pad" "Look" + } + } + + "settings" + { + "mouse_sensitivity" "9" + } + + "mode_overrides" + { + "menu" + { + "left_north" "" + "left_east" "" + "left_south" "" + "left_west" "" + } + } + + "metadata" + { + "title" "" + "description" "" + } +} + + + diff --git a/steamworksexample/remotestoragesync.h b/steamworksexample/remotestoragesync.h index 634ae23..838de6a 100644 --- a/steamworksexample/remotestoragesync.h +++ b/steamworksexample/remotestoragesync.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============ +//========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ // // Purpose: Class for tracking stats and achievements // @@ -27,6 +27,8 @@ class IRemoteStorageSync { public: + virtual ~IRemoteStorageSync() {} + virtual void SynchronizeToClient() = 0; virtual void SynchronizeToServer() = 0; virtual void Render() = 0; diff --git a/tools/ContentPrep.zip b/tools/ContentPrep.zip index 27ac24a..59d7125 100644 Binary files a/tools/ContentPrep.zip and b/tools/ContentPrep.zip differ diff --git a/tools/drm/Readme.txt b/tools/drm/Readme.txt index 16fc5d5..3501ef7 100644 --- a/tools/drm/Readme.txt +++ b/tools/drm/Readme.txt @@ -13,11 +13,11 @@ Using the DRM tool ================================================== Flag values ================================================== -Normal: 32 -Min compatibility mode: 36 +Default: 0 +Min compatibility mode: 4 Max compatibility mode: 38 -Try it with flag = 32, if that breaks the game, try with flag = 36, if that still breaks the game, try with flag = 38. +Try it with flag = 0, if that breaks the game, try with flag = 4, if that still breaks the game, try with flag = 38. ================================================== Steam Guard @@ -32,7 +32,7 @@ Steam Guard may block you from authenticating. If so, do the following. ================================================== Example usage ================================================== -drmtool.exe -remotedrm build_path\Auslandia.exe 107700 32 +drmtool.exe -remotedrm build_path\Auslandia.exe 107700 0 ================================================== Example drmtool.cfg file diff --git a/tools/drm/Release/drmunpackp.dll b/tools/drm/Release/drmunpackp.dll deleted file mode 100644 index 7d1402b..0000000 Binary files a/tools/drm/Release/drmunpackp.dll and /dev/null differ diff --git a/tools/drm/Release/steamdrmp.dll b/tools/drm/Release/steamdrmp.dll deleted file mode 100644 index 8ade50c..0000000 Binary files a/tools/drm/Release/steamdrmp.dll and /dev/null differ diff --git a/tools/drm/steamdrm.dll b/tools/drm/steamdrm.dll deleted file mode 100644 index 2816a27..0000000 Binary files a/tools/drm/steamdrm.dll and /dev/null differ diff --git a/tools/drm/ubuntu12_32/drmtoolp b/tools/drm/ubuntu12_32/drmtoolp index a0247f3..27010b4 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 67d4bb5..6d2f3bd 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 ec34981..01c4b3f 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 1cbc729..ab2bdcf 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 fa55f5a..cf73d35 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 cb81cd1..93d2db5 100644 Binary files a/tools/drm/ubuntu12_64/steamdrmp.so and b/tools/drm/ubuntu12_64/steamdrmp.so differ diff --git a/tools/drm/win64/Release/drmunpackp.dll b/tools/drm/win64/Release/drmunpackp.dll deleted file mode 100644 index 6309e0c..0000000 Binary files a/tools/drm/win64/Release/drmunpackp.dll and /dev/null differ diff --git a/tools/drm/win64/Release/steamdrmp.dll b/tools/drm/win64/Release/steamdrmp.dll deleted file mode 100644 index cb76fda..0000000 Binary files a/tools/drm/win64/Release/steamdrmp.dll and /dev/null differ