Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface to Xbox 360 system functions. Helps deal with the async system and Live
  4. // functions by either providing a handle for the caller to check results or handling
  5. // automatic cleanup of the async data when the caller doesn't care about the results.
  6. //
  7. //===========================================================================//
  8. #ifndef IXBOXSYSTEM_H
  9. #define IXBOXSYSTEM_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #if !defined( _X360 )
  14. #include "xbox/xboxstubs.h"
  15. #endif
  16. typedef void* AsyncHandle_t;
  17. typedef void* XboxHandle_t;
  18. #ifdef POSIX
  19. #define ERROR_SUCCESS 0
  20. #define ERROR_IO_PENDING 1
  21. #define ERROR_IO_INCOMPLETE 2
  22. #define ERROR_INSUFFICIENT_BUFFER 3
  23. #endif
  24. //-----------------------------------------------------------------------------
  25. // Xbox system interface
  26. //-----------------------------------------------------------------------------
  27. abstract_class IXboxSystem
  28. {
  29. public:
  30. virtual AsyncHandle_t CreateAsyncHandle( void ) = 0;
  31. virtual void ReleaseAsyncHandle( AsyncHandle_t handle ) = 0;
  32. virtual int GetOverlappedResult( AsyncHandle_t handle, uint *pResultCode, bool bWait ) = 0;
  33. virtual void CancelOverlappedOperation( AsyncHandle_t handle ) = 0;
  34. // Save/Load
  35. virtual void GetModSaveContainerNames( const char *pchModName, const wchar_t **ppchDisplayName, const char **ppchName ) = 0;
  36. virtual uint GetContainerRemainingSpace( void ) = 0;
  37. virtual bool DeviceCapacityAdequate( DWORD nStorageID, const char *pModName ) = 0;
  38. virtual DWORD DiscoverUserData( DWORD nUserID, const char *pModName ) = 0;
  39. // XUI
  40. virtual bool ShowDeviceSelector( bool bForce, uint *pStorageID, AsyncHandle_t *pHandle ) = 0;
  41. virtual void ShowSigninUI( uint nPanes, uint nFlags ) = 0;
  42. // Rich Presence and Matchmaking
  43. virtual int UserSetContext( uint nUserIdx, uint nContextID, uint nContextValue, bool bAsync = true, AsyncHandle_t *pHandle = NULL ) = 0;
  44. virtual int UserSetProperty( uint nUserIndex, uint nPropertyId, uint nBytes, const void *pvValue, bool bAsync = true, AsyncHandle_t *pHandle = NULL ) = 0;
  45. // Matchmaking
  46. virtual int CreateSession( uint nFlags, uint nUserIdx, uint nMaxPublicSlots, uint nMaxPrivateSlots, uint64 *pNonce, void *pSessionInfo, XboxHandle_t *pSessionHandle, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  47. virtual uint DeleteSession( XboxHandle_t hSession, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  48. virtual uint SessionSearch( uint nProcedureIndex, uint nUserIndex, uint nNumResults, uint nNumUsers, uint nNumProperties, uint nNumContexts, XUSER_PROPERTY *pSearchProperties, XUSER_CONTEXT *pSearchContexts, uint *pcbResultsBuffer, XSESSION_SEARCHRESULT_HEADER *pSearchResults, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  49. virtual uint SessionStart( XboxHandle_t hSession, uint nFlags, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  50. virtual uint SessionEnd( XboxHandle_t hSession, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  51. virtual int SessionJoinLocal( XboxHandle_t hSession, uint nUserCount, const uint *pUserIndexes, const bool *pPrivateSlots, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  52. virtual int SessionJoinRemote( XboxHandle_t hSession, uint nUserCount, const XUID *pXuids, const bool *pPrivateSlots, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  53. virtual int SessionLeaveLocal( XboxHandle_t hSession, uint nUserCount, const uint *pUserIndexes, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  54. virtual int SessionLeaveRemote( XboxHandle_t hSession, uint nUserCount, const XUID *pXuids, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  55. virtual int SessionMigrate( XboxHandle_t hSession, uint nUserIndex, void *pSessionInfo, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  56. virtual int SessionArbitrationRegister( XboxHandle_t hSession, uint nFlags, uint64 nonce, uint *pBytes, void *pBuffer, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  57. // Stats
  58. virtual int WriteStats( XboxHandle_t hSession, XUID xuid, uint nViews, void* pViews, bool bAsync, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  59. // Achievements
  60. virtual int EnumerateAchievements( uint nUserIdx, uint64 xuid, uint nStartingIdx, uint nCount, void *pBuffer, uint nBufferBytes, bool bAsync = true, AsyncHandle_t *pAsyncHandle = NULL ) = 0;
  61. virtual void AwardAchievement( uint nUserIdx, uint nAchievementId ) = 0;
  62. virtual void FinishContainerWrites( void ) = 0;
  63. virtual uint GetContainerOpenResult( void ) = 0;
  64. virtual uint OpenContainers( void ) = 0;
  65. virtual void CloseContainers( void ) = 0;
  66. };
  67. #define XBOXSYSTEM_INTERFACE_VERSION "XboxSystemInterface001"
  68. #endif // IXBOXSYSTEM_H