CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

MIXFILE.H (3966B)


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