mirror of
https://github.com/rlabrecque/SteamworksSDK.git
synced 2026-10-10 09:33:04 +08:00
v1.29
This commit is contained in:
+28
@@ -11,6 +11,34 @@ website at: http://partner.steamgames.com
|
||||
|
||||
Revision History:
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.29 24th April 2014
|
||||
----------------------------------------------------------------
|
||||
|
||||
General:
|
||||
* Adjust game server login to use a token instead of username/password. Tokens are randomly generated at account creation time and can be reset.
|
||||
* Added existing text param to ISteamUtils::ShowGamepadTextInput() so games can prepopulate control before displaying to user.
|
||||
* Updated retail disc installer to use a single multi-language steamsetup.exe replacing all Steam install MSI packages.
|
||||
* Removed redistributable Steam libraries for dedicated servers. Standalone dedicated server should use shared "Steamworks SDK Redist" depots.
|
||||
* steamcmd is now included for Linux and OSX.
|
||||
|
||||
Music:
|
||||
* Introducing API to control the Steam Music Player from external software. As an example this gives games the opportunity to pause the music or lower the volume, when an important cut scene is shown, and start playing afterwards.
|
||||
* Added menu and code to the Steamworks Example to demonstrate this API.
|
||||
* This feature is currently limited to users in the Steam Music Player Beta. It will have no effect on other users.
|
||||
|
||||
UGC:
|
||||
* ISteamUGC - Add m_bCachedData to SteamUGCQueryCompleted_t and SteamUGCRequestUGCDetailsResult_t which can be used to determine if the data was retrieved from the cache.
|
||||
* ISteamUGC - Allow clients to get cached responses for ISteamUGC queries. This is so client code doesn't have to build their own caching layer on top of ISteamUGC.
|
||||
* ISteamRemoteStorage - add the name of the shared file to RemoteStorageFileShareResult_t so it can be matched up to the request if a game has multiple outstanding FileShare requests going on at the same time
|
||||
|
||||
Steam VR:
|
||||
* Renamed GetEyeMatrix to GetHeadFromEyePose and made it return an HmdMatrix34t. This doesn't actually change the values it was returning, it just updates the name to match the values that were already being returned. Changed the driver interface too.
|
||||
* Renamed GetWorldFromHeadPose to GetTrackerFromHeadPose to avoid confusion about the game's world space vs. the tracker's coordinate system.
|
||||
* Also renamed GetLastWorldFromHeadPose to GetLastTrackerFromHeadPose.
|
||||
* Added GetTrackerZeroPose method to get the tracker zero pose.
|
||||
* Added VR support to the Linux/SDL version of the Steamworks Example.
|
||||
|
||||
----------------------------------------------------------------
|
||||
v1.28 28th January 2014
|
||||
----------------------------------------------------------------
|
||||
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
// Render the menu
|
||||
virtual void Render()
|
||||
{
|
||||
const int32 iMaxMenuItems = 13;
|
||||
const int32 iMaxMenuItems = 14;
|
||||
int32 iNumItems = (int32)m_VecMenuItems.size();
|
||||
uint32 uBoxHeight = MIN( iNumItems, iMaxMenuItems ) * ( MENU_FONT_HEIGHT + MENU_ITEM_PADDING );
|
||||
uint32 yPos = m_pGameEngine->GetViewportHeight()/2 - uBoxHeight/2;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
extern IGameEngine *CreateGameEngineOSX();
|
||||
#elif defined(SDL)
|
||||
#include "GameEngine.h"
|
||||
extern IGameEngine *CreateGameEngineSDL();
|
||||
extern IGameEngine *CreateGameEngineSDL( bool bUseVR );
|
||||
#endif
|
||||
|
||||
#include "SpaceWarClient.h"
|
||||
@@ -212,6 +212,16 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow )
|
||||
// with important UI in your game.
|
||||
SteamUtils()->SetOverlayNotificationPosition( k_EPositionTopRight );
|
||||
|
||||
// Ensure that the user has logged into Steam. This will always return true if the game is launched
|
||||
// from Steam, but if Steam is at the login prompt when you run your game from the debugger, it
|
||||
// will return false.
|
||||
if ( !SteamUser()->BLoggedOn() )
|
||||
{
|
||||
OutputDebugString( "Steam user is not logged in\n" );
|
||||
Alert( "Fatal Error", "Steam user must be logged in to play this game (SteamUser()->BLoggedOn() returned false).\n" );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// We are going to use the controller interface, initialize it, which is a seperate step as it
|
||||
// create a new thread in the game proc and we don't want to force that on games that don't
|
||||
// have native Steam controller implementations
|
||||
@@ -222,12 +232,21 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow )
|
||||
char rgchFullPath[1024];
|
||||
#if defined(_WIN32)
|
||||
_snprintf( rgchFullPath, sizeof( rgchFullPath ), "%s\\%s", rgchCWD, "controller.vdf" );
|
||||
#elif defined(OSX)
|
||||
// hack for now, because we do not have utility functions available for finding the resource path
|
||||
// alternatively we could disable the SteamController init on OS X
|
||||
_snprintf( rgchFullPath, sizeof( rgchFullPath ), "%s/steamworksexample.app/Contents/Resources/%s", rgchCWD, "controller.vdf" );
|
||||
#else
|
||||
_snprintf( rgchFullPath, sizeof( rgchFullPath ), "%s/%s", rgchCWD, "controller.vdf" );
|
||||
#endif
|
||||
SteamController()->Init( rgchFullPath );
|
||||
if( !SteamController()->Init( rgchFullPath ) )
|
||||
{
|
||||
OutputDebugString( "SteamController()->Init() failed\n" );
|
||||
Alert( "Fatal Error", "Steam Controller Init failed. Is controller.vdf in the current working directory?\n" );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
bool bUseVR = false;
|
||||
bool bUseVR = SteamUtils()->IsSteamRunningInVR();
|
||||
const char *pchServerAddress, *pchLobbyID;
|
||||
ParseCommandLine( pchCmdLine, &pchServerAddress, &pchLobbyID, &bUseVR );
|
||||
|
||||
@@ -244,7 +263,7 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow )
|
||||
#elif defined(OSX)
|
||||
CreateGameEngineOSX();
|
||||
#elif defined(SDL)
|
||||
CreateGameEngineSDL();
|
||||
CreateGameEngineSDL( bUseVR );
|
||||
#else
|
||||
#error Need CreateGameEngine()
|
||||
#endif
|
||||
|
||||
@@ -27,5 +27,6 @@ CMainMenu::CMainMenu( IGameEngine *pGameEngine ) : CBaseMenu<EClientGameState>(
|
||||
AddMenuItem( MenuItem_t( "Remote Storage", k_EClientRemoteStorage ) );
|
||||
AddMenuItem( MenuItem_t( "Write Minidump", k_EClientMinidump ) );
|
||||
AddMenuItem( MenuItem_t( "Web Callback", k_EClientWebCallback ) );
|
||||
AddMenuItem( MenuItem_t( "Music Player", k_EClientMusic ) );
|
||||
AddMenuItem( MenuItem_t( "Exit Game", k_EClientGameExiting ) );
|
||||
}
|
||||
@@ -184,6 +184,7 @@ enum EClientGameState
|
||||
k_EClientRetrySteamConnection,
|
||||
k_EClientClanChatRoom,
|
||||
k_EClientWebCallback,
|
||||
k_EClientMusic,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "time.h"
|
||||
#include "ServerBrowser.h"
|
||||
#include "Leaderboards.h"
|
||||
#include "musicplayer.h"
|
||||
#include "clanchatroom.h"
|
||||
#include "Lobby.h"
|
||||
#include "p2pauth.h"
|
||||
@@ -139,6 +140,7 @@ void CSpaceWarClient::Init( IGameEngine *pGameEngine )
|
||||
// Init stats
|
||||
m_pStatsAndAchievements = new CStatsAndAchievements( pGameEngine );
|
||||
m_pLeaderboards = new CLeaderboards( pGameEngine );
|
||||
m_pMusicPlayer = new CMusicPlayer( pGameEngine );
|
||||
m_pClanChatRoom = new CClanChatRoom( pGameEngine );
|
||||
|
||||
// Remote Storage page
|
||||
@@ -990,6 +992,12 @@ void CSpaceWarClient::OnGameStateChanged( EClientGameState eGameStateNew )
|
||||
m_pRemoteStorage->Show();
|
||||
SteamFriends()->SetRichPresence( "status", "Viewing remote storage" );
|
||||
}
|
||||
else if ( m_eGameState == k_EClientMusic )
|
||||
{
|
||||
// we've switched to the music player menu
|
||||
m_pMusicPlayer->Show();
|
||||
SteamFriends()->SetRichPresence( "status", "Using music player" );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1412,6 +1420,16 @@ void CSpaceWarClient::RunFrame()
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
case k_EClientMusic:
|
||||
m_pStarField->Render();
|
||||
|
||||
m_pMusicPlayer->RunFrame();
|
||||
|
||||
if ( bEscapePressed )
|
||||
{
|
||||
SetGameState( k_EClientGameMenu );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
OutputDebugString( "Unhandled game state in CSpaceWar::RunFrame\n" );
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "Ship.h"
|
||||
#include "StatsAndAchievements.h"
|
||||
#include "RemoteStorage.h"
|
||||
#include "musicplayer.h"
|
||||
|
||||
// Forward class declaration
|
||||
class CConnectingMenu;
|
||||
@@ -85,6 +86,9 @@ struct LeaderboardMenuItem_t
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CSpaceWarClient
|
||||
{
|
||||
public:
|
||||
@@ -143,6 +147,8 @@ public:
|
||||
void OnMenuSelection( LeaderboardMenuItem_t selection );
|
||||
void OnMenuSelection( ERemoteStorageSyncMenuCommand selection );
|
||||
|
||||
void OnMenuSelection( MusicPlayerMenuItem_t selection ) { m_pMusicPlayer->OnMenuSelection( selection ); }
|
||||
|
||||
// Set game state
|
||||
void SetGameState( EClientGameState eState );
|
||||
EClientGameState GetGameState() { return m_eGameState; }
|
||||
@@ -342,6 +348,7 @@ private:
|
||||
CStatsAndAchievements *m_pStatsAndAchievements;
|
||||
|
||||
CLeaderboards *m_pLeaderboards;
|
||||
CMusicPlayer *m_pMusicPlayer;
|
||||
CClanChatRoom *m_pClanChatRoom;
|
||||
CServerBrowser *m_pServerBrowser;
|
||||
|
||||
|
||||
@@ -405,6 +405,10 @@
|
||||
RelativePath=".\MainMenu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\musicplayer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\p2pauth.cpp"
|
||||
>
|
||||
@@ -515,6 +519,10 @@
|
||||
RelativePath=".\Messages.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\musicplayer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\p2pauth.h"
|
||||
>
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -2386,7 +2386,7 @@ GLMContext::GLMContext( GLMDisplayParams *params )
|
||||
if (success)
|
||||
{
|
||||
//write a cookie into the CGL context leading back to the GLM context object
|
||||
GLint glm_context_link = (GLint) this;
|
||||
GLint glm_context_link = (GLint)((uintptr_t)this);
|
||||
CGLSetParameter( m_ctx, kCGLCPClientStorage, &glm_context_link );
|
||||
|
||||
// save off the pixel format attributes we used
|
||||
|
||||
+3
-8
@@ -1036,6 +1036,7 @@ void GLMDisplayDB::PopulateRenderers( void )
|
||||
{
|
||||
fields.m_pciVendorID = *((UInt32*)CFDataGetBytePtr(vendorID));
|
||||
CFRelease( vendorID );
|
||||
vendorID = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1046,6 +1047,7 @@ void GLMDisplayDB::PopulateRenderers( void )
|
||||
{
|
||||
fields.m_pciDeviceID = *((UInt32*)CFDataGetBytePtr(deviceID));
|
||||
CFRelease( deviceID );
|
||||
deviceID = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1058,6 +1060,7 @@ void GLMDisplayDB::PopulateRenderers( void )
|
||||
char *data = (char*)CFDataGetBytePtr(model);
|
||||
strncpy( fields.m_pciModelString, data, sizeof(fields.m_pciModelString) );
|
||||
CFRelease( model );
|
||||
model = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1151,14 +1154,6 @@ void GLMDisplayDB::PopulateRenderers( void )
|
||||
IOObjectRelease(ioIterator);
|
||||
}
|
||||
|
||||
// Release vendorID, deviceID, and model as appropriate
|
||||
if(vendorID)
|
||||
CFRelease(vendorID);
|
||||
if(deviceID)
|
||||
CFRelease(deviceID);
|
||||
if(model)
|
||||
CFRelease(model);
|
||||
|
||||
// generate shorthand bools
|
||||
switch( fields.m_pciVendorID )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose: interface to app data in Steam
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ISTEAMAPPLIST_H
|
||||
#define ISTEAMAPPLIST_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "steam/isteamclient.h"
|
||||
#include "steam/steamtypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: This is a restricted interface that can only be used by previously approved apps,
|
||||
// contact your Steam Account Manager if you believe you need access to this API.
|
||||
// This interface lets you detect installed apps for the local Steam client, useful for debugging tools
|
||||
// to offer lists of apps to debug via Steam.
|
||||
//-----------------------------------------------------------------------------
|
||||
class ISteamAppList
|
||||
{
|
||||
public:
|
||||
virtual uint32 GetNumInstalledApps() = 0;
|
||||
virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0;
|
||||
|
||||
virtual int GetAppName( AppId_t nAppID, char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found
|
||||
virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found
|
||||
|
||||
virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game
|
||||
};
|
||||
|
||||
#define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001"
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
#pragma pack( push, 4 )
|
||||
#elif defined( VALVE_CALLBACK_PACK_LARGE )
|
||||
#pragma pack( push, 8 )
|
||||
#else
|
||||
#error isteamclient.h must be included
|
||||
#endif
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: Sent when a new app is installed
|
||||
//---------------------------------------------------------------------------------
|
||||
DEFINE_CALLBACK( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 );
|
||||
CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
|
||||
END_DEFINE_CALLBACK_1()
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: Sent when an app is uninstalled
|
||||
//---------------------------------------------------------------------------------
|
||||
DEFINE_CALLBACK( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 );
|
||||
CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs
|
||||
END_DEFINE_CALLBACK_1()
|
||||
|
||||
|
||||
#pragma pack( pop )
|
||||
#endif // ISTEAMAPPLIST_H
|
||||
@@ -17,6 +17,10 @@
|
||||
// Define compile time assert macros to let us validate the structure sizes.
|
||||
#define VALVE_COMPILE_TIME_ASSERT( pred ) typedef char compile_time_assert_type[(pred) ? 1 : -1];
|
||||
|
||||
#ifndef REFERENCE
|
||||
#define REFERENCE(arg) ((void)arg)
|
||||
#endif
|
||||
|
||||
#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.
|
||||
@@ -83,12 +87,14 @@ class ISteamApps;
|
||||
class ISteamNetworking;
|
||||
class ISteamRemoteStorage;
|
||||
class ISteamScreenshots;
|
||||
class ISteamMusic;
|
||||
class ISteamGameServerStats;
|
||||
class ISteamPS3OverlayRender;
|
||||
class ISteamHTTP;
|
||||
class ISteamUnifiedMessages;
|
||||
class ISteamController;
|
||||
class ISteamUGC;
|
||||
class ISteamAppList;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Interface to creating a new steam instance, or to
|
||||
@@ -196,9 +202,15 @@ public:
|
||||
|
||||
// Exposes the ISteamUGC interface
|
||||
virtual ISteamUGC *GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// returns app list interface, only available on specially registered apps
|
||||
virtual ISteamAppList *GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
|
||||
// Music Player
|
||||
virtual ISteamMusic *GetISteamMusic( HSteamUser hSteamuser, HSteamPipe hSteamPipe, const char *pchVersion ) = 0;
|
||||
};
|
||||
|
||||
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient012"
|
||||
#define STEAMCLIENT_INTERFACE_VERSION "SteamClient014"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Base values for callback identifiers, each callback must
|
||||
@@ -241,6 +253,9 @@ enum { k_iClientUGCCallbacks = 3400 };
|
||||
enum { k_iSteamStreamClientCallbacks = 3500 };
|
||||
enum { k_IClientProductBuilderCallbacks = 3600 };
|
||||
enum { k_iClientShortcutsCallbacks = 3700 };
|
||||
enum { k_iClientRemoteControlManagerCallbacks = 3800 };
|
||||
enum { k_iSteamAppListCallbacks = 3900 };
|
||||
enum { k_iSteamMusicCallbacks = 4000 };
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -291,7 +306,7 @@ struct callbackname : SteamCallback_t { \
|
||||
|
||||
#define END_DEFINE_CALLBACK_0() \
|
||||
static uint32 GetNumMemberVariables() { return 0; } \
|
||||
static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { return false; } \
|
||||
static bool GetMemberVariable( uint32 index, uint32 &varOffset, uint32 &varSize, uint32 &varCount, const char **pszName, const char **pszType ) { REFERENCE( pszType ); REFERENCE( pszName ); REFERENCE( varCount ); REFERENCE( varSize ); REFERENCE( varOffset ); REFERENCE( index ); return false; } \
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#error isteamclient.h must be included
|
||||
#endif
|
||||
|
||||
#define MAX_STEAM_CONTROLLERS 8
|
||||
#define MAX_STEAM_CONTROLLERS 16
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
@@ -56,10 +56,7 @@ public:
|
||||
/// @see SteamServersConnected_t
|
||||
/// @see SteamServerConnectFailure_t
|
||||
/// @see SteamServersDisconnected_t
|
||||
virtual void LogOn(
|
||||
const char *pszAccountName,
|
||||
const char *pszPassword
|
||||
) = 0;
|
||||
virtual void LogOn( const char *pszToken ) = 0;
|
||||
|
||||
/// Login to a generic, anonymous account.
|
||||
///
|
||||
@@ -250,7 +247,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer011"
|
||||
#define STEAMGAMESERVER_INTERFACE_VERSION "SteamGameServer012"
|
||||
|
||||
// game server flags
|
||||
const uint32 k_unServerFlagNone = 0x00;
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
virtual int AddFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags, uint32 rTime32LastPlayedOnServer ) =0;
|
||||
|
||||
// removes the game server from the local storage; returns true if one was removed
|
||||
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
|
||||
virtual bool RemoveFavoriteGame( AppId_t nAppID, uint32 nIP, uint16 nConnPort, uint16 nQueryPort, uint32 unFlags ) = 0;
|
||||
|
||||
///////
|
||||
// Game lobby functions
|
||||
@@ -563,6 +563,7 @@ struct FavoritesListChanged_t
|
||||
uint32 m_nAppID;
|
||||
uint32 m_nFlags;
|
||||
bool m_bAdd; // true if this is adding the entry, otherwise it is a remove
|
||||
AccountID_t m_unAccountId;
|
||||
};
|
||||
|
||||
|
||||
@@ -725,6 +726,21 @@ struct PSNGameBootInviteResult_t
|
||||
bool m_bGameBootInviteExists;
|
||||
CSteamID m_steamIDLobby; // Should be valid if m_bGameBootInviteExists == true
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Result of our request to create a Lobby
|
||||
// m_eResult == k_EResultOK on success
|
||||
// at this point, the lobby has been joined and is ready for use
|
||||
// a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)
|
||||
//-----------------------------------------------------------------------------
|
||||
struct FavoritesListAccountsUpdated_t
|
||||
{
|
||||
enum { k_iCallback = k_iSteamMatchmakingCallbacks + 16 };
|
||||
|
||||
EResult m_eResult;
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//============ Copyright (c) Valve Corporation, All rights reserved. ============
|
||||
|
||||
#ifndef ISTEAMMUSIC_H
|
||||
#define ISTEAMMUSIC_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "steam/isteamclient.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
enum AudioPlayback_Status
|
||||
{
|
||||
AudioPlayback_Undefined = 0,
|
||||
AudioPlayback_Playing = 1,
|
||||
AudioPlayback_Paused = 2,
|
||||
AudioPlayback_Idle = 3
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Functions to control music playback in the steam client
|
||||
//-----------------------------------------------------------------------------
|
||||
class ISteamMusic
|
||||
{
|
||||
public:
|
||||
virtual bool BIsEnabled() = 0;
|
||||
virtual bool BIsPlaying() = 0;
|
||||
|
||||
virtual AudioPlayback_Status GetPlaybackStatus() = 0;
|
||||
|
||||
virtual void Play() = 0;
|
||||
virtual void Pause() = 0;
|
||||
virtual void PlayPrevious() = 0;
|
||||
virtual void PlayNext() = 0;
|
||||
|
||||
// volume is between 0.0 and 1.0
|
||||
virtual void SetVolume( float flVolume ) = 0;
|
||||
virtual float GetVolume() = 0;
|
||||
|
||||
};
|
||||
|
||||
#define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001"
|
||||
|
||||
// callbacks
|
||||
#if defined( VALVE_CALLBACK_PACK_SMALL )
|
||||
#pragma pack( push, 4 )
|
||||
#elif defined( VALVE_CALLBACK_PACK_LARGE )
|
||||
#pragma pack( push, 8 )
|
||||
#else
|
||||
#error isteamclient.h must be included
|
||||
#endif
|
||||
|
||||
|
||||
DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 )
|
||||
END_DEFINE_CALLBACK_0()
|
||||
|
||||
DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 )
|
||||
CALLBACK_MEMBER( 0, float, m_flNewVolume )
|
||||
END_DEFINE_CALLBACK_1()
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
#endif // #define ISTEAMMUSIC_H
|
||||
@@ -41,6 +41,7 @@ struct SteamParamStringArray_t
|
||||
typedef uint64 UGCHandle_t;
|
||||
typedef uint64 PublishedFileUpdateHandle_t;
|
||||
typedef uint64 PublishedFileId_t;
|
||||
const PublishedFileId_t k_PublishedFileIdInvalid = 0;
|
||||
const UGCHandle_t k_UGCHandleInvalid = 0xffffffffffffffffull;
|
||||
const PublishedFileUpdateHandle_t k_PublishedFileUpdateHandleInvalid = 0xffffffffffffffffull;
|
||||
|
||||
@@ -366,6 +367,7 @@ struct RemoteStorageFileShareResult_t
|
||||
enum { k_iCallback = k_iClientRemoteStorageCallbacks + 7 };
|
||||
EResult m_eResult; // The result of the operation
|
||||
UGCHandle_t m_hFile; // The handle that can be shared with users and features
|
||||
char m_rgchFilename[k_cchFilenameMax]; // The name of the file that was shared
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,8 +23,12 @@
|
||||
|
||||
|
||||
typedef uint64 UGCQueryHandle_t;
|
||||
typedef uint64 UGCUpdateHandle_t;
|
||||
|
||||
|
||||
const UGCQueryHandle_t k_UGCQueryHandleInvalid = 0xffffffffffffffffull;
|
||||
const UGCUpdateHandle_t k_UGCUpdateHandleInvalid = 0xffffffffffffffffull;
|
||||
|
||||
|
||||
// Matching UGC types for queries
|
||||
enum EUGCMatchingUGCType
|
||||
@@ -129,10 +133,10 @@ class ISteamUGC
|
||||
{
|
||||
public:
|
||||
|
||||
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app.
|
||||
// Query UGC associated with a user. 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 CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
|
||||
|
||||
// Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app.
|
||||
// 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;
|
||||
|
||||
// Send the query to Steam
|
||||
@@ -149,6 +153,7 @@ public:
|
||||
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
|
||||
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
|
||||
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
// Options only for querying user UGC
|
||||
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
|
||||
@@ -159,11 +164,11 @@ public:
|
||||
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
|
||||
|
||||
// Request full details for one piece of UGC
|
||||
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION001"
|
||||
#define STEAMUGC_INTERFACE_VERSION "STEAMUGC_INTERFACE_VERSION002"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Callback for querying UGC
|
||||
@@ -175,6 +180,7 @@ struct SteamUGCQueryCompleted_t
|
||||
EResult m_eResult;
|
||||
uint32 m_unNumResultsReturned;
|
||||
uint32 m_unTotalMatchingResults;
|
||||
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
|
||||
};
|
||||
|
||||
|
||||
@@ -185,8 +191,15 @@ struct SteamUGCRequestUGCDetailsResult_t
|
||||
{
|
||||
enum { k_iCallback = k_iClientUGCCallbacks + 2 };
|
||||
SteamUGCDetails_t m_details;
|
||||
bool m_bCachedData; // indicates whether this data was retrieved from the local on-disk cache
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: k_iClientUGCCallbacks + 3 to k_iClientUGCCallbacks + 6 in use
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
#endif // ISTEAMUGC_H
|
||||
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
#endif
|
||||
|
||||
// Activates the Big Picture text input dialog which only supports gamepad input
|
||||
virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax ) = 0;
|
||||
virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0;
|
||||
|
||||
// Returns previously entered text & length
|
||||
virtual uint32 GetEnteredGamepadTextLength() = 0;
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
virtual bool IsSteamRunningInVR() = 0;
|
||||
};
|
||||
|
||||
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils006"
|
||||
#define STEAMUTILS_INTERFACE_VERSION "SteamUtils007"
|
||||
|
||||
|
||||
// callbacks
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,10 +20,12 @@
|
||||
#include "isteamnetworking.h"
|
||||
#include "isteamremotestorage.h"
|
||||
#include "isteamscreenshots.h"
|
||||
#include "isteammusic.h"
|
||||
#include "isteamhttp.h"
|
||||
#include "isteamunifiedmessages.h"
|
||||
#include "isteamcontroller.h"
|
||||
#include "isteamugc.h"
|
||||
#include "isteamapplist.h"
|
||||
|
||||
#if defined( _PS3 )
|
||||
#include "steamps3params.h"
|
||||
@@ -120,6 +122,8 @@ S_API ISteamHTTP *S_CALLTYPE SteamHTTP();
|
||||
S_API ISteamUnifiedMessages *S_CALLTYPE SteamUnifiedMessages();
|
||||
S_API ISteamController *S_CALLTYPE SteamController();
|
||||
S_API ISteamUGC *S_CALLTYPE SteamUGC();
|
||||
S_API ISteamAppList *S_CALLTYPE SteamAppList();
|
||||
S_API ISteamMusic *S_CALLTYPE SteamMusic();
|
||||
#ifdef _PS3
|
||||
S_API ISteamPS3OverlayRender *S_CALLTYPE SteamPS3OverlayRender();
|
||||
#endif
|
||||
@@ -402,6 +406,8 @@ public:
|
||||
ISteamUnifiedMessages* SteamUnifiedMessages() { return m_pSteamUnifiedMessages; }
|
||||
ISteamController* SteamController() { return m_pController; }
|
||||
ISteamUGC* SteamUGC() { return m_pSteamUGC; }
|
||||
ISteamAppList* SteamAppList() { return m_pSteamAppList; }
|
||||
ISteamMusic* SteamMusic() { return m_pSteamMusic; }
|
||||
#ifdef _PS3
|
||||
ISteamPS3OverlayRender* SteamPS3OverlayRender() { return m_pSteamPS3OverlayRender; }
|
||||
#endif
|
||||
@@ -421,6 +427,8 @@ private:
|
||||
ISteamUnifiedMessages*m_pSteamUnifiedMessages;
|
||||
ISteamController *m_pController;
|
||||
ISteamUGC *m_pSteamUGC;
|
||||
ISteamAppList *m_pSteamAppList;
|
||||
ISteamMusic *m_pSteamMusic;
|
||||
#ifdef _PS3
|
||||
ISteamPS3OverlayRender *m_pSteamPS3OverlayRender;
|
||||
#endif
|
||||
@@ -444,9 +452,11 @@ inline void CSteamAPIContext::Clear()
|
||||
m_pSteamRemoteStorage = NULL;
|
||||
m_pSteamHTTP = NULL;
|
||||
m_pSteamScreenshots = NULL;
|
||||
m_pSteamMusic = NULL;
|
||||
m_pSteamUnifiedMessages = NULL;
|
||||
m_pController = NULL;
|
||||
m_pSteamUGC = NULL;
|
||||
m_pSteamAppList = NULL;
|
||||
#ifdef _PS3
|
||||
m_pSteamPS3OverlayRender = NULL;
|
||||
#endif
|
||||
@@ -517,6 +527,16 @@ inline bool CSteamAPIContext::Init()
|
||||
if ( !m_pSteamUGC )
|
||||
return false;
|
||||
|
||||
m_pSteamAppList = SteamClient()->GetISteamAppList( hSteamUser, hSteamPipe, STEAMAPPLIST_INTERFACE_VERSION );
|
||||
if ( !m_pSteamAppList )
|
||||
return false;
|
||||
|
||||
m_pSteamMusic = SteamClient()->GetISteamMusic( hSteamUser, hSteamPipe, STEAMMUSIC_INTERFACE_VERSION );
|
||||
if ( !m_pSteamMusic )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _PS3
|
||||
m_pSteamPS3OverlayRender = SteamClient()->GetISteamPS3OverlayRender();
|
||||
#endif
|
||||
|
||||
@@ -221,19 +221,21 @@ enum EAppReleaseState
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
enum EAppOwernshipFlags
|
||||
enum EAppOwnershipFlags
|
||||
{
|
||||
k_EAppOwernshipFlags_None = 0x000, // unknown
|
||||
k_EAppOwernshipFlags_OwnsLicense = 0x001, // owns license for this game
|
||||
k_EAppOwernshipFlags_FreeLicense = 0x002, // not paid for game
|
||||
k_EAppOwernshipFlags_RegionRestricted = 0x004, // owns app, but not allowed to play in current region
|
||||
k_EAppOwernshipFlags_LowViolence = 0x008, // only low violence version
|
||||
k_EAppOwernshipFlags_InvalidPlatform = 0x010, // app not supported on current platform
|
||||
k_EAppOwernshipFlags_SharedLicense = 0x020, // license was granted by authorized local device
|
||||
k_EAppOwernshipFlags_FreeWeekend = 0x040, // owned by a free weekend licenses
|
||||
k_EAppOwernshipFlags_LicenseLocked = 0x080, // shared license is locked (in use) by other user
|
||||
k_EAppOwernshipFlags_LicensePending = 0x100, // owns app, but transaction is still pending. Can't install or play
|
||||
k_EAppOwernshipFlags_LicenseExpired = 0x200, // doesn't own app anymore since license expired
|
||||
k_EAppOwnershipFlags_None = 0x000, // unknown
|
||||
k_EAppOwnershipFlags_OwnsLicense = 0x001, // owns license for this game
|
||||
k_EAppOwnershipFlags_FreeLicense = 0x002, // not paid for game
|
||||
k_EAppOwnershipFlags_RegionRestricted = 0x004, // owns app, but not allowed to play in current region
|
||||
k_EAppOwnershipFlags_LowViolence = 0x008, // only low violence version
|
||||
k_EAppOwnershipFlags_InvalidPlatform = 0x010, // app not supported on current platform
|
||||
k_EAppOwnershipFlags_SharedLicense = 0x020, // license was granted by authorized local device
|
||||
k_EAppOwnershipFlags_FreeWeekend = 0x040, // owned by a free weekend licenses
|
||||
k_EAppOwnershipFlags_LicenseLocked = 0x080, // shared license is locked (in use) by other user
|
||||
k_EAppOwnershipFlags_LicensePending = 0x100, // owns app, but transaction is still pending. Can't install or play
|
||||
k_EAppOwnershipFlags_LicenseExpired = 0x200, // doesn't own app anymore since license expired
|
||||
k_EAppOwnershipFlags_LicensePermanent = 0x400, // permanent license, not borrowed, or guest or freeweekend etc
|
||||
k_EAppOwnershipFlags_LicenseRecurring = 0x800, // Recurring license, user is charged periodically
|
||||
};
|
||||
|
||||
|
||||
@@ -468,7 +470,7 @@ public:
|
||||
m_steamid.m_comp.m_EUniverse = eUniverse;
|
||||
m_steamid.m_comp.m_EAccountType = eAccountType;
|
||||
|
||||
if ( eAccountType == k_EAccountTypeClan )
|
||||
if ( eAccountType == k_EAccountTypeClan || eAccountType == k_EAccountTypeGameServer )
|
||||
{
|
||||
m_steamid.m_comp.m_unAccountInstance = 0;
|
||||
}
|
||||
|
||||
+21
-11
@@ -77,13 +77,13 @@ public:
|
||||
// ------------------------------------
|
||||
|
||||
/** Size and position that the window needs to be on the VR display. */
|
||||
virtual bool GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
|
||||
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 disortion into */
|
||||
virtual void GetEyeOutputViewport( Hmd_Eye eEye, GraphicsAPIConvention eAPIType, uint32_t *pnX, uint32_t *pnY, 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;
|
||||
@@ -96,11 +96,11 @@ public:
|
||||
* 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 between the view space and eye space. Eye space is the per-eye flavor of view
|
||||
* space that provides stereo disparity. Instead of Model * View * Projection the model is Model * View * Eye * Projection.
|
||||
* Normally View and Eye will be multiplied together and treated as View in your application.
|
||||
/** 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 HmdMatrix44_t GetEyeMatrix( Hmd_Eye eEye ) = 0;
|
||||
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.
|
||||
@@ -113,6 +113,12 @@ public:
|
||||
*/
|
||||
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;
|
||||
|
||||
// ------------------------------------
|
||||
// Tracking Methods
|
||||
// ------------------------------------
|
||||
@@ -120,18 +126,18 @@ public:
|
||||
/** 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 analagous to the inverse of the view matrix in most applications, though
|
||||
* 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 GetWorldFromHeadPose( float fPredictedSecondsFromNow, HmdMatrix34_t *pmPose, HmdTrackingResult *peResult ) = 0;
|
||||
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 GetLastWorldFromHeadPose( HmdMatrix34_t *pmPose ) = 0;
|
||||
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. */
|
||||
@@ -143,6 +149,10 @@ public:
|
||||
* 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
|
||||
// ------------------------------------
|
||||
@@ -158,7 +168,7 @@ public:
|
||||
virtual uint32_t GetDisplayId( char *pchBuffer, uint32_t unBufferLen ) = 0;
|
||||
};
|
||||
|
||||
static const char * const IHmd_Version = "IHmd_002";
|
||||
static const char * const IHmd_Version = "IHmd_004";
|
||||
|
||||
/** error codes returned by Vr_Init */
|
||||
enum HmdError
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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 gameenginesdl.cpp Leaderboards.cpp Lobby.cpp Main.cpp MainMenu.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
|
||||
SOURCEFILES := BaseMenu.cpp clanchatroom.cpp connectingmenu.cpp gameenginesdl.cpp glew.c Leaderboards.cpp Lobby.cpp Main.cpp MainMenu.cpp musicplayer.cpp p2pauth.cpp PhotonBeam.cpp QuitMenu.cpp RemoteStorage.cpp remotestoragesync.cpp ServerBrowser.cpp Ship.cpp SpaceWarClient.cpp SpaceWarEntity.cpp SpaceWarServer.cpp StarField.cpp StatsAndAchievements.cpp stdafx.cpp steamvrglhelper.cpp Sun.cpp VectorEntity.cpp voicechat.cpp
|
||||
|
||||
TARGETNAME := SteamworksExampleLinux
|
||||
#TARGETTYPE can be APP, STATIC or SHARED
|
||||
|
||||
@@ -54,7 +54,7 @@ INCLUDE_DIRS := $(STEAMWORKS_SDK)/public
|
||||
LIBRARY_DIRS := $(STEAMWORKS_SDK)/public/steam/lib/linux32 $(STEAMWORKS_SDK)/redistributable_bin/linux32
|
||||
LIBRARY_NAMES := steam_api
|
||||
|
||||
CFLAGS := -g -DPOSIX -DSDL $(shell STEAM_RUNTIME_ROOT=$(STEAM_RUNTIME_ROOT) $(SDL_CONFIG) --cflags)
|
||||
CFLAGS := -g -DPOSIX -DSDL $(shell STEAM_RUNTIME_ROOT=$(STEAM_RUNTIME_ROOT) $(SDL_CONFIG) --cflags) -DGNUC
|
||||
DEBUG_CFLAGS := -O0
|
||||
RELEASE_CFLAGS := -O3
|
||||
|
||||
|
||||
@@ -1045,10 +1045,13 @@ bool CGameEngineGL::BUberRenderPrimitive( IDirect3DVertexShader9 *vsh,
|
||||
if ( !m_pD3D9Device )
|
||||
return false;
|
||||
|
||||
BSetShaders ( vsh, psh );
|
||||
BSetVertexDeclaration ( decl );
|
||||
BSetStreamSource ( streamNumber, hVertBuf, 0 /*uOffset*/, uStride ); // streams are based at start of buffer
|
||||
BRenderPrimitive ( primType, uStartVertex, uCount ); // uStartVertex advances the fetch offset from the base
|
||||
bool bRes = false;
|
||||
bRes |= BSetShaders ( vsh, psh );
|
||||
bRes |= BSetVertexDeclaration ( decl );
|
||||
bRes |= BSetStreamSource ( streamNumber, hVertBuf, 0 /*uOffset*/, uStride ); // streams are based at start of buffer
|
||||
bRes |= BRenderPrimitive ( primType, uStartVertex, uCount ); // uStartVertex advances the fetch offset from the base
|
||||
|
||||
return bRes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,18 +11,20 @@
|
||||
#include <queue>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "gameenginesdl.h"
|
||||
#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()
|
||||
IGameEngine *CreateGameEngineSDL( bool bUseVR )
|
||||
{
|
||||
static CGameEngineGL* s_pGameEngine = NULL;
|
||||
|
||||
if (!s_pGameEngine)
|
||||
{
|
||||
s_pGameEngine = new CGameEngineGL();
|
||||
s_pGameEngine = new CGameEngineGL( bUseVR );
|
||||
}
|
||||
|
||||
return s_pGameEngine;
|
||||
@@ -80,7 +82,7 @@ power_of_two(int input)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor for game engine instance
|
||||
//-----------------------------------------------------------------------------
|
||||
CGameEngineGL::CGameEngineGL()
|
||||
CGameEngineGL::CGameEngineGL( bool bUseVR )
|
||||
{
|
||||
g_engine = this;
|
||||
|
||||
@@ -112,8 +114,24 @@ CGameEngineGL::CGameEngineGL()
|
||||
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" );
|
||||
@@ -138,6 +156,13 @@ 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 );
|
||||
}
|
||||
@@ -228,17 +253,32 @@ bool CGameEngineGL::BInitializeAudio()
|
||||
|
||||
bool CGameEngineGL::BInitializeGraphics()
|
||||
{
|
||||
m_nWindowWidth = 1024;
|
||||
m_nWindowHeight = 768;
|
||||
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;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
|
||||
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
|
||||
|
||||
m_window = SDL_CreateWindow( "SteamworksExample",
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED,
|
||||
m_nWindowWidth,
|
||||
m_nWindowHeight,
|
||||
windowX,
|
||||
windowY,
|
||||
nWindowWidth,
|
||||
nWindowHeight,
|
||||
SDL_WINDOW_OPENGL );
|
||||
if ( !m_window ) {
|
||||
OutputDebugString( "Couldn't create SDL window: " );
|
||||
@@ -255,6 +295,13 @@ bool CGameEngineGL::BInitializeGraphics()
|
||||
return false;
|
||||
}
|
||||
|
||||
GLenum err = glewInit();
|
||||
if( err != GLEW_OK )
|
||||
{
|
||||
fprintf(stderr, "glewInit failed with %s\n", glewGetErrorString( err ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_GL_SetSwapInterval( 1 );
|
||||
|
||||
// Clear any errors
|
||||
@@ -295,6 +342,18 @@ 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;
|
||||
@@ -302,7 +361,17 @@ bool CGameEngineGL::BInitializeGraphics()
|
||||
|
||||
void CGameEngineGL::AdjustViewport()
|
||||
{
|
||||
SDL_GetWindowSize( m_window, &m_nWindowWidth, &m_nWindowHeight );
|
||||
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 );
|
||||
}
|
||||
|
||||
// Perspective
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -312,6 +381,8 @@ void CGameEngineGL::AdjustViewport()
|
||||
|
||||
// View port has changed as well
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0, 0, 0 );
|
||||
|
||||
glViewport( 0, 0, m_nWindowWidth, m_nWindowHeight );
|
||||
glScissor( 0, 0, m_nWindowWidth, m_nWindowHeight );
|
||||
@@ -416,6 +487,42 @@ 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 );
|
||||
|
||||
@@ -627,6 +734,78 @@ 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
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -918,7 +1097,7 @@ void CGameEngineGL::MessagePump()
|
||||
}
|
||||
else if ( event.type == SDL_QUIT )
|
||||
{
|
||||
CreateGameEngineSDL()->Shutdown();
|
||||
CreateGameEngineSDL( false )->Shutdown();
|
||||
}
|
||||
|
||||
} while ( !BShuttingDown() );
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
typedef unsigned char byte;
|
||||
|
||||
#include "GameEngine.h"
|
||||
#include "steam/steamvr.h"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
@@ -59,13 +60,14 @@ typedef unsigned char byte;
|
||||
|
||||
class CVoiceContext;
|
||||
class GLString;
|
||||
class CSteamVRGLHelper;
|
||||
|
||||
class CGameEngineGL : public IGameEngine
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
CGameEngineGL();
|
||||
CGameEngineGL( bool bUseVR );
|
||||
|
||||
// Destructor
|
||||
~CGameEngineGL() { Shutdown(); }
|
||||
@@ -169,6 +171,9 @@ 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;
|
||||
|
||||
@@ -242,6 +247,11 @@ public:
|
||||
// Map of voice handles
|
||||
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
|
||||
|
||||
@@ -571,13 +571,11 @@ bool CGameEngineWin32::BCreateGameWindow( int nShowCommand )
|
||||
{
|
||||
int32 x, y;
|
||||
uint32 w, h;
|
||||
if ( m_pVRHmd->GetWindowBounds( &x, &y, &w, &h ) )
|
||||
{
|
||||
m_nWindowWidth = w;
|
||||
m_nWindowHeight = h;
|
||||
windowX = x;
|
||||
windowY = y;
|
||||
}
|
||||
m_pVRHmd->GetWindowBounds( &x, &y, &w, &h );
|
||||
m_nWindowWidth = w;
|
||||
m_nWindowHeight = h;
|
||||
windowX = x;
|
||||
windowY = y;
|
||||
}
|
||||
|
||||
WNDCLASS wc;
|
||||
@@ -970,7 +968,7 @@ void CGameEngineWin32::EndFrame()
|
||||
|
||||
// get the viewport from the Hmd
|
||||
uint32 vpx, vpy, vpw, vph;
|
||||
m_pVRHmd->GetEyeOutputViewport( eye, vr::API_DirectX, &vpx, &vpy, &vpw, &vph );
|
||||
m_pVRHmd->GetEyeOutputViewport( eye, &vpx, &vpy, &vpw, &vph );
|
||||
|
||||
if ( FAILED( m_pD3D9Device->SetPixelShader( m_pVRDistortionPixelShader ) ) )
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,206 @@
|
||||
//========= Copyright � 1996-2009, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose: Class for tracking leaderboards
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "musicplayer.h"
|
||||
#include "BaseMenu.h"
|
||||
#include <math.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Menu that shows a music player
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMusicPlayerMenu : public CBaseMenu< MusicPlayerMenuItem_t >
|
||||
{
|
||||
public:
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CMusicPlayerMenu( IGameEngine *pGameEngine )
|
||||
: CBaseMenu< MusicPlayerMenuItem_t >( pGameEngine )
|
||||
, m_menuItemPause( "Pause" )
|
||||
, m_menuItemPlay( "Play" )
|
||||
, m_menuItemPlayPrevious( "Play Previous" )
|
||||
, m_menuItemPlayNext( "Play Next" )
|
||||
, m_menuItemIncreaseVolume( "Increase Volume" )
|
||||
, m_menuItemDecreaseVolume( "Decrease Volume" )
|
||||
, m_menuItemBack( "Back" )
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Creates menu
|
||||
//-----------------------------------------------------------------------------
|
||||
void Rebuild()
|
||||
{
|
||||
PushSelectedItem();
|
||||
ClearMenuItems();
|
||||
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Pause", m_menuItemPause ) );
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Play", m_menuItemPlay ) );
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Play Previous", m_menuItemPlayPrevious ) );
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Play Next", m_menuItemPlayNext ) );
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Increase Volume", m_menuItemIncreaseVolume ) );
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Decrease Volume", m_menuItemDecreaseVolume ) );
|
||||
AddMenuItem( CMusicPlayerMenu::MenuItem_t( "Return to main menu", m_menuItemBack ) );
|
||||
|
||||
UpdateHeading();
|
||||
|
||||
PopSelectedItem();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void UpdateHeading()
|
||||
{
|
||||
const char *pchEnabled = "Disabled";
|
||||
|
||||
if ( SteamMusic()->BIsEnabled() )
|
||||
{
|
||||
pchEnabled = "Enabled";
|
||||
}
|
||||
|
||||
const char *pchPlaybackStatus = "";
|
||||
AudioPlayback_Status nStatus = SteamMusic()->GetPlaybackStatus();
|
||||
switch( nStatus )
|
||||
{
|
||||
case AudioPlayback_Undefined:
|
||||
pchPlaybackStatus = "Undefined";
|
||||
break;
|
||||
case AudioPlayback_Playing:
|
||||
pchPlaybackStatus = "Playing";
|
||||
break;
|
||||
case AudioPlayback_Paused:
|
||||
pchPlaybackStatus = "Paused";
|
||||
break;
|
||||
case AudioPlayback_Idle:
|
||||
pchPlaybackStatus = "Done";
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
// Music Volume is between 0.0 and 1.0: multiply by ten, so its equivalent to Big Picture display.
|
||||
float flVolume = SteamMusic()->GetVolume();
|
||||
int nVolume = int( flVolume * 10 );
|
||||
|
||||
sprintf_safe( m_szHeadingString, "Music: %s Status: %s Volume: %d", pchEnabled, pchPlaybackStatus, nVolume );
|
||||
SetHeading( m_szHeadingString );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: variables
|
||||
//-----------------------------------------------------------------------------
|
||||
char m_szHeadingString[255]; // String to show in server browser
|
||||
|
||||
MusicPlayerMenuItem_t m_menuItemPause;
|
||||
MusicPlayerMenuItem_t m_menuItemPlay;
|
||||
MusicPlayerMenuItem_t m_menuItemPlayPrevious;
|
||||
MusicPlayerMenuItem_t m_menuItemPlayNext;
|
||||
|
||||
MusicPlayerMenuItem_t m_menuItemIncreaseVolume;
|
||||
MusicPlayerMenuItem_t m_menuItemDecreaseVolume;
|
||||
|
||||
MusicPlayerMenuItem_t m_menuItemBack;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CMusicPlayer::CMusicPlayer( IGameEngine *pGameEngine )
|
||||
: m_pGameEngine( pGameEngine )
|
||||
, m_CallbackVolumeChanged( this, &CMusicPlayer::OnVolumeChanged )
|
||||
, m_CallbackPlaybackStatusHasChanged( this, &CMusicPlayer::OnPlaybackStatusHasChanged )
|
||||
{
|
||||
m_pMusicPlayerMenu = new CMusicPlayerMenu( pGameEngine );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Run a frame
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMusicPlayer::RunFrame()
|
||||
{
|
||||
m_pMusicPlayerMenu->RunFrame();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handles menu actions
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMusicPlayer::OnMenuSelection( MusicPlayerMenuItem_t selection )
|
||||
{
|
||||
if (selection == m_pMusicPlayerMenu->m_menuItemPlay)
|
||||
{
|
||||
SteamMusic()->Play();
|
||||
}
|
||||
else if (selection == m_pMusicPlayerMenu->m_menuItemPause)
|
||||
{
|
||||
SteamMusic()->Pause();
|
||||
}
|
||||
else if (selection == m_pMusicPlayerMenu->m_menuItemPlayPrevious)
|
||||
{
|
||||
SteamMusic()->PlayPrevious();
|
||||
}
|
||||
else if (selection == m_pMusicPlayerMenu->m_menuItemPlayNext)
|
||||
{
|
||||
SteamMusic()->PlayNext();
|
||||
}
|
||||
else if (selection == m_pMusicPlayerMenu->m_menuItemIncreaseVolume)
|
||||
{
|
||||
// conversion necessary, because the UI in big picture shows 10 bars,
|
||||
// but volume is a value between 0.0 and 1.0
|
||||
float flVolume = SteamMusic()->GetVolume();
|
||||
int nVolume = int( flVolume * 10 );
|
||||
nVolume = MIN( nVolume + 1, 10 );
|
||||
SteamMusic()->SetVolume( (float)nVolume * 0.1f );
|
||||
}
|
||||
else if (selection == m_pMusicPlayerMenu->m_menuItemDecreaseVolume)
|
||||
{
|
||||
// conversion necessary, because the UI in big picture shows 10 bars,
|
||||
// but volume is a value between 0.0 and 1.0
|
||||
float flVolume = SteamMusic()->GetVolume();
|
||||
int nVolume = int( flVolume * 10 );
|
||||
nVolume = MAX( nVolume - 1, 0 );
|
||||
SteamMusic()->SetVolume( (float)nVolume * 0.1f );
|
||||
}
|
||||
else if (selection == m_pMusicPlayerMenu->m_menuItemBack)
|
||||
{
|
||||
SpaceWarClient()->SetGameState(k_EClientGameMenu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Shows / Refreshes
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMusicPlayer::Show()
|
||||
{
|
||||
m_pMusicPlayerMenu->Rebuild();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMusicPlayer::OnPlaybackStatusHasChanged( PlaybackStatusHasChanged_t *pPlaybackStatusHasChanged )
|
||||
{
|
||||
m_pMusicPlayerMenu->UpdateHeading();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMusicPlayer::OnVolumeChanged( VolumeHasChanged_t *pVolumeChanged )
|
||||
{
|
||||
m_pMusicPlayerMenu->UpdateHeading();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//========= Copyright © 1996-2009, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose: Class for controlling the Music Player
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef MUSICPLAYER_H
|
||||
#define MUSICPLAYER_H
|
||||
|
||||
#include "GameEngine.h"
|
||||
|
||||
class CMusicPlayerMenu;
|
||||
|
||||
|
||||
struct MusicPlayerMenuItem_t
|
||||
{
|
||||
const char *m_pchCommand;
|
||||
|
||||
MusicPlayerMenuItem_t() : m_pchCommand( "" ) {}
|
||||
MusicPlayerMenuItem_t( const char *pchCommand ) : m_pchCommand( pchCommand ) {}
|
||||
|
||||
bool operator==( const MusicPlayerMenuItem_t& rhs ) const
|
||||
{
|
||||
return strncmp( m_pchCommand, rhs.m_pchCommand, strlen( m_pchCommand ) ) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CMusicPlayer
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
CMusicPlayer( IGameEngine *pGameEngine );
|
||||
|
||||
// Run a frame
|
||||
void RunFrame();
|
||||
|
||||
// shows / refreshes music player
|
||||
void Show();
|
||||
|
||||
// handles input from menu
|
||||
void OnMenuSelection( MusicPlayerMenuItem_t selection );
|
||||
|
||||
private:
|
||||
|
||||
IGameEngine *m_pGameEngine;
|
||||
CMusicPlayerMenu *m_pMusicPlayerMenu;
|
||||
|
||||
STEAM_CALLBACK( CMusicPlayer, OnPlaybackStatusHasChanged, PlaybackStatusHasChanged_t, m_CallbackPlaybackStatusHasChanged );
|
||||
STEAM_CALLBACK( CMusicPlayer, OnVolumeChanged, VolumeHasChanged_t, m_CallbackVolumeChanged );
|
||||
};
|
||||
|
||||
#endif // MUSICPLAYER_H
|
||||
Binary file not shown.
@@ -0,0 +1,485 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#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
|
||||
@@ -50,6 +50,8 @@
|
||||
50E77DF51362190C000FC072 /* glmgrext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DE61362190C000FC072 /* glmgrext.cpp */; };
|
||||
50E77DF61362190C000FC072 /* mathlite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50E77DE91362190C000FC072 /* mathlite.cpp */; };
|
||||
50E77DF813621991000FC072 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50E77DF713621991000FC072 /* IOKit.framework */; };
|
||||
F803305119087F9200344590 /* musicplayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F803305019087F9200344590 /* musicplayer.cpp */; };
|
||||
F80330831908872600344590 /* controller.vdf in Resources */ = {isa = PBXBuildFile; fileRef = F80330821908872600344590 /* controller.vdf */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -153,6 +155,9 @@
|
||||
50E77DE91362190C000FC072 /* mathlite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathlite.cpp; path = ../glmgr/mathlite.cpp; sourceTree = "<group>"; };
|
||||
50E77DEA1362190C000FC072 /* mathlite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathlite.h; path = ../glmgr/mathlite.h; sourceTree = "<group>"; };
|
||||
50E77DF713621991000FC072 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||
F803304F19087DA600344590 /* musicplayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = musicplayer.h; sourceTree = "<group>"; };
|
||||
F803305019087F9200344590 /* musicplayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = musicplayer.cpp; sourceTree = "<group>"; };
|
||||
F80330821908872600344590 /* controller.vdf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = controller.vdf; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -210,6 +215,7 @@
|
||||
503C6CE51268F49F00B66E3B /* Lobby.cpp */,
|
||||
503C6CE71268F49F00B66E3B /* Main.cpp */,
|
||||
503C6CE81268F49F00B66E3B /* MainMenu.cpp */,
|
||||
F803305019087F9200344590 /* musicplayer.cpp */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
@@ -219,6 +225,7 @@
|
||||
children = (
|
||||
504EDCC01269025A00F96D63 /* steam_appid.txt */,
|
||||
504EDCB4126900D600F96D63 /* steamworksexample-Info.plist */,
|
||||
F80330821908872600344590 /* controller.vdf */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
@@ -274,6 +281,7 @@
|
||||
503C6CE61268F49F00B66E3B /* Lobby.h */,
|
||||
503C6CE91268F49F00B66E3B /* MainMenu.h */,
|
||||
503C6CEA1268F49F00B66E3B /* Messages.h */,
|
||||
F803304F19087DA600344590 /* musicplayer.h */,
|
||||
);
|
||||
name = Headers;
|
||||
sourceTree = "<group>";
|
||||
@@ -337,6 +345,8 @@
|
||||
/* Begin PBXProject section */
|
||||
503C6CA51268F34200B66E3B /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
};
|
||||
buildConfigurationList = 503C6CA81268F34200B66E3B /* Build configuration list for PBXProject "steamworksexample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
@@ -359,6 +369,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F80330831908872600344590 /* controller.vdf in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -371,6 +382,7 @@
|
||||
files = (
|
||||
503C6D0F1268F49F00B66E3B /* BaseMenu.cpp in Sources */,
|
||||
503C6D101268F49F00B66E3B /* connectingmenu.cpp in Sources */,
|
||||
F803305119087F9200344590 /* musicplayer.cpp in Sources */,
|
||||
503C6D121268F49F00B66E3B /* gameengineosx.mm in Sources */,
|
||||
503C6D131268F49F00B66E3B /* glstringosx.mm in Sources */,
|
||||
503C6D141268F49F00B66E3B /* Leaderboards.cpp in Sources */,
|
||||
@@ -428,7 +440,7 @@
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
SDKROOT = macosx10.8;
|
||||
USER_HEADER_SEARCH_PATHS = ../public;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -448,7 +460,7 @@
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
SDKROOT = macosx10.8;
|
||||
USER_HEADER_SEARCH_PATHS = ../public;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
STEAMROOT="$(cd "${0%/*}" && echo $PWD)"
|
||||
STEAMEXE=`basename "$0" .sh`
|
||||
|
||||
UNAME=`uname`
|
||||
if [ "$UNAME" == "Linux" ]; then
|
||||
PLATFORM=linux32
|
||||
export LD_LIBRARY_PATH="$STEAMROOT/$PLATFORM:$LD_LIBRARY_PATH"
|
||||
else # if [ "$UNAME" == "Darwin" ]; then
|
||||
PLATFORM=osx32
|
||||
export DYLD_LIBRARY_PATH="$STEAMROOT/$PLATFORM:$DYLD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
ulimit -n 2048
|
||||
|
||||
MAGIC_RESTART_EXITCODE=42
|
||||
|
||||
if [ "$DEBUGGER" == "gdb" ] || [ "$DEBUGGER" == "cgdb" ]; then
|
||||
ARGSFILE=$(mktemp $USER.steam.gdb.XXXX)
|
||||
|
||||
# Set the LD_PRELOAD varname in the debugger, and unset the global version.
|
||||
if [ "$LD_PRELOAD" ]; then
|
||||
echo set env LD_PRELOAD=$LD_PRELOAD >> "$ARGSFILE"
|
||||
echo show env LD_PRELOAD >> "$ARGSFILE"
|
||||
unset LD_PRELOAD
|
||||
fi
|
||||
|
||||
$DEBUGGER -x "$ARGSFILE" "$STEAMROOT/$PLATFORM/$STEAMEXE" "$@"
|
||||
rm "$ARGSFILE"
|
||||
else
|
||||
$DEBUGGER "$STEAMROOT/$PLATFORM/$STEAMEXE" "$@"
|
||||
fi
|
||||
|
||||
STATUS=$?
|
||||
|
||||
if [ $STATUS -eq $MAGIC_RESTART_EXITCODE ]; then
|
||||
exec "$0" "$@"
|
||||
fi
|
||||
exit $STATUS
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Breakpad
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
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.
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.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user