Remove all PS3 support

This commit is contained in:
Riley Labrecque
2021-03-25 22:42:12 -07:00
parent 37e939ea0d
commit bac226c204
18 changed files with 7 additions and 2829 deletions
-3
View File
@@ -163,8 +163,6 @@ void RunGameLoop( IGameEngine *pGameEngine, const char *pchServerAddress, const
//-----------------------------------------------------------------------------
// Purpose: Real main entry point for the program
//-----------------------------------------------------------------------------
#ifndef _PS3
static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow )
{
@@ -283,7 +281,6 @@ static int RealMain( const char *pchCmdLine, HINSTANCE hInstance, int nCmdShow )
// exit
return EXIT_SUCCESS;
}
#endif
//-----------------------------------------------------------------------------
// Purpose: Main entry point for the program -- win32
-4
View File
@@ -42,10 +42,6 @@
CRemoteStorage::CRemoteStorage( IGameEngine *pGameEngine ) : m_pGameEngine( pGameEngine ), m_pRemoteStorageSync(NULL)
{
m_pRemoteStorageScreen = new CRemoteStorageScreen( pGameEngine );
#ifdef _PS3
m_pRemoteStorageSync = new CRemoteStorageSync( pGameEngine );
#endif
}
-14
View File
@@ -116,8 +116,6 @@ inline T QWordSwap( T dw )
return *((T*)&temp);
}
#ifndef _PS3
#define LittleInt16( val ) ( val )
#define LittleWord( val ) ( val )
#define LittleInt32( val ) ( val )
@@ -125,18 +123,6 @@ inline T QWordSwap( T dw )
#define LittleQWord( val ) ( val )
#define LittleFloat( val ) ( val )
#else
#define LittleInt16( val ) WordSwap( val )
#define LittleWord( val ) WordSwap( val )
#define LittleInt32( val ) DWordSwap( val )
#define LittleDWord( val ) DWordSwap( val )
#define LittleQWord( val ) QWordSwap( val )
#define LittleFloat( val ) DWordSwap( val )
#endif
// Leaderboard names
#define LEADERBOARD_QUICKEST_WIN "Quickest Win"
#define LEADERBOARD_FEET_TRAVELED "Feet Traveled"
+3 -45
View File
@@ -61,21 +61,12 @@ CSpaceWarClient::CSpaceWarClient( IGameEngine *pGameEngine )
void CSpaceWarClient::Init( IGameEngine *pGameEngine )
{
// On PC/OSX we always know the user has a SteamID and is logged in already,
// as Steam enforces this before game launch. On PS3 however the game must
// initiate the logon and we need to check the state here and block the user
// while Steam connects.
// as Steam enforces this before game launch.
if ( SteamUser()->BLoggedOn() )
{
m_SteamIDLocalUser = SteamUser()->GetSteamID();
m_eGameState = k_EClientGameMenu;
}
#ifdef _PS3
else
{
m_eGameState = k_EClientConnectingToSteam;
SteamUser()->LogOn( true );
}
#endif
g_pSpaceWarClient = this;
m_pGameEngine = pGameEngine;
@@ -1436,34 +1427,13 @@ void CSpaceWarClient::RunFrame()
m_pGameEngine->SetSteamControllerActionSet( eControllerActionSet_MenuControls );
break;
case k_EClientRetrySteamConnection:
#ifdef _PS3
m_pStarField->Render();
SteamUser()->LogOn( true );
m_pConnectingMenu->Reset();
SetGameState( k_EClientConnectingToSteam );
#else
OutputDebugString( "Invalidate state k_EClientRetrySteamConnection hit on non-PS3 platform" );
#endif
break;
case k_EClientLinkSteamAccount:
#ifdef _PS3
m_pStarField->Render();
SteamUser()->LogOnAndLinkSteamAccountToPSN( true, "jmccaskeybeta", "test123" );
m_pConnectingMenu->Reset();
SetGameState( k_EClientConnectingToSteam );
#else
OutputDebugString( "Invalidate state k_EClientLinkSteamAccount hit on non-PS3 platform" );
#endif
break;
case k_EClientAutoCreateAccount:
#ifdef _PS3
m_pStarField->Render();
m_pConnectingMenu->Reset();
SteamUser()->LogOnAndCreateNewSteamAccountIfNeeded( true );
SetGameState( k_EClientConnectingToSteam );
#else
OutputDebugString( "Invalidate state k_EClientAutoCreateAccount hit on non-PS3 platform" );
#endif
break;
case k_EClientGameMenu:
m_pStarField->Render();
@@ -1722,7 +1692,7 @@ void CSpaceWarClient::RunFrame()
if ( !m_bSentWebOpen )
{
m_bSentWebOpen = true;
#ifndef _PS3
char szCurDir[MAX_PATH];
if ( !_getcwd( szCurDir, sizeof(szCurDir) ) )
{
@@ -1733,7 +1703,6 @@ void CSpaceWarClient::RunFrame()
// load the test html page, it just has a steam://gamewebcallback link in it
SteamFriends()->ActivateGameOverlayToWebPage( szURL );
SetGameState( k_EClientGameMenu );
#endif
}
break;
@@ -1852,16 +1821,8 @@ void CSpaceWarClient::RunFrame()
void CSpaceWarClient::DrawHUDText()
{
// Padding from the edge of the screen for hud elements
#ifdef _PS3
// Larger padding on PS3, since many of our test HDTVs truncate
// edges of the screen and can't be calibrated properly.
const int32 nHudPaddingVertical = 20;
const int32 nHudPaddingHorizontal = 35;
#else
const int32 nHudPaddingVertical = 15;
const int32 nHudPaddingHorizontal = 15;
#endif
const int32 width = m_pGameEngine->GetViewportWidth();
const int32 height = m_pGameEngine->GetViewportHeight();
@@ -2026,11 +1987,8 @@ void CSpaceWarClient::DrawInstructions()
rect.right = width;
char rgchBuffer[256];
#ifdef _PS3
sprintf_safe( rgchBuffer, "Turn Ship Left: 'Left'\nTurn Ship Right: 'Right'\nForward Thrusters: 'R2'\nReverse Thrusters: 'L2'\nFire Photon Beams: 'Cross'" );
#else
sprintf_safe( rgchBuffer, "Turn Ship Left: 'A'\nTurn Ship Right: 'D'\nForward Thrusters: 'W'\nReverse Thrusters: 'S'\nFire Photon Beams: 'Space'" );
#endif
m_pGameEngine->BDrawString( m_hInstructionsFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_CENTER|TEXTPOS_VCENTER, rgchBuffer );
+2 -129
View File
@@ -44,8 +44,7 @@ CStatsAndAchievements::CStatsAndAchievements( IGameEngine *pGameEngine )
m_GameID( SteamUtils()->GetAppID() ),
m_CallbackUserStatsReceived( this, &CStatsAndAchievements::OnUserStatsReceived ),
m_CallbackUserStatsStored( this, &CStatsAndAchievements::OnUserStatsStored ),
m_CallbackAchievementStored( this, &CStatsAndAchievements::OnAchievementStored ),
m_CallbackPS3TrophiesInstalled( this, &CStatsAndAchievements::OnPS3TrophiesInstalled )
m_CallbackAchievementStored( this, &CStatsAndAchievements::OnAchievementStored )
{
m_pSteamUser = SteamUser();
m_pSteamUserStats = SteamUserStats();
@@ -67,9 +66,6 @@ CStatsAndAchievements::CStatsAndAchievements( IGameEngine *pGameEngine )
m_hDisplayFont = pGameEngine->HCreateFont( ACHDISP_FONT_HEIGHT, FW_MEDIUM, false, "Arial" );
if ( !m_hDisplayFont )
OutputDebugString( "Stats font was not created properly, text won't draw\n" );
m_bInstalledPS3Trophies = false;
m_bStartedPS3TrophyInstall = false;
}
#pragma warning( pop )
@@ -79,31 +75,8 @@ CStatsAndAchievements::CStatsAndAchievements( IGameEngine *pGameEngine )
//-----------------------------------------------------------------------------
void CStatsAndAchievements::RunFrame()
{
// On PS3, must first install trophies before using the stats system
if ( !m_bInstalledPS3Trophies )
if ( !m_bRequestedStats )
{
#ifdef _PS3
// PS3 trophies should be installed before writing to disk. Check PS3TrophiesInstalled_t to determine
// if trophy installation failed because the machine is out of free HD space.
if ( !m_bStartedPS3TrophyInstall )
{
if ( !m_pSteamUserStats->InstallPS3Trophies() )
{
OutputDebugString( "Failed to install PS3 trophies. This is a fatal error\n" );
exit( 1 );
}
m_bStartedPS3TrophyInstall = true;
}
// wait for PS3TrophiesInstalled_t
#else
m_bInstalledPS3Trophies = true;
m_bStartedPS3TrophyInstall = true;
#endif
}
else if ( !m_bRequestedStats )
{
// Is Steam Loaded? if no, can't get stats, done
if ( NULL == m_pSteamUserStats || NULL == m_pSteamUser )
{
@@ -111,8 +84,6 @@ void CStatsAndAchievements::RunFrame()
return;
}
LoadUserStatsOnPS3();
// If yes, request our stats
bool bSuccess = m_pSteamUserStats->RequestCurrentStats();
@@ -322,8 +293,6 @@ void CStatsAndAchievements::OnUserStatsReceived( UserStatsReceived_t *pCallback
m_pSteamUserStats->GetStat( "FeetTraveled", &m_flTotalFeetTraveled );
m_pSteamUserStats->GetStat( "MaxFeetTraveled", &m_flMaxFeetTraveled );
m_pSteamUserStats->GetStat( "AverageSpeed", &m_flAverageSpeed );
SaveUserStatsOnPS3();
}
else
{
@@ -347,7 +316,6 @@ void CStatsAndAchievements::OnUserStatsStored( UserStatsStored_t *pCallback )
if ( k_EResultOK == pCallback->m_eResult )
{
OutputDebugString( "StoreStats - success\n" );
SaveUserStatsOnPS3();
}
else if ( k_EResultInvalidParam == pCallback->m_eResult )
{
@@ -397,34 +365,6 @@ void CStatsAndAchievements::OnAchievementStored( UserAchievementStored_t *pCallb
}
//-----------------------------------------------------------------------------
// Purpose: An achievement was stored
//-----------------------------------------------------------------------------
void CStatsAndAchievements::OnPS3TrophiesInstalled( PS3TrophiesInstalled_t *pCallback )
{
// we may get callbacks for other games' stats arriving, ignore them
if ( m_GameID.ToUint64() == pCallback->m_nGameID )
{
if ( pCallback->m_eResult != k_EResultOK )
{
// this is a fatal error. Usually the PS3 would have already displayed a fatal error to the user and forced the game to exit. If the system
// could not display that error, you should display the appropriate message to the user then exit.
char buffer[256];
if ( pCallback->m_eResult == k_EResultDiskFull )
sprintf_safe( buffer, "Failed to install PS3 trophies because the HD is full (required space=%llu)\n", pCallback->m_ulRequiredDiskSpace );
else
sprintf_safe( buffer, "Failed to install PS3 trophies (%d)", pCallback->m_eResult );
buffer[ sizeof(buffer) - 1 ] = 0;
OutputDebugString( buffer );
exit( 1 );
}
m_bInstalledPS3Trophies = true;
}
}
//-----------------------------------------------------------------------------
// Purpose: Display the user's stats and achievements
//-----------------------------------------------------------------------------
@@ -631,70 +571,3 @@ void CStatsAndAchievements::DrawInventory( RECT &rect, SteamItemInstanceID_t ite
sprintf_safe( rgchBuffer, "%s", pItem->GetLocalizedName().c_str() );
m_pGameEngine->BDrawString( m_hDisplayFont, rect, D3DCOLOR_ARGB( 255, 25, 200, 25 ), TEXTPOS_LEFT|TEXTPOS_VCENTER, rgchBuffer );
}
bool CStatsAndAchievements::LoadUserStatsOnPS3()
{
#ifdef _PS3
// On PS3, we need to load the user's stats & achievement information from the save container. In this example, we are simply
// reading the data from a known location on disk
FILE *file = fopen( GetUserSaveDataPath(), "rb" );
if ( !file )
{
// we need to tell Steam that there is no data
SteamUserStats()->SetUserStatsData( NULL, 0 );
return true;
}
fseek( file, 0, SEEK_END );
long nSize = ftell( file );
fseek( file, 0, SEEK_SET );
byte *buffer = new byte[nSize];
fread( buffer, 1, nSize, file );
fclose( file );
bool bRet = SteamUserStats()->SetUserStatsData( buffer, nSize );
delete [] buffer;
return bRet;
#else
return true;
#endif
}
bool CStatsAndAchievements::SaveUserStatsOnPS3()
{
#ifdef _PS3
// On PS3, we need to save the user's stats & achievement information into the save container. In this example, we are simply
// saving the data to a known location on disk
// get required buffer size
uint32 unSize = 0;
if ( !SteamUserStats()->GetUserStatsData( NULL, 0, &unSize ) && unSize == 0 )
return false;
// get data
byte *buffer = new byte[unSize];
uint32 unWritten = 0;
bool bRet = SteamUserStats()->GetUserStatsData( buffer, unSize, &unWritten );
if ( bRet )
{
FILE *file = fopen( GetUserSaveDataPath(), "wb" );
if ( file )
{
bRet = (fwrite( buffer, 1, unWritten, file ) == unWritten);
fclose( file );
}
else
{
bRet = false;
}
}
delete [] buffer;
return bRet;
#else
return true;
#endif
}
+1 -10
View File
@@ -59,8 +59,7 @@ public:
STEAM_CALLBACK( CStatsAndAchievements, OnUserStatsReceived, UserStatsReceived_t, m_CallbackUserStatsReceived );
STEAM_CALLBACK( CStatsAndAchievements, OnUserStatsStored, UserStatsStored_t, m_CallbackUserStatsStored );
STEAM_CALLBACK( CStatsAndAchievements, OnAchievementStored, UserAchievementStored_t, m_CallbackAchievementStored );
STEAM_CALLBACK( CStatsAndAchievements, OnPS3TrophiesInstalled, PS3TrophiesInstalled_t, m_CallbackPS3TrophiesInstalled );
private:
@@ -76,10 +75,6 @@ private:
void DrawStatInfo( RECT &rect, const char *pchName, float flValue );
void DrawInventory( RECT &rect, SteamItemInstanceID_t itemid );
// PS3 specific
bool LoadUserStatsOnPS3();
bool SaveUserStatsOnPS3();
// our GameID
CGameID m_GameID;
@@ -114,10 +109,6 @@ private:
float m_flTotalFeetTraveled;
float m_flMaxFeetTraveled;
float m_flAverageSpeed;
// PS3 specific
bool m_bStartedPS3TrophyInstall;
bool m_bInstalledPS3Trophies;
};
#endif // STATS_AND_ACHIEVEMENTS_H
+1 -5
View File
@@ -85,12 +85,8 @@ typedef unsigned __int64 uint64;
#include <sys/socket.h>
#include <netinet/in.h>
#if defined(_PS3)
#if defined(OSX)
#include "stdafx_ps3.h"
#elif defined(OSX)
#include <OpenGL/OpenGL.h>
#endif
-7
View File
@@ -249,13 +249,6 @@ public:
// link two lobbies for the purposes of checking player compatibility
// you must be the lobby owner of both lobbies
virtual bool SetLinkedLobby( CSteamID steamIDLobby, CSteamID steamIDLobbyDependent ) = 0;
#ifdef _PS3
// changes who the lobby owner is
// you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby
// after completion, the local user will no longer be the owner
virtual void CheckForPSNGameBootInvite( unsigned int iGameBootAttributes ) = 0;
#endif
};
#define STEAMMATCHMAKING_INTERFACE_VERSION "SteamMatchMaking009"
-91
View File
@@ -1,91 +0,0 @@
//====== Copyright © 1996-2010, Valve Corporation, All rights reserved. =======
//
// Purpose: interface the game must provide Steam with on PS3 in order for the
// Steam overlay to render.
//
//=============================================================================
#ifndef ISTEAMPS3OVERLAYRENDERER_H
#define ISTEAMPS3OVERLAYRENDERER_H
#ifdef _WIN32
#pragma once
#endif
#include "cell/pad.h"
//-----------------------------------------------------------------------------
// Purpose: Enum for supported gradient directions
//-----------------------------------------------------------------------------
enum EOverlayGradientDirection
{
k_EOverlayGradientHorizontal = 1,
k_EOverlayGradientVertical = 2,
k_EOverlayGradientNone = 3,
};
// Helpers for fetching individual color components from ARGB packed DWORD colors Steam PS3 overlay renderer uses.
#define STEAM_COLOR_RED( color ) \
(int)(((color)>>16)&0xff)
#define STEAM_COLOR_GREEN( color ) \
(int)(((color)>>8)&0xff)
#define STEAM_COLOR_BLUE( color ) \
(int)((color)&0xff)
#define STEAM_COLOR_ALPHA( color ) \
(int)(((color)>>24)&0xff)
//-----------------------------------------------------------------------------
// Purpose: Interface the game must expose to Steam for rendering
//-----------------------------------------------------------------------------
class ISteamPS3OverlayRenderHost
{
public:
// Interface for game engine to implement which Steam requires to render.
// Draw a textured rect. This may use only part of the texture and will pass texture coords, it will also possibly request a gradient and will specify colors for vertexes.
virtual void DrawTexturedRect( int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection ) = 0;
// Load a RGBA texture for Steam, or update a previously loaded one. Updates may be partial. You must not evict or remove this texture once Steam has uploaded it.
virtual void LoadOrUpdateTexture( int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char *pData ) = 0;
// Delete a texture Steam previously uploaded
virtual void DeleteTexture( int32 iTextureID ) = 0;
// Delete all previously uploaded textures
virtual void DeleteAllTextures() = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Interface Steam exposes for the game to tell it when to render, etc.
//-----------------------------------------------------------------------------
class ISteamPS3OverlayRender
{
public:
// Call once at startup to initialize the Steam overlay and pass it your host interface ptr
virtual bool BHostInitialize( uint32 unScreenWidth, uint32 unScreenHeight, uint32 unRefreshRate, ISteamPS3OverlayRenderHost *pRenderHost, void *CellFontLib ) = 0;
// Call this once a frame when you are ready for the Steam overlay to render (ie, right before flipping buffers, after all your rendering)
virtual void Render() = 0;
// Call this everytime you read input on PS3.
//
// If this returns true, then the overlay is active and has consumed the input, your game
// should then ignore all the input until BHandleCellPadData once again returns false, which
// will mean the overlay is deactivated.
virtual bool BHandleCellPadData( const CellPadData &padData ) = 0;
// Call this if you detect no controllers connected or that the XMB is intercepting input
//
// This is important to clear input state for the overlay, so keys left down during XMB activation
// are not continued to be processed.
virtual bool BResetInputState() = 0;
};
#endif // ISTEAMPS3OVERLAYRENDERER_H
-13
View File
@@ -457,19 +457,6 @@ struct LeaderboardUGCSet_t
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating that PS3 trophies have been installed
//-----------------------------------------------------------------------------
struct PS3TrophiesInstalled_t
{
enum { k_iCallback = k_iSteamUserStatsCallbacks + 12 };
uint64 m_nGameID; // Game these stats are for
EResult m_eResult; // The result of the operation
uint64 m_ulRequiredDiskSpace; // If m_eResult is k_EResultDiskFull, will contain the amount of space needed to install trophies
};
//-----------------------------------------------------------------------------
// Purpose: callback indicating global stats have been received.
// Returned as a result of RequestGlobalStats()
-1
View File
@@ -230,7 +230,6 @@ class ISteamScreenshots;
class ISteamMusic;
class ISteamMusicRemote;
class ISteamGameServerStats;
class ISteamPS3OverlayRender;
class ISteamHTTP;
class ISteamController;
class ISteamUGC;
-112
View File
@@ -1,112 +0,0 @@
//====== Copyright 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose:
//
//=============================================================================
#ifndef STEAMPS3PARAMS_H
#define STEAMPS3PARAMS_H
#ifdef _WIN32
#pragma once
#endif
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// PlayStation 3 initialization parameters
//
// The following structure must be passed to when loading steam_api_ps3.prx
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#define STEAM_PS3_PATH_MAX 1055
#define STEAM_PS3_SERVICE_ID_MAX 32
#define STEAM_PS3_COMMUNICATION_ID_MAX 10
#define STEAM_PS3_COMMUNICATION_SIG_MAX 160
#define STEAM_PS3_LANGUAGE_MAX 64
#define STEAM_PS3_REGION_CODE_MAX 16
#define STEAM_PS3_CURRENT_PARAMS_VER 2
struct SteamPS3Params_t
{
uint32 m_unVersion; // set to STEAM_PS3_CURRENT_PARAMS_VER
void *pReserved;
uint32 m_nAppId; // set to your game's appid
char m_rgchInstallationPath[ STEAM_PS3_PATH_MAX ]; // directory containing latest steam prx's and sdata. Can be read only (BDVD)
char m_rgchSystemCache[ STEAM_PS3_PATH_MAX ]; // temp working cache, not persistent
char m_rgchGameData[ STEAM_PS3_PATH_MAX ]; // persistent game data path for storing user data
char m_rgchNpServiceID[ STEAM_PS3_SERVICE_ID_MAX ];
char m_rgchNpCommunicationID[ STEAM_PS3_COMMUNICATION_ID_MAX ];
char m_rgchNpCommunicationSig[ STEAM_PS3_COMMUNICATION_SIG_MAX ];
// Language should be one of the following. must be zero terminated
// danish
// dutch
// english
// finnish
// french
// german
// italian
// korean
// norwegian
// polish
// portuguese
// russian
// schinese
// spanish
// swedish
// tchinese
char m_rgchSteamLanguage[ STEAM_PS3_LANGUAGE_MAX ];
// region codes are "SCEA", "SCEE", "SCEJ". must be zero terminated
char m_rgchRegionCode[ STEAM_PS3_REGION_CODE_MAX ];
// Should be SYS_TTYP3 through SYS_TTYP10, if it's 0 then Steam won't spawn a
// thread to read console input at all. Using this let's you use Steam console commands
// like: profile_on, profile_off, profile_dump, mem_stats, mem_validate.
unsigned int m_cSteamInputTTY;
struct Ps3netInit_t
{
bool m_bNeedInit;
void *m_pMemory;
int m_nMemorySize;
int m_flags;
} m_sysNetInitInfo;
struct Ps3jpgInit_t
{
bool m_bNeedInit;
} m_sysJpgInitInfo;
struct Ps3pngInit_t
{
bool m_bNeedInit;
} m_sysPngInitInfo;
struct Ps3sysutilUserInfo_t
{
bool m_bNeedInit;
} m_sysSysUtilUserInfo;
bool m_bIncludeNewsPage;
};
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
// PlayStation 3 memory structure
//----------------------------------------------------------------------------------------------------------------------------------------------------------//
#define STEAMPS3_MALLOC_INUSE 0x53D04A51
#define STEAMPS3_MALLOC_SYSTEM 0x0D102C48
#define STEAMPS3_MALLOC_OK 0xFFD04A51
struct SteamPS3Memory_t
{
bool m_bSingleAllocation; // If true, Steam will request one 6MB allocation and use the returned memory for all future allocations
// If false, Steam will make call malloc for each allocation
// required function pointers
void* (*m_pfMalloc)(size_t);
void* (*m_pfRealloc)(void *, size_t);
void (*m_pfFree)(void *);
size_t (*m_pUsable_size)(void*);
};
#endif // STEAMPS3PARAMS_H
-4
View File
@@ -29,10 +29,6 @@ typedef unsigned char uint8;
#endif
#if !defined(VALVE_BIG_ENDIAN)
#if defined(_PS3)
// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code.
#define VALVE_BIG_ENDIAN 1
#endif
#if defined( __GNUC__ ) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define VALVE_BIG_ENDIAN 1
#endif
File diff suppressed because it is too large Load Diff
-235
View File
@@ -1,235 +0,0 @@
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose: Main class for the game engine -- ps3 implementation
//
// $NoKeywords: $
//=============================================================================
#ifndef GAMEENGINEPS3_H
#define GAMEENGINEPS3_H
#include "GameEngine.h"
#include <set>
#include <map>
// Font info for PS3 dbg font output
struct PS3DbgFont_t
{
float m_nScale;
};
class CVoiceContext;
class CGameEnginePS3 : public IGameEngine, public ISteamPS3OverlayRenderHost
{
public:
// Static methods for tracing mapping of game engine class instances to hwnds
static CGameEnginePS3 * FindEngineInstanceForPtr( void *ptr );
static void AddInstanceToPtrMap( CGameEnginePS3* pInstance );
static void RemoveInstanceFromPtrMap( void *ptr );
// Constructor
CGameEnginePS3();
// Destructor
~CGameEnginePS3() { Shutdown(); }
// Check if the game engine is initialized ok and ready for use
bool BReadyForUse() { return m_bEngineReadyForUse; }
// Check if the engine is shutting down
bool BShuttingDown() { return m_bShuttingDown; }
// Set the background color
void SetBackgroundColor( short a, short r, short g, short b );
// Start a frame, clear(), beginscene(), etc
bool StartFrame();
// Finish a frame, endscene(), present(), etc.
void EndFrame();
// Shutdown the game engine
void Shutdown();
// Pump messages from the OS
void MessagePump();
// Accessors for game screen size
int32 GetViewportWidth() { return m_nWindowWidth; }
int32 GetViewportHeight() { return m_nWindowHeight; }
// Function for drawing text to the screen, dwFormat is a combination of flags like DT_LEFT, TEXTPOS_VCENTER etc...
bool BDrawString( HGAMEFONT hFont, RECT rect, DWORD dwColor, DWORD dwFormat, const char *pchText );
// Create a new font returning our internal handle value for it (0 means failure)
HGAMEFONT HCreateFont( int nHeight, int nFontWeight, bool bItalic, const char * pchFont );
// Create a new texture returning our internal handle value for it (0 means failure)
HGAMETEXTURE HCreateTexture( byte *pRGBAData, uint32 uWidth, uint32 uHeight );
// Draw a line, the engine itself will manage batching these (although you can explicitly flush if you need to)
bool BDrawLine( float xPos0, float yPos0, DWORD dwColor0, float xPos1, float yPos1, DWORD dwColor1 );
// Flush the line buffer
bool BFlushLineBuffer();
// Draw a point, the engine itself will manage batching these (although you can explicitly flush if you need to)
bool BDrawPoint( float xPos, float yPos, DWORD dwColor );
// Flush the point buffer
bool BFlushPointBuffer();
// Draw a filled quad
bool BDrawFilledQuad( float xPos0, float yPos0, float xPos1, float yPos1, DWORD dwColor );
// Draw a textured rectangle
bool BDrawTexturedQuad( float xPos0, float yPos0, float xPos1, float yPos1,
float u0, float v0, float u1, float v1, DWORD dwColor, HGAMETEXTURE hTexture );
// Flush any still cached quad buffers
bool BFlushQuadBuffer();
// Get the current state of a key
bool BIsKeyDown( DWORD dwVK );
// Get the first (in some arbitrary order) key down, if any
bool BGetFirstKeyDown( DWORD *pdwVK );
// Get current tick count for the game engine
uint64 GetGameTickCount() { return m_ulGameTickCount; }
// Get the tick count elapsed since the previous frame
// bugbug - We use this time to compute things like thrust and acceleration in the game,
// so it's important in doesn't jump ahead by large increments... Need a better
// way to handle that.
uint64 GetGameTicksFrameDelta() { return m_ulGameTickCount - m_ulPreviousGameTickCount; }
// Tell the game engine to update current tick count
void UpdateGameTickCount();
// Tell the game engine to sleep for a bit if needed to limit frame rate
bool BSleepForFrameRateLimit( uint32 ulMaxFrameRate );
// Check if the game engine hwnd currently has focus (and a working d3d device)
bool BGameEngineHasFocus() { return true; }
// Voice chat functions
virtual HGAMEVOICECHANNEL HCreateVoiceChannel();
virtual void DestroyVoiceChannel( HGAMEVOICECHANNEL hChannel );
virtual bool AddVoiceData( HGAMEVOICECHANNEL hChannel, const uint8 *pVoiceData, uint32 uLength );
// ISteamPS3OverlayRenderHost implementation
virtual void DrawTexturedRect( int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection );
virtual void LoadOrUpdateTexture( int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char *pData );
virtual void DeleteTexture( int32 iTextureID );
virtual void DeleteAllTextures();
private:
// Draw a textured rectangle
bool BDrawTexturedGradientQuad( float xPos0, float yPos0, float xPos1, float yPos1,
float u0, float v0, float u1, float v1,
DWORD dwColorTopLeft, DWORD dwColorTopRight, DWORD dwColorBottomLeft, DWORD dwColorBottomRight, HGAMETEXTURE hTexture );
// Initialize the PSGL rendering interfaces and default state
bool BInitializePSGL();
// Initialize the debug font library
bool BInitializeCellDbgFont();
// Initialize libpad for controller input
bool BInitializeLibPad();
bool BInitializeAudio();
void RunAudio();
private:
// Tracks whether the engine is ready for use
bool m_bEngineReadyForUse;
// Tracks if we are shutting down
bool m_bShuttingDown;
// Size of the window to display the game in
int32 m_nWindowWidth;
int32 m_nWindowHeight;
// Current game time in milliseconds
uint64 m_ulGameTickCount;
// Game time at the start of the previous frame
uint64 m_ulPreviousGameTickCount;
// White texture used when drawing filled quads
HGAMETEXTURE m_hTextureWhite;
// PSGL and CellDbgFont objects
PSGLcontext * m_pPSGLContext;
PSGLdevice * m_pPSGLDevice;
CellDbgFontConsoleId m_DbgFontConsoleID;
// Pointer to actual data for points
GLfloat *m_rgflPointsData;
GLubyte *m_rgflPointsColorData;
// How many points are outstanding needing flush
DWORD m_dwPointsToFlush;
// Pointer to actual data for lines
GLfloat *m_rgflLinesData;
GLubyte *m_rgflLinesColorData;
// How many lines are outstanding needing flush
DWORD m_dwLinesToFlush;
// Pointer to actual data for quads
GLfloat *m_rgflQuadsData;
GLubyte *m_rgflQuadsColorData;
GLfloat *m_rgflQuadsTextureData;
// How many lines are outstanding needing flush
DWORD m_dwQuadsToFlush;
// Currently active PS3 pad index to use for input
int m_iCurrentPadIndex;
// Map of engine instances by ptr, used in ps3 sys callbacks to find engine instance to handle callback
static std::map<void *, CGameEnginePS3 *> m_MapEngineInstances;
// Map of font handles we have given out
HGAMEFONT m_nNextFontHandle;
std::map< HGAMEFONT, PS3DbgFont_t > m_MapGameFonts;
// Map of handles to texture objects
struct TextureData_t
{
uint32 m_uWidth;
uint32 m_uHeight;
GLuint m_uTextureID;
};
std::map<HGAMETEXTURE, TextureData_t> m_MapTextures;
HGAMETEXTURE m_nNextTextureHandle;
// Last bound texture, used to know when we must flush
HGAMETEXTURE m_hLastTexture;
// Map of button state, translated to VK for win32.
std::set< DWORD > m_SetKeysDown;
// Map of voice handles
std::map<HGAMEVOICECHANNEL, CVoiceContext* > m_MapVoiceChannel;
uint32 m_unVoiceChannelCount;
// Map of Steam texture ids to our engine texture handles
std::map< int, HGAMETEXTURE> m_MapSteamTextures;
};
#endif // GAMEENGINEPS3_H
-228
View File
@@ -1,228 +0,0 @@
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose: Class for tracking stats and achievements
//
// $NoKeywords: $
//=============================================================================
#include "stdafx.h"
#include "remotestoragesync.h"
#include "BaseMenu.h"
//-----------------------------------------------------------------------------
// NOTE
//
// The following code is for synchronizing files while the game is running
// This is only necessary when on the Playstation 3, as the Steam client handles
// these operations when on PC/Mac.
//
//-----------------------------------------------------------------------------
#ifdef _PS3
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CRemoteStorageSyncMenu::CRemoteStorageSyncMenu( IGameEngine *pGameEngine ) : CBaseMenu<ERemoteStorageSyncMenuCommand>( pGameEngine )
{
}
//-----------------------------------------------------------------------------
// Purpose: Shows the synchronization progress menu
//-----------------------------------------------------------------------------
void CRemoteStorageSyncMenu::ShowSyncProgress( ESyncOperation eSyncOperation, double dPercentComplete )
{
if ( eSyncOperation == k_ESyncOperationIdle )
return;
PushSelectedItem();
ClearMenuItems();
// Create progress text
char buffer[260];
const char *pchFormat = (eSyncOperation == k_ESyncOperationToClient ) ? "Syncing to client (%d%%)" : "Syncing to server(%d%%)";
sprintf( buffer, pchFormat, (int)dPercentComplete );
AddMenuItem( CRemoteStorageSyncMenu::MenuItem_t( buffer, k_EMenuCommandProgress ) );
PopSelectedItem();
}
//-----------------------------------------------------------------------------
// Purpose: Shows the synchronization progress menu
//-----------------------------------------------------------------------------
void CRemoteStorageSyncMenu::ShowSyncComplete( ESyncOperation eSyncOperation, bool bSuccess )
{
if ( eSyncOperation == k_ESyncOperationIdle )
return;
PushSelectedItem();
ClearMenuItems();
// Create progress text
char buffer[260];
const char *pchResult = bSuccess ? "complete" : "failed";
const char *pchFormat = (eSyncOperation == k_ESyncOperationToClient ) ? "Sync to client %s.. press X" : "Sync to server %s.. press X";
sprintf( buffer, pchFormat, pchResult );
AddMenuItem( CRemoteStorageSyncMenu::MenuItem_t( buffer, k_EMenuCommandSyncComplete ) );
PopSelectedItem();
}
//-----------------------------------------------------------------------------
// Purpose: Shows the conflict menu
//-----------------------------------------------------------------------------
void CRemoteStorageSyncMenu::ShowConflict()
{
PushSelectedItem();
ClearMenuItems();
// Description
AddMenuItem( CRemoteStorageSyncMenu::MenuItem_t( "There is a conflict between the local & server versions of your files:", k_EMenuCommandNone ) );
PopSelectedItem();
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CRemoteStorageSync::CRemoteStorageSync( IGameEngine *pGameEngine ) :
m_eSyncOperation( k_ESyncOperationIdle ),
m_menu( pGameEngine ),
m_callbackAppSyncClientComplete( this, &CRemoteStorageSync::OnAppSyncClientComplete ),
m_callbackAppSyncServerComplete( this, &CRemoteStorageSync::OnAppSyncServerComplete ),
m_callbackAppSyncProgress( this, &CRemoteStorageSync::OnAppSyncProgress )
{
}
//-----------------------------------------------------------------------------
// Purpose: Start synchronizing files to the client
//-----------------------------------------------------------------------------
void CRemoteStorageSync::SynchronizeToClient()
{
if ( m_eSyncOperation != k_ESyncOperationIdle )
return;
if ( !SteamRemoteStorage()->SynchronizeToClient() )
return;
m_eSyncOperation = k_ESyncOperationToClient;
m_menu.ShowSyncProgress( m_eSyncOperation, 0.0 );
}
//-----------------------------------------------------------------------------
// Purpose: Start synchronizing files to the server
//-----------------------------------------------------------------------------
void CRemoteStorageSync::SynchronizeToServer()
{
if ( m_eSyncOperation != k_ESyncOperationIdle )
return;
if ( !SteamRemoteStorage()->SynchronizeToServer() )
return;
m_eSyncOperation = k_ESyncOperationToServer;
m_menu.ShowSyncProgress( m_eSyncOperation, 0.0 );
}
//-----------------------------------------------------------------------------
// Purpose: Called each frame. Draw's menu
//-----------------------------------------------------------------------------
void CRemoteStorageSync::Render()
{
m_menu.RunFrame();
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if we are done synchronizing
//-----------------------------------------------------------------------------
bool CRemoteStorageSync::BFinished()
{
return m_eSyncOperation == k_ESyncOperationIdle;
}
//-----------------------------------------------------------------------------
// Purpose: Called periodically by Steam when a synchronization is in progress
//-----------------------------------------------------------------------------
void CRemoteStorageSync::OnAppSyncProgress( RemoteStorageAppSyncProgress_t *pParam )
{
// make sure the update is for us
if ( pParam->m_nAppID != SteamUtils()->GetAppID() )
return;
// make sure the update is in the direction we expect
if ( m_eSyncOperation == k_ESyncOperationIdle || (pParam->m_bUploading && m_eSyncOperation != k_ESyncOperationToServer) )
return;
m_menu.ShowSyncProgress( m_eSyncOperation, pParam->m_dAppPercentComplete );
}
//-----------------------------------------------------------------------------
// Purpose: Called by Steam when a synchronization to the client is complete
//-----------------------------------------------------------------------------
void CRemoteStorageSync::OnAppSyncClientComplete( RemoteStorageAppSyncedClient_t *pParam )
{
// make sure the update is for us
if ( pParam->m_nAppID != SteamUtils()->GetAppID() )
return;
// make sure the update is in the direction we expect
if ( m_eSyncOperation != k_ESyncOperationToClient )
return;
// check for errors
if ( pParam->m_eResult == k_EResultRemoteFileConflict )
{
m_menu.ShowConflict();
return;
}
m_menu.ShowSyncComplete( m_eSyncOperation, pParam->m_eResult == k_EResultOK );
}
//-----------------------------------------------------------------------------
// Purpose: Called by Steam when a synchronization to the server is complete
//-----------------------------------------------------------------------------
void CRemoteStorageSync::OnAppSyncServerComplete( RemoteStorageAppSyncedServer_t *pParam )
{
// make sure the update is for us
if ( pParam->m_nAppID != SteamUtils()->GetAppID() )
return;
// make sure the update is in the direction we expect
if ( m_eSyncOperation != k_ESyncOperationToServer )
return;
// check for errors
if ( pParam->m_eResult == k_EResultRemoteFileConflict )
{
m_menu.ShowConflict();
return;
}
m_menu.ShowSyncComplete( m_eSyncOperation, pParam->m_eResult == k_EResultOK );
}
//-----------------------------------------------------------------------------
// Purpose: A sync menu item has been selected
//-----------------------------------------------------------------------------
void CRemoteStorageSync::OnMenuSelection( ERemoteStorageSyncMenuCommand selection )
{
switch( selection )
{
case k_EMenuCommandSyncComplete:
m_eSyncOperation = k_ESyncOperationIdle;
break;
}
}
#endif
-50
View File
@@ -36,54 +36,4 @@ public:
virtual void OnMenuSelection( ERemoteStorageSyncMenuCommand selection ) = 0;
};
#ifdef _PS3
enum ESyncOperation
{
k_ESyncOperationIdle,
k_ESyncOperationToClient,
k_ESyncOperationToServer
};
//-----------------------------------------------------------------------------
// Purpose: Menu shown for synchronization progress and prompting user to resolve a conflict
//-----------------------------------------------------------------------------
class CRemoteStorageSyncMenu : public CBaseMenu< ERemoteStorageSyncMenuCommand >
{
public:
CRemoteStorageSyncMenu( IGameEngine *pGameEngine );
void ShowSyncProgress( ESyncOperation eSyncOperation, double dPercentComplete );
void ShowSyncComplete( ESyncOperation eSyncOperation, bool bSuccess );
void ShowConflict();
};
//-----------------------------------------------------------------------------
// Purpose: Synchronizes files with Steam
//-----------------------------------------------------------------------------
class CRemoteStorageSync : public IRemoteStorageSync
{
public:
// Constructor
CRemoteStorageSync( IGameEngine *pGameEngine );
// IRemoteStorageSync implementations
virtual void SynchronizeToClient();
virtual void SynchronizeToServer();
virtual void Render();
virtual bool BFinished();
virtual void OnMenuSelection( ERemoteStorageSyncMenuCommand selection );
private:
// synchronization updates
STEAM_CALLBACK( CRemoteStorageSync, OnAppSyncClientComplete, RemoteStorageAppSyncedClient_t, m_callbackAppSyncClientComplete );
STEAM_CALLBACK( CRemoteStorageSync, OnAppSyncServerComplete, RemoteStorageAppSyncedServer_t, m_callbackAppSyncServerComplete );
STEAM_CALLBACK( CRemoteStorageSync, OnAppSyncProgress, RemoteStorageAppSyncProgress_t, m_callbackAppSyncProgress );
STEAM_CALLBACK( CRemoteStorageSync, OnConflictResolution, RemoteStorageConflictResolution_t, m_callbackConflictResolution );
CRemoteStorageSyncMenu m_menu;
ESyncOperation m_eSyncOperation;
};
#endif // !_PS3
#endif
-38
View File
@@ -1,38 +0,0 @@
//========= Copyright Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
// stdafx_ps3.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently on the PS3 platform
//
#include <cell/error.h>
#include <sys/process.h>
#include <sys/paths.h>
#include <sys/prx.h>
#include <sys/spu_initialize.h>
#include <sys/memory.h>
#include <PSGL/psgl.h>
#include <PSGL/psglu.h>
#include <sys/types.h>
#include <cell/fios/fios_common.h>
#include <cell/fios/fios_memory.h>
#include <cell/fios/fios_configuration.h>
#include <cell/fios/fios_time.h>
#include <cell/dbgfont.h>
#include <cell/pad/libpad.h>
#include <sysutil/sysutil_syscache.h>
#include <sys/tty.h>
//#define PS3_MTT_DEBUG
#ifdef PS3_MTT_DEBUG
#include "../external/libmtt/libmtt/libmtt_log.h"
#endif
extern CellDbgFontConsoleId g_DbgFontConsoleID;