Debian Codegraph @

format_docs/pdb/mbp.txt

raw
1 // BEGINNING OF FILE
2 // NOTES:
3 // 1* Numeric data stored as big endian, 32 bits.
4 // 2* Data padded to 16 bits limits. (Sometimes to 32 bits limits?)
5 // 3* Text stored seems to be an 8 bit encoding padded to 16 bits
6 // (may be "ISO-8859-1"?, or may be just a local machine character set?)
7 // 4* I initially used the term "MARK" where I should have used "HIGHLIGHT",
8 // bear that in mind (it was a bad name election when I started reversing)
9
10 <0x 31 bytes = book_title_PAR + 0x00 PAD if (book_title_PAR < 31) >
11 <0x 00>
12 <0x 00 00 00 00>
13 ...4
14 ...4
15 <0x 00 00 00 00>
16 <0x 00 00 00 00>
17 <0x 00 00 00 00>
18 <0x 00 00 00 00>
19 BPAR
20 MOBI
21 <0x 4 bytes = Next free pointer identifier>
22 // Note: pointer identifiers aren't always consecutive,
23 // so this number is usually bigger than de # of index entries
24 <0x 00 00>
25 <0x 4 bytes = Number of index entries>
26 <0x 4 bytes = Position of BPAR>
27 <0x 00 00 00 00> // BPAR pointer identifier = 0x0
28
29
30 // INDEXES:
31 // Order of Indexes: from the beginning of this MBP file,
32 // forward to the end of the file.
33 // Nevertheless, see these comments for order relative to:
34 // "BEGINNING OF USER DATA": order of Data marks.
35 // "FINAL GROUP OF MARKS": order of final marks.
36 [for each {NOTE,MARK,CORRECTION,DRAWING,BOOKMARK,
37 AUTHOR,TITLE,CATEGORY,GENRE,ABSTRACT,COVER,PUBLISHER,
38 ...}
39 || "last DATA"]
40 // Note: Pointer identifiers to DATA's assigned so the number
41 // shrinks as the table grows down.
42 [if NOTE || CORRECTION]
43 <0x 4 bytes = Position of DATA....EBVS>
44 <0x 4 bytes = Pointer identifier, used by BKMK blocks>
45 [fi NOTE || CORRECTION]
46 <0x 4 bytes = Position of DATA>
47 <0x 4 bytes = Pointer identifier, used by BKMK blocks>
48 [if NOTE || CORRECTION]
49 <0x 4 bytes = Position of DATA>
50 <0x 4 bytes = Pointer identifier, used by BKMK blocks>
51 [fi NOTE || CORRECTION]
52 [if MARK || DRAWING || BOOKMARK]
53 <0x 4 bytes = Position of DATA....EBVS>
54 <0x 4 bytes = Pointer identifier, used by BKMK blocks>
55 [fi MARK || DRAWING || BOOKMARK]
56 [if AUTHOR || TITLE || CATEGORY || GENRE || ABSTRACT || COVER || PUBLISHER]
57 <0x 4 bytes = Position of [AUTH || TITL || CATE || GENR || ABST || COVE || PUBL] >
58 <0x 4 bytes = Pointer identifier>
59 [fi AUTHOR || TITLE || CATEGORY || GENRE || ABSTRACT || COVER || PUBLISHER]
60 [if last DATA] // there's always a last piece of DATA (not user data?)
61 <0x 4 bytes = Position of last DATA>
62 <0x 4 bytes = Pointer identifier> // usually <0x 00 00 00 01>
63 [fi last DATA]
64 [next {NOTE,MARK,CORRECTION,DRAWING,BOOKMARK,
65 AUTHOR,TITLE,CATEGORY,GENRE,ABSTRACT,COVER,PUBLISHER,
66 ...}
67 || "last DATA"]
68
69
70 [for each {NOTE,MARK,CORRECTION,DRAWING}]
71 <0x 4 bytes = Position of BKMK>
72 <0x 4 bytes = Pointer identifier>
73 // Note: pointer identifiers for BKMK's are usually the minor
74 // of all the identifiers associated to an annotation. All
75 // other DATA references in INDEXES table associated to this
76 // BKMK, have bigger pointer identifiers.
77 // Note: Pointer identifiers to BKMK's assigned so the number
78 // grows as the table grows down.
79 [next {NOTE,MARK,CORRECTION,DRAWING}]
80
81
82 <0x 2 bytes random PAD>
83 BPAR
84 <0x 4 bytes = size of BPAR block>
85 <0x FF FF FF FF>
86 ...4 <-- 'position of last read' related
87 ...4 <-- 'position of last read' related
88 ...4
89 <0x FF FF FF FF>
90 ...4
91 ...4
92 ...4 <-- 'position of last read' related
93 ...(rest of size of BPAR block, if bigger than 0x20)
94 [if (size of BPAR block) mod 32 != 0]
95 <0x FF FF FF FF>
96 [fi]
97
98 // BEGINNING OF USER DATA:
99 // Order of {NOTE,MARK,CORRECTION,DRAWING} :
100 // starts with user data at the end of the file,
101 // going backwards to the beginning of the file:
102 //--------------------------------------------------------------------
103 [for each {NOTE,MARK,CORRECTION,DRAWING}]
104 //-------------------------------
105 [if NOTE]
106 DATA
107 <0x 4 bytes = size of DATA block>
108 [if EBAR] // this block can appear, or not... ???
109 EBAR
110 ...various {4 x byte} ???
111 [fi EBAR]
112 EBVS
113 <0x 00 00 00 03> ???
114 <0x 4 bytes = IDENTIFIER> ???
115 [<0x 00 00 00 01>, or nothing at all] ???
116 <0x 00 00 00 08>
117 <0x FF FF FF FF>
118 <0x 00 00 00 00>
119 <0x 00 00 00 10>
120 ...(rest of size of DATA block)
121 <0x FD EA = PAD? (ýê)>
122 DATA
123 <0x 4 bytes = size of <marked text (see 3rd note)> >
124 <marked text (see 3rd note)>
125 [if (size of <marked text (see 3rd note)>) mod 4 !=0]
126 <0x random PAD until (size of <marked text (see 3rd note)>) mod 4 ==0>
127 [fi]
128 DATA
129 <0x 4 bytes = size of <note text (see 3rd note)> >
130 <note text (see 3rd note)>
131 [if (size of <note text (see 3rd note)>) mod 4 !=0]
132 <0x random PAD until (size of <note text (see 3rd note)>) mod 4 ==0>
133 [fi]
134 [fi NOTE]
135 //-------------------------------
136 [if MARK || BOOKMARK]
137 DATA
138 <0x 4 bytes = size of <marked text (see 3rd note)> >
139 <marked text (see 3rd note)>
140 [if (size of <marked text (see 3rd note)>) mod 4 !=0]
141 <0x random PAD until (size of <marked text (see 3rd note)>) mod 4 ==0>
142 [fi]
143 DATA
144 <0x 4 bytes = size of DATA block>
145 [if EBAR] // this block can appear, or not... ???
146 EBAR
147 ...various {4 x byte} ???
148 [fi EBAR]
149 EBVS
150 <0x 00 00 00 03> ???
151 <0x 4 bytes = IDENTIFIER> ???
152 [<0x 00 00 00 01>, or nothing at all] ???
153 <0x 00 00 00 08>
154 <0x FF FF FF FF>
155 <0x 00 00 00 00>
156 <0x 00 00 00 10>
157 ...(rest of size of DATA block)
158 <0x FD EA = PAD? (ýê)>
159 [fi MARK || BOOKMARK]
160 //-------------------------------
161 [if CORRECTION]
162 DATA
163 <0x 4 bytes = size of DATA block>
164 [if EBAR] // this block can appear, or not... ???
165 EBAR
166 ...various {4 x byte} ???
167 [fi EBAR]
168 EBVS
169 <0x 00 00 00 03> ???
170 <0x 4 bytes = IDENTIFIER> ???
171 [<0x 00 00 00 01>, or nothing at all] ???
172 <0x 00 00 00 08>
173 <0x FF FF FF FF>
174 <0x 00 00 00 00>
175 <0x 00 00 00 10>
176 ...(rest of size of DATA block)
177 <0x FD EA = PAD? (ýê)>
178 DATA
179 <0x 4 bytes = size of <marked text (see 3rd note)> >
180 <marked text (see 3rd note)>
181 [if (size of <marked text (see 3rd note)>) mod 4 !=0]
182 <0x random PAD until (size of <marked text (see 3rd note)>) mod 4 ==0>
183 [fi]
184 DATA
185 <0x 4 bytes = size of <note text (see 3rd note)> >
186 <note text (see 3rd note)>
187 [if (size of <note text (see 3rd note)>) mod 4 !=0]
188 <0x random PAD until (size of <note text (see 3rd note)>) mod 4 ==0>
189 [fi]
190 [fi CORRECTION]
191 //-------------------------------
192 [if DRAWING]
193 DATA
194 <0x 4 bytes = size of raw data>
195 ADQM
196 // NOTE: background color is stored in corresponding BKMK.
197 [begin DRAWING format]
198 ...4 = <0x 00 00 00 01> ???
199 <0x 4 bytes = X POSITION OF UPPER LEFT CORNER??? >
200 <0x 4 bytes = Y POSITION OF UPPER LEFT CORNER??? >
201 <0x 4 bytes = X SIZE in pixels >
202 <0x 4 bytes = Y SIZE in pixels >
203 ...4 = <0x 00 00 00 00> ???
204 <0x 4 bytes = number of STROKES>
205 [if "number of STROKES" == 0]
206 <0x 00 00 00 00>
207 [end DRAWING format]
208 [fi]
209 [for each STROKE]
210 <0x 00 00 00 01> ???
211 <0x 4 bytes> =
212 Stroke's beginning position in list of coordinates.
213 <0x 4 bytes> =
214 Stroke's ending position in list of coordinates.
215 <0x 00 RR GG BB> = RRGGBB color of stroke.
216 [next STROKE]
217 <0x 4 bytes> = number of coordinate pairs in array of coordinates.
218 // NOTE: each stroke is formed out of at least three
219 // coordinate pairs: begin, {next point}(1-n), end point.
220 [for each COORDINATE]
221 <0x 4 bytes> = X coordinate
222 <0x 4 bytes> = Y coordinate
223 [next COORDINATE]
224 [end DRAWING format]
225 [if (size of <marked text (see 3rd note)>) mod 4 !=0]
226 <0x random PAD until (size of <marked text (see 3rd note)>) mod 4 ==0>
227 [fi]
228 DATA
229 <0x 4 bytes = size of <marked text (see 3rd note)> >
230 <marked text (see 3rd note)>
231 [if (size of <marked text (see 3rd note)>) mod 4 !=0]
232 <0x random PAD until (size of <marked text (see 3rd note)>) mod 4 ==0>
233 [fi]
234 DATA
235 <0x 4 bytes = size of DATA block>
236 [if EBAR] // this block can appear, or not... ???
237 EBAR
238 ...various {4 x byte} ???
239 [fi EBAR]
240 EBVS
241 <0x 00 00 00 03>
242 <0x 4 bytes = IDENTIFIER>
243 [<0x 00 00 00 01>, or nothing at all] ???
244 <0x 00 00 00 08>
245 <0x FF FF FF FF>
246 <0x 00 00 00 00>
247 <0x 00 00 00 10>
248 ...(size of DATA block - 30)
249 <0x FD EA = PAD? (ýê)>
250 [fi DRAWING]
251 //-------------------------------
252 [next {NOTE,MARK,CORRECTION,DRAWING}]
253
254 // AUTHOR (if any)
255 //--------------------------------------------------------------------
256 [if AUTHOR]
257 AUTH
258 <0x 4 bytes = size of AUTHOR block>
259 <text (see 3rd note)>
260 [fi AUTHOR]
261 //--------------------------------------------------------------------
262 // TITLE (if any)
263 //--------------------------------------------------------------------
264 [if TITLE]
265 TITL
266 <0x 4 bytes = size of TITLE block>
267 <text (see 3rd note)>
268 [fi TITLE]
269 //--------------------------------------------------------------------
270 // GENRE (if any)
271 //--------------------------------------------------------------------
272 [if GENRE]
273 GENR
274 <0x 4 bytes = size of GENRE block>
275 <text (see 3rd note)>
276 [fi GENRE]
277 //--------------------------------------------------------------------
278 // ABSTRACT (if any)
279 //--------------------------------------------------------------------
280 [if ABSTRACT]
281 ABST
282 <0x 4 bytes = size of ABSTRACT block>
283 <text (see 3rd note)>
284 [fi ABSTRACT]
285 //--------------------------------------------------------------------
286
287 // FINAL DATA
288 // Note: 'FINAL DATA' can occur anytime between these marks:
289 // AUTHOR,TITLE,CATEGORY,GENRE,ABSTRACT,COVER,PUBLISHER,...
290 //--------------------------------------------------------------------
291 DATA
292 <0x 4 bytes = size of EBVS block>
293 [if EBAR] // this block can appear, or not... ???
294 EBAR
295 ...various {4 x byte} ???
296 [fi EBAR]
297 EBVS
298 <0x 00 00 00 03> || <0x 00 00 00 04>
299 <0x 4 bytes || 8 bytes = IDENTIFIER>
300 <0x 00 00 00 08>
301 <0x FF FF FF FF>
302 <0x 00 00 00 00>
303 <0x 00 00 00 10>
304 ...(size of EBVS block - 30) :
305 ...4 <-- 'position of last read' related
306 ...various {4 x byte} ???
307 ...4 <-- 'position of last read' related
308 ...4
309 ...4
310 ...4
311 <0x FD EA = PAD? (ýê)>
312 //--------------------------------------------------------------------
313
314 // CATEGORY (if any)
315 //--------------------------------------------------------------------
316 [if CATEGORY]
317 CATE
318 <0x 4 bytes = size of CATEGORY block>
319 <text (see 3rd note)>
320 [fi CATEGORY]
321 //--------------------------------------------------------------------
322 // COVER (if any)
323 //--------------------------------------------------------------------
324 [if COVER]
325 COVE
326 <0x 4 bytes = size of COVER block>
327 <text (see 3rd note)>
328 [fi COVER]
329 //--------------------------------------------------------------------
330 // PUBLISHER (if any)
331 //--------------------------------------------------------------------
332 [if PUBLISHER]
333 PUBL
334 <0x 4 bytes = size of PUBLISHER block>
335 <text (see 3rd note)>
336 [fi PUBLISHER]
337 //--------------------------------------------------------------------
338
339
340 // FINAL GROUP OF MARKS
341 // Order of {NOTE,MARK,CORRECTION} :
342 // starts with user data at the beginning of the file,
343 // going forwards to the end:
344 //--------------------------------------------------------------------
345 [for each {NOTE,MARK,CORRECTION,DRAWING,BOOKMARK}]
346 BKMK
347 <0x 4 bytes = size of BKMK>
348 <0x 4 bytes = TEXT position of the beginning of {NOTE,MARK,CORRECTION,DRAWING,BOOKMARK}>
349 //-------------------------------
350 [if DRAWING]
351 <0x FF FF FF FF>
352 [else]
353 <0x 4 bytes = TEXT position of the end of {NOTE,MARK,CORRECTION,BOOKMARK}>
354 [fi DRAWING]
355 ...4
356 ...4
357 //-------------------------------
358 [if NOTE]
359 <0x xx xx xx (20)?>, xxxxxx=>RRGGBB color ???
360 <0x 00 00 00 02>
361 [fi NOTE]
362 [if MARK]
363 <0x xx xx xx (0F/00)??>, xxxxxx=>RRGGBB color ???
364 <0x 00 00 00 04>
365 [fi MARK]
366 [if CORRECTION]
367 <0x xx xx xx (6F)?>, xxxxxx=>RRGGBB color ???
368 <0x 00 00 00 02>
369 [fi CORRECTION]
370 [if DRAWING]
371 <0x xx xx xx (0F)?>, xxxxxx=>RRGGBB DRAWING's background color.
372 <0x 00 00 00 08>
373 [fi DRAWING]
374 [if BOOKMARK]
375 <0x xx xx xx 00>
376 <0x 00 00 00 01>
377 [fi BOOKMARK]
378 // this one is a strange type of mark, of yet not identified use:
379 [if UNKNOWN_TYPE_YET_1]
380 <0x xx xx xx 00>
381 <0x 00 00 40 00>
382 [fi UNKNOWN_TYPE_YET_1]
383
384 //-------------------------------
385 [if BOOKMARK || (NOTE "without stored marked text")]
386 <0x FF FF FF FF>
387 [else]
388 <0x 4 bytes = DATA pointer in INDEXES>
389 [fi BOOKMARK]
390 [if DRAWING || MARK]
391 <0x FF FF FF FF>
392 [else]
393 <0x 4 bytes = DATA pointer in INDEXES>
394 [fi]
395 <0x 4 bytes = DATA pointer in INDEXES>
396 [if DRAWING]
397 <0x 4 bytes = DATA pointer in INDEXES>
398 [else]
399 <0x FF FF FF FF>
400 [fi]
401 //-------------------------------
402 <0x FF FF FF FF>
403 <0x FF FF FF FF>
404 [next {NOTE,MARK,CORRECTION,DRAWING,BOOKMARK}]
405 //--------------------------------------------------------------------
406
407 [if length % 32 bit != 0] ???
408 <0x FF FF FF FF>
409 [fi]
410
411 // END OF FILE
412
413 // by [email protected], v0.2.e, 12/2009
414 // http://www.angelfire.com/ego2/idleloop