mirror of
https://github.com/rlabrecque/SteamworksSDK.git
synced 2026-10-10 01:23:04 +08:00
v1.33
This commit is contained in:
+17
@@ -11,6 +11,23 @@ website at: http://partner.steamgames.com
|
||||
|
||||
Revision History:
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.33 6th May 2015
|
||||
----------------------------------------------------------------
|
||||
|
||||
UGC:
|
||||
* Added DownloadItem(), which will force download a piece of UGC (it will be cached based on usage). This can be used by stand-alone game servers.
|
||||
* Renamed GetItemUpdateInfo() => GetItemDownloadInfo() and added GetItemState() which can be used to determine whether an item is currently being downloaded, has already been downloaded, etc.
|
||||
* Added ability to set and retrieve developer metadata for an item
|
||||
* Added ability to modify a user's favorites list
|
||||
* Added ability to retrieve preview image & video URLs
|
||||
* Added ability to retrieve "children" for an item (e.g. for collections)
|
||||
* Added ability to retrieve stats, such as current number of subscribers, lifetime unique subscribers, etc.
|
||||
|
||||
|
||||
SteamVR
|
||||
* steamvr.h has been removed. You can use the OpenVR SDK to access those interfaces: https://github.com/ValveSoftware/openvr
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.32 5th February 2015
|
||||
|
||||
@@ -46,7 +46,7 @@ enum ETEXTUREFORMAT
|
||||
};
|
||||
|
||||
// used for VR support
|
||||
namespace vr { class IHmd; }
|
||||
namespace vr { class IVRSystem; }
|
||||
|
||||
//
|
||||
// Interface that needs to be implemented for game engines on all platforms
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
extern IGameEngine *CreateGameEngineOSX();
|
||||
#elif defined(SDL)
|
||||
#include "GameEngine.h"
|
||||
extern IGameEngine *CreateGameEngineSDL( bool bUseVR );
|
||||
extern IGameEngine *CreateGameEngineSDL( );
|
||||
#endif
|
||||
|
||||
#include "SpaceWarClient.h"
|
||||
@@ -78,7 +78,7 @@ extern "C" void __cdecl SteamAPIDebugTextHook( int nSeverity, const char *pchDeb
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Extracts some feature from the command line
|
||||
//-----------------------------------------------------------------------------
|
||||
void ParseCommandLine( const char *pchCmdLine, const char **ppchServerAddress, const char **ppchLobbyID, bool *pbUseVR )
|
||||
void ParseCommandLine( const char *pchCmdLine, const char **ppchServerAddress, const char **ppchLobbyID )
|
||||
{
|
||||
// Look for the +connect ipaddress:port parameter in the command line,
|
||||
// Steam will pass this when a user has used the Steam Server browser to find
|
||||
@@ -103,11 +103,6 @@ void ParseCommandLine( const char *pchCmdLine, const char **ppchServerAddress, c
|
||||
*ppchLobbyID = pchCmdLine + ( pchConnectLobby - pchCmdLine ) + strlen( pchConnectLobbyParam ) + 1;
|
||||
}
|
||||
|
||||
// look for -vr on command line. Switch to VR mode if it's thre
|
||||
const char *pchVRParam = "-vr";
|
||||
const char *pchVR = strstr( pchCmdLine, pchVRParam );
|
||||
if ( pchVR )
|
||||
*pbUseVR = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,24 +234,21 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow )
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
bool bUseVR = SteamUtils()->IsSteamRunningInVR();
|
||||
const char *pchServerAddress, *pchLobbyID;
|
||||
ParseCommandLine( pchCmdLine, &pchServerAddress, &pchLobbyID, &bUseVR );
|
||||
ParseCommandLine( pchCmdLine, &pchServerAddress, &pchLobbyID );
|
||||
|
||||
// do a DRM self check
|
||||
Steamworks_SelfCheck();
|
||||
|
||||
// init VR before we make the window
|
||||
|
||||
// Construct a new instance of the game engine
|
||||
// bugbug jmccaskey - make screen resolution dynamic, maybe take it on command line?
|
||||
IGameEngine *pGameEngine =
|
||||
#if defined(_WIN32)
|
||||
new CGameEngineWin32( hInstance, nCmdShow, 1024, 768, bUseVR );
|
||||
new CGameEngineWin32( hInstance, nCmdShow, 1024, 768 );
|
||||
#elif defined(OSX)
|
||||
CreateGameEngineOSX();
|
||||
#elif defined(SDL)
|
||||
CreateGameEngineSDL( bUseVR );
|
||||
CreateGameEngineSDL( );
|
||||
#else
|
||||
#error Need CreateGameEngine()
|
||||
#endif
|
||||
|
||||
@@ -792,9 +792,8 @@ void CSpaceWarClient::OnGameJoinRequested( GameRichPresenceJoinRequested_t *pCal
|
||||
{
|
||||
// parse out the connect
|
||||
const char *pchServerAddress, *pchLobbyID;
|
||||
bool bUseVR = false;
|
||||
extern void ParseCommandLine( const char *pchCmdLine, const char **ppchServerAddress, const char **ppchLobbyID, bool *pbUseVR );
|
||||
ParseCommandLine( pCallback->m_rgchConnect, &pchServerAddress, &pchLobbyID, &bUseVR );
|
||||
extern void ParseCommandLine( const char *pchCmdLine, const char **ppchServerAddress, const char **ppchLobbyID );
|
||||
ParseCommandLine( pCallback->m_rgchConnect, &pchServerAddress, &pchLobbyID );
|
||||
|
||||
// exec
|
||||
ExecCommandLineConnect( pchServerAddress, pchLobbyID );
|
||||
@@ -2175,14 +2174,20 @@ bool CSpaceWarClient::LoadWorkshopItem( PublishedFileId_t workshopItemID )
|
||||
if ( m_nNumWorkshopItems == MAX_WORKSHOP_ITEMS )
|
||||
return false; // too much
|
||||
|
||||
uint32 unItemState = SteamUGC()->GetItemState( workshopItemID );
|
||||
|
||||
if ( !(unItemState & k_EItemStateInstalled) )
|
||||
return false;
|
||||
|
||||
uint32 unTimeStamp = 0;
|
||||
uint64 unSizeOnDisk = 0;
|
||||
char szItemFolder[1024] = { 0 };
|
||||
bool bLegacyItem = false;
|
||||
if ( !SteamUGC()->GetItemInstallInfo( workshopItemID, &unSizeOnDisk, szItemFolder, sizeof(szItemFolder), &bLegacyItem ) )
|
||||
|
||||
if ( !SteamUGC()->GetItemInstallInfo( workshopItemID, &unSizeOnDisk, szItemFolder, sizeof(szItemFolder), &unTimeStamp ) )
|
||||
return false;
|
||||
|
||||
char szFile[1024];
|
||||
if( bLegacyItem )
|
||||
if( unItemState & k_EItemStateLegacyItem )
|
||||
{
|
||||
// szItemFolder just points directly to the item for legacy items that were published with the RemoteStorage API.
|
||||
_snprintf( szFile, sizeof( szFile ), "%s", szItemFolder );
|
||||
|
||||
Binary file not shown.
@@ -2577,7 +2577,7 @@ HRESULT IDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurfa
|
||||
if ( !m_rtSurfaces[ RenderTargetIndex ] )
|
||||
return D3DERR_NOTFOUND;
|
||||
|
||||
if ( ( RenderTargetIndex < 0 ) || ( RenderTargetIndex > 4 ) || !ppRenderTarget )
|
||||
if ( ( RenderTargetIndex > 4 ) || !ppRenderTarget )
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// safe because of early exit on NULL above
|
||||
|
||||
@@ -529,7 +529,9 @@ GLMValueEntry_t g_d3d_vtxdeclusages_short[] =
|
||||
{ D3DDECLUSAGE_SAMPLE ,"M" }
|
||||
};
|
||||
|
||||
GLMValueEntry_t g_cgl_rendids[] = // need to mask with 0xFFFFFF00 to match on these (ex: 8800GT == 0x00022608
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
GLMValueEntry_t g_cgl_rendids[] = // need to mask with 0xFFFFFF00 to match on these (ex: 8800GT == 0x00022608
|
||||
{
|
||||
VE( kCGLRendererGenericID ),
|
||||
VE( kCGLRendererGenericFloatID ),
|
||||
@@ -551,6 +553,7 @@ GLMValueEntry_t g_cgl_rendids[] = // need to mask with 0xFFFFFF00 to match on
|
||||
|
||||
VE( TERMVALUE )
|
||||
};
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
GLMValueEntry_t g_gl_errors[] =
|
||||
{
|
||||
|
||||
+3
-1
@@ -19,7 +19,8 @@ PFNglGetFramebufferAttachmentParameteriv pfnglGetFramebufferAttachmentParameteri
|
||||
PFNglUniformBufferEXT pfnglUniformBufferEXT;
|
||||
|
||||
// NSSymbol was deprecated in 10.5.
|
||||
#pragma clang diagnostic warning "-Wdeprecated-declarations"
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
void * NSGLGetProcAddress (const char *name)
|
||||
{
|
||||
@@ -34,6 +35,7 @@ void * NSGLGetProcAddress (const char *name)
|
||||
return symbol ? NSAddressOfSymbol (symbol) : NULL;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
void GLMSetupExtensions( void )
|
||||
{
|
||||
|
||||
+2
-19
@@ -616,8 +616,6 @@ inline void VectorMultiply( const Vector& a, vec_t b, Vector& result );
|
||||
inline void VectorMultiply( const Vector& a, const Vector& b, Vector& result );
|
||||
inline void VectorDivide( const Vector& a, vec_t b, Vector& result );
|
||||
inline void VectorDivide( const Vector& a, const Vector& b, Vector& result );
|
||||
inline void VectorScale ( const Vector& in, vec_t scale, Vector& result );
|
||||
inline void VectorMA( const Vector& start, float scale, const Vector& direction, Vector& dest );
|
||||
|
||||
// Vector equality with tolerance
|
||||
bool VectorsAreEqual( const Vector& src1, const Vector& src2, float tolerance = 0.0f );
|
||||
@@ -1315,13 +1313,6 @@ inline void VectorMultiply( const Vector& a, const Vector& b, Vector& c )
|
||||
c.z = a.z * b.z;
|
||||
}
|
||||
|
||||
// for backwards compatability
|
||||
inline void VectorScale ( const Vector& in, vec_t scale, Vector& result )
|
||||
{
|
||||
VectorMultiply( in, scale, result );
|
||||
}
|
||||
|
||||
|
||||
inline void VectorDivide( const Vector& a, vec_t b, Vector& c )
|
||||
{
|
||||
CHECK_VALID(a);
|
||||
@@ -1544,7 +1535,8 @@ inline void ComputeClosestPoint( const Vector& vecStart, float flMaxDist, const
|
||||
else
|
||||
{
|
||||
vecDelta /= FastSqrt( flDistSqr );
|
||||
VectorMA( vecStart, flMaxDist, vecDelta, *pResult );
|
||||
vecDelta *= flMaxDist;
|
||||
VectorAdd( vecStart, vecDelta, *pResult );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2028,15 +2020,6 @@ inline void VectorCopy( RadianEuler const& src, RadianEuler &dst )
|
||||
dst.z = src.z;
|
||||
}
|
||||
|
||||
inline void VectorScale( RadianEuler const& src, float b, RadianEuler &dst )
|
||||
{
|
||||
CHECK_VALID(src);
|
||||
Assert( IsFinite(b) );
|
||||
dst.x = src.x * b;
|
||||
dst.y = src.y * b;
|
||||
dst.z = src.z * b;
|
||||
}
|
||||
|
||||
inline bool RadianEuler::IsValid() const
|
||||
{
|
||||
return IsFinite(x) && IsFinite(y) && IsFinite(z);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#endif
|
||||
|
||||
#include "isteamclient.h"
|
||||
#include "steamcontrollerpublic.h"
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
@@ -26,13 +25,61 @@
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#define STEAM_RIGHT_TRIGGER_MASK 0x0000001
|
||||
#define STEAM_LEFT_TRIGGER_MASK 0x0000002
|
||||
#define STEAM_RIGHT_BUMPER_MASK 0x0000004
|
||||
#define STEAM_LEFT_BUMPER_MASK 0x0000008
|
||||
#define STEAM_BUTTON_0_MASK 0x0000010
|
||||
#define STEAM_BUTTON_1_MASK 0x0000020
|
||||
#define STEAM_BUTTON_2_MASK 0x0000040
|
||||
#define STEAM_BUTTON_3_MASK 0x0000080
|
||||
#define STEAM_TOUCH_0_MASK 0x0000100
|
||||
#define STEAM_TOUCH_1_MASK 0x0000200
|
||||
#define STEAM_TOUCH_2_MASK 0x0000400
|
||||
#define STEAM_TOUCH_3_MASK 0x0000800
|
||||
#define STEAM_BUTTON_MENU_MASK 0x0001000
|
||||
#define STEAM_BUTTON_STEAM_MASK 0x0002000
|
||||
#define STEAM_BUTTON_ESCAPE_MASK 0x0004000
|
||||
#define STEAM_BUTTON_BACK_LEFT_MASK 0x0008000
|
||||
#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0010000
|
||||
#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0020000
|
||||
#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0040000
|
||||
#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0080000
|
||||
#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0100000
|
||||
#define STEAM_JOYSTICK_BUTTON_MASK 0x0400000
|
||||
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
struct SteamControllerState001_t
|
||||
{
|
||||
// If packet num matches that on your prior call, then the controller state hasn't been changed since
|
||||
// your last call and there is no need to process it
|
||||
uint32 unPacketNum;
|
||||
|
||||
// bit flags for each of the buttons
|
||||
uint64 ulButtons;
|
||||
|
||||
// Left pad coordinates
|
||||
short sLeftPadX;
|
||||
short sLeftPadY;
|
||||
|
||||
// Right pad coordinates
|
||||
short sRightPadX;
|
||||
short sRightPadY;
|
||||
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#define SteamControllerState_t SteamControllerState001_t
|
||||
|
||||
enum ESteamControllerPad
|
||||
{
|
||||
k_ESteamControllerPad_Left,
|
||||
k_ESteamControllerPad_Right
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Native Steam controller support API
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
enum EFriendRelationship
|
||||
{
|
||||
k_EFriendRelationshipNone = 0,
|
||||
k_EFriendRelationshipBlocked = 1,
|
||||
k_EFriendRelationshipBlocked = 1, // this doesn't get stored; the user has just done an Ignore on an friendship invite
|
||||
k_EFriendRelationshipRequestRecipient = 2,
|
||||
k_EFriendRelationshipFriend = 3,
|
||||
k_EFriendRelationshipRequestInitiator = 4,
|
||||
k_EFriendRelationshipIgnored = 5,
|
||||
k_EFriendRelationshipIgnored = 5, // this is stored; the user has explicit blocked this other user from comments/chat/etc
|
||||
k_EFriendRelationshipIgnoredFriend = 6,
|
||||
k_EFriendRelationshipSuggested = 7,
|
||||
|
||||
|
||||
@@ -374,56 +374,18 @@ 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( 0, HHTMLBrowser, unBrowserHandle ) // the handle of the current 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()
|
||||
CALLBACK_MEMBER( 6, HHTMLBrowser, unNewWindow_BrowserHandle ) // the handle of the new window surface
|
||||
END_DEFINE_CALLBACK_7()
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -28,8 +28,8 @@ class ISteamHTTP
|
||||
public:
|
||||
|
||||
// Initializes a new HTTP request, returning a handle to use in further operations on it. Requires
|
||||
// the method (GET or POST) and the absolute URL for the request. Only http requests (ie, not https) are
|
||||
// currently supported, so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/
|
||||
// the method (GET or POST) and the absolute URL for the request. Both http and https are supported,
|
||||
// so this string must start with http:// or https:// and should look like http://store.steampowered.com/app/250/
|
||||
// or such.
|
||||
virtual HTTPRequestHandle CreateHTTPRequest( EHTTPMethod eHTTPRequestMethod, const char *pchAbsoluteURL ) = 0;
|
||||
|
||||
@@ -168,6 +168,8 @@ struct HTTPRequestCompleted_t
|
||||
// Will be the HTTP status code value returned by the server, k_EHTTPStatusCode200OK is the normal
|
||||
// OK response, if you get something else you probably need to treat it as a failure.
|
||||
EHTTPStatusCode m_eStatusCode;
|
||||
|
||||
uint32 m_unBodySize; // Same as GetHTTPResponseBodySize()
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -102,8 +102,31 @@ enum EItemUpdateStatus
|
||||
k_EItemUpdateStatusCommittingChanges = 5 // The item update is committing all changes
|
||||
};
|
||||
|
||||
enum EItemState
|
||||
{
|
||||
k_EItemStateNone = 0, // item not tracked on client
|
||||
k_EItemStateSubscribed = 1, // current user is subscribed to this item. Not just cached.
|
||||
k_EItemStateLegacyItem = 2, // item was created with ISteamRemoteStorage
|
||||
k_EItemStateInstalled = 4, // item is installed and usable (but maybe out of date)
|
||||
k_EItemStateNeedsUpdate = 8, // items needs an update. Either because it's not installed yet or creator updated content
|
||||
k_EItemStateDownloading = 16, // item update is currently downloading
|
||||
k_EItemStateDownloadPending = 32, // DownloadItem() was called for this item, content isn't available until DownloadItemResult_t is fired
|
||||
};
|
||||
|
||||
enum EItemStatistic
|
||||
{
|
||||
k_EItemStatistic_NumSubscriptions = 0,
|
||||
k_EItemStatistic_NumFavorites = 1,
|
||||
k_EItemStatistic_NumFollowers = 2,
|
||||
k_EItemStatistic_NumUniqueSubscriptions = 3,
|
||||
k_EItemStatistic_NumUniqueFavorites = 4,
|
||||
k_EItemStatistic_NumUniqueFollowers = 5,
|
||||
k_EItemStatistic_NumUniqueWebsiteViews = 6,
|
||||
k_EItemStatistic_ReportScore = 7,
|
||||
};
|
||||
|
||||
const uint32 kNumUGCResultsPerPage = 50;
|
||||
const uint32 k_cchDeveloperMetadataMax = 5000;
|
||||
|
||||
// Details for a single published file/UGC
|
||||
struct SteamUGCDetails_t
|
||||
@@ -135,7 +158,8 @@ struct SteamUGCDetails_t
|
||||
uint32 m_unVotesUp; // number of votes up
|
||||
uint32 m_unVotesDown; // number of votes down
|
||||
float m_flScore; // calculated score
|
||||
uint32 m_unNumChildren; // if m_eFileType == k_EWorkshopFileTypeCollection, then this number will be the number of children contained within the collection
|
||||
// collection details
|
||||
uint32 m_unNumChildren;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -151,11 +175,20 @@ public:
|
||||
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
||||
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
|
||||
|
||||
// Query for the details of the given published file ids (this RequestUGCDetails call is deprecated and replaced with this)
|
||||
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
|
||||
// Send the query to Steam
|
||||
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
|
||||
|
||||
// Retrieve an individual result after receiving the callback for querying UGC
|
||||
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
|
||||
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, char *pchURL, uint32 cchURLSize ) = 0;
|
||||
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, char *pchMetadata, uint32 cchMetadatasize ) = 0;
|
||||
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
|
||||
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 *pStatValue ) = 0;
|
||||
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
|
||||
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, char *pchURLOrVideoID, uint32 cchURLSize, bool *pbIsImage ) = 0;
|
||||
|
||||
// Release the request to free up memory, after retrieving results
|
||||
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
|
||||
@@ -164,6 +197,9 @@ public:
|
||||
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
|
||||
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
|
||||
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
|
||||
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
|
||||
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
|
||||
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
@@ -175,7 +211,7 @@ public:
|
||||
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
|
||||
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
|
||||
|
||||
// Request full details for one piece of UGC
|
||||
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
|
||||
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
// Steam Workshop Creator API
|
||||
@@ -185,6 +221,7 @@ public:
|
||||
|
||||
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
|
||||
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
|
||||
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
|
||||
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
|
||||
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item
|
||||
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
|
||||
@@ -194,18 +231,30 @@ public:
|
||||
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
|
||||
|
||||
// Steam Workshop Consumer API
|
||||
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscript to this item, will be installed ASAP
|
||||
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
|
||||
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
|
||||
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
|
||||
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
|
||||
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
|
||||
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
|
||||
|
||||
// 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;
|
||||
// get EItemState flags about item on this client
|
||||
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
|
||||
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
|
||||
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
|
||||
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
|
||||
|
||||
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
|
||||
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
|
||||
|
||||
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
|
||||
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
|
||||
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
|
||||
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION003"
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION005"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Callback for querying UGC
|
||||
@@ -256,7 +305,7 @@ struct SubmitItemUpdateResult_t
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: a new Workshop item has been installed
|
||||
// Purpose: a Workshop item has been installed or updated
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ItemInstalled_t
|
||||
{
|
||||
@@ -266,6 +315,28 @@ struct ItemInstalled_t
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: result of DownloadItem(), existing item files can be accessed again
|
||||
//-----------------------------------------------------------------------------
|
||||
struct DownloadItemResult_t
|
||||
{
|
||||
enum { k_iCallback = k_iClientUGCCallbacks + 6 };
|
||||
AppId_t m_unAppID;
|
||||
PublishedFileId_t m_nPublishedFileId;
|
||||
EResult m_eResult;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: result of AddItemToFavorites() or RemoveItemFromFavorites()
|
||||
//-----------------------------------------------------------------------------
|
||||
struct UserFavoriteItemsListChanged_t
|
||||
{
|
||||
enum { k_iCallback = k_iClientUGCCallbacks + 7 };
|
||||
PublishedFileId_t m_nPublishedFileId;
|
||||
EResult m_eResult;
|
||||
bool m_bWasAddRequest;
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#endif // ISTEAMUGC_H
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Steam Video api
|
||||
// Purpose: Steam Video API
|
||||
//-----------------------------------------------------------------------------
|
||||
class ISteamVideo
|
||||
{
|
||||
@@ -33,11 +33,20 @@ public:
|
||||
|
||||
// Get a URL suitable for streaming the given Video app ID's video
|
||||
virtual void GetVideoURL( AppId_t unVideoAppID ) = 0;
|
||||
|
||||
|
||||
// returns true if user is uploading a live broadcast
|
||||
virtual bool IsBroadcasting( int *pnNumViewers ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMVIDEO_INTERFACE_VERSION "STEAMVIDEO_INTERFACE_V001"
|
||||
|
||||
DEFINE_CALLBACK( BroadcastUploadStart_t, k_iClientVideoCallbacks + 4 )
|
||||
END_DEFINE_CALLBACK_0()
|
||||
|
||||
DEFINE_CALLBACK( BroadcastUploadStop_t, k_iClientVideoCallbacks + 5 )
|
||||
CALLBACK_MEMBER( 0, EBroadcastUploadResult, m_eResult )
|
||||
END_DEFINE_CALLBACK_1()
|
||||
|
||||
DEFINE_CALLBACK( GetVideoURLResult_t, k_iClientVideoCallbacks + 11 )
|
||||
CALLBACK_MEMBER( 0, EResult, m_eResult )
|
||||
CALLBACK_MEMBER( 1, AppId_t, m_unVideoAppID )
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+782
-69
File diff suppressed because it is too large
Load Diff
@@ -459,17 +459,27 @@ S_API bool SteamAPI_ISteamUnifiedMessages_SendNotification(intptr_t instancePtr,
|
||||
S_API bool SteamAPI_ISteamController_Init(intptr_t instancePtr, const char * pchAbsolutePathToControllerConfigVDF);
|
||||
S_API bool SteamAPI_ISteamController_Shutdown(intptr_t instancePtr);
|
||||
S_API void SteamAPI_ISteamController_RunFrame(intptr_t instancePtr);
|
||||
S_API bool SteamAPI_ISteamController_GetControllerState(intptr_t instancePtr, uint32 unControllerIndex, struct SteamControllerState_t * pState);
|
||||
S_API bool SteamAPI_ISteamController_GetControllerState(intptr_t instancePtr, uint32 unControllerIndex, struct SteamControllerState001_t * pState);
|
||||
S_API void SteamAPI_ISteamController_TriggerHapticPulse(intptr_t instancePtr, uint32 unControllerIndex, ESteamControllerPad eTargetPad, unsigned short usDurationMicroSec);
|
||||
S_API void SteamAPI_ISteamController_SetOverrideMode(intptr_t instancePtr, const char * pchMode);
|
||||
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(intptr_t instancePtr, AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage);
|
||||
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(intptr_t instancePtr, EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage);
|
||||
S_API UGCQueryHandle_t SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(intptr_t instancePtr, PublishedFileId_t * pvecPublishedFileID, uint32 unNumPublishedFileIDs);
|
||||
S_API SteamAPICall_t SteamAPI_ISteamUGC_SendQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle);
|
||||
S_API bool SteamAPI_ISteamUGC_GetQueryUGCResult(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, struct SteamUGCDetails_t * pDetails);
|
||||
S_API bool SteamAPI_ISteamUGC_GetQueryUGCPreviewURL(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, char * pchURL, uint32 cchURLSize);
|
||||
S_API bool SteamAPI_ISteamUGC_GetQueryUGCMetadata(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, char * pchMetadata, uint32 cchMetadatasize);
|
||||
S_API bool SteamAPI_ISteamUGC_GetQueryUGCChildren(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, PublishedFileId_t * pvecPublishedFileID, uint32 cMaxEntries);
|
||||
S_API bool SteamAPI_ISteamUGC_GetQueryUGCStatistic(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint32 * pStatValue);
|
||||
S_API uint32 SteamAPI_ISteamUGC_GetQueryUGCNumAdditionalPreviews(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index);
|
||||
S_API bool SteamAPI_ISteamUGC_GetQueryUGCAdditionalPreview(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, char * pchURLOrVideoID, uint32 cchURLSize, bool * pbIsImage);
|
||||
S_API bool SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(intptr_t instancePtr, UGCQueryHandle_t handle);
|
||||
S_API bool SteamAPI_ISteamUGC_AddRequiredTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName);
|
||||
S_API bool SteamAPI_ISteamUGC_AddExcludedTag(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pTagName);
|
||||
S_API bool SteamAPI_ISteamUGC_SetReturnLongDescription(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnLongDescription);
|
||||
S_API bool SteamAPI_ISteamUGC_SetReturnMetadata(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnMetadata);
|
||||
S_API bool SteamAPI_ISteamUGC_SetReturnChildren(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnChildren);
|
||||
S_API bool SteamAPI_ISteamUGC_SetReturnAdditionalPreviews(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnAdditionalPreviews);
|
||||
S_API bool SteamAPI_ISteamUGC_SetReturnTotalOnly(intptr_t instancePtr, UGCQueryHandle_t handle, bool bReturnTotalOnly);
|
||||
S_API bool SteamAPI_ISteamUGC_SetAllowCachedResponse(intptr_t instancePtr, UGCQueryHandle_t handle, uint32 unMaxAgeSeconds);
|
||||
S_API bool SteamAPI_ISteamUGC_SetCloudFileNameFilter(intptr_t instancePtr, UGCQueryHandle_t handle, const char * pMatchCloudFileName);
|
||||
@@ -481,18 +491,23 @@ S_API SteamAPICall_t SteamAPI_ISteamUGC_CreateItem(intptr_t instancePtr, AppId_t
|
||||
S_API UGCUpdateHandle_t SteamAPI_ISteamUGC_StartItemUpdate(intptr_t instancePtr, AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemTitle(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchTitle);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemDescription(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchDescription);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemMetadata(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchMetaData);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemVisibility(intptr_t instancePtr, UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemTags(intptr_t instancePtr, UGCUpdateHandle_t updateHandle, const struct SteamParamStringArray_t * pTags);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemContent(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszContentFolder);
|
||||
S_API bool SteamAPI_ISteamUGC_SetItemPreview(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pszPreviewFile);
|
||||
S_API SteamAPICall_t SteamAPI_ISteamUGC_SubmitItemUpdate(intptr_t instancePtr, UGCUpdateHandle_t handle, const char * pchChangeNote);
|
||||
S_API EItemUpdateStatus SteamAPI_ISteamUGC_GetItemUpdateProgress(intptr_t instancePtr, UGCUpdateHandle_t handle, uint64 * punBytesProcessed, uint64 * punBytesTotal);
|
||||
S_API SteamAPICall_t SteamAPI_ISteamUGC_AddItemToFavorites(intptr_t instancePtr, AppId_t nAppId, PublishedFileId_t nPublishedFileID);
|
||||
S_API SteamAPICall_t SteamAPI_ISteamUGC_RemoveItemFromFavorites(intptr_t instancePtr, AppId_t nAppId, PublishedFileId_t nPublishedFileID);
|
||||
S_API SteamAPICall_t SteamAPI_ISteamUGC_SubscribeItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID);
|
||||
S_API SteamAPICall_t SteamAPI_ISteamUGC_UnsubscribeItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID);
|
||||
S_API uint32 SteamAPI_ISteamUGC_GetNumSubscribedItems(intptr_t instancePtr);
|
||||
S_API uint32 SteamAPI_ISteamUGC_GetSubscribedItems(intptr_t instancePtr, PublishedFileId_t * pvecPublishedFileID, uint32 cMaxEntries);
|
||||
S_API bool SteamAPI_ISteamUGC_GetItemInstallInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punSizeOnDisk, char * pchFolder, uint32 cchFolderSize, bool * pbLegacyItem);
|
||||
S_API bool SteamAPI_ISteamUGC_GetItemUpdateInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, bool * pbNeedsUpdate, bool * pbIsDownloading, uint64 * punBytesDownloaded, uint64 * punBytesTotal);
|
||||
S_API uint32 SteamAPI_ISteamUGC_GetItemState(intptr_t instancePtr, PublishedFileId_t nPublishedFileID);
|
||||
S_API bool SteamAPI_ISteamUGC_GetItemInstallInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punSizeOnDisk, char * pchFolder, uint32 cchFolderSize, uint32 * punTimeStamp);
|
||||
S_API bool SteamAPI_ISteamUGC_GetItemDownloadInfo(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, uint64 * punBytesDownloaded, uint64 * punBytesTotal);
|
||||
S_API bool SteamAPI_ISteamUGC_DownloadItem(intptr_t instancePtr, PublishedFileId_t nPublishedFileID, bool bHighPriority);
|
||||
S_API uint32 SteamAPI_ISteamAppList_GetNumInstalledApps(intptr_t instancePtr);
|
||||
S_API uint32 SteamAPI_ISteamAppList_GetInstalledApps(intptr_t instancePtr, AppId_t * pvecAppID, uint32 unMaxAppIDs);
|
||||
S_API int SteamAPI_ISteamAppList_GetAppName(intptr_t instancePtr, AppId_t nAppID, char * pchName, int cchNameMax);
|
||||
@@ -556,24 +571,69 @@ S_API bool SteamAPI_ISteamInventory_LoadItemDefinitions(intptr_t instancePtr);
|
||||
S_API bool SteamAPI_ISteamInventory_GetItemDefinitionIDs(intptr_t instancePtr, SteamItemDef_t * pItemDefIDs, uint32 * punItemDefIDsArraySize);
|
||||
S_API bool SteamAPI_ISteamInventory_GetItemDefinitionProperty(intptr_t instancePtr, SteamItemDef_t iDefinition, const char * pchPropertyName, char * pchValueBuffer, uint32 * punValueBufferSize);
|
||||
S_API void SteamAPI_ISteamVideo_GetVideoURL(intptr_t instancePtr, AppId_t unVideoAppID);
|
||||
S_API void SteamAPI_vr_IHmd_GetWindowBounds(intptr_t instancePtr, int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API void SteamAPI_vr_IHmd_GetRecommendedRenderTargetSize(intptr_t instancePtr, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API void SteamAPI_vr_IHmd_GetEyeOutputViewport(intptr_t instancePtr, vr::Hmd_Eye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API struct vr::HmdMatrix44_t SteamAPI_vr_IHmd_GetProjectionMatrix(intptr_t instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType);
|
||||
S_API void SteamAPI_vr_IHmd_GetProjectionRaw(intptr_t instancePtr, vr::Hmd_Eye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom);
|
||||
S_API struct vr::DistortionCoordinates_t SteamAPI_vr_IHmd_ComputeDistortion(intptr_t instancePtr, vr::Hmd_Eye eEye, float fU, float fV);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_vr_IHmd_GetHeadFromEyePose(intptr_t instancePtr, vr::Hmd_Eye eEye);
|
||||
S_API bool SteamAPI_vr_IHmd_GetViewMatrix(intptr_t instancePtr, float fSecondsFromNow, struct vr::HmdMatrix44_t * pMatLeftView, struct vr::HmdMatrix44_t * pMatRightView, vr::HmdTrackingResult * peResult);
|
||||
S_API int32_t SteamAPI_vr_IHmd_GetD3D9AdapterIndex(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IHmd_GetDXGIOutputInfo(intptr_t instancePtr, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex);
|
||||
S_API void SteamAPI_vr_IHmd_AttachToWindow(intptr_t instancePtr, void * hWnd);
|
||||
S_API bool SteamAPI_vr_IHmd_GetTrackerFromHeadPose(intptr_t instancePtr, float fPredictedSecondsFromNow, struct vr::HmdMatrix34_t * pmPose, vr::HmdTrackingResult * peResult);
|
||||
S_API bool SteamAPI_vr_IHmd_GetLastTrackerFromHeadPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmPose);
|
||||
S_API bool SteamAPI_vr_IHmd_WillDriftInYaw(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IHmd_ZeroTracker(intptr_t instancePtr);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_vr_IHmd_GetTrackerZeroPose(intptr_t instancePtr);
|
||||
S_API uint32_t SteamAPI_vr_IHmd_GetDriverId(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API uint32_t SteamAPI_vr_IHmd_GetDisplayId(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API bool SteamAPI_ISteamVideo_IsBroadcasting(intptr_t instancePtr, int * pnNumViewers);
|
||||
S_API void SteamAPI_vr_IVRSystem_GetWindowBounds(intptr_t instancePtr, int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API void SteamAPI_vr_IVRSystem_GetRecommendedRenderTargetSize(intptr_t instancePtr, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API void SteamAPI_vr_IVRSystem_GetEyeOutputViewport(intptr_t instancePtr, vr::Hmd_Eye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API struct vr::HmdMatrix44_t SteamAPI_vr_IVRSystem_GetProjectionMatrix(intptr_t instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType);
|
||||
S_API void SteamAPI_vr_IVRSystem_GetProjectionRaw(intptr_t instancePtr, vr::Hmd_Eye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom);
|
||||
S_API struct vr::DistortionCoordinates_t SteamAPI_vr_IVRSystem_ComputeDistortion(intptr_t instancePtr, vr::Hmd_Eye eEye, float fU, float fV);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_vr_IVRSystem_GetEyeToHeadTransform(intptr_t instancePtr, vr::Hmd_Eye eEye);
|
||||
S_API bool SteamAPI_vr_IVRSystem_GetTimeSinceLastVsync(intptr_t instancePtr, float * pfSecondsSinceLastVsync, uint64_t * pulFrameCounter);
|
||||
S_API int32_t SteamAPI_vr_IVRSystem_GetD3D9AdapterIndex(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRSystem_GetDXGIOutputInfo(intptr_t instancePtr, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex);
|
||||
S_API void SteamAPI_vr_IVRSystem_AttachToWindow(intptr_t instancePtr, void * hWnd);
|
||||
S_API void SteamAPI_vr_IVRSystem_GetDeviceToAbsoluteTrackingPose(intptr_t instancePtr, vr::TrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, struct vr::TrackedDevicePose_t * pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount);
|
||||
S_API void SteamAPI_vr_IVRSystem_ResetSeatedZeroPose(intptr_t instancePtr);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_vr_IVRSystem_GetSeatedZeroPoseToStandingAbsoluteTrackingPose(intptr_t instancePtr);
|
||||
S_API bool SteamAPI_vr_IVRSystem_LoadRenderModel(intptr_t instancePtr, const char * pchRenderModelName, struct vr::RenderModel_t * pRenderModel);
|
||||
S_API void SteamAPI_vr_IVRSystem_FreeRenderModel(intptr_t instancePtr, struct vr::RenderModel_t * pRenderModel);
|
||||
S_API vr::TrackedDeviceClass SteamAPI_vr_IVRSystem_GetTrackedDeviceClass(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex);
|
||||
S_API bool SteamAPI_vr_IVRSystem_IsTrackedDeviceConnected(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex);
|
||||
S_API bool SteamAPI_vr_IVRSystem_GetBoolTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
|
||||
S_API float SteamAPI_vr_IVRSystem_GetFloatTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
|
||||
S_API int32_t SteamAPI_vr_IVRSystem_GetInt32TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
|
||||
S_API uint64_t SteamAPI_vr_IVRSystem_GetUint64TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_vr_IVRSystem_GetMatrix34TrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError * pError);
|
||||
S_API uint32_t SteamAPI_vr_IVRSystem_GetStringTrackedDeviceProperty(intptr_t instancePtr, vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, char * pchValue, uint32_t unBufferSize, vr::TrackedPropertyError * pError);
|
||||
S_API const char * SteamAPI_vr_IVRSystem_GetPropErrorNameFromEnum(intptr_t instancePtr, vr::TrackedPropertyError error);
|
||||
S_API bool SteamAPI_vr_IVRSystem_PollNextEvent(intptr_t instancePtr, struct vr::VREvent_t * pEvent);
|
||||
S_API const char * SteamAPI_vr_IVRSystem_GetEventTypeNameFromEnum(intptr_t instancePtr, vr::EVREventType eType);
|
||||
S_API struct vr::HiddenAreaMesh_t SteamAPI_vr_IVRSystem_GetHiddenAreaMesh(intptr_t instancePtr, vr::Hmd_Eye eEye);
|
||||
S_API vr::ChaperoneCalibrationState SteamAPI_vr_IVRChaperone_GetCalibrationState(intptr_t instancePtr);
|
||||
S_API bool SteamAPI_vr_IVRChaperone_GetSoftBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSoftBoundsInfo_t * pInfo);
|
||||
S_API bool SteamAPI_vr_IVRChaperone_GetHardBoundsInfo(intptr_t instancePtr, struct vr::HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount);
|
||||
S_API bool SteamAPI_vr_IVRChaperone_GetSeatedBoundsInfo(intptr_t instancePtr, struct vr::ChaperoneSeatedBoundsInfo_t * pInfo);
|
||||
S_API uint32_t SteamAPI_vr_IVRCompositor_GetLastError(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferSize);
|
||||
S_API void SteamAPI_vr_IVRCompositor_SetVSync(intptr_t instancePtr, bool bVSync);
|
||||
S_API bool SteamAPI_vr_IVRCompositor_GetVSync(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRCompositor_SetGamma(intptr_t instancePtr, float fGamma);
|
||||
S_API float SteamAPI_vr_IVRCompositor_GetGamma(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRCompositor_SetGraphicsDevice(intptr_t instancePtr, vr::Compositor_DeviceType eType, void * pDevice);
|
||||
S_API void SteamAPI_vr_IVRCompositor_WaitGetPoses(intptr_t instancePtr, struct vr::TrackedDevicePose_t * pPoseArray, uint32_t unPoseArrayCount);
|
||||
S_API void SteamAPI_vr_IVRCompositor_Submit(intptr_t instancePtr, vr::Hmd_Eye eEye, void * pTexture, struct vr::Compositor_TextureBounds * pBounds);
|
||||
S_API void SteamAPI_vr_IVRCompositor_ClearLastSubmittedFrame(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRCompositor_GetOverlayDefaults(intptr_t instancePtr, struct vr::Compositor_OverlaySettings * pSettings);
|
||||
S_API void SteamAPI_vr_IVRCompositor_SetOverlay(intptr_t instancePtr, void * pTexture, struct vr::Compositor_OverlaySettings * pSettings);
|
||||
S_API void SteamAPI_vr_IVRCompositor_SetOverlayRaw(intptr_t instancePtr, void * buffer, uint32_t width, uint32_t height, uint32_t depth, struct vr::Compositor_OverlaySettings * pSettings);
|
||||
S_API void SteamAPI_vr_IVRCompositor_SetOverlayFromFile(intptr_t instancePtr, const char * pchFilePath, struct vr::Compositor_OverlaySettings * pSettings);
|
||||
S_API void SteamAPI_vr_IVRCompositor_ClearOverlay(intptr_t instancePtr);
|
||||
S_API bool SteamAPI_vr_IVRCompositor_GetFrameTiming(intptr_t instancePtr, struct vr::Compositor_FrameTiming * pTiming, uint32_t unFramesAgo);
|
||||
S_API void SteamAPI_vr_IVRCompositor_FadeToColor(intptr_t instancePtr, float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground);
|
||||
S_API void SteamAPI_vr_IVRCompositor_FadeGrid(intptr_t instancePtr, float fSeconds, bool bFadeIn);
|
||||
S_API void SteamAPI_vr_IVRCompositor_CompositorBringToFront(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRCompositor_CompositorGoToBack(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRCompositor_CompositorQuit(intptr_t instancePtr);
|
||||
S_API bool SteamAPI_vr_IVRCompositor_IsFullscreen(intptr_t instancePtr);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_GetDriverCount(intptr_t instancePtr);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_GetDriverId(intptr_t instancePtr, uint32_t unDriverIndex, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_GetDriverDisplayCount(intptr_t instancePtr, const char * pchDriverId);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_GetDriverDisplayId(intptr_t instancePtr, const char * pchDriverId, uint32_t unDisplayIndex, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_GetDriverDisplayModelNumber(intptr_t instancePtr, const char * pchDriverId, const char * pchDisplayId, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_GetDriverDisplaySerialNumber(intptr_t instancePtr, const char * pchDriverId, const char * pchDisplayId, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API uint32_t SteamAPI_vr_IVRControlPanel_LoadSharedResource(intptr_t instancePtr, const char * pchResourceName, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API float SteamAPI_vr_IVRControlPanel_GetIPD(intptr_t instancePtr);
|
||||
S_API void SteamAPI_vr_IVRControlPanel_SetIPD(intptr_t instancePtr, float fIPD);
|
||||
S_API bool SteamAPI_ISteamGameServer_InitGameServer(intptr_t instancePtr, uint32 unIP, uint16 usGamePort, uint16 usQueryPort, uint32 unFlags, AppId_t nGameAppId, const char * pchVersionString);
|
||||
S_API void SteamAPI_ISteamGameServer_SetProduct(intptr_t instancePtr, const char * pszProduct);
|
||||
S_API void SteamAPI_ISteamGameServer_SetGameDescription(intptr_t instancePtr, const char * pszGameDescription);
|
||||
|
||||
+982
-702
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,973 @@
|
||||
//=== === Copyright 1996-2014, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: This file contains C#/managed code bindings for the SteamAPI interfaces
|
||||
// This file is auto-generated, do not edit it.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Valve.Steamworks;
|
||||
using Valve.Interop;
|
||||
|
||||
|
||||
|
||||
namespace Valve.VR
|
||||
{
|
||||
|
||||
public abstract class IVRSystem
|
||||
{
|
||||
public abstract IntPtr GetIntPtr();
|
||||
public abstract void GetWindowBounds(ref int pnX,ref int pnY,ref uint pnWidth,ref uint pnHeight);
|
||||
public abstract void GetRecommendedRenderTargetSize(ref uint pnWidth,ref uint pnHeight);
|
||||
public abstract void GetEyeOutputViewport(Hmd_Eye eEye,ref uint pnX,ref uint pnY,ref uint pnWidth,ref uint pnHeight);
|
||||
public abstract HmdMatrix44_t GetProjectionMatrix(Hmd_Eye eEye,float fNearZ,float fFarZ,GraphicsAPIConvention eProjType);
|
||||
public abstract void GetProjectionRaw(Hmd_Eye eEye,ref float pfLeft,ref float pfRight,ref float pfTop,ref float pfBottom);
|
||||
public abstract DistortionCoordinates_t ComputeDistortion(Hmd_Eye eEye,float fU,float fV);
|
||||
public abstract HmdMatrix34_t GetEyeToHeadTransform(Hmd_Eye eEye);
|
||||
public abstract bool GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync,ref ulong pulFrameCounter);
|
||||
public abstract int GetD3D9AdapterIndex();
|
||||
public abstract void GetDXGIOutputInfo(ref int pnAdapterIndex,ref int pnAdapterOutputIndex);
|
||||
public abstract void AttachToWindow(IntPtr hWnd);
|
||||
public abstract void GetDeviceToAbsoluteTrackingPose(TrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray);
|
||||
public abstract void ResetSeatedZeroPose();
|
||||
public abstract HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
|
||||
public abstract bool LoadRenderModel(string pchRenderModelName,ref RenderModel_t pRenderModel);
|
||||
public abstract void FreeRenderModel(ref RenderModel_t pRenderModel);
|
||||
public abstract TrackedDeviceClass GetTrackedDeviceClass(TrackedDeviceIndex_t unDeviceIndex);
|
||||
public abstract bool IsTrackedDeviceConnected(TrackedDeviceIndex_t unDeviceIndex);
|
||||
public abstract bool GetBoolTrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError);
|
||||
public abstract float GetFloatTrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError);
|
||||
public abstract int GetInt32TrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError);
|
||||
public abstract ulong GetUint64TrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError);
|
||||
public abstract HmdMatrix34_t GetMatrix34TrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError);
|
||||
public abstract uint GetStringTrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,System.Text.StringBuilder pchValue,uint unBufferSize,ref TrackedPropertyError pError);
|
||||
public abstract string GetPropErrorNameFromEnum(TrackedPropertyError error);
|
||||
public abstract bool PollNextEvent(ref VREvent_t pEvent);
|
||||
public abstract string GetEventTypeNameFromEnum(uint eType);
|
||||
public abstract uint GetHiddenAreaMesh(Hmd_Eye eEye);
|
||||
}
|
||||
|
||||
|
||||
public abstract class IVRChaperone
|
||||
{
|
||||
public abstract IntPtr GetIntPtr();
|
||||
public abstract ChaperoneCalibrationState GetCalibrationState();
|
||||
public abstract bool GetSoftBoundsInfo(ref ChaperoneSoftBoundsInfo_t pInfo);
|
||||
public abstract bool GetHardBoundsInfo(out HmdQuad_t [] pQuadsBuffer);
|
||||
public abstract bool GetSeatedBoundsInfo(ref ChaperoneSeatedBoundsInfo_t pInfo);
|
||||
}
|
||||
|
||||
|
||||
public abstract class IVRCompositor
|
||||
{
|
||||
public abstract IntPtr GetIntPtr();
|
||||
public abstract uint GetLastError(System.Text.StringBuilder pchBuffer,uint unBufferSize);
|
||||
public abstract void SetVSync(bool bVSync);
|
||||
public abstract bool GetVSync();
|
||||
public abstract void SetGamma(float fGamma);
|
||||
public abstract float GetGamma();
|
||||
public abstract void SetGraphicsDevice(Compositor_DeviceType eType,IntPtr pDevice);
|
||||
public abstract void WaitGetPoses(TrackedDevicePose_t [] pPoseArray);
|
||||
public abstract void Submit(Hmd_Eye eEye,IntPtr pTexture,ref Compositor_TextureBounds pBounds);
|
||||
public abstract void ClearLastSubmittedFrame();
|
||||
public abstract void GetOverlayDefaults(ref Compositor_OverlaySettings pSettings);
|
||||
public abstract void SetOverlay(IntPtr pTexture,ref Compositor_OverlaySettings pSettings);
|
||||
public abstract void SetOverlayRaw(IntPtr buffer,uint width,uint height,uint depth,ref Compositor_OverlaySettings pSettings);
|
||||
public abstract void SetOverlayFromFile(string pchFilePath,ref Compositor_OverlaySettings pSettings);
|
||||
public abstract void ClearOverlay();
|
||||
public abstract bool GetFrameTiming(ref Compositor_FrameTiming pTiming,uint unFramesAgo);
|
||||
public abstract void FadeToColor(float fSeconds,float fRed,float fGreen,float fBlue,float fAlpha,bool bBackground);
|
||||
public abstract void FadeGrid(float fSeconds,bool bFadeIn);
|
||||
public abstract void CompositorBringToFront();
|
||||
public abstract void CompositorGoToBack();
|
||||
public abstract void CompositorQuit();
|
||||
public abstract bool IsFullscreen();
|
||||
}
|
||||
|
||||
|
||||
public abstract class IVRControlPanel
|
||||
{
|
||||
public abstract IntPtr GetIntPtr();
|
||||
public abstract uint GetDriverCount();
|
||||
public abstract uint GetDriverId(uint unDriverIndex,string pchBuffer,uint unBufferLen);
|
||||
public abstract uint GetDriverDisplayCount(string pchDriverId);
|
||||
public abstract uint GetDriverDisplayId(string pchDriverId,uint unDisplayIndex,string pchBuffer,uint unBufferLen);
|
||||
public abstract uint GetDriverDisplayModelNumber(string pchDriverId,string pchDisplayId,string pchBuffer,uint unBufferLen);
|
||||
public abstract uint GetDriverDisplaySerialNumber(string pchDriverId,string pchDisplayId,string pchBuffer,uint unBufferLen);
|
||||
public abstract uint LoadSharedResource(string pchResourceName,string pchBuffer,uint unBufferLen);
|
||||
public abstract float GetIPD();
|
||||
public abstract void SetIPD(float fIPD);
|
||||
}
|
||||
|
||||
|
||||
public class CVRSystem : IVRSystem
|
||||
{
|
||||
public CVRSystem(IntPtr VRSystem)
|
||||
{
|
||||
m_pVRSystem = VRSystem;
|
||||
}
|
||||
IntPtr m_pVRSystem;
|
||||
|
||||
public override IntPtr GetIntPtr() { return m_pVRSystem; }
|
||||
|
||||
private void CheckIfUsable()
|
||||
{
|
||||
if (m_pVRSystem == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Steam Pointer not configured");
|
||||
}
|
||||
}
|
||||
public override void GetWindowBounds(ref int pnX,ref int pnY,ref uint pnWidth,ref uint pnHeight)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pnX = 0;
|
||||
pnY = 0;
|
||||
pnWidth = 0;
|
||||
pnHeight = 0;
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_GetWindowBounds(m_pVRSystem,ref pnX,ref pnY,ref pnWidth,ref pnHeight);
|
||||
}
|
||||
public override void GetRecommendedRenderTargetSize(ref uint pnWidth,ref uint pnHeight)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pnWidth = 0;
|
||||
pnHeight = 0;
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_GetRecommendedRenderTargetSize(m_pVRSystem,ref pnWidth,ref pnHeight);
|
||||
}
|
||||
public override void GetEyeOutputViewport(Hmd_Eye eEye,ref uint pnX,ref uint pnY,ref uint pnWidth,ref uint pnHeight)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pnX = 0;
|
||||
pnY = 0;
|
||||
pnWidth = 0;
|
||||
pnHeight = 0;
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_GetEyeOutputViewport(m_pVRSystem,eEye,ref pnX,ref pnY,ref pnWidth,ref pnHeight);
|
||||
}
|
||||
public override HmdMatrix44_t GetProjectionMatrix(Hmd_Eye eEye,float fNearZ,float fFarZ,GraphicsAPIConvention eProjType)
|
||||
{
|
||||
CheckIfUsable();
|
||||
HmdMatrix44_t result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetProjectionMatrix(m_pVRSystem,eEye,fNearZ,fFarZ,eProjType);
|
||||
return result;
|
||||
}
|
||||
public override void GetProjectionRaw(Hmd_Eye eEye,ref float pfLeft,ref float pfRight,ref float pfTop,ref float pfBottom)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pfLeft = 0;
|
||||
pfRight = 0;
|
||||
pfTop = 0;
|
||||
pfBottom = 0;
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_GetProjectionRaw(m_pVRSystem,eEye,ref pfLeft,ref pfRight,ref pfTop,ref pfBottom);
|
||||
}
|
||||
public override DistortionCoordinates_t ComputeDistortion(Hmd_Eye eEye,float fU,float fV)
|
||||
{
|
||||
CheckIfUsable();
|
||||
DistortionCoordinates_t result = NativeEntrypoints.SteamAPI_vr_IVRSystem_ComputeDistortion(m_pVRSystem,eEye,fU,fV);
|
||||
return result;
|
||||
}
|
||||
public override HmdMatrix34_t GetEyeToHeadTransform(Hmd_Eye eEye)
|
||||
{
|
||||
CheckIfUsable();
|
||||
HmdMatrix34_t result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetEyeToHeadTransform(m_pVRSystem,eEye);
|
||||
return result;
|
||||
}
|
||||
public override bool GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync,ref ulong pulFrameCounter)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pfSecondsSinceLastVsync = 0;
|
||||
pulFrameCounter = 0;
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetTimeSinceLastVsync(m_pVRSystem,ref pfSecondsSinceLastVsync,ref pulFrameCounter);
|
||||
return result;
|
||||
}
|
||||
public override int GetD3D9AdapterIndex()
|
||||
{
|
||||
CheckIfUsable();
|
||||
int result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetD3D9AdapterIndex(m_pVRSystem);
|
||||
return result;
|
||||
}
|
||||
public override void GetDXGIOutputInfo(ref int pnAdapterIndex,ref int pnAdapterOutputIndex)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pnAdapterIndex = 0;
|
||||
pnAdapterOutputIndex = 0;
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_GetDXGIOutputInfo(m_pVRSystem,ref pnAdapterIndex,ref pnAdapterOutputIndex);
|
||||
}
|
||||
public override void AttachToWindow(IntPtr hWnd)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_AttachToWindow(m_pVRSystem,hWnd);
|
||||
}
|
||||
public override void GetDeviceToAbsoluteTrackingPose(TrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_GetDeviceToAbsoluteTrackingPose(m_pVRSystem,eOrigin,fPredictedSecondsToPhotonsFromNow,pTrackedDevicePoseArray,(uint) pTrackedDevicePoseArray.Length);
|
||||
}
|
||||
public override void ResetSeatedZeroPose()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_ResetSeatedZeroPose(m_pVRSystem);
|
||||
}
|
||||
public override HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose()
|
||||
{
|
||||
CheckIfUsable();
|
||||
HmdMatrix34_t result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetSeatedZeroPoseToStandingAbsoluteTrackingPose(m_pVRSystem);
|
||||
return result;
|
||||
}
|
||||
public override bool LoadRenderModel(string pchRenderModelName,ref RenderModel_t pRenderModel)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRSystem_LoadRenderModel(m_pVRSystem,pchRenderModelName,ref pRenderModel);
|
||||
return result;
|
||||
}
|
||||
public override void FreeRenderModel(ref RenderModel_t pRenderModel)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRSystem_FreeRenderModel(m_pVRSystem,ref pRenderModel);
|
||||
}
|
||||
public override TrackedDeviceClass GetTrackedDeviceClass(TrackedDeviceIndex_t unDeviceIndex)
|
||||
{
|
||||
CheckIfUsable();
|
||||
TrackedDeviceClass result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetTrackedDeviceClass(m_pVRSystem,unDeviceIndex);
|
||||
return result;
|
||||
}
|
||||
public override bool IsTrackedDeviceConnected(TrackedDeviceIndex_t unDeviceIndex)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRSystem_IsTrackedDeviceConnected(m_pVRSystem,unDeviceIndex);
|
||||
return result;
|
||||
}
|
||||
public override bool GetBoolTrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetBoolTrackedDeviceProperty(m_pVRSystem,unDeviceIndex,prop,ref pError);
|
||||
return result;
|
||||
}
|
||||
public override float GetFloatTrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError)
|
||||
{
|
||||
CheckIfUsable();
|
||||
float result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetFloatTrackedDeviceProperty(m_pVRSystem,unDeviceIndex,prop,ref pError);
|
||||
return result;
|
||||
}
|
||||
public override int GetInt32TrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError)
|
||||
{
|
||||
CheckIfUsable();
|
||||
int result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetInt32TrackedDeviceProperty(m_pVRSystem,unDeviceIndex,prop,ref pError);
|
||||
return result;
|
||||
}
|
||||
public override ulong GetUint64TrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError)
|
||||
{
|
||||
CheckIfUsable();
|
||||
ulong result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetUint64TrackedDeviceProperty(m_pVRSystem,unDeviceIndex,prop,ref pError);
|
||||
return result;
|
||||
}
|
||||
public override HmdMatrix34_t GetMatrix34TrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,ref TrackedPropertyError pError)
|
||||
{
|
||||
CheckIfUsable();
|
||||
HmdMatrix34_t result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetMatrix34TrackedDeviceProperty(m_pVRSystem,unDeviceIndex,prop,ref pError);
|
||||
return result;
|
||||
}
|
||||
public override uint GetStringTrackedDeviceProperty(TrackedDeviceIndex_t unDeviceIndex,TrackedDeviceProperty prop,System.Text.StringBuffer pchValue,uint unBufferSize,ref TrackedPropertyError pError)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetStringTrackedDeviceProperty(m_pVRSystem,unDeviceIndex,prop,pchValue,unBufferSize,ref pError);
|
||||
return result;
|
||||
}
|
||||
public override string GetPropErrorNameFromEnum(TrackedPropertyError error)
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetPropErrorNameFromEnum(m_pVRSystem,error);
|
||||
return (string) Marshal.PtrToStructure(result, typeof(string));
|
||||
}
|
||||
public override bool PollNextEvent(ref VREvent_t pEvent)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRSystem_PollNextEvent(m_pVRSystem,ref pEvent);
|
||||
return result;
|
||||
}
|
||||
public override string GetEventTypeNameFromEnum(uint eType)
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetEventTypeNameFromEnum(m_pVRSystem,eType);
|
||||
return (string) Marshal.PtrToStructure(result, typeof(string));
|
||||
}
|
||||
public override uint GetHiddenAreaMesh(Hmd_Eye eEye)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRSystem_GetHiddenAreaMesh(m_pVRSystem,eEye);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CVRChaperone : IVRChaperone
|
||||
{
|
||||
public CVRChaperone(IntPtr VRChaperone)
|
||||
{
|
||||
m_pVRChaperone = VRChaperone;
|
||||
}
|
||||
IntPtr m_pVRChaperone;
|
||||
|
||||
public override IntPtr GetIntPtr() { return m_pVRChaperone; }
|
||||
|
||||
private void CheckIfUsable()
|
||||
{
|
||||
if (m_pVRChaperone == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Steam Pointer not configured");
|
||||
}
|
||||
}
|
||||
public override ChaperoneCalibrationState GetCalibrationState()
|
||||
{
|
||||
CheckIfUsable();
|
||||
ChaperoneCalibrationState result = NativeEntrypoints.SteamAPI_vr_IVRChaperone_GetCalibrationState(m_pVRChaperone);
|
||||
return result;
|
||||
}
|
||||
public override bool GetSoftBoundsInfo(ref ChaperoneSoftBoundsInfo_t pInfo)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRChaperone_GetSoftBoundsInfo(m_pVRChaperone,ref pInfo);
|
||||
return result;
|
||||
}
|
||||
public override bool GetHardBoundsInfo(out HmdQuad_t [] pQuadsBuffer)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint punQuadsCount = 0;
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRChaperone_GetHardBoundsInfo(m_pVRChaperone,null,ref punQuadsCount);
|
||||
pQuadsBuffer= new HmdQuad_t[punQuadsCount];
|
||||
result = NativeEntrypoints.SteamAPI_vr_IVRChaperone_GetHardBoundsInfo(m_pVRChaperone,pQuadsBuffer,ref punQuadsCount);
|
||||
return result;
|
||||
}
|
||||
public override bool GetSeatedBoundsInfo(ref ChaperoneSeatedBoundsInfo_t pInfo)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRChaperone_GetSeatedBoundsInfo(m_pVRChaperone,ref pInfo);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CVRCompositor : IVRCompositor
|
||||
{
|
||||
public CVRCompositor(IntPtr VRCompositor)
|
||||
{
|
||||
m_pVRCompositor = VRCompositor;
|
||||
}
|
||||
IntPtr m_pVRCompositor;
|
||||
|
||||
public override IntPtr GetIntPtr() { return m_pVRCompositor; }
|
||||
|
||||
private void CheckIfUsable()
|
||||
{
|
||||
if (m_pVRCompositor == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Steam Pointer not configured");
|
||||
}
|
||||
}
|
||||
public override uint GetLastError(System.Text.StringBuffer pchBuffer,uint unBufferSize)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRCompositor_GetLastError(m_pVRCompositor,pchBuffer,unBufferSize);
|
||||
return result;
|
||||
}
|
||||
public override void SetVSync(bool bVSync)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_SetVSync(m_pVRCompositor,bVSync);
|
||||
}
|
||||
public override bool GetVSync()
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRCompositor_GetVSync(m_pVRCompositor);
|
||||
return result;
|
||||
}
|
||||
public override void SetGamma(float fGamma)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_SetGamma(m_pVRCompositor,fGamma);
|
||||
}
|
||||
public override float GetGamma()
|
||||
{
|
||||
CheckIfUsable();
|
||||
float result = NativeEntrypoints.SteamAPI_vr_IVRCompositor_GetGamma(m_pVRCompositor);
|
||||
return result;
|
||||
}
|
||||
public override void SetGraphicsDevice(Compositor_DeviceType eType,IntPtr pDevice)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_SetGraphicsDevice(m_pVRCompositor,eType,pDevice);
|
||||
}
|
||||
public override void WaitGetPoses(TrackedDevicePose_t [] pPoseArray)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_WaitGetPoses(m_pVRCompositor,pPoseArray,(uint) pPoseArray.Length);
|
||||
}
|
||||
public override void Submit(Hmd_Eye eEye,IntPtr pTexture,ref Compositor_TextureBounds pBounds)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_Submit(m_pVRCompositor,eEye,pTexture,ref pBounds);
|
||||
}
|
||||
public override void ClearLastSubmittedFrame()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_ClearLastSubmittedFrame(m_pVRCompositor);
|
||||
}
|
||||
public override void GetOverlayDefaults(ref Compositor_OverlaySettings pSettings)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_GetOverlayDefaults(m_pVRCompositor,ref pSettings);
|
||||
}
|
||||
public override void SetOverlay(IntPtr pTexture,ref Compositor_OverlaySettings pSettings)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_SetOverlay(m_pVRCompositor,pTexture,ref pSettings);
|
||||
}
|
||||
public override void SetOverlayRaw(IntPtr buffer,uint width,uint height,uint depth,ref Compositor_OverlaySettings pSettings)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_SetOverlayRaw(m_pVRCompositor,buffer,width,height,depth,ref pSettings);
|
||||
}
|
||||
public override void SetOverlayFromFile(string pchFilePath,ref Compositor_OverlaySettings pSettings)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_SetOverlayFromFile(m_pVRCompositor,pchFilePath,ref pSettings);
|
||||
}
|
||||
public override void ClearOverlay()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_ClearOverlay(m_pVRCompositor);
|
||||
}
|
||||
public override bool GetFrameTiming(ref Compositor_FrameTiming pTiming,uint unFramesAgo)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRCompositor_GetFrameTiming(m_pVRCompositor,ref pTiming,unFramesAgo);
|
||||
return result;
|
||||
}
|
||||
public override void FadeToColor(float fSeconds,float fRed,float fGreen,float fBlue,float fAlpha,bool bBackground)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_FadeToColor(m_pVRCompositor,fSeconds,fRed,fGreen,fBlue,fAlpha,bBackground);
|
||||
}
|
||||
public override void FadeGrid(float fSeconds,bool bFadeIn)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_FadeGrid(m_pVRCompositor,fSeconds,bFadeIn);
|
||||
}
|
||||
public override void CompositorBringToFront()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_CompositorBringToFront(m_pVRCompositor);
|
||||
}
|
||||
public override void CompositorGoToBack()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_CompositorGoToBack(m_pVRCompositor);
|
||||
}
|
||||
public override void CompositorQuit()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRCompositor_CompositorQuit(m_pVRCompositor);
|
||||
}
|
||||
public override bool IsFullscreen()
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_vr_IVRCompositor_IsFullscreen(m_pVRCompositor);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CVRControlPanel : IVRControlPanel
|
||||
{
|
||||
public CVRControlPanel(IntPtr VRControlPanel)
|
||||
{
|
||||
m_pVRControlPanel = VRControlPanel;
|
||||
}
|
||||
IntPtr m_pVRControlPanel;
|
||||
|
||||
public override IntPtr GetIntPtr() { return m_pVRControlPanel; }
|
||||
|
||||
private void CheckIfUsable()
|
||||
{
|
||||
if (m_pVRControlPanel == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Steam Pointer not configured");
|
||||
}
|
||||
}
|
||||
public override uint GetDriverCount()
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetDriverCount(m_pVRControlPanel);
|
||||
return result;
|
||||
}
|
||||
public override uint GetDriverId(uint unDriverIndex,string pchBuffer,uint unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetDriverId(m_pVRControlPanel,unDriverIndex,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
public override uint GetDriverDisplayCount(string pchDriverId)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetDriverDisplayCount(m_pVRControlPanel,pchDriverId);
|
||||
return result;
|
||||
}
|
||||
public override uint GetDriverDisplayId(string pchDriverId,uint unDisplayIndex,string pchBuffer,uint unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetDriverDisplayId(m_pVRControlPanel,pchDriverId,unDisplayIndex,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
public override uint GetDriverDisplayModelNumber(string pchDriverId,string pchDisplayId,string pchBuffer,uint unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetDriverDisplayModelNumber(m_pVRControlPanel,pchDriverId,pchDisplayId,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
public override uint GetDriverDisplaySerialNumber(string pchDriverId,string pchDisplayId,string pchBuffer,uint unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetDriverDisplaySerialNumber(m_pVRControlPanel,pchDriverId,pchDisplayId,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
public override uint LoadSharedResource(string pchResourceName,string pchBuffer,uint unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_LoadSharedResource(m_pVRControlPanel,pchResourceName,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
public override float GetIPD()
|
||||
{
|
||||
CheckIfUsable();
|
||||
float result = NativeEntrypoints.SteamAPI_vr_IVRControlPanel_GetIPD(m_pVRControlPanel);
|
||||
return result;
|
||||
}
|
||||
public override void SetIPD(float fIPD)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_vr_IVRControlPanel_SetIPD(m_pVRControlPanel,fIPD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SteamAPIInterop
|
||||
{
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_RestartAppIfNecessary")]
|
||||
internal static extern void SteamAPI_RestartAppIfNecessary(uint unOwnAppID );
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_Init")]
|
||||
internal static extern void SteamAPI_Init();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_RunCallbacks")]
|
||||
internal static extern void SteamAPI_RunCallbacks();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_RegisterCallback")]
|
||||
internal static extern void SteamAPI_RegisterCallback(IntPtr pCallback, int iCallback);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_UnregisterCallback")]
|
||||
internal static extern void SteamAPI_UnregisterCallback(IntPtr pCallback);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamClient")]
|
||||
internal static extern IntPtr SteamClient();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamUser")]
|
||||
internal static extern IntPtr SteamUser();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamFriends")]
|
||||
internal static extern IntPtr SteamFriends();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamUtils")]
|
||||
internal static extern IntPtr SteamUtils();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmaking")]
|
||||
internal static extern IntPtr SteamMatchmaking();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingServerListResponse")]
|
||||
internal static extern IntPtr SteamMatchmakingServerListResponse();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingPingResponse")]
|
||||
internal static extern IntPtr SteamMatchmakingPingResponse();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingPlayersResponse")]
|
||||
internal static extern IntPtr SteamMatchmakingPlayersResponse();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingRulesResponse")]
|
||||
internal static extern IntPtr SteamMatchmakingRulesResponse();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMatchmakingServers")]
|
||||
internal static extern IntPtr SteamMatchmakingServers();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamRemoteStorage")]
|
||||
internal static extern IntPtr SteamRemoteStorage();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamUserStats")]
|
||||
internal static extern IntPtr SteamUserStats();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamApps")]
|
||||
internal static extern IntPtr SteamApps();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamNetworking")]
|
||||
internal static extern IntPtr SteamNetworking();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamScreenshots")]
|
||||
internal static extern IntPtr SteamScreenshots();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMusic")]
|
||||
internal static extern IntPtr SteamMusic();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamMusicRemote")]
|
||||
internal static extern IntPtr SteamMusicRemote();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamHTTP")]
|
||||
internal static extern IntPtr SteamHTTP();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamUnifiedMessages")]
|
||||
internal static extern IntPtr SteamUnifiedMessages();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamController")]
|
||||
internal static extern IntPtr SteamController();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamUGC")]
|
||||
internal static extern IntPtr SteamUGC();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAppList")]
|
||||
internal static extern IntPtr SteamAppList();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamHTMLSurface")]
|
||||
internal static extern IntPtr SteamHTMLSurface();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamInventory")]
|
||||
internal static extern IntPtr SteamInventory();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamVideo")]
|
||||
internal static extern IntPtr SteamVideo();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "CV")]
|
||||
internal static extern IntPtr CV();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "CV")]
|
||||
internal static extern IntPtr CV();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "CV")]
|
||||
internal static extern IntPtr CV();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "CV")]
|
||||
internal static extern IntPtr CV();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamGameServer")]
|
||||
internal static extern IntPtr SteamGameServer();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamGameServerStats")]
|
||||
internal static extern IntPtr SteamGameServerStats();
|
||||
}
|
||||
|
||||
|
||||
public enum Hmd_Eye
|
||||
{
|
||||
Eye_Left = 0,
|
||||
Eye_Right = 1,
|
||||
}
|
||||
public enum GraphicsAPIConvention
|
||||
{
|
||||
API_DirectX = 0,
|
||||
API_OpenGL = 1,
|
||||
}
|
||||
public enum HmdTrackingResult
|
||||
{
|
||||
TrackingResult_Uninitialized = 1,
|
||||
TrackingResult_Calibrating_InProgress = 100,
|
||||
TrackingResult_Calibrating_OutOfRange = 101,
|
||||
TrackingResult_Running_OK = 200,
|
||||
TrackingResult_Running_OutOfRange = 201,
|
||||
}
|
||||
public enum TrackedDeviceClass
|
||||
{
|
||||
TrackedDeviceClass_Invalid = 0,
|
||||
TrackedDeviceClass_HMD = 1,
|
||||
TrackedDeviceClass_Controller = 2,
|
||||
TrackedDeviceClass_TrackingReference = 4,
|
||||
TrackedDeviceClass_Other = 1000,
|
||||
}
|
||||
public enum TrackingUniverseOrigin
|
||||
{
|
||||
TrackingUniverseSeated = 0,
|
||||
TrackingUniverseStanding = 1,
|
||||
TrackingUniverseRawAndUncalibrated = 2,
|
||||
}
|
||||
public enum TrackedDeviceProperty
|
||||
{
|
||||
Prop_TrackingSystemName_String = 1000,
|
||||
Prop_ModelNumber_String = 1001,
|
||||
Prop_SerialNumber_String = 1002,
|
||||
Prop_RenderModelName_String = 1003,
|
||||
Prop_WillDriftInYaw_Bool = 1004,
|
||||
Prop_ManufacturerName_String = 1005,
|
||||
Prop_TrackingFirmwareVersion_String = 1006,
|
||||
Prop_HardwareRevision_String = 1007,
|
||||
Prop_ReportsTimeSinceVSync_Bool = 2000,
|
||||
Prop_SecondsFromVsyncToPhotons_Float = 2001,
|
||||
Prop_DisplayFrequency_Float = 2002,
|
||||
Prop_UserIpdMeters_Float = 2003,
|
||||
Prop_CurrentUniverseId_Uint64 = 2004,
|
||||
Prop_PreviousUniverseId_Uint64 = 2005,
|
||||
Prop_DisplayFirmwareVersion_String = 2006,
|
||||
Prop_AttachedDeviceId_String = 3000,
|
||||
Prop_FieldOfViewLeftDegrees_Float = 4000,
|
||||
Prop_FieldOfViewRightDegrees_Float = 4001,
|
||||
Prop_FieldOfViewTopDegrees_Float = 4002,
|
||||
Prop_FieldOfViewBottomDegrees_Float = 4003,
|
||||
Prop_TrackingRangeMinimumMeters_Float = 4004,
|
||||
Prop_TrackingRangeMaximumMeters_Float = 4005,
|
||||
}
|
||||
public enum TrackedPropertyError
|
||||
{
|
||||
TrackedProp_Success = 0,
|
||||
TrackedProp_WrongDataType = 1,
|
||||
TrackedProp_WrongDeviceClass = 2,
|
||||
TrackedProp_BufferTooSmall = 3,
|
||||
TrackedProp_UnknownProperty = 4,
|
||||
TrackedProp_InvalidDevice = 5,
|
||||
TrackedProp_CouldNotContactServer = 6,
|
||||
TrackedProp_ValueNotProvidedByDevice = 7,
|
||||
TrackedProp_StringExceedsMaximumLength = 8,
|
||||
}
|
||||
public enum EVREventType
|
||||
{
|
||||
VREvent_None = 0,
|
||||
VREvent_TrackedDeviceActivated = 100,
|
||||
VREvent_TrackedDeviceDeactivated = 101,
|
||||
VREvent_TrackedDeviceUpdated = 102,
|
||||
}
|
||||
public enum HmdError
|
||||
{
|
||||
HmdError_None = 0,
|
||||
HmdError_Init_InstallationNotFound = 100,
|
||||
HmdError_Init_InstallationCorrupt = 101,
|
||||
HmdError_Init_VRClientDLLNotFound = 102,
|
||||
HmdError_Init_FileNotFound = 103,
|
||||
HmdError_Init_FactoryNotFound = 104,
|
||||
HmdError_Init_InterfaceNotFound = 105,
|
||||
HmdError_Init_InvalidInterface = 106,
|
||||
HmdError_Init_UserConfigDirectoryInvalid = 107,
|
||||
HmdError_Init_HmdNotFound = 108,
|
||||
HmdError_Init_NotInitialized = 109,
|
||||
HmdError_Init_PathRegistryNotFound = 110,
|
||||
HmdError_Init_NoConfigPath = 111,
|
||||
HmdError_Init_NoLogPath = 112,
|
||||
HmdError_Init_PathRegistryNotWritable = 113,
|
||||
HmdError_Driver_Failed = 200,
|
||||
HmdError_Driver_Unknown = 201,
|
||||
HmdError_Driver_HmdUnknown = 202,
|
||||
HmdError_Driver_NotLoaded = 203,
|
||||
HmdError_Driver_RuntimeOutOfDate = 204,
|
||||
HmdError_Driver_HmdInUse = 205,
|
||||
HmdError_IPC_ServerInitFailed = 300,
|
||||
HmdError_IPC_ConnectFailed = 301,
|
||||
HmdError_IPC_SharedStateInitFailed = 302,
|
||||
HmdError_IPC_CompositorInitFailed = 303,
|
||||
HmdError_IPC_MutexInitFailed = 304,
|
||||
HmdError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
|
||||
HmdError_Steam_SteamInstallationNotFound = 2000,
|
||||
}
|
||||
public enum ChaperoneCalibrationState
|
||||
{
|
||||
ChaperoneCalibrationState_OK = 1,
|
||||
ChaperoneCalibrationState_Warning = 100,
|
||||
ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101,
|
||||
ChaperoneCalibrationState_Warning_BaseStationRemoved = 102,
|
||||
ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103,
|
||||
ChaperoneCalibrationState_Error = 200,
|
||||
ChaperoneCalibrationState_Error_BaseStationUninitalized = 201,
|
||||
ChaperoneCalibrationState_Error_BaseStationConflict = 202,
|
||||
ChaperoneCalibrationState_Error_SoftBoundsInvalid = 203,
|
||||
ChaperoneCalibrationState_Error_HardBoundsInvalid = 204,
|
||||
}
|
||||
public enum Compositor_DeviceType
|
||||
{
|
||||
Compositor_DeviceType_None = 0,
|
||||
Compositor_DeviceType_D3D9 = 1,
|
||||
Compositor_DeviceType_D3D9Ex = 2,
|
||||
Compositor_DeviceType_D3D10 = 3,
|
||||
Compositor_DeviceType_D3D11 = 4,
|
||||
Compositor_DeviceType_OpenGL = 5,
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix34_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] m; //float[3][4]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix44_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] m; //float[4][4]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdVector3_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] v; //float[3]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdVector3d_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.R8)]
|
||||
public double[] v; //double[3]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdVector2_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] v; //float[2]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdQuaternion_t
|
||||
{
|
||||
public double w;
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdQuad_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.HmdVector3_t)]
|
||||
public HmdVector3_t[] vCorners; //HmdVector3_t[4]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct DistortionCoordinates_t
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] rfRed; //float[2]
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] rfGreen; //float[2]
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] rfBlue; //float[2]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct TrackedDevicePose_t
|
||||
{
|
||||
public HmdMatrix34_t mDeviceToAbsoluteTracking;
|
||||
public HmdVector3_t vVelocity;
|
||||
public HmdVector3_t vAngularVelocity;
|
||||
public HmdTrackingResult eTrackingResult;
|
||||
public bool bPoseIsValid;
|
||||
public bool bDeviceIsValid;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_Vertex_t
|
||||
{
|
||||
public HmdVector3_t vPosition;
|
||||
public HmdVector3_t vNormal;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.R4)]
|
||||
public float[] rfTextureCoord; //float[2]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_TextureMap_t
|
||||
{
|
||||
public char unWidth;
|
||||
public char unHeight;
|
||||
public byte rubTextureMapData;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_t
|
||||
{
|
||||
public ulong ulInternalHandle;
|
||||
public RenderModel_Vertex_t rVertexData;
|
||||
public uint unVertexCount;
|
||||
public char rIndexData;
|
||||
public uint unTriangleCount;
|
||||
public RenderModel_TextureMap_t diffuseTexture;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct VREvent_t
|
||||
{
|
||||
public uint eventType;
|
||||
public TrackedDeviceIndex_t trackedDeviceIndex;
|
||||
public uint param1;
|
||||
public float eventAgeSeconds;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HiddenAreaMesh_t
|
||||
{
|
||||
public HmdVector2_t pVertexData;
|
||||
public uint unTriangleCount;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct ChaperoneSoftBoundsInfo_t
|
||||
{
|
||||
public HmdQuad_t quadCorners;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct ChaperoneSeatedBoundsInfo_t
|
||||
{
|
||||
public HmdVector3_t vSeatedHeadPosition;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.HmdVector3_t)]
|
||||
public HmdVector3_t[] vDeskEdgePositions; //HmdVector3_t[2]
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct Compositor_FrameTiming
|
||||
{
|
||||
public uint size;
|
||||
public double frameStart;
|
||||
public float frameVSync;
|
||||
public uint droppedFrames;
|
||||
public uint frameIndex;
|
||||
public TrackedDevicePose_t pose;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct Compositor_OverlaySettings
|
||||
{
|
||||
public uint size;
|
||||
public bool curved;
|
||||
public bool antialias;
|
||||
public float scale;
|
||||
public float distance;
|
||||
public float alpha;
|
||||
public float uOffset;
|
||||
public float vOffset;
|
||||
public float uScale;
|
||||
public float vScale;
|
||||
public float gridDivs;
|
||||
public float gridWidth;
|
||||
public float gridScale;
|
||||
public HmdMatrix44_t transform;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct Compositor_TextureBounds
|
||||
{
|
||||
public float uMin;
|
||||
public float vMin;
|
||||
public float uMax;
|
||||
public float vMax;
|
||||
}
|
||||
|
||||
public class SteamVR
|
||||
{
|
||||
public static void Init(uint appId)
|
||||
{
|
||||
SteamAPIInterop.SteamAPI_RestartAppIfNecessary (appId);
|
||||
SteamAPIInterop.SteamAPI_Init ();
|
||||
}
|
||||
|
||||
public static void RunCallbacks()
|
||||
{
|
||||
SteamAPIInterop.SteamAPI_RunCallbacks ();
|
||||
}
|
||||
|
||||
public static void RegisterCallback(IntPtr pCallback, int iCallback)
|
||||
{
|
||||
SteamAPIInterop.SteamAPI_RegisterCallback (pCallback, iCallback);
|
||||
}
|
||||
|
||||
public static void UnregisterCallback(IntPtr pCallback)
|
||||
{
|
||||
SteamAPIInterop.SteamAPI_UnregisterCallback (pCallback);
|
||||
}
|
||||
|
||||
public const int k_iSteamUserCallbacks = 100;
|
||||
public const int k_iSteamGameServerCallbacks = 200;
|
||||
public const int k_iSteamFriendsCallbacks = 300;
|
||||
public const int k_iSteamBillingCallbacks = 400;
|
||||
public const int k_iSteamMatchmakingCallbacks = 500;
|
||||
public const int k_iSteamContentServerCallbacks = 600;
|
||||
public const int k_iSteamUtilsCallbacks = 700;
|
||||
public const int k_iClientFriendsCallbacks = 800;
|
||||
public const int k_iClientUserCallbacks = 900;
|
||||
public const int k_iSteamAppsCallbacks = 1000;
|
||||
public const int k_iSteamUserStatsCallbacks = 1100;
|
||||
public const int k_iSteamNetworkingCallbacks = 1200;
|
||||
public const int k_iClientRemoteStorageCallbacks = 1300;
|
||||
public const int k_iClientDepotBuilderCallbacks = 1400;
|
||||
public const int k_iSteamGameServerItemsCallbacks = 1500;
|
||||
public const int k_iClientUtilsCallbacks = 1600;
|
||||
public const int k_iSteamGameCoordinatorCallbacks = 1700;
|
||||
public const int k_iSteamGameServerStatsCallbacks = 1800;
|
||||
public const int k_iSteam2AsyncCallbacks = 1900;
|
||||
public const int k_iSteamGameStatsCallbacks = 2000;
|
||||
public const int k_iClientHTTPCallbacks = 2100;
|
||||
public const int k_iClientScreenshotsCallbacks = 2200;
|
||||
public const int k_iSteamScreenshotsCallbacks = 2300;
|
||||
public const int k_iClientAudioCallbacks = 2400;
|
||||
public const int k_iClientUnifiedMessagesCallbacks = 2500;
|
||||
public const int k_iSteamStreamLauncherCallbacks = 2600;
|
||||
public const int k_iClientControllerCallbacks = 2700;
|
||||
public const int k_iSteamControllerCallbacks = 2800;
|
||||
public const int k_iClientParentalSettingsCallbacks = 2900;
|
||||
public const int k_iClientDeviceAuthCallbacks = 3000;
|
||||
public const int k_iClientNetworkDeviceManagerCallbacks = 3100;
|
||||
public const int k_iClientMusicCallbacks = 3200;
|
||||
public const int k_iClientRemoteClientManagerCallbacks = 3300;
|
||||
public const int k_iClientUGCCallbacks = 3400;
|
||||
public const int k_iSteamStreamClientCallbacks = 3500;
|
||||
public const int k_IClientProductBuilderCallbacks = 3600;
|
||||
public const int k_iClientShortcutsCallbacks = 3700;
|
||||
public const int k_iClientRemoteControlManagerCallbacks = 3800;
|
||||
public const int k_iSteamAppListCallbacks = 3900;
|
||||
public const int k_iSteamMusicCallbacks = 4000;
|
||||
public const int k_iSteamMusicRemoteCallbacks = 4100;
|
||||
public const int k_iClientVRCallbacks = 4200;
|
||||
public const int k_iClientReservedCallbacks = 4300;
|
||||
public const int k_iSteamReservedCallbacks = 4400;
|
||||
public const int k_iSteamHTMLSurfaceCallbacks = 4500;
|
||||
public const int k_iClientVideoCallbacks = 4600;
|
||||
public const int k_iClientInventoryCallbacks = 4700;
|
||||
public const int k_cchPersonaNameMax = 128;
|
||||
public const int k_cwchPersonaNameMax = 32;
|
||||
public const int k_cchMaxRichPresenceKeys = 20;
|
||||
public const int k_cchMaxRichPresenceKeyLength = 64;
|
||||
public const int k_cchMaxRichPresenceValueLength = 256;
|
||||
public const int k_cchStatNameMax = 128;
|
||||
public const int k_cchLeaderboardNameMax = 128;
|
||||
public const int k_cLeaderboardDetailsMax = 64;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -115,7 +115,13 @@ enum EResult
|
||||
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
|
||||
k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
|
||||
k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
|
||||
k_EResultNotModified = 91, // data not modified
|
||||
k_EResultNotModified = 91, // data not modified
|
||||
k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it
|
||||
k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance
|
||||
k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
|
||||
k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource
|
||||
k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account
|
||||
k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone
|
||||
};
|
||||
|
||||
// Error codes for use with the voice functions
|
||||
@@ -248,6 +254,7 @@ enum EAppOwnershipFlags
|
||||
k_EAppOwnershipFlags_LicensePermanent = 0x0800, // permanent license, not borrowed, or guest or freeweekend etc
|
||||
k_EAppOwnershipFlags_LicenseRecurring = 0x1000, // Recurring license, user is charged periodically
|
||||
k_EAppOwnershipFlags_LicenseCanceled = 0x2000, // Mark as canceled, but might be still active if recurring
|
||||
k_EAppOwnershipFlags_AutoGrant = 0x4000, // Ownership is based on any kind of autogrant license
|
||||
};
|
||||
|
||||
|
||||
@@ -266,8 +273,8 @@ enum EAppType
|
||||
k_EAppType_Guide = 0x040, // game guide, PDF 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_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_Hardware = 0x200, // a hardware device (Steam Machine, Steam Controller, Steam Link, etc.)
|
||||
// 0x400 is up for grabs here
|
||||
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
|
||||
@@ -317,6 +324,7 @@ enum EChatEntryType
|
||||
k_EChatEntryTypeHistoricalChat = 11, // a chat message from user's chat history or offilne message
|
||||
k_EChatEntryTypeReserved1 = 12,
|
||||
k_EChatEntryTypeReserved2 = 13,
|
||||
k_EChatEntryTypeLinkBlocked = 14, // a link was removed by the chat filter.
|
||||
};
|
||||
|
||||
|
||||
@@ -398,6 +406,27 @@ enum ENotificationPosition
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Broadcast upload result details
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EBroadcastUploadResult
|
||||
{
|
||||
k_EBroadcastUploadResultNone = 0, // broadcast state unknown
|
||||
k_EBroadcastUploadResultOK = 1, // broadcast was good, no problems
|
||||
k_EBroadcastUploadResultInitFailed = 2, // broadcast init failed
|
||||
k_EBroadcastUploadResultFrameFailed = 3, // broadcast frame upload failed
|
||||
k_EBroadcastUploadResultTimeout = 4, // broadcast upload timed out
|
||||
k_EBroadcastUploadResultBandwidthExceeded = 5, // broadcast send too much data
|
||||
k_EBroadcastUploadResultLowFPS = 6, // broadcast FPS too low
|
||||
k_EBroadcastUploadResultMissingKeyFrames = 7, // broadcast sending not enough key frames
|
||||
k_EBroadcastUploadResultNoConnection = 8, // broadcast client failed to connect to relay
|
||||
k_EBroadcastUploadResultRelayFailed = 9, // relay dropped the upload
|
||||
k_EBroadcastUploadResultSettingsChanged = 10, // the client changed broadcast settings
|
||||
k_EBroadcastUploadResultMissingAudio = 11, // client failed to send audio data
|
||||
k_EBroadcastUploadResultTooFarBehind = 12, // clients was too slow uploading
|
||||
};
|
||||
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
#define CSTEAMID_DEFINED
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
//========= Copyright © 1996-2013, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose: Controller related public types/constants
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef STEAMCONTROLLERPUBLIC_H
|
||||
#define STEAMCONTROLLERPUBLIC_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( STEAM ) || defined( ISTEAMCONTROLLER_H )
|
||||
// This file should only be included by the Steam build or directly from
|
||||
// isteamcontroller.h.
|
||||
#include "steamtypes.h"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
typedef uint32_t uint32;
|
||||
#ifdef __C51__
|
||||
typedef uint8_t uint64[8];
|
||||
#else
|
||||
typedef uint64_t uint64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
// Safe to add new bitfields at the end of this list for new buttons/actions,
|
||||
// but never re-use or re-number an existing flag as old client code will be
|
||||
// confused.
|
||||
#define STEAM_RIGHT_TRIGGER_MASK 0x0000000000000001l
|
||||
#define STEAM_LEFT_TRIGGER_MASK 0x0000000000000002l
|
||||
#define STEAM_RIGHT_BUMPER_MASK 0x0000000000000004l
|
||||
#define STEAM_LEFT_BUMPER_MASK 0x0000000000000008l
|
||||
#define STEAM_BUTTON_0_MASK 0x0000000000000010l
|
||||
#define STEAM_BUTTON_1_MASK 0x0000000000000020l
|
||||
#define STEAM_BUTTON_2_MASK 0x0000000000000040l
|
||||
#define STEAM_BUTTON_3_MASK 0x0000000000000080l
|
||||
#define STEAM_TOUCH_0_MASK 0x0000000000000100l
|
||||
#define STEAM_TOUCH_1_MASK 0x0000000000000200l
|
||||
#define STEAM_TOUCH_2_MASK 0x0000000000000400l
|
||||
#define STEAM_TOUCH_3_MASK 0x0000000000000800l
|
||||
#define STEAM_BUTTON_MENU_MASK 0x0000000000001000l
|
||||
#define STEAM_BUTTON_STEAM_MASK 0x0000000000002000l
|
||||
#define STEAM_BUTTON_ESCAPE_MASK 0x0000000000004000l
|
||||
#define STEAM_BUTTON_BACK_LEFT_MASK 0x0000000000008000l
|
||||
#define STEAM_BUTTON_BACK_RIGHT_MASK 0x0000000000010000l
|
||||
#define STEAM_BUTTON_LEFTPAD_CLICKED_MASK 0x0000000000020000l
|
||||
#define STEAM_BUTTON_RIGHTPAD_CLICKED_MASK 0x0000000000040000l
|
||||
#define STEAM_LEFTPAD_FINGERDOWN_MASK 0x0000000000080000l
|
||||
#define STEAM_RIGHTPAD_FINGERDOWN_MASK 0x0000000000100000l
|
||||
|
||||
// Only add fields to the end of this struct, or if you need to change it in a larger
|
||||
// way add a new message id and new struct completely so as to not break old clients.
|
||||
struct SteamControllerState_t
|
||||
{
|
||||
// If packet num matches that on your prior call, then the controller state hasn't been changed since
|
||||
// your last call and there is no need to process it
|
||||
uint32 unPacketNum;
|
||||
|
||||
// bit flags for each of the buttons
|
||||
uint64 ulButtons;
|
||||
|
||||
// Left pad coordinates
|
||||
short sLeftPadX;
|
||||
short sLeftPadY;
|
||||
|
||||
// Right pad coordinates
|
||||
short sRightPadX;
|
||||
short sRightPadY;
|
||||
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif // STEAMCONTROLLERPUBLIC_H
|
||||
|
||||
@@ -117,12 +117,13 @@ typedef uint64 GID_t;
|
||||
const GID_t k_GIDNil = 0xffffffffffffffffull;
|
||||
|
||||
// For convenience, we define a number of types that are just new names for GIDs
|
||||
typedef GID_t JobID_t; // Each Job has a unique ID
|
||||
typedef uint64 JobID_t; // Each Job has a unique ID
|
||||
typedef GID_t TxnID_t; // Each financial transaction has a unique ID
|
||||
|
||||
const GID_t k_TxnIDNil = k_GIDNil;
|
||||
const GID_t k_TxnIDUnknown = 0;
|
||||
|
||||
const JobID_t k_JobIDNil = 0xffffffffffffffffull;
|
||||
|
||||
// this is baked into client messages and interfaces as an int,
|
||||
// make sure we never break this.
|
||||
@@ -131,7 +132,7 @@ const PackageId_t k_uPackageIdFreeSub = 0x0;
|
||||
const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
|
||||
|
||||
typedef uint32 BundleId_t;
|
||||
|
||||
const BundleId_t k_uBundleIdInvalid = 0;
|
||||
|
||||
// this is baked into client messages and interfaces as an int,
|
||||
// make sure we never break this.
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace vr
|
||||
{
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// The 32-bit version of gcc has the alignment requirement for uint64 and double set to
|
||||
// 4 meaning that even with #pragma pack(8) these types will only be four-byte aligned.
|
||||
// The 64-bit version of gcc has the alignment requirement for these types set to
|
||||
// 8 meaning that unless we use #pragma pack(4) our structures will get bigger.
|
||||
// The 64-bit structure packing has to match the 32-bit structure packing for each platform.
|
||||
#pragma pack( push, 4 )
|
||||
#else
|
||||
#pragma pack( push, 8 )
|
||||
#endif
|
||||
|
||||
|
||||
// right-handed system
|
||||
// +y is up
|
||||
// +x is to the right
|
||||
// -z is going away from you
|
||||
// Distance unit is meters
|
||||
struct HmdMatrix34_t
|
||||
{
|
||||
float m[3][4];
|
||||
};
|
||||
|
||||
struct HmdMatrix44_t
|
||||
{
|
||||
float m[4][4];
|
||||
};
|
||||
|
||||
|
||||
/** Used to return the post-distortion UVs for each color channel.
|
||||
* UVs range from 0 to 1 with 0,0 in the upper left corner of the
|
||||
* source render target. The 0,0 to 1,1 range covers a single eye. */
|
||||
struct DistortionCoordinates_t
|
||||
{
|
||||
float rfRed[2];
|
||||
float rfGreen[2];
|
||||
float rfBlue[2];
|
||||
};
|
||||
|
||||
|
||||
enum Hmd_Eye
|
||||
{
|
||||
Eye_Left = 0,
|
||||
Eye_Right = 1
|
||||
};
|
||||
|
||||
enum GraphicsAPIConvention
|
||||
{
|
||||
API_DirectX = 0, // Normalized Z goes from 0 at the viewer to 1 at the far clip plane
|
||||
API_OpenGL = 1, // Normalized Z goes from 1 at the viewer to -1 at the far clip plane
|
||||
};
|
||||
|
||||
enum HmdTrackingResult
|
||||
{
|
||||
TrackingResult_Uninitialized = 1,
|
||||
|
||||
TrackingResult_Calibrating_InProgress = 100,
|
||||
TrackingResult_Calibrating_OutOfRange = 101,
|
||||
|
||||
TrackingResult_Running_OK = 200,
|
||||
TrackingResult_Running_OutOfRange = 201,
|
||||
};
|
||||
|
||||
class IHmd
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
// ------------------------------------
|
||||
// Display Methods
|
||||
// ------------------------------------
|
||||
|
||||
/** Size and position that the window needs to be on the VR display. */
|
||||
virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
|
||||
/** Suggested size for the intermediate render target that the distortion pulls from. */
|
||||
virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
|
||||
/** Gets the viewport in the frame buffer to draw the output of the distortion into */
|
||||
virtual void GetEyeOutputViewport( Hmd_Eye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
|
||||
/** The projection matrix for the specified eye */
|
||||
virtual HmdMatrix44_t GetProjectionMatrix( Hmd_Eye eEye, float fNearZ, float fFarZ, GraphicsAPIConvention eProjType ) = 0;
|
||||
|
||||
/** The components necessary to build your own projection matrix in case your
|
||||
* application is doing something fancy like infinite Z */
|
||||
virtual void GetProjectionRaw( Hmd_Eye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0;
|
||||
|
||||
/** Returns the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in
|
||||
* the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. */
|
||||
virtual DistortionCoordinates_t ComputeDistortion( Hmd_Eye eEye, float fU, float fV ) = 0;
|
||||
|
||||
/** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head
|
||||
* space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection.
|
||||
* Normally View and Eye^-1 will be multiplied together and treated as View in your application.
|
||||
*/
|
||||
virtual HmdMatrix34_t GetHeadFromEyePose( Hmd_Eye eEye ) = 0;
|
||||
|
||||
/** For use in simple VR apps, this method returns the concatenation of the
|
||||
* tracking pose and the eye matrix to get a full view matrix for each eye.
|
||||
* This is ( GetEyeMatrix() ) * (GetWorldFromHeadPose() ^ -1 ) */
|
||||
virtual bool GetViewMatrix( float fSecondsFromNow, HmdMatrix44_t *pMatLeftView, HmdMatrix44_t *pMatRightView, HmdTrackingResult *peResult ) = 0;
|
||||
|
||||
/** [D3D9 Only]
|
||||
* Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such
|
||||
* a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error.
|
||||
*/
|
||||
virtual int32_t GetD3D9AdapterIndex() = 0;
|
||||
|
||||
/** [D3D10/11 Only]
|
||||
* Returns the adapter index and output index that the user should pass into EnumAdapters adn EnumOutputs
|
||||
* to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1.
|
||||
*/
|
||||
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
|
||||
// ------------------------------------
|
||||
|
||||
/** The pose that the tracker thinks that the HMD will be in at the specified
|
||||
* number of seconds into the future. Pass 0 to get the current state.
|
||||
*
|
||||
* This is roughly analogous to the inverse of the view matrix in most applications, though
|
||||
* many games will need to do some additional rotation or translation on top of the rotation
|
||||
* and translation provided by the head pose.
|
||||
*
|
||||
* If this function returns true the pose has been populated with a pose that can be used by the application.
|
||||
* Check peResult for details about the pose, including messages that should be displayed to the user.
|
||||
*/
|
||||
virtual bool GetTrackerFromHeadPose( float fPredictedSecondsFromNow, HmdMatrix34_t *pmPose, HmdTrackingResult *peResult ) = 0;
|
||||
|
||||
/** Passes back the pose matrix from the last successful call to GetWorldFromHeadPose(). Returns true if that matrix is
|
||||
* valid (because there has been a previous successful pose.) */
|
||||
virtual bool GetLastTrackerFromHeadPose( HmdMatrix34_t *pmPose ) = 0;
|
||||
|
||||
/** Returns true if the tracker for this HMD will drift the Yaw component of its pose over time regardless of
|
||||
* actual head motion. This is true for gyro-based trackers with no ground truth. */
|
||||
virtual bool WillDriftInYaw() = 0;
|
||||
|
||||
/** Sets the zero pose for the tracker coordinate system. After this call all WorldFromHead poses will be relative
|
||||
* to the pose whenever this was called. The new zero coordinate system will not change the fact that the Y axis is
|
||||
* up in the real world, so the next pose returned from GetWorldFromHeadPose after a call to ZeroTracker may not be
|
||||
* exactly an identity matrix. */
|
||||
virtual void ZeroTracker() = 0;
|
||||
|
||||
/** Returns the zero pose for the tracker coordinate system. If the tracker has never had a valid pose, this
|
||||
* will be an identity matrix. */
|
||||
virtual HmdMatrix34_t GetTrackerZeroPose() = 0;
|
||||
|
||||
// ------------------------------------
|
||||
// Administrative methods
|
||||
// ------------------------------------
|
||||
|
||||
/** The ID of the driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If
|
||||
* the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes
|
||||
* will be enough to fit any ID. */
|
||||
virtual uint32_t GetDriverId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
||||
|
||||
/** The ID of this display within its driver this HMD uses as a UTF-8 string. Returns the length of the ID in bytes. If
|
||||
* the buffer is not large enough to fit the ID an empty string will be returned. In general, 128 bytes
|
||||
* will be enough to fit any ID. */
|
||||
virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
||||
};
|
||||
|
||||
static const char * const IHmd_Version = "IHmd_005";
|
||||
|
||||
/** error codes returned by Vr_Init */
|
||||
enum HmdError
|
||||
{
|
||||
HmdError_None = 0,
|
||||
|
||||
HmdError_Init_InstallationNotFound = 100,
|
||||
HmdError_Init_InstallationCorrupt = 101,
|
||||
HmdError_Init_VRClientDLLNotFound = 102,
|
||||
HmdError_Init_FileNotFound = 103,
|
||||
HmdError_Init_FactoryNotFound = 104,
|
||||
HmdError_Init_InterfaceNotFound = 105,
|
||||
HmdError_Init_InvalidInterface = 106,
|
||||
HmdError_Init_UserConfigDirectoryInvalid = 107,
|
||||
HmdError_Init_HmdNotFound = 108,
|
||||
HmdError_Init_NotInitialized = 109,
|
||||
|
||||
HmdError_Driver_Failed = 200,
|
||||
HmdError_Driver_Unknown = 201,
|
||||
HmdError_Driver_HmdUnknown = 202,
|
||||
HmdError_Driver_NotLoaded = 203,
|
||||
|
||||
HmdError_IPC_ServerInitFailed = 300,
|
||||
HmdError_IPC_ConnectFailed = 301,
|
||||
HmdError_IPC_SharedStateInitFailed = 302,
|
||||
|
||||
HmdError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
|
||||
|
||||
HmdError_Steam_SteamInstallationNotFound = 2000,
|
||||
|
||||
};
|
||||
|
||||
|
||||
// figure out how to import from the VR API dll
|
||||
#if defined(_WIN32)
|
||||
|
||||
#ifdef VR_API_EXPORT
|
||||
#define VR_INTERFACE extern "C" __declspec( dllexport )
|
||||
#else
|
||||
#define VR_INTERFACE extern "C" __declspec( dllimport )
|
||||
#endif
|
||||
|
||||
#elif defined(GNUC) || defined(COMPILER_GCC)
|
||||
|
||||
#ifdef VR_API_EXPORT
|
||||
#define VR_INTERFACE extern "C" __attribute__((visibility("default")))
|
||||
#else
|
||||
#define VR_INTERFACE extern "C"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "Unsupported Platform."
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/** Finds the active installation of the VR API and initializes it. The priority for figuring
|
||||
* out where to load vrclient from are:
|
||||
* 1. The convar "VR_OVERRIDE", which should contain an absolute path to the root of
|
||||
* an vr API directory.
|
||||
* 2. The pchVROverride argument. This should be an absolute path or a path relative to
|
||||
* the current executable.
|
||||
* 3. The path "./vr" relative to the current executable's path.
|
||||
*
|
||||
* Each of these paths are to the "root" of the VR API install. That's the directory with
|
||||
* the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself.
|
||||
*/
|
||||
VR_INTERFACE IHmd *VR_Init( HmdError *peError );
|
||||
|
||||
/** unloads vrclient.dll. Any interface pointers from the interface are
|
||||
* invalid after this point */
|
||||
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 )
|
||||
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//====== Copyright (c) 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to user account information in Steam
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef STEAMVRFLAT_H
|
||||
#define STEAMVRFLAT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
S_API void SteamAPI_IHmd_GetWindowBounds(intptr_t instancePtr, int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API void SteamAPI_IHmd_GetRecommendedRenderTargetSize(intptr_t instancePtr, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API void SteamAPI_IHmd_GetEyeOutputViewport(intptr_t instancePtr, vr::Hmd_Eye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight);
|
||||
S_API struct vr::HmdMatrix44_t SteamAPI_IHmd_GetProjectionMatrix(intptr_t instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType);
|
||||
S_API void SteamAPI_IHmd_GetProjectionRaw(intptr_t instancePtr, vr::Hmd_Eye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom);
|
||||
S_API struct vr::DistortionCoordinates_t SteamAPI_IHmd_ComputeDistortion(intptr_t instancePtr, vr::Hmd_Eye eEye, float fU, float fV);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_IHmd_GetHeadFromEyePose(intptr_t instancePtr, vr::Hmd_Eye eEye);
|
||||
S_API bool SteamAPI_IHmd_GetViewMatrix(intptr_t instancePtr, float fSecondsFromNow, struct vr::HmdMatrix44_t * pMatLeftView, struct vr::HmdMatrix44_t * pMatRightView, vr::HmdTrackingResult * peResult);
|
||||
S_API int32_t SteamAPI_IHmd_GetD3D9AdapterIndex(intptr_t instancePtr);
|
||||
S_API void SteamAPI_IHmd_GetDXGIOutputInfo(intptr_t instancePtr, int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex);
|
||||
S_API void SteamAPI_IHmd_AttachToWindow(intptr_t instancePtr, void * hWnd);
|
||||
S_API bool SteamAPI_IHmd_GetTrackerFromHeadPose(intptr_t instancePtr, float fPredictedSecondsFromNow, struct vr::HmdMatrix34_t * pmPose, vr::HmdTrackingResult * peResult);
|
||||
S_API bool SteamAPI_IHmd_GetLastTrackerFromHeadPose(intptr_t instancePtr, struct vr::HmdMatrix34_t * pmPose);
|
||||
S_API bool SteamAPI_IHmd_WillDriftInYaw(intptr_t instancePtr);
|
||||
S_API void SteamAPI_IHmd_ZeroTracker(intptr_t instancePtr);
|
||||
S_API struct vr::HmdMatrix34_t SteamAPI_IHmd_GetTrackerZeroPose(intptr_t instancePtr);
|
||||
S_API uint32_t SteamAPI_IHmd_GetDriverId(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferLen);
|
||||
S_API uint32_t SteamAPI_IHmd_GetDisplayId(intptr_t instancePtr, char * pchBuffer, uint32_t unBufferLen);
|
||||
#endif // STEAMVRFLAT_H
|
||||
@@ -1,285 +0,0 @@
|
||||
//=== === Copyright 1996-2004, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Valve.SteamVRInterop
|
||||
{
|
||||
|
||||
class NativeEntrypoints
|
||||
{
|
||||
|
||||
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetWindowBounds")]
|
||||
internal static extern void SteamAPI_IHmd_GetWindowBounds(IntPtr instancePtr, ref int32_t pnX, ref int32_t pnY, ref uint32_t pnWidth, ref uint32_t pnHeight);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetRecommendedRenderTargetSize")]
|
||||
internal static extern void SteamAPI_IHmd_GetRecommendedRenderTargetSize(IntPtr instancePtr, ref uint32_t pnWidth, ref uint32_t pnHeight);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetEyeOutputViewport")]
|
||||
internal static extern void SteamAPI_IHmd_GetEyeOutputViewport(IntPtr instancePtr, vr::Hmd_Eye eEye, ref uint32_t pnX, ref uint32_t pnY, ref uint32_t pnWidth, ref uint32_t pnHeight);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetProjectionMatrix")]
|
||||
internal static extern vr::HmdMatrix44_t SteamAPI_IHmd_GetProjectionMatrix(IntPtr instancePtr, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetProjectionRaw")]
|
||||
internal static extern void SteamAPI_IHmd_GetProjectionRaw(IntPtr instancePtr, vr::Hmd_Eye eEye, ref float pfLeft, ref float pfRight, ref float pfTop, ref float pfBottom);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_ComputeDistortion")]
|
||||
internal static extern vr::DistortionCoordinates_t SteamAPI_IHmd_ComputeDistortion(IntPtr instancePtr, vr::Hmd_Eye eEye, float fU, float fV);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetHeadFromEyePose")]
|
||||
internal static extern vr::HmdMatrix34_t SteamAPI_IHmd_GetHeadFromEyePose(IntPtr instancePtr, vr::Hmd_Eye eEye);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetViewMatrix")]
|
||||
internal static extern bool SteamAPI_IHmd_GetViewMatrix(IntPtr instancePtr, float fSecondsFromNow, ref vr::HmdMatrix44_t pMatLeftView, ref vr::HmdMatrix44_t pMatRightView, ref vr::HmdTrackingResult peResult);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetD3D9AdapterIndex")]
|
||||
internal static extern int32_t SteamAPI_IHmd_GetD3D9AdapterIndex(IntPtr instancePtr);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetDXGIOutputInfo")]
|
||||
internal static extern void SteamAPI_IHmd_GetDXGIOutputInfo(IntPtr instancePtr, ref int32_t pnAdapterIndex, ref int32_t pnAdapterOutputIndex);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_AttachToWindow")]
|
||||
internal static extern void SteamAPI_IHmd_AttachToWindow(IntPtr instancePtr, IntPtr hWnd);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetTrackerFromHeadPose")]
|
||||
internal static extern bool SteamAPI_IHmd_GetTrackerFromHeadPose(IntPtr instancePtr, float fPredictedSecondsFromNow, ref vr::HmdMatrix34_t pmPose, ref vr::HmdTrackingResult peResult);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetLastTrackerFromHeadPose")]
|
||||
internal static extern bool SteamAPI_IHmd_GetLastTrackerFromHeadPose(IntPtr instancePtr, ref vr::HmdMatrix34_t pmPose);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_WillDriftInYaw")]
|
||||
internal static extern bool SteamAPI_IHmd_WillDriftInYaw(IntPtr instancePtr);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_ZeroTracker")]
|
||||
internal static extern void SteamAPI_IHmd_ZeroTracker(IntPtr instancePtr);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetTrackerZeroPose")]
|
||||
internal static extern vr::HmdMatrix34_t SteamAPI_IHmd_GetTrackerZeroPose(IntPtr instancePtr);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetDriverId")]
|
||||
internal static extern uint32_t SteamAPI_IHmd_GetDriverId(IntPtr instancePtr, string pchBuffer, uint32_t unBufferLen);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_IHmd_GetDisplayId")]
|
||||
internal static extern uint32_t SteamAPI_IHmd_GetDisplayId(IntPtr instancePtr, string pchBuffer, uint32_t unBufferLen);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public abstract class IHmd
|
||||
{
|
||||
public abstract void GetWindowBounds(out int32_t pnX,out int32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight);
|
||||
public abstract void GetRecommendedRenderTargetSize(out uint32_t pnWidth,out uint32_t pnHeight);
|
||||
public abstract void GetEyeOutputViewport(vr::Hmd_Eye eEye,out uint32_t pnX,out uint32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight);
|
||||
public abstract vr::HmdMatrix44_t GetProjectionMatrix(vr::Hmd_Eye eEye,float fNearZ,float fFarZ,vr::GraphicsAPIConvention eProjType);
|
||||
public abstract void GetProjectionRaw(vr::Hmd_Eye eEye,out float pfLeft,out float pfRight,out float pfTop,out float pfBottom);
|
||||
public abstract vr::DistortionCoordinates_t ComputeDistortion(vr::Hmd_Eye eEye,float fU,float fV);
|
||||
public abstract vr::HmdMatrix34_t GetHeadFromEyePose(vr::Hmd_Eye eEye);
|
||||
public abstract bool GetViewMatrix(float fSecondsFromNow,out vr::HmdMatrix44_t pMatLeftView,out vr::HmdMatrix44_t pMatRightView,out vr::HmdTrackingResult peResult);
|
||||
public abstract int32_t GetD3D9AdapterIndex();
|
||||
public abstract void GetDXGIOutputInfo(out int32_t pnAdapterIndex,out int32_t pnAdapterOutputIndex);
|
||||
public abstract void AttachToWindow(IntPtr hWnd);
|
||||
public abstract bool GetTrackerFromHeadPose(float fPredictedSecondsFromNow,out vr::HmdMatrix34_t pmPose,out vr::HmdTrackingResult peResult);
|
||||
public abstract bool GetLastTrackerFromHeadPose(out vr::HmdMatrix34_t pmPose);
|
||||
public abstract bool WillDriftInYaw();
|
||||
public abstract void ZeroTracker();
|
||||
public abstract vr::HmdMatrix34_t GetTrackerZeroPose();
|
||||
public abstract uint32_t GetDriverId(string pchBuffer,uint32_t unBufferLen);
|
||||
public abstract uint32_t GetDisplayId(string pchBuffer,uint32_t unBufferLen);
|
||||
}
|
||||
|
||||
|
||||
public class CHmd : IHmd
|
||||
{
|
||||
public CHmd(IntPtr hmd)
|
||||
{
|
||||
m_hmd = hmd;
|
||||
}
|
||||
IntPtr m_hmd;
|
||||
|
||||
private void CheckIfUsable()
|
||||
{
|
||||
if (m_hmd == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Steam Pointer not configured");
|
||||
}
|
||||
}
|
||||
public override void GetWindowBounds(out int32_t pnX,out int32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_IHmd_GetWindowBounds(m_hmd,ref pnX,ref pnY,ref pnWidth,ref pnHeight);
|
||||
}
|
||||
public override void GetRecommendedRenderTargetSize(out uint32_t pnWidth,out uint32_t pnHeight)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_IHmd_GetRecommendedRenderTargetSize(m_hmd,ref pnWidth,ref pnHeight);
|
||||
}
|
||||
public override void GetEyeOutputViewport(vr::Hmd_Eye eEye,out uint32_t pnX,out uint32_t pnY,out uint32_t pnWidth,out uint32_t pnHeight)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_IHmd_GetEyeOutputViewport(m_hmd,eEye,ref pnX,ref pnY,ref pnWidth,ref pnHeight);
|
||||
}
|
||||
public override vr::HmdMatrix44_t GetProjectionMatrix(vr::Hmd_Eye eEye,float fNearZ,float fFarZ,vr::GraphicsAPIConvention eProjType)
|
||||
{
|
||||
CheckIfUsable();
|
||||
vr::HmdMatrix44_t result = NativeEntrypoints.SteamAPI_IHmd_GetProjectionMatrix(m_hmd,eEye,fNearZ,fFarZ,eProjType);
|
||||
return result;
|
||||
}
|
||||
public override void GetProjectionRaw(vr::Hmd_Eye eEye,out float pfLeft,out float pfRight,out float pfTop,out float pfBottom)
|
||||
{
|
||||
CheckIfUsable();
|
||||
pfLeft = 0;
|
||||
pfRight = 0;
|
||||
pfTop = 0;
|
||||
pfBottom = 0;
|
||||
NativeEntrypoints.SteamAPI_IHmd_GetProjectionRaw(m_hmd,eEye,ref pfLeft,ref pfRight,ref pfTop,ref pfBottom);
|
||||
}
|
||||
public override vr::DistortionCoordinates_t ComputeDistortion(vr::Hmd_Eye eEye,float fU,float fV)
|
||||
{
|
||||
CheckIfUsable();
|
||||
vr::DistortionCoordinates_t result = NativeEntrypoints.SteamAPI_IHmd_ComputeDistortion(m_hmd,eEye,fU,fV);
|
||||
return result;
|
||||
}
|
||||
public override vr::HmdMatrix34_t GetHeadFromEyePose(vr::Hmd_Eye eEye)
|
||||
{
|
||||
CheckIfUsable();
|
||||
vr::HmdMatrix34_t result = NativeEntrypoints.SteamAPI_IHmd_GetHeadFromEyePose(m_hmd,eEye);
|
||||
return result;
|
||||
}
|
||||
public override bool GetViewMatrix(float fSecondsFromNow,out vr::HmdMatrix44_t pMatLeftView,out vr::HmdMatrix44_t pMatRightView,out vr::HmdTrackingResult peResult)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_IHmd_GetViewMatrix(m_hmd,fSecondsFromNow,ref pMatLeftView,ref pMatRightView,ref peResult);
|
||||
return result;
|
||||
}
|
||||
public override int32_t GetD3D9AdapterIndex()
|
||||
{
|
||||
CheckIfUsable();
|
||||
int32_t result = NativeEntrypoints.SteamAPI_IHmd_GetD3D9AdapterIndex(m_hmd);
|
||||
return result;
|
||||
}
|
||||
public override void GetDXGIOutputInfo(out int32_t pnAdapterIndex,out int32_t pnAdapterOutputIndex)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_IHmd_GetDXGIOutputInfo(m_hmd,ref pnAdapterIndex,ref pnAdapterOutputIndex);
|
||||
}
|
||||
public override void AttachToWindow(IntPtr hWnd)
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_IHmd_AttachToWindow(m_hmd,hWnd);
|
||||
}
|
||||
public override bool GetTrackerFromHeadPose(float fPredictedSecondsFromNow,out vr::HmdMatrix34_t pmPose,out vr::HmdTrackingResult peResult)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_IHmd_GetTrackerFromHeadPose(m_hmd,fPredictedSecondsFromNow,ref pmPose,ref peResult);
|
||||
return result;
|
||||
}
|
||||
public override bool GetLastTrackerFromHeadPose(out vr::HmdMatrix34_t pmPose)
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_IHmd_GetLastTrackerFromHeadPose(m_hmd,ref pmPose);
|
||||
return result;
|
||||
}
|
||||
public override bool WillDriftInYaw()
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_IHmd_WillDriftInYaw(m_hmd);
|
||||
return result;
|
||||
}
|
||||
public override void ZeroTracker()
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_IHmd_ZeroTracker(m_hmd);
|
||||
}
|
||||
public override vr::HmdMatrix34_t GetTrackerZeroPose()
|
||||
{
|
||||
CheckIfUsable();
|
||||
vr::HmdMatrix34_t result = NativeEntrypoints.SteamAPI_IHmd_GetTrackerZeroPose(m_hmd);
|
||||
return result;
|
||||
}
|
||||
public override uint32_t GetDriverId(string pchBuffer,uint32_t unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint32_t result = NativeEntrypoints.SteamAPI_IHmd_GetDriverId(m_hmd,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
public override uint32_t GetDisplayId(string pchBuffer,uint32_t unBufferLen)
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint32_t result = NativeEntrypoints.SteamAPI_IHmd_GetDisplayId(m_hmd,pchBuffer,unBufferLen);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SteamVRInterop
|
||||
{
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "VR_Init")]
|
||||
internal static extern IntPtr VR_Init(out HmdError peError);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "VR_Shutdown")]
|
||||
internal static extern void VR_Shutdown();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "VR_IsHmdPresent")]
|
||||
internal static extern bool VR_IsHmdPresent();
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "SteamAPI_UnregisterCallback")]
|
||||
internal static extern string VR_GetStringForHmdError(HmdError error);
|
||||
[DllImportAttribute("Steam_api", EntryPoint = "Hmd")]
|
||||
internal static extern IntPtr Hmd();
|
||||
}
|
||||
|
||||
|
||||
public enum Hmd_Eye
|
||||
{
|
||||
Eye_Left = 0,
|
||||
Eye_Right = 1,
|
||||
}
|
||||
public enum GraphicsAPIConvention
|
||||
{
|
||||
API_DirectX = 0,
|
||||
API_OpenGL = 1,
|
||||
}
|
||||
public enum HmdTrackingResult
|
||||
{
|
||||
TrackingResult_Uninitialized = 1,
|
||||
TrackingResult_Calibrating_InProgress = 100,
|
||||
TrackingResult_Calibrating_OutOfRange = 101,
|
||||
TrackingResult_Running_OK = 200,
|
||||
TrackingResult_Running_OutOfRange = 201,
|
||||
}
|
||||
public enum HmdError
|
||||
{
|
||||
HmdError_None = 0,
|
||||
HmdError_Init_InstallationNotFound = 100,
|
||||
HmdError_Init_InstallationCorrupt = 101,
|
||||
HmdError_Init_VRClientDLLNotFound = 102,
|
||||
HmdError_Init_FileNotFound = 103,
|
||||
HmdError_Init_FactoryNotFound = 104,
|
||||
HmdError_Init_InterfaceNotFound = 105,
|
||||
HmdError_Init_InvalidInterface = 106,
|
||||
HmdError_Init_UserConfigDirectoryInvalid = 107,
|
||||
HmdError_Init_HmdNotFound = 108,
|
||||
HmdError_Init_NotInitialized = 109,
|
||||
HmdError_Driver_Failed = 200,
|
||||
HmdError_Driver_Unknown = 201,
|
||||
HmdError_Driver_HmdUnknown = 202,
|
||||
HmdError_Driver_NotLoaded = 203,
|
||||
HmdError_IPC_ServerInitFailed = 300,
|
||||
HmdError_IPC_ConnectFailed = 301,
|
||||
HmdError_IPC_SharedStateInitFailed = 302,
|
||||
HmdError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix34_t
|
||||
{
|
||||
public float m;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix44_t
|
||||
{
|
||||
public float m;
|
||||
}
|
||||
[StructLayout(LayoutKind.Sequential)] public struct DistortionCoordinates_t
|
||||
{
|
||||
public float rfRed;
|
||||
public float rfGreen;
|
||||
public float rfBlue;
|
||||
}
|
||||
|
||||
public class SteamVR
|
||||
{
|
||||
public static IHMD Init(out HmdError peError)
|
||||
{
|
||||
return new CHMD(VR_Init(out peError));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#VisualGDB: AutoSourceFiles #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS
|
||||
SOURCEFILES := BaseMenu.cpp clanchatroom.cpp connectingmenu.cpp Friends.cpp gameenginesdl.cpp glew.c htmlsurface.cpp Inventory.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
|
||||
SOURCEFILES := BaseMenu.cpp clanchatroom.cpp connectingmenu.cpp Friends.cpp gameenginesdl.cpp glew.c htmlsurface.cpp Inventory.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 Sun.cpp VectorEntity.cpp voicechat.cpp
|
||||
|
||||
TARGETNAME := SteamworksExampleLinux
|
||||
#TARGETTYPE can be APP, STATIC or SHARED
|
||||
|
||||
@@ -14,17 +14,16 @@
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include "gameenginesdl.h"
|
||||
#include "steamvrglhelper.h"
|
||||
|
||||
CGameEngineGL *g_engine; // dxabstract will use this.. it is set by the engine constructor
|
||||
|
||||
IGameEngine *CreateGameEngineSDL( bool bUseVR )
|
||||
IGameEngine *CreateGameEngineSDL( )
|
||||
{
|
||||
static CGameEngineGL* s_pGameEngine = NULL;
|
||||
|
||||
if (!s_pGameEngine)
|
||||
{
|
||||
s_pGameEngine = new CGameEngineGL( bUseVR );
|
||||
s_pGameEngine = new CGameEngineGL( );
|
||||
}
|
||||
|
||||
return s_pGameEngine;
|
||||
@@ -82,7 +81,7 @@ power_of_two(int input)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor for game engine instance
|
||||
//-----------------------------------------------------------------------------
|
||||
CGameEngineGL::CGameEngineGL( bool bUseVR )
|
||||
CGameEngineGL::CGameEngineGL( )
|
||||
{
|
||||
g_engine = this;
|
||||
|
||||
@@ -114,24 +113,8 @@ CGameEngineGL::CGameEngineGL( bool bUseVR )
|
||||
m_rgflQuadsTextureData = new GLfloat[ 8*QUAD_BUFFER_TOTAL_SIZE ];
|
||||
m_dwQuadsToFlush = 0;
|
||||
|
||||
m_pVRGLHelper = NULL;
|
||||
m_pHmd = NULL;
|
||||
|
||||
TTF_Init();
|
||||
|
||||
if( bUseVR )
|
||||
{
|
||||
vr::HmdError error;
|
||||
m_pHmd = vr::VR_Init( &error );
|
||||
if( !m_pHmd )
|
||||
{
|
||||
fprintf( stderr, "VR_Init returned error %d\n", error );
|
||||
OutputDebugString( "!! Initialize Steamworks VR failed\n" );
|
||||
return;
|
||||
}
|
||||
m_pVRGLHelper = new CSteamVRGLHelper();
|
||||
}
|
||||
|
||||
if( !BInitializeGraphics() )
|
||||
{
|
||||
OutputDebugString( "!! Initializing graphics failed\n" );
|
||||
@@ -156,13 +139,6 @@ void CGameEngineGL::Shutdown()
|
||||
// Flag that we are shutting down so the frame loop will stop running
|
||||
m_bShuttingDown = true;
|
||||
|
||||
if ( m_pVRGLHelper )
|
||||
{
|
||||
m_pVRGLHelper->Shutdown();
|
||||
delete m_pVRGLHelper;
|
||||
m_pVRGLHelper = NULL;
|
||||
}
|
||||
|
||||
if ( m_context ) {
|
||||
SDL_GL_DeleteContext( m_context );
|
||||
}
|
||||
@@ -256,20 +232,8 @@ bool CGameEngineGL::BInitializeGraphics()
|
||||
int windowX = SDL_WINDOWPOS_CENTERED;
|
||||
int windowY = SDL_WINDOWPOS_CENTERED;
|
||||
int nWindowWidth, nWindowHeight;
|
||||
if( !m_pHmd )
|
||||
{
|
||||
nWindowWidth = m_nWindowWidth = 1024;
|
||||
nWindowHeight = m_nWindowHeight = 768;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t unWidth, unHeight;
|
||||
m_pHmd->GetWindowBounds( &windowX, &windowY, &unWidth, &unHeight );
|
||||
nWindowWidth = unWidth;
|
||||
nWindowHeight = unHeight;
|
||||
m_nWindowWidth = 640;
|
||||
m_nWindowHeight = 480;
|
||||
}
|
||||
nWindowWidth = m_nWindowWidth = 1024;
|
||||
nWindowHeight = m_nWindowHeight = 768;
|
||||
|
||||
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
|
||||
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
|
||||
@@ -342,18 +306,6 @@ bool CGameEngineGL::BInitializeGraphics()
|
||||
|
||||
glDepthRange( 0.0f, 1.0f );
|
||||
|
||||
// create some other VR-related resources
|
||||
if( m_pHmd )
|
||||
{
|
||||
if( !m_pVRGLHelper->BInit( m_pHmd ) )
|
||||
{
|
||||
OutputDebugString( "Unable to init VRGLHelper\n" );
|
||||
return false;
|
||||
}
|
||||
m_pVRGLHelper->InitUIRenderTarget( m_nWindowWidth, m_nWindowHeight );
|
||||
m_pVRGLHelper->BInitPredistortRenderTarget();
|
||||
}
|
||||
|
||||
AdjustViewport();
|
||||
|
||||
return true;
|
||||
@@ -361,17 +313,8 @@ bool CGameEngineGL::BInitializeGraphics()
|
||||
|
||||
void CGameEngineGL::AdjustViewport()
|
||||
{
|
||||
if( m_pHmd )
|
||||
{
|
||||
m_pVRGLHelper->BPushUIRenderTarget();
|
||||
// don't update m_nWindowWidth and m_nWindowHeight here
|
||||
// because they're actually the size of the UI render target
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_GetWindowSize( m_window, &m_nWindowWidth, &m_nWindowHeight );
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0 );
|
||||
}
|
||||
SDL_GetWindowSize( m_window, &m_nWindowWidth, &m_nWindowHeight );
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0 );
|
||||
|
||||
// Perspective
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -487,42 +430,6 @@ void CGameEngineGL::EndFrame()
|
||||
// Flush quad buffer
|
||||
BFlushQuadBuffer();
|
||||
|
||||
// do quad renderering and distortion pass for VR
|
||||
if( m_pHmd )
|
||||
{
|
||||
// draw some lines around the edge of the "screen" in the 2D texture so that it's very obvious
|
||||
// where the boundary is to aid stereo fusion
|
||||
uint32 dwBorderColor = 0x888888FF;
|
||||
float fViewWidth = (float)GetViewportWidth();
|
||||
float fViewHeight = (float)GetViewportHeight();
|
||||
for ( float f = 0; f < 5.f; f += 1.f )
|
||||
{
|
||||
BDrawLine( 0 + f, 0 + f, dwBorderColor, fViewWidth - f, 0 + f, dwBorderColor );
|
||||
BDrawLine( 0 + f, fViewHeight - f, dwBorderColor, fViewWidth - f, fViewHeight - f, dwBorderColor );
|
||||
BDrawLine( 0 + f, 0 + f, dwBorderColor, 0 + f, fViewHeight - f, dwBorderColor );
|
||||
BDrawLine( fViewWidth - f, 0 + f, dwBorderColor, fViewWidth - f, fViewHeight - f, dwBorderColor );
|
||||
}
|
||||
BFlushLineBuffer();
|
||||
|
||||
vr::HmdMatrix34_t matWorldFromHead;
|
||||
vr::HmdTrackingResult result;
|
||||
if( m_pHmd->GetTrackerFromHeadPose( 0, &matWorldFromHead, &result ) )
|
||||
{
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
vr::Hmd_Eye eye = (vr::Hmd_Eye)i;
|
||||
m_pVRGLHelper->PushPredistortRenderTarget();
|
||||
m_pVRGLHelper->PushViewAndProjection( eye, 0.1f, 100.f, matWorldFromHead );
|
||||
|
||||
BDrawVRScreenQuad();
|
||||
BFlushQuadBuffer();
|
||||
|
||||
m_pVRGLHelper->DrawPredistortToFrameBuffer( eye );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Swap buffers now that everything is flushed
|
||||
SDL_GL_SwapWindow( m_window );
|
||||
|
||||
@@ -810,78 +717,6 @@ bool CGameEngineGL::BDrawTexturedQuad( float xPos0, float yPos0, float xPos1, fl
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Draw a textured quad
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CGameEngineGL::BDrawVRScreenQuad()
|
||||
{
|
||||
if ( m_bShuttingDown )
|
||||
return false;
|
||||
|
||||
// Check if we are out of room and need to flush the buffer, or if our texture is changing
|
||||
// then we also need to flush the buffer.
|
||||
if ( m_dwQuadsToFlush > 0 )
|
||||
{
|
||||
BFlushQuadBuffer();
|
||||
}
|
||||
|
||||
// Bind the new texture
|
||||
glBindTexture( GL_TEXTURE_2D, m_pVRGLHelper->GetUITexture() );
|
||||
float fHeight = m_pVRGLHelper->GetAspectRatio();
|
||||
|
||||
DWORD dwOffset = m_dwQuadsToFlush*12;
|
||||
m_rgflQuadsData[dwOffset] = -1.f;
|
||||
m_rgflQuadsData[dwOffset+1] = -fHeight;
|
||||
m_rgflQuadsData[dwOffset+2] = -2.f;
|
||||
|
||||
m_rgflQuadsData[dwOffset+3] = 1.f;
|
||||
m_rgflQuadsData[dwOffset+4] = -fHeight;
|
||||
m_rgflQuadsData[dwOffset+5] = -2.f;
|
||||
|
||||
m_rgflQuadsData[dwOffset+6] = 1.f;
|
||||
m_rgflQuadsData[dwOffset+7] = fHeight;
|
||||
m_rgflQuadsData[dwOffset+8] = -2.f;
|
||||
|
||||
m_rgflQuadsData[dwOffset+9] = -1.f;
|
||||
m_rgflQuadsData[dwOffset+10] = fHeight;
|
||||
m_rgflQuadsData[dwOffset+11] = -2.f;
|
||||
|
||||
uint32 dwColor = 0xFFFFFFFF;
|
||||
dwOffset = m_dwQuadsToFlush*16;
|
||||
m_rgflQuadsColorData[dwOffset] = COLOR_RED( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+1] = COLOR_GREEN( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+2] = COLOR_BLUE( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+3] = COLOR_ALPHA( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+4] = COLOR_RED( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+5] = COLOR_GREEN( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+6] = COLOR_BLUE( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+7] = COLOR_ALPHA( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+8] = COLOR_RED( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+9] = COLOR_GREEN( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+10] = COLOR_BLUE( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+11] = COLOR_ALPHA( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+12] = COLOR_RED( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+13] = COLOR_GREEN( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+14] = COLOR_BLUE( dwColor );
|
||||
m_rgflQuadsColorData[dwOffset+15] = COLOR_ALPHA( dwColor );
|
||||
|
||||
dwOffset = m_dwQuadsToFlush*8;
|
||||
m_rgflQuadsTextureData[dwOffset] = 0;
|
||||
m_rgflQuadsTextureData[dwOffset+1] = 0;
|
||||
m_rgflQuadsTextureData[dwOffset+2] = 1.f;
|
||||
m_rgflQuadsTextureData[dwOffset+3] = 0;
|
||||
m_rgflQuadsTextureData[dwOffset+4] = 1.f;
|
||||
m_rgflQuadsTextureData[dwOffset+5] = 1.f;
|
||||
m_rgflQuadsTextureData[dwOffset+6] = 0;
|
||||
m_rgflQuadsTextureData[dwOffset+7] = 1.f;
|
||||
|
||||
|
||||
++m_dwQuadsToFlush;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Flush buffered quads
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1200,7 +1035,7 @@ void CGameEngineGL::MessagePump()
|
||||
}
|
||||
else if ( event.type == SDL_QUIT )
|
||||
{
|
||||
CreateGameEngineSDL( false )->Shutdown();
|
||||
CreateGameEngineSDL( )->Shutdown();
|
||||
}
|
||||
|
||||
} while ( !BShuttingDown() );
|
||||
|
||||
@@ -60,14 +60,13 @@ typedef unsigned char byte;
|
||||
|
||||
class CVoiceContext;
|
||||
class GLString;
|
||||
class CSteamVRGLHelper;
|
||||
|
||||
class CGameEngineGL : public IGameEngine
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
CGameEngineGL( bool bUseVR );
|
||||
CGameEngineGL( );
|
||||
|
||||
// Destructor
|
||||
~CGameEngineGL() { Shutdown(); }
|
||||
@@ -178,9 +177,6 @@ public:
|
||||
|
||||
void UpdateKey( uint32_t vkKey, int nDown );
|
||||
|
||||
// draw the VR screen quad in the world
|
||||
bool BDrawVRScreenQuad();
|
||||
|
||||
// Tracks whether the engine is ready for use
|
||||
bool m_bEngineReadyForUse;
|
||||
|
||||
@@ -255,10 +251,6 @@ public:
|
||||
std::map<HGAMEVOICECHANNEL, CVoiceContext* > m_MapVoiceChannel;
|
||||
uint32 m_unVoiceChannelCount;
|
||||
|
||||
// handle to the Steamworks VR HMD interface
|
||||
vr::IHmd *m_pHmd;
|
||||
CSteamVRGLHelper *m_pVRGLHelper;
|
||||
|
||||
};
|
||||
|
||||
#endif // GAMEENGINESDL_H
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "GameEngineWin32.h"
|
||||
#include <map>
|
||||
#include "steam/steamvr.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
@@ -127,7 +126,7 @@ public:
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor for game engine instance
|
||||
//-----------------------------------------------------------------------------
|
||||
CGameEngineWin32::CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32 nWindowWidth, int32 nWindowHeight, bool bUseVR )
|
||||
CGameEngineWin32::CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32 nWindowWidth, int32 nWindowHeight )
|
||||
{
|
||||
m_bEngineReadyForUse = false;
|
||||
m_bShuttingDown = false;
|
||||
@@ -169,24 +168,6 @@ CGameEngineWin32::CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32
|
||||
m_ulGameTickCount = 0;
|
||||
m_dwBackgroundColor = D3DCOLOR_ARGB(0, 255, 255, 255 );
|
||||
m_pBackbufferDepth = NULL;
|
||||
m_hVRDistortionMap[0] = NULL;
|
||||
m_hVRDistortionMap[1] = NULL;
|
||||
m_pVRDistortionPixelShader = NULL;
|
||||
|
||||
if ( !bUseVR )
|
||||
{
|
||||
m_pVRHmd = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
vr::HmdError error;
|
||||
m_pVRHmd = vr::VR_Init( &error );
|
||||
if ( !m_pVRHmd )
|
||||
{
|
||||
::MessageBoxA( NULL, "Failed to initialize VR.\n\nGame will now exit.", "SteamworksExample - Fatal error", MB_OK | MB_ICONERROR );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// for XAudio2
|
||||
CoInitializeEx( NULL, COINIT_MULTITHREADED );
|
||||
@@ -217,28 +198,10 @@ CGameEngineWin32::CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_pVRHmd )
|
||||
{
|
||||
// these sizes are used for the 2D rendering
|
||||
m_nViewportWidth = 640;
|
||||
m_nViewportHeight = 480;
|
||||
m_hVR2DRenderTarget = HCreateTexture( NULL, m_nViewportWidth, m_nViewportHeight );
|
||||
|
||||
uint32 w, h;
|
||||
m_pVRHmd->GetRecommendedRenderTargetSize( &w, &h );
|
||||
m_hVRSceneRenderTarget = HCreateTexture( NULL, w, h );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT r;
|
||||
::GetClientRect( m_hWnd, &r );
|
||||
m_nViewportWidth = r.right - r.left;
|
||||
m_nViewportHeight = r.bottom - r.top;
|
||||
|
||||
m_hVR2DRenderTarget = NULL;
|
||||
m_hVRSceneRenderTarget = NULL;
|
||||
}
|
||||
RECT r;
|
||||
::GetClientRect( m_hWnd, &r );
|
||||
m_nViewportWidth = r.right - r.left;
|
||||
m_nViewportHeight = r.bottom - r.top;
|
||||
|
||||
// initialize XAudio2 interface
|
||||
if( FAILED( XAudio2Create( &m_pXAudio2, 0 ) ) )
|
||||
@@ -318,7 +281,6 @@ void CGameEngineWin32::Shutdown()
|
||||
SAFE_RELEASE( m_pD3D9Device );
|
||||
SAFE_RELEASE( m_pD3D9Interface );
|
||||
SAFE_RELEASE( m_pXAudio2 );
|
||||
SAFE_RELEASE( m_pVRDistortionPixelShader );
|
||||
|
||||
// Destroy our window
|
||||
if ( m_hWnd )
|
||||
@@ -353,12 +315,6 @@ void CGameEngineWin32::Shutdown()
|
||||
}
|
||||
|
||||
CoUninitialize();
|
||||
|
||||
if ( m_pVRHmd )
|
||||
{
|
||||
vr::VR_Shutdown();
|
||||
m_pVRHmd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -435,13 +391,6 @@ bool CGameEngineWin32::BHandleLostDevice()
|
||||
}
|
||||
}
|
||||
|
||||
// if we have a VR shader, free it We'll re-create it on demand
|
||||
if ( m_pVRDistortionPixelShader )
|
||||
{
|
||||
m_pVRDistortionPixelShader->Release();
|
||||
m_pVRDistortionPixelShader = NULL;
|
||||
}
|
||||
|
||||
return bFullySuccessful;
|
||||
}
|
||||
|
||||
@@ -567,17 +516,6 @@ bool CGameEngineWin32::BCreateGameWindow( int nShowCommand )
|
||||
int windowX = 0;
|
||||
int windowY = 0;
|
||||
|
||||
if ( m_pVRHmd )
|
||||
{
|
||||
int32 x, y;
|
||||
uint32 w, h;
|
||||
m_pVRHmd->GetWindowBounds( &x, &y, &w, &h );
|
||||
m_nWindowWidth = w;
|
||||
m_nWindowHeight = h;
|
||||
windowX = x;
|
||||
windowY = y;
|
||||
}
|
||||
|
||||
WNDCLASS wc;
|
||||
DWORD style;
|
||||
|
||||
@@ -600,10 +538,7 @@ bool CGameEngineWin32::BCreateGameWindow( int nShowCommand )
|
||||
}
|
||||
|
||||
// Set parent window mode (normal system window with overlap/draw-ordering)
|
||||
if ( m_pVRHmd )
|
||||
style = WS_POPUP;
|
||||
else
|
||||
style = WS_OVERLAPPED|WS_SYSMENU;
|
||||
style = WS_OVERLAPPED|WS_SYSMENU;
|
||||
|
||||
// Create actual window
|
||||
m_hWnd = CreateWindow( "SteamworksExample",
|
||||
@@ -669,10 +604,6 @@ bool CGameEngineWin32::BInitializeD3D9()
|
||||
m_d3dpp.BackBufferFormat = d3ddisplaymode.Format;
|
||||
|
||||
UINT nAdapter = D3DADAPTER_DEFAULT;
|
||||
if ( m_pVRHmd )
|
||||
{
|
||||
nAdapter = m_pVRHmd->GetD3D9AdapterIndex();
|
||||
}
|
||||
|
||||
// Create Direct3D9 device
|
||||
// (if it fails to create hardware vertex processing, then go with the software alternative).
|
||||
@@ -803,24 +734,10 @@ bool CGameEngineWin32::StartFrame()
|
||||
if ( FAILED( hRes ) )
|
||||
return false;
|
||||
|
||||
// if we're in VR mode, set the 2D offscreen rendertarget
|
||||
if ( m_pVRHmd )
|
||||
{
|
||||
if ( !BSetRenderTarget( m_hVR2DRenderTarget ) )
|
||||
return false;
|
||||
|
||||
// Clear the back buffer and z-buffer with an opaque color
|
||||
hRes = m_pD3D9Device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 255, 0, 0, 0), 1.0f, 0 );
|
||||
if ( FAILED( hRes ) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the back buffer and z-buffer
|
||||
hRes = m_pD3D9Device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, m_dwBackgroundColor, 1.0f, 0 );
|
||||
if ( FAILED( hRes ) )
|
||||
return false;
|
||||
}
|
||||
// Clear the back buffer and z-buffer
|
||||
hRes = m_pD3D9Device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, m_dwBackgroundColor, 1.0f, 0 );
|
||||
if ( FAILED( hRes ) )
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
@@ -859,141 +776,6 @@ void CGameEngineWin32::EndFrame()
|
||||
BFlushQuadBuffer();
|
||||
|
||||
// draw the VR mode offscreen render target on a quad somewhere
|
||||
if ( m_pVRHmd )
|
||||
{
|
||||
// make sure we have a distortion shader
|
||||
if ( !m_pVRDistortionPixelShader )
|
||||
{
|
||||
if ( !BInitializeVRShader() )
|
||||
{
|
||||
OutputDebugString( "Unable to init VR shader\n" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// draw some lines around the edge of the "screen" in the 2D texture so that it's very obvious
|
||||
// where the boundary is to aid stereo fusion
|
||||
DWORD dwBorderColor = D3DCOLOR_ARGB( 255, 128, 128, 128 );
|
||||
float fViewWidth = (float)GetViewportWidth();
|
||||
float fViewHeight = (float)GetViewportHeight();
|
||||
|
||||
for ( float f = 0; f < 5.f; f += 1.f )
|
||||
{
|
||||
BDrawLine( 0 + f, 0 + f, dwBorderColor, fViewWidth - f, 0 + f, dwBorderColor );
|
||||
BDrawLine( 0 + f, fViewHeight - f, dwBorderColor, fViewWidth - f, fViewHeight - f, dwBorderColor );
|
||||
BDrawLine( 0 + f, 0 + f, dwBorderColor, 0 + f, fViewHeight - f, dwBorderColor );
|
||||
BDrawLine( fViewWidth - f, 0 + f, dwBorderColor, fViewWidth - f, fViewHeight - f, dwBorderColor );
|
||||
}
|
||||
BFlushLineBuffer();
|
||||
|
||||
// Clear the frame buffer
|
||||
BUnsetRenderTarget();
|
||||
hRes = m_pD3D9Device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, m_dwBackgroundColor, 1.0f, 0 );
|
||||
|
||||
float fHeight = (float)GetViewportHeight( ) / (float)GetViewportWidth( );
|
||||
Textured3DQuadVertex_t vScreenQuad[4] =
|
||||
{
|
||||
{
|
||||
-1.f, fHeight, -2.f,
|
||||
0xFFFFFFFF,
|
||||
0.f, 0.f,
|
||||
},
|
||||
{
|
||||
1.f, fHeight , -2.f,
|
||||
0xFFFFFFFF,
|
||||
1.f, 0.f,
|
||||
},
|
||||
{
|
||||
-1.f, -fHeight , -2.f,
|
||||
0xFFFFFFFF,
|
||||
0.f, 1.f,
|
||||
},
|
||||
{
|
||||
1.f, -fHeight , -2.f,
|
||||
0xFFFFFFFF,
|
||||
1.f, 1.f,
|
||||
}
|
||||
};
|
||||
Textured3DQuadVertex_t vScreenQuadInverse[4];
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
vScreenQuadInverse[i] = vScreenQuad[3 - i];
|
||||
}
|
||||
|
||||
vr::HmdTrackingResult eResult;
|
||||
vr::HmdMatrix44_t matLeftView, matRightView;
|
||||
bool bGotPose = m_pVRHmd->GetViewMatrix( 0, &matLeftView, &matRightView, &eResult );
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
|
||||
vr::Hmd_Eye eye = (vr::Hmd_Eye)i;
|
||||
|
||||
if ( !BSetRenderTarget( m_hVRSceneRenderTarget ) )
|
||||
{
|
||||
OutputDebugString( "Unable to set scene render target\n" );
|
||||
return;
|
||||
}
|
||||
hRes = m_pD3D9Device->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB( 0, 50, 50, 50 ), 1.0f, 0 );
|
||||
|
||||
if ( !m_hTextureWhite )
|
||||
{
|
||||
byte *pRGBAData = new byte[1 * 1 * 4];
|
||||
memset( pRGBAData, 255, 1 * 1 * 4 );
|
||||
m_hTextureWhite = HCreateTexture( pRGBAData, 1, 1 );
|
||||
delete[] pRGBAData;
|
||||
}
|
||||
|
||||
vr::HmdMatrix44_t matProjection = m_pVRHmd->GetProjectionMatrix( eye, 0.1f, 100.f, vr::API_DirectX );
|
||||
D3DXMATRIX matD3DProj = D3DXMATRIX( &matProjection.m[0][0] );
|
||||
D3DXMATRIX matD3DProj_transposed;
|
||||
D3DXMatrixTranspose( &matD3DProj_transposed, &matD3DProj );
|
||||
m_pD3D9Device->SetTransform( D3DTS_PROJECTION, &matD3DProj_transposed );
|
||||
|
||||
D3DXMATRIX matD3DView;
|
||||
if ( eye == vr::Eye_Left )
|
||||
matD3DView = D3DXMATRIX( &matLeftView.m[0][0] );
|
||||
else
|
||||
matD3DView = D3DXMATRIX( &matRightView.m[0][0] );
|
||||
D3DXMATRIX matD3DView_transposed;
|
||||
D3DXMatrixTranspose( &matD3DView_transposed, &matD3DView );
|
||||
m_pD3D9Device->SetTransform( D3DTS_VIEW, &matD3DView_transposed );
|
||||
|
||||
|
||||
// draw the 2D texture on a quad into the 3D render target
|
||||
BDraw3DTexturedQuad( vScreenQuad, m_hVR2DRenderTarget );
|
||||
//BDraw3DTexturedQuad( vScreenQuadInverse, m_hVR2DRenderTarget );
|
||||
BFlush3DQuadBuffer( );
|
||||
|
||||
// now draw the scene to the frame buffer with the distortion texture
|
||||
BUnsetRenderTarget();
|
||||
|
||||
// get the viewport from the Hmd
|
||||
uint32 vpx, vpy, vpw, vph;
|
||||
m_pVRHmd->GetEyeOutputViewport( eye, &vpx, &vpy, &vpw, &vph );
|
||||
|
||||
if ( FAILED( m_pD3D9Device->SetPixelShader( m_pVRDistortionPixelShader ) ) )
|
||||
{
|
||||
OutputDebugString( "Couldn't set VR pixel shader\n" );
|
||||
}
|
||||
|
||||
if ( !BReadyTexture( m_hVRDistortionMap[i] ) )
|
||||
{
|
||||
OutputDebugString( "Couldn't ready distortion map\n" );
|
||||
}
|
||||
if ( FAILED( m_pD3D9Device->SetTexture( 1, m_MapTextures[m_hVRDistortionMap[i]].m_pTexture ) ) )
|
||||
{
|
||||
OutputDebugString( "Couldn't set distortion map\n" );
|
||||
}
|
||||
|
||||
|
||||
BDrawTexturedRect( (float)vpx, (float)vpy, (float)(vpx + vpw), (float)(vpy + vph), 0, 0, 1.f, 1.f, D3DCOLOR_ARGB( 255, 255, 255, 255 ), m_hVRSceneRenderTarget );
|
||||
BFlushQuadBuffer();
|
||||
|
||||
m_pD3D9Device->SetTexture( 1, NULL );
|
||||
m_pD3D9Device->SetPixelShader( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
hRes = m_pD3D9Device->EndScene();
|
||||
if ( FAILED( hRes ) )
|
||||
{
|
||||
@@ -2539,180 +2321,3 @@ bool CGameEngineWin32::BUnsetRenderTarget()
|
||||
}
|
||||
|
||||
|
||||
// Quick and dirty wrapper for working with UV coordinates.
|
||||
template<typename T>
|
||||
struct TUV
|
||||
{
|
||||
T x, y;
|
||||
TUV() {}
|
||||
TUV( T _x, T _y )
|
||||
: x( _x ), y( _y ) {}
|
||||
TUV( const float a[2] )
|
||||
: x( a[0] ), y( a[1] ) {}
|
||||
TUV( const TUV& other )
|
||||
: x( other.x ), y( other.y ) {}
|
||||
inline TUV operator*(T scale) const
|
||||
{
|
||||
return TUV( x * scale, y * scale );
|
||||
}
|
||||
inline TUV operator+(const TUV& other) const
|
||||
{
|
||||
return TUV( x + other.x, y + other.y );
|
||||
}
|
||||
inline TUV operator-(const TUV& other) const
|
||||
{
|
||||
return TUV( x - other.x, y - other.y );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline TUV<T> operator*(T scale, const TUV<T> v)
|
||||
{
|
||||
return TUV<T>( scale * v.x, scale * v.y );
|
||||
}
|
||||
|
||||
typedef TUV<float> UVf;
|
||||
typedef TUV<double> UVd;
|
||||
|
||||
// Loads the VR distortion shader off disk
|
||||
bool CGameEngineWin32::BInitializeVRShader()
|
||||
{
|
||||
if ( !m_pVRHmd )
|
||||
{
|
||||
OutputDebugString( "Don't call BInitializeVRShader unless the game is in VR mode\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
char szCurDir[MAX_PATH];
|
||||
_getcwd( szCurDir, sizeof(szCurDir) );
|
||||
char szShaderPath[MAX_PATH];
|
||||
sprintf_safe( szShaderPath, "%s\\D3D9VRDistort.cso", szCurDir );
|
||||
|
||||
FILE *pFile = fopen( szShaderPath, "rb" );
|
||||
if ( !pFile )
|
||||
{
|
||||
OutputDebugString( "Failed opening D3D9Overlay.cso for reading\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Figure out the filesize
|
||||
fseek( pFile, 0, SEEK_END );
|
||||
size_t lSize = ftell( pFile );
|
||||
bool bSuccess = false;
|
||||
rewind( pFile );
|
||||
if ( lSize )
|
||||
{
|
||||
// Allocate a buffer to read the file into
|
||||
char *rgchBuffer = new char[lSize];
|
||||
if ( !rgchBuffer )
|
||||
{
|
||||
OutputDebugString( "Memory allocation failure\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t result = fread( rgchBuffer, 1, lSize, pFile );
|
||||
if ( result != lSize )
|
||||
{
|
||||
OutputDebugString( "Failed reading from cso file\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
HRESULT hRes = m_pD3D9Device->CreatePixelShader( (DWORD*)rgchBuffer, &m_pVRDistortionPixelShader );
|
||||
if ( SUCCEEDED( hRes ) && m_pVRDistortionPixelShader )
|
||||
{
|
||||
OutputDebugString( "Created IDirect3DPixelShader9 from memory ok!\n" );
|
||||
bSuccess = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDebugString( "Creating effect from memory failed!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
delete[] rgchBuffer;
|
||||
}
|
||||
}
|
||||
fclose( pFile );
|
||||
|
||||
if ( !bSuccess )
|
||||
return false;
|
||||
|
||||
int nDistSize = 128;
|
||||
int elem_span = 4;
|
||||
|
||||
struct DistortionSample_t
|
||||
{
|
||||
uint16 redU;
|
||||
uint16 redV;
|
||||
uint16 blueU;
|
||||
uint16 blueV;
|
||||
};
|
||||
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
// we only need to do this once
|
||||
if ( m_hVRDistortionMap[i] != 0 )
|
||||
continue;
|
||||
|
||||
vr::Hmd_Eye eye = (vr::Hmd_Eye)i;
|
||||
|
||||
uint16 *pData = (uint16 *)malloc( sizeof(uint16)* elem_span * nDistSize * nDistSize );
|
||||
|
||||
for ( int yi = 0; yi < nDistSize; yi++ )
|
||||
{
|
||||
const float v = (yi + 0.5f) / (float)nDistSize;
|
||||
for ( int xi = 0; xi < nDistSize; xi++ )
|
||||
{
|
||||
const float u = (xi + 0.5f) / (float)nDistSize;
|
||||
|
||||
vr::DistortionCoordinates_t coords = m_pVRHmd->ComputeDistortion( eye, u, v );
|
||||
UVf samp_red( coords.rfRed );
|
||||
UVf samp_green( coords.rfGreen );
|
||||
UVf samp_blue( coords.rfBlue );
|
||||
|
||||
static const float rg_to_rb_ratio = 0.522f;
|
||||
UVf red_to_blue = samp_blue - samp_red;
|
||||
UVf tex_samp_red = samp_green - rg_to_rb_ratio * red_to_blue;
|
||||
UVf tex_samp_blue = samp_green + (1 - rg_to_rb_ratio) * red_to_blue;
|
||||
|
||||
if ( tex_samp_red.x < 0.0 || tex_samp_blue.x < 0.0 )
|
||||
{
|
||||
tex_samp_red.x = tex_samp_blue.x = 0.0;
|
||||
}
|
||||
|
||||
if ( tex_samp_red.x > 1.0 || tex_samp_blue.x > 1.0 )
|
||||
{
|
||||
tex_samp_red.x = tex_samp_blue.x = 1.0;
|
||||
}
|
||||
|
||||
if ( tex_samp_red.y < 0.0 || tex_samp_blue.y < 0.0 )
|
||||
{
|
||||
tex_samp_red.y = tex_samp_blue.y = 0.0;
|
||||
}
|
||||
|
||||
if ( tex_samp_red.y > 1.0 || tex_samp_blue.y > 1.0 )
|
||||
{
|
||||
tex_samp_red.y = tex_samp_blue.y = 1.0;
|
||||
}
|
||||
|
||||
int idx = yi * nDistSize + xi;
|
||||
|
||||
pData[idx * elem_span + 0] = (uint16)(tex_samp_red.x * 65535.f );
|
||||
pData[idx * elem_span + 1] = (uint16)(tex_samp_red.y * 65535.f );
|
||||
pData[idx * elem_span + 2] = (uint16)(tex_samp_blue.x * 65535.f );
|
||||
pData[idx * elem_span + 3] = (uint16)(tex_samp_blue.y * 65535.f );
|
||||
}
|
||||
}
|
||||
|
||||
m_hVRDistortionMap[i] = HCreateTexture( (byte *)pData, nDistSize, nDistSize, eTextureFormat_BGRA16 );
|
||||
free( pData );
|
||||
if ( !m_hVRDistortionMap[i] )
|
||||
{
|
||||
OutputDebugString( "Unable to create distortion texture\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
static void RemoveInstanceFromHWNDMap( HWND hWnd );
|
||||
|
||||
// Constructor
|
||||
CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32 nWindowWidth, int32 nWindowHeight, bool bUseVR );
|
||||
CGameEngineWin32( HINSTANCE hInstance, int nShowCommand, int32 nWindowWidth, int32 nWindowHeight );
|
||||
|
||||
// Destructor
|
||||
~CGameEngineWin32() { Shutdown(); }
|
||||
@@ -247,9 +247,6 @@ private:
|
||||
// Handle reseting the d3d device (ie, acquire resources again)
|
||||
bool BHandleResetDevice();
|
||||
|
||||
// Loads the VR distortion shader off disk
|
||||
bool BInitializeVRShader();
|
||||
|
||||
private:
|
||||
// Tracks whether the engine is ready for use
|
||||
bool m_bEngineReadyForUse;
|
||||
@@ -257,9 +254,6 @@ private:
|
||||
// Tracks if we are shutting down
|
||||
bool m_bShuttingDown;
|
||||
|
||||
// if this is not NULL we are in VR mode
|
||||
vr::IHmd *m_pVRHmd;
|
||||
|
||||
// Color we clear the background of the window to each frame
|
||||
DWORD m_dwBackgroundColor;
|
||||
|
||||
@@ -318,12 +312,6 @@ private:
|
||||
};
|
||||
std::map<HGAMETEXTURE, TextureData_t> m_MapTextures;
|
||||
|
||||
// the render target we draw the 2D game into for VR
|
||||
HGAMETEXTURE m_hVR2DRenderTarget;
|
||||
|
||||
// the render target we draw the 3D scene into for VR
|
||||
HGAMETEXTURE m_hVRSceneRenderTarget;
|
||||
|
||||
// Vertex buffer for textured quads
|
||||
HGAMEVERTBUF m_hQuadBuffer;
|
||||
|
||||
@@ -414,12 +402,6 @@ private:
|
||||
// Map of font handles to font objects
|
||||
std::map<HGAMEVOICECHANNEL, CVoiceContext* > m_MapVoiceChannel;
|
||||
uint32 m_unVoiceChannelCount;
|
||||
|
||||
// Pixel shader for VR distortion correction
|
||||
IDirect3DPixelShader9* m_pVRDistortionPixelShader;
|
||||
|
||||
// the distortion map used by the VR distortion pixel shader (one per eye)
|
||||
HGAMETEXTURE m_hVRDistortionMap[2];
|
||||
};
|
||||
|
||||
#endif // GAMEENGINEWIN32_H
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
float c_rg_to_rb_ratio = 0.522;
|
||||
|
||||
sampler2D BaseTextureSampler : register(s0);
|
||||
sampler2D DistortMapTextureSampler : register(s1);
|
||||
|
||||
struct Fullscreen_Quad_Vert {
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord: TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct Distort_Out
|
||||
{
|
||||
float4 color: COLOR;
|
||||
};
|
||||
|
||||
Distort_Out PS(Fullscreen_Quad_Vert input)
|
||||
{
|
||||
float2 vOriginal = input.texcoord;
|
||||
|
||||
float4 vRead = tex2D( DistortMapTextureSampler, vOriginal );
|
||||
|
||||
float2 vGreen;
|
||||
vGreen.r = ( vRead.x + vRead.z ) / 2;
|
||||
vGreen.g = ( vRead.y + vRead.w ) / 2;
|
||||
|
||||
float4 vFinal;
|
||||
vFinal.r = tex2D( BaseTextureSampler, vRead.xy ).r;
|
||||
vFinal.ga = tex2D( BaseTextureSampler, vGreen ).ga;
|
||||
vFinal.b = tex2D( BaseTextureSampler, vRead.zw ).b;
|
||||
|
||||
float fBoundsCheck = saturate( dot( (vGreen.xy < float2(0.05,0.05)), float2(1,1)) + dot( (vGreen.xy > float2(0.95,0.95)), float2(1,1)) );
|
||||
vFinal.xyz = lerp( vFinal.xyz, float3(0,0,0), fBoundsCheck );
|
||||
|
||||
Distort_Out o;
|
||||
o.color = vFinal;
|
||||
return o;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
fxc /E PS /T ps_3_0 /O3 /Gfa /Fo ..\D3D9VRDistort.cso D3D9VRDistort.ps
|
||||
@@ -1,487 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include "steamvrglhelper.h"
|
||||
|
||||
|
||||
using vr::HmdMatrix44_t;
|
||||
using vr::HmdMatrix34_t;
|
||||
|
||||
|
||||
CSteamVRGLHelper::CSteamVRGLHelper()
|
||||
{
|
||||
m_UIRenderTarget = 0;
|
||||
m_UIRenderTargetTexture = 0;
|
||||
|
||||
m_PredistortRenderTarget = 0;
|
||||
m_PredistortRenderTargetDepth = 0;
|
||||
m_PredistortRenderTargetTexture = 0;
|
||||
|
||||
m_bDistortionInitialized = false;
|
||||
m_rgflQuadData = NULL;
|
||||
m_rgflQuadColorData = NULL;
|
||||
m_rgflQuadTextureData = NULL;
|
||||
}
|
||||
|
||||
CSteamVRGLHelper::~CSteamVRGLHelper()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSteamVRGLHelper::BInit( vr::IHmd *pHmd )
|
||||
{
|
||||
m_pHmd = pHmd;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSteamVRGLHelper::Shutdown()
|
||||
{
|
||||
if( m_UIRenderTarget != 0 )
|
||||
{
|
||||
glDeleteTextures( 1, &m_UIRenderTargetTexture );
|
||||
glDeleteFramebuffers( 1, &m_UIRenderTarget );
|
||||
|
||||
m_UIRenderTarget = 0;
|
||||
m_UIRenderTargetTexture = 0;
|
||||
}
|
||||
|
||||
if( m_PredistortRenderTarget != 0 )
|
||||
{
|
||||
glDeleteTextures( 1, &m_PredistortRenderTargetTexture );
|
||||
glDeleteFramebuffers( 1, &m_PredistortRenderTargetDepth );
|
||||
glDeleteFramebuffers( 1, &m_PredistortRenderTarget );
|
||||
|
||||
m_PredistortRenderTargetDepth = 0;
|
||||
m_PredistortRenderTargetTexture = 0;
|
||||
m_PredistortRenderTarget = 0;
|
||||
}
|
||||
|
||||
if( m_bDistortionInitialized )
|
||||
{
|
||||
glDeleteProgram( m_DistortShader );
|
||||
glDeleteTextures( 2, m_DistortTexture );
|
||||
|
||||
delete [] m_rgflQuadData;
|
||||
delete [] m_rgflQuadColorData;
|
||||
delete [] m_rgflQuadTextureData;
|
||||
m_rgflQuadData = NULL;
|
||||
m_rgflQuadColorData = NULL;
|
||||
m_rgflQuadTextureData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool CSteamVRGLHelper::InitUIRenderTarget( uint32_t unWidth, uint32_t unHeight )
|
||||
{
|
||||
if( m_UIRenderTarget != 0 )
|
||||
return false;
|
||||
|
||||
// create the frame buffer itself
|
||||
glGenFramebuffers(1, &m_UIRenderTarget);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_UIRenderTarget);
|
||||
|
||||
// The texture we're going to render to
|
||||
glGenTextures(1, &m_UIRenderTargetTexture);
|
||||
|
||||
// "Bind" the newly created texture : all future texture functions will modify this texture
|
||||
glBindTexture(GL_TEXTURE_2D, m_UIRenderTargetTexture);
|
||||
|
||||
// Give an empty image to OpenGL ( the last "0" )
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, unWidth, unHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
|
||||
// Set "renderedTexture" as our colour attachement #0
|
||||
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_UIRenderTargetTexture, 0 );
|
||||
|
||||
// Set the list of draw buffers.
|
||||
GLenum rDrawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDrawBuffers(ARRAYSIZE( rDrawBuffers ), rDrawBuffers);
|
||||
|
||||
m_unUIWidth = unWidth;
|
||||
m_unUIHeight = unHeight;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSteamVRGLHelper::BPushUIRenderTarget()
|
||||
{
|
||||
if( m_UIRenderTarget == 0 )
|
||||
return false;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_UIRenderTarget);
|
||||
glClearColor( 0, 0, 0, (float)1.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HmdMatrix_TransposeInPlace( HmdMatrix44_t & mat )
|
||||
{
|
||||
for( int x=0; x<3; x++ )
|
||||
{
|
||||
for( int y= x+1 ; y<4; y++ )
|
||||
{
|
||||
float tmp = mat.m[x][y];
|
||||
mat.m[x][y] = mat.m[y][x];
|
||||
mat.m[y][x] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSteamVRGLHelper::PushViewAndProjection( vr::Hmd_Eye eye, float fNearZ, float fFarZ, const vr::HmdMatrix34_t & matWorldFromHeadPose )
|
||||
{
|
||||
HmdMatrix44_t matProjection = m_pHmd->GetProjectionMatrix( eye, fNearZ, fFarZ, vr::API_OpenGL );
|
||||
|
||||
// Perspective
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
HmdMatrix_TransposeInPlace( matProjection );
|
||||
glLoadMatrixf( &matProjection.m[0][0] );
|
||||
|
||||
// to get the view matrix, we first need to turn the pose into a 4x4
|
||||
vr::HmdMatrix44_t matWorldFromHeadPose44;
|
||||
for( int y=0; y<4; y++ )
|
||||
{
|
||||
for( int x=0; x<3; x++ )
|
||||
matWorldFromHeadPose44.m[x][y] = matWorldFromHeadPose.m[x][y];
|
||||
matWorldFromHeadPose44.m[3][y] = 0;
|
||||
}
|
||||
matWorldFromHeadPose44.m[3][3] = 1.f;
|
||||
|
||||
// View matrix has changed as well
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadMatrixf( &matWorldFromHeadPose44.m[0][0] );
|
||||
HmdMatrix34_t matEye = m_pHmd->GetHeadFromEyePose( eye );
|
||||
glMultMatrixf( &matEye.m[0][0] );
|
||||
|
||||
}
|
||||
|
||||
bool CSteamVRGLHelper::BInitPredistortRenderTarget()
|
||||
{
|
||||
if( m_PredistortRenderTarget != 0 )
|
||||
return false;
|
||||
|
||||
m_pHmd->GetRecommendedRenderTargetSize( &m_unPredistortWidth, &m_unPredistortHeight );
|
||||
|
||||
// create the frame buffer itself
|
||||
glGenFramebuffers(1, &m_PredistortRenderTarget);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_PredistortRenderTarget);
|
||||
|
||||
// The texture we're going to render to
|
||||
glGenTextures(1, &m_PredistortRenderTargetTexture);
|
||||
|
||||
// "Bind" the newly created texture : all future texture functions will modify this texture
|
||||
glBindTexture(GL_TEXTURE_2D, m_PredistortRenderTargetTexture);
|
||||
|
||||
// Give an empty image to OpenGL ( the last "0" )
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_unPredistortWidth, m_unPredistortHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
|
||||
// The depth buffer
|
||||
glGenRenderbuffers(1, &m_PredistortRenderTargetDepth);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_PredistortRenderTargetDepth);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_unPredistortWidth, m_unPredistortHeight);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_PredistortRenderTargetDepth);
|
||||
|
||||
// Set "renderedTexture" as our colour attachement #0
|
||||
glFramebufferTexture( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_PredistortRenderTargetTexture, 0 );
|
||||
|
||||
// Set the list of draw buffers.
|
||||
GLenum rDrawBuffers[1] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDrawBuffers(ARRAYSIZE( rDrawBuffers ), rDrawBuffers);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CSteamVRGLHelper::PushPredistortRenderTarget()
|
||||
{
|
||||
if( m_PredistortRenderTarget == 0 )
|
||||
return;
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_PredistortRenderTarget);
|
||||
|
||||
glClearColor( 0.1f, 0.1f, 0.1f, (float)1.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
|
||||
glViewport( 0, 0, m_unPredistortWidth, m_unPredistortHeight );
|
||||
glScissor( 0, 0, m_unPredistortWidth, m_unPredistortHeight );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static const char* const g_pchVRFragmentShader = "GLOverlay_v0.frag";
|
||||
|
||||
static GLuint CreateShader(const char* pchFragmentShader)
|
||||
{
|
||||
char chFragmentShaderInfoLog[1024];
|
||||
char chProgramInfoLog[1024];
|
||||
chFragmentShaderInfoLog[0] = 0;
|
||||
chProgramInfoLog[0] = 0;
|
||||
GLuint nProgram = glCreateProgram();
|
||||
GLuint nFragmentShader = glCreateShader( GL_FRAGMENT_SHADER );
|
||||
glShaderSource( nFragmentShader, 1, &pchFragmentShader, NULL );
|
||||
glCompileShader( nFragmentShader );
|
||||
GLint nFragmentShaderCompiled;
|
||||
glGetShaderiv( nFragmentShader, GL_COMPILE_STATUS, &nFragmentShaderCompiled );
|
||||
glGetShaderInfoLog( nFragmentShader, sizeof( chFragmentShaderInfoLog ), NULL, chFragmentShaderInfoLog );
|
||||
glAttachShader( nProgram, nFragmentShader );
|
||||
glDeleteShader( nFragmentShader );
|
||||
glLinkProgram( nProgram );
|
||||
GLint nProgramLinked;
|
||||
glGetProgramiv( nProgram, GL_LINK_STATUS, &nProgramLinked );
|
||||
glGetProgramInfoLog( nProgram, sizeof( chProgramInfoLog ), NULL, chProgramInfoLog );
|
||||
if ( chFragmentShaderInfoLog[0] )
|
||||
{
|
||||
fprintf( stderr, "GLSL Fragment Shader log:\n" );
|
||||
fprintf( stderr, "%s\n", chFragmentShaderInfoLog );
|
||||
}
|
||||
if ( chProgramInfoLog[0] )
|
||||
{
|
||||
fprintf( stderr, "GLSL Program log:\n" );
|
||||
fprintf( stderr, "%s\n", chProgramInfoLog );
|
||||
}
|
||||
return nProgram;
|
||||
}
|
||||
|
||||
// Quick and dirty wrapper for working with UV coordinates.
|
||||
template<typename T>
|
||||
struct TUV
|
||||
{
|
||||
T x, y;
|
||||
TUV() {}
|
||||
TUV(T _x, T _y)
|
||||
: x(_x), y(_y) {}
|
||||
TUV(const float a[2])
|
||||
: x(a[0]), y(a[1]) {}
|
||||
TUV(const TUV& other)
|
||||
: x(other.x), y(other.y) {}
|
||||
inline TUV operator*(T scale) const
|
||||
{ return TUV(x * scale, y * scale); }
|
||||
inline TUV operator+(const TUV& other) const
|
||||
{ return TUV(x + other.x, y + other.y); }
|
||||
inline TUV operator-(const TUV& other) const
|
||||
{ return TUV(x - other.x, y - other.y); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline TUV<T> operator*(T scale, const TUV<T> v)
|
||||
{
|
||||
return TUV<T>(scale * v.x, scale * v.y);
|
||||
}
|
||||
|
||||
typedef TUV<float> UVf;
|
||||
typedef TUV<double> UVd;
|
||||
|
||||
template<typename T>
|
||||
void PopulateDistortionMap( vr::IHmd *pHmd, vr::Hmd_Eye eye, int width, int height, T* data, int elem_scale = (T)(-1) )
|
||||
{
|
||||
const int elem_count = 4;
|
||||
|
||||
for ( int yi = 0; yi < height; yi++ )
|
||||
{
|
||||
const float v = ( yi + 0.5f ) / height;
|
||||
for ( int xi = 0; xi < width; xi++ )
|
||||
{
|
||||
const float u = ( xi + 0.5f ) / width;
|
||||
|
||||
vr::DistortionCoordinates_t coords = pHmd->ComputeDistortion(eye, u, v);
|
||||
UVf samp_red(coords.rfRed);
|
||||
UVf samp_green(coords.rfGreen);
|
||||
UVf samp_blue(coords.rfBlue);
|
||||
|
||||
static const float rg_to_rb_ratio = 0.522f;
|
||||
UVf red_to_blue = samp_blue - samp_red;
|
||||
UVf tex_samp_red = samp_green - rg_to_rb_ratio * red_to_blue;
|
||||
UVf tex_samp_blue = samp_green + (1-rg_to_rb_ratio) * red_to_blue;
|
||||
|
||||
if ( tex_samp_red.x < 0.0 || tex_samp_blue.x < 0.0 )
|
||||
{
|
||||
tex_samp_red.x = tex_samp_blue.x = 0.0;
|
||||
}
|
||||
|
||||
if ( tex_samp_red.x > 1.0 || tex_samp_blue.x > 1.0 )
|
||||
{
|
||||
tex_samp_red.x = tex_samp_blue.x = 1.0;
|
||||
}
|
||||
|
||||
if ( tex_samp_red.y < 0.0 || tex_samp_blue.y < 0.0 )
|
||||
{
|
||||
tex_samp_red.y = tex_samp_blue.y = 0.0;
|
||||
}
|
||||
|
||||
if ( tex_samp_red.y > 1.0 || tex_samp_blue.y > 1.0 )
|
||||
{
|
||||
tex_samp_red.y = tex_samp_blue.y = 1.0;
|
||||
}
|
||||
|
||||
int idx = yi * width + xi;
|
||||
|
||||
data[ idx * elem_count + 0 ] = (T)(tex_samp_red.x * elem_scale + 0.5f);
|
||||
data[ idx * elem_count + 1 ] = (T)(tex_samp_red.y * elem_scale + 0.5f);
|
||||
data[ idx * elem_count + 2 ] = (T)(tex_samp_blue.x * elem_scale + 0.5f);
|
||||
data[ idx * elem_count + 3 ] = (T)(tex_samp_blue.y * elem_scale + 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CSteamVRGLHelper::InitDistortion()
|
||||
{
|
||||
if( m_bDistortionInitialized )
|
||||
return;
|
||||
|
||||
// init the quad
|
||||
uint32_t x, y, w, h;
|
||||
m_pHmd->GetEyeOutputViewport( vr::Eye_Left, &x, &y, &w, &h );
|
||||
|
||||
m_rgflQuadData = new GLfloat[ 4 * 3];
|
||||
m_rgflQuadColorData = new GLubyte[ 4 * 4 ];
|
||||
m_rgflQuadTextureData = new GLfloat[ 4 * 2 ];
|
||||
|
||||
m_rgflQuadData[0 + 0] = 0;
|
||||
m_rgflQuadData[0 + 1] = h;
|
||||
m_rgflQuadData[0 + 2] = 1;
|
||||
|
||||
m_rgflQuadTextureData[0 + 0] = 0;
|
||||
m_rgflQuadTextureData[0 + 1] = 0;
|
||||
|
||||
m_rgflQuadData[3 + 0] = w;
|
||||
m_rgflQuadData[3 + 1] = h;
|
||||
m_rgflQuadData[3 + 2] = 1;
|
||||
|
||||
m_rgflQuadTextureData[2 + 0] = 1.f;
|
||||
m_rgflQuadTextureData[2 + 1] = 0;
|
||||
|
||||
m_rgflQuadData[6 + 0] = w;
|
||||
m_rgflQuadData[6 + 1] = 0;
|
||||
m_rgflQuadData[6 + 2] = 1;
|
||||
|
||||
m_rgflQuadTextureData[4 + 0] = 1.f;
|
||||
m_rgflQuadTextureData[4 + 1] = 1.f;
|
||||
|
||||
m_rgflQuadData[9 + 0] = 0;
|
||||
m_rgflQuadData[9 + 1] = 0;
|
||||
m_rgflQuadData[9 + 2] = 1;
|
||||
|
||||
m_rgflQuadTextureData[6 + 0] = 0;
|
||||
m_rgflQuadTextureData[6 + 1] = 1.f;
|
||||
|
||||
memset( m_rgflQuadColorData, 0xFFFFFFFF, sizeof( GLubyte ) * 4 * 4 );
|
||||
|
||||
// init the distortion textures
|
||||
const uint32 unDistortMapSize = 128;
|
||||
uint16* pData = new uint16[unDistortMapSize * unDistortMapSize * 4];
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
vr::Hmd_Eye eye = (vr::Hmd_Eye)i;
|
||||
|
||||
PopulateDistortionMap( m_pHmd, eye, unDistortMapSize, unDistortMapSize, pData);
|
||||
|
||||
glGenTextures( 1, &m_DistortTexture[ i ] );
|
||||
glBindTexture( GL_TEXTURE_2D, m_DistortTexture[ i ] );
|
||||
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0 );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS_EXT, 0.0 );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0 );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
|
||||
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA16, unDistortMapSize, unDistortMapSize, 0, GL_RGBA, GL_UNSIGNED_SHORT, (void *)pData );
|
||||
}
|
||||
delete [] pData;
|
||||
|
||||
// init the distortion shader
|
||||
FILE *fileShader = fopen( "shaders/GLVRDistort.glsl", "r" );
|
||||
if( !fileShader )
|
||||
{
|
||||
fprintf( stderr, "Unable to load saders/GLVRDistort.glsl for VR distortion correction\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
fseek( fileShader, 0, SEEK_END );
|
||||
long size = ftell( fileShader );
|
||||
fseek( fileShader, 0, SEEK_SET );
|
||||
|
||||
char *pchFile = new char[size+1];
|
||||
fread( pchFile, size, 1, fileShader );
|
||||
pchFile[ size ] = 0;
|
||||
|
||||
|
||||
m_DistortShader = CreateShader( pchFile );
|
||||
|
||||
m_DistortColorSampler = glGetUniformLocation( m_DistortShader, "BaseTextureSampler" );
|
||||
m_DistortMapSampler = glGetUniformLocation( m_DistortShader, "DistortMapTextureSampler" );
|
||||
|
||||
delete [] pchFile;
|
||||
}
|
||||
|
||||
// don't do this again
|
||||
m_bDistortionInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
void CSteamVRGLHelper::DrawPredistortToFrameBuffer( vr::Hmd_Eye eye )
|
||||
{
|
||||
InitDistortion();
|
||||
|
||||
// set the output to the frame buffer
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0 );
|
||||
|
||||
// set the viewport and scissor to the viewport provided by Steam VR
|
||||
uint32_t x, y, w, h;
|
||||
m_pHmd->GetEyeOutputViewport( eye, &x, &y, &w, &h );
|
||||
y=0;
|
||||
glViewport( x, y, w, h );
|
||||
glScissor( x, y, w, h );
|
||||
|
||||
// get the window bounds to use to build the projection
|
||||
int32_t xWindow, yWindow;
|
||||
uint32_t wWindow, hWindow;
|
||||
m_pHmd->GetWindowBounds( &xWindow, &yWindow, &wWindow, &hWindow );
|
||||
|
||||
// nice 2D projection matrix
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho( 0, w, h, 0, -1.0f, 1.0f );
|
||||
glTranslatef( 0, 0, 0 );
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
// bind the predistort and distortion map textures
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
|
||||
glActiveTexture( GL_TEXTURE1 );
|
||||
glBindTexture( GL_TEXTURE_2D, m_DistortTexture[ eye ] );
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
glBindTexture( GL_TEXTURE_2D, m_PredistortRenderTargetTexture );
|
||||
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
GLint nOldProgram = 0;
|
||||
glGetIntegerv( GL_CURRENT_PROGRAM, &nOldProgram );
|
||||
|
||||
glUseProgram( m_DistortShader );
|
||||
|
||||
glUniform1i( m_DistortColorSampler, 0 );
|
||||
glUniform1i( m_DistortMapSampler, 1 );
|
||||
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, m_rgflQuadColorData );
|
||||
glVertexPointer( 3, GL_FLOAT, 0, m_rgflQuadData );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, m_rgflQuadTextureData );
|
||||
glDrawArrays( GL_QUADS, 0, 4 );
|
||||
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
glUseProgram( nOldProgram );
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
#ifndef STEAMVRGLHELPER_H
|
||||
#define STEAMVRGLHELPER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "SDL_opengl.h"
|
||||
|
||||
#include "steam/steamvr.h"
|
||||
|
||||
class CSteamVRGLHelper
|
||||
{
|
||||
public:
|
||||
CSteamVRGLHelper();
|
||||
~CSteamVRGLHelper();
|
||||
|
||||
bool BInit( vr::IHmd *pHmd );
|
||||
void Shutdown();
|
||||
bool InitUIRenderTarget( uint32_t unWidth, uint32_t unHeight );
|
||||
bool BPushUIRenderTarget();
|
||||
GLuint GetUITexture() const { return m_UIRenderTargetTexture; }
|
||||
|
||||
void PushViewAndProjection( vr::Hmd_Eye eye, float fNearZ, float fFarZ, const vr::HmdMatrix34_t & matWorldFromheadPose );
|
||||
|
||||
bool BInitPredistortRenderTarget();
|
||||
void PushPredistortRenderTarget();
|
||||
float GetAspectRatio() const { return (float)m_unPredistortWidth / (float)m_unPredistortHeight; }
|
||||
void DrawPredistortToFrameBuffer( vr::Hmd_Eye eye );
|
||||
|
||||
private:
|
||||
void InitDistortion();
|
||||
|
||||
// for rendering UI
|
||||
GLuint m_UIRenderTarget;
|
||||
GLuint m_UIRenderTargetTexture;
|
||||
uint32_t m_unUIWidth;
|
||||
uint32_t m_unUIHeight;
|
||||
|
||||
// for rendering the pre-distortion scene into
|
||||
GLuint m_PredistortRenderTarget;
|
||||
GLuint m_PredistortRenderTargetDepth;
|
||||
GLuint m_PredistortRenderTargetTexture;
|
||||
uint32_t m_unPredistortWidth;
|
||||
uint32_t m_unPredistortHeight;
|
||||
|
||||
// Used in the distortion pass
|
||||
bool m_bDistortionInitialized;
|
||||
GLuint m_DistortShader;
|
||||
GLuint m_DistortTexture[2];
|
||||
GLuint m_DistortColorSampler;
|
||||
GLuint m_DistortMapSampler;
|
||||
GLfloat *m_rgflQuadData;
|
||||
GLubyte *m_rgflQuadColorData;
|
||||
GLfloat *m_rgflQuadTextureData;
|
||||
|
||||
vr::IHmd *m_pHmd;
|
||||
};
|
||||
|
||||
#endif // STEAMVRGLHELPER_H
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Versions/Current/Headers
|
||||
@@ -0,0 +1,282 @@
|
||||
// Copyright (c) 2006, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Framework to provide a simple C API to crash reporting for
|
||||
// applications. By default, if any machine-level exception (e.g.,
|
||||
// EXC_BAD_ACCESS) occurs, it will be handled by the BreakpadRef
|
||||
// object as follows:
|
||||
//
|
||||
// 1. Create a minidump file (see Breakpad for details)
|
||||
// 2. Prompt the user (using CFUserNotification)
|
||||
// 3. Invoke a command line reporting tool to send the minidump to a
|
||||
// server
|
||||
//
|
||||
// By specifying parameters to the BreakpadCreate function, you can
|
||||
// modify the default behavior to suit your needs and wants and
|
||||
// desires.
|
||||
|
||||
// A service name associated with the original bootstrap parent port, saved in
|
||||
// OnDemandServer and restored in Inspector.
|
||||
#define BREAKPAD_BOOTSTRAP_PARENT_PORT "com.Breakpad.BootstrapParent"
|
||||
|
||||
typedef void *BreakpadRef;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include "BreakpadDefines.h"
|
||||
|
||||
// Optional user-defined function to dec to decide if we should handle
|
||||
// this crash or forward it along.
|
||||
// Return true if you want Breakpad to handle it.
|
||||
// Return false if you want Breakpad to skip it
|
||||
// The exception handler always returns false, as if SEND_AND_EXIT were false
|
||||
// (which means the next exception handler will take the exception)
|
||||
typedef bool (*BreakpadFilterCallback)(int exception_type,
|
||||
int exception_code,
|
||||
mach_port_t crashing_thread,
|
||||
void *context);
|
||||
|
||||
// Create a new BreakpadRef object and install it as an exception
|
||||
// handler. The |parameters| will typically be the contents of your
|
||||
// bundle's Info.plist.
|
||||
//
|
||||
// You can also specify these additional keys for customizable behavior:
|
||||
// Key: Value:
|
||||
// BREAKPAD_PRODUCT Product name (e.g., "MyAwesomeProduct")
|
||||
// This one is used as the key to identify
|
||||
// the product when uploading. Falls back to
|
||||
// CFBundleName if not specified.
|
||||
// REQUIRED
|
||||
//
|
||||
// BREAKPAD_PRODUCT_DISPLAY This is the display name, e.g. a pretty
|
||||
// name for the product when the crash_sender
|
||||
// pops up UI for the user. Falls back first to
|
||||
// CFBundleDisplayName and then to
|
||||
// BREAKPAD_PRODUCT if not specified.
|
||||
//
|
||||
// BREAKPAD_VERSION Product version (e.g., 1.2.3), used
|
||||
// as metadata for crash report. Falls back to
|
||||
// CFBundleVersion if not specified.
|
||||
// REQUIRED
|
||||
//
|
||||
// BREAKPAD_VENDOR Vendor name, used in UI (e.g. "A report has
|
||||
// been created that you can send to <vendor>")
|
||||
//
|
||||
// BREAKPAD_URL URL destination for reporting
|
||||
// REQUIRED
|
||||
//
|
||||
// BREAKPAD_REPORT_INTERVAL # of seconds between sending
|
||||
// reports. If an additional report is
|
||||
// generated within this time, it will
|
||||
// be ignored. Default: 3600sec.
|
||||
// Specify 0 to send all reports.
|
||||
//
|
||||
// BREAKPAD_SKIP_CONFIRM If true, the reporter will send the report
|
||||
// without any user intervention.
|
||||
// Defaults to NO
|
||||
//
|
||||
// BREAKPAD_CONFIRM_TIMEOUT Number of seconds before the upload
|
||||
// confirmation dialog will be automatically
|
||||
// dismissed (cancelling the upload).
|
||||
// Default: 300 seconds (min of 60).
|
||||
// Specify 0 to prevent timeout.
|
||||
//
|
||||
// BREAKPAD_SEND_AND_EXIT If true, the handler will exit after sending.
|
||||
// This will prevent any other handler (e.g.,
|
||||
// CrashReporter) from getting the crash.
|
||||
// Defaults TO YES
|
||||
//
|
||||
// BREAKPAD_DUMP_DIRECTORY The directory to store crash-dumps
|
||||
// in. By default, we use
|
||||
// ~/Library/Breakpad/<BREAKPAD_PRODUCT>
|
||||
// The path you specify here is tilde-expanded.
|
||||
//
|
||||
// BREAKPAD_INSPECTOR_LOCATION The full path to the Inspector executable.
|
||||
// Defaults to <Framework resources>/Inspector
|
||||
//
|
||||
// BREAKPAD_REPORTER_EXE_LOCATION The full path to the Reporter/sender
|
||||
// executable.
|
||||
// Default:
|
||||
// <Framework Resources>/crash_report_sender.app
|
||||
//
|
||||
// BREAKPAD_LOGFILES Indicates an array of log file paths that
|
||||
// should be uploaded at crash time.
|
||||
//
|
||||
// BREAKPAD_REQUEST_COMMENTS If true, the message dialog will have a
|
||||
// text box for the user to enter comments.
|
||||
// Default: NO
|
||||
//
|
||||
// BREAKPAD_REQUEST_EMAIL If true and BREAKPAD_REQUEST_COMMENTS is also
|
||||
// true, the message dialog will have a text
|
||||
// box for the user to enter their email address.
|
||||
// Default: NO
|
||||
//
|
||||
// BREAKPAD_SERVER_TYPE A parameter that tells Breakpad how to
|
||||
// rewrite the upload parameters for a specific
|
||||
// server type. The currently valid values are
|
||||
// 'socorro' or 'google'. If you want to add
|
||||
// other types, see the function in
|
||||
// crash_report_sender.m that maps parameters to
|
||||
// URL parameters. Defaults to 'google'.
|
||||
//
|
||||
// BREAKPAD_SERVER_PARAMETER_DICT A plist dictionary of static
|
||||
// parameters that are uploaded to the
|
||||
// server. The parameters are sent as
|
||||
// is to the crash server. Their
|
||||
// content isn't added to the minidump
|
||||
// but pass as URL parameters when
|
||||
// uploading theminidump to the crash
|
||||
// server.
|
||||
//=============================================================================
|
||||
// The BREAKPAD_PRODUCT, BREAKPAD_VERSION and BREAKPAD_URL are
|
||||
// required to have non-NULL values. By default, the BREAKPAD_PRODUCT
|
||||
// will be the CFBundleName and the BREAKPAD_VERSION will be the
|
||||
// CFBundleVersion when these keys are present in the bundle's
|
||||
// Info.plist, which is usually passed in to BreakpadCreate() as an
|
||||
// NSDictionary (you could also pass in another dictionary that had
|
||||
// the same keys configured). If the BREAKPAD_PRODUCT or
|
||||
// BREAKPAD_VERSION are ultimately undefined, BreakpadCreate() will
|
||||
// fail. You have been warned.
|
||||
//
|
||||
// If you are running in a debugger, Breakpad will not install, unless the
|
||||
// BREAKPAD_IGNORE_DEBUGGER envionment variable is set and/or non-zero.
|
||||
//
|
||||
// The BREAKPAD_SKIP_CONFIRM and BREAKPAD_SEND_AND_EXIT default
|
||||
// values are NO and YES. However, they can be controlled by setting their
|
||||
// values in a user or global plist.
|
||||
//
|
||||
// It's easiest to use Breakpad via the Framework, but if you're compiling the
|
||||
// code in directly, BREAKPAD_INSPECTOR_LOCATION and
|
||||
// BREAKPAD_REPORTER_EXE_LOCATION allow you to specify custom paths
|
||||
// to the helper executables.
|
||||
//
|
||||
//=============================================================================
|
||||
// The following are NOT user-supplied but are documented here for
|
||||
// completeness. They are calculated by Breakpad during initialization &
|
||||
// crash-dump generation, or entered in by the user.
|
||||
//
|
||||
// BREAKPAD_PROCESS_START_TIME The time, in seconds since the Epoch, the
|
||||
// process started
|
||||
//
|
||||
// BREAKPAD_PROCESS_CRASH_TIME The time, in seconds since the Epoch, the
|
||||
// process crashed.
|
||||
//
|
||||
// BREAKPAD_PROCESS_UP_TIME The total time in milliseconds the process
|
||||
// has been running. This parameter is not
|
||||
// set until the crash-dump-generation phase.
|
||||
//
|
||||
// BREAKPAD_LOGFILE_KEY_PREFIX Used to find out which parameters in the
|
||||
// parameter dictionary correspond to log
|
||||
// file paths.
|
||||
//
|
||||
// BREAKPAD_SERVER_PARAMETER_PREFIX This prefix is used by Breakpad
|
||||
// internally, because Breakpad uses
|
||||
// the same dictionary internally to
|
||||
// track both its internal
|
||||
// configuration parameters and
|
||||
// parameters meant to be uploaded
|
||||
// to the server. This string is
|
||||
// used internally by Breakpad to
|
||||
// prefix user-supplied parameter
|
||||
// names so those can be sent to the
|
||||
// server without leaking Breakpad's
|
||||
// internal values.
|
||||
//
|
||||
// BREAKPAD_ON_DEMAND Used internally to indicate to the
|
||||
// Reporter that we're sending on-demand,
|
||||
// not as result of a crash.
|
||||
//
|
||||
// BREAKPAD_COMMENTS The text the user provided as comments.
|
||||
// Only used in crash_report_sender.
|
||||
|
||||
// Returns a new BreakpadRef object on success, NULL otherwise.
|
||||
BreakpadRef BreakpadCreate(NSDictionary *parameters);
|
||||
|
||||
// Uninstall and release the data associated with |ref|.
|
||||
void BreakpadRelease(BreakpadRef ref);
|
||||
|
||||
// Clients may set an optional callback which gets called when a crash
|
||||
// occurs. The callback function should return |true| if we should
|
||||
// handle the crash, generate a crash report, etc. or |false| if we
|
||||
// should ignore it and forward the crash (normally to CrashReporter).
|
||||
// Context is a pointer to arbitrary data to make the callback with.
|
||||
void BreakpadSetFilterCallback(BreakpadRef ref,
|
||||
BreakpadFilterCallback callback,
|
||||
void *context);
|
||||
|
||||
// User defined key and value string storage. Generally this is used
|
||||
// to configure Breakpad's internal operation, such as whether the
|
||||
// crash_sender should prompt the user, or the filesystem location for
|
||||
// the minidump file. See Breakpad.h for some parameters that can be
|
||||
// set. Anything longer than 255 bytes will be truncated. Note that
|
||||
// the string is converted to UTF8 before truncation, so any multibyte
|
||||
// character that straddles the 255(256 - 1 for terminator) byte limit
|
||||
// will be mangled.
|
||||
//
|
||||
// A maximum number of 64 key/value pairs are supported. An assert()
|
||||
// will fire if more than this number are set. Unfortunately, right
|
||||
// now, the same dictionary is used for both Breakpad's parameters AND
|
||||
// the Upload parameters.
|
||||
//
|
||||
// TODO (nealsid): Investigate how necessary this is if we don't
|
||||
// automatically upload parameters to the server anymore.
|
||||
// TODO (nealsid): separate server parameter dictionary from the
|
||||
// dictionary used to configure Breakpad, and document limits for each
|
||||
// independently.
|
||||
void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value);
|
||||
NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key);
|
||||
void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key);
|
||||
|
||||
// You can use this method to specify parameters that will be uploaded
|
||||
// to the crash server. They will be automatically encoded as
|
||||
// necessary. Note that as mentioned above there are limits on both
|
||||
// the number of keys and their length.
|
||||
void BreakpadAddUploadParameter(BreakpadRef ref, NSString *key,
|
||||
NSString *value);
|
||||
|
||||
// This method will remove a previously-added parameter from the
|
||||
// upload parameter set.
|
||||
void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString *key);
|
||||
|
||||
// Add a log file for Breakpad to read and send upon crash dump
|
||||
void BreakpadAddLogFile(BreakpadRef ref, NSString *logPathname);
|
||||
|
||||
// Generate a minidump and send
|
||||
void BreakpadGenerateAndSendReport(BreakpadRef ref);
|
||||
|
||||
void BreakpadSetComment( BreakpadRef ref, char const *pchComment );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) 2011, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Keys for configuration file
|
||||
#define kReporterMinidumpDirectoryKey "MinidumpDir"
|
||||
#define kReporterMinidumpIDKey "MinidumpID"
|
||||
|
||||
// Filename for recording uploaded IDs
|
||||
#define kReporterLogFilename "uploads.log"
|
||||
|
||||
// The default subdirectory of the Library to put crash dumps in
|
||||
// The subdirectory is
|
||||
// ~/Library/<kDefaultLibrarySubdirectory>/<GoogleBreakpadProduct>
|
||||
#define kDefaultLibrarySubdirectory "Breakpad"
|
||||
|
||||
// Specify some special keys to be used in the configuration file that is
|
||||
// generated by Breakpad and consumed by the crash_sender.
|
||||
#define BREAKPAD_PRODUCT "BreakpadProduct"
|
||||
#define BREAKPAD_PRODUCT_DISPLAY "BreakpadProductDisplay"
|
||||
#define BREAKPAD_VERSION "BreakpadVersion"
|
||||
#define BREAKPAD_VENDOR "BreakpadVendor"
|
||||
#define BREAKPAD_URL "BreakpadURL"
|
||||
#define BREAKPAD_REPORT_INTERVAL "BreakpadReportInterval"
|
||||
#define BREAKPAD_SKIP_CONFIRM "BreakpadSkipConfirm"
|
||||
#define BREAKPAD_CONFIRM_TIMEOUT "BreakpadConfirmTimeout"
|
||||
#define BREAKPAD_SEND_AND_EXIT "BreakpadSendAndExit"
|
||||
#define BREAKPAD_DUMP_DIRECTORY "BreakpadMinidumpLocation"
|
||||
#define BREAKPAD_INSPECTOR_LOCATION "BreakpadInspectorLocation"
|
||||
#define BREAKPAD_REPORTER_EXE_LOCATION \
|
||||
"BreakpadReporterExeLocation"
|
||||
#define BREAKPAD_LOGFILES "BreakpadLogFiles"
|
||||
#define BREAKPAD_LOGFILE_UPLOAD_SIZE "BreakpadLogFileTailSize"
|
||||
#define BREAKPAD_REQUEST_COMMENTS "BreakpadRequestComments"
|
||||
#define BREAKPAD_COMMENTS "BreakpadComments"
|
||||
#define BREAKPAD_REQUEST_EMAIL "BreakpadRequestEmail"
|
||||
#define BREAKPAD_EMAIL "BreakpadEmail"
|
||||
#define BREAKPAD_SERVER_TYPE "BreakpadServerType"
|
||||
#define BREAKPAD_SERVER_PARAMETER_DICT "BreakpadServerParameters"
|
||||
|
||||
// The keys below are NOT user supplied, and are used internally.
|
||||
#define BREAKPAD_PROCESS_START_TIME "BreakpadProcStartTime"
|
||||
#define BREAKPAD_PROCESS_UP_TIME "BreakpadProcessUpTime"
|
||||
#define BREAKPAD_PROCESS_CRASH_TIME "BreakpadProcessCrashTime"
|
||||
#define BREAKPAD_LOGFILE_KEY_PREFIX "BreakpadAppLogFile"
|
||||
#define BREAKPAD_SERVER_PARAMETER_PREFIX "BreakpadServerParameterPrefix_"
|
||||
#define BREAKPAD_ON_DEMAND "BreakpadOnDemand"
|
||||
@@ -1 +0,0 @@
|
||||
Versions/Current/Resources
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>11G63</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Breakpad</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.googlecode.google-breakpad</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Breakpad</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0.compiler</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>10K549</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.6</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0433</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4E3002</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
BIN
Binary file not shown.
+48
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>11G63</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.Breakpad.crash_report_sender</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0.compiler</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>10K549</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.6</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0433</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
APPL????
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1 +0,0 @@
|
||||
A
|
||||
BIN
Binary file not shown.
+282
@@ -0,0 +1,282 @@
|
||||
// Copyright (c) 2006, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Framework to provide a simple C API to crash reporting for
|
||||
// applications. By default, if any machine-level exception (e.g.,
|
||||
// EXC_BAD_ACCESS) occurs, it will be handled by the BreakpadRef
|
||||
// object as follows:
|
||||
//
|
||||
// 1. Create a minidump file (see Breakpad for details)
|
||||
// 2. Prompt the user (using CFUserNotification)
|
||||
// 3. Invoke a command line reporting tool to send the minidump to a
|
||||
// server
|
||||
//
|
||||
// By specifying parameters to the BreakpadCreate function, you can
|
||||
// modify the default behavior to suit your needs and wants and
|
||||
// desires.
|
||||
|
||||
// A service name associated with the original bootstrap parent port, saved in
|
||||
// OnDemandServer and restored in Inspector.
|
||||
#define BREAKPAD_BOOTSTRAP_PARENT_PORT "com.Breakpad.BootstrapParent"
|
||||
|
||||
typedef void *BreakpadRef;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include "BreakpadDefines.h"
|
||||
|
||||
// Optional user-defined function to dec to decide if we should handle
|
||||
// this crash or forward it along.
|
||||
// Return true if you want Breakpad to handle it.
|
||||
// Return false if you want Breakpad to skip it
|
||||
// The exception handler always returns false, as if SEND_AND_EXIT were false
|
||||
// (which means the next exception handler will take the exception)
|
||||
typedef bool (*BreakpadFilterCallback)(int exception_type,
|
||||
int exception_code,
|
||||
mach_port_t crashing_thread,
|
||||
void *context);
|
||||
|
||||
// Create a new BreakpadRef object and install it as an exception
|
||||
// handler. The |parameters| will typically be the contents of your
|
||||
// bundle's Info.plist.
|
||||
//
|
||||
// You can also specify these additional keys for customizable behavior:
|
||||
// Key: Value:
|
||||
// BREAKPAD_PRODUCT Product name (e.g., "MyAwesomeProduct")
|
||||
// This one is used as the key to identify
|
||||
// the product when uploading. Falls back to
|
||||
// CFBundleName if not specified.
|
||||
// REQUIRED
|
||||
//
|
||||
// BREAKPAD_PRODUCT_DISPLAY This is the display name, e.g. a pretty
|
||||
// name for the product when the crash_sender
|
||||
// pops up UI for the user. Falls back first to
|
||||
// CFBundleDisplayName and then to
|
||||
// BREAKPAD_PRODUCT if not specified.
|
||||
//
|
||||
// BREAKPAD_VERSION Product version (e.g., 1.2.3), used
|
||||
// as metadata for crash report. Falls back to
|
||||
// CFBundleVersion if not specified.
|
||||
// REQUIRED
|
||||
//
|
||||
// BREAKPAD_VENDOR Vendor name, used in UI (e.g. "A report has
|
||||
// been created that you can send to <vendor>")
|
||||
//
|
||||
// BREAKPAD_URL URL destination for reporting
|
||||
// REQUIRED
|
||||
//
|
||||
// BREAKPAD_REPORT_INTERVAL # of seconds between sending
|
||||
// reports. If an additional report is
|
||||
// generated within this time, it will
|
||||
// be ignored. Default: 3600sec.
|
||||
// Specify 0 to send all reports.
|
||||
//
|
||||
// BREAKPAD_SKIP_CONFIRM If true, the reporter will send the report
|
||||
// without any user intervention.
|
||||
// Defaults to NO
|
||||
//
|
||||
// BREAKPAD_CONFIRM_TIMEOUT Number of seconds before the upload
|
||||
// confirmation dialog will be automatically
|
||||
// dismissed (cancelling the upload).
|
||||
// Default: 300 seconds (min of 60).
|
||||
// Specify 0 to prevent timeout.
|
||||
//
|
||||
// BREAKPAD_SEND_AND_EXIT If true, the handler will exit after sending.
|
||||
// This will prevent any other handler (e.g.,
|
||||
// CrashReporter) from getting the crash.
|
||||
// Defaults TO YES
|
||||
//
|
||||
// BREAKPAD_DUMP_DIRECTORY The directory to store crash-dumps
|
||||
// in. By default, we use
|
||||
// ~/Library/Breakpad/<BREAKPAD_PRODUCT>
|
||||
// The path you specify here is tilde-expanded.
|
||||
//
|
||||
// BREAKPAD_INSPECTOR_LOCATION The full path to the Inspector executable.
|
||||
// Defaults to <Framework resources>/Inspector
|
||||
//
|
||||
// BREAKPAD_REPORTER_EXE_LOCATION The full path to the Reporter/sender
|
||||
// executable.
|
||||
// Default:
|
||||
// <Framework Resources>/crash_report_sender.app
|
||||
//
|
||||
// BREAKPAD_LOGFILES Indicates an array of log file paths that
|
||||
// should be uploaded at crash time.
|
||||
//
|
||||
// BREAKPAD_REQUEST_COMMENTS If true, the message dialog will have a
|
||||
// text box for the user to enter comments.
|
||||
// Default: NO
|
||||
//
|
||||
// BREAKPAD_REQUEST_EMAIL If true and BREAKPAD_REQUEST_COMMENTS is also
|
||||
// true, the message dialog will have a text
|
||||
// box for the user to enter their email address.
|
||||
// Default: NO
|
||||
//
|
||||
// BREAKPAD_SERVER_TYPE A parameter that tells Breakpad how to
|
||||
// rewrite the upload parameters for a specific
|
||||
// server type. The currently valid values are
|
||||
// 'socorro' or 'google'. If you want to add
|
||||
// other types, see the function in
|
||||
// crash_report_sender.m that maps parameters to
|
||||
// URL parameters. Defaults to 'google'.
|
||||
//
|
||||
// BREAKPAD_SERVER_PARAMETER_DICT A plist dictionary of static
|
||||
// parameters that are uploaded to the
|
||||
// server. The parameters are sent as
|
||||
// is to the crash server. Their
|
||||
// content isn't added to the minidump
|
||||
// but pass as URL parameters when
|
||||
// uploading theminidump to the crash
|
||||
// server.
|
||||
//=============================================================================
|
||||
// The BREAKPAD_PRODUCT, BREAKPAD_VERSION and BREAKPAD_URL are
|
||||
// required to have non-NULL values. By default, the BREAKPAD_PRODUCT
|
||||
// will be the CFBundleName and the BREAKPAD_VERSION will be the
|
||||
// CFBundleVersion when these keys are present in the bundle's
|
||||
// Info.plist, which is usually passed in to BreakpadCreate() as an
|
||||
// NSDictionary (you could also pass in another dictionary that had
|
||||
// the same keys configured). If the BREAKPAD_PRODUCT or
|
||||
// BREAKPAD_VERSION are ultimately undefined, BreakpadCreate() will
|
||||
// fail. You have been warned.
|
||||
//
|
||||
// If you are running in a debugger, Breakpad will not install, unless the
|
||||
// BREAKPAD_IGNORE_DEBUGGER envionment variable is set and/or non-zero.
|
||||
//
|
||||
// The BREAKPAD_SKIP_CONFIRM and BREAKPAD_SEND_AND_EXIT default
|
||||
// values are NO and YES. However, they can be controlled by setting their
|
||||
// values in a user or global plist.
|
||||
//
|
||||
// It's easiest to use Breakpad via the Framework, but if you're compiling the
|
||||
// code in directly, BREAKPAD_INSPECTOR_LOCATION and
|
||||
// BREAKPAD_REPORTER_EXE_LOCATION allow you to specify custom paths
|
||||
// to the helper executables.
|
||||
//
|
||||
//=============================================================================
|
||||
// The following are NOT user-supplied but are documented here for
|
||||
// completeness. They are calculated by Breakpad during initialization &
|
||||
// crash-dump generation, or entered in by the user.
|
||||
//
|
||||
// BREAKPAD_PROCESS_START_TIME The time, in seconds since the Epoch, the
|
||||
// process started
|
||||
//
|
||||
// BREAKPAD_PROCESS_CRASH_TIME The time, in seconds since the Epoch, the
|
||||
// process crashed.
|
||||
//
|
||||
// BREAKPAD_PROCESS_UP_TIME The total time in milliseconds the process
|
||||
// has been running. This parameter is not
|
||||
// set until the crash-dump-generation phase.
|
||||
//
|
||||
// BREAKPAD_LOGFILE_KEY_PREFIX Used to find out which parameters in the
|
||||
// parameter dictionary correspond to log
|
||||
// file paths.
|
||||
//
|
||||
// BREAKPAD_SERVER_PARAMETER_PREFIX This prefix is used by Breakpad
|
||||
// internally, because Breakpad uses
|
||||
// the same dictionary internally to
|
||||
// track both its internal
|
||||
// configuration parameters and
|
||||
// parameters meant to be uploaded
|
||||
// to the server. This string is
|
||||
// used internally by Breakpad to
|
||||
// prefix user-supplied parameter
|
||||
// names so those can be sent to the
|
||||
// server without leaking Breakpad's
|
||||
// internal values.
|
||||
//
|
||||
// BREAKPAD_ON_DEMAND Used internally to indicate to the
|
||||
// Reporter that we're sending on-demand,
|
||||
// not as result of a crash.
|
||||
//
|
||||
// BREAKPAD_COMMENTS The text the user provided as comments.
|
||||
// Only used in crash_report_sender.
|
||||
|
||||
// Returns a new BreakpadRef object on success, NULL otherwise.
|
||||
BreakpadRef BreakpadCreate(NSDictionary *parameters);
|
||||
|
||||
// Uninstall and release the data associated with |ref|.
|
||||
void BreakpadRelease(BreakpadRef ref);
|
||||
|
||||
// Clients may set an optional callback which gets called when a crash
|
||||
// occurs. The callback function should return |true| if we should
|
||||
// handle the crash, generate a crash report, etc. or |false| if we
|
||||
// should ignore it and forward the crash (normally to CrashReporter).
|
||||
// Context is a pointer to arbitrary data to make the callback with.
|
||||
void BreakpadSetFilterCallback(BreakpadRef ref,
|
||||
BreakpadFilterCallback callback,
|
||||
void *context);
|
||||
|
||||
// User defined key and value string storage. Generally this is used
|
||||
// to configure Breakpad's internal operation, such as whether the
|
||||
// crash_sender should prompt the user, or the filesystem location for
|
||||
// the minidump file. See Breakpad.h for some parameters that can be
|
||||
// set. Anything longer than 255 bytes will be truncated. Note that
|
||||
// the string is converted to UTF8 before truncation, so any multibyte
|
||||
// character that straddles the 255(256 - 1 for terminator) byte limit
|
||||
// will be mangled.
|
||||
//
|
||||
// A maximum number of 64 key/value pairs are supported. An assert()
|
||||
// will fire if more than this number are set. Unfortunately, right
|
||||
// now, the same dictionary is used for both Breakpad's parameters AND
|
||||
// the Upload parameters.
|
||||
//
|
||||
// TODO (nealsid): Investigate how necessary this is if we don't
|
||||
// automatically upload parameters to the server anymore.
|
||||
// TODO (nealsid): separate server parameter dictionary from the
|
||||
// dictionary used to configure Breakpad, and document limits for each
|
||||
// independently.
|
||||
void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value);
|
||||
NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key);
|
||||
void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key);
|
||||
|
||||
// You can use this method to specify parameters that will be uploaded
|
||||
// to the crash server. They will be automatically encoded as
|
||||
// necessary. Note that as mentioned above there are limits on both
|
||||
// the number of keys and their length.
|
||||
void BreakpadAddUploadParameter(BreakpadRef ref, NSString *key,
|
||||
NSString *value);
|
||||
|
||||
// This method will remove a previously-added parameter from the
|
||||
// upload parameter set.
|
||||
void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString *key);
|
||||
|
||||
// Add a log file for Breakpad to read and send upon crash dump
|
||||
void BreakpadAddLogFile(BreakpadRef ref, NSString *logPathname);
|
||||
|
||||
// Generate a minidump and send
|
||||
void BreakpadGenerateAndSendReport(BreakpadRef ref);
|
||||
|
||||
void BreakpadSetComment( BreakpadRef ref, char const *pchComment );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) 2011, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Keys for configuration file
|
||||
#define kReporterMinidumpDirectoryKey "MinidumpDir"
|
||||
#define kReporterMinidumpIDKey "MinidumpID"
|
||||
|
||||
// Filename for recording uploaded IDs
|
||||
#define kReporterLogFilename "uploads.log"
|
||||
|
||||
// The default subdirectory of the Library to put crash dumps in
|
||||
// The subdirectory is
|
||||
// ~/Library/<kDefaultLibrarySubdirectory>/<GoogleBreakpadProduct>
|
||||
#define kDefaultLibrarySubdirectory "Breakpad"
|
||||
|
||||
// Specify some special keys to be used in the configuration file that is
|
||||
// generated by Breakpad and consumed by the crash_sender.
|
||||
#define BREAKPAD_PRODUCT "BreakpadProduct"
|
||||
#define BREAKPAD_PRODUCT_DISPLAY "BreakpadProductDisplay"
|
||||
#define BREAKPAD_VERSION "BreakpadVersion"
|
||||
#define BREAKPAD_VENDOR "BreakpadVendor"
|
||||
#define BREAKPAD_URL "BreakpadURL"
|
||||
#define BREAKPAD_REPORT_INTERVAL "BreakpadReportInterval"
|
||||
#define BREAKPAD_SKIP_CONFIRM "BreakpadSkipConfirm"
|
||||
#define BREAKPAD_CONFIRM_TIMEOUT "BreakpadConfirmTimeout"
|
||||
#define BREAKPAD_SEND_AND_EXIT "BreakpadSendAndExit"
|
||||
#define BREAKPAD_DUMP_DIRECTORY "BreakpadMinidumpLocation"
|
||||
#define BREAKPAD_INSPECTOR_LOCATION "BreakpadInspectorLocation"
|
||||
#define BREAKPAD_REPORTER_EXE_LOCATION \
|
||||
"BreakpadReporterExeLocation"
|
||||
#define BREAKPAD_LOGFILES "BreakpadLogFiles"
|
||||
#define BREAKPAD_LOGFILE_UPLOAD_SIZE "BreakpadLogFileTailSize"
|
||||
#define BREAKPAD_REQUEST_COMMENTS "BreakpadRequestComments"
|
||||
#define BREAKPAD_COMMENTS "BreakpadComments"
|
||||
#define BREAKPAD_REQUEST_EMAIL "BreakpadRequestEmail"
|
||||
#define BREAKPAD_EMAIL "BreakpadEmail"
|
||||
#define BREAKPAD_SERVER_TYPE "BreakpadServerType"
|
||||
#define BREAKPAD_SERVER_PARAMETER_DICT "BreakpadServerParameters"
|
||||
|
||||
// The keys below are NOT user supplied, and are used internally.
|
||||
#define BREAKPAD_PROCESS_START_TIME "BreakpadProcStartTime"
|
||||
#define BREAKPAD_PROCESS_UP_TIME "BreakpadProcessUpTime"
|
||||
#define BREAKPAD_PROCESS_CRASH_TIME "BreakpadProcessCrashTime"
|
||||
#define BREAKPAD_LOGFILE_KEY_PREFIX "BreakpadAppLogFile"
|
||||
#define BREAKPAD_SERVER_PARAMETER_PREFIX "BreakpadServerParameterPrefix_"
|
||||
#define BREAKPAD_ON_DEMAND "BreakpadOnDemand"
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>11G63</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Breakpad</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.googlecode.google-breakpad</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Breakpad</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0.compiler</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>10K549</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.6</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0433</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4E3002</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+48
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>11G63</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.Breakpad.crash_report_sender</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>crash_report_sender</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0.compiler</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>10K549</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.6</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0433</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4E3002</string>
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
APPL????
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user