mirror of
https://github.com/rlabrecque/SteamworksSDK.git
synced 2026-10-10 09:33:04 +08:00
v1.31
This commit is contained in:
+22
@@ -11,6 +11,28 @@ website at: http://partner.steamgames.com
|
|||||||
|
|
||||||
Revision History:
|
Revision History:
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
v1.31 8th September 2014
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
UGC:
|
||||||
|
* The Workshop item content API in ISteamUGC now supports legacy workshop items uploaded via the ISteamRemoteStorage interface. ISteamUGC::GetItemInstallInfo(). This will return whether the item was a legacy item or a new item. If it is a legacy item, then the pchFolder variable will be the full path to the file.
|
||||||
|
|
||||||
|
HTML:
|
||||||
|
* Added initial version of ISteamHTMLSurface API, which allows games to get textures for html pages and interact with them. There is also a sample implementation in the SteamworksExample.
|
||||||
|
|
||||||
|
Virtual Reality:
|
||||||
|
* Added VR_IsHmdPresent, which returns true if an HMD appears to be present but does not initialize the VR API. This is useful when enabling/disabling UI elements to offer VR mode to a user.
|
||||||
|
* Added VR_GetStringForHmdError which turns an HmdError enum value into a string.
|
||||||
|
|
||||||
|
SteamPipe
|
||||||
|
* The example Steampipe batch file (run_build.bat) now uses run_app_build_http instead of run_app_build by default.
|
||||||
|
|
||||||
|
ContentPrep.app
|
||||||
|
* Updated wxPython requirements for this app (version 2.7 and 2.8 supported). App will prompt with updated URL to download compatible packages if necessary.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
v1.30 10th July 2014
|
v1.30 10th July 2014
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ typedef int HGAMEVOICECHANNEL;
|
|||||||
#define VOICE_OUTPUT_SAMPLE_RATE_IDEAL 11025
|
#define VOICE_OUTPUT_SAMPLE_RATE_IDEAL 11025
|
||||||
#define BYTES_PER_SAMPLE 2
|
#define BYTES_PER_SAMPLE 2
|
||||||
|
|
||||||
|
// Texture formats we support for upload to textures
|
||||||
|
enum ETEXTUREFORMAT
|
||||||
|
{
|
||||||
|
eTextureFormat_RGBA, // 8 bits per channel
|
||||||
|
eTextureFormat_BGRA, // 8 bits per channel
|
||||||
|
eTextureFormat_BGRA16, // 16 bits per channel
|
||||||
|
};
|
||||||
|
|
||||||
// used for VR support
|
// used for VR support
|
||||||
namespace vr { class IHmd; }
|
namespace vr { class IHmd; }
|
||||||
|
|
||||||
@@ -81,8 +89,11 @@ public:
|
|||||||
// Create a new font returning our internal handle value for it (0 means failure)
|
// Create a new font returning our internal handle value for it (0 means failure)
|
||||||
virtual HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont ) = 0;
|
virtual HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont ) = 0;
|
||||||
|
|
||||||
// Create a new texture returning our internal handle value for it (0 means failure)
|
// Create a new texture returning our internal handle value for it (0 means failure), texture type specifies the type of data contained in pData
|
||||||
virtual HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight ) = 0;
|
virtual HGAMETEXTURE HCreateTexture( byte *pData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA ) = 0;
|
||||||
|
|
||||||
|
// update an existing texture, texture type specifies the type of data contained in pData
|
||||||
|
virtual bool UpdateTexture( HGAMETEXTURE texture, byte *pData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA ) = 0;
|
||||||
|
|
||||||
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
||||||
virtual bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 ) = 0;
|
virtual bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 ) = 0;
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ void CLeaderboards::OnMenuSelection( LeaderboardMenuItem_t selection )
|
|||||||
}
|
}
|
||||||
else if ( selection.m_bNextLeaderboard )
|
else if ( selection.m_bNextLeaderboard )
|
||||||
{
|
{
|
||||||
m_nCurrentLeaderboard = ++m_nCurrentLeaderboard % 2;
|
m_nCurrentLeaderboard = (m_nCurrentLeaderboard+1) % 2;
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,5 +29,6 @@ CMainMenu::CMainMenu( IGameEngine *pGameEngine ) : CBaseMenu<EClientGameState>(
|
|||||||
AddMenuItem( MenuItem_t( "Web Callback", k_EClientWebCallback ) );
|
AddMenuItem( MenuItem_t( "Web Callback", k_EClientWebCallback ) );
|
||||||
AddMenuItem( MenuItem_t( "Music Player", k_EClientMusic ) );
|
AddMenuItem( MenuItem_t( "Music Player", k_EClientMusic ) );
|
||||||
AddMenuItem( MenuItem_t( "Workshop Items", k_EClientWorkshop ) );
|
AddMenuItem( MenuItem_t( "Workshop Items", k_EClientWorkshop ) );
|
||||||
|
AddMenuItem( MenuItem_t( "HTML Page", k_EClientHTMLSurface ) );
|
||||||
AddMenuItem( MenuItem_t( "Exit Game", k_EClientGameExiting ) );
|
AddMenuItem( MenuItem_t( "Exit Game", k_EClientGameExiting ) );
|
||||||
}
|
}
|
||||||
@@ -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
|
// Purpose: Class for tracking stats and achievements
|
||||||
//
|
//
|
||||||
@@ -300,7 +300,7 @@ void CRemoteStorageScreen::Render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int32 width = m_pGameEngine->GetViewportWidth();
|
const int32 width = m_pGameEngine->GetViewportWidth();
|
||||||
const int32 height = m_pGameEngine->GetViewportHeight();
|
//const int32 height = m_pGameEngine->GetViewportHeight();
|
||||||
|
|
||||||
const int32 pxColumn1Left = width / 2 - CLOUDDISP_COLUMN_WIDTH / 2;
|
const int32 pxColumn1Left = width / 2 - CLOUDDISP_COLUMN_WIDTH / 2;
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ enum EClientGameState
|
|||||||
k_EClientWebCallback,
|
k_EClientWebCallback,
|
||||||
k_EClientMusic,
|
k_EClientMusic,
|
||||||
k_EClientWorkshop,
|
k_EClientWorkshop,
|
||||||
|
k_EClientHTMLSurface,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "Lobby.h"
|
#include "Lobby.h"
|
||||||
#include "p2pauth.h"
|
#include "p2pauth.h"
|
||||||
#include "voicechat.h"
|
#include "voicechat.h"
|
||||||
|
#include "htmlsurface.h"
|
||||||
#include "steam/steamencryptedappticket.h"
|
#include "steam/steamencryptedappticket.h"
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
@@ -156,6 +157,9 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine )
|
|||||||
// P2P voice chat
|
// P2P voice chat
|
||||||
m_pVoiceChat = new CVoiceChat( pGameEngine );
|
m_pVoiceChat = new CVoiceChat( pGameEngine );
|
||||||
|
|
||||||
|
// HTML Surface page
|
||||||
|
m_pHTMLSurface = new CHTMLSurface(pGameEngine);
|
||||||
|
|
||||||
LoadWorkshopItems();
|
LoadWorkshopItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +208,9 @@ CSpaceWarClient::~CSpaceWarClient()
|
|||||||
if ( m_pVoiceChat )
|
if ( m_pVoiceChat )
|
||||||
delete m_pVoiceChat;
|
delete m_pVoiceChat;
|
||||||
|
|
||||||
|
if ( m_pHTMLSurface )
|
||||||
|
delete m_pHTMLSurface;
|
||||||
|
|
||||||
for( uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i )
|
for( uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i )
|
||||||
{
|
{
|
||||||
if ( m_rgpShips[i] )
|
if ( m_rgpShips[i] )
|
||||||
@@ -1016,6 +1023,12 @@ void CSpaceWarClient::OnGameStateChanged( EClientGameState eGameStateNew )
|
|||||||
m_pMusicPlayer->Show();
|
m_pMusicPlayer->Show();
|
||||||
SteamFriends()->SetRichPresence( "status", "Using music player" );
|
SteamFriends()->SetRichPresence( "status", "Using music player" );
|
||||||
}
|
}
|
||||||
|
else if ( m_eGameState == k_EClientHTMLSurface )
|
||||||
|
{
|
||||||
|
// we've switched to the html page
|
||||||
|
m_pHTMLSurface->Show();
|
||||||
|
SteamFriends()->SetRichPresence("status", "Using the web");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1358,6 +1371,12 @@ void CSpaceWarClient::RunFrame()
|
|||||||
m_pRemoteStorage->Render();
|
m_pRemoteStorage->Render();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case k_EClientHTMLSurface:
|
||||||
|
m_pHTMLSurface->RunFrame();
|
||||||
|
m_pHTMLSurface->Render();
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case k_EClientMinidump:
|
case k_EClientMinidump:
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
RaiseException( EXCEPTION_NONCONTINUABLE_EXCEPTION,
|
RaiseException( EXCEPTION_NONCONTINUABLE_EXCEPTION,
|
||||||
@@ -2101,11 +2120,20 @@ bool CSpaceWarClient::LoadWorkshopItem( PublishedFileId_t workshopItemID )
|
|||||||
|
|
||||||
uint64 unSizeOnDisk = 0;
|
uint64 unSizeOnDisk = 0;
|
||||||
char szItemFolder[1024] = { 0 };
|
char szItemFolder[1024] = { 0 };
|
||||||
if ( !SteamUGC()->GetItemInstallInfo( workshopItemID, &unSizeOnDisk, szItemFolder, sizeof(szItemFolder) ) )
|
bool bLegacyItem = false;
|
||||||
|
if ( !SteamUGC()->GetItemInstallInfo( workshopItemID, &unSizeOnDisk, szItemFolder, sizeof(szItemFolder), &bLegacyItem ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char szFile[1024];
|
char szFile[1024];
|
||||||
_snprintf(szFile, sizeof(szFile), "%s/workshopitem.txt", szItemFolder);
|
if( bLegacyItem )
|
||||||
|
{
|
||||||
|
// szItemFolder just points directly to the item for legacy items that were published with the RemoteStorage API.
|
||||||
|
_snprintf( szFile, sizeof( szFile ), "%s", szItemFolder );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_snprintf( szFile, sizeof( szFile ), "%s/workshopitem.txt", szItemFolder );
|
||||||
|
}
|
||||||
|
|
||||||
CWorkshopItem *pItem = LoadWorkshopItemFromFile( szFile );
|
CWorkshopItem *pItem = LoadWorkshopItemFromFile( szFile );
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class CClanChatRoom;
|
|||||||
class CP2PAuthPlayer;
|
class CP2PAuthPlayer;
|
||||||
class CP2PAuthedGame;
|
class CP2PAuthedGame;
|
||||||
class CVoiceChat;
|
class CVoiceChat;
|
||||||
|
class CHTMLSurface;
|
||||||
|
|
||||||
// Height of the HUD font
|
// Height of the HUD font
|
||||||
#define HUD_FONT_HEIGHT 18
|
#define HUD_FONT_HEIGHT 18
|
||||||
@@ -428,6 +429,9 @@ private:
|
|||||||
// p2p voice chat
|
// p2p voice chat
|
||||||
CVoiceChat *m_pVoiceChat;
|
CVoiceChat *m_pVoiceChat;
|
||||||
|
|
||||||
|
// html page viewer
|
||||||
|
CHTMLSurface *m_pHTMLSurface;
|
||||||
|
|
||||||
// connection handler
|
// connection handler
|
||||||
STEAM_CALLBACK( CSpaceWarClient, OnP2PSessionConnectFail, P2PSessionConnectFail_t, m_CallbackP2PSessionConnectFail );
|
STEAM_CALLBACK( CSpaceWarClient, OnP2PSessionConnectFail, P2PSessionConnectFail_t, m_CallbackP2PSessionConnectFail );
|
||||||
|
|
||||||
|
|||||||
@@ -393,6 +393,10 @@
|
|||||||
RelativePath=".\connectingmenu.cpp"
|
RelativePath=".\connectingmenu.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\htmlsurface.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Leaderboards.cpp"
|
RelativePath=".\Leaderboards.cpp"
|
||||||
>
|
>
|
||||||
@@ -503,6 +507,10 @@
|
|||||||
RelativePath=".\connectingmenu.h"
|
RelativePath=".\connectingmenu.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\htmlsurface.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Leaderboards.h"
|
RelativePath=".\Leaderboards.h"
|
||||||
>
|
>
|
||||||
|
|||||||
Binary file not shown.
@@ -69,7 +69,8 @@ typedef int32 HSteamUser;
|
|||||||
#define __cdecl
|
#define __cdecl
|
||||||
#endif
|
#endif
|
||||||
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
|
extern "C" typedef void (__cdecl *SteamAPIWarningMessageHook_t)(int, const char *);
|
||||||
|
extern "C" typedef void( *SteamAPI_PostAPIResultInProcess_t )(SteamAPICall_t callHandle, void *, uint32 unCallbackSize, int iCallbackNum);
|
||||||
|
extern "C" typedef uint32 ( *SteamAPI_CheckCallbackRegistered_t )( int iCallbackNum );
|
||||||
#if defined( __SNC__ )
|
#if defined( __SNC__ )
|
||||||
#pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor
|
#pragma diag_suppress=1700 // warning 1700: class "%s" has virtual functions but non-virtual destructor
|
||||||
#endif
|
#endif
|
||||||
@@ -96,6 +97,7 @@ class ISteamUnifiedMessages;
|
|||||||
class ISteamController;
|
class ISteamController;
|
||||||
class ISteamUGC;
|
class ISteamUGC;
|
||||||
class ISteamAppList;
|
class ISteamAppList;
|
||||||
|
class ISteamHTMLSurface;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Interface to creating a new steam instance, or to
|
// Purpose: Interface to creating a new steam instance, or to
|
||||||
@@ -168,7 +170,6 @@ public:
|
|||||||
// user screenshots
|
// user screenshots
|
||||||
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
virtual ISteamScreenshots *GetISteamScreenshots( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||||
|
|
||||||
|
|
||||||
// this needs to be called every frame to process matchmaking results
|
// this needs to be called every frame to process matchmaking results
|
||||||
// redundant if you're already calling SteamAPI_RunCallbacks()
|
// redundant if you're already calling SteamAPI_RunCallbacks()
|
||||||
virtual void RunFrame() = 0;
|
virtual void RunFrame() = 0;
|
||||||
@@ -212,9 +213,17 @@ public:
|
|||||||
|
|
||||||
// Music Player Remote
|
// Music Player Remote
|
||||||
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
|
virtual ISteamMusicRemote *GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
|
||||||
|
|
||||||
|
// html page display
|
||||||
|
virtual ISteamHTMLSurface *GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion) = 0;
|
||||||
|
|
||||||
|
// Helper functions for internal Steam usage
|
||||||
|
virtual void Set_SteamAPI_CPostAPIResultInProcess( SteamAPI_PostAPIResultInProcess_t func ) = 0;
|
||||||
|
virtual void Remove_SteamAPI_CPostAPIResultInProcess( SteamAPI_PostAPIResultInProcess_t func ) = 0;
|
||||||
|
virtual void Set_SteamAPI_CCheckCallbackRegisteredInProcess( SteamAPI_CheckCallbackRegistered_t func ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient015"
|
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient016"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Base values for callback identifiers, each callback must
|
// Purpose: Base values for callback identifiers, each callback must
|
||||||
@@ -262,6 +271,10 @@ enum { k_iSteamAppListCallbacks = 3900 };
|
|||||||
enum { k_iSteamMusicCallbacks = 4000 };
|
enum { k_iSteamMusicCallbacks = 4000 };
|
||||||
enum { k_iSteamMusicRemoteCallbacks = 4100 };
|
enum { k_iSteamMusicRemoteCallbacks = 4100 };
|
||||||
enum { k_iClientVRCallbacks = 4200 };
|
enum { k_iClientVRCallbacks = 4200 };
|
||||||
|
enum { k_iClientReservedCallbacks = 4300 };
|
||||||
|
enum { k_iSteamReservedCallbacks = 4400 };
|
||||||
|
enum { k_iSteamHTMLSurfaceCallbacks = 4500 };
|
||||||
|
enum { k_iClientVideoCallbacks = 4600 };
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// The CALLBACK macros are for client side callback logging enabled with
|
// The CALLBACK macros are for client side callback logging enabled with
|
||||||
@@ -373,7 +386,7 @@ struct callbackname : SteamCallback_t { \
|
|||||||
END_CALLBACK_INTERNAL_END()
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
#define END_DEFINE_CALLBACK_8() \
|
#define END_DEFINE_CALLBACK_8() \
|
||||||
END_CALLBACK_INTERNAL_BEGIN( 7 ) \
|
END_CALLBACK_INTERNAL_BEGIN( 8 ) \
|
||||||
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
@@ -385,7 +398,7 @@ struct callbackname : SteamCallback_t { \
|
|||||||
END_CALLBACK_INTERNAL_END()
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
#define END_DEFINE_CALLBACK_9() \
|
#define END_DEFINE_CALLBACK_9() \
|
||||||
END_CALLBACK_INTERNAL_BEGIN( 7 ) \
|
END_CALLBACK_INTERNAL_BEGIN( 9 ) \
|
||||||
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
@@ -397,4 +410,84 @@ struct callbackname : SteamCallback_t { \
|
|||||||
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||||
END_CALLBACK_INTERNAL_END()
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
|
#define END_DEFINE_CALLBACK_10() \
|
||||||
|
END_CALLBACK_INTERNAL_BEGIN( 10 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
|
||||||
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
|
#define END_DEFINE_CALLBACK_11() \
|
||||||
|
END_CALLBACK_INTERNAL_BEGIN( 11 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
|
||||||
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
|
#define END_DEFINE_CALLBACK_12() \
|
||||||
|
END_CALLBACK_INTERNAL_BEGIN( 12 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
|
||||||
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
|
#define END_DEFINE_CALLBACK_13() \
|
||||||
|
END_CALLBACK_INTERNAL_BEGIN( 13 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 12 ) \
|
||||||
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
|
#define END_DEFINE_CALLBACK_14() \
|
||||||
|
END_CALLBACK_INTERNAL_BEGIN( 14 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 0 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 1 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 2 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 3 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 4 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 5 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 6 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 7 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 8 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 9 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 10 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 11 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 12 ) \
|
||||||
|
END_CALLBACK_INTERNAL_SWITCH( 13 ) \
|
||||||
|
END_CALLBACK_INTERNAL_END()
|
||||||
|
|
||||||
#endif // ISTEAMCLIENT_H
|
#endif // ISTEAMCLIENT_H
|
||||||
|
|||||||
@@ -0,0 +1,476 @@
|
|||||||
|
//====== Copyright 1996-2013, Valve Corporation, All rights reserved. =======
|
||||||
|
//
|
||||||
|
// Purpose: interface to display html pages in a texture
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
#ifndef ISTEAMHTMLSURFACE_H
|
||||||
|
#define ISTEAMHTMLSURFACE_H
|
||||||
|
#ifdef _WIN32
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "isteamclient.h"
|
||||||
|
|
||||||
|
typedef uint32 HHTMLBrowser;
|
||||||
|
const uint32 INVALID_HTTMLBROWSER = 0;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Functions for displaying HTML pages and interacting with them
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ISteamHTMLSurface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ISteamHTMLSurface() {}
|
||||||
|
|
||||||
|
// Must call init and shutdown when starting/ending use of the interface
|
||||||
|
virtual bool Init() = 0;
|
||||||
|
virtual bool Shutdown() = 0;
|
||||||
|
|
||||||
|
// Create a browser object for display of a html page, when creation is complete the call handle
|
||||||
|
// will return a HTML_BrowserReady_t callback for the HHTMLBrowser of your new browser.
|
||||||
|
// The user agent string is a substring to be added to the general user agent string so you can
|
||||||
|
// identify your client on web servers.
|
||||||
|
// The userCSS string lets you apply a CSS style sheet to every displayed page, leave null if
|
||||||
|
// you do not require this functionality.
|
||||||
|
virtual SteamAPICall_t CreateBrowser( const char *pchUserAgent, const char *pchUserCSS ) = 0;
|
||||||
|
|
||||||
|
// Call this when you are done with a html surface, this lets us free the resources being used by it
|
||||||
|
virtual void RemoveBrowser( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
|
||||||
|
// Navigate to this URL, results in a HTML_StartRequest_t as the request commences
|
||||||
|
virtual void LoadURL( HHTMLBrowser unBrowserHandle, const char *pchURL, const char *pchPostData ) = 0;
|
||||||
|
|
||||||
|
// Tells the surface the size in pixels to display the surface
|
||||||
|
virtual void SetSize( HHTMLBrowser unBrowserHandle, uint32 unWidth, uint32 unHeight ) = 0;
|
||||||
|
|
||||||
|
// Stop the load of the current html page
|
||||||
|
virtual void StopLoad( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
// Reload (most likely from local cache) the current page
|
||||||
|
virtual void Reload( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
// navigate back in the page history
|
||||||
|
virtual void GoBack( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
// navigate forward in the page history
|
||||||
|
virtual void GoForward( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
|
||||||
|
// add this header to any url requests from this browser
|
||||||
|
virtual void AddHeader( HHTMLBrowser unBrowserHandle, const char *pchKey, const char *pchValue ) = 0;
|
||||||
|
// run this javascript script in the currently loaded page
|
||||||
|
virtual void ExecuteJavascript( HHTMLBrowser unBrowserHandle, const char *pchScript ) = 0;
|
||||||
|
|
||||||
|
enum EHTMLMouseButton
|
||||||
|
{
|
||||||
|
eHTMLMouseButton_Left = 0,
|
||||||
|
eHTMLMouseButton_Right = 1,
|
||||||
|
eHTMLMouseButton_Middle = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Mouse click and mouse movement commands
|
||||||
|
virtual void MouseUp( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
|
||||||
|
virtual void MouseDown( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
|
||||||
|
virtual void MouseDoubleClick( HHTMLBrowser unBrowserHandle, EHTMLMouseButton eMouseButton ) = 0;
|
||||||
|
// x and y are relative to the HTML bounds
|
||||||
|
virtual void MouseMove( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
|
||||||
|
// nDelta is pixels of scroll
|
||||||
|
virtual void MouseWheel( HHTMLBrowser unBrowserHandle, int32 nDelta ) = 0;
|
||||||
|
|
||||||
|
enum EMouseCursor
|
||||||
|
{
|
||||||
|
dc_user = 0,
|
||||||
|
dc_none,
|
||||||
|
dc_arrow,
|
||||||
|
dc_ibeam,
|
||||||
|
dc_hourglass,
|
||||||
|
dc_waitarrow,
|
||||||
|
dc_crosshair,
|
||||||
|
dc_up,
|
||||||
|
dc_sizenw,
|
||||||
|
dc_sizese,
|
||||||
|
dc_sizene,
|
||||||
|
dc_sizesw,
|
||||||
|
dc_sizew,
|
||||||
|
dc_sizee,
|
||||||
|
dc_sizen,
|
||||||
|
dc_sizes,
|
||||||
|
dc_sizewe,
|
||||||
|
dc_sizens,
|
||||||
|
dc_sizeall,
|
||||||
|
dc_no,
|
||||||
|
dc_hand,
|
||||||
|
dc_blank, // don't show any custom cursor, just use your default
|
||||||
|
dc_middle_pan,
|
||||||
|
dc_north_pan,
|
||||||
|
dc_north_east_pan,
|
||||||
|
dc_east_pan,
|
||||||
|
dc_south_east_pan,
|
||||||
|
dc_south_pan,
|
||||||
|
dc_south_west_pan,
|
||||||
|
dc_west_pan,
|
||||||
|
dc_north_west_pan,
|
||||||
|
dc_alias,
|
||||||
|
dc_cell,
|
||||||
|
dc_colresize,
|
||||||
|
dc_copycur,
|
||||||
|
dc_verticaltext,
|
||||||
|
dc_rowresize,
|
||||||
|
dc_zoomin,
|
||||||
|
dc_zoomout,
|
||||||
|
dc_help,
|
||||||
|
dc_custom,
|
||||||
|
|
||||||
|
dc_last, // custom cursors start from this value and up
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EHTMLKeyModifiers
|
||||||
|
{
|
||||||
|
eHTMLKeyModifier_None = 0,
|
||||||
|
eHTMLKeyModifier_AltDown = 1 << 0,
|
||||||
|
eHTMLKeyModifier_CrtlDown = 1 << 1,
|
||||||
|
eHTMLKeyModifier_ShiftDown = 1 << 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
// keyboard interactions, native keycode is the virtual key code value from your OS
|
||||||
|
virtual void KeyDown( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
|
||||||
|
virtual void KeyUp( HHTMLBrowser unBrowserHandle, uint32 nNativeKeyCode, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
|
||||||
|
// cUnicodeChar is the unicode character point for this keypress (and potentially multiple chars per press)
|
||||||
|
virtual void KeyChar( HHTMLBrowser unBrowserHandle, uint32 cUnicodeChar, EHTMLKeyModifiers eHTMLKeyModifiers ) = 0;
|
||||||
|
|
||||||
|
// programmatically scroll this many pixels on the page
|
||||||
|
virtual void SetHorizontalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
|
||||||
|
virtual void SetVerticalScroll( HHTMLBrowser unBrowserHandle, uint32 nAbsolutePixelScroll ) = 0;
|
||||||
|
|
||||||
|
// tell the html control if it has key focus currently, controls showing the I-beam cursor in text controls amongst other things
|
||||||
|
virtual void SetKeyFocus( HHTMLBrowser unBrowserHandle, bool bHasKeyFocus ) = 0;
|
||||||
|
|
||||||
|
// open the current pages html code in the local editor of choice, used for debugging
|
||||||
|
virtual void ViewSource( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
// copy the currently selected text on the html page to the local clipboard
|
||||||
|
virtual void CopyToClipboard( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
// paste from the local clipboard to the current html page
|
||||||
|
virtual void PasteFromClipboard( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
|
||||||
|
// find this string in the browser, if bCurrentlyInFind is true then instead cycle to the next matching element
|
||||||
|
virtual void Find( HHTMLBrowser unBrowserHandle, const char *pchSearchStr, bool bCurrentlyInFind, bool bReverse ) = 0;
|
||||||
|
// cancel a currently running find
|
||||||
|
virtual void StopFind( HHTMLBrowser unBrowserHandle ) = 0;
|
||||||
|
|
||||||
|
// return details about the link at position x,y on the current page
|
||||||
|
virtual void GetLinkAtPosition( HHTMLBrowser unBrowserHandle, int x, int y ) = 0;
|
||||||
|
|
||||||
|
// set a webcookie for the hostname in question
|
||||||
|
virtual void SetCookie( const char *pchHostname, const char *pchKey, const char *pchValue, const char *pchPath = "/", RTime32 nExpires = 0, bool bSecure = false, bool bHTTPOnly = false ) = 0;
|
||||||
|
|
||||||
|
// Zoom the current page by flZoom ( from 0.0 to 4.0, so to zoom to 120% use 1.2 ), zooming around point X,Y in the page (use 0,0 if you don't care)
|
||||||
|
virtual void SetPageScaleFactor( HHTMLBrowser unBrowserHandle, float flZoom, int nPointX, int nPointY ) = 0;
|
||||||
|
|
||||||
|
// CALLBACKS
|
||||||
|
//
|
||||||
|
// These set of functions are used as responses to callback requests
|
||||||
|
//
|
||||||
|
|
||||||
|
// You MUST call this in response to a HTML_StartRequest_t callback
|
||||||
|
// Set bAllowed to true to allow this navigation, false to cancel it and stay
|
||||||
|
// on the current page. You can use this feature to limit the valid pages
|
||||||
|
// allowed in your HTML surface.
|
||||||
|
virtual void AllowStartRequest( HHTMLBrowser unBrowserHandle, bool bAllowed ) = 0;
|
||||||
|
|
||||||
|
// You MUST call this in response to a HTML_JSAlert_t or HTML_JSConfirm_t callback
|
||||||
|
// Set bResult to true for the OK option of a confirm, use false otherwise
|
||||||
|
virtual void JSDialogResponse( HHTMLBrowser unBrowserHandle, bool bResult ) = 0;
|
||||||
|
|
||||||
|
// You MUST call this in response to a HTML_FileOpenDialog_t callback
|
||||||
|
virtual void FileLoadDialogResponse( HHTMLBrowser unBrowserHandle, const char **pchSelectedFiles ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define STEAMHTMLSURFACE_INTERFACE_VERSION "STEAMHTMLSURFACE_INTERFACE_VERSION_002"
|
||||||
|
|
||||||
|
// 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: The browser is ready for use
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_BrowserReady_t, k_iSteamHTMLSurfaceCallbacks + 1 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // this browser is now fully created and ready to navigate to pages
|
||||||
|
END_DEFINE_CALLBACK_1()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the browser has a pending paint
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK(HTML_NeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 2)
|
||||||
|
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the browser that needs the paint
|
||||||
|
CALLBACK_MEMBER(1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
|
||||||
|
CALLBACK_MEMBER(2, uint32, unWide) // the total width of the pBGRA texture
|
||||||
|
CALLBACK_MEMBER(3, uint32, unTall) // the total height of the pBGRA texture
|
||||||
|
CALLBACK_MEMBER(4, uint32, unUpdateX) // the offset in X for the damage rect for this update
|
||||||
|
CALLBACK_MEMBER(5, uint32, unUpdateY) // the offset in Y for the damage rect for this update
|
||||||
|
CALLBACK_MEMBER(6, uint32, unUpdateWide) // the width of the damage rect for this update
|
||||||
|
CALLBACK_MEMBER(7, uint32, unUpdateTall) // the height of the damage rect for this update
|
||||||
|
CALLBACK_MEMBER(8, uint32, unScrollX) // the page scroll the browser was at when this texture was rendered
|
||||||
|
CALLBACK_MEMBER(9, uint32, unScrollY) // the page scroll the browser was at when this texture was rendered
|
||||||
|
CALLBACK_MEMBER(10, float, flPageScale) // the page scale factor on this page when rendered
|
||||||
|
CALLBACK_MEMBER(11, uint32, unPageSerial) // incremented on each new page load, you can use this to reject draws while navigating to new pages
|
||||||
|
END_DEFINE_CALLBACK_12()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: The browser wanted to navigate to a new page
|
||||||
|
// NOTE - you MUST call AllowStartRequest in response to this callback
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK(HTML_StartRequest_t, k_iSteamHTMLSurfaceCallbacks + 3)
|
||||||
|
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface navigating
|
||||||
|
CALLBACK_MEMBER(1, const char *, pchURL) // the url they wish to navigate to
|
||||||
|
CALLBACK_MEMBER(2, const char *, pchTarget) // the html link target type (i.e _blank, _self, _parent, _top )
|
||||||
|
CALLBACK_MEMBER(3, const char *, pchPostData ) // any posted data for the request
|
||||||
|
CALLBACK_MEMBER(4, bool, bIsRedirect) // true if this was a http/html redirect from the last load request
|
||||||
|
END_DEFINE_CALLBACK_5()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: The browser has been requested to close due to user interaction (usually from a javascript window.close() call)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK(HTML_CloseBrowser_t, k_iSteamHTMLSurfaceCallbacks + 4)
|
||||||
|
CALLBACK_MEMBER(0, HHTMLBrowser, unBrowserHandle) // the handle of the surface
|
||||||
|
END_DEFINE_CALLBACK_1()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the browser is navigating to a new url
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_URLChanged_t, k_iSteamHTMLSurfaceCallbacks + 5 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface navigating
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchURL ) // the url they wish to navigate to
|
||||||
|
CALLBACK_MEMBER( 2, const char *, pchPostData ) // any posted data for the request
|
||||||
|
CALLBACK_MEMBER( 3, bool, bIsRedirect ) // true if this was a http/html redirect from the last load request
|
||||||
|
CALLBACK_MEMBER( 4, const char *, pchPageTitle ) // the title of the page
|
||||||
|
CALLBACK_MEMBER( 5, bool, bNewNavigation ) // true if this was from a fresh tab and not a click on an existing page
|
||||||
|
END_DEFINE_CALLBACK_6()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: A page is finished loading
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_FinishedRequest_t, k_iSteamHTMLSurfaceCallbacks + 6 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchURL ) //
|
||||||
|
CALLBACK_MEMBER( 2, const char *, pchPageTitle ) //
|
||||||
|
END_DEFINE_CALLBACK_3()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a request to load this url in a new tab
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_OpenLinkInNewTab_t, k_iSteamHTMLSurfaceCallbacks + 7 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchURL ) //
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the page has a new title now
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_ChangedTitle_t, k_iSteamHTMLSurfaceCallbacks + 8 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchTitle ) //
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: results from a search
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_SearchResults_t, k_iSteamHTMLSurfaceCallbacks + 9 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, uint32, unResults ) //
|
||||||
|
CALLBACK_MEMBER( 2, uint32, unCurrentMatch ) //
|
||||||
|
END_DEFINE_CALLBACK_3()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: page history status changed on the ability to go backwards and forward
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_CanGoBackAndForward_t, k_iSteamHTMLSurfaceCallbacks + 10 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, bool, bCanGoBack ) //
|
||||||
|
CALLBACK_MEMBER( 2, bool, bCanGoForward ) //
|
||||||
|
END_DEFINE_CALLBACK_3()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: details on the visibility and size of the horizontal scrollbar
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_HorizontalScroll_t, k_iSteamHTMLSurfaceCallbacks + 11 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
|
||||||
|
CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
|
||||||
|
CALLBACK_MEMBER( 3, float, flPageScale ) //
|
||||||
|
CALLBACK_MEMBER( 4, bool , bVisible ) //
|
||||||
|
CALLBACK_MEMBER( 5, uint32, unPageSize ) //
|
||||||
|
END_DEFINE_CALLBACK_6()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: details on the visibility and size of the vertical scrollbar
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_VerticalScroll_t, k_iSteamHTMLSurfaceCallbacks + 12 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, uint32, unScrollMax ) //
|
||||||
|
CALLBACK_MEMBER( 2, uint32, unScrollCurrent ) //
|
||||||
|
CALLBACK_MEMBER( 3, float, flPageScale ) //
|
||||||
|
CALLBACK_MEMBER( 4, bool, bVisible ) //
|
||||||
|
CALLBACK_MEMBER( 5, uint32, unPageSize ) //
|
||||||
|
END_DEFINE_CALLBACK_6()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: response to GetLinkAtPosition call
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_LinkAtPosition_t, k_iSteamHTMLSurfaceCallbacks + 13 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, uint32, x ) //
|
||||||
|
CALLBACK_MEMBER( 2, uint32, y ) //
|
||||||
|
CALLBACK_MEMBER( 3, const char *, pchURL ) //
|
||||||
|
CALLBACK_MEMBER( 4, bool, bInput ) //
|
||||||
|
CALLBACK_MEMBER( 5, bool, bLiveLink ) //
|
||||||
|
END_DEFINE_CALLBACK_6()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: show a Javascript alert dialog, call JSDialogResponse
|
||||||
|
// when the user dismisses this dialog (or right away to ignore it)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_JSAlert_t, k_iSteamHTMLSurfaceCallbacks + 14 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchMessage ) //
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: show a Javascript confirmation dialog, call JSDialogResponse
|
||||||
|
// when the user dismisses this dialog (or right away to ignore it)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_JSConfirm_t, k_iSteamHTMLSurfaceCallbacks + 15 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchMessage ) //
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: show a Javascript confirmation dialog, call JSDialogResponse
|
||||||
|
// when the user dismisses this dialog (or right away to ignore it)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_FileOpenDialog_t, k_iSteamHTMLSurfaceCallbacks + 16 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchTitle ) //
|
||||||
|
CALLBACK_MEMBER( 2, const char *, pchInitialFile ) //
|
||||||
|
END_DEFINE_CALLBACK_3()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a popup item (i.e combo box) on the page needs rendering
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_ComboNeedsPaint_t, k_iSteamHTMLSurfaceCallbacks + 17 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pBGRA ) // a pointer to the B8G8R8A8 data for this surface, valid until SteamAPI_RunCallbacks is next called
|
||||||
|
CALLBACK_MEMBER( 2, uint32, unWide ) // the total width of the pBGRA texture
|
||||||
|
CALLBACK_MEMBER( 3, uint32, unTall ) // the total height of the pBGRA texture
|
||||||
|
END_DEFINE_CALLBACK_4()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a popup (i.e combo box) wants to display
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_ShowPopup_t, k_iSteamHTMLSurfaceCallbacks + 18 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
END_DEFINE_CALLBACK_1()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a popup (i.e combo box) wants to hide
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_HidePopup_t, k_iSteamHTMLSurfaceCallbacks + 19 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
END_DEFINE_CALLBACK_1()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a popup (i.e combo box) wants to hide
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_SizePopup_t, k_iSteamHTMLSurfaceCallbacks + 20 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, uint32, unX ) // the x pos into the page to display the popup
|
||||||
|
CALLBACK_MEMBER( 2, uint32, unY ) // the y pos into the page to display the popup
|
||||||
|
CALLBACK_MEMBER( 3, uint32, unWide ) // the total width of the pBGRA texture
|
||||||
|
CALLBACK_MEMBER( 4, uint32, unTall ) // the total height of the pBGRA texture
|
||||||
|
END_DEFINE_CALLBACK_5()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a new html window has been created
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_NewWindow_t, k_iSteamHTMLSurfaceCallbacks + 21 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchURL ) // the page to load
|
||||||
|
CALLBACK_MEMBER( 2, uint32, unX ) // the x pos into the page to display the popup
|
||||||
|
CALLBACK_MEMBER( 3, uint32, unY ) // the y pos into the page to display the popup
|
||||||
|
CALLBACK_MEMBER( 4, uint32, unWide ) // the total width of the pBGRA texture
|
||||||
|
CALLBACK_MEMBER( 5, uint32, unTall ) // the total height of the pBGRA texture
|
||||||
|
END_DEFINE_CALLBACK_6()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: change the cursor to display
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_SetCursor_t, k_iSteamHTMLSurfaceCallbacks + 22 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, uint32, eMouseCursor ) // the EMouseCursor to display
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: informational message from the browser
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_StatusText_t, k_iSteamHTMLSurfaceCallbacks + 23 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: show a tooltip
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_ShowToolTip_t, k_iSteamHTMLSurfaceCallbacks + 24 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: update the text of an existing tooltip
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_UpdateToolTip_t, k_iSteamHTMLSurfaceCallbacks + 25 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
CALLBACK_MEMBER( 1, const char *, pchMsg ) // the EMouseCursor to display
|
||||||
|
END_DEFINE_CALLBACK_2()
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: hide the tooltip you are showing
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
DEFINE_CALLBACK( HTML_HideToolTip_t, k_iSteamHTMLSurfaceCallbacks + 26 )
|
||||||
|
CALLBACK_MEMBER( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the surface
|
||||||
|
END_DEFINE_CALLBACK_1()
|
||||||
|
|
||||||
|
|
||||||
|
#pragma pack( pop )
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ISTEAMHTMLSURFACE_H
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
virtual bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0;
|
virtual bool GetFavoriteGame( int iGame, AppId_t *pnAppID, uint32 *pnIP, uint16 *pnConnPort, uint16 *pnQueryPort, uint32 *punFlags, uint32 *pRTime32LastPlayedOnServer ) = 0;
|
||||||
|
|
||||||
// adds the game server to the local list; updates the time played of the server if it already exists in the list
|
// adds the game server to the local list; updates the time played of the server if it already exists in the list
|
||||||
virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0;
|
virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) = 0;
|
||||||
|
|
||||||
// removes the game server from the local storage; returns true if one was removed
|
// removes the game server from the local storage; returns true if one was removed
|
||||||
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
|
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "steam/isteamclient.h"
|
#include "isteamclient.h"
|
||||||
#include "steam/isteammusic.h"
|
#include "isteammusic.h"
|
||||||
|
|
||||||
#define k_SteamMusicNameMaxLength 255
|
#define k_SteamMusicNameMaxLength 255
|
||||||
#define k_SteamMusicPNGMaxLength 65535
|
#define k_SteamMusicPNGMaxLength 65535
|
||||||
|
|||||||
@@ -102,9 +102,10 @@ enum EWorkshopFileType
|
|||||||
k_EWorkshopFileTypeMerch = 11,
|
k_EWorkshopFileTypeMerch = 11,
|
||||||
k_EWorkshopFileTypeControllerBinding = 12,
|
k_EWorkshopFileTypeControllerBinding = 12,
|
||||||
k_EWorkshopFileTypeSteamworksAccessInvite = 13,
|
k_EWorkshopFileTypeSteamworksAccessInvite = 13,
|
||||||
|
k_EWorkshopFileTypeSteamVideo = 14,
|
||||||
|
|
||||||
// Update k_EWorkshopFileTypeMax if you add values.
|
// Update k_EWorkshopFileTypeMax if you add values.
|
||||||
k_EWorkshopFileTypeMax = 14
|
k_EWorkshopFileTypeMax = 15
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -198,11 +198,13 @@ public:
|
|||||||
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
|
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
|
||||||
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
|
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
|
||||||
|
|
||||||
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, char *pchFolder, uint32 cchFolderSize ) = 0; // returns true if item is installed
|
// Get info about the item on disk. If you are supporting items published through the legacy RemoteStorage APIs then *pbLegacyItem will be set to true
|
||||||
|
// and pchFolder will contain the full path to the file rather than the containing folder.
|
||||||
|
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, char *pchFolder, uint32 cchFolderSize, bool *pbLegacyItem ) = 0; // returns true if item is installed
|
||||||
virtual bool GetItemUpdateInfo( PublishedFileId_t nPublishedFileID, bool *pbNeedsUpdate, bool *pbIsDownloading, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
|
virtual bool GetItemUpdateInfo( PublishedFileId_t nPublishedFileID, bool *pbNeedsUpdate, bool *pbIsDownloading, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION002"
|
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION003"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Callback for querying UGC
|
// Purpose: Callback for querying UGC
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,6 +27,7 @@
|
|||||||
#include "isteamcontroller.h"
|
#include "isteamcontroller.h"
|
||||||
#include "isteamugc.h"
|
#include "isteamugc.h"
|
||||||
#include "isteamapplist.h"
|
#include "isteamapplist.h"
|
||||||
|
#include "isteamhtmlsurface.h"
|
||||||
|
|
||||||
#if defined( _PS3 )
|
#if defined( _PS3 )
|
||||||
#include "steamps3params.h"
|
#include "steamps3params.h"
|
||||||
@@ -126,6 +127,7 @@ S_API ISteamUGC *S_CALLTYPE SteamUGC();
|
|||||||
S_API ISteamAppList *S_CALLTYPE SteamAppList();
|
S_API ISteamAppList *S_CALLTYPE SteamAppList();
|
||||||
S_API ISteamMusic *S_CALLTYPE SteamMusic();
|
S_API ISteamMusic *S_CALLTYPE SteamMusic();
|
||||||
S_API ISteamMusicRemote *S_CALLTYPE SteamMusicRemote();
|
S_API ISteamMusicRemote *S_CALLTYPE SteamMusicRemote();
|
||||||
|
S_API ISteamHTMLSurface *S_CALLTYPE SteamHTMLSurface();
|
||||||
#ifdef _PS3
|
#ifdef _PS3
|
||||||
S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender();
|
S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender();
|
||||||
#endif
|
#endif
|
||||||
@@ -411,6 +413,7 @@ public:
|
|||||||
ISteamAppList* SteamAppList() { return m_pSteamAppList; }
|
ISteamAppList* SteamAppList() { return m_pSteamAppList; }
|
||||||
ISteamMusic* SteamMusic() { return m_pSteamMusic; }
|
ISteamMusic* SteamMusic() { return m_pSteamMusic; }
|
||||||
ISteamMusicRemote* SteamMusicRemote() { return m_pSteamMusicRemote; }
|
ISteamMusicRemote* SteamMusicRemote() { return m_pSteamMusicRemote; }
|
||||||
|
ISteamHTMLSurface* SteamHTMLSurface() { return m_pSteamHTMLSurface; }
|
||||||
#ifdef _PS3
|
#ifdef _PS3
|
||||||
ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; }
|
ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; }
|
||||||
#endif
|
#endif
|
||||||
@@ -433,6 +436,7 @@ private:
|
|||||||
ISteamAppList *m_pSteamAppList;
|
ISteamAppList *m_pSteamAppList;
|
||||||
ISteamMusic *m_pSteamMusic;
|
ISteamMusic *m_pSteamMusic;
|
||||||
ISteamMusicRemote *m_pSteamMusicRemote;
|
ISteamMusicRemote *m_pSteamMusicRemote;
|
||||||
|
ISteamHTMLSurface *m_pSteamHTMLSurface;
|
||||||
#ifdef _PS3
|
#ifdef _PS3
|
||||||
ISteamPS3OverlayRender *m_pSteamPS3OverlayRender;
|
ISteamPS3OverlayRender *m_pSteamPS3OverlayRender;
|
||||||
#endif
|
#endif
|
||||||
@@ -461,6 +465,9 @@ inline void CSteamAPIContext::Clear()
|
|||||||
m_pController = NULL;
|
m_pController = NULL;
|
||||||
m_pSteamUGC = NULL;
|
m_pSteamUGC = NULL;
|
||||||
m_pSteamAppList = NULL;
|
m_pSteamAppList = NULL;
|
||||||
|
m_pSteamMusic = NULL;
|
||||||
|
m_pSteamMusicRemote= NULL;
|
||||||
|
m_pSteamHTMLSurface = NULL;
|
||||||
#ifdef _PS3
|
#ifdef _PS3
|
||||||
m_pSteamPS3OverlayRender = NULL;
|
m_pSteamPS3OverlayRender = NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -547,6 +554,12 @@ inline bool CSteamAPIContext::Init()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_pSteamHTMLSurface = SteamClient()->GetISteamHTMLSurface( hSteamUser, hSteamPipe, STEAMHTMLSURFACE_INTERFACE_VERSION );
|
||||||
|
if ( !m_pSteamHTMLSurface )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _PS3
|
#ifdef _PS3
|
||||||
m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender();
|
m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -112,7 +112,8 @@ enum EResult
|
|||||||
k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
|
k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
|
||||||
k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
|
k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
|
||||||
k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
|
k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
|
||||||
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch (only on token setup, not on login path)
|
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
|
||||||
|
k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
|
||||||
};
|
};
|
||||||
|
|
||||||
// Error codes for use with the voice functions
|
// Error codes for use with the voice functions
|
||||||
@@ -177,6 +178,7 @@ typedef enum
|
|||||||
k_EAuthSessionResponseAuthTicketCanceled = 6, // The ticket has been canceled by the issuer
|
k_EAuthSessionResponseAuthTicketCanceled = 6, // The ticket has been canceled by the issuer
|
||||||
k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid.
|
k_EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid.
|
||||||
k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam.
|
k_EAuthSessionResponseAuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam.
|
||||||
|
k_EAuthSessionResponsePublisherIssuedBan = 9, // The user is banned for this game. The ban came via the web api and not VAC
|
||||||
} EAuthSessionResponse;
|
} EAuthSessionResponse;
|
||||||
|
|
||||||
// results from UserHasLicenseForApp
|
// results from UserHasLicenseForApp
|
||||||
@@ -255,17 +257,23 @@ enum EAppType
|
|||||||
k_EAppType_Application = 0x002, // software application
|
k_EAppType_Application = 0x002, // software application
|
||||||
k_EAppType_Tool = 0x004, // SDKs, editors & dedicated servers
|
k_EAppType_Tool = 0x004, // SDKs, editors & dedicated servers
|
||||||
k_EAppType_Demo = 0x008, // game demo
|
k_EAppType_Demo = 0x008, // game demo
|
||||||
k_EAppType_Media = 0x010, // media trailer
|
k_EAppType_Media_DEPRECATED = 0x010, // legacy - was used for game trailers, which are now just videos on the web
|
||||||
k_EAppType_DLC = 0x020, // down loadable content
|
k_EAppType_DLC = 0x020, // down loadable content
|
||||||
k_EAppType_Guide = 0x040, // game guide, PDF etc
|
k_EAppType_Guide = 0x040, // game guide, PDF etc
|
||||||
k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc)
|
k_EAppType_Driver = 0x080, // hardware driver updater (ATI, Razor etc)
|
||||||
k_EAppType_Config = 0x100, // hidden app used to config Steam features (backpack, sales, etc)
|
k_EAppType_Config = 0x100, // hidden app used to config Steam features (backpack, sales, etc)
|
||||||
|
k_EAppType_Film = 0x200, // A Movie (feature film)
|
||||||
|
k_EAppType_TVSeries = 0x400, // A TV or other video series which will have episodes and perhaps seasons
|
||||||
|
k_EAppType_Video = 0x800, // A video component of either a Film or TVSeries (may be the feature, an episode, preview, making-of, etc)
|
||||||
|
k_EAppType_Plugin = 0x1000, // Plug-in types for other Apps
|
||||||
|
k_EAppType_Music = 0x2000, // Music files
|
||||||
|
|
||||||
k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only
|
k_EAppType_Shortcut = 0x40000000, // just a shortcut, client side only
|
||||||
k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace
|
k_EAppType_DepotOnly = 0x80000000, // placeholder since depots and apps share the same namespace
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// types of user game stats fields
|
// types of user game stats fields
|
||||||
// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE
|
// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE
|
||||||
@@ -303,7 +311,8 @@ enum EChatEntryType
|
|||||||
k_EChatEntryTypeWasBanned = 9, // user was banned (data: 64-bit steamid of actor performing the ban)
|
k_EChatEntryTypeWasBanned = 9, // user was banned (data: 64-bit steamid of actor performing the ban)
|
||||||
k_EChatEntryTypeDisconnected = 10, // user disconnected
|
k_EChatEntryTypeDisconnected = 10, // user disconnected
|
||||||
k_EChatEntryTypeHistoricalChat = 11, // a chat message from user's chat history or offilne message
|
k_EChatEntryTypeHistoricalChat = 11, // a chat message from user's chat history or offilne message
|
||||||
|
k_EChatEntryTypeReserved1 = 12,
|
||||||
|
k_EChatEntryTypeReserved2 = 13,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -526,7 +535,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H )
|
#if defined( INCLUDED_STEAM2_USERID_STRUCTS )
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Initializes a steam ID from a Steam2 ID structure
|
// Purpose: Initializes a steam ID from a Steam2 ID structure
|
||||||
// Input: pTSteamGlobalUserID - Steam2 ID to convert
|
// Input: pTSteamGlobalUserID - Steam2 ID to convert
|
||||||
|
|||||||
@@ -16,10 +16,13 @@
|
|||||||
// isteamcontroller.h.
|
// isteamcontroller.h.
|
||||||
#include "steamtypes.h"
|
#include "steamtypes.h"
|
||||||
#else
|
#else
|
||||||
// Otherwise, we assume it's a firmware build, which doesn't deal with all the
|
#include <stdint.h>
|
||||||
// things that exist in steamtypes.h, and hardcode the typedefs we need.
|
typedef uint32_t uint32;
|
||||||
typedef unsigned int uint32;
|
#ifdef __C51__
|
||||||
typedef unsigned __int64 uint64;
|
typedef uint8_t uint64[8];
|
||||||
|
#else
|
||||||
|
typedef uint64_t uint64;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ enum EHTTPStatusCode
|
|||||||
k_EHTTPStatusCode415UnsupportedMediaType = 415,
|
k_EHTTPStatusCode415UnsupportedMediaType = 415,
|
||||||
k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416,
|
k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416,
|
||||||
k_EHTTPStatusCode417ExpectationFailed = 417,
|
k_EHTTPStatusCode417ExpectationFailed = 417,
|
||||||
|
k_EHTTPStatusCode429TooManyRequests = 429,
|
||||||
|
|
||||||
// Server error codes
|
// Server error codes
|
||||||
k_EHTTPStatusCode500InternalServerError = 500,
|
k_EHTTPStatusCode500InternalServerError = 500,
|
||||||
|
|||||||
+20
-1
@@ -119,6 +119,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0;
|
virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0;
|
||||||
|
|
||||||
|
/** [Windows Only]
|
||||||
|
* Notifies the system that the VR output will appear in a particular window.
|
||||||
|
*/
|
||||||
|
virtual void AttachToWindow( void *hWnd ) = 0;
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Tracking Methods
|
// Tracking Methods
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
@@ -168,7 +173,7 @@ public:
|
|||||||
virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const IHmd_Version = "IHmd_004";
|
static const char * const IHmd_Version = "IHmd_005";
|
||||||
|
|
||||||
/** error codes returned by Vr_Init */
|
/** error codes returned by Vr_Init */
|
||||||
enum HmdError
|
enum HmdError
|
||||||
@@ -187,11 +192,16 @@ enum HmdError
|
|||||||
HmdError_Init_NotInitialized = 109,
|
HmdError_Init_NotInitialized = 109,
|
||||||
|
|
||||||
HmdError_Driver_Failed = 200,
|
HmdError_Driver_Failed = 200,
|
||||||
|
HmdError_Driver_Unknown = 201,
|
||||||
|
HmdError_Driver_HmdUnknown = 202,
|
||||||
|
HmdError_Driver_NotLoaded = 203,
|
||||||
|
|
||||||
HmdError_IPC_ServerInitFailed = 300,
|
HmdError_IPC_ServerInitFailed = 300,
|
||||||
HmdError_IPC_ConnectFailed = 301,
|
HmdError_IPC_ConnectFailed = 301,
|
||||||
HmdError_IPC_SharedStateInitFailed = 302,
|
HmdError_IPC_SharedStateInitFailed = 302,
|
||||||
|
|
||||||
|
HmdError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -236,6 +246,15 @@ VR_INTERFACE IHmd *VR_Init( HmdError *peError );
|
|||||||
* invalid after this point */
|
* invalid after this point */
|
||||||
VR_INTERFACE void VR_Shutdown( );
|
VR_INTERFACE void VR_Shutdown( );
|
||||||
|
|
||||||
|
/** Returns true if there is an HMD attached. This check is as lightweight as possible and
|
||||||
|
* can be called outside of VR_Init/VR_Shutdown. It should be used when an application wants
|
||||||
|
* to know if initializing VR is a possibility but isn't ready to take that step yet.
|
||||||
|
*/
|
||||||
|
VR_INTERFACE bool VR_IsHmdPresent();
|
||||||
|
|
||||||
|
/** Returns the string version of an HMD error. This function may be called outside of VR_Init()/VR_Shutdown(). */
|
||||||
|
VR_INTERFACE const char *VR_GetStringForHmdError( HmdError error );
|
||||||
|
|
||||||
#pragma pack( pop )
|
#pragma pack( pop )
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,7 @@
|
|||||||
#Visit http://visualgdb.com/makefiles for more details
|
#Visit http://visualgdb.com/makefiles for more details
|
||||||
|
|
||||||
#VisualGDB: AutoSourceFiles #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS
|
#VisualGDB: AutoSourceFiles #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS
|
||||||
SOURCEFILES := BaseMenu.cpp clanchatroom.cpp connectingmenu.cpp gameenginesdl.cpp glew.c Leaderboards.cpp Lobby.cpp Main.cpp MainMenu.cpp musicplayer.cpp p2pauth.cpp PhotonBeam.cpp QuitMenu.cpp RemoteStorage.cpp remotestoragesync.cpp ServerBrowser.cpp Ship.cpp SpaceWarClient.cpp SpaceWarEntity.cpp SpaceWarServer.cpp StarField.cpp StatsAndAchievements.cpp stdafx.cpp steamvrglhelper.cpp Sun.cpp VectorEntity.cpp voicechat.cpp
|
SOURCEFILES := BaseMenu.cpp clanchatroom.cpp connectingmenu.cpp gameenginesdl.cpp glew.c htmlsurface.cpp Leaderboards.cpp Lobby.cpp Main.cpp MainMenu.cpp musicplayer.cpp p2pauth.cpp PhotonBeam.cpp QuitMenu.cpp RemoteStorage.cpp remotestoragesync.cpp ServerBrowser.cpp Ship.cpp SpaceWarClient.cpp SpaceWarEntity.cpp SpaceWarServer.cpp StarField.cpp StatsAndAchievements.cpp stdafx.cpp steamvrglhelper.cpp Sun.cpp VectorEntity.cpp voicechat.cpp
|
||||||
|
|
||||||
TARGETNAME := SteamworksExampleLinux
|
TARGETNAME := SteamworksExampleLinux
|
||||||
#TARGETTYPE can be APP, STATIC or SHARED
|
#TARGETTYPE can be APP, STATIC or SHARED
|
||||||
|
|||||||
@@ -0,0 +1,465 @@
|
|||||||
|
//====== Copyright 1996-2014, Valve Corporation, All rights reserved. =======
|
||||||
|
//
|
||||||
|
// Purpose: Simple C++ protobuf manipulation routines. For a more advanced,
|
||||||
|
// fully-featured library, see https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
#include "SimpleProtobuf.h"
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE:
|
||||||
|
// You should probably be using the official protobuf library instead if you
|
||||||
|
// have any concerns about how this code works, or are planning to modify it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define CHECK_OVERRUN( ptr, end, len ) ( end < ptr || (size_t)( end - ptr ) < len )
|
||||||
|
|
||||||
|
static void ProtobufEncodeVarInt( std::string& strProtobuf, uint64 ulVarInt )
|
||||||
|
{
|
||||||
|
for ( ; ulVarInt >= 128; ulVarInt >>= 7 )
|
||||||
|
strProtobuf.append( 1, ((char)ulVarInt & (char)127) | (char)128 );
|
||||||
|
strProtobuf.append( 1, (char)ulVarInt );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_Integer( std::string& strProtobuf, uint32 uFieldNumber, uint64 ulVarIntData )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ) );
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, ulVarIntData );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_SInteger( std::string& strProtobuf, uint32 uFieldNumber, int64 ulSwizzleVarIntData )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_SINTEGER( uFieldNumber ) );
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, (ulSwizzleVarIntData << 1) ^ (ulSwizzleVarIntData >> 63) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_Fixed64( std::string& strProtobuf, uint32 uFieldNumber, uint64 ulFixed64Data )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ) );
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
ulFixed64Data = QWordSwap( ulFixed64Data );
|
||||||
|
#endif
|
||||||
|
strProtobuf.append( reinterpret_cast<char*>(&ulFixed64Data), 8 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_Fixed64( std::string& strProtobuf, uint32 uFieldNumber, double flFixed64Data )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ) );
|
||||||
|
const char *pData = reinterpret_cast<const char*>(&flFixed64Data);
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
strProtobuf.append( std::const_reverse_iterator<const char*>( pData + 8 ), std::const_reverse_iterator<const char*>( pData ) );
|
||||||
|
#else
|
||||||
|
strProtobuf.append( pData, 8 );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_String( std::string& strProtobuf, uint32 uFieldNumber, const char *pchData, size_t cchData )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_STRING( uFieldNumber ) );
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, cchData );
|
||||||
|
strProtobuf.append( pchData, cchData );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_String( std::string& strProtobuf, uint32 uFieldNumber, const std::string &strData )
|
||||||
|
{
|
||||||
|
ProtobufWriteField_String( strProtobuf, uFieldNumber, strData.data(), strData.size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_String( std::string& strProtobuf, uint32 uFieldNumber, const char *pchData )
|
||||||
|
{
|
||||||
|
ProtobufWriteField_String( strProtobuf, uFieldNumber, pchData, strlen( pchData ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_Fixed32( std::string& strProtobuf, uint32 uFieldNumber, uint32 ulFixed32Data )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ) );
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
ulFixed32Data = DWordSwap( ulFixed32Data );
|
||||||
|
#endif
|
||||||
|
strProtobuf.append( reinterpret_cast<char*>(&ulFixed32Data), 4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProtobufWriteField_Fixed32( std::string& strProtobuf, uint32 uFieldNumber, float flFixed32Data )
|
||||||
|
{
|
||||||
|
ProtobufEncodeVarInt( strProtobuf, PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ) );
|
||||||
|
const char *pData = reinterpret_cast<const char*>(&flFixed32Data);
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
strProtobuf.append( std::const_reverse_iterator<const char*>( pData + 4 ), std::const_reverse_iterator<const char*>( pData ) );
|
||||||
|
#else
|
||||||
|
strProtobuf.append( pData, 4 );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool ProtobufDecodeVarInt( const char * &pParsePosition, const char *pParseEnd, uint64 &ulVarInt )
|
||||||
|
{
|
||||||
|
const char * pStart = pParsePosition;
|
||||||
|
while ( pParsePosition < pParseEnd && (*pParsePosition & 128) )
|
||||||
|
++pParsePosition;
|
||||||
|
if ( pParsePosition >= pParseEnd )
|
||||||
|
return false;
|
||||||
|
uint64 v = 0;
|
||||||
|
for ( const char *p = pParsePosition++; p >= pStart; --p )
|
||||||
|
v = (v << 7) + (*p & 127);
|
||||||
|
ulVarInt = v;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFieldTag( const char * &pParsePosition, const char *pParseEnd, uint32 &uFieldTag )
|
||||||
|
{
|
||||||
|
uint64 v;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, v ) || v == 0 || (v >> 32) != 0 )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uFieldTag = (uint32)v;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufSkipFieldValue( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag )
|
||||||
|
{
|
||||||
|
switch ( uFieldTag & 7 )
|
||||||
|
{
|
||||||
|
case 0: // VARINT
|
||||||
|
while ( pParsePosition < pParseEnd )
|
||||||
|
{
|
||||||
|
char c = *pParsePosition++;
|
||||||
|
if ( !( c & 128 ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case 1: // FIXED64
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 8 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pParsePosition += 8;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case 2: // LENGTH DELIM (string, etc)
|
||||||
|
{
|
||||||
|
uint64 ulLength = 0;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulLength ) )
|
||||||
|
return false;
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, ulLength ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pParsePosition += ulLength;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 5: // FIXED32
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 4 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pParsePosition += 4;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default: // UNKNOWN
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFixed32( const char * &pParsePosition, const char *pParseEnd, int32 &nValue )
|
||||||
|
{
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 4 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy( &nValue, pParsePosition, 4 );
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
nValue = DWordSwap( nValue );
|
||||||
|
#endif
|
||||||
|
pParsePosition += 4;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 &uValue )
|
||||||
|
{
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 4 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy( &uValue, pParsePosition, 4 );
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
uValue = DWordSwap( uValue );
|
||||||
|
#endif
|
||||||
|
pParsePosition += 4;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFixed32( const char * &pParsePosition, const char *pParseEnd, float &flValue )
|
||||||
|
{
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 4 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
std::copy( std::const_reverse_iterator( pParsePosition + 4 ), std::const_reverse_iterator( pParsePosition ), reinterpret_cast<char *>(&flValue) );
|
||||||
|
#else
|
||||||
|
memcpy( &flValue, pParsePosition, 4 );
|
||||||
|
#endif
|
||||||
|
pParsePosition += 4;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFixed64( const char * &pParsePosition, const char *pParseEnd, int64 &lValue )
|
||||||
|
{
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 8 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy( &lValue, pParsePosition, 8 );
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
lValue = QWordSwap( lValue );
|
||||||
|
#endif
|
||||||
|
pParsePosition += 8;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFixed64( const char * &pParsePosition, const char *pParseEnd, uint64 &ulValue )
|
||||||
|
{
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 8 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy( &ulValue, pParsePosition, 8 );
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
ulValue = QWordSwap( ulValue );
|
||||||
|
#endif
|
||||||
|
pParsePosition += 8;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadFixed64( const char * &pParsePosition, const char *pParseEnd, double &flValue )
|
||||||
|
{
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, 8 ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#ifdef VALVE_BIG_ENDIAN
|
||||||
|
std::copy( std::const_reverse_iterator( pParsePosition + 8 ), std::const_reverse_iterator( pParsePosition ), reinterpret_cast<char *>(&flValue) );
|
||||||
|
#else
|
||||||
|
memcpy( &flValue, pParsePosition, 8 );
|
||||||
|
#endif
|
||||||
|
pParsePosition += 8;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, uint64 &ulVarInt )
|
||||||
|
{
|
||||||
|
return ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulVarInt );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, int64 &lVarInt )
|
||||||
|
{
|
||||||
|
return ProtobufDecodeVarInt( pParsePosition, pParseEnd, reinterpret_cast<uint64&>(lVarInt) );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, uint32 &uVarInt )
|
||||||
|
{
|
||||||
|
uint64 ulVarInt;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulVarInt ) )
|
||||||
|
return false;
|
||||||
|
uVarInt = (uint32)ulVarInt;
|
||||||
|
return (uint64)uVarInt == ulVarInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, int32 &nVarInt )
|
||||||
|
{
|
||||||
|
uint64 ulVarInt;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulVarInt ) )
|
||||||
|
return false;
|
||||||
|
nVarInt = (int32)ulVarInt;
|
||||||
|
return (uint64)(int64)nVarInt == ulVarInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, bool &bVarInt )
|
||||||
|
{
|
||||||
|
uint64 ulVarInt;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulVarInt ) )
|
||||||
|
return false;
|
||||||
|
bVarInt = ( ulVarInt != 0 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadSInteger( const char * &pParsePosition, const char *pParseEnd, int64 &lVarInt )
|
||||||
|
{
|
||||||
|
uint64 v;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, v ) )
|
||||||
|
return false;
|
||||||
|
lVarInt = (int64)(v >> 1) ^ -(int64)(v & 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadSInteger( const char * &pParsePosition, const char *pParseEnd, int32 &nVarInt )
|
||||||
|
{
|
||||||
|
uint64 v;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, v ) )
|
||||||
|
return false;
|
||||||
|
int64 lVarInt = (int64)(v >> 1) ^ -(int64)(v & 1);
|
||||||
|
nVarInt = (int32)lVarInt;
|
||||||
|
return (int64)nVarInt == lVarInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadString( const char * &pParsePosition, const char *pParseEnd, std::string &strValue )
|
||||||
|
{
|
||||||
|
uint64 ulLength;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulLength ) )
|
||||||
|
return false;
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, ulLength ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
strValue.assign( pParsePosition, (size_t)ulLength );
|
||||||
|
pParsePosition += ulLength;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadStringAlias( const char * &pParsePosition, const char *pParseEnd, const char * &pStringDataStart, const char * &pStringDataEnd )
|
||||||
|
{
|
||||||
|
uint64 ulLength;
|
||||||
|
if ( !ProtobufDecodeVarInt( pParsePosition, pParseEnd, ulLength ) )
|
||||||
|
return false;
|
||||||
|
if ( CHECK_OVERRUN( pParsePosition, pParseEnd, ulLength ) )
|
||||||
|
{
|
||||||
|
pParsePosition = pParseEnd;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pStringDataStart = pParsePosition;
|
||||||
|
pParsePosition += ulLength;
|
||||||
|
pStringDataEnd = pParsePosition;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
static bool ProtobufReadRepeated_T( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector< T > &vecData, bool( *pfnRead )(const char * &, const char *, T &) )
|
||||||
|
{
|
||||||
|
if ( (uFieldTag & 7) == 2 )
|
||||||
|
{
|
||||||
|
const char *pStart = NULL, *pEnd = NULL;
|
||||||
|
if ( !ProtobufReadStringAlias( pParsePosition, pParseEnd, pStart, pEnd ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
while ( pStart != pEnd )
|
||||||
|
{
|
||||||
|
T v;
|
||||||
|
if ( !pfnRead( pStart, pEnd, v ) )
|
||||||
|
return false;
|
||||||
|
vecData.push_back( v );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
T v;
|
||||||
|
if ( !pfnRead( pParsePosition, pParseEnd, v ) )
|
||||||
|
return false;
|
||||||
|
vecData.push_back( v );
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint64> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int64> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint32> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int32> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<bool> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufReadRepeatedSInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int64> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadSInteger ); }
|
||||||
|
bool ProtobufReadRepeatedSInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int32> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadSInteger ); }
|
||||||
|
bool ProtobufReadRepeatedFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int32> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadFixed32 ); }
|
||||||
|
bool ProtobufReadRepeatedFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint32> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadFixed32 ); }
|
||||||
|
bool ProtobufReadRepeatedFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<float> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadFixed32 ); }
|
||||||
|
bool ProtobufReadRepeatedFixed64( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int64> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadFixed64 ); }
|
||||||
|
bool ProtobufReadRepeatedFixed64( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint64> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadFixed64 ); }
|
||||||
|
bool ProtobufReadRepeatedFixed64( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<double> &vec ) { return ProtobufReadRepeated_T( pParsePosition, pParseEnd, uFieldTag, vec, &ProtobufReadFixed64 ); }
|
||||||
|
|
||||||
|
bool ProtobufReadRepeatedString( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<std::string> &vec )
|
||||||
|
{
|
||||||
|
vec.push_back( std::string() );
|
||||||
|
if ( !ProtobufReadString( pParsePosition, pParseEnd, vec.back() ) )
|
||||||
|
{
|
||||||
|
vec.pop_back();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
static bool ProtobufExtractField_T( const char *pParsePosition, const char *pParseEnd, uint32 uFieldTag, T &value, bool( *pfnRead )(const char * &, const char *, T &) )
|
||||||
|
{
|
||||||
|
uint32 uCurrentTag = 0;
|
||||||
|
bool bOK = false;
|
||||||
|
while ( ProtobufReadFieldTag( pParsePosition, pParseEnd, uCurrentTag ) )
|
||||||
|
{
|
||||||
|
if ( uCurrentTag == uFieldTag )
|
||||||
|
bOK = pfnRead( pParsePosition, pParseEnd, value );
|
||||||
|
else
|
||||||
|
ProtobufSkipFieldValue( pParsePosition, pParseEnd, uCurrentTag );
|
||||||
|
}
|
||||||
|
return bOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
static bool ProtobufExtractField_T( const char *pParsePosition, const char *pParseEnd, uint32 uFieldTag, T &value, bool( *pfnRead )(const char * &, const char *, uint32, T &) )
|
||||||
|
{
|
||||||
|
uint32 uCurrentTag = 0;
|
||||||
|
bool bOK = false;
|
||||||
|
while ( ProtobufReadFieldTag( pParsePosition, pParseEnd, uCurrentTag ) )
|
||||||
|
{
|
||||||
|
if ( uCurrentTag == uFieldTag || uCurrentTag == PROTOBUF_FIELDTAG_STRING( uFieldTag >> 3 ) )
|
||||||
|
bOK = pfnRead( pParsePosition, pParseEnd, uCurrentTag, value );
|
||||||
|
else
|
||||||
|
ProtobufSkipFieldValue( pParsePosition, pParseEnd, uCurrentTag );
|
||||||
|
}
|
||||||
|
return bOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, uint64 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), value, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, int64 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), value, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, uint32 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), value, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, int32 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), value, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, bool &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), value, &ProtobufReadInteger ); }
|
||||||
|
bool ProtobufExtractField_SInteger( const std::string &strProtobuf, uint32 uFieldNumber, int64 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_SINTEGER( uFieldNumber ), value, &ProtobufReadSInteger ); }
|
||||||
|
bool ProtobufExtractField_SInteger( const std::string &strProtobuf, uint32 uFieldNumber, int32 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_SINTEGER( uFieldNumber ), value, &ProtobufReadSInteger ); }
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string &strProtobuf, uint32 uFieldNumber, int64 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ), value, &ProtobufReadFixed64 ); }
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string &strProtobuf, uint32 uFieldNumber, uint64 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ), value, &ProtobufReadFixed64 ); }
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string &strProtobuf, uint32 uFieldNumber, double &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ), value, &ProtobufReadFixed64 ); }
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string &strProtobuf, uint32 uFieldNumber, int32 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ), value, &ProtobufReadFixed32 ); }
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string &strProtobuf, uint32 uFieldNumber, uint32 &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ), value, &ProtobufReadFixed32 ); }
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string &strProtobuf, uint32 uFieldNumber, float &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ), value, &ProtobufReadFixed32 ); }
|
||||||
|
bool ProtobufExtractField_String( const std::string &strProtobuf, uint32 uFieldNumber, std::string &value ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_STRING( uFieldNumber ), value, &ProtobufReadString ); }
|
||||||
|
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<uint64> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<int64> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<uint32> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<int32> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedInteger ); }
|
||||||
|
bool ProtobufExtractField_Integer( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<bool> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_INTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedInteger ); }
|
||||||
|
bool ProtobufExtractField_SInteger( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<int64> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_SINTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedSInteger ); }
|
||||||
|
bool ProtobufExtractField_SInteger( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<int32> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_SINTEGER( uFieldNumber ), vec, &ProtobufReadRepeatedSInteger ); }
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<int64> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ), vec, &ProtobufReadRepeatedFixed64 ); }
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<uint64> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ), vec, &ProtobufReadRepeatedFixed64 ); }
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<double> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED64( uFieldNumber ), vec, &ProtobufReadRepeatedFixed64 ); }
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<int32> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ), vec, &ProtobufReadRepeatedFixed32 ); }
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<uint32> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ), vec, &ProtobufReadRepeatedFixed32 ); }
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<float> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_FIXED32( uFieldNumber ), vec, &ProtobufReadRepeatedFixed32 ); }
|
||||||
|
bool ProtobufExtractField_String( const std::string &strProtobuf, uint32 uFieldNumber, std::vector<std::string> &vec ) { return ProtobufExtractField_T( strProtobuf.data(), strProtobuf.data() + strProtobuf.size(), PROTOBUF_FIELDTAG_STRING( uFieldNumber ), vec, &ProtobufReadRepeatedString ); }
|
||||||
|
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
//====== Copyright 1996-2014, Valve Corporation, All rights reserved. =======
|
||||||
|
//
|
||||||
|
// Purpose: Simple C++ protobuf manipulation routines. For a more advanced,
|
||||||
|
// fully-featured library, see https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
#ifndef SIMPLEPROTOBUF_H
|
||||||
|
#define SIMPLEPROTOBUF_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "steam/steamtypes.h"
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// This file contains some quick-and-dirty helpers that can encode and
|
||||||
|
// decode the protocol-buffer ("protobuf") serialization format. It's
|
||||||
|
// a reasonable way to communicate with simple protobuf-based services.
|
||||||
|
//
|
||||||
|
// However, if you are doing serious work with protobufs, you should
|
||||||
|
// take the time to understand and use the official C++ library. It
|
||||||
|
// provides a tool which copmiles protobuf descriptions directly into
|
||||||
|
// working C++ classes, which will save you time and effort, and help
|
||||||
|
// with parsing complicated message types.
|
||||||
|
//
|
||||||
|
// https://developers.google.com/protocol-buffers/
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// The protobuf serialization format is a simple field-based encoding;
|
||||||
|
// a complete protobuf is the unordered concatenation of all its fields.
|
||||||
|
// Unknown or incorrectly-typed fields are ignored by protobuf parsers.
|
||||||
|
//
|
||||||
|
// Details: https://developers.google.com/protocol-buffers/docs/encoding
|
||||||
|
//
|
||||||
|
// All protobuf value types use one of these five encodings:
|
||||||
|
// Integer: bool, enum, int32, uint32, int64, uint64
|
||||||
|
// SInteger: sint32, sint64
|
||||||
|
// Fixed32: fixed32, float
|
||||||
|
// Fixed64: fixed64, double
|
||||||
|
// String: string, bytes, nested message types
|
||||||
|
//
|
||||||
|
// Nested protobufs are built up independently, then encoded as string
|
||||||
|
// fields in the parent protobuf.
|
||||||
|
//
|
||||||
|
// Arrays ("repeated" field types) have two possible encodings: simple
|
||||||
|
// and packed. This utility file can parse both encodings, but only
|
||||||
|
// emits simple repeated fields (via multiple ProtobufWriteField calls
|
||||||
|
// with the same field number, one for every array element).
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Example usage
|
||||||
|
//
|
||||||
|
// If this is the protobuf definition of a message...
|
||||||
|
//
|
||||||
|
// message TestMessage {
|
||||||
|
// optional uint32 index = 1;
|
||||||
|
// optional string text = 2;
|
||||||
|
// repeated double number = 3;
|
||||||
|
// optional bool flag = 4;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ...then this is how to compose it:
|
||||||
|
//
|
||||||
|
// std::string msg;
|
||||||
|
// ProtobufWriteField_Integer( msg, 1, iIndex );
|
||||||
|
// ProtobufWriteField_Integer( msg, 4, true );
|
||||||
|
// ProtobufWriteField_Fixed64( msg, 3, 1.0 );
|
||||||
|
// ProtobufWriteField_Fixed64( msg, 3, 2.0 );
|
||||||
|
// ProtobufWriteField_Fixed64( msg, 3, 3.0 );
|
||||||
|
// ProtobufWriteField_String( msg, 2, "text field" );
|
||||||
|
//
|
||||||
|
// ...and this is how to extract individual fields:
|
||||||
|
//
|
||||||
|
// std::string strText;
|
||||||
|
// ProtobufExtractField_String( msg, 2, strText );
|
||||||
|
//
|
||||||
|
// ...and this is how to parse it with optimized low-level operations:
|
||||||
|
//
|
||||||
|
// bool bFlag = false;
|
||||||
|
// uint32 uIndex = 0;
|
||||||
|
// std::string strText;
|
||||||
|
// std::vector< double > vecNumbers;
|
||||||
|
//
|
||||||
|
// const char *pParse = msg.data(), *pEnd = msg.data() + msg.size();
|
||||||
|
// for ( uint32 uFieldTag = 0; ProtobufReadFieldTag( pParse, pEnd, uFieldTag ); ) {
|
||||||
|
// switch ( uFieldTag ) {
|
||||||
|
// case PROTOBUF_FIELDTAG_INTEGER( 1 ): ProtobufReadInteger( pParse, pEnd, iIndex ); break;
|
||||||
|
// case PROTOBUF_FIELDTAG_STRING( 2 ): ProtobufReadString( pParse, pEnd, strText ); break;
|
||||||
|
// case PROTOBUF_FIELDTAG_FIXED64( 3 ): case PROTOBUF_FIELDTAG_REPEATED_FIXED64( 3 ):
|
||||||
|
// ProtobufReadRepeatedFixed64( pParse, pEnd, uFieldTag, vecNumbers ); break;
|
||||||
|
// case PROTOBUF_FIELDTAG_STRING( 4 ): ProtobufReadInteger( pParse, pEnd, bFlag ); break;
|
||||||
|
// default: ProtobufSkipFieldValue( pParse, pEnd, uFieldTag ); break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// NOTE: it is important to handle both REPEATED and non-REPEATED cases when
|
||||||
|
// parsing repeated fields, for all types other than strings! There are two
|
||||||
|
// different possible encodings for repeated non-string fields, and failing
|
||||||
|
// to handle both cases can lead to invalid parse results.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Encoding functions
|
||||||
|
//
|
||||||
|
// Note: C++ type promotion rules will automatically handle smaller integer types
|
||||||
|
|
||||||
|
void ProtobufWriteField_Integer( std::string& strProtobuf, uint32 uFieldNumber, uint64 ulVarIntData );
|
||||||
|
void ProtobufWriteField_SInteger( std::string& strProtobuf, uint32 uFieldNumber, int64 lSwizzleVarIntData );
|
||||||
|
void ProtobufWriteField_Fixed64( std::string& strProtobuf, uint32 uFieldNumber, uint64 ulFixed64Data );
|
||||||
|
void ProtobufWriteField_Fixed64( std::string& strProtobuf, uint32 uFieldNumber, double flFixed64Data );
|
||||||
|
void ProtobufWriteField_Fixed32( std::string& strProtobuf, uint32 uFieldNumber, uint32 ulFixed32Data );
|
||||||
|
void ProtobufWriteField_Fixed32( std::string& strProtobuf, uint32 uFieldNumber, float flFixed32Data );
|
||||||
|
void ProtobufWriteField_String( std::string& strProtobuf, uint32 uFieldNumber, const char *pchData, size_t cchData );
|
||||||
|
void ProtobufWriteField_String( std::string& strProtobuf, uint32 uFieldNumber, const char *pchData );
|
||||||
|
void ProtobufWriteField_String( std::string& strProtobuf, uint32 uFieldNumber, const std::string &strData );
|
||||||
|
|
||||||
|
// Decoding functions, high-level (not optimized for speed)
|
||||||
|
//
|
||||||
|
|
||||||
|
bool ProtobufExtractField_Integer( const std::string & strProtobuf, uint32 uFieldNumber, uint64 &ulData );
|
||||||
|
bool ProtobufExtractField_Integer( const std::string & strProtobuf, uint32 uFieldNumber, int64 &lData );
|
||||||
|
bool ProtobufExtractField_Integer( const std::string & strProtobuf, uint32 uFieldNumber, uint32 &uData );
|
||||||
|
bool ProtobufExtractField_Integer( const std::string & strProtobuf, uint32 uFieldNumber, int32 &iData );
|
||||||
|
bool ProtobufExtractField_Integer( const std::string & strProtobuf, uint32 uFieldNumber, bool &bData );
|
||||||
|
bool ProtobufExtractField_SInteger( const std::string & strProtobuf, uint32 uFieldNumber, int64 &lData );
|
||||||
|
bool ProtobufExtractField_SInteger( const std::string & strProtobuf, uint32 uFieldNumber, int32 &lData );
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string & strProtobuf, uint32 uFieldNumber, uint64 &ulData );
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string & strProtobuf, uint32 uFieldNumber, int64 &lData );
|
||||||
|
bool ProtobufExtractField_Fixed64( const std::string & strProtobuf, uint32 uFieldNumber, double &flData );
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string & strProtobuf, uint32 uFieldNumber, uint32 &uData );
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string & strProtobuf, uint32 uFieldNumber, int32 &iData );
|
||||||
|
bool ProtobufExtractField_Fixed32( const std::string & strProtobuf, uint32 uFieldNumber, float &flData );
|
||||||
|
bool ProtobufExtractField_String( const std::string & strProtobuf, uint32 uFieldNumber, std::string &strData );
|
||||||
|
|
||||||
|
// Decoding functions, low-level (see example usage and important NOTE in comments above)
|
||||||
|
//
|
||||||
|
|
||||||
|
bool ProtobufReadFieldTag( const char * &pParsePosition, const char *pParseEnd, uint32 &uFieldTag );
|
||||||
|
bool ProtobufSkipFieldValue( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag );
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, uint64 &ulVarInt );
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, int64 &lVarInt );
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, uint32 &uVarInt );
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, int32 &nVarInt );
|
||||||
|
bool ProtobufReadInteger( const char * &pParsePosition, const char *pParseEnd, bool &bVarInt );
|
||||||
|
bool ProtobufReadSInteger( const char * &pParsePosition, const char *pParseEnd, int64 &lVarInt );
|
||||||
|
bool ProtobufReadSInteger( const char * &pParsePosition, const char *pParseEnd, int32 &nVarInt );
|
||||||
|
bool ProtobufReadFixed64( const char * &pParsePosition, const char *pParseEnd, int64 &lValue );
|
||||||
|
bool ProtobufReadFixed64( const char * &pParsePosition, const char *pParseEnd, uint64 &ulValue );
|
||||||
|
bool ProtobufReadFixed64( const char * &pParsePosition, const char *pParseEnd, double &flValue );
|
||||||
|
bool ProtobufReadFixed32( const char * &pParsePosition, const char *pParseEnd, int32 &nValue );
|
||||||
|
bool ProtobufReadFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 &uValue );
|
||||||
|
bool ProtobufReadFixed32( const char * &pParsePosition, const char *pParseEnd, float &flValue );
|
||||||
|
bool ProtobufReadString( const char * &pParsePosition, const char *pParseEnd, std::string &strValue );
|
||||||
|
bool ProtobufReadStringAlias( const char * &pParsePosition, const char *pParseEnd, const char * &pStringDataStart, const char * &pStringDataEnd );
|
||||||
|
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint64> &vec );
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int64> &vec );
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint32> &vec );
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int32> &vec );
|
||||||
|
bool ProtobufReadRepeatedInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<bool> &vec );
|
||||||
|
bool ProtobufReadRepeatedSInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int64> &vec );
|
||||||
|
bool ProtobufReadRepeatedSInteger( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int32> &vec );
|
||||||
|
bool ProtobufReadRepeatedFixed64( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int64> &vec );
|
||||||
|
bool ProtobufReadRepeatedFixed64( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint64> &vec );
|
||||||
|
bool ProtobufReadRepeatedFixed64( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<double> &vec );
|
||||||
|
bool ProtobufReadRepeatedFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<int32> &vec );
|
||||||
|
bool ProtobufReadRepeatedFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<uint32> &vec );
|
||||||
|
bool ProtobufReadRepeatedFixed32( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<float> &vec );
|
||||||
|
bool ProtobufReadRepeatedString( const char * &pParsePosition, const char *pParseEnd, uint32 uFieldTag, std::vector<std::string> &vec );
|
||||||
|
|
||||||
|
#define PROTOBUF_FIELDTAG_INTEGER( Field ) ( (uint64)( Field ) << 3 )
|
||||||
|
#define PROTOBUF_FIELDTAG_SINTEGER( Field ) ( (uint64)( Field ) << 3 )
|
||||||
|
#define PROTOBUF_FIELDTAG_FIXED64( Field ) ( (uint64)( Field ) << 3 | (uint64)1 )
|
||||||
|
#define PROTOBUF_FIELDTAG_STRING( Field ) ( (uint64)( Field ) << 3 | (uint64)2 )
|
||||||
|
#define PROTOBUF_FIELDTAG_FIXED32( Field ) ( (uint64)( Field ) << 3 | (uint64)5 )
|
||||||
|
|
||||||
|
#define PROTOBUF_FIELDTAG_REPEATED_INTEGER PROTOBUF_FIELDTAG_STRING
|
||||||
|
#define PROTOBUF_FIELDTAG_REPEATED_SINTEGER PROTOBUF_FIELDTAG_STRING
|
||||||
|
#define PROTOBUF_FIELDTAG_REPEATED_FIXED32 PROTOBUF_FIELDTAG_STRING
|
||||||
|
#define PROTOBUF_FIELDTAG_REPEATED_FIXED64 PROTOBUF_FIELDTAG_STRING
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -144,7 +144,10 @@ public:
|
|||||||
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
|
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
|
||||||
|
|
||||||
// Create a new texture returning our internal handle value for it (0 means failure)
|
// Create a new texture returning our internal handle value for it (0 means failure)
|
||||||
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight );
|
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA );
|
||||||
|
|
||||||
|
// update an existing texture
|
||||||
|
bool UpdateTexture( HGAMETEXTURE texture, byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat );
|
||||||
|
|
||||||
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
||||||
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
|
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
|
||||||
|
|||||||
@@ -1693,7 +1693,7 @@ bool CGameEngineGL::BFlushQuadBuffer()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Creates a new texture
|
// Purpose: Creates a new texture
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight )
|
HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat )
|
||||||
{
|
{
|
||||||
#if DX9MODE
|
#if DX9MODE
|
||||||
if ( !m_pD3D9Device )
|
if ( !m_pD3D9Device )
|
||||||
@@ -1732,7 +1732,7 @@ HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint
|
|||||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||||
|
|
||||||
// build our texture mipmaps
|
// build our texture mipmaps
|
||||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, uWidth, uHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, (void *)pRGBAData );
|
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, uWidth, uHeight, 0, eTextureFormat == eTextureFormat_RGBA ? GL_RGBA : GL_BGRA, GL_UNSIGNED_BYTE, (void *)pRGBAData );
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
|
||||||
int nHandle = m_nNextTextureHandle;
|
int nHandle = m_nNextTextureHandle;
|
||||||
@@ -1744,6 +1744,39 @@ HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: update an exiting textue
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool CGameEngineGL::UpdateTexture( HGAMETEXTURE texture, byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat )
|
||||||
|
{
|
||||||
|
#if DX9MODE
|
||||||
|
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if ( m_bShuttingDown )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::map<HGAMETEXTURE, TextureData_t>::iterator iter;
|
||||||
|
iter = m_MapTextures.find( texture );
|
||||||
|
if ( iter == m_MapTextures.end() )
|
||||||
|
{
|
||||||
|
OutputDebugString( "BDrawTexturedQuad called with invalid hTexture value\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
glBindTexture( GL_TEXTURE_2D, iter->second.m_uTextureID );
|
||||||
|
|
||||||
|
// build our texture mipmaps
|
||||||
|
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, uWidth, uHeight, 0, eTextureFormat == eTextureFormat_RGBA ? GL_RGBA : GL_BGRA, GL_UNSIGNED_BYTE, (void *)pRGBAData );
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Creates a new font
|
// Purpose: Creates a new font
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -837,7 +837,7 @@ bool CGameEngineGL::BFlushQuadBuffer()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Creates a new texture
|
// Purpose: Creates a new texture
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight )
|
HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat )
|
||||||
{
|
{
|
||||||
if ( m_bShuttingDown )
|
if ( m_bShuttingDown )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -859,7 +859,7 @@ HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint
|
|||||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||||
|
|
||||||
// build our texture mipmaps
|
// build our texture mipmaps
|
||||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, uWidth, uHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, (void *)pRGBAData );
|
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, uWidth, uHeight, 0, eTextureFormat == eTextureFormat_RGBA ? GL_RGBA : GL_BGRA, GL_UNSIGNED_BYTE, (void *)pRGBAData );
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
|
||||||
int nHandle = m_nNextTextureHandle;
|
int nHandle = m_nNextTextureHandle;
|
||||||
@@ -870,6 +870,33 @@ HGAMETEXTURE CGameEngineGL::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: update an exiting textue
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool CGameEngineGL::UpdateTexture( HGAMETEXTURE texture, byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat )
|
||||||
|
{
|
||||||
|
if ( m_bShuttingDown )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::map<HGAMETEXTURE, TextureData_t>::iterator iter;
|
||||||
|
iter = m_MapTextures.find( texture );
|
||||||
|
if ( iter == m_MapTextures.end() )
|
||||||
|
{
|
||||||
|
OutputDebugString( "BDrawTexturedQuad called with invalid hTexture value\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
glBindTexture( GL_TEXTURE_2D, iter->second.m_uTextureID );
|
||||||
|
|
||||||
|
// build our texture mipmaps
|
||||||
|
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, uWidth, uHeight, 0, eTextureFormat == eTextureFormat_RGBA ? GL_RGBA : GL_BGRA, GL_UNSIGNED_BYTE, (void *)pRGBAData );
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Creates a new font
|
// Purpose: Creates a new font
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -104,7 +104,10 @@ public:
|
|||||||
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
|
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
|
||||||
|
|
||||||
// Create a new texture returning our internal handle value for it (0 means failure)
|
// Create a new texture returning our internal handle value for it (0 means failure)
|
||||||
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight );
|
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA );
|
||||||
|
|
||||||
|
// update an existing texture
|
||||||
|
bool UpdateTexture( HGAMETEXTURE texture, byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat );
|
||||||
|
|
||||||
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
||||||
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
|
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
|
||||||
|
|||||||
@@ -1846,29 +1846,34 @@ bool CGameEngineWin32::BRenderPrimitive( D3DPRIMITIVETYPE primType, uint32 uStar
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Creates a new texture
|
// Purpose: Creates a new texture
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
HGAMETEXTURE CGameEngineWin32::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight )
|
HGAMETEXTURE CGameEngineWin32::HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat )
|
||||||
{
|
|
||||||
return HCreateTextureInternal( pRGBAData, uWidth, uHeight, D3DFMT_A8R8G8B8 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Create a new texture returning our internal handle value for it (0 means failure)
|
|
||||||
HGAMETEXTURE CGameEngineWin32::HCreateTextureInternal( byte *pRGBAData, uint32 uWidth, uint32 uHeight, D3DFORMAT eFormat )
|
|
||||||
{
|
{
|
||||||
if ( !m_pD3D9Device )
|
if ( !m_pD3D9Device )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
D3DFORMAT eD3DDeviceFormat = D3DFMT_A8R8G8B8;
|
||||||
|
|
||||||
|
switch ( eTextureFormat )
|
||||||
|
{
|
||||||
|
case eTextureFormat_RGBA:
|
||||||
|
case eTextureFormat_BGRA:
|
||||||
|
eD3DDeviceFormat = D3DFMT_A8R8G8B8;
|
||||||
|
break;
|
||||||
|
case eTextureFormat_BGRA16:
|
||||||
|
eD3DDeviceFormat = D3DFMT_A16B16G16R16;
|
||||||
|
}
|
||||||
|
|
||||||
TextureData_t TexData;
|
TextureData_t TexData;
|
||||||
TexData.m_uWidth = uWidth;
|
TexData.m_uWidth = uWidth;
|
||||||
TexData.m_uHeight = uHeight;
|
TexData.m_uHeight = uHeight;
|
||||||
if ( pRGBAData )
|
if ( pRGBAData )
|
||||||
{
|
{
|
||||||
size_t dataSize = 0;
|
size_t dataSize = 0;
|
||||||
if ( eFormat == D3DFMT_A8B8G8R8 )
|
if ( eD3DDeviceFormat == D3DFMT_A8R8G8B8 )
|
||||||
{
|
{
|
||||||
dataSize = uWidth*uHeight * 4;
|
dataSize = uWidth*uHeight * 4;
|
||||||
}
|
}
|
||||||
else if ( eFormat == D3DFMT_A16B16G16R16 )
|
else if ( eD3DDeviceFormat == D3DFMT_A16B16G16R16 )
|
||||||
{
|
{
|
||||||
dataSize = sizeof(uint16)* 4 * uWidth * uHeight;
|
dataSize = sizeof(uint16)* 4 * uWidth * uHeight;
|
||||||
}
|
}
|
||||||
@@ -1881,7 +1886,8 @@ HGAMETEXTURE CGameEngineWin32::HCreateTextureInternal( byte *pRGBAData, uint32 u
|
|||||||
}
|
}
|
||||||
TexData.m_pTexture = NULL;
|
TexData.m_pTexture = NULL;
|
||||||
TexData.m_pDepthSurface = NULL;
|
TexData.m_pDepthSurface = NULL;
|
||||||
TexData.m_eFormat = eFormat;
|
TexData.m_eFormat = eD3DDeviceFormat;
|
||||||
|
TexData.m_eTextureFormat = eTextureFormat;
|
||||||
|
|
||||||
int nHandle = m_nNextTextureHandle;
|
int nHandle = m_nNextTextureHandle;
|
||||||
++m_nNextTextureHandle;
|
++m_nNextTextureHandle;
|
||||||
@@ -2162,6 +2168,78 @@ bool CGameEngineWin32::AddVoiceData( HGAMEVOICECHANNEL hChannel, const uint8 *pV
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: update an existing texture
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool CGameEngineWin32::UpdateTexture( HGAMETEXTURE hTexture, byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat )
|
||||||
|
{
|
||||||
|
std::map<HGAMETEXTURE, TextureData_t>::iterator iter;
|
||||||
|
iter = m_MapTextures.find( hTexture );
|
||||||
|
if (iter == m_MapTextures.end())
|
||||||
|
{
|
||||||
|
OutputDebugString( "BFlushQuadBuffer failed with invalid m_hLastTexture value\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put the data into the texture
|
||||||
|
D3DLOCKED_RECT rect;
|
||||||
|
HRESULT hRes = iter->second.m_pTexture->LockRect( 0, &rect, NULL, 0 );
|
||||||
|
if (FAILED( hRes ))
|
||||||
|
{
|
||||||
|
OutputDebugString( "LockRect call failed\n" );
|
||||||
|
iter->second.m_pTexture->Release();
|
||||||
|
iter->second.m_pTexture = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iter->second.m_eFormat == D3DFMT_A8R8G8B8)
|
||||||
|
{
|
||||||
|
DWORD *pARGB = (DWORD *)rect.pBits;
|
||||||
|
byte *pRGBA = (byte *)pRGBAData;
|
||||||
|
|
||||||
|
byte r, g, b, a;
|
||||||
|
for (uint32 y = 0; y < uHeight; ++y)
|
||||||
|
{
|
||||||
|
for (uint32 x = 0; x < uWidth; ++x)
|
||||||
|
{
|
||||||
|
// swap position of alpha value from back to front to be in correct format for d3d...
|
||||||
|
r = *pRGBA++;
|
||||||
|
g = *pRGBA++;
|
||||||
|
b = *pRGBA++;
|
||||||
|
a = *pRGBA++;
|
||||||
|
|
||||||
|
if ( eTextureFormat == eTextureFormat_RGBA )
|
||||||
|
*pARGB++ = D3DCOLOR_ARGB( a, r, g, b );
|
||||||
|
else if ( eTextureFormat == eTextureFormat_BGRA)
|
||||||
|
*pARGB++ = D3DCOLOR_ARGB( a, b, g, r );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (iter->second.m_eFormat == D3DFMT_A16B16G16R16)
|
||||||
|
{
|
||||||
|
uint16 *pDest = (uint16 *)rect.pBits;
|
||||||
|
uint16 *pSrc = (uint16 *)pRGBAData;
|
||||||
|
|
||||||
|
if ( eTextureFormat != eTextureFormat_BGRA16 )
|
||||||
|
OutputDebugString( "Unsupported texture format for BGRA16 texture \n" );
|
||||||
|
|
||||||
|
memcpy( pDest, pSrc, sizeof( uint16 )* uWidth * uHeight * 4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
hRes = iter->second.m_pTexture->UnlockRect( 0 );
|
||||||
|
if (FAILED( hRes ))
|
||||||
|
{
|
||||||
|
OutputDebugString( "UnlockRect call failed\n" );
|
||||||
|
iter->second.m_pTexture->Release();
|
||||||
|
iter->second.m_pTexture = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CGameEngineWin32::BReadyTexture( HGAMETEXTURE hTexture )
|
bool CGameEngineWin32::BReadyTexture( HGAMETEXTURE hTexture )
|
||||||
{
|
{
|
||||||
std::map<HGAMETEXTURE, TextureData_t>::iterator iter;
|
std::map<HGAMETEXTURE, TextureData_t>::iterator iter;
|
||||||
@@ -2215,7 +2293,7 @@ bool CGameEngineWin32::BReadyTexture( HGAMETEXTURE hTexture )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( iter->second.m_eFormat == D3DFMT_A8B8G8R8 )
|
if ( iter->second.m_eFormat == D3DFMT_A8R8G8B8 )
|
||||||
{
|
{
|
||||||
DWORD *pARGB = (DWORD *)rect.pBits;
|
DWORD *pARGB = (DWORD *)rect.pBits;
|
||||||
byte *pRGBA = (byte *)iter->second.m_pRGBAData;
|
byte *pRGBA = (byte *)iter->second.m_pRGBAData;
|
||||||
@@ -2231,7 +2309,10 @@ bool CGameEngineWin32::BReadyTexture( HGAMETEXTURE hTexture )
|
|||||||
b = *pRGBA++;
|
b = *pRGBA++;
|
||||||
a = *pRGBA++;
|
a = *pRGBA++;
|
||||||
|
|
||||||
*pARGB++ = D3DCOLOR_ARGB( a, r, g, b );
|
if ( iter->second.m_eTextureFormat == eTextureFormat_RGBA )
|
||||||
|
*pARGB++ = D3DCOLOR_ARGB( a, r, g, b );
|
||||||
|
else
|
||||||
|
*pARGB++ = D3DCOLOR_ARGB( a, b, g, r );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2239,6 +2320,9 @@ bool CGameEngineWin32::BReadyTexture( HGAMETEXTURE hTexture )
|
|||||||
{
|
{
|
||||||
uint16 *pDest = (uint16 *)rect.pBits;
|
uint16 *pDest = (uint16 *)rect.pBits;
|
||||||
uint16 *pSrc = (uint16 *)iter->second.m_pRGBAData;
|
uint16 *pSrc = (uint16 *)iter->second.m_pRGBAData;
|
||||||
|
|
||||||
|
if ( iter->second.m_eTextureFormat != eTextureFormat_BGRA16 )
|
||||||
|
OutputDebugString( "Unsupported texture format for BGRA16 texture \n" );
|
||||||
|
|
||||||
memcpy( pDest, pSrc, sizeof(uint16)* iter->second.m_uWidth * iter->second.m_uHeight * 4 );
|
memcpy( pDest, pSrc, sizeof(uint16)* iter->second.m_uWidth * iter->second.m_uHeight * 4 );
|
||||||
}
|
}
|
||||||
@@ -2515,7 +2599,7 @@ bool CGameEngineWin32::BInitializeVRShader()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hVRDistortionMap[i] = HCreateTextureInternal( (byte *)pData, nDistSize, nDistSize, D3DFMT_A16B16G16R16 );
|
m_hVRDistortionMap[i] = HCreateTexture( (byte *)pData, nDistSize, nDistSize, eTextureFormat_BGRA16 );
|
||||||
free( pData );
|
free( pData );
|
||||||
if ( !m_hVRDistortionMap[i] )
|
if ( !m_hVRDistortionMap[i] )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,7 +127,10 @@ public:
|
|||||||
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
|
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
|
||||||
|
|
||||||
// Create a new texture returning our internal handle value for it (0 means failure)
|
// Create a new texture returning our internal handle value for it (0 means failure)
|
||||||
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight );
|
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat = eTextureFormat_RGBA );
|
||||||
|
|
||||||
|
// update an existing texture
|
||||||
|
bool UpdateTexture( HGAMETEXTURE texture, byte *pRGBAData, uint32 uWidth, uint32 uHeight, ETEXTUREFORMAT eTextureFormat );
|
||||||
|
|
||||||
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
|
||||||
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
|
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
|
||||||
@@ -203,9 +206,6 @@ public:
|
|||||||
void RecordKeyUp( DWORD dwVK );
|
void RecordKeyUp( DWORD dwVK );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Create a new texture returning our internal handle value for it (0 means failure)
|
|
||||||
HGAMETEXTURE HCreateTextureInternal( byte *pRGBAData, uint32 uWidth, uint32 uHeight, D3DFORMAT eFormat );
|
|
||||||
|
|
||||||
|
|
||||||
// Creates the hwnd for the game
|
// Creates the hwnd for the game
|
||||||
bool BCreateGameWindow( int nShowCommand );
|
bool BCreateGameWindow( int nShowCommand );
|
||||||
@@ -309,7 +309,8 @@ private:
|
|||||||
uint32 m_uHeight;
|
uint32 m_uHeight;
|
||||||
LPDIRECT3DTEXTURE9 m_pTexture;
|
LPDIRECT3DTEXTURE9 m_pTexture;
|
||||||
LPDIRECT3DSURFACE9 m_pDepthSurface; // render targets only
|
LPDIRECT3DSURFACE9 m_pDepthSurface; // render targets only
|
||||||
D3DFORMAT m_eFormat;
|
D3DFORMAT m_eFormat; // format for the texture on the card itself
|
||||||
|
ETEXTUREFORMAT m_eTextureFormat; // format of the data you provide
|
||||||
};
|
};
|
||||||
std::map<HGAMETEXTURE, TextureData_t> m_MapTextures;
|
std::map<HGAMETEXTURE, TextureData_t> m_MapTextures;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
|
||||||
|
//
|
||||||
|
// Purpose: Class to render a HTML page on the screen
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "htmlsurface.h"
|
||||||
|
#include "SpaceWarClient.h"
|
||||||
|
|
||||||
|
#define HTML_TEXT_HEIGHT 20
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Constructor
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
CHTMLSurface::CHTMLSurface( IGameEngine *pGameEngine ) :
|
||||||
|
m_CloseBrowser( this, &CHTMLSurface::OnCloseBrowser ),
|
||||||
|
m_NeedsPaint( this, &CHTMLSurface::OnNeedsPaint ),
|
||||||
|
m_StartRequest( this, &CHTMLSurface::OnStartRequest ),
|
||||||
|
m_FinishedRequest( this, &CHTMLSurface::OnFinishedRequest )
|
||||||
|
{
|
||||||
|
m_pGameEngine = pGameEngine;
|
||||||
|
m_unBrowserHandle = INVALID_HTTMLBROWSER;
|
||||||
|
m_hHTMLTexture = -1;
|
||||||
|
|
||||||
|
m_unHTMLWide = m_pGameEngine->GetViewportWidth() - 100;
|
||||||
|
m_unHTMLTall = m_pGameEngine->GetViewportHeight() - 100;
|
||||||
|
|
||||||
|
SteamHTMLSurface()->Init();
|
||||||
|
SteamHTMLSurface()->SetSize( m_unBrowserHandle, m_unHTMLWide, m_unHTMLTall );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Destructor
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
CHTMLSurface::~CHTMLSurface()
|
||||||
|
{
|
||||||
|
if ( m_unBrowserHandle )
|
||||||
|
SteamHTMLSurface()->RemoveBrowser( m_unBrowserHandle );
|
||||||
|
m_unBrowserHandle = INVALID_HTTMLBROWSER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: RunFrame
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::RunFrame()
|
||||||
|
{
|
||||||
|
if ( m_pGameEngine->BIsKeyDown( VK_ESCAPE ) )
|
||||||
|
{
|
||||||
|
SpaceWarClient()->SetGameState( k_EClientGameMenu );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: draw the page
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::Render()
|
||||||
|
{
|
||||||
|
if (m_hHTMLTexture >= 0)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
rect.left = 50;
|
||||||
|
rect.top = 50;
|
||||||
|
rect.right = m_unHTMLWide + rect.left;
|
||||||
|
rect.bottom = m_unHTMLTall + rect.top;
|
||||||
|
|
||||||
|
m_pGameEngine->BDrawTexturedQuad( (float)rect.left, (float)rect.top, (float)rect.right, (float)rect.bottom,
|
||||||
|
0.0f, 0.0f, 1.0, 1.0, D3DCOLOR_ARGB( 255, 255, 255, 255 ), m_hHTMLTexture );
|
||||||
|
}
|
||||||
|
|
||||||
|
RECT rect;
|
||||||
|
rect.top = m_unHTMLTall + 70;
|
||||||
|
rect.bottom = rect.top + HTML_TEXT_HEIGHT;
|
||||||
|
rect.left = m_unHTMLWide/2 - 200;
|
||||||
|
rect.right = rect.left + 400;
|
||||||
|
|
||||||
|
char rgchBuffer[256];
|
||||||
|
sprintf_safe( rgchBuffer, "Hit ESC to return to main menu" );
|
||||||
|
m_pGameEngine->BDrawString( m_hDisplayFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_CENTER | TEXTPOS_VCENTER, rgchBuffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::Show()
|
||||||
|
{
|
||||||
|
m_hDisplayFont = m_pGameEngine->HCreateFont(HTML_TEXT_HEIGHT, FW_MEDIUM, false, "Arial");
|
||||||
|
if (!m_hDisplayFont)
|
||||||
|
OutputDebugString("RemoteStorage font was not created properly, text won't draw\n");
|
||||||
|
|
||||||
|
SteamAPICall_t hSteamAPICall = SteamHTMLSurface()->CreateBrowser( "SpaceWars Test", NULL );
|
||||||
|
m_SteamCallResultBrowserReady.Set( hSteamAPICall, this, &CHTMLSurface::OnBrowserReady );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the page asked to be closed
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::OnCloseBrowser( HTML_CloseBrowser_t *pParam )
|
||||||
|
{
|
||||||
|
m_unBrowserHandle = INVALID_HTTMLBROWSER;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the browser is ready to load pages and start sending us textures to render
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::OnBrowserReady( HTML_BrowserReady_t *pBrowserReady, bool bIOFailure )
|
||||||
|
{
|
||||||
|
if (bIOFailure)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_unBrowserHandle = pBrowserReady->unBrowserHandle;
|
||||||
|
SteamHTMLSurface()->SetSize( m_unBrowserHandle, m_unHTMLWide, m_unHTMLWide );
|
||||||
|
SteamHTMLSurface()->LoadURL( m_unBrowserHandle, "http://steamcommunity.com/", NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: we have a new texture to present
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::OnNeedsPaint( HTML_NeedsPaint_t *pParam )
|
||||||
|
{
|
||||||
|
if ( m_hHTMLTexture < 0 )
|
||||||
|
m_hHTMLTexture = m_pGameEngine->HCreateTexture( (byte *)pParam->pBGRA, pParam->unWide, pParam->unTall, eTextureFormat_BGRA );
|
||||||
|
else
|
||||||
|
m_pGameEngine->UpdateTexture( m_hHTMLTexture, (byte *)pParam->pBGRA, pParam->unWide, pParam->unTall, eTextureFormat_BGRA );
|
||||||
|
|
||||||
|
if (pParam->unWide != m_unHTMLWide)
|
||||||
|
OutputDebugString( "bad texture width for html\n" );
|
||||||
|
if (pParam->unTall != m_unHTMLTall)
|
||||||
|
OutputDebugString( "bad texture height for html\n" );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the page requested that a URL be loaded, should we allow it?
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::OnStartRequest( HTML_StartRequest_t *pParam )
|
||||||
|
{
|
||||||
|
SteamHTMLSurface()->AllowStartRequest( m_unBrowserHandle, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: the page is now fully loaded
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void CHTMLSurface::OnFinishedRequest( HTML_FinishedRequest_t *pParam )
|
||||||
|
{
|
||||||
|
// Uncomment this if you want to scale a pages contents when you display it
|
||||||
|
//SteamHTMLSurface()->SetPageScaleFactor( m_unBrowserHandle, 2.0, 0, 0 );
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
|
||||||
|
//
|
||||||
|
// Purpose: Class for handling finding servers, getting their details, and displaying
|
||||||
|
// them inside the game
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
#ifndef HTMLSURFACE_H
|
||||||
|
#define HTMLSURFACE_H
|
||||||
|
|
||||||
|
#include "SpaceWar.h"
|
||||||
|
#include "GameEngine.h"
|
||||||
|
#include "steam/steam_api.h"
|
||||||
|
#include "steam/isteamhtmlsurface.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CHTMLSurface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHTMLSurface( IGameEngine *pGameEngine );
|
||||||
|
~CHTMLSurface();
|
||||||
|
|
||||||
|
// Run a frame (to handle kb input and such as well as render)
|
||||||
|
void RunFrame();
|
||||||
|
|
||||||
|
void Render();
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
|
||||||
|
private:
|
||||||
|
STEAM_CALLBACK( CHTMLSurface, OnCloseBrowser, HTML_CloseBrowser_t, m_CloseBrowser );
|
||||||
|
STEAM_CALLBACK( CHTMLSurface, OnNeedsPaint, HTML_NeedsPaint_t, m_NeedsPaint );
|
||||||
|
STEAM_CALLBACK( CHTMLSurface, OnStartRequest, HTML_StartRequest_t, m_StartRequest );
|
||||||
|
STEAM_CALLBACK( CHTMLSurface, OnFinishedRequest, HTML_FinishedRequest_t, m_FinishedRequest );
|
||||||
|
|
||||||
|
void OnBrowserReady( HTML_BrowserReady_t *pBrowserReady, bool bIOFailure );
|
||||||
|
CCallResult< CHTMLSurface, HTML_BrowserReady_t > m_SteamCallResultBrowserReady;
|
||||||
|
|
||||||
|
|
||||||
|
// Pointer to engine instance (so we can draw stuff)
|
||||||
|
IGameEngine *m_pGameEngine;
|
||||||
|
|
||||||
|
HGAMEFONT m_hDisplayFont;
|
||||||
|
|
||||||
|
HHTMLBrowser m_unBrowserHandle; // handle to the html surface object
|
||||||
|
HGAMETEXTURE m_hHTMLTexture; // the texture data for the page
|
||||||
|
|
||||||
|
uint32 m_unHTMLWide; // the size of the html page we want to show
|
||||||
|
uint32 m_unHTMLTall;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //HTMLSURFACE_H
|
||||||
@@ -193,6 +193,8 @@ bool CSteamVRGLHelper::BInitPredistortRenderTarget()
|
|||||||
// Set the list of draw buffers.
|
// Set the list of draw buffers.
|
||||||
GLenum rDrawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
|
GLenum rDrawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
|
||||||
glDrawBuffers(ARRAYSIZE( rDrawBuffers ), rDrawBuffers);
|
glDrawBuffers(ARRAYSIZE( rDrawBuffers ), rDrawBuffers);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
50E77DF51362190C000FC072 /* glmgrext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DE61362190C000FC072 /* glmgrext.cpp */; };
|
50E77DF51362190C000FC072 /* glmgrext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DE61362190C000FC072 /* glmgrext.cpp */; };
|
||||||
50E77DF61362190C000FC072 /* mathlite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DE91362190C000FC072 /* mathlite.cpp */; };
|
50E77DF61362190C000FC072 /* mathlite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DE91362190C000FC072 /* mathlite.cpp */; };
|
||||||
50E77DF813621991000FC072 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E77DF713621991000FC072 /* IOKit.framework */; };
|
50E77DF813621991000FC072 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E77DF713621991000FC072 /* IOKit.framework */; };
|
||||||
|
840B387019BB91C50084B9F1 /* htmlsurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840B386E19BB91C50084B9F1 /* htmlsurface.cpp */; };
|
||||||
F803305119087F9200344590 /* musicplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F803305019087F9200344590 /* musicplayer.cpp */; };
|
F803305119087F9200344590 /* musicplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F803305019087F9200344590 /* musicplayer.cpp */; };
|
||||||
F80330831908872600344590 /* controller.vdf in Resources */ = {isa = PBXBuildFile; fileRef = F80330821908872600344590 /* controller.vdf */; };
|
F80330831908872600344590 /* controller.vdf in Resources */ = {isa = PBXBuildFile; fileRef = F80330821908872600344590 /* controller.vdf */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
@@ -155,6 +156,8 @@
|
|||||||
50E77DE91362190C000FC072 /* mathlite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlite.cpp; path = ../glmgr/mathlite.cpp; sourceTree = "<group>"; };
|
50E77DE91362190C000FC072 /* mathlite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlite.cpp; path = ../glmgr/mathlite.cpp; sourceTree = "<group>"; };
|
||||||
50E77DEA1362190C000FC072 /* mathlite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlite.h; path = ../glmgr/mathlite.h; sourceTree = "<group>"; };
|
50E77DEA1362190C000FC072 /* mathlite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlite.h; path = ../glmgr/mathlite.h; sourceTree = "<group>"; };
|
||||||
50E77DF713621991000FC072 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
50E77DF713621991000FC072 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||||
|
840B386E19BB91C50084B9F1 /* htmlsurface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = htmlsurface.cpp; sourceTree = "<group>"; };
|
||||||
|
840B386F19BB91C50084B9F1 /* htmlsurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htmlsurface.h; sourceTree = "<group>"; };
|
||||||
F803304F19087DA600344590 /* musicplayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = musicplayer.h; sourceTree = "<group>"; };
|
F803304F19087DA600344590 /* musicplayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = musicplayer.h; sourceTree = "<group>"; };
|
||||||
F803305019087F9200344590 /* musicplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = musicplayer.cpp; sourceTree = "<group>"; };
|
F803305019087F9200344590 /* musicplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = musicplayer.cpp; sourceTree = "<group>"; };
|
||||||
F80330821908872600344590 /* controller.vdf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = controller.vdf; sourceTree = "<group>"; };
|
F80330821908872600344590 /* controller.vdf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = controller.vdf; sourceTree = "<group>"; };
|
||||||
@@ -191,6 +194,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
50E77DCF136218F5000FC072 /* glmgr */,
|
50E77DCF136218F5000FC072 /* glmgr */,
|
||||||
|
840B386E19BB91C50084B9F1 /* htmlsurface.cpp */,
|
||||||
503C6CED1268F49F00B66E3B /* p2pauth.cpp */,
|
503C6CED1268F49F00B66E3B /* p2pauth.cpp */,
|
||||||
503C6CEF1268F49F00B66E3B /* PhotonBeam.cpp */,
|
503C6CEF1268F49F00B66E3B /* PhotonBeam.cpp */,
|
||||||
503C6CF11268F49F00B66E3B /* QuitMenu.cpp */,
|
503C6CF11268F49F00B66E3B /* QuitMenu.cpp */,
|
||||||
@@ -253,6 +257,7 @@
|
|||||||
503C6D291268F4EE00B66E3B /* Headers */ = {
|
503C6D291268F4EE00B66E3B /* Headers */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
840B386F19BB91C50084B9F1 /* htmlsurface.h */,
|
||||||
50D642861461EF3200A5739B /* clanchatroom.h */,
|
50D642861461EF3200A5739B /* clanchatroom.h */,
|
||||||
503C6CEE1268F49F00B66E3B /* p2pauth.h */,
|
503C6CEE1268F49F00B66E3B /* p2pauth.h */,
|
||||||
503C6CF01268F49F00B66E3B /* PhotonBeam.h */,
|
503C6CF01268F49F00B66E3B /* PhotonBeam.h */,
|
||||||
@@ -380,6 +385,7 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
840B387019BB91C50084B9F1 /* htmlsurface.cpp in Sources */,
|
||||||
503C6D0F1268F49F00B66E3B /* BaseMenu.cpp in Sources */,
|
503C6D0F1268F49F00B66E3B /* BaseMenu.cpp in Sources */,
|
||||||
503C6D101268F49F00B66E3B /* connectingmenu.cpp in Sources */,
|
503C6D101268F49F00B66E3B /* connectingmenu.cpp in Sources */,
|
||||||
F803305119087F9200344590 /* musicplayer.cpp in Sources */,
|
F803305119087F9200344590 /* musicplayer.cpp in Sources */,
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
builder\steamcmd.exe +login account password +run_app_build ..\scripts\app_build_1000.vdf +quit
|
builder\steamcmd.exe +login account password +run_app_build_http ..\scripts\app_build_1000.vdf +quit
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user