fi2 encoder/decoder - page 11 - DryOS Development - CHDK Forum
supplierdeeply

fi2 encoder/decoder

  • 100 Replies
  • 66661 Views
Re: fi2 encoder/decoder
« Reply #100 on: 31 / October / 2020, 11:04:59 »
Advertisements
Hi,please find a python version where -pv parameter (dryos version) is not needed, as length of fi2_rec_s and type of checksum (long or byte based) is guessed.
Block can be extracted and checksum is verified.

Code: [Select]
>python fi2dec.py  -k 1234567890ABCDEF1234567890ABCDEF -i 1234567890ABCDEF1234567890ABCDEF  ..\g7xm2_101b\G7XM2110.FI2
header_size:01d4 hwid:32bc model_id:03970000 version:01010000 nblk:11 datacs:62180cdf
record_len: 10
    offset   upklen   len      addr     uf1      fmain    fboot
#00 00000000 0012b100 00055d20 00000000 00000000 00000000 00000001 00000000 00000000 00000000
#01 00055d20 010057d0 00869280 e0020000 00000000 00000001 00000000 00000000 00000000 00000000
#02 008befa0 00042998 0002c870 e1200000 00000000 00000000 00000000 00000000 00000000 00000000
#03 008eb810 00020000 00000100 e12a0000 00000000 00000000 00000000 00000000 00000000 00000000
#04 008eb910 004ca9c8 0022a950 e1520000 00000000 00000000 00000000 00000000 00000000 00000000
#05 00b16260 00002eb8 000020f0 e1bc0000 00000000 00000000 00000000 00000000 00000000 00000000
#06 00b18350 00009c88 00007890 e1be0000 00000000 00000000 00000000 00000000 00000000 00000000
#07 00b1fbe0 00020000 00000000 e1c00000 00000000 00000000 00000000 00000000 00000001 00000000
#08 00b1fbe0 00200000 001b9580 e1d00000 00000000 00000000 00000000 00000000 00000000 00000000
#09 00cd9160 000005f4 00000580 e1f00000 00000000 00000000 00000000 00000000 00000000 00000000
#10 00cd96e0 00020000 00000000 e1f80000 00000000 00000000 00000000 00000000 00000001 00000000
I'm attaching an archive with the original(?) source (thanks to the unknown person who kept it available and to c10ud for finding it).
I'm also attaching my version of fi2dec which is based on tools/packfi2 and the original fi2encdec source. This version is able to deal with new fi2 files too, just don't forget the -pv switch.
Example output:
Code: [Select]
> fi2dec -pv 52 -key 1234567890ABCDEF1234567890ABCDEF -iv 234567890ABCDEF1234567890ABCDEF1 SOME.FI2
HLEN 0x000001CC HWID 0x00003260 UNK1 0x03410000   ID 0x01000200
  CH 0x00000001 UNK2 0x00000001   CS 0x35D94E42,  12 data blocks

rec: offs 0x00000000 unpacked size 0x0014a82c packed size 0x0006c680 dest 0x00000000
     uf1  0x00000000 mainf 0 bootf 1                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x0006c680 unpacked size 0x009530bc packed size 0x005086c0 dest 0xfc020000
     uf1  0x00000000 mainf 1 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x00574d40 unpacked size 0x00000001 packed size 0x00000010 dest 0xfd580000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x00574d50 unpacked size 0x0031ee84 packed size 0x00141b70 dest 0xfd740000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006b68c0 unpacked size 0x00001f40 packed size 0x00001600 dest 0xfdde0000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006b7ec0 unpacked size 0x00007120 packed size 0x00005770 dest 0xfde00000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006bd630 unpacked size 0x00020000 packed size 0x00000000 dest 0xfde20000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000001
rec: offs 0x006bd630 unpacked size 0x00028db8 packed size 0x00003620 dest 0xfde40000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006c0c50 unpacked size 0x00020000 packed size 0x00000000 dest 0xfdfc0000
     uf1  0x00000000 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000001
rec: offs 0x006c0c50 unpacked size 0x00000010 packed size 0x00000020 dest 0xfdf60000
     uf1  0x00000001 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006c0c70 unpacked size 0x00000822 packed size 0x000003b0 dest 0xfdf61c00
     uf1  0x00000001 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
rec: offs 0x006c1020 unpacked size 0x00003a80 packed size 0x000009a0 dest 0xfdf6a800
     uf1  0x00000001 mainf 0 bootf 0                  uf2 0x00000000 uf3  0x00000000
Done
The output files are saved into the current directory.


Update. New fi2dec source version, no longer fails on a certain r55 file. Encoder part not tested.
old version removed
fi2dec_.7z (87.98 kB - downloaded 18 times.)
Update 2. Source updated to not fail on 64-bit systems. Zlib also updated to 1.2.11.
old version removed
fi2dec2015.7z (103.19 kB - downloaded 35 times.)
« Last Edit: 31 / October / 2020, 11:07:21 by lorenzo353 »

 

Related Topics