Counter Strike : Global Offensive Source Code
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.

85 lines
3.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #if !defined( HOST_SAVERESTORE_H )
  10. #define HOST_SAVERESTORE_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. class CSaveRestoreData;
  15. abstract_class ISaveRestoreDataCallback
  16. {
  17. public:
  18. // Called by SaveGameState after building the server's CSaveRestoreData
  19. virtual void Execute( CSaveRestoreData *save ) = 0;
  20. };
  21. abstract_class ISaveRestore
  22. {
  23. public:
  24. virtual void Init( void ) = 0;
  25. virtual void Shutdown( void ) = 0;
  26. virtual void OnFrameRendered() = 0;
  27. virtual bool SaveFileExists( const char *pName ) = 0;
  28. virtual bool LoadGame( const char *pName, bool bLetToolsOverrideLoadGameEnts ) = 0;
  29. virtual bool IsOverrideLoadGameEntsOn() = 0;
  30. virtual const char *GetSaveDir(void) = 0;
  31. virtual void ClearSaveDir( void ) = 0;
  32. virtual void RequestClearSaveDir( void ) = 0;
  33. virtual int LoadGameState( char const *level, bool createPlayers ) = 0;
  34. virtual void LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName ) = 0;
  35. virtual const char *FindRecentSave( char *pNameBuf, int nameBufLen ) = 0;
  36. virtual void ForgetRecentSave() = 0;
  37. virtual int SaveGameSlot( const char *pSaveName, const char *pSaveComment, bool onlyThisLevel = false, bool bSetMostRecent = true, const char *pszDestMap = NULL, const char *pszLandmark = NULL ) = 0;
  38. virtual bool SaveGameState( bool bTransition, ISaveRestoreDataCallback *pCallback = NULL, bool bOpenContainer = true, bool bIsAutosaveOrDangerous = false ) = 0;
  39. virtual int IsValidSave( void ) = 0; // returns true if this is a valid time to make a save. (it doesn't ask if a particular save file is valid.)
  40. virtual void Finish( CSaveRestoreData *save ) = 0;
  41. virtual void RestoreClientState( char const *fileName, bool adjacent ) = 0;
  42. virtual void RestoreAdjacenClientState( char const *map ) = 0;
  43. virtual int SaveReadNameAndComment( FileHandle_t f, char *name, char *comment ) = 0;
  44. virtual int GetMostRecentElapsedMinutes( void ) = 0;
  45. virtual int GetMostRecentElapsedSeconds( void ) = 0;
  46. virtual int GetMostRecentElapsedTimeSet( void ) = 0;
  47. virtual void SetMostRecentElapsedMinutes( const int min ) = 0;
  48. virtual void SetMostRecentElapsedSeconds( const int sec ) = 0;
  49. virtual void UpdateSaveGameScreenshots() = 0;
  50. virtual void OnFinishedClientRestore() = 0;
  51. virtual void AutoSaveDangerousIsSafe() = 0;
  52. virtual char const *GetMostRecentlyLoadedFileName() = 0;
  53. virtual char const *GetSaveFileName() = 0;
  54. virtual bool IsXSave( void ) = 0;
  55. virtual void SetIsXSave( bool bState ) = 0;
  56. virtual void FinishAsyncSave() = 0;
  57. virtual bool StorageDeviceValid() = 0;
  58. virtual void SetMostRecentSaveGame( const char *lpszFilename ) = 0;
  59. virtual bool IsSaveInProgress() = 0;
  60. virtual bool IsAutoSaveDangerousInProgress() = 0;
  61. virtual bool SaveGame( const char *pSaveName, bool bIsXSave, char *pOutName, int nOutNameSize, char *pOutComment, int nOutCommentSize ) = 0;
  62. virtual bool IsAutoSaveInProgress() = 0;
  63. };
  64. void *SaveAllocMemory( size_t num, size_t size, bool bClear = false );
  65. void SaveFreeMemory( void *pSaveMem );
  66. #ifndef DEDICATED
  67. extern ISaveRestore *saverestore;
  68. #endif
  69. #endif // HOST_SAVERESTORE_H