Merge pull request #4324 from FernetMenta/wasapi
[vuplus_xbmc] / lib / UnrarXLib / rdwrfn.hpp
1 #ifndef _RAR_DATAIO_
2 #define _RAR_DATAIO_
3
4 class CmdAdd;
5 class Unpack;
6
7 #include "system.h"
8 #include "threads/Event.h"
9
10 class CGUIDialogProgress;
11
12 class ComprDataIO
13 {
14   private:
15     void ShowUnpRead(Int64 ArcPos,Int64 ArcSize);
16     void ShowUnpWrite();
17
18
19     bool UnpackFromMemory;
20     uint UnpackFromMemorySize;
21     byte *UnpackFromMemoryAddr;
22
23     bool UnpackToMemory;
24     //uint UnpackToMemorySize;
25     byte *UnpackToMemoryAddr;
26
27     uint UnpWrSize;
28     byte *UnpWrAddr;
29
30     Int64 UnpPackedSize;
31
32     bool ShowProgress;
33     bool TestMode;
34     bool SkipUnpCRC;
35
36     File *SrcFile;
37     File *DestFile;
38
39     CmdAdd *Command;
40
41     FileHeader *SubHead;
42     Int64 *SubHeadPos;
43
44 #ifndef NOCRYPT
45     CryptData Crypt;
46     CryptData Decrypt;
47 #endif
48
49
50     int LastPercent;
51
52     char CurrentCommand;
53
54   public:
55     ComprDataIO();
56     void Init();
57     int UnpRead(byte *Addr,uint Count);
58     void UnpWrite(byte *Addr,uint Count);
59     void EnableShowProgress(bool Show) {ShowProgress=Show;}
60     void GetUnpackedData(byte **Data,uint *Size);
61     void SetPackedSizeToRead(Int64 Size) {UnpPackedSize=Size;}
62     void SetTestMode(bool Mode) {TestMode=Mode;}
63     void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
64     void SetFiles(File *SrcFile,File *DestFile);
65     void SetCommand(CmdAdd *Cmd) {Command=Cmd;}
66     void SetSubHeader(FileHeader *hd,Int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
67     void SetEncryption(int Method,char *Password,byte *Salt,bool Encrypt);
68     void SetAV15Encryption();
69     void SetCmt13Encryption();
70     void SetUnpackToMemory(byte *Addr,uint Size);
71     void SetCurrentCommand(char Cmd) {CurrentCommand=Cmd;}
72
73     bool PackVolume;
74     bool UnpVolume;
75     bool NextVolumeMissing;
76     Int64 TotalPackRead;
77     Int64 UnpArcSize;
78     Int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
79     Int64 ProcessedArcSize,TotalArcSize;
80
81     uint PackFileCRC,UnpFileCRC,PackedCRC;
82
83     int Encryption;
84     int Decryption;
85     int UnpackToMemorySize;
86     
87     // added stuff
88     CEvent* hBufferFilled;
89     CEvent* hBufferEmpty;
90     CEvent* hSeek;
91     CEvent* hSeekDone;
92     CEvent* hQuit;
93     CGUIDialogProgress* m_pDlgProgress;
94     bool bQuit;
95     Int64 m_iSeekTo;
96     Int64 m_iStartOfBuffer;
97     Int64 CurUnpStart;
98 };
99
100 #endif