29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from pathlib import Path
|
|
from PIL import Image,ImageDraw,ImageFont
|
|
import struct
|
|
p=Path(__file__).parent
|
|
(p/'assets').mkdir(exist_ok=True)
|
|
h=bytearray(Path('C:/Amiga/HD0/System/Shell.info').read_bytes()[:78])
|
|
def u16(n):return struct.pack('>H',n)
|
|
def u32(n):return struct.pack('>I',n&0xffffffff)
|
|
h[12:16]=u16(48)+u16(40);h[16:18]=u16(6);h[48]=3
|
|
for off in (22,26):h[off:off+4]=u32(1)
|
|
for off in (44,50,54,66,70):h[off:off+4]=u32(0)
|
|
h[58:66]=u32(-1)+u32(-1);h[74:78]=u32(131072)
|
|
data=bytearray(h)
|
|
for selected in (False,True):
|
|
im=Image.new('P',(48,40),0);d=ImageDraw.Draw(im)
|
|
d.rounded_rectangle((2,1,45,35),radius=3,fill=2,outline=1 if selected else 3,width=2)
|
|
for col in range(6):
|
|
for row in range(5):
|
|
xx=7+col*6; yy=5+row*5
|
|
if (col+row)%4!=0:
|
|
d.line((xx,yy,xx+2,yy),fill=1 if row==(col+2)%5 else 3)
|
|
d.point((xx+1,yy+2),fill=3)
|
|
d.rectangle((18,36,30,38),fill=3)
|
|
data+=u16(0)+u16(0)+u16(48)+u16(40)+u16(2)+u32(1)+bytes([3,0])+u32(0)
|
|
for plane in range(2):
|
|
for y in range(40):
|
|
for x in range(0,48,8):data.append(sum((128>>i) if im.getpixel((x+i,y))&(1<<plane) else 0 for i in range(8)))
|
|
(p/'assets'/'Matrix.info').write_bytes(data)
|