sys_profile.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __SYS_PROFILE_H__
  21. #define __SYS_PROFILE_H__
  22. #include "sys_savegame.h"
  23. #include "sys_session_savegames.h"
  24. class idSaveGameProcessorSaveProfile;
  25. class idSaveGameProcessorLoadProfile;
  26. class idLocalUser;
  27. class idPlayerProfile;
  28. /*
  29. ================================================
  30. idProfileMgr
  31. ================================================
  32. */
  33. class idProfileMgr {
  34. public:
  35. idProfileMgr();
  36. ~idProfileMgr();
  37. // Called the first time it's asked to load
  38. void Init( idLocalUser * user );
  39. void Pump();
  40. idPlayerProfile * GetProfile();
  41. private:
  42. void LoadSettingsAsync();
  43. void SaveSettingsAsync();
  44. void OnLoadSettingsCompleted( idSaveLoadParms * parms );
  45. void OnSaveSettingsCompleted( idSaveLoadParms * parms );
  46. private:
  47. std::auto_ptr< idSaveGameProcessorSaveProfile > profileSaveProcessor;
  48. std::auto_ptr< idSaveGameProcessorLoadProfile > profileLoadProcessor;
  49. idLocalUser * user; // reference passed in
  50. idPlayerProfile * profile;
  51. saveGameHandle_t handle;
  52. };
  53. /*
  54. ================================================
  55. idSaveGameProcessorSaveProfile
  56. ================================================
  57. */
  58. class idSaveGameProcessorSaveProfile : public idSaveGameProcessorSaveFiles {
  59. public:
  60. DEFINE_CLASS( idSaveGameProcessorSaveProfile );
  61. idSaveGameProcessorSaveProfile();
  62. bool InitSaveProfile( idPlayerProfile * profile, const char * folder );
  63. virtual bool Process();
  64. private:
  65. idFile_SaveGame * profileFile;
  66. idPlayerProfile * profile;
  67. };
  68. /*
  69. ================================================
  70. idSaveGameProcessorLoadProfile
  71. ================================================
  72. */
  73. class idSaveGameProcessorLoadProfile : public idSaveGameProcessorLoadFiles {
  74. public:
  75. DEFINE_CLASS( idSaveGameProcessorLoadProfile );
  76. idSaveGameProcessorLoadProfile();
  77. ~idSaveGameProcessorLoadProfile();
  78. bool InitLoadProfile( idPlayerProfile * profile, const char * folder );
  79. virtual bool Process();
  80. private:
  81. idFile_SaveGame * profileFile;
  82. idPlayerProfile * profile;
  83. };
  84. // Synchronous check, just checks if a profile exists within the savegame location
  85. bool Sys_SaveGameProfileCheck();
  86. #endif