研究 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 字節 | |
? | 記錄 | 記錄的數據。。。。。 | |