static void quit_signal(int sig) { char *txt=NULL; switch (sig) { case SIGINT: txt=strdup("SIGINT"); break; case SIGTERM: txt=strdup("SIGTERM"); break; case SIGQUIT: txt=strdup("SIGQUIT"); break; case SIGSEGV: txt=strdup("SIGSEGV"); break; default: txt=strdup("UNKNOWN"); break; } printf("%s Version %.2f killed, signal %s(%d)\n", __plugin__, SH_VERSION, txt, sig); put_instance(get_instance()-1); free(txt); exit(1); }
int main (int argc, char **argv) { int index=0,cindex=0,mainloop=1,dloop=1,tv, spr, resolution; char tstr[BUFSIZE]={0}, *rptr; PLISTENTRY pl; printf("%s Version %.2f\n", __plugin__, SH_VERSION); for(tv=1; tv<argc; tv++) { if(*argv[tv]=='/') { strcpy(CFG_FILE,argv[tv]); } } //init framebuffer before 1st scale2res fb = open(FB_DEVICE, O_RDWR); #ifdef MARTII if (fb < 0) fb = open(FB_DEVICE_FALLBACK, O_RDWR); #endif if(fb == -1) { perror(__plugin__ " <open framebuffer device>"); exit(1); } if(ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) { perror(__plugin__ " <FBIOGET_FSCREENINFO>\n"); return -1; } if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1) { perror(__plugin__ " <FBIOGET_VSCREENINFO>\n"); return -1; } #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) var_screeninfo.xres = DEFAULT_XRES; var_screeninfo.yres = DEFAULT_YRES; #endif if(!(lfb = (uint32_t*)mmap(0, fix_screeninfo.smem_len, PROT_WRITE|PROT_READ, MAP_SHARED, fb, 0))) { perror(__plugin__ " <mapping of Framebuffer>\n"); return -1; } // read config ixw=scale2res(600), iyw=scale2res(680), xoffs=scale2res(13); if((line_buffer=calloc(BUFSIZE+1, sizeof(char)))==NULL) { printf(NOMEM); return -1; } if((trstr=calloc(BUFSIZE+1, sizeof(char)))==NULL) { printf(NOMEM); return -1; } spr=Read_Neutrino_Cfg("screen_preset")+1; resolution=Read_Neutrino_Cfg("osd_resolution"); if (resolution == -1) sprintf(trstr,"screen_StartX_%s", spres[spr]); else sprintf(trstr,"screen_StartX_%s_%d", spres[spr], resolution); if((sx=Read_Neutrino_Cfg(trstr))<0) sx=scale2res(100); if (resolution == -1) sprintf(trstr,"screen_EndX_%s", spres[spr]); else sprintf(trstr,"screen_EndX_%s_%d", spres[spr], resolution); if((ex=Read_Neutrino_Cfg(trstr))<0) ex=scale2res(1180); if (resolution == -1) sprintf(trstr,"screen_StartY_%s", spres[spr]); else sprintf(trstr,"screen_StartY_%s_%d", spres[spr], resolution); if((sy=Read_Neutrino_Cfg(trstr))<0) sy=scale2res(100); if (resolution == -1) sprintf(trstr,"screen_EndY_%s", spres[spr]); else sprintf(trstr,"screen_EndY_%s_%d", spres[spr], resolution); if((ey=Read_Neutrino_Cfg(trstr))<0) ey=scale2res(620); for(index=CMCST; index<=CMH; index++) { sprintf(trstr,"menu_%s_alpha",menucoltxt[index]); if((tv=Read_Neutrino_Cfg(trstr))>=0) tr[index]=255-(float)tv*2.55; sprintf(trstr,"menu_%s_blue",menucoltxt[index]); if((tv=Read_Neutrino_Cfg(trstr))>=0) bl[index]=(float)tv*2.55; sprintf(trstr,"menu_%s_green",menucoltxt[index]); if((tv=Read_Neutrino_Cfg(trstr))>=0) gn[index]=(float)tv*2.55; sprintf(trstr,"menu_%s_red",menucoltxt[index]); if((tv=Read_Neutrino_Cfg(trstr))>=0) rd[index]=(float)tv*2.55; } if(Read_Neutrino_Cfg("rounded_corners")>0) { radius = scale2res(11); radius_small = scale2res(5); } else radius = radius_small = 0; mtmo = Read_Neutrino_Cfg("timing.menu"); if (mtmo < 0) mtmo = 0; cindex=CMC; for(index=COL_MENUCONTENT_PLUS_0; index<=COL_MENUCONTENT_PLUS_3; index++) { rd[index]=rd[cindex]+25; gn[index]=gn[cindex]+25; bl[index]=bl[cindex]+25; tr[index]=tr[cindex]; cindex=index; } sprintf(trstr,"infobar_alpha"); if((tv=Read_Neutrino_Cfg(trstr))>=0) tr[COL_SHADOW_PLUS_0]=255-(float)tv*2.55; sprintf(trstr,"infobar_blue"); if((tv=Read_Neutrino_Cfg(trstr))>=0) bl[COL_SHADOW_PLUS_0]=(float)tv*2.55*0.4; sprintf(trstr,"infobar_green"); if((tv=Read_Neutrino_Cfg(trstr))>=0) gn[COL_SHADOW_PLUS_0]=(float)tv*2.55*0.4; sprintf(trstr,"infobar_red"); if((tv=Read_Neutrino_Cfg(trstr))>=0) rd[COL_SHADOW_PLUS_0]=(float)tv*2.55*0.4; for (index = 0; index <= COL_SHADOW_PLUS_0; index++) bgra[index] = (tr[index] << 24) | (rd[index] << 16) | (gn[index] << 8) | bl[index]; InitRC(); //InitVFD(); //init fontlibrary if((error = FT_Init_FreeType(&library))) { printf("%s <FT_Init_FreeType failed with Errorcode 0x%.2X>", __plugin__, error); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_Manager_New(library, 1, 2, 0, &MyFaceRequester, NULL, &manager))) { printf("%s <FTC_Manager_New failed with Errorcode 0x%.2X>\n", __plugin__, error); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_SBitCache_New(manager, &cache))) { printf("%s <FTC_SBitCache_New failed with Errorcode 0x%.2X>\n", __plugin__, error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } memset(&menu,0,sizeof(MENU)); if(Check_Config()) { printf("%s <Check_Config> Unable to read Config %s\n", __plugin__, CFG_FILE); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); Clear_List(&menu,-1); free(line_buffer); return -1; } if((error = FTC_Manager_LookupFace(manager, FONT, &face))) { printf("%s <FTC_Manager_LookupFace failed with Errorcode 0x%.2X, trying default font>\n", __plugin__, error); if((error = FTC_Manager_LookupFace(manager, FONT2, &face))) { printf("%s <FTC_Manager_LookupFace failed with Errorcode 0x%.2X>\n", __plugin__, error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return 2; } else desc.face_id = FONT2; } else desc.face_id = FONT; printf("%s <FTC_Manager_LookupFace Font \"%s\" loaded>\n", __plugin__, desc.face_id); use_kerning = FT_HAS_KERNING(face); desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; //init backbuffer #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) lbb = lfb + 1920 * 1080; fix_screeninfo.line_length = DEFAULT_XRES * sizeof(uint32_t); stride = DEFAULT_XRES; #else stride = fix_screeninfo.line_length/sizeof(uint32_t); if(stride == 7680 && var_screeninfo.xres == 1280) { var_screeninfo.yres = 1080; } if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { printf("%s <allocating of Backbuffer failed>\n", __plugin__); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } #endif //lbb=lfb; #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FillRect(0, 0, DEFAULT_XRES, DEFAULT_YRES, 0); blit(); #else memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); //blit(); #endif startx = sx; starty = sy; /* scale to resolution */ FSIZE_BIG = scale2res(FSIZE_BIG); FSIZE_MED = scale2res(FSIZE_MED); FSIZE_SMALL = scale2res(FSIZE_SMALL); TABULATOR = scale2res(TABULATOR); OFFSET_MED = scale2res(OFFSET_MED); OFFSET_SMALL = scale2res(OFFSET_SMALL); OFFSET_MIN = scale2res(OFFSET_MIN); /* Set up signal handlers. */ signal(SIGINT, quit_signal); signal(SIGTERM, quit_signal); signal(SIGQUIT, quit_signal); signal(SIGSEGV, quit_signal); index=0; if(vfd) { sprintf(tstr,"%s -c", VFD); system(tstr); } ShowInfo(&menu, 1); //main loop menu.act_entry=0; if(Get_Menu(1)) { printf("%s <unable to create menu>\n", __plugin__); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } cindex=0; put_instance(instance=get_instance()+1); while(mainloop) { cindex=Get_Selection(&menu); dloop=1; switch(cindex) { case -1: mainloop=0; break; case 0: mainloop=Menu_Up(&menu); break; case 1: pl=menu.list[menu.act_entry]; switch (pl->type) { case TYP_MENU: menu.act_header=pl->headerpos; menu.lastheaderentrys[menu.act_header]=menu.act_entry; menu.headerwait[menu.act_header]=pl->message!=NULL; if(menu.headerwait[menu.act_header]) { strcpy(tstr,pl->entry); if((rptr=strxchr(tstr,','))!=NULL) { *rptr=0; } ShowMessage(tstr, pl->message, 0); } Get_Menu(0); menu.act_entry=0; break; case TYP_EXECUTE: if((rptr=strxchr(pl->entry,','))!=NULL) { strcpy(tstr,pl->entry); rptr=strxchr(tstr,','); *rptr=0; rptr=strxchr(pl->entry,','); rptr++; if(pl->stay) { if(pl->stay==1) { if(pl->message) { if(strlen(pl->message)) { ShowMessage(tstr, pl->message, 0); } } else { ShowMessage(tstr, "Bitte warten", 0); } } else { #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FillRect(0, 0, DEFAULT_XRES, DEFAULT_YRES, 0); blit(); #else memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); //blit(); #endif } if(*(rptr+strlen(rptr)-1)=='&') { *(rptr+strlen(rptr)-1)=0; } } else { if(*(rptr+strlen(rptr)-1)!='&') { sprintf(tstr,"%s &",rptr); rptr=tstr; } } CloseRC(); system(rptr); InitRC(); mainloop= pl->stay==1; if(pl->stay==1) { Get_Menu(1); } } break; } } } //cleanup Clear_List(&menu,-1); FTC_Manager_Done(manager); FT_Done_FreeType(library); #if 0 if(strlen(url)) { sprintf(line_buffer,"/sbin/rdate -s %s > /dev/null &",url); system(line_buffer); } #endif CloseRC(); //CloseVFD(); free(line_buffer); free(trstr); // clear Display #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) FillRect(0, 0, DEFAULT_XRES, DEFAULT_YRES, 0); blit(); #else memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); //blit(); #endif munmap(lfb, fix_screeninfo.smem_len); close(fb); #if !defined(MARTII) && !defined(HAVE_SPARK_HARDWARE) && !defined(HAVE_DUCKBOX_HARDWARE) free(lbb); #endif put_instance(get_instance()-1); return 0; }
int main (int argc, char **argv) { int index,index2,tv,found=0; int dloop=1, rcc=-1, flsh=0, cupd=0; char rstr[BUFSIZE], *rptr, *aptr; time_t tm1,tm2; unsigned int alpha; clock_t tk1=0; FILE *fh; if(argc<2) { ShowUsage(); return 0; } dloop=0; for(tv=1; !dloop && tv<argc; tv++) { aptr=argv[tv]; if((rptr=strchr(aptr,'='))!=NULL) { rptr++; if(strstr(aptr,"size=")!=NULL) { if(sscanf(rptr,"%d",&size)!=1) { dloop=1; } } else { if(strstr(aptr,"title=")!=NULL) { title=strdup(rptr); CatchTabs(title); if(strcmp(title,"none")==0) { header=0; } /* tpos=0; while(*rptr) { if(*rptr!='~') { nstr[tpos]=*rptr; } else { rc=*(rptr+1); found=0; for(i=0; i<sizeof(sc) && !found; i++) { if(rc==sc[i]) { rc=tc[i]; found=1; } } if(found) { nstr[tpos]=rc; ++rptr; } else { nstr[tpos]=*rptr; } } ++tpos; ++rptr; } nstr[tpos]=0; title=strdup(nstr); */ } else { if(strstr(aptr,"timeout=")!=NULL) { if(sscanf(rptr,"%d",&timeout)!=1) { dloop=1; } } else { if(strstr(aptr,"msg=")!=NULL) { dloop=Transform_Msg(rptr); if(timeout==0) { if((timeout=Read_Neutrino_Cfg("timing.epg"))<0) timeout=300; } type=1; } else { if(strstr(aptr,"popup=")!=NULL) { dloop=Transform_Msg(rptr); if(timeout==0) { if((timeout=Read_Neutrino_Cfg("timing.infobar"))<0) timeout=6; } type=2; } else { if(strstr(aptr,"refresh=")!=NULL) { if(sscanf(rptr,"%d",&refresh)!=1) { dloop=1; } } else { if(strstr(aptr,"select=")!=NULL) { dloop=GetSelection(rptr); } else { if(strstr(aptr,"default=")!=NULL) { if((sscanf(rptr,"%d",&selection)!=1) || selection<1) { dloop=1; } } else { if(strstr(aptr,"order=")!=NULL) { if(sscanf(rptr,"%d",&bpline)!=1) { dloop=1; } } else { if(strstr(aptr,"echo=")!=NULL) { if(sscanf(rptr,"%d",&echo)!=1) { dloop=1; } } else { if(strstr(aptr,"absolute=")!=NULL) { if(sscanf(rptr,"%d",&absolute)!=1) { dloop=1; } } else { if(strstr(aptr,"hide=")!=NULL) { if(sscanf(rptr,"%d",&mute)!=1) { dloop=1; } } else { if(strstr(aptr,"cyclic=")!=NULL) { if(sscanf(rptr,"%d",&cyclic)!=1) { dloop=1; } } else { dloop=2; } } } } } } } } } } } } } } switch (dloop) { case 1: printf("msgbox <param error: %s>\n",aptr); return 0; break; case 2: printf("msgbox <unknown command: %s>\n\n",aptr); ShowUsage(); return 0; break; } } /*for(tv=0; tv<buttons; tv++) { printf("%cButton %d: %s\n",(tv==selection-1)?'>':' ',tv+1,butmsg[tv]); } return 0;*/ if(!echo) { printf("\nmsgbox Message-Box Version %.2f\n",M_VERSION); } if(!buttons) { butmsg[0]=strdup("OK"); buttons=1; } /* if(selection>buttons) { printf("msgbox <param error: default=%d>\n",selection); return 0; } */ if(!absolute) { for(tv=0; tv<buttons; tv++) { rbutt[tv]=tv+1; } } if(selection) { for(tv=0; tv<buttons && !found; tv++) { if(rbutt[tv]==selection) { selection=tv+1; found=1; } } if(!found) { printf("msgbox <param error: default=%d>\n",selection); return 0; } } else { for(tv=0; tv<buttons && !selection; tv++) { if(strlen(butmsg[tv])) { selection=tv+1; } } } /* for(tv=0; selection!=rbutt[tv] && tv<buttons; tv++); if(tv>=buttons) { selection=1; } */ if(!title) { title=strdup("Information"); } if((line_buffer=calloc(BUFSIZE+1, sizeof(char)))==NULL) { printf(NOMEM); return -1; } if((debounce=Read_Neutrino_Cfg("repeat_genericblocker"))<0) debounce=200; if((rblock=Read_Neutrino_Cfg("repeat_blocker"))<0) rblock=50; if(((sx=Read_Neutrino_Cfg("screen_StartX"))<0)&&((sx=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/left"))<0)) sx=80; if(((ex=Read_Neutrino_Cfg("screen_EndX"))<0)&&((ex=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/right"))<0)) ex=620; if(((sy=Read_Neutrino_Cfg("screen_StartY"))<0)&&((sy=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/top"))<0)) sy=80; if(((ey=Read_Neutrino_Cfg("screen_EndY"))<0)&&((ey=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/bottom"))<0)) ey=505; if(Read_Neutrino_Cfg("rounded_corners")>0) radius=9; else radius=0; if((trstr=malloc(BUFSIZE))==NULL) { printf(NOMEM); return -1; } fb = open(FB_DEVICE, O_RDWR); #ifdef HAVE_DBOX_HARDWARE ioctl(fb, AVIA_GT_GV_GET_BLEV, &alpha); #endif rc = open(RC_DEVICE, O_RDONLY); fcntl(rc, F_SETFL, (fcntl(rc, F_GETFL) | O_EXCL) | O_NONBLOCK); //init framebuffer if(ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) { printf("msgbox <FBIOGET_FSCREENINFO failed>\n"); return -1; } if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1) { printf("msgbox <FBIOGET_VSCREENINFO failed>\n"); return -1; } if(ioctl(fb, FBIOGETCMAP, &oldcmap) == -1) { printf("msgbox <FBIOGETCMAP failed>\n"); return -1; } /* fh=fopen("/tmp/cmap.log","w"); fprintf(fh,"Start: %d, LEN: %d\n",oldcmap.start,oldcmap.len); for(tv=0; tv<256; tv++) { fprintf(fh,"%02d %04x %04x %04x %04x\n",tv,oldcmap.red[tv],oldcmap.green[tv],oldcmap.blue[tv],oldcmap.transp[tv]); } fclose(fh); */ for(index=0; index<8; index++) { sprintf(rstr,"menu_%s_alpha",menucoltxt[index]); if((tv=Read_Neutrino_Cfg(rstr))>=0) for(index2=0; index2<7; index2++) otr[menucolval[index]+index2]=(tv<<8); } ord[FLASH]=ord[CMCT]; ogn[FLASH]=ogn[CMCT]; obl[FLASH]=obl[CMCT]; otr[FLASH]=otr[CMCT]; /* fh=fopen("/tmp/cmap2.log","w"); fprintf(fh,"Start: %d, LEN: %d\n",oldcmap.start,oldcmap.len); for(tv=0; tv<256; tv++) { fprintf(fh,"%02d %04x %04x %04x %04x\n",tv,oldcmap.red[tv],oldcmap.green[tv],oldcmap.blue[tv],oldcmap.transp[tv]); } fclose(fh); */ /* { int i; printf("unsigned short rd[] = {"); for(i=CMCST; i<=CMH;i++) printf("0x%02x<<8, ",(ord[i]>>8)&0xFF); printf("\nunsigned short gn[] = {"); for(i=CMCST; i<=CMH;i++) printf("0x%02x<<8, ",(ogn[i]>>8)&0xFF); printf("\nunsigned short bl[] = {"); for(i=CMCST; i<=CMH;i++) printf("0x%02x<<8, ",(obl[i]>>8)&0xFF); printf("\nunsigned short tr[] = {"); for(i=CMCST; i<=CMH;i++) printf("0x%02x<<8, ",(otr[i]>>8)&0xFF); printf("\n"); } return 0; */ if(ioctl(fb, FBIOPUTCMAP, &oldcmap) == -1) { printf("msgbox <FBIOPUTCMAP failed>\n"); return -1; } if(!(lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0))) { printf("msgbox <mapping of Framebuffer failed>\n"); return -1; } //init fontlibrary if((error = FT_Init_FreeType(&library))) { printf("msgbox <FT_Init_FreeType failed with Errorcode 0x%.2X>", error); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_Manager_New(library, 1, 2, 0, &MyFaceRequester, NULL, &manager))) { printf("msgbox <FTC_Manager_New failed with Errorcode 0x%.2X>\n", error); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_SBitCache_New(manager, &cache))) { printf("msgbox <FTC_SBitCache_New failed with Errorcode 0x%.2X>\n", error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_Manager_Lookup_Face(manager, FONT, &face))) { printf("msgbox <FTC_Manager_Lookup_Face failed with Errorcode 0x%.2X>\n", error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } use_kerning = FT_HAS_KERNING(face); #ifdef FT_NEW_CACHE_API desc.face_id = FONT; #else desc.font.face_id = FONT; #endif #if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 0 desc.image_type = ftc_image_mono; #else desc.flags = FT_LOAD_MONOCHROME; #endif //init backbuffer if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres))) { printf("msgbox <allocating of Backbuffer failed>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(!(obb = malloc(var_screeninfo.xres*var_screeninfo.yres))) { printf("msgbox <allocating of Backbuffer failed>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(!(hbb = malloc(var_screeninfo.xres*var_screeninfo.yres))) { printf("msgbox <allocating of Backbuffer failed>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); free(obb); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(!(ibb = malloc(var_screeninfo.xres*var_screeninfo.yres))) { printf("msgbox <allocating of Backbuffer failed>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); free(obb); free(hbb); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(refresh & 1) { memcpy(ibb, lfb, var_screeninfo.xres*var_screeninfo.yres); } else { memset(ibb, TRANSP, var_screeninfo.xres*var_screeninfo.yres); } if(mute==2) { memcpy(hbb, lfb, var_screeninfo.xres*var_screeninfo.yres); } else { memset(hbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres); } if(refresh & 2) { memcpy(obb, lfb, var_screeninfo.xres*var_screeninfo.yres); } else { memset(obb, TRANSP, var_screeninfo.xres*var_screeninfo.yres); } startx = sx /*+ (((ex-sx) - 620)/2)*/; starty = sy /* + (((ey-sy) - 505)/2)*/; /* Set up signal handlers. */ signal(SIGINT, quit_signal); signal(SIGTERM, quit_signal); signal(SIGQUIT, quit_signal); put_instance(instance=get_instance()+1); show_txt(0); //FBEnterWord( 100, 100, 100,20,CMCT); //rc=RC_HOME; time(&tm1); tm2=tm1; tk1=clock()/(CLOCKS_PER_SEC/1000); #ifdef HAVE_DREAMBOX_HARDWARE ClearKeys(); #endif //main loop while((rcc!=RC_HOME) && (rcc!=RC_OK) && ((timeout==-1)||((tm2-tm1)<timeout))) { rcc=GetRCCode(); if(rcc!=-1) { time(&tm1); } else { if(++cupd>10) { if(cyclic) { show_txt(0); cupd=0; } } usleep(100000L); } if(mute && rcc==RC_MUTE) { hide^=1; show_txt(0); usleep(500000L); while(GetRCCode()!=-1); if(hide) { if((fh=fopen(HDF_FILE,"w"))!=NULL) { fprintf(fh,"hidden"); fclose(fh); } } else { remove(HDF_FILE); } } if((!hide) && (rcc!=RC_HOME) && (rcc!=RC_OK)) { switch(rcc) { case RC_LEFT: if(!hide && (--selection<1)) { selection=buttons; } show_txt(1); break; case RC_RIGHT: if(!hide && (++selection>buttons)) { selection=1; } show_txt(1); break; case RC_UP: if(!hide && ((selection-=bpline)<1)) { selection=1; } show_txt(1); break; case RC_DOWN: if(!hide && ((selection+=bpline)>buttons)) { selection=buttons; } show_txt(1); break; default: if(++flsh==7) { flsh=0; flash^=1; ord[FLASH]=(flash)?ord[CMC]:ord[CMCT]; ogn[FLASH]=(flash)?ogn[CMC]:ogn[CMCT]; obl[FLASH]=(flash)?obl[CMC]:obl[CMCT]; otr[FLASH]=(flash)?otr[CMC]:otr[CMCT]; ioctl(fb, FBIOPUTCMAP, &oldcmap); } break; } } time(&tm2); if(hide) { rcc=-1; } } if((type!=1) || (rcc!=RC_OK)) { selection=0; } //cleanup // clear Display // memset(lbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres); // memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres); memcpy(lfb, obb, var_screeninfo.xres*var_screeninfo.yres); munmap(lfb, fix_screeninfo.smem_len); #ifdef HAVE_DBOX_HARDWARE ioctl(fb, AVIA_GT_GV_SET_BLEV, alpha); #endif close(fb); free(lbb); put_instance(get_instance()-1); if(echo && selection>0) { printf("%s\n",butmsg[selection-1]); } for(tv=0; tv<buttons; tv++) { free(butmsg[tv]); } free(trstr); free(line_buffer); free(title); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(obb); free(hbb); free(ibb); close(rc); remove("/tmp/msgbox.tmp"); if(selection) { return rbutt[selection-1]; } return 0; }
static void quit_signal(int sig) { put_instance(get_instance()-1); printf("msgbox Version %.2f killed\n",M_VERSION); exit(1); }
int main (int argc, char **argv) { int ix,tv,found=0, spr, resolution; int dloop=1, rcc=-1; char rstr[BUFSIZE]={0}, *rptr=NULL, *aptr=NULL; time_t tm1,tm2; #ifndef MARTII FILE *fh; #endif if(argc<2) { ShowUsage(); return 0; } //init framebuffer before 1st scale2res fb = open(FB_DEVICE, O_RDWR); #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE if (fb < 0) fb = open(FB_DEVICE_FALLBACK, O_RDWR); #endif if(fb == -1) { perror(__plugin__ " <open framebuffer device>"); exit(1); } if(ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) { perror(__plugin__ " <FBIOGET_FSCREENINFO>\n"); return -1; } if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1) { perror(__plugin__ " <FBIOGET_VSCREENINFO>\n"); return -1; } #if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_DUCKBOX_HARDWARE) var_screeninfo.xres = DEFAULT_XRES; var_screeninfo.yres = DEFAULT_YRES; #endif if(!(lfb = (uint32_t*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0))) { perror(__plugin__ " <mapping of Framebuffer>\n"); return -1; } dloop=0; for(tv=1; !dloop && tv<argc; tv++) { aptr=argv[tv]; if(!strcmp(aptr,"-v") || !strcmp(aptr,"--version")) { printf("%s Version %.2f\n", __plugin__, M_VERSION); return 0; } if((rptr=strchr(aptr,'='))!=NULL) { rptr++; if(strstr(aptr,"size=")!=NULL) { if(sscanf(rptr,"%d",&FSIZE_MED)!=1) { dloop=1; } } else { if(strstr(aptr,"title=")!=NULL) { size_t l = strlen(rptr); char *t = (char *)alloca(l * 4 + 1); memcpy(t, rptr, l + 1); TranslateString(t, l * 4); title = strdup(t); CatchTabs(title); if(strcmp(title,"none")==0) { header=0; } } else { if(strstr(aptr,"timeout=")!=NULL) { if(sscanf(rptr,"%d",&timeout)!=1) { dloop=1; } } else { if(strstr(aptr,"msg=")!=NULL) { dloop=Transform_Msg(rptr); if(timeout==0) { if((timeout=Read_Neutrino_Cfg("timing.epg"))<0) timeout=300; } type=1; } else { if(strstr(aptr,"popup=")!=NULL) { dloop=Transform_Msg(rptr); if(timeout==0) { if((timeout=Read_Neutrino_Cfg("timing.infobar"))<0) timeout=6; } type=2; } else { if(strstr(aptr,"refresh=")!=NULL) { if(sscanf(rptr,"%d",&refresh)!=1) { dloop=1; } } else { if(strstr(aptr,"select=")!=NULL) { dloop=GetSelection(rptr); } else { if(strstr(aptr,"default=")!=NULL) { if((sscanf(rptr,"%d",&selection)!=1) || selection<1) { dloop=1; } } else { if(strstr(aptr,"order=")!=NULL) { if(sscanf(rptr,"%d",&bpline)!=1) { dloop=1; } } else { if(strstr(aptr,"echo=")!=NULL) { if(sscanf(rptr,"%d",&echo)!=1) { dloop=1; } } else { if(strstr(aptr,"absolute=")!=NULL) { if(sscanf(rptr,"%d",&absolute)!=1) { dloop=1; } } else { if(strstr(aptr,"hide=")!=NULL) { if(sscanf(rptr,"%d",&mute)!=1) { dloop=1; } } else { if(strstr(aptr,"cyclic=")!=NULL) { if(sscanf(rptr,"%d",&cyclic)!=1) { dloop=1; } } else { if(strstr(aptr,"icon=")!=NULL) { icon=rptr; dloop=Transform_Icon(icon)==0; } else { dloop=2; } } } } } } } } } } } } } } } switch (dloop) { case 1: printf("%s <param error: %s>\n", __plugin__, aptr); return 0; break; case 2: printf("%s <unknown command: %s>\n\n", __plugin__, aptr); ShowUsage(); return 0; break; } } FSIZE_BIG=(float)FSIZE_MED*1.25; FSIZE_SMALL=(FSIZE_MED*4)/5; TABULATOR=2*FSIZE_MED; size=FSIZE_MED; /* if(!echo) { printf("\nMsgBox Version %.2f\n", M_VERSION); } */ if(!buttons) { butmsg[0]=strdup("OK"); buttons=1; } if(!absolute) { for(tv=0; tv<buttons; tv++) { rbutt[tv]=tv+1; } } if(selection) { for(tv=0; tv<buttons && !found; tv++) { if(rbutt[tv]==selection) { selection=tv+1; found=1; } } if(!found) { printf("%s <param error: default=%d>\n", __plugin__, selection); return 0; } } else { for(tv=0; tv<buttons && !selection; tv++) { if(strlen(butmsg[tv])) { selection=tv+1; } } } if(!icon) { icon=strdup("info"); } if(!title) { title=strdup("Information"); } if((line_buffer=calloc(BUFSIZE+1, sizeof(char)))==NULL) { printf(NOMEM); return -1; } spr=Read_Neutrino_Cfg("screen_preset")+1; resolution=Read_Neutrino_Cfg("osd_resolution"); if (resolution == -1) sprintf(line_buffer,"screen_StartX_%s", spres[spr]); else sprintf(line_buffer,"screen_StartX_%s_%d", spres[spr], resolution); if((sx=Read_Neutrino_Cfg(line_buffer))<0) sx=scale2res(100); if (resolution == -1) sprintf(line_buffer,"screen_EndX_%s", spres[spr]); else sprintf(line_buffer,"screen_EndX_%s_%d", spres[spr], resolution); if((ex=Read_Neutrino_Cfg(line_buffer))<0) ex=scale2res(1180); if (resolution == -1) sprintf(line_buffer,"screen_StartY_%s", spres[spr]); else sprintf(line_buffer,"screen_StartY_%s_%d", spres[spr], resolution); if((sy=Read_Neutrino_Cfg(line_buffer))<0) sy=scale2res(100); if (resolution == -1) sprintf(line_buffer,"screen_EndY_%s", spres[spr]); else sprintf(line_buffer,"screen_EndY_%s_%d", spres[spr], resolution); if((ey=Read_Neutrino_Cfg(line_buffer))<0) ey=scale2res(620); for(ix=CMCST; ix<=CMH; ix++) { sprintf(rstr,"menu_%s_alpha",menucoltxt[ix]); if((tv=Read_Neutrino_Cfg(rstr))>=0) tr[ix]=255-(float)tv*2.55; sprintf(rstr,"menu_%s_blue",menucoltxt[ix]); if((tv=Read_Neutrino_Cfg(rstr))>=0) bl[ix]=(float)tv*2.55; sprintf(rstr,"menu_%s_green",menucoltxt[ix]); if((tv=Read_Neutrino_Cfg(rstr))>=0) gn[ix]=(float)tv*2.55; sprintf(rstr,"menu_%s_red",menucoltxt[ix]); if((tv=Read_Neutrino_Cfg(rstr))>=0) rd[ix]=(float)tv*2.55; } int cix=CMC; for(ix=COL_MENUCONTENT_PLUS_0; ix<=COL_MENUCONTENT_PLUS_3; ix++) { rd[ix]=rd[cix]+25; gn[ix]=gn[cix]+25; bl[ix]=bl[cix]+25; tr[ix]=tr[cix]; cix=ix; } sprintf(rstr,"infobar_alpha"); if((tv=Read_Neutrino_Cfg(rstr))>=0) tr[COL_SHADOW_PLUS_0]=255-(float)tv*2.55; sprintf(rstr,"infobar_blue"); if((tv=Read_Neutrino_Cfg(rstr))>=0) bl[COL_SHADOW_PLUS_0]=(float)tv*2.55*0.4; sprintf(rstr,"infobar_green"); if((tv=Read_Neutrino_Cfg(rstr))>=0) gn[COL_SHADOW_PLUS_0]=(float)tv*2.55*0.4; sprintf(rstr,"infobar_red"); if((tv=Read_Neutrino_Cfg(rstr))>=0) rd[COL_SHADOW_PLUS_0]=(float)tv*2.55*0.4; for (ix = 0; ix <= COL_SHADOW_PLUS_0; ix++) bgra[ix] = (tr[ix] << 24) | (rd[ix] << 16) | (gn[ix] << 8) | bl[ix]; if(Read_Neutrino_Cfg("rounded_corners")>0) { radius = scale2res(11); radius_small = scale2res(5); } else radius = radius_small = 0; InitRC(); if((trstr=malloc(BUFSIZE))==NULL) { printf(NOMEM); return -1; } //init fontlibrary if((error = FT_Init_FreeType(&library))) { printf("%s <FT_Init_FreeType failed with Errorcode 0x%.2X>", __plugin__, error); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_Manager_New(library, 1, 2, 0, &MyFaceRequester, NULL, &manager))) { printf("%s <FTC_Manager_New failed with Errorcode 0x%.2X>\n", __plugin__, error); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } if((error = FTC_SBitCache_New(manager, &cache))) { printf("%s <FTC_SBitCache_New failed with Errorcode 0x%.2X>\n", __plugin__, error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } Read_Neutrino_Cfg("font_file="); if((error = FTC_Manager_LookupFace(manager, FONT, &face))) { if((error = FTC_Manager_LookupFace(manager, FONT2, &face))) { printf("%s <FTC_Manager_LookupFace failed with Errorcode 0x%.2X>\n", __plugin__, error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return 2; } else desc.face_id = FONT2; } else desc.face_id = FONT; use_kerning = FT_HAS_KERNING(face); desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; //init backbuffer #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE lbb = lfb + 1920 * 1080; fix_screeninfo.line_length = DEFAULT_XRES * sizeof(uint32_t); stride = DEFAULT_XRES; #else stride = fix_screeninfo.line_length/sizeof(uint32_t); if(stride == 7680 && var_screeninfo.xres == 1280) { var_screeninfo.yres = 1080; } if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror(__plugin__ " <allocating of Backbuffer>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return -1; } #endif if(!(obb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror(__plugin__ " <allocating of Backbuffer>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(!(hbb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror(__plugin__ " <allocating of Backbuffer>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); free(obb); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(!(ibb = malloc(var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)))) { perror(__plugin__ " <allocating of Backbuffer>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); free(obb); free(hbb); munmap(lfb, fix_screeninfo.smem_len); return -1; } if(refresh & 1) { memcpy(ibb, lbb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); } else { memset(ibb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); } if(mute==2) { memcpy(hbb, lbb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); } else { memset(hbb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); } if(refresh & 2) { memcpy(obb, lbb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); } else { memset(obb, TRANSP, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); } startx = sx; starty = sy; /* scale to resolution */ FSIZE_BIG = scale2res(FSIZE_BIG); FSIZE_MED = scale2res(FSIZE_MED); FSIZE_SMALL = scale2res(FSIZE_SMALL); TABULATOR = scale2res(TABULATOR); OFFSET_MED = scale2res(OFFSET_MED); OFFSET_SMALL = scale2res(OFFSET_SMALL); OFFSET_MIN = scale2res(OFFSET_MIN); size = scale2res(size); /* Set up signal handlers. */ signal(SIGINT, quit_signal); signal(SIGTERM, quit_signal); signal(SIGQUIT, quit_signal); signal(SIGSEGV, quit_signal); put_instance(instance=get_instance()+1); show_txt(0); time(&tm1); tm2=tm1; //main loop while((rcc!=KEY_EXIT) && (rcc!=KEY_HOME) && (rcc!=KEY_OK) && ((timeout==-1)||((tm2-tm1)<timeout))) { rcc=GetRCCode(1000); if(rcc!=-1) { time(&tm1); } else { if(cyclic) show_txt(0); #if 0 if(++cupd>100) { if(cyclic) { show_txt(0); cupd=0; } } usleep(10000L); #endif } if(mute && rcc==KEY_MUTE) { hide^=1; show_txt(0); #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE ClearRC(); #else while(GetRCCode(300)!=-1); if(hide) { if((fh=fopen(HDF_FILE,"w"))!=NULL) { fprintf(fh,"hidden"); fclose(fh); } } else { remove(HDF_FILE); } #endif } if((!hide) && (rcc!=KEY_EXIT) && (rcc!=KEY_HOME) && (rcc!=KEY_OK)) { switch(rcc) { case KEY_LEFT: if(!hide && (--selection<1)) { selection=buttons; } show_txt(1); break; case KEY_RIGHT: if(!hide && (++selection>buttons)) { selection=1; } show_txt(1); break; case KEY_UP: if(!hide && ((selection-=bpline)<1)) { selection=1; } show_txt(1); break; case KEY_DOWN: if(!hide && ((selection+=bpline)>buttons)) { selection=buttons; } show_txt(1); break; default: flash^=1; break; } } time(&tm2); if(hide) { rcc=-1; } } if((type!=1) || (rcc!=KEY_OK)) { selection=0; } //cleanup #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE memcpy(lbb, obb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); blit(); #else memcpy(lfb, obb, var_screeninfo.xres*var_screeninfo.yres*sizeof(uint32_t)); #endif munmap(lfb, fix_screeninfo.smem_len); close(fb); #if !defined(HAVE_SPARK_HARDWARE) && !defined(HAVE_DUCKBOX_HARDWARE) free(lbb); #endif put_instance(get_instance()-1); if(echo && selection>0) { printf("%s\n",butmsg[selection-1]); } for(tv=0; tv<buttons; tv++) { free(butmsg[tv]); } free(trstr); free(line_buffer); free(title); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(obb); free(hbb); free(ibb); CloseRC(); remove("/tmp/msgbox.tmp"); if(selection) { return rbutt[selection-1]; } return 0; }
int main (int argc, char **argv) { int tv,cols=25,debounce=25,tmo=0; char ttl[]="Input"; int dloop=1,keys=0,frame=1,mask=0,bhelp=0; char *title=NULL, *format=NULL, *defstr=NULL, *aptr, *rptr; unsigned int alpha; if(argc==1) { ShowUsage(); return 0; } dloop=0; for(tv=1; !dloop && tv<argc; tv++) { aptr=argv[tv]; if((rptr=strchr(aptr,'='))!=NULL) { rptr++; if(strstr(aptr,"l=")!=NULL) { format=rptr; dloop=Transform_Msg(format)==0; } else { if(strstr(aptr,"t=")!=NULL) { title=rptr; dloop=Transform_Msg(title)==0; } else { if(strstr(aptr,"d=")!=NULL) { defstr=rptr; dloop=Transform_Msg(defstr)==0; } else { if(strstr(aptr,"m=")!=NULL) { if(sscanf(rptr,"%d",&mask)!=1) { dloop=1; } } else { if(strstr(aptr,"f=")!=NULL) { if(sscanf(rptr,"%d",&frame)!=1) { dloop=1; } } else { if(strstr(aptr,"k=")!=NULL) { if(sscanf(rptr,"%d",&keys)!=1) { dloop=1; } } else { if(strstr(aptr,"h=")!=NULL) { if(sscanf(rptr,"%d",&bhelp)!=1) { dloop=1; } } else { if(strstr(aptr,"c=")!=NULL) { if(sscanf(rptr,"%d",&cols)!=1) { dloop=1; } } else { if(strstr(aptr,"o=")!=NULL) { if(sscanf(rptr,"%d",&tmo)!=1) { dloop=1; } } else { dloop=2; } } } } } } } } } } switch (dloop) { case 1: printf("input <param error: %s>\n",aptr); return 0; break; case 2: printf("input <unknown command: %s>\n\n",aptr); ShowUsage(); return 0; break; } } if(!format) { printf("input <missing format string>\n"); return 0; } if(!title) { title=ttl; } if((buffer=calloc(BUFSIZE+1, sizeof(char)))==NULL) { printf(NOMEM); return 0; } if(((sx=Read_Neutrino_Cfg("screen_StartX"))<0)&&((sx=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/left"))<0)) sx=80; if(((ex=Read_Neutrino_Cfg("screen_EndX"))<0)&&((ex=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/right"))<0)) ex=620; if(((sy=Read_Neutrino_Cfg("screen_StartY"))<0)&&((sy=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/top"))<0)) sy=80; if(((ey=Read_Neutrino_Cfg("screen_EndY"))<0)&&((ey=Read_Neutrino_Cfg("/enigma/plugins/needoffsets/bottom"))<0)) ey=505; if(Read_Neutrino_Cfg("rounded_corners")>0) radius=9; else radius=0; fb = open(FB_DEVICE, O_RDWR); #ifdef HAVE_DBOX_HARDWARE ioctl(fb, AVIA_GT_GV_GET_BLEV, &alpha); #endif InitRC(); //init framebuffer if(ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) { printf("input <FBIOGET_FSCREENINFO failed>\n"); return 0; } if(ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1) { printf("input <FBIOGET_VSCREENINFO failed>\n"); return 0; } if(!(lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0))) { printf("input <mapping of Framebuffer failed>\n"); return 0; } //init fontlibrary if((error = FT_Init_FreeType(&library))) { printf("input <FT_Init_FreeType failed with Errorcode 0x%.2X>", error); munmap(lfb, fix_screeninfo.smem_len); return 0; } if((error = FTC_Manager_New(library, 1, 2, 0, &MyFaceRequester, NULL, &manager))) { printf("input <FTC_Manager_New failed with Errorcode 0x%.2X>\n", error); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return 0; } if((error = FTC_SBitCache_New(manager, &cache))) { printf("input <FTC_SBitCache_New failed with Errorcode 0x%.2X>\n", error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return 0; } if((error = FTC_Manager_Lookup_Face(manager, FONT, &face))) { printf("input <FTC_Manager_Lookup_Face failed with Errorcode 0x%.2X>\n", error); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return 0; } use_kerning = FT_HAS_KERNING(face); #ifdef FT_NEW_CACHE_API desc.face_id = (char*)FONT; #else desc.font.face_id = FONT; #endif #if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 0 desc.image_type = ftc_image_mono; #else desc.flags = FT_LOAD_MONOCHROME; #endif //init backbuffer if(!(lbb = malloc(var_screeninfo.xres*var_screeninfo.yres))) { printf("input <allocating of Backbuffer failed>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); munmap(lfb, fix_screeninfo.smem_len); return 0; } if(!(obb = malloc(var_screeninfo.xres*var_screeninfo.yres))) { printf("input <allocating of Backbuffer failed>\n"); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); munmap(lfb, fix_screeninfo.smem_len); return 0; } memcpy(lbb, lfb, var_screeninfo.xres*var_screeninfo.yres); memcpy(obb, lfb, var_screeninfo.xres*var_screeninfo.yres); startx = sx /*+ (((ex-sx) - 620)/2)*/; starty = sy /* + (((ey-sy) - 505)/2)*/; signal(SIGINT, quit_signal); signal(SIGTERM, quit_signal); signal(SIGQUIT, quit_signal); //main loop put_instance(instance=get_instance()+1); printf("%s\n",inputd(format, title, defstr, keys, frame, mask, bhelp, cols, tmo, debounce)); put_instance(get_instance()-1); memcpy(lfb, obb, var_screeninfo.xres*var_screeninfo.yres); free(buffer); FTC_Manager_Done(manager); FT_Done_FreeType(library); free(lbb); free(obb); #ifdef HAVE_DBOX_HARDWARE ioctl(fb, AVIA_GT_GV_SET_BLEV, alpha); #endif munmap(lfb, fix_screeninfo.smem_len); close(fb); CloseRC(); return 1; }