2009-11-10 16:48:42 +01:00
|
|
|
#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,
|
2020-07-15 00:40:26 +02:00
|
|
|
VMSF_DELTA
|
2009-11-10 16:48:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct VM_PreparedProgram
|
|
|
|
{
|
|
|
|
VM_PreparedProgram()
|
|
|
|
{
|
|
|
|
FilteredDataSize=0;
|
2020-07-15 00:40:26 +02:00
|
|
|
Type=VMSF_NONE;
|
2009-11-10 16:48:42 +01:00
|
|
|
}
|
2020-07-15 00:40:26 +02:00
|
|
|
VM_StandardFilters Type;
|
2009-11-10 16:48:42 +01:00
|
|
|
uint InitR[7];
|
|
|
|
byte *FilteredData;
|
|
|
|
uint FilteredDataSize;
|
|
|
|
};
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
class RarVM
|
2009-11-10 16:48:42 +01:00
|
|
|
{
|
|
|
|
private:
|
2020-07-15 00:40:26 +02:00
|
|
|
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);
|
2009-11-10 16:48:42 +01:00
|
|
|
|
|
|
|
byte *Mem;
|
|
|
|
uint R[8];
|
|
|
|
public:
|
|
|
|
RarVM();
|
|
|
|
~RarVM();
|
|
|
|
void Init();
|
|
|
|
void Prepare(byte *Code,uint CodeSize,VM_PreparedProgram *Prg);
|
|
|
|
void Execute(VM_PreparedProgram *Prg);
|
2020-07-15 00:40:26 +02:00
|
|
|
void SetMemory(size_t Pos,byte *Data,size_t DataSize);
|
2009-11-10 16:48:42 +01:00
|
|
|
static uint ReadData(BitInput &Inp);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|