Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
MixFileFactoryClass.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE__MIXFILEFACTORYCLASS_H
13#define TT_INCLUDE__MIXFILEFACTORYCLASS_H
14#include "engine_common.h"
15#include "engine_vector.h"
16#include "engine_io.h"
17#include "engine_string.h"
18struct mix_header
19{
20 int id;
21 int index_offset;
22 int tailer_offset;
23 int zero;
24};
25class SimpleFileFactoryClass;
26class MixFileFactoryClass : public FileFactoryClass
27{
28public:
29 struct FileInfoStruct
30 {
31 unsigned int id;
32 unsigned int offset;
33 unsigned int size;
34 bool operator== (const FileInfoStruct &src)
35 {
36 return false;
37 }
38 bool operator!= (const FileInfoStruct &src)
39 {
40 return true;
41 }
42 bool operator < (const FileInfoStruct& b) const
43 {
44 return id < b.id;
45 }
46 };
47 struct AddInfoStruct
48 {
49 StringClass Filename1;
50 StringClass Filename2;
51 bool operator== (const AddInfoStruct &src)
52 {
53 return false;
54 }
55 bool operator!= (const AddInfoStruct &src)
56 {
57 return true;
58 }
59 };
60protected:
61 FileFactoryClass *Factory; //4
62 DynamicVectorClass<FileInfoStruct> FileInformation; //8
63 StringClass MixFilename; //32
64 unsigned int UnkOffset; //36
65 unsigned int FileCount; //40
66 unsigned int MixFilenameOffset; //44
67 bool IsValid; //48
68 DynamicVectorClass<StringClass> Filenames; //52
69 DynamicVectorClass<AddInfoStruct> AddedFiles; //76
70 bool FileAdded; //100
71public:
72 MixFileFactoryClass(const char*, FileFactoryClass *);
73 virtual ~MixFileFactoryClass ();
74 virtual FileClass* Get_File (const char* fileName);
75 virtual void Return_File (FileClass* file);
76 void Build_Filename_List(DynamicVectorClass<StringClass>&list);
77 bool Is_Valid() {return IsValid;}
78};
79
80class MixFileCreator {
81public:
82 struct FileInfoStruct {
83 unsigned int CRC;
84 unsigned int pos;
85 unsigned int size;
86 StringClass name;
87 bool operator== (const FileInfoStruct &src)
88 {
89 return false;
90 }
91 bool operator!= (const FileInfoStruct &src)
92 {
93 return true;
94 }
95 };
96 DynamicVectorClass<FileInfoStruct> Files;
97 FileClass *File;
98 MixFileCreator(const char *name);
99 static int File_Info_Compare(const void *v1, const void *v2);
100 ~MixFileCreator();
101 void Add_File(char const *name, char const *name2);
102 void Add_File(char const *name, FileClass *file);
103};
104
105class MixClass {
106 struct PathStr {
107 StringClass path;
108 StringClass name;
109 };
110 struct FileInfo {
111 int next;
112 StringClass name;
113 PathStr *path;
114 };
115 int *order;
116 FileInfo *files;
117 int count;
118 int count2;
119 static int File_Info_Compare(const void *v1, const void *v2);
120 void Create_Mix(const char *name);
121};
122void BuildMixFile(const char *path,DynamicVectorClass<StringClass> filenames,DynamicVectorClass<FileFactoryClass *> filefactories);
123#endif