Diffstat (limited to 'noncore/apps/opie-reader/Aportis.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Aportis.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/Aportis.h b/noncore/apps/opie-reader/Aportis.h index 08016f4..1ca5e73 100644 --- a/noncore/apps/opie-reader/Aportis.h +++ b/noncore/apps/opie-reader/Aportis.h | |||
@@ -19,68 +19,82 @@ struct tDocHeader { | |||
19 | char sName[32]; | 19 | char sName[32]; |
20 | DWORD dwUnknown1; | 20 | DWORD dwUnknown1; |
21 | DWORD dwTime1; | 21 | DWORD dwTime1; |
22 | DWORD dwTime2; | 22 | DWORD dwTime2; |
23 | DWORD dwTime3; | 23 | DWORD dwTime3; |
24 | DWORD dwLastSync; | 24 | DWORD dwLastSync; |
25 | DWORD ofsSort; | 25 | DWORD ofsSort; |
26 | DWORD ofsCatagories; | 26 | DWORD ofsCatagories; |
27 | DWORD dwCreator; | 27 | DWORD dwCreator; |
28 | DWORD dwType; | 28 | DWORD dwType; |
29 | DWORD dwUnknown2; | 29 | DWORD dwUnknown2; |
30 | DWORD dwUnknown3; | 30 | DWORD dwUnknown3; |
31 | WORD wNumRecs; | 31 | WORD wNumRecs; |
32 | }; | 32 | }; |
33 | */ | 33 | */ |
34 | struct tDocRecord0 { | 34 | struct tDocRecord0 { |
35 | WORD wVersion;// 1=plain text, 2=compressed | 35 | WORD wVersion;// 1=plain text, 2=compressed |
36 | WORD wSpare; | 36 | WORD wSpare; |
37 | DWORD dwStoryLen; // in chars, when decompressed | 37 | DWORD dwStoryLen; // in chars, when decompressed |
38 | WORD wNumRecs; // text records only; equals tDocHeader.wNumRecs-1 | 38 | WORD wNumRecs; // text records only; equals tDocHeader.wNumRecs-1 |
39 | WORD wRecSize; // usually 0x1000 | 39 | WORD wRecSize; // usually 0x1000 |
40 | DWORD dwSpare2; | 40 | DWORD dwSpare2; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct PeanutHeader | ||
44 | { | ||
45 | UInt16 Version; | ||
46 | UInt8 Junk1[6]; | ||
47 | UInt16 Records; | ||
48 | UInt8 Junk2[106]; | ||
49 | }; | ||
50 | |||
43 | ////////////// utilities ////////////////////////////////////// | 51 | ////////////// utilities ////////////////////////////////////// |
44 | 52 | ||
45 | inline WORD SwapWord(WORD r) | 53 | inline WORD SwapWord(WORD r) |
46 | { | 54 | { |
47 | return (r>>8) + (r<<8); | 55 | return (r>>8) + (r<<8); |
48 | } | 56 | } |
49 | 57 | ||
50 | inline DWORD SwapLong(DWORD r) | 58 | inline DWORD SwapLong(DWORD r) |
51 | { | 59 | { |
52 | return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000); | 60 | return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000); |
53 | } | 61 | } |
54 | 62 | ||
55 | class Aportis : public CExpander, Cpdb { | 63 | class Aportis : public CExpander, Cpdb { |
64 | bool peanutfile; | ||
65 | void dePeanut(int&); | ||
56 | DWORD dwLen; | 66 | DWORD dwLen; |
57 | WORD nRecs2; | 67 | WORD nRecs2; |
58 | DWORD dwTLen; | 68 | DWORD dwTLen; |
59 | WORD nRecs; | 69 | WORD nRecs; |
60 | WORD BlockSize; | 70 | WORD BlockSize; |
61 | DWORD dwRecLen; | 71 | DWORD dwRecLen; |
62 | int currentrec, currentpos; | 72 | int currentrec, currentpos; |
63 | unsigned int cbptr; | 73 | unsigned int cbptr; |
64 | unsigned int outptr; | 74 | unsigned int outptr; |
65 | unsigned char circbuf[2048]; | 75 | unsigned char circbuf[2048]; |
66 | char bCompressed; | 76 | char bCompressed; |
67 | public: | 77 | public: |
68 | virtual void sizes(unsigned long& _file, unsigned long& _text) | 78 | virtual void sizes(unsigned long& _file, unsigned long& _text) |
69 | { | 79 | { |
70 | _file = dwLen; | 80 | _file = dwLen; |
71 | _text = dwTLen; | 81 | _text = dwTLen; |
72 | } | 82 | } |
73 | virtual bool hasrandomaccess() { return true; } | 83 | virtual bool hasrandomaccess() { return true; } |
74 | virtual ~Aportis() {} | 84 | virtual ~Aportis() {} |
75 | Aportis(); | 85 | Aportis(); |
76 | virtual int openfile(const char *src); | 86 | virtual int openfile(const char *src); |
77 | virtual int getch(); | 87 | virtual int getch(); |
78 | virtual unsigned int locate(); | 88 | virtual unsigned int locate(); |
79 | virtual void locate(unsigned int n); | 89 | virtual void locate(unsigned int n); |
80 | virtual CList<Bkmk>* getbkmklist(); | 90 | virtual CList<Bkmk>* getbkmklist(); |
91 | virtual MarkupType PreferredMarkup() | ||
92 | { | ||
93 | return (peanutfile) ? cPML : cTEXT; | ||
94 | } | ||
81 | private: | 95 | private: |
82 | bool refreshbuffer(); | 96 | bool refreshbuffer(); |
83 | unsigned int GetBS(unsigned int bn); | 97 | unsigned int GetBS(unsigned int bn); |
84 | }; | 98 | }; |
85 | 99 | ||
86 | #endif | 100 | #endif |