from pathlib import Path p=Path(__file__).parent/'player.c';s=p.read_text() s=s.replace('lastState=-1,full=1,lastw=0','lastState=-1,full=1,hud=0,repaint=0,lastw=0') s=s.replace('full=dirty||seconds!=lastSecond||(hip?hip->play:0)!=lastState;','hud=seconds!=lastSecond||(hip?hip->play:0)!=lastState;repaint=dirty;full=dirty||hud;') s=s.replace('memcpy(frame,panel,W*H);drawAudio();','full=repaint;memcpy(frame,panel,W*H);drawAudio();') s=s.replace('frame+504*W+382,W);}','frame+504*W+382,W);if(hud)WriteChunkyPixels(w->RPort,w->BorderLeft+382,w->BorderTop+354,w->BorderLeft+741,w->BorderTop+409,frame+354*W+382,W);}') s=s.replace('}else if(full){scaledRegion(w,iw,rw,rh,ox,oy,0,0,W,H);}','}else if(full){for(y=0;yRPort,w->BorderLeft,w->BorderTop,w->BorderLeft+iw-1,w->BorderTop+ih-1,scaled,iw);}') s=s.replace('scaledRegion(w,iw,rw,rh,ox,oy,382,504,742,510);}','scaledRegion(w,iw,rw,rh,ox,oy,382,504,742,510);if(hud)scaledRegion(w,iw,rw,rh,ox,oy,382,354,742,410);}') p.write_text(s)