mungewell / zoom-zt2

Python script to install/remove effects from the Zoom G1Four pedal
MIT License
62 stars 11 forks source link

MS-plus ZIC format #84

Open mungewell opened 2 months ago

mungewell commented 2 months ago

figure out as much as we can about the 'ZIC' format.

Note: If ZIC is not uploaded with effect, the effect is a blank icon in the librarian - but is still selectable

mungewell commented 2 months ago

Dumping a random ICON

$ hexdump -C HALL5G.ZIC | head
00000000  5a 42 4d 50 18 00 00 00  48 00 61 00 66 00 80 00  |ZBMP....H.a.f...|
00000010  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  fc fe ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff 7f  |................|
00000040  3f 1f 1f 1f 1f 1f 3f 7f  ff ff ff ff ff ff ff ff  |?.....?.........|
00000050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000060  ff ff ff ff ff ff fe fc  ff ff ff ff ff ff ff ff  |................|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000080  ff ff ff ff ff ff ff f0  e0 c0 c0 c0 c0 c0 e0 f0  |................|
00000090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

$ ls -la HALL5G.ZIC 
-rw-rw-r-- 1 simon simon 2600 Sep  1 11:07 HALL5G.ZIC

0x61 = 97 0x66 = 102 97 102 = 9894, assuming 2bits per pixel this would occupy 2732.5 bytes 98 103 = 10094, assuming 2bits per pixel this would occupy 2523.5 bytes

mungewell commented 2 months ago

So it looks like the Icon is stripped in the same way (as icons within the ZD2), ie 8bit wide stripes layed along side each other.

But also looks to contain two (or more); small and large perhaps?

$ dd bs=16 skip=2 if=HALL5G.ZIC of=temp.bin
160+1 records in
160+1 records out
2568 bytes (2.6 kB, 2.5 KiB) copied, 0.00378844 s, 678 kB/s
simon@the-void:~/zoom-zt2-sdw-github/zoom_fx_ms-plus/ms-60b$ python3 convert_zic.py

convert_zic.py.txt icon

mungewell commented 2 months ago
        #img2 = destripe(img, 35)
        img2 = destripe(img, 25)

icon

mungewell commented 2 months ago

convert_zic.py.txt icon_small icon_big

mungewell commented 2 months ago

Some unknowns; offset 0x0010 - perhaps 'invert'

./EXCITER.ZIC
00000000  5a 42 4d 50 18 00 00 00  48 00 61 00 66 00 80 00  |ZBMP....H.a.f...|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

convert_zic.py.txt icon_small icon_big

Not sure about offset 0x0004, only different here

./IR.ZIC
00000000  5a 42 4d 50 08 00 00 00  4a 00 61 00 00 00 00 00  |ZBMP....J.a.....|
00000010  fc fe 07 03 03 03 03 03  03 03 03 03 03 03 03 03  |................|
mungewell commented 2 months ago

D'oh the 0x00000018 or 0x00000008 are the length of the segment describing the image properties. And it looks like the IR.ZIC file only contains the 'small' icon. icon_0

I improved code and push it here: https://github.com/mungewell/zoom-zt2/blob/master/convert_zic.py

There's enough information to go in reverse (PNG -> ZIC), but I was too lazy to code it ;-)

$ find . -name "*.ZIC" -exec bash -c "python3 convert_zic.py -p icons/{} {}" \;
Converting: ./B_OCTAVE.ZIC
Writing: icons/./B_OCTAVE.ZIC_0.png
Writing: icons/./B_OCTAVE.ZIC_1.png
Converting: ./LINPRE.ZIC
Writing: icons/./LINPRE.ZIC_0.png
Writing: icons/./LINPRE.ZIC_1.png
Converting: ./SOLPRE.ZIC
Writing: icons/./SOLPRE.ZIC_0.png
Writing: icons/./SOLPRE.ZIC_1.png
Converting: ./DUAL_CMP.ZIC
Writing: icons/./DUAL_CMP.ZIC_0.png
Writing: icons/./DUAL_CMP.ZIC_1.png
Converting: ./SUPERCHO.ZIC
Writing: icons/./SUPERCHO.ZIC_0.png
Writing: icons/./SUPERCHO.ZIC_1.png
...
mungewell commented 2 months ago

OK I did code it; you can extract Icons to PNG, edit them in Gimp (or the like) and push them back into the ZIC with '-r' / '--reverse' flag.