mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
1
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
//========= Copyright 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
|
||||
#endif
|
||||
|
||||
class IXboxConsole
|
||||
{
|
||||
public:
|
||||
virtual void SendRemoteCommand( const char* dbgCommand, bool bAsync ) = 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 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[], unsigned int 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 AddCommands( int numCommands, const char* commands[], const char* help[] ) = 0;
|
||||
};
|
||||
|
||||
class CXboxConsole : public IXboxConsole
|
||||
{
|
||||
public:
|
||||
void SendRemoteCommand( const char* dbgCommand, bool bAsync );
|
||||
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 );
|
||||
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[], unsigned int 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 AddCommands( int numCommands, const char* commands[], const char* help[] );
|
||||
};
|
||||
|
||||
XBXCONSOLE_INTERFACE IXboxConsole *g_pXboxConsole;
|
||||
XBXCONSOLE_INTERFACE void XboxConsoleInit();
|
||||
|
||||
#define XBX_SendRemoteCommand if ( !g_pXboxConsole ) ; else g_pXboxConsole->SendRemoteCommand
|
||||
#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_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_rAddCommands ( !g_pXboxConsole ) ? 0 : g_pXboxConsole->AddCommands
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
//========= Copyright Valve Corporation, 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"
|
||||
|
||||
// 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 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_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 fallback;
|
||||
int final;
|
||||
int failed;
|
||||
} 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;
|
||||
} xSoundList_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float position[3];
|
||||
float angle[3];
|
||||
char mapPath[256];
|
||||
char savePath[256];
|
||||
int build;
|
||||
int skill;
|
||||
} xMapInfo_t;
|
||||
|
||||
/******************************************************************************
|
||||
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 );
|
||||
|
||||
// Accessors
|
||||
PLATFORM_INTERFACE const char* XBX_GetLanguageString( void );
|
||||
PLATFORM_INTERFACE bool XBX_IsLocalized( void );
|
||||
PLATFORM_INTERFACE DWORD XBX_GetStorageDeviceId( void );
|
||||
PLATFORM_INTERFACE void XBX_SetStorageDeviceId( DWORD id );
|
||||
PLATFORM_INTERFACE DWORD XBX_GetPrimaryUserId( void );
|
||||
PLATFORM_INTERFACE void XBX_SetPrimaryUserId( DWORD id );
|
||||
PLATFORM_INTERFACE XNKID XBX_GetInviteSessionId( void );
|
||||
PLATFORM_INTERFACE void XBX_SetInviteSessionId( XNKID nSessionId );
|
||||
PLATFORM_INTERFACE DWORD XBX_GetInvitedUserId( void );
|
||||
PLATFORM_INTERFACE void XBX_SetInvitedUserId( DWORD nUserId );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,295 @@
|
||||
//========= Copyright 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_GAMERESTART 0x00000010 // set if game wants to restart self (skips appchooser)
|
||||
#define LF_INVITERESTART 0x00000020 // set if game was invited from another app (launches TF and fires off session connect)
|
||||
|
||||
#pragma pack(1)
|
||||
struct launchHeader_t
|
||||
{
|
||||
unsigned int id;
|
||||
unsigned int version;
|
||||
unsigned int flags;
|
||||
|
||||
int nStorageID;
|
||||
int nUserID;
|
||||
int bForceEnglish;
|
||||
XNKID nInviteSessionID;
|
||||
|
||||
// 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.nStorageID = XBX_INVALID_STORAGE_ID;
|
||||
m_Launch.header.nUserID = XBX_INVALID_USER_ID;
|
||||
m_Launch.header.bForceEnglish = false;
|
||||
|
||||
memset( &m_Launch.header.nInviteSessionID, 0, sizeof( m_Launch.header.nInviteSessionID ) );
|
||||
|
||||
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 ( 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;
|
||||
}
|
||||
}
|
||||
|
||||
// valid when 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 ( m_Launch.header.id != VALVE_LAUNCH_ID || m_Launch.header.version != VALVE_LAUNCH_VERSION )
|
||||
{
|
||||
// not interested in somebody else's data
|
||||
ResetLaunchData();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Returns OUR internal launch flags.
|
||||
//--------------------------------------------------------------------------------------
|
||||
int GetLaunchFlags()
|
||||
{
|
||||
// establish the data
|
||||
RestoreOrResetLaunchData();
|
||||
return m_Launch.header.flags;
|
||||
}
|
||||
|
||||
int GetStorageID( void )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
return m_Launch.header.nStorageID;
|
||||
}
|
||||
void SetStorageID( int storageID )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
m_Launch.header.nStorageID = storageID;
|
||||
}
|
||||
|
||||
int GetUserID( void )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
return m_Launch.header.nUserID;
|
||||
}
|
||||
void SetUserID( int userID )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
m_Launch.header.nUserID = userID;
|
||||
}
|
||||
|
||||
bool GetForceEnglish( void )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
return m_Launch.header.bForceEnglish ? true : false;
|
||||
}
|
||||
void SetForceEnglish( bool bForceEnglish )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
m_Launch.header.bForceEnglish = bForceEnglish;
|
||||
}
|
||||
|
||||
void GetInviteSessionID( XNKID *pSessionID )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
*pSessionID = m_Launch.header.nInviteSessionID;
|
||||
}
|
||||
void SetInviteSessionID( XNKID *pSessionID )
|
||||
{
|
||||
RestoreOrResetLaunchData();
|
||||
m_Launch.header.nInviteSessionID = *pSessionID;
|
||||
}
|
||||
|
||||
void Launch( const char *pNewImageName = NULL )
|
||||
{
|
||||
if ( !pNewImageName )
|
||||
{
|
||||
pNewImageName = "default.xex";
|
||||
}
|
||||
|
||||
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
|
||||
@@ -0,0 +1,91 @@
|
||||
//========= Copyright Valve Corporation, 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 103
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char labelString[128];
|
||||
COLORREF color;
|
||||
} xrProfile_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char messageString[256];
|
||||
float time;
|
||||
float deltaTime;
|
||||
int memory;
|
||||
int deltaMemory;
|
||||
} xrTimeStamp_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char nameString[256];
|
||||
char shaderString[256];
|
||||
int refCount;
|
||||
} xrMaterial_t;
|
||||
|
||||
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 fallback;
|
||||
int final;
|
||||
int failed;
|
||||
} xrTexture_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char nameString[256];
|
||||
char formatString[64];
|
||||
int rate;
|
||||
int bits;
|
||||
int channels;
|
||||
int looped;
|
||||
int dataSize;
|
||||
int numSamples;
|
||||
int streamed;
|
||||
} 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;
|
||||
} xrMapInfo_t;
|
||||
|
||||
// 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")
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,237 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Win32 replacements for XBox.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#if !defined( XBOXSTUBS_H ) && !defined( _X360 )
|
||||
#define XBOXSTUBS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#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
|
||||
|
||||
// Console device ports
|
||||
#define XDEVICE_PORT0 0
|
||||
#define XDEVICE_PORT1 1
|
||||
#define XDEVICE_PORT2 2
|
||||
#define XDEVICE_PORT3 3
|
||||
#define XUSER_MAX_COUNT 4
|
||||
#define XUSER_INDEX_NONE 0x000000FE
|
||||
|
||||
#define XBX_CLR_DEFAULT 0xFF000000
|
||||
#define XBX_CLR_WARNING 0x0000FFFF
|
||||
#define XBX_CLR_ERROR 0x000000FF
|
||||
|
||||
#define XBOX_MINBORDERSAFE 0
|
||||
#define XBOX_MAXBORDERSAFE 0
|
||||
|
||||
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_MAX_KEYS,
|
||||
} xKey_t;
|
||||
|
||||
//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;
|
||||
|
||||
typedef unsigned short WORD;
|
||||
#ifndef POSIX
|
||||
typedef unsigned long DWORD;
|
||||
typedef void* HANDLE;
|
||||
typedef unsigned __int64 ULONGLONG;
|
||||
#endif
|
||||
|
||||
#ifdef POSIX
|
||||
typedef DWORD COLORREF;
|
||||
#endif
|
||||
|
||||
#ifndef INVALID_HANDLE_VALUE
|
||||
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
|
||||
#endif
|
||||
|
||||
// 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 int XNADDR;
|
||||
typedef uint64 XUID;
|
||||
|
||||
typedef struct {
|
||||
BYTE ab[8]; // xbox to xbox key identifier
|
||||
} XNKID;
|
||||
|
||||
typedef struct {
|
||||
BYTE ab[16]; // xbox to xbox key exchange key
|
||||
} XNKEY;
|
||||
|
||||
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 XUSER_DATA_TYPE_INT32 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
|
||||
|
||||
FORCEINLINE void XBX_ProcessEvents() {}
|
||||
FORCEINLINE unsigned int XBX_GetSystemTime() { return 0; }
|
||||
FORCEINLINE int XBX_GetPrimaryUserId() { return 0; }
|
||||
FORCEINLINE void XBX_SetPrimaryUserId( DWORD idx ) {}
|
||||
FORCEINLINE int XBX_GetStorageDeviceId() { return 0; }
|
||||
FORCEINLINE void XBX_SetStorageDeviceId( DWORD idx ) {}
|
||||
FORCEINLINE const char *XBX_GetLanguageString() { return ""; }
|
||||
FORCEINLINE bool XBX_IsLocalized() { return false; }
|
||||
|
||||
#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
|
||||
#define XCONTENT_MAX_FILENAME_LENGTH 42
|
||||
|
||||
#define XBX_INVALID_STORAGE_ID ((DWORD) -1)
|
||||
#define XBX_STORAGE_DECLINED ((DWORD) -2)
|
||||
|
||||
#endif // XBOXSTUBS_H
|
||||
Reference in New Issue
Block a user