研究 MOBI 要从研究 PDB 开始。
但我还是不知道 MOBI 跟 PalmOS 有什么关系
原文链接:https://wiki.mobileread.com/wiki/PDB#Palm_Database_File_Code
PalmOS 将所有 RAM 存储保存为数据库格式。RAM 中没有文件系统。当同步到 PC 上时,这些数据库将被保存在单独的文件中,这就是添加扩展名的地方。设备 RAM 中的所有文件都必须是 Palm 数据库格式,无论是程序还是数据。为外部存储创建的 PDB 文件是数据文件,其中可以包含任意内容。
表格显示有问题,看图吧
偏移地址 | 字节数 | 内容 | 注释 |
---|---|---|---|
0 | 32 | 数据库名 | 数据库名,以 0 结尾。PalmOS 上作为文件名。对于电子书一般为书名,长度够的话包含作者名 |
32 | 2 | 属性 | bit field.(不重要,不翻了) 0x0002 Read-Only 0x0004 Dirty AppInfoArea 0x0008 Backup this database (i.e. no conduit exists) 0x0010 (16 decimal) Okay to install newer over existing copy, if present on PalmPilot 0x0020 (32 decimal) Force the PalmPilot to reset after this database is installed 0x0040 (64 decimal) Don't allow copy of file to be beamed to other Pilot. |
34 | 2 | 版本 | |
36 | 4 | 创建时间 | Unix 时间戳 |
40 | 4 | 修改时间 | |
44 | 4 | 最后备份时间 | |
48 | 4 | 修改编号? | |
52 | 4 | 软件信息 ID? | 软件信息的偏移地址(如果有)或者 null |
56 | 4 | 分类 ID? | 分类信息的偏移地址(如果有)或者 null |
60 | 4 | 文件类型 | 见该表 |
64 | 4 | 创建者(软件) | 见该表 |
68 | 4 | 唯一的 ID 种子? | 内部使用 |
72 | 4 | 下一个记录表 ID | 在 PalmOS 的内存中使用 |
76 | 2 | 记录数 | 该文件中有 N 条记录 |
78 | 8N | 列表,每条记录的信息 | |
以下是每条记录的信息 | 重复 N 次 | ||
4 | 记录数据的偏移地址 | 从文件头开始 | |
1 | 记录属性 | bit field. The least significant four bits are used to represent the category values. These are the categories used to split the databases for viewing on the screen. A few of the 16 categories are pre-defined but the user can add their own. There is an undefined category for use if the user or programmer hasn't set this. 0x10 (16 decimal) Secret record bit. 0x20 (32 decimal) Record in use (busy bit). 0x40 (64 decimal) Dirty record bit. 0x80 (128, unsigned decimal) Delete record on next HotSync. | |
3 | 唯一 ID | 一般从 0 开始数 | |
记录的信息结束 | |||
2? | 分隔 | 一般是两个全 0 字节 | |
? | 记录 | 记录的数据。。。。。 | |