-
Notifications
You must be signed in to change notification settings - Fork 23
/
rarvm.hpp
44 lines (38 loc) · 985 Bytes
/
rarvm.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
#ifndef _RAR_VM_
#define _RAR_VM_
#define VM_MEMSIZE 0x40000
#define VM_MEMMASK (VM_MEMSIZE-1)
enum VM_StandardFilters {
VMSF_NONE, VMSF_E8, VMSF_E8E9, VMSF_ITANIUM, VMSF_RGB, VMSF_AUDIO,
VMSF_DELTA
};
struct VM_PreparedProgram
{
VM_PreparedProgram()
{
FilteredDataSize=0;
Type=VMSF_NONE;
}
VM_StandardFilters Type;
uint InitR[7];
byte *FilteredData;
uint FilteredDataSize;
};
class RarVM
{
private:
bool ExecuteStandardFilter(VM_StandardFilters FilterType);
uint FilterItanium_GetBits(byte *Data,uint BitPos,uint BitCount);
void FilterItanium_SetBits(byte *Data,uint BitField,uint BitPos,uint BitCount);
byte *Mem;
uint R[8];
public:
RarVM();
~RarVM();
void Init();
void Prepare(byte *Code,uint CodeSize,VM_PreparedProgram *Prg);
void Execute(VM_PreparedProgram *Prg);
void SetMemory(size_t Pos,byte *Data,size_t DataSize);
static uint ReadData(BitInput &Inp);
};
#endif