forked from revivalizer/rekkrunchy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dis.hpp
59 lines (43 loc) · 1.21 KB
/
dis.hpp
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
// Written by Fabian "ryg" Giesen.
// I hereby place this code in the public domain.
#ifndef __DIS_HPP__
#define __DIS_HPP__
#include "_types.hpp"
namespace rekkrunchy
{
/****************************************************************************/
#define NBUFFERS 20
struct DataBuffer
{
sInt Size, Max;
sU8 *Data;
DataBuffer();
~DataBuffer();
void Clear();
void Append( sU8 *data, sInt size );
void PutValue( sU32 value, sInt size );
};
class DisFilter
{
DataBuffer Buffer[ NBUFFERS ];
DataBuffer SourceBuffer[ NBUFFERS ];
sInt FuncTablePos;
sU32 FuncTable[ 255 ];
sBool NextFunc;
sU32 LastJump;
sU32 JumpTable;
class DebugInfo *Info;
sU32 CodeSize;
sInt CountInstr( sU8 *instr );
sInt ProcessInstr( sU8 *instr, const sU8* codeStart, sU32 memory, sU32 VA );
public:
DataBuffer Output;
DataBuffer SourceDataOutput;
sU8 Table[ 256 ];
void Filter( sU8 *code, sInt size, sU32 VA, DebugInfo *info = 0 );
};
class ReorderBuffer;
void DisUnFilter( sU8 *packed, sU8 *dest, sU32 oldAddr, sU32 newAddr, ReorderBuffer &reord );
/****************************************************************************/
}
#endif