### BNL File Structure Example (bnl.yaml) Source: https://context7.com/jindroush/albituzka/llms.txt Example structure for `bnl.yaml` used by `bnl_creator.pl`. It defines book settings, encryption parameters, start button actions, book modes, quiz structures, and OID-to-MP3 mappings. ```yaml # Sekce header – globální nastavení knihy book_id: '0x0BB8' encryption: header_key: '0x00000100' prekey_dw: '0x000000F5' prekey: - '0x00' - '0x00' # ... celkem 16 bytů start_button_1st_read: mode_0: - media_0000.mp3 start_button_2nd_read: mode_0: - media_0001.mp3 book_mode_read: mode_0: - media_0002.mp3 --- # Sekce quiz quizes: - q_type: '0x0000' q_asked: '0x0003' q_verify: '0x0001' q_oid: oid_x0064 questions: - q0_unk: '0x0000' q0_oid: oid_x0065 q0_good_reply_oids: - oid_x0066 --- # Sekce oids – mapování OID kódů na MP3 soubory oid_x0064: mode_0: - media_0003.mp3 oid_x0065: mode_0: - media_0004.mp3 ``` -------------------------------- ### OID Code Generation YAML Structure (generate_oids.yaml) Source: https://context7.com/jindroush/albituzka/llms.txt Example structure for `generate_oids.yaml` used by `oid_png_generator.pl`. Defines OID numbers and their corresponding output filenames for batch code generation. ```yaml - oid: 3000 fname: oid_icon_start.png - oid: 6 fname: oid_icon_stop.png - oid: 10000 fname: oid_x270F_moje_oid.png ``` -------------------------------- ### Build Custom Book with Albituzka Tools Source: https://context7.com/jindroush/albituzka/llms.txt Instructions for creating a custom book using Albituzka tools. This involves preparing YAML configuration, audio files, and graphics, then using Perl scripts to generate BNL files and OID PNG codes. ```bash # Postup vytvoření vlastní knihy: # 1. Připravit bnl.yaml s definicí OID -> MP3 mapování # 2. Namluvit a připravit MP3 soubory # 3. Sestavit BNL: perl tools/creator/bnl_creator.pl -input test/podklady/bnl.yaml -output moje_kniha.bnl # 4. Vygenerovat OID PNG kódy: perl tools/oid_generator/oid_png_generator.pl @generate_oids.yaml -dpi 1200 # 5. Vložit PNG kódy do grafiky (PSD/GIMP) a vytisknout ``` -------------------------------- ### Create BNL Files with bnl_creator.pl Source: https://context7.com/jindroush/albituzka/llms.txt Reassemble BNL files using `bnl_creator.pl`. It takes a `bnl.yaml` file and MP3s to create a new BNL file and a `generate_oids.yaml` for OID generation. Specify input and output files with `-input` and `-output` flags. ```bash perl bnl_creator.pl ``` ```bash perl bnl_creator.pl -input moje_kniha.yaml -output moje_kniha.bnl ``` ```text # Očekávaný výstup: # Loaded 512 lines from bnl.yaml # Parsed input data. # Encryption: from input file # Oids range: 0x0064-0x02FF # Book modes: 2 # Book id: 0x0BB8 (3000) # Media: references 47 files # Created moje_kniha.bnl, 1024512 bytes long. # Done. ``` -------------------------------- ### Analyze Firmware with fw_cutter.pl Source: https://context7.com/jindroush/albituzka/llms.txt Use `fw_cutter.pl` to analyze firmware files (`update.chp`, `updateA.chp`). It identifies firmware parts, extracts texts, MP3s, and OID-to-firmware tables. Use `-save` to extract internal files or `-savebin` to extract binary sections. ```bash perl fw_cutter.pl updateA.chp ``` ```bash perl fw_cutter.pl updateA.chp -save ``` ```bash perl fw_cutter.pl updateA.chp -savebin ``` ```text # Očekávaný výstup: # input: updateA.chp # md5: a1b2c3d4e5f6... # chip: SN9P701F # modules count: 3 ``` -------------------------------- ### Check BNL File Compatibility with Python Source: https://context7.com/jindroush/albituzka/llms.txt Verify if a BNL file is compatible with the Albituzka project by performing an XOR test on the first two 32-bit DWORD values of its header. Requires the 'struct' module. ```python import struct def check_bnl_compatibility(filename): """ Ověří, zda je BNL soubor kompatibilní s albituzka projektem. XOR prvních dvou 32-bit DWORD hodnot musí dát 0x200. """ with open(filename, 'rb') as f: data = f.read(8) dw1, dw2 = struct.unpack('> 24 # Aplikace key modifikátoru (z header_key) foreach (@prekey) { $_ = ($_ + $k3) & 0xFF; } # Generování šifrovacího klíče (výsledek: pole 512 bajtů) my @key = keygen(\@prekey); # Dešifrování dat (funguje i jako šifrování díky XOR symetrii) my $buffer = "...šifrovaná data..."; decrypt_mem(\$buffer, \@key); # $buffer nyní obsahuje dešifrovaná data # Ověření šifrovacích podmínek (musí platit): # ((header_key >> 24) + (prekey_dw & 0xFF)) & 0xFF == 0xF5 my $header_key = 0x12000100; my $prekey_dw = 0x000000E3; # 0xF5 - 0x12 = 0xE3 die "Neplatný klíč" unless (((($header_key >> 24) + ($prekey_dw & 0xFF)) & 0xFF) == 0xF5); ``` -------------------------------- ### Perl OID Converter: Internal to Raw OID Source: https://context7.com/jindroush/albituzka/llms.txt Convert between internal OID codes (indices) and RAW OID codes (printed on paper) using pre-initialized lookup tables. The conversion table contains over 65,000 mappings. ```perl # Inicializace konverzní tabulky (volá se automaticky) my @oid_tbl_int2raw; oid_converter_init(); # naplní @oid_tbl_int2raw # Převod interního kódu na RAW kód (tištěný OID) my $internal_oid = 5; # interní index 5 my $raw_oid = $oid_tbl_int2raw[$internal_oid]; printf("Interní OID %d -> RAW OID %d\n", $internal_oid, $raw_oid); # Interní OID 5 -> RAW OID 20 # Použití v disassembleru – výpis OID s oběma formáty printf("file oid-%04X [paper:%04X]\n", $internal_oid, oid2rawoid($internal_oid)); # file oid-0005 [paper:0014] # Praktický příklad: generování PNG pro OID interního kódu 1000 my $raw = $oid_tbl_int2raw[1000]; # $raw se předá do create_OID_raster() pro generování PNG ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.