Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
dateiformat [09.06.2015 22:13] martin |
dateiformat [11.08.2021 10:15] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Buchformat ====== | ||
- | |||
- | Ein Ting-Buch besteht mindestens 3 Datein: | ||
- | |||
- | | ''< | ||
- | | ''< | ||
- | | ''< | ||
- | |||
- | Ting-Bücher die Skripte enthalten (z.B. Spiele) eine weitere Datei: | ||
- | |||
- | | ''< | ||
- | |||
- | Für die Funktion eines Buches ist allein die '' | ||
- | |||
- | ====== Die txt-Datei ====== | ||
- | < | ||
- | Name: < | ||
- | Publisher: < | ||
- | Author: < | ||
- | Book Version: < | ||
- | URL: <URL> | ||
- | ThumbMD5: <MD5 Summe der png-Datei> | ||
- | FileMD5: <MD5 Summe der ouf-Datei> | ||
- | ScriptMD5: <MD5 Summe der src-Datei> | ||
- | Book Area Code: en | ||
- | </ | ||
- | |||
- | Für Bücher ohne Skript-Datei entfällt die Zeile | ||
- | < | ||
- | ScriptMD5: <MD5 Summe der src-Datei> | ||
- | </ | ||
- | Ein Buch ohne Skript-Datei bedeutet nicht, dass das Buch keine Skripte enthält. Die binären Skripte befinden | ||
- | ich immer noch einmal (ohne Kommentare) in der ouf-Datei. | ||
- | |||
- | |||
- | Beispiel: '' | ||
- | < | ||
- | Name: Bauernhof Rätsel | ||
- | Publisher: arsEdition | ||
- | Author: Corina Beurenmeister | ||
- | Book Version: 255 | ||
- | URL: | ||
- | ThumbMD5: 963091a6d6854ddb7c89cd9b532ba22a | ||
- | FileMD5: 66287f1f855aa1dbd53a56f5155a91fe | ||
- | ScriptMD5: 9b28c79405e513dabad4094a1869aa21 | ||
- | Book Area Code: en | ||
- | </ | ||
- | |||
- | ====== Die png Datei ====== | ||
- | |||
- | Ein png-Bild der Größe 140px × 193px. (???) | ||
- | |||
- | ====== Die ouf Datei ====== | ||
- | |||
- | Dateistruktur | ||
- | ^ Bereich ^ Größe ^ | ||
- | | Dateikopf | 40 bytes (10 x 32 bit) | | ||
- | | Padding | 64 bytes | | ||
- | | Index-Tabelle | n x 12 byte = n x 3 x 32 bit | | ||
- | | Padding || | ||
- | | MP3 (incl. optionalem ID3-Tag ) / Binärscode || | ||
- | | Padding || | ||
- | | MP3 (incl. optionalem ID3-Tag ) / Binärscode || | ||
- | | ... || | ||
- | | MP3 (incl. optionalem ID3-Tag ) / Binärscode || | ||
- | |||
- | |||
- | ===== Dateikopf ===== | ||
- | |||
- | | 0 | Startposition der Index-Tabelle | 0x0068 | | ||
- | | 4 | unbekannt | 2 | | ||
- | | 8 | erste Ting-ID | 15001 (15000 gefunden; laut " | ||
- | | 12 | letzte Ting-ID | | ||
- | | 16 | Anzahl der genutzten Ting-IDs | Entspricht nicht immer letzte Ting-ID – erste Ting-ID + 1 (???) | | ||
- | | 20 | Buch-ID || | ||
- | | 24 | unbekannt | Werte im Bereich 1 bis 20 gefunden (häufig gefunden: 2, 5, 7 und 11) | | ||
- | | 28 | Erstellungszeitpunkt (???) | UNIX-Timestamp | | ||
- | | 32 | unbekannt | 0 | | ||
- | | 36 | unbekannt | 0x0000ffff | | ||
- | |||
- | ===== Index-Tabelle ===== | ||
- | |||
- | Jeder Eintrag besteht jeweils aus drei 32bit unsigned integer-Werten | ||
- | |||
- | | 0 | Kodierte Position des MP3 innerhalb der ouf-Datei (siehe Funktion: '' | ||
- | | 4 | Größe des MP3s oder des Skript-Kompilats in Bytes || | ||
- | | 8 | 0 | leerer Eintrag | | ||
- | | 8 | 1 | MP3 | | ||
- | | 8 | 2 | Skript | | ||
- | |||
- | ===== Padding ===== | ||
- | |||
- | Die einzelnen Einträge (MP3 oder Binärcode) fangen immer an einer Adresse der Form 0x......00 an. Das Padding erfolgt mit beliebigen Zeichen (meist nullen). Eine Ausnahme bildet das Padding zwischen dem ersten möglichen Anfang des ersten Tracks und dem wirklichen Anfang des ersten Tracks. Dieser muss mit nullen gefüllt sein. | ||
- | |||
- | ===== Funktionen ===== | ||
- | |||
- | Bei einigen Büchern muss zu der Funktion '' | ||
- | |||
- | < | ||
- | < | ||
- | </ | ||
- | |||
- | berechnet. Die Position des ersten Eintrags wird wahrscheinlich wie folgt ermittelt: | ||
- | |||
- | < | ||
- | pos = 12 * <Anzahl der Eintrage im Index> + < | ||
- | pos += (0x100 - (pos % 0x100)) % 0x100 | ||
- | while(< | ||
- | pos += 0x100; | ||
- | } | ||
- | </ | ||
- | |||
- | Die Funktion '' | ||
- | Position in der Indextablelle den Positionscode in der Indextabelle. Die Funktion '' | ||
- | liefert aus dem Positionscode in der Indextabelle und der Position in der Indextablelle | ||
- | die Position in der ouf-Datei. | ||
- | |||
- | < | ||
- | |||
- | private final static int[] E = { 578, 562, 546, 530, 514, 498, 482, 466, | ||
- | 322, 306, 290, 274, 258, 242, 226, 210, -446, | ||
- | -462, -478, -494, -510, -526, -542, -558, -702, | ||
- | -718, -734, -750, -766, -782, -798, -814}; | ||
- | /** | ||
- | * Errechnet aus der Position in der ouf-Datei und der Position in der Indextablelle | ||
- | * den Positionscode in der Indextabelle | ||
- | * @param position Position in der Datei | ||
- | * @param n Position in der Indextablelle (startet bei 0) | ||
- | * @return Positionscode in der Indextabelle (1. Feld). Im Fehlerfall -1 | ||
- | */ | ||
- | private static int getCodeFromPositionInFile(int position, int n) { | ||
- | if(((position & 0xFF) != 0x0) | (n < 0)) { | ||
- | return -1; | ||
- | } | ||
- | n--; | ||
- | int b = (position >> 8) + n * 0x1A; | ||
- | for(int k = 0; k < E.length; k++) { | ||
- | int v = (b - E[k]) << 8; | ||
- | if(getPositionInFileFromCode(v, | ||
- | return v; | ||
- | } | ||
- | } | ||
- | return -1; | ||
- | } | ||
- | |||
- | /** | ||
- | * Errechnet aus dem Positionscode in der Indextabelle und der Position in der Indextablelle | ||
- | * die Position in der ouf-Datei | ||
- | * @param code Positionscode in der Indextabelle (1. Feld) | ||
- | * @param n Position in der Indextablelle (startet bei 0) | ||
- | * @return Position in der Datei. Im Fehlerfall -1 | ||
- | */ | ||
- | public static int getPositionInFileFromCode(int code, int n) { | ||
- | if(((code & 0xFF) != 0x0) | (n < 0)) { | ||
- | return -1; | ||
- | } | ||
- | n--; | ||
- | code = code >> 8; | ||
- | int c = ((code >> 3) & 0x1) | (((code >> 4) & 0x1) << 1) | | ||
- | (((code >> 5) & 0x1) << 2) | (((code >> 7) & 0x1) << 3) | | ||
- | (((code >> 9) & 0x1) << 4); | ||
- | code -= n * 0x1A - E[c]; | ||
- | return code << 8; | ||
- | } | ||
- | </ |