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.

152 lines
5.4 KiB

  1. //===== Copyright � 1996-2010, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Utility class for discovering and caching path info on the PS3.
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef PS3_PATHINFO_H
  8. #define PS3_PATHINFO_H
  9. #include <sysutil/sysutil_gamecontent.h>
  10. #include <sysutil/sysutil_syscache.h>
  11. #include "../common/ps3_cstrike15/ps3_title_id.h"
  12. #define HDD_BOOT
  13. /// Contains the game root / data / patch / etc paths.
  14. /// Needs to be initialized once and then you can access at will.
  15. class CPs3ContentPathInfo
  16. {
  17. public:
  18. // Call this once, when you've got the filesystem DLL loaded and ready to go.
  19. // Returns CELL_GAME_RET_OK on success; see cpp for error codes
  20. enum Flags_t
  21. {
  22. INIT_RETAIL_MODE = ( 1 << 0 ),
  23. INIT_IMAGE_ON_BDVD = ( 1 << 1 ),
  24. INIT_IMAGE_ON_HDD = ( 1 << 2 ),
  25. INIT_IMAGE_APP_HOME = ( 1 << 3 ),
  26. INIT_PRX_ON_BDVD = ( 1 << 4 ),
  27. INIT_PRX_ON_HDD = ( 1 << 5 ),
  28. INIT_PRX_APP_HOME = ( 1 << 6 ),
  29. INIT_SYS_CACHE_CLEAR = ( 1 << 7 ),
  30. };
  31. int Init( unsigned int uiFlagsMask );
  32. inline const char *GameAppVer() const;
  33. inline const char *GamePatchAppVer() const;
  34. inline const char *PrxPath() const; // where the PRXes can be found (eg, yadda/bin)
  35. inline const char *GameBasePath() const; // the directory equivalent to game/... in a PC/Steam install.
  36. inline const char *GamePatchBasePath() const; // the directory equivalent to game/... in a PC/Steam install.
  37. inline const char *SelfDirectory() const; /// the directory where the .self file can be found.
  38. inline const char *HDDataPath() const; /// the "game data" path which we create on the local hd
  39. inline const char *SystemCachePath() const; /// the "system cache" path as returned by cellSysCacheMount()
  40. inline const char *GameImagePath() const; // the directory tree under which to hunt for the .zip s. This can be different things depending on command line overrides.
  41. inline const char *SaveShadowPath() const; // the directory in which save files are temporarily stored. returned by engine->GetSaveDirName().
  42. inline int GetFreeHDDSpace( ) const ; /// the const version can only use the cached value
  43. // some helpful state queries:
  44. inline unsigned int GetGameBootAttributes() const { return m_nBootAttribs; }
  45. inline bool IsBeingDebugged() const { return (m_nBootAttribs & CELL_GAME_ATTRIBUTE_DEBUG) != 0; }
  46. inline bool IsPatched() const { return (m_nBootAttribs & CELL_GAME_ATTRIBUTE_PATCH) != 0; }
  47. inline bool IsInitialized() const { return m_bInitialized; }
  48. inline unsigned int BootType() const { return m_nBootType; }
  49. inline const char *GetParamSFO_Title() { return m_gameTitle; }
  50. inline const char *GetParamSFO_TitleID() { return m_gameTitleID; } // aka "product code" in the saveutil docs
  51. inline const char *GetWWMASTER_TitleID() { return PS3_GAME_TITLE_ID_WW_MASTER; }
  52. CPs3ContentPathInfo();
  53. private:
  54. char m_gameTitle[CELL_GAME_SYSP_TITLE_SIZE]; // CELL_GAME_PARAMID_TITLE
  55. char m_gameTitleID[CELL_GAME_SYSP_TITLEID_SIZE]; // CELL_GAME_PARAMID_TITLE_ID
  56. char m_gameAppVer[CELL_GAME_SYSP_VERSION_SIZE]; // CELL_GAME_PARAMID_APP_VER
  57. char m_gamePatchAppVer[CELL_GAME_SYSP_VERSION_SIZE]; // CELL_GAME_PARAMID_APP_VER
  58. int m_gameParentalLevel; // CELL_GAME_PARAMID_PARENTAL_LEVEL
  59. int m_gameResolution; // CELL_GAME_PARAMID_RESOLUTION
  60. int m_gameSoundFormat; // CELL_GAME_PARAMID_SOUND_FORMAT
  61. char m_gameContentPath[CELL_GAME_PATH_MAX]; // as returned by contentPermit but usually meaningless (?)
  62. char m_gamePatchContentPath[CELL_GAME_PATH_MAX]; // as returned by contentPermit but usually meaningless (?)
  63. char m_gameBasePath[CELL_GAME_PATH_MAX];
  64. char m_gamePatchBasePath[CELL_GAME_PATH_MAX];
  65. char m_gameExesPath[CELL_GAME_PATH_MAX];
  66. char m_gameHDDataPath[CELL_GAME_PATH_MAX];
  67. char m_gameImageDataPath[CELL_GAME_PATH_MAX];
  68. char m_gameSystemCachePath[CELL_SYSCACHE_PATH_MAX]; // as returned by cellSysCacheMount()
  69. char m_gameSavesShadowPath[CELL_SYSCACHE_PATH_MAX]; // as returned by cellSysCacheMount()
  70. unsigned int m_nBootType; /// either CELL_GAME_GAMETYPE_DISC or CELL_GAME_GAMETYPE_HDD
  71. unsigned int m_nBootAttribs; /// some combination of attribute masks -- see .cpp for details
  72. int m_nHDDFreeSizeKb; /// cached value for free hard disk space in kb.
  73. bool m_bInitialized;
  74. };
  75. const char * CPs3ContentPathInfo::GameAppVer() const
  76. {
  77. return m_gameAppVer;
  78. }
  79. const char * CPs3ContentPathInfo::GamePatchAppVer() const
  80. {
  81. return m_gamePatchAppVer;
  82. }
  83. const char * CPs3ContentPathInfo::GameBasePath() const
  84. {
  85. return m_gameBasePath;
  86. }
  87. const char * CPs3ContentPathInfo::GamePatchBasePath() const
  88. {
  89. return m_gamePatchBasePath;
  90. }
  91. const char * CPs3ContentPathInfo::SelfDirectory() const
  92. {
  93. return m_gameBasePath; // happens to be the same in the current implementation
  94. }
  95. const char * CPs3ContentPathInfo::HDDataPath() const
  96. {
  97. return m_gameHDDataPath; // happens to be the same in the current implementation
  98. }
  99. const char * CPs3ContentPathInfo::SystemCachePath() const
  100. {
  101. return m_gameSystemCachePath; // happens to be the same in the current implementation
  102. }
  103. const char * CPs3ContentPathInfo::GameImagePath() const
  104. {
  105. return m_gameImageDataPath; // happens to be the same in the current implementation
  106. }
  107. const char * CPs3ContentPathInfo::PrxPath() const
  108. {
  109. return m_gameExesPath;
  110. }
  111. const char * CPs3ContentPathInfo::SaveShadowPath() const
  112. {
  113. return m_gameSavesShadowPath;
  114. }
  115. int CPs3ContentPathInfo::GetFreeHDDSpace( ) const
  116. {
  117. return m_nHDDFreeSizeKb;
  118. }
  119. extern CPs3ContentPathInfo *g_pPS3PathInfo;
  120. #endif // PS3_PATHINFO_H