This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

159
common/xbox/xbox_console.h Normal file
View File

@@ -0,0 +1,159 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Xbox console
//
//=====================================================================================//
#pragma once
#include "tier0/platform.h"
#ifndef STATIC_TIER0
#ifdef TIER0_DLL_EXPORT
#define XBXCONSOLE_INTERFACE DLL_EXPORT
#define XBXCONSOLE_OVERLOAD DLL_GLOBAL_EXPORT
#else
#define XBXCONSOLE_INTERFACE DLL_IMPORT
#define XBXCONSOLE_OVERLOAD DLL_GLOBAL_IMPORT
#endif
#else // BUILD_AS_DLL
#define XBXCONSOLE_INTERFACE extern
#define XBXCONSOLE_OVERLOAD
#endif // BUILD_AS_DLL
// all redirecting funneled here, stop redirecting in this module only
#undef OutputDebugString
#define XBX_MAX_PROFILE_COUNTERS 64
#if !defined( _X360 )
#define xMaterialList_t void
#define xTextureList_t void
#define xSoundList_t void
#define xMapInfo_t void
#define xModelList_t void
#define xDataCacheItem_t void
#define xVProfNodeItem_t void
#define xBudgetInfo_t void
#endif
class IXboxConsole
{
public:
virtual void SendRemoteCommand( const char *dbgCommand, bool bAsync ) = 0;
virtual void SendArbitraryPrefixedTextMessage( const char *prefix, const char *message, bool async ) = 0;
virtual void DebugString( unsigned int color, const char *format, ... ) = 0;
virtual bool IsConsoleConnected() = 0;
virtual void InitConsoleMonitor( bool bWaitForConnect = false ) = 0;
virtual void DisconnectConsoleMonitor() = 0;
virtual void FlushDebugOutput() = 0;
virtual bool GetXboxName( char *, unsigned * ) = 0;
virtual void CrashDump( bool ) = 0;
virtual void CrashDumpFullHeap( bool ) = 0;
virtual void DumpDllInfo( const char *pBasePath ) = 0;
virtual void OutputDebugString( const char * ) = 0;
virtual bool IsDebuggerPresent() = 0;
virtual int SetProfileAttributes( const char *pProfileName, int numCounters, const char *names[], COLORREF colors[] ) = 0;
virtual void SetProfileData( const char *pProfileName, int numCounters, unsigned int *counters ) = 0;
virtual int MemDump( const char *pDumpFileName ) = 0;
virtual int TimeStampLog( float time, const char *pString ) = 0;
virtual int MaterialList( int nMaterials, const xMaterialList_t *pXMaterialList ) = 0;
virtual int TextureList( int nTextures, const xTextureList_t *pXTextureList ) = 0;
virtual int SoundList( int nSounds, const xSoundList_t *pXSoundList ) = 0;
virtual int MapInfo( const xMapInfo_t *pXMapInfo ) = 0;
virtual int BudgetInfo( const xBudgetInfo_t *pXBudgetInfo ) = 0;
virtual int AddCommands( int numCommands, const char *commands[], const char* help[] ) = 0;
virtual int ModelList( int nModels, const xModelList_t *pList ) = 0;
virtual int DataCacheList( int nItems, const xDataCacheItem_t* pItems ) = 0;
virtual int VProfNodeList( int nItems, const xVProfNodeItem_t *pItems ) = 0;
virtual int TraceComplete( void ) = 0;
virtual int BugReporter( void ) = 0;
virtual bool SendBinaryData( const void *pData, int iDataSize, bool bAsync = true, DWORD dwSyncTimout = 15000 ) = 0; //returns false if sync call timed out or not connected. Otherwise true
virtual int SyncDvdDevCache() = 0;
virtual int SyncShaderCache() = 0;
virtual int Version( int nVersion ) = 0;
};
class CXboxConsole : public IXboxConsole
{
public:
void SendRemoteCommand( const char* dbgCommand, bool bAsync );
void SendArbitraryPrefixedTextMessage( const char *prefix, const char *message, bool async );
void DebugString( unsigned int color, const char* format, ... );
bool IsConsoleConnected();
void InitConsoleMonitor( bool bWaitForConnect = false );
void DisconnectConsoleMonitor();
void FlushDebugOutput();
bool GetXboxName( char *, unsigned * );
void CrashDump( bool );
void CrashDumpFullHeap( bool );
int DumpModuleSize( const char *pName );
void DumpDllInfo( const char *pBasePath );
void OutputDebugString( const char * );
bool IsDebuggerPresent();
int SetProfileAttributes( const char *pProfileName, int numCounters, const char *names[], COLORREF colors[] );
void SetProfileData( const char *pProfileName, int numCounters, unsigned int *counters );
int MemDump( const char *pDumpFileName );
int TimeStampLog( float time, const char *pString );
int MaterialList( int nMaterials, const xMaterialList_t *pXMaterialList );
int TextureList( int nTextures, const xTextureList_t *pXTextureList );
int SoundList( int nSounds, const xSoundList_t *pXSoundList );
int MapInfo( const xMapInfo_t *pXMapInfo );
int BudgetInfo( const xBudgetInfo_t *pXBudgetInfo );
int AddCommands( int numCommands, const char *commands[], const char *help[] );
int ModelList( int nModels, const xModelList_t *pList );
int DataCacheList( int nItems, const xDataCacheItem_t *pItems );
int VProfNodeList( int nItems, const xVProfNodeItem_t *pItems );
int TraceComplete( void );
int BugReporter( void );
bool SendBinaryData( const void *pData, int iDataSize, bool bAsync, DWORD dwSyncTimout );
int SyncDvdDevCache();
int SyncShaderCache();
int Version( int nVersion );
};
XBXCONSOLE_INTERFACE IXboxConsole *g_pXboxConsole;
XBXCONSOLE_INTERFACE void XboxConsoleInit();
#define XBX_SendRemoteCommand if ( !g_pXboxConsole ) ; else g_pXboxConsole->SendRemoteCommand
#define XBX_SendPrefixedMsg if ( !g_pXboxConsole ) ; else g_pXboxConsole->SendArbitraryPrefixedTextMessage
#define XBX_DebugString if ( !g_pXboxConsole ) ; else g_pXboxConsole->DebugString
#define XBX_IsConsoleConnected ( !g_pXboxConsole ) ? false : g_pXboxConsole->IsConsoleConnected
#define XBX_InitConsoleMonitor if ( !g_pXboxConsole ) ; else g_pXboxConsole->InitConsoleMonitor
#define XBX_DisconnectConsoleMonitor if ( !g_pXboxConsole ) ; else g_pXboxConsole->DisconnectConsoleMonitor
#define XBX_FlushDebugOutput if ( !g_pXboxConsole ) ; else g_pXboxConsole->FlushDebugOutput
#define XBX_GetXboxName ( !g_pXboxConsole ) ? false : g_pXboxConsole->GetXboxName
#define XBX_CrashDump if ( !g_pXboxConsole ) ; else g_pXboxConsole->CrashDump
#define XBX_CrashDumpFullHeap if ( !g_pXboxConsole ) ; else g_pXboxConsole->CrashDumpFullHeap
#define XBX_DumpDllInfo if ( !g_pXboxConsole ) ; else g_pXboxConsole->DumpDllInfo
#define XBX_OutputDebugString if ( !g_pXboxConsole ) ; else g_pXboxConsole->OutputDebugString
#define XBX_IsDebuggerPresent ( !g_pXboxConsole ) ? false : g_pXboxConsole->IsDebuggerPresent
#define XBX_rSetProfileAttributes ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SetProfileAttributes
#define XBX_rSetProfileData if ( !g_pXboxConsole ) ; else g_pXboxConsole->SetProfileData
#define XBX_rMemDump ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MemDump
#define XBX_rTimeStampLog ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TimeStampLog
#define XBX_rMaterialList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MaterialList
#define XBX_rTextureList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TextureList
#define XBX_rSoundList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SoundList
#define XBX_rMapInfo ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->MapInfo
#define XBX_rBudgetInfo ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->BudgetInfo
#define XBX_rAddCommands ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->AddCommands
#define XBX_rModelList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->ModelList
#define XBX_rDataCacheList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->DataCacheList
#define XBX_rVProfNodeList ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->VProfNodeList
#define XBX_rTraceComplete ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->TraceComplete
#define XBX_rBugReporter ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->BugReporter
#define XBX_SendBinaryData ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SendBinaryData
#define XBX_rSyncDvdDevCache ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SyncDvdDevCache
#define XBX_rSyncShaderCache ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->SyncShaderCache
#define XBX_rVersion ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->Version

296
common/xbox/xbox_core.h Normal file
View File

@@ -0,0 +1,296 @@
//========= Copyright <20> 1996-2004, Valve LLC, All rights reserved. ============
//
// Purpose: XBox Core definitions
//
//=============================================================================
#pragma once
#define XBOX_DONTCARE 0 // for functions with don't care params
#define XBX_MAX_DPORTS 4
#define XBX_MAX_BUTTONSAMPLE 32768
#define XBX_MAX_ANALOGSAMPLE 255
#define XBX_MAX_MESSAGE 2048
#define XBX_MAX_PATH MAX_PATH
#define XBX_MAX_RCMDLENGTH 256
#define XBX_MAX_RCMDNAMELEN 32
#define XBX_HDD_CLUSTERSIZE 16384
// could be dvd or hdd, actual device depends on source of xex launch
#define XBX_DVD_DRIVE "D:\\"
#define XBX_BOOT_DRIVE "D:\\"
#define XBX_IOTHREAD_STACKSIZE 32768
#define XBX_IOTHREAD_PRIORITY THREAD_PRIORITY_HIGHEST
// scale by screen dimension to get an inset
#define XBOX_MINBORDERSAFE 0.05f
#define XBOX_MAXBORDERSAFE 0.075f
#define XBX_CALCSIG_TYPE XCALCSIG_FLAG_NON_ROAMABLE
#define XBX_INVALID_STORAGE_ID ((DWORD)-1)
#define XBX_STORAGE_DECLINED ((DWORD)-2)
#define XBX_INVALID_USER_ID ((DWORD)-1)
#define XBX_USER_SETTINGS_CONTAINER_DRIVE "CFG"
#define XBX_USER_SAVES_CONTAINER_DRIVE "SAV"
// Path to our running executable
#define XBX_XEX_BASE_FILENAME "default.xex"
#define XBX_XEX_PATH XBX_BOOT_DRIVE XBX_XEX_BASE_FILENAME
#define XBX_CLR_DEFAULT 0xFF000000
#define XBX_CLR_WARNING 0x0000FFFF
#define XBX_CLR_ERROR 0x000000FF
// disk space requirements
#define XBX_SAVEGAME_BYTES ( 1024 * 1024 * 2 )
#define XBX_CONFIGFILE_BYTES ( 1024 * 100 )
#define XBX_USER_STATS_BYTES ( 1024 * 28 )
#define XBX_USER_SETTINGS_BYTES ( XBX_CONFIGFILE_BYTES + XBX_USER_STATS_BYTES )
#define XBX_PERSISTENT_BYTES_NEEDED ( XBX_SAVEGAME_BYTES * 10 ) // 8 save games, 1 autosave, 1 autosavedangerous
#define XMAKECOLOR( r, g, b ) ((unsigned int)(((unsigned char)(r)|((unsigned int)((unsigned char)(g))<<8))|(((unsigned int)(unsigned char)(b))<<16)))
#define MAKE_NON_SRGB_FMT(x) ((D3DFORMAT)( ((unsigned int)(x)) & ~(D3DFORMAT_SIGNX_MASK | D3DFORMAT_SIGNY_MASK | D3DFORMAT_SIGNZ_MASK)))
#define IS_D3DFORMAT_SRGB( x ) ( MAKESRGBFMT(x) == (x) )
typedef enum
{
XEV_NULL,
XEV_REMOTECMD,
XEV_QUIT,
XEV_LISTENER_NOTIFICATION,
} xevent_e;
typedef struct xevent_s
{
xevent_e event;
int arg1;
int arg2;
int arg3;
} xevent_t;
typedef struct xevent_SYS_SIGNINCHANGED_s
{
XUID xuid[ XUSER_MAX_COUNT ];
XUSER_SIGNIN_STATE state[ XUSER_MAX_COUNT ];
DWORD dwParam;
} xevent_SYS_SIGNINCHANGED_t;
typedef enum
{
XK_NULL,
XK_BUTTON_UP,
XK_BUTTON_DOWN,
XK_BUTTON_LEFT,
XK_BUTTON_RIGHT,
XK_BUTTON_START,
XK_BUTTON_BACK,
XK_BUTTON_STICK1,
XK_BUTTON_STICK2,
XK_BUTTON_A,
XK_BUTTON_B,
XK_BUTTON_X,
XK_BUTTON_Y,
XK_BUTTON_LEFT_SHOULDER,
XK_BUTTON_RIGHT_SHOULDER,
XK_BUTTON_LTRIGGER,
XK_BUTTON_RTRIGGER,
XK_STICK1_UP,
XK_STICK1_DOWN,
XK_STICK1_LEFT,
XK_STICK1_RIGHT,
XK_STICK2_UP,
XK_STICK2_DOWN,
XK_STICK2_LEFT,
XK_STICK2_RIGHT,
XK_BUTTON_INACTIVE_START, // Special key that is passed through on disabled controllers
XK_BUTTON_FIREMODE_SELECTOR_1,
XK_BUTTON_FIREMODE_SELECTOR_2,
XK_BUTTON_FIREMODE_SELECTOR_3,
XK_BUTTON_RELOAD,
XK_BUTTON_TRIGGER,
XK_BUTTON_PUMP_ACTION,
XK_XBUTTON_ROLL_RIGHT,
XK_XBUTTON_ROLL_LEFT,
XK_MAX_KEYS,
} xKey_t;
typedef struct
{
const char *pName;
const char *pGroupName;
const char *pFormatName;
int size;
int width;
int height;
int depth;
int numLevels;
int binds;
int refCount;
int sRGB;
int edram;
int procedural;
int cacheableState;
int cacheableSize;
int final;
int failed;
int pwl;
int reduced;
} xTextureList_t;
typedef struct
{
const char *pName;
const char *pShaderName;
int refCount;
} xMaterialList_t;
typedef struct
{
char name[MAX_PATH];
char formatName[32];
int rate;
int bits;
int channels;
int looped;
int dataSize;
int numSamples;
int streamed;
int quality;
} xSoundList_t;
typedef struct
{
float position[3];
float angle[3];
char mapPath[256];
char savePath[256];
int build;
int skill;
char details[1024];
} xMapInfo_t;
typedef struct
{
int BSPSize;
} xBudgetInfo_t;
struct xModelList_t
{
char name[MAX_PATH];
int dataSize;
int numVertices;
int triCount;
int dataSizeLod0;
int numVerticesLod0;
int triCountLod0;
int numBones;
int numParts;
int numLODs;
int numMeshes;
};
struct xDataCacheItem_t
{
char name[MAX_PATH];
char section[64];
int size;
int lockCount;
unsigned int clientId;
unsigned int itemData;
unsigned int handle;
};
struct xVProfNodeItem_t
{
const char *pName;
const char *pBudgetGroupName;
unsigned int budgetGroupColor;
unsigned int totalCalls;
double inclusiveTime;
double exclusiveTime;
};
/******************************************************************************
XBOX_SYSTEM.CPP
******************************************************************************/
#if defined( PLATFORM_H )
// redirect debugging output through xbox debug channel
#define OutputDebugStringA XBX_OutputDebugStringA
// Messages
PLATFORM_INTERFACE void XBX_Error( const char* format, ... );
PLATFORM_INTERFACE void XBX_OutputDebugStringA( LPCSTR lpOutputString );
// Event handling
PLATFORM_INTERFACE bool XBX_NotifyCreateListener( ULONG64 categories );
PLATFORM_INTERFACE void XBX_QueueEvent( xevent_e event, int arg1, int arg2, int arg3 );
PLATFORM_INTERFACE void XBX_ProcessEvents( void );
PLATFORM_INTERFACE void XBX_DispatchEventsQueue( void );
// Accessors
PLATFORM_INTERFACE const char* XBX_GetLanguageString( void );
PLATFORM_INTERFACE bool XBX_IsLocalized( void );
PLATFORM_INTERFACE bool XBX_IsAudioLocalized( void );
PLATFORM_INTERFACE const char *XBX_GetNextSupportedLanguage( const char *pLanguage, bool *pbHasAudio );
PLATFORM_INTERFACE bool XBX_IsRestrictiveLanguage( void );
//
// Storage devices management
//
PLATFORM_INTERFACE void XBX_ResetStorageDeviceInfo();
PLATFORM_INTERFACE DWORD XBX_DescribeStorageDevice( DWORD nStorageID );
PLATFORM_INTERFACE char const *XBX_MakeStorageContainerRoot( int iController, char const *szRootName, char *pBuffer, int numBufferBytes );
PLATFORM_INTERFACE DWORD XBX_GetStorageDeviceId( int iController );
PLATFORM_INTERFACE void XBX_SetStorageDeviceId( int iController, DWORD id );
//
// Information about game primary user
//
PLATFORM_INTERFACE DWORD XBX_GetPrimaryUserId( void );
PLATFORM_INTERFACE void XBX_SetPrimaryUserId( DWORD id );
PLATFORM_INTERFACE DWORD XBX_GetPrimaryUserIsGuest( void );
PLATFORM_INTERFACE void XBX_SetPrimaryUserIsGuest( DWORD bPrimaryUserIsGuest );
//
// Disabling and enabling input from controllers
//
PLATFORM_INTERFACE void XBX_ResetUserIdSlots();
PLATFORM_INTERFACE void XBX_ClearUserIdSlots();
//
// Mapping between game slots and controllers
//
PLATFORM_INTERFACE int XBX_GetUserId( int nSlot );
PLATFORM_INTERFACE int XBX_GetSlotByUserId( int idx );
PLATFORM_INTERFACE void XBX_SetUserId( int nSlot, int idx );
PLATFORM_INTERFACE void XBX_ClearSlot( int nSlot );
PLATFORM_INTERFACE void XBX_ClearUserId( int idx );
PLATFORM_INTERFACE DWORD XBX_GetUserIsGuest( int nSlot );
PLATFORM_INTERFACE void XBX_SetUserIsGuest( int nSlot, DWORD dwUserIsGuest );
//
// Number of game users
//
PLATFORM_INTERFACE DWORD XBX_GetNumGameUsers( void );
PLATFORM_INTERFACE void XBX_SetNumGameUsers( DWORD numGameUsers );
//
// Invite related functions
//
PLATFORM_INTERFACE XNKID XBX_GetInviteSessionId( void );
PLATFORM_INTERFACE void XBX_SetInviteSessionId( XNKID nSessionId );
PLATFORM_INTERFACE XUID XBX_GetInvitedUserXuid( void );
PLATFORM_INTERFACE void XBX_SetInvitedUserXuid( XUID xuid );
PLATFORM_INTERFACE DWORD XBX_GetInvitedUserId( void );
PLATFORM_INTERFACE void XBX_SetInvitedUserId( DWORD nUserId );
#endif

451
common/xbox/xbox_launch.h Normal file
View File

@@ -0,0 +1,451 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Xbox Launch Routines.
//
//=====================================================================================//
#ifndef _XBOX_LAUNCH_H_
#define _XBOX_LAUNCH_H_
#pragma once
#ifndef _CERT
#pragma comment( lib, "xbdm.lib" )
#endif
// id and version are used to tag the data blob, currently only need a singe hardcoded id
// when the version and id don't match, the data blob is not ours
#define VALVE_LAUNCH_ID (('V'<<24)|('A'<<16)|('L'<<8)|('V'<<0))
#define VALVE_LAUNCH_VERSION 1
// launch flags
#define LF_ISDEBUGGING 0x80000000 // set if session was active prior to launch
#define LF_INTERNALLAUNCH 0x00000001 // set if launch was internal (as opposed to dashboard)
#define LF_EXITFROMINSTALLER 0x00000002 // set if exit was from an installer
#define LF_EXITFROMGAME 0x00000004 // set if exit was from a game
#define LF_EXITFROMCHOOSER 0x00000008 // set if exit was from the chooser
#define LF_WARMRESTART 0x00000010 // set if game wants to restart self (skips intro movies)
#define LF_INSTALLEDTOCACHE 0x00000040 // set if installer populated or validated cache partition
#define LF_UNKNOWNDATA 0x00000080
#pragma pack(1)
struct launchHeader_t
{
unsigned int id;
unsigned int version;
unsigned int flags;
int nUserID;
int nCtrlr2Storage[4];
char nSlot2Ctrlr[4];
char nSlot2Guest[4];
int numGameUsers;
int bForceEnglish;
// increments at each engine re-launch
DWORD nAttractID;
// for caller defined data, occurs after this header
// limited to slightly less than MAX_LAUNCH_DATA_SIZE
unsigned int nDataSize;
};
#pragma pack()
// per docs, no larger than MAX_LAUNCH_DATA_SIZE
union xboxLaunchData_t
{
launchHeader_t header;
char data[MAX_LAUNCH_DATA_SIZE];
};
//--------------------------------------------------------------------------------------
// Simple class to wrap the peristsent launch payload.
//
// Can be used by an application that does not use tier0 (i.e. the launcher).
// Primarily designed to be anchored in tier0, so multiple systems can easily query and
// set the persistent payload.
//--------------------------------------------------------------------------------------
class CXboxLaunch
{
public:
CXboxLaunch()
{
ResetLaunchData();
}
void ResetLaunchData()
{
// invalid until established
// nonzero identifies a valid payload
m_LaunchDataSize = 0;
m_Launch.header.id = 0;
m_Launch.header.version = 0;
m_Launch.header.flags = 0;
m_Launch.header.nUserID = XBX_INVALID_USER_ID;
m_Launch.header.bForceEnglish = false;
m_Launch.header.nCtrlr2Storage[0] = XBX_INVALID_STORAGE_ID;
m_Launch.header.nCtrlr2Storage[1] = XBX_INVALID_STORAGE_ID;
m_Launch.header.nCtrlr2Storage[2] = XBX_INVALID_STORAGE_ID;
m_Launch.header.nCtrlr2Storage[3] = XBX_INVALID_STORAGE_ID;
m_Launch.header.nSlot2Ctrlr[0] = 0;
m_Launch.header.nSlot2Ctrlr[1] = 1;
m_Launch.header.nSlot2Ctrlr[2] = 2;
m_Launch.header.nSlot2Ctrlr[3] = 3;
m_Launch.header.nSlot2Guest[0] = 0;
m_Launch.header.nSlot2Guest[1] = 0;
m_Launch.header.nSlot2Guest[2] = 0;
m_Launch.header.nSlot2Guest[3] = 0;
m_Launch.header.numGameUsers = 0;
m_Launch.header.nAttractID = 0;
m_Launch.header.nDataSize = 0;
}
// Returns how much space can be used by caller
int MaxPayloadSize()
{
return sizeof( xboxLaunchData_t ) - sizeof( launchHeader_t );
}
bool SetLaunchData( void *pData, int dataSize, int flags = 0 )
{
#if defined( _DEMO )
if ( pData && ( flags & LF_UNKNOWNDATA ) )
{
// not ours, put the demo structure back as-is
XSetLaunchData( pData, dataSize );
m_LaunchDataSize = dataSize;
return true;
}
#endif
if ( pData && dataSize && dataSize > MaxPayloadSize() )
{
// not enough room
return false;
}
if ( pData && dataSize && dataSize <= MaxPayloadSize() )
{
memcpy( m_Launch.data + sizeof( launchHeader_t ), pData, dataSize );
m_Launch.header.nDataSize = dataSize;
}
else
{
m_Launch.header.nDataSize = 0;
}
flags |= LF_INTERNALLAUNCH;
#if !defined( _CERT )
if ( DmIsDebuggerPresent() )
{
flags |= LF_ISDEBUGGING;
}
#endif
m_Launch.header.id = VALVE_LAUNCH_ID;
m_Launch.header.version = VALVE_LAUNCH_VERSION;
m_Launch.header.flags = flags;
XSetLaunchData( &m_Launch, MAX_LAUNCH_DATA_SIZE );
// assume successful, mark as valid
m_LaunchDataSize = MAX_LAUNCH_DATA_SIZE;
return true;
}
//--------------------------------------------------------------------------------------
// Returns TRUE if the launch data blob is available. FALSE otherwise.
// Caller is expected to validate and interpret contents based on ID.
//--------------------------------------------------------------------------------------
bool GetLaunchData( unsigned int *pID, void **pData, int *pDataSize )
{
if ( !m_LaunchDataSize )
{
// purposely not doing this in the constructor (unstable as used by tier0), but on first fetch
bool bValid = false;
DWORD dwLaunchDataSize;
DWORD dwStatus = XGetLaunchDataSize( &dwLaunchDataSize );
if ( dwStatus == ERROR_SUCCESS && dwLaunchDataSize <= MAX_LAUNCH_DATA_SIZE )
{
dwStatus = XGetLaunchData( (void*)&m_Launch, dwLaunchDataSize );
if ( dwStatus == ERROR_SUCCESS )
{
bValid = true;
m_LaunchDataSize = dwLaunchDataSize;
}
}
if ( !bValid )
{
ResetLaunchData();
}
}
// a valid launch payload could be ours (re-launch) or from an alternate booter (demo launcher)
if ( m_LaunchDataSize == MAX_LAUNCH_DATA_SIZE && m_Launch.header.id == VALVE_LAUNCH_ID && m_Launch.header.version == VALVE_LAUNCH_VERSION )
{
// internal recognized format
if ( pID )
{
*pID = m_Launch.header.id;
}
if ( pData )
{
*pData = m_Launch.data + sizeof( launchHeader_t );
}
if ( pDataSize )
{
*pDataSize = m_Launch.header.nDataSize;
}
}
else if ( m_LaunchDataSize )
{
// not ours, unknown format, caller interprets
if ( pID )
{
// assume payload was packaged with an initial ID
*pID = *(unsigned int *)m_Launch.data;
}
if ( pData )
{
*pData = m_Launch.data;
}
if ( pDataSize )
{
*pDataSize = m_LaunchDataSize;
}
}
else if ( !m_LaunchDataSize )
{
// mark for caller as all invalid
if ( pID )
{
*pID = 0;
}
if ( pData )
{
*pData = NULL;
}
if ( pDataSize )
{
*pDataSize = 0;
}
}
// valid when any data is available (not necessarily valve's tag)
return ( m_LaunchDataSize != 0 );
}
//--------------------------------------------------------------------------------------
// Returns TRUE if the launch data blob is available. FALSE otherwise.
// Data blob could be ours or not.
//--------------------------------------------------------------------------------------
bool RestoreLaunchData()
{
return GetLaunchData( NULL, NULL, NULL );
}
//--------------------------------------------------------------------------------------
// Restores the data blob. If the data blob is not ours, resets it.
//--------------------------------------------------------------------------------------
void RestoreOrResetLaunchData()
{
RestoreLaunchData();
#if !defined( _DEMO )
if ( m_Launch.header.id != VALVE_LAUNCH_ID || m_Launch.header.version != VALVE_LAUNCH_VERSION )
{
// not interested in somebody else's data
ResetLaunchData();
}
#endif
}
//--------------------------------------------------------------------------------------
// Returns OUR internal launch flags.
//--------------------------------------------------------------------------------------
int GetLaunchFlags()
{
// establish the data
RestoreOrResetLaunchData();
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return 0;
}
#endif
return m_Launch.header.flags;
}
void SetLaunchFlags( unsigned int ufNewFlags )
{
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return;
}
#endif
m_Launch.header.flags = ufNewFlags;
}
void GetStorageID( int storageID[4] )
{
RestoreOrResetLaunchData();
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
storageID[0] = XBX_INVALID_STORAGE_ID;
storageID[1] = XBX_INVALID_STORAGE_ID;
storageID[2] = XBX_INVALID_STORAGE_ID;
storageID[3] = XBX_INVALID_STORAGE_ID;
return;
}
#endif
memcpy( storageID, m_Launch.header.nCtrlr2Storage, sizeof( m_Launch.header.nCtrlr2Storage ) );
}
void SetStorageID( int const storageID[4] )
{
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return;
}
#endif
memcpy( m_Launch.header.nCtrlr2Storage, storageID, sizeof( m_Launch.header.nCtrlr2Storage ) );
}
void GetSlotUsers( int &numGameUsers, char nSlot2Ctrlr[4], char nSlot2Guest[4] )
{
RestoreOrResetLaunchData();
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
numGameUsers = 0;
nSlot2Ctrlr[0] = 0;
nSlot2Ctrlr[1] = 1;
nSlot2Ctrlr[2] = 2;
nSlot2Ctrlr[3] = 3;
nSlot2Guest[0] = 0;
nSlot2Guest[1] = 0;
nSlot2Guest[2] = 0;
nSlot2Guest[3] = 0;
return;
}
#endif
numGameUsers = m_Launch.header.numGameUsers;
memcpy( nSlot2Ctrlr, m_Launch.header.nSlot2Ctrlr, sizeof( m_Launch.header.nSlot2Ctrlr ) );
memcpy( nSlot2Guest, m_Launch.header.nSlot2Guest, sizeof( m_Launch.header.nSlot2Guest ) );
}
void SetSlotUsers( int numGameUsers, char const nSlot2Ctrlr[4], char const nSlot2Guest[4] )
{
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return;
}
#endif
m_Launch.header.numGameUsers = numGameUsers;
memcpy( m_Launch.header.nSlot2Ctrlr, nSlot2Ctrlr, sizeof( m_Launch.header.nSlot2Ctrlr ) );
memcpy( m_Launch.header.nSlot2Guest, nSlot2Guest, sizeof( m_Launch.header.nSlot2Guest ) );
}
int GetUserID( void )
{
RestoreOrResetLaunchData();
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return XBX_INVALID_USER_ID;
}
#endif
return m_Launch.header.nUserID;
}
void SetUserID( int userID )
{
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return;
}
#endif
m_Launch.header.nUserID = userID;
}
bool GetForceEnglish( void )
{
RestoreOrResetLaunchData();
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return false;
}
#endif
return m_Launch.header.bForceEnglish ? true : false;
}
void SetForceEnglish( bool bForceEnglish )
{
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return;
}
#endif
m_Launch.header.bForceEnglish = bForceEnglish;
}
DWORD GetAttractID( void )
{
RestoreOrResetLaunchData();
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return 0;
}
#endif
return m_Launch.header.nAttractID;
}
void SetAttractID( DWORD nAttractID )
{
#if defined( _DEMO )
if ( m_Launch.header.id && m_Launch.header.id != VALVE_LAUNCH_ID )
{
return;
}
#endif
m_Launch.header.nAttractID = nAttractID;
}
void Launch( const char *pNewImageName = NULL )
{
if ( !pNewImageName )
{
#if defined( _DEMO )
pNewImageName = XLAUNCH_KEYWORD_DEFAULT_APP;
#else
pNewImageName = "default.xex";
#endif
}
XLaunchNewImage( pNewImageName, 0 );
}
private:
xboxLaunchData_t m_Launch;
DWORD m_LaunchDataSize;
};
#if defined( PLATFORM_H )
// For applications that use tier0.dll
PLATFORM_INTERFACE CXboxLaunch *XboxLaunch();
#endif
#endif

View File

@@ -0,0 +1,154 @@
//========= Copyright <20> 1996-2007, Valve LLC, All rights reserved. ============
//
// Purpose: XBox VXConsole Common. Used for public remote access items.
//
//=============================================================================
#pragma once
// sent during connection, used to explicitly guarantee a binary compatibility
#define VXCONSOLE_PROTOCOL_VERSION 300
typedef struct
{
char labelString[128];
COLORREF color;
} xrProfile_t;
typedef struct
{
char messageString[256];
float time;
float deltaTime;
size_t memory;
int deltaMemory;
} xrTimeStamp_t;
typedef struct
{
char nameString[256];
char shaderString[256];
int refCount;
} xrMaterial_t;
enum cacheableState_e
{
CS_STATIC = 0, // texture is not lru managed
CS_EVICTED, // texture mip0 is not in memory
CS_LOADING, // texture mip0 is loading
CS_VALID, // texture mip0 is valid for rendering
CS_MAX
};
typedef struct
{
char nameString[256];
char groupString[64];
char formatString[64];
int size;
int width;
int height;
int depth;
int numLevels;
int binds;
int refCount;
int sRGB;
int edram;
int procedural;
int cacheableState;
int cacheableSize : 31; // Packing avoids game-to-vxconsole protocol version conflict
int final : 1;
int failed;
int pwl;
int reduced;
} xrTexture_t;
typedef struct
{
char nameString[256];
char formatString[64];
int rate;
int bits;
int channels;
int looped;
int dataSize;
int numSamples;
int streamed;
int quality;
} xrSound_t;
typedef struct
{
char nameString[128];
char helpString[256];
} xrCommand_t;
typedef struct
{
float position[3];
float angle[3];
char mapPath[256];
char savePath[256];
int build;
int skill;
char details[1024];
} xrMapInfo_t;
typedef struct
{
int BSPSize;
} xrBudgetInfo_t;
struct xrModel_t
{
char nameString[256];
int dataSize;
int numVertices;
int triCount;
int dataSizeLod0;
int numVerticesLod0;
int triCountLod0;
int numBones;
int numParts;
int numLODs;
int numMeshes;
};
struct xrDataCacheItem_t
{
char nameString[256];
char sectionString[64];
int size;
int lockCount;
unsigned int clientId;
unsigned int itemData;
unsigned int handle;
};
struct xrVProfNodeItem_t
{
char nameString[128];
char budgetGroupString[128];
unsigned int budgetGroupColor;
unsigned int totalCalls;
double inclusiveTime;
double exclusiveTime;
};
// Types of action taken in response to an rc_Assert() message
enum AssertAction_t
{
ASSERT_ACTION_BREAK = 0, // Break on this Assert
ASSERT_ACTION_IGNORE_THIS, // Ignore this Assert once
ASSERT_ACTION_IGNORE_ALWAYS, // Ignore this Assert from now on
ASSERT_ACTION_IGNORE_FILE, // Ignore all Asserts from this file from now on
ASSERT_ACTION_IGNORE_ALL, // Ignore all Asserts from now on
ASSERT_ACTION_OTHER // A more complex response requiring additional data (e.g. "ignore this Assert 5 times")
};
//id's for dispatching binary notifications to proper handlers
enum XBX_DBGBinaryNotification_HandlerID_t
{
XBX_DBG_BNH_STACKTRANSLATOR,
XBX_DBG_BNH_END,
};

File diff suppressed because it is too large Load Diff

461
common/xbox/xboxstubs.h Normal file
View File

@@ -0,0 +1,461 @@
//========= Copyright 1996-2004, Valve LLC, All rights reserved. ============
//
// Purpose: Win32 replacements for XBox.
//
//=============================================================================
#if !defined( XBOXSTUBS_H ) && !defined( _X360 )
#define XBOXSTUBS_H
#ifdef _WIN32
#pragma once
#endif
#ifdef _WIN32
typedef unsigned long DWORD;
//#include "winlite.h"
#endif
#include "tier0/platform.h"
// Content creation/open flags
#define XCONTENTFLAG_NONE 0x00
#define XCONTENTFLAG_CREATENEW 0x00
#define XCONTENTFLAG_CREATEALWAYS 0x00
#define XCONTENTFLAG_OPENEXISTING 0x00
#define XCONTENTFLAG_OPENALWAYS 0x00
#define XCONTENTFLAG_TRUNCATEEXISTING 0x00
// Content attributes
#define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00
#define XCONTENTFLAG_NODEVICE_TRANSFER 0x00
#define XCONTENTFLAG_STRONG_SIGNED 0x00
#define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00
#define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00
// XNet flags
#define XNET_GET_XNADDR_PENDING 0x00000000 // Address acquisition is not yet complete
#define XNET_GET_XNADDR_NONE 0x00000001 // XNet is uninitialized or no debugger found
#define XNET_GET_XNADDR_ETHERNET 0x00000002 // Host has ethernet address (no IP address)
#define XNET_GET_XNADDR_STATIC 0x00000004 // Host has statically assigned IP address
#define XNET_GET_XNADDR_DHCP 0x00000008 // Host has DHCP assigned IP address
#define XNET_GET_XNADDR_PPPOE 0x00000010 // Host has PPPoE assigned IP address
#define XNET_GET_XNADDR_GATEWAY 0x00000020 // Host has one or more gateways configured
#define XNET_GET_XNADDR_DNS 0x00000040 // Host has one or more DNS servers configured
#define XNET_GET_XNADDR_ONLINE 0x00000080 // Host is currently connected to online service
#define XNET_GET_XNADDR_TROUBLESHOOT 0x00008000 // Network configuration requires troubleshooting
// Console device ports
#define XDEVICE_PORT0 0
#define XDEVICE_PORT1 1
#define XDEVICE_PORT2 2
#define XDEVICE_PORT3 3
#ifndef _PS3
#define XUSER_MAX_COUNT 4
#endif // !_PS3
#define XUSER_INDEX_NONE 0x000000FE
#define XBX_CLR_DEFAULT 0xFF000000
#define XBX_CLR_WARNING 0x0000FFFF
#define XBX_CLR_ERROR 0x000000FF
#ifndef _PS3
#define XBOX_MINBORDERSAFE 0
#define XBOX_MAXBORDERSAFE 0
#endif // !_PS3
#if defined( PLATFORM_PS3 )
#include "ps3/ps3_core.h"
#endif
#ifndef _PS3
typedef enum
{
XK_NULL,
XK_BUTTON_UP,
XK_BUTTON_DOWN,
XK_BUTTON_LEFT,
XK_BUTTON_RIGHT,
XK_BUTTON_START,
XK_BUTTON_BACK,
XK_BUTTON_STICK1,
XK_BUTTON_STICK2,
XK_BUTTON_A,
XK_BUTTON_B,
XK_BUTTON_X,
XK_BUTTON_Y,
XK_BUTTON_LEFT_SHOULDER,
XK_BUTTON_RIGHT_SHOULDER,
XK_BUTTON_LTRIGGER,
XK_BUTTON_RTRIGGER,
XK_STICK1_UP,
XK_STICK1_DOWN,
XK_STICK1_LEFT,
XK_STICK1_RIGHT,
XK_STICK2_UP,
XK_STICK2_DOWN,
XK_STICK2_LEFT,
XK_STICK2_RIGHT,
XK_BUTTON_INACTIVE_START,
XK_BUTTON_FIREMODE_SELECTOR_1,
XK_BUTTON_FIREMODE_SELECTOR_2,
XK_BUTTON_FIREMODE_SELECTOR_3,
XK_BUTTON_RELOAD,
XK_BUTTON_TRIGGER,
XK_BUTTON_PUMP_ACTION,
XK_XBUTTON_ROLL_RIGHT,
XK_XBUTTON_ROLL_LEFT,
XK_MAX_KEYS,
} xKey_t;
#endif
//typedef enum
//{
// XVRB_NONE, // off
// XVRB_ERROR, // fatal error
// XVRB_ALWAYS, // no matter what
// XVRB_WARNING, // non-fatal warnings
// XVRB_STATUS, // status reports
// XVRB_ALL,
//} xverbose_e;
#ifndef WORD
typedef unsigned short WORD;
#endif
#if ( !defined ( DWORD ) && !defined( WIN32 ) && !defined( _PS3 ))
typedef unsigned int DWORD;
#endif
#ifndef POSIX
typedef void* HANDLE;
# if defined(_PS3) || defined(POSIX)
typedef unsigned long long ULONGLONG
# else
typedef unsigned __int64 ULONGLONG;
# endif
#endif
#if defined( OSX )
typedef DWORD COLORREF;
#elif defined( POSIX ) && !defined( _PS3 )
typedef DWORD COLORREF;
#endif
#ifndef INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
#endif
/*
* Internet address (old style... should be updated)
*/
#ifdef PLATFORM_PS3
#include <netinet/in.h>
typedef struct in_addr IN_ADDR;
#elif defined( POSIX )
struct ip4_addr {
union {
struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { unsigned short s_w1,s_w2; } S_un_w;
unsigned long S_addr;
} S_un;
};
typedef struct ip4_addr IN_ADDR;
#else
#ifndef s_addr
/*
* Internet address (old style... should be updated)
*/
struct in_addr {
union {
struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { unsigned short s_w1,s_w2; } S_un_w;
unsigned long S_addr;
} S_un;
#define s_addr S_un.S_addr
/* can be used for most tcp & ip code */
#define s_host S_un.S_un_b.s_b2
/* host on imp */
#define s_net S_un.S_un_b.s_b1
/* network */
#define s_imp S_un.S_un_w.s_w2
/* imp */
#define s_impno S_un.S_un_b.s_b4
/* imp # */
#define s_lh S_un.S_un_b.s_b3
/* logical host */
};
typedef struct in_addr IN_ADDR;
#endif
#endif
typedef unsigned int XIN_ADDR;
typedef struct {
IN_ADDR ina; // IP address (zero if not static/DHCP)
IN_ADDR inaOnline; // Online IP address (zero if not online)
WORD wPortOnline; // Online port
BYTE abEnet[6]; // Ethernet MAC address
BYTE abOnline[20]; // Online identification
} XNADDR;
typedef uint64 XUID;
#ifndef INVALID_XUID
#define INVALID_XUID ((XUID) 0)
#endif
#ifndef _PS3
typedef struct {
BYTE ab[8]; // xbox to xbox key identifier
} XNKID;
typedef struct {
BYTE ab[16]; // xbox to xbox key exchange key
} XNKEY;
#endif
typedef struct _XSESSION_INFO
{
XNKID sessionID; // 8 bytes
XNADDR hostAddress; // 36 bytes
XNKEY keyExchangeKey; // 16 bytes
} XSESSION_INFO, *PXSESSION_INFO;
typedef struct _XUSER_DATA
{
BYTE type;
union
{
int nData; // XUSER_DATA_TYPE_INT32
int64 i64Data; // XUSER_DATA_TYPE_INT64
double dblData; // XUSER_DATA_TYPE_DOUBLE
struct // XUSER_DATA_TYPE_UNICODE
{
uint cbData; // Includes null-terminator
char * pwszData;
} string;
float fData; // XUSER_DATA_TYPE_FLOAT
struct // XUSER_DATA_TYPE_BINARY
{
uint cbData;
char * pbData;
} binary;
};
} XUSER_DATA, *PXUSER_DATA;
typedef struct _XUSER_PROPERTY
{
DWORD dwPropertyId;
XUSER_DATA value;
} XUSER_PROPERTY, *PXUSER_PROPERTY;
typedef struct _XUSER_CONTEXT
{
DWORD dwContextId;
DWORD dwValue;
} XUSER_CONTEXT, *PXUSER_CONTEXT;
typedef struct _XSESSION_SEARCHRESULT
{
XSESSION_INFO info;
DWORD dwOpenPublicSlots;
DWORD dwOpenPrivateSlots;
DWORD dwFilledPublicSlots;
DWORD dwFilledPrivateSlots;
DWORD cProperties;
DWORD cContexts;
PXUSER_PROPERTY pProperties;
PXUSER_CONTEXT pContexts;
} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT;
typedef struct _XSESSION_SEARCHRESULT_HEADER
{
DWORD dwSearchResults;
XSESSION_SEARCHRESULT *pResults;
} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER;
typedef struct _XSESSION_REGISTRANT
{
uint64 qwMachineID;
DWORD bTrustworthiness;
DWORD bNumUsers;
XUID *rgUsers;
} XSESSION_REGISTRANT;
typedef struct _XSESSION_REGISTRATION_RESULTS
{
DWORD wNumRegistrants;
XSESSION_REGISTRANT *rgRegistrants;
} XSESSION_REGISTRATION_RESULTS, *PXSESSION_REGISTRATION_RESULTS;
typedef struct {
BYTE bFlags;
BYTE bReserved;
WORD cProbesXmit;
WORD cProbesRecv;
WORD cbData;
BYTE * pbData;
WORD wRttMinInMsecs;
WORD wRttMedInMsecs;
DWORD dwUpBitsPerSec;
DWORD dwDnBitsPerSec;
} XNQOSINFO;
typedef struct {
uint cxnqos;
uint cxnqosPending;
XNQOSINFO axnqosinfo[1];
} XNQOS;
#define XSESSION_CREATE_HOST 0
#define XSESSION_CREATE_USES_ARBITRATION 0
#define XNET_QOS_LISTEN_ENABLE 0
#define XNET_QOS_LISTEN_DISABLE 0
#define XNET_QOS_LISTEN_SET_DATA 0
#define XUSER_DATA_TYPE_CONTEXT ((BYTE)0)
#define XUSER_DATA_TYPE_INT32 ((BYTE)1)
#define XUSER_DATA_TYPE_INT64 ((BYTE)2)
#define XUSER_DATA_TYPE_DOUBLE ((BYTE)3)
#define XUSER_DATA_TYPE_UNICODE ((BYTE)4)
#define XUSER_DATA_TYPE_FLOAT ((BYTE)5)
#define XUSER_DATA_TYPE_BINARY ((BYTE)6)
#define XUSER_DATA_TYPE_DATETIME ((BYTE)7)
#define XUSER_DATA_TYPE_NULL ((BYTE)0xFF)
#define XPROFILE_TITLE_SPECIFIC1 0x3FFF
#define XPROFILE_TITLE_SPECIFIC2 0x3FFE
#define XPROFILE_TITLE_SPECIFIC3 0x3FFD
#define XPROFILE_SETTING_MAX_SIZE 1000
FORCEINLINE unsigned int XBX_GetSystemTime() { return 0; }
#ifndef PLATFORM_PS3
FORCEINLINE DWORD XBX_GetNumGameUsers() { return 1; }
FORCEINLINE void XBX_ProcessEvents() {}
FORCEINLINE void XBX_DispatchEventsQueue() {}
FORCEINLINE DWORD XBX_GetPrimaryUserId() { return 0; }
FORCEINLINE void XBX_SetPrimaryUserId( DWORD idx ) {}
FORCEINLINE void XBX_ResetStorageDeviceInfo() {}
FORCEINLINE DWORD XBX_DescribeStorageDevice( DWORD nStorageID ) { return 1; }
FORCEINLINE DWORD XBX_GetStorageDeviceId(int) { return 0; }
FORCEINLINE void XBX_SetStorageDeviceId( int, DWORD ) {}
FORCEINLINE const char *XBX_GetLanguageString() { return ""; }
FORCEINLINE bool XBX_IsLocalized() { return false; }
FORCEINLINE bool XBX_IsAudioLocalized() { return false; }
FORCEINLINE const char *XBX_GetNextSupportedLanguage( const char *pLanguage, bool *pbHasAudio ) { return NULL; }
FORCEINLINE bool XBX_IsRestrictiveLanguage() { return false; }
FORCEINLINE int XBX_GetUserId( int nSlot ) { return nSlot; }
FORCEINLINE int XBX_GetSlotByUserId( int idx ) { return idx; }
FORCEINLINE void XBX_SetUserId( int nSlot, int idx ) {}
#endif
#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
#define XCONTENT_MAX_FILENAME_LENGTH 42
#ifndef _PS3
#define XBX_INVALID_STORAGE_ID ((DWORD) -1)
#define XBX_STORAGE_DECLINED ((DWORD) -2)
#endif // !_PS3
enum XUSER_SIGNIN_STATE
{
eXUserSigninState_NotSignedIn,
eXUserSigninState_SignedInLocally,
eXUserSigninState_SignedInToLive,
};
#if defined( _PS3 )
#elif defined( POSIX )
typedef size_t ULONG_PTR;
#elif defined( _M_X64 )
typedef _W64 unsigned __int64 ULONG_PTR;
#else
typedef _W64 unsigned long ULONG_PTR;
#endif
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
typedef void * PXOVERLAPPED_COMPLETION_ROUTINE;
#if defined( _PS3 ) || !defined( POSIX )
typedef struct _XOVERLAPPED {
ULONG_PTR InternalLow;
ULONG_PTR InternalHigh;
ULONG_PTR InternalContext;
HANDLE hEvent;
PXOVERLAPPED_COMPLETION_ROUTINE pCompletionRoutine;
DWORD_PTR dwCompletionContext;
DWORD dwExtendedError;
} XOVERLAPPED, *PXOVERLAPPED;
#endif
#ifndef MAX_RICHPRESENCE_SIZE
#define MAX_RICHPRESENCE_SIZE 64
#endif
#ifndef XUSER_NAME_SIZE
#define XUSER_NAME_SIZE 16
#endif
#ifndef GPU_RESOLVE_ALIGNMENT
#define GPU_RESOLVE_ALIGNMENT 8
#endif
#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
#define XCONTENT_MAX_FILENAME_LENGTH 42
#define XCONTENTDEVICE_MAX_NAME_LENGTH 27
typedef DWORD XCONTENTDEVICEID, *PXCONTENTDEVICEID;
#ifndef _PS3
typedef struct _XCONTENT_DATA
{
XCONTENTDEVICEID DeviceID;
DWORD dwContentType;
wchar_t szDisplayName[XCONTENT_MAX_DISPLAYNAME_LENGTH];
char szFileName[XCONTENT_MAX_FILENAME_LENGTH];
} XCONTENT_DATA, *PXCONTENT_DATA;
#endif
#define X_CONTEXT_PRESENCE 0x00010001
#define X_CONTEXT_GAME_TYPE 0x0001000A
#define X_CONTEXT_GAME_MODE 0x0001000B
#define X_PROPERTY_RANK 0x00011001
#define X_PROPERTY_GAMERNAME 0x00011002
#define X_PROPERTY_SESSION_ID 0x00011003
// System attributes used in matchmaking queries
#define X_PROPERTY_GAMER_ZONE 0x00011101
#define X_PROPERTY_GAMER_COUNTRY 0x00011102
#define X_PROPERTY_GAMER_LANGUAGE 0x00011103
#define X_PROPERTY_GAMER_RATING 0x00011104
#define X_PROPERTY_GAMER_MU 0x00011105
#define X_PROPERTY_GAMER_SIGMA 0x00011106
#define X_PROPERTY_GAMER_PUID 0x00011107
#define X_PROPERTY_AFFILIATE_SCORE 0x00011108
#define X_PROPERTY_GAMER_HOSTNAME 0x00011109
// Properties used to write to skill leaderboards
#define X_PROPERTY_RELATIVE_SCORE 0x0001100A
#define X_PROPERTY_SESSION_TEAM 0x0001100B
// Properties written at the session level to override TrueSkill parameters
#define X_PROPERTY_PLAYER_PARTIAL_PLAY_PERCENTAGE 0x0001100C
#define X_PROPERTY_PLAYER_SKILL_UPDATE_WEIGHTING_FACTOR 0x0001100D
#define X_PROPERTY_SESSION_SKILL_BETA 0x0001100E
#define X_PROPERTY_SESSION_SKILL_TAU 0x0001100F
#define X_PROPERTY_SESSION_SKILL_DRAW_PROBABILITY 0x00011010
// Attachment size is written to a leaderboard when the entry qualifies for
// a gamerclip. The rating can be retrieved via XUserEstimateRankForRating.
#define X_PROPERTY_ATTACHMENT_SIZE 0x00011011
// Values for X_CONTEXT_GAME_TYPE
#define X_CONTEXT_GAME_TYPE_RANKED 0
#define X_CONTEXT_GAME_TYPE_STANDARD 1
#endif // XBOXSTUBS_H