Open g0wfv opened 5 years ago
Maybe but I have few spare time now... If someone could help I can add him/her to this project as developer
Done it!
The fix was very simple in the end ....
306c306,323
< PLTE_len='\x00\x00\x00'+chr(len(PLTE_chunk))
---
> char1=len(PLTE_chunk)
> char2=0
> char3=0
> char4=0
>
> while char1>16777216:
> char4=char4+1
> char1=char1-16777216
>
> while char1>65536:
> char3=char3+1
> char1=char1-65536
>
> while char1>256:
> char2=char2+1
> char1=char1-256
>
> PLTE_len=chr(char4)+chr(char3)+chr(char2)+chr(char1)
Although this is overkill (handles more colours than the Mi Band 4 can use apparently!) it should be future proof to a certain degree, and there's probably a more elegant way to do it!
This code does the same thing, but it's more compact.
char_r=len(PLTE_chunk)
PLTE_len = ''
for p in range(3,-1,-1):
char_d, char_r = divmod(char_r, 256**p)
PLTE_len = PLTE_len + chr(char_d)
But in any case, when I try to unpack a Mi Band 4 bin file, it determines the number of resources, throws a 0 version and a negative resoffset
, and finally tells me for all resources ERROR: 83 isn't a bitmap resource
@g0wfv how did you get it to work?
Is it possible for dial2img.py to be modified to work with Mi Band 4 .bin file?