-
Notifications
You must be signed in to change notification settings - Fork 0
/
SWFReader.h
119 lines (79 loc) · 2.36 KB
/
SWFReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* File: SWFReader.h
* Author: brucewang
*
* Created on October 24, 2009, 8:44 PM
*/
#ifndef _SWFREADER_H
#define _SWFREADER_H
#include "types.h"
///-----------------------------------------------------------
///
///
///-----------------------------------------------------------
class SWFReader {
private:
byte bitPosition; // Current bit position within byte (only used for reading bit fields)
byte currentByte; // Value of the current byte (only used for reading bit fields)
long lDataOffset;
int iVariables;
public:
UInt32 *bitValues; // For pre-computed bit values
Single *powers; // For pre-computed fixed-point powers
long lFileSizePos;
byte *SwfData;
int getNumberOfVariables();
stSwfVariable VariableList[125];
void AddVariableInfo(
ulong lPosition,
ulong length,
int iOriginalOffset,
ushort usEditId,
int iRectInfoLength,
byte *bRectData,
int iOptionFlagSize,
byte *bOptionFlagData,
ushort usFlag,
char *szVariableName,
char *szInitialValue);
/*
* 2007-08-07 brucewang
*/
long GetPosition();
int GetBitPosition(){ return bitPosition; }
const byte * GetBuffer(){ return SwfData; }
~SWFReader();
SWFReader(byte *buffer);
byte ReadByte();
bool ReadBit();
// Read an unsigned 8-bit integer
byte ReadUI8();
// You need to 'delete' the returned memory chunk
// after use.
//
// Read an array of unsigned 8-bit integers
byte* ReadUI8(int n);
// Read a signed byte
sbyte ReadSI8();
// Read an unsigned 16-bit integer
UInt16 ReadUI16();
// Read a signed 16-bit integer
Int16 ReadSI16();
// Read an unsigned 32-bit integer
UInt32 ReadUI32();
// Read a signed 32-bit integer
Int32 ReadSI32();
// Read a 32-bit 16.16 fixed-point number
Single ReadFIXED();
// Read a szstring
// TODO: Is StringBuilder worth it for these small strings?
szstring ReadSTRING();
// Read an unsigned bit value
UInt32 ReadUB(int nBits);
// Read a signed bit value
Int32 ReadSB(int nBits);
// Read a signed fixed-point bit value
// TODO: Math.Pow probably isn't the fastest method of accomplishing this
//Single ReadFB(int nBits);
};
#endif /* _SWFREADER_H */