KPakFile.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:2k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //---------------------------------------------------------------------------
  2. // Sword3 Engine (c) 1999-2000 by Kingsoft
  3. //
  4. // File: KPakFile.h
  5. // Date: 2000.08.08
  6. // Code: WangWei(Daphnis)
  7. // Desc: Header File
  8. //---------------------------------------------------------------------------
  9. #ifndef KPakFile_H
  10. #define KPakFile_H
  11. //---------------------------------------------------------------------------
  12. #include "KFile.h"
  13. #ifndef _SERVER
  14. #include "XPackFile.h"
  15. #endif
  16. //---------------------------------------------------------------------------
  17. ENGINE_API void g_SetPakFileMode(int nFileMode);
  18. //---------------------------------------------------------------------------
  19. class ENGINE_API KPakFile
  20. {
  21. public:
  22. KPakFile();
  23. ~KPakFile();
  24. BOOL Open(const char* pszFileName);
  25. void Close();
  26. bool IsFileInPak();
  27. DWORD Read(void* pBuffer, unsigned int uSize);
  28. DWORD Seek(int nOffset, unsigned int uMethod);
  29. DWORD Tell();
  30. DWORD Size();
  31. BOOL Save(const char* pszFileName);
  32. private:
  33. KFile m_File; // 真实文件(不在包中)
  34. #ifndef _SERVER
  35. XPackElemFileRef m_PackRef;
  36. #endif
  37. };
  38. //---------------------------------------------------------------------------
  39. #ifndef _SERVER
  40. struct KSGImageContent
  41. {
  42. int nWidth;
  43. int nHeight;
  44. unsigned short Data[1];
  45. };
  46. #define KSG_IMAGE_CONTENT_SIZE(w, h)    ((unsigned)((&((KSGImageContent *)0)->Data[0])) + w * h * 2)
  47. ENGINE_API SPRHEAD* SprGetHeader(const char* pszFileName, SPROFFS*& pOffsetTable);
  48. ENGINE_API void SprReleaseHeader(SPRHEAD* pSprHeader);
  49. ENGINE_API SPRFRAME* SprGetFrame(SPRHEAD* pSprHeader, int nFrame);
  50. ENGINE_API void SprReleaseFrame(SPRFRAME* pFrame);
  51. ENGINE_API KSGImageContent *get_jpg_image(const char cszName[], unsigned uRGBMask16 = ((unsigned)-1));
  52. ENGINE_API void release_image(KSGImageContent *pImage);
  53. #endif
  54. #endif