void showSearchString(void) { Goto_pos(0, 1); (void) Cconws("Search: "); Goto_pos(8, 1); (void) Cconws(search.text); }
void showPageNumber(void) { Goto_pos(13, 2); (void) Cconws("Page: "); Goto_pos(19, 2); char tmp[10]; intToStr(search.pageCurrent + 1, tmp); tmp[3] = '/'; intToStr(search.pagesCount, tmp + 4); (void) Cconws(tmp); }
void getStatus(void) { commandShort[4] = FDD_CMD_GET_IMAGE_ENCODING_RUNNING; commandShort[5] = 0; sectorCount = 1; // read 1 sector BYTE res = Supexec(ce_acsiReadCommand); if(res != FDD_OK) { // fail? just quit return; } status.encoding = pBfr[0]; // isRunning - 1: is running, 0: is not running status.prevDoWeHaveStorage = status.doWeHaveStorage; // make a copy of previous value status.doWeHaveStorage = pBfr[1]; // do we have storage on RPi attached? status.prevDownloadCount = status.downloadCount; // make a copy of previous download files count status.downloadCount = pBfr[2]; // how many files are still downloading? Goto_pos(0, 23); // show status line (void) Cconws("\33p"); // inverse on (void) Cconws((const char *) (pBfr + 4)); // status string (void) Cconws("\33q"); // inverse off }
void showMenuDownload(BYTE showMask) { if(showMask & SHOWMENU_STATICTEXT) { (void) Clear_home(); (void) Cconws("\33p[Floppy image download, Jookie 2014-18]\33q\r\n"); } if(showMask & SHOWMENU_SEARCHSTRING) { showSearchString(); } if(showMask & SHOWMENU_RESULTS_ALL) { showPageNumber(); } showResults(showMask); if(showMask & SHOWMENU_STATICTEXT) { Goto_pos(0, 19); (void) Cconws("\33pA..Z\33q - search, \33p(shift) arrows\33q - move\r\n"); if(status.doWeHaveStorage) { // with storage (void) Cconws("\33pF1, F2, F3\33q - insert into slot 1, 2, 3\r\n"); (void) Cconws("\33pF4\33q - download, \33pF5\33q - refresh list,\r\n"); } else { // without storage (void) Cconws(" \r\n"); (void) Cconws(" \33pF5\33q - refresh list,\r\n"); } (void) Cconws("\33pF8\33q - setup screen, \33pF10\33q - quit\r\n"); } }
void main(void) { int i; Super(0); /* passage en SUPERVISEUR */ Clear_home(); while (''=='') { for (i=0; i<=3; i++) { Goto_pos(i,1); printf("Joy (%d) Position =>%u Tire => %u \n",i+1,position(i),feu(i)); } } Super(1); /* retour en UTILISATEUR */ }
void showResults(BYTE showMask) { int i; char *pRow; char rowCopy[ROW_LENGTH]; if(showMask & SHOWMENU_RESULTS_ALL) { // if should redraw all results (void) Cconws("\33w"); // disable line wrap for(i=0; i<15; i++) { pRow = (char *) (searchContent + (i * ROW_LENGTH)); BYTE selected = (i == search.row); Goto_pos(0, 3 + i); (void) Cconws("\33K"); // clear line from cursor to right if(selected) { // for selected row (void) Cconws("\33p"); } (void) Cconws(pRow); if(selected) { // for selected row (void) Cconws("\33q"); } } (void) Cconws("\33v"); // enable line wrap return; } if(showMask & SHOWMENU_RESULTS_ROW) { // if should redraw only selected line (void) Cconws("\33w"); // disable line wrap // draw previous line without inversion Goto_pos(0, 3 + search.prevRow); pRow = (char *) (searchContent + (search.prevRow * ROW_LENGTH)); (void) Cconws(pRow); // draw current line with inversion Goto_pos(0, 3 + search.row); pRow = (char *) (searchContent + (search.row * ROW_LENGTH)); memcpy(rowCopy, pRow, ROW_LENGTH); // make a copy of row for(i=0; i<ROW_LENGTH; i++) { // find and replace all 'inverse off' with 'inverse on' codes to keep the line reversed if(rowCopy[i] == 27 && rowCopy[i + 1] == 'q') { // is 'inserve off'? rowCopy[i + 1] = 'p'; // now it's inverse on } } (void) Cconws("\33p"); (void) Cconws(rowCopy); // show current but altered row (void) Cconws("\33q"); (void) Cconws("\33v"); // enable line wrap return; } }