Revision 2, 0.9 kB
(checked in by yumileroy, 17 years ago)
|
[svn] * Proper SVN structure
Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00
|
Line | |
---|
1 | #define _CRT_SECURE_NO_DEPRECATE |
---|
2 | |
---|
3 | #ifndef MPQ_H |
---|
4 | #define MPQ_H |
---|
5 | |
---|
6 | #define __STORMLIB_SELF__ |
---|
7 | |
---|
8 | #include <string.h> |
---|
9 | #include <ctype.h> |
---|
10 | #include <vector> |
---|
11 | #include <iostream> |
---|
12 | #include "Stormlib.h" |
---|
13 | |
---|
14 | using namespace std; |
---|
15 | |
---|
16 | typedef unsigned int uint32; |
---|
17 | |
---|
18 | |
---|
19 | class MPQArchive |
---|
20 | { |
---|
21 | |
---|
22 | public: |
---|
23 | HANDLE hMPQ; |
---|
24 | MPQArchive(const char* filename); |
---|
25 | void close(); |
---|
26 | }; |
---|
27 | |
---|
28 | class MPQFile |
---|
29 | { |
---|
30 | HANDLE hFile; |
---|
31 | HANDLE hMPQ; |
---|
32 | bool eof; |
---|
33 | char *buffer; |
---|
34 | size_t pointer, |
---|
35 | size; |
---|
36 | |
---|
37 | // disable copying |
---|
38 | //MPQFile(const MPQFile &f) {} |
---|
39 | //void operator=(const MPQFile &f) {} |
---|
40 | |
---|
41 | public: |
---|
42 | MPQFile(const char* filename); |
---|
43 | ~MPQFile(); |
---|
44 | size_t read(void* dest, size_t bytes); |
---|
45 | size_t getSize(); |
---|
46 | size_t getPos(); |
---|
47 | char* getBuffer(); |
---|
48 | char* getPointer(); |
---|
49 | bool isEof(); |
---|
50 | void seek(int offset); |
---|
51 | void seekRelative(int offset); |
---|
52 | void close(); |
---|
53 | }; |
---|
54 | |
---|
55 | inline void flipcc(char *fcc) |
---|
56 | { |
---|
57 | char t; |
---|
58 | t=fcc[0]; |
---|
59 | fcc[0]=fcc[3]; |
---|
60 | fcc[3]=t; |
---|
61 | t=fcc[1]; |
---|
62 | fcc[1]=fcc[2]; |
---|
63 | fcc[2]=t; |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | #endif |
---|
69 | |
---|