MIXFILE.H 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. ** Command & Conquer(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: F:\projects\c&c\vcs\code\mixfile.h_v 2.18 16 Oct 1995 16:47:22 JOE_BOSTIC $ */
  19. /***********************************************************************************************
  20. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : MIXFILE.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : October 18, 1994 *
  30. * *
  31. * Last Update : October 18, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef MIXFILE_H
  37. #define MIXFILE_H
  38. #include <wwlib32.h>
  39. #include "link.h"
  40. class MixFileClass : public LinkClass
  41. {
  42. public:
  43. char const *Filename; // Filename of mixfile.
  44. MixFileClass(char const *filename);
  45. ~MixFileClass(void);
  46. static bool Free(char const *filename);
  47. static void Free_All(void);
  48. void Free(void);
  49. bool Cache(void);
  50. static bool Cache(char const *filename);
  51. static bool Offset(char const *filename, void ** realptr = 0, MixFileClass ** mixfile = 0, long * offset = 0, long * size = 0);
  52. static void const * Retrieve(char const *filename);
  53. struct SubBlock {
  54. long CRC; // CRC code for embedded file.
  55. long Offset; // Offset from start of data section.
  56. long Size; // Size of data subfile.
  57. int operator < (SubBlock & two) const {return (CRC < two.CRC);};
  58. int operator > (SubBlock & two) const {return (CRC > two.CRC);};
  59. int operator == (SubBlock & two) const {return (CRC == two.CRC);};
  60. };
  61. private:
  62. static MixFileClass * Finder(char const *filename);
  63. long Offset(long crc, long *size = 0);
  64. typedef struct {
  65. short count;
  66. long size;
  67. } FileHeader;
  68. int Count; // Number of sub-blocks.
  69. long DataSize; // Size of raw data.
  70. SubBlock * Buffer; // Array of sub blocks (could be in EMS).
  71. void *Data; // Pointer to raw data.
  72. static MixFileClass * First;
  73. };
  74. #endif