/** * Return the string entered. The maximal length of the string is * FILENAME_MAX, i.e. 16+1. */ const char* __fastcall__ screenReadInput(const char* pStrTitle, const char* pStrDefault) { uint8_t len; static char strInput[FILENAME_MAX]; char c; screenBing(); strcpy(strInput, pStrDefault); len = strlen(strInput); screenPrintBox(2, 6, 36, 12); screenPrintSepLine(2, 37, 8); cputsxy(3, 7, pStrTitle); // the input field textcolor(COLOR_LIGHTFRAME); screenPrintBox(4, 10, 32, 3); textcolor(COLOR_FOREGROUND); screenPrintButton(30, 14, "Enter"); cursor(1); do { cputsxy(5, 11, strInput); cputc(' '); gotox(5 + len); c = cgetc(); if (len < sizeof(strInput) - 1 && ((c >= 32 && c < 128) || (c >= 192 && c < 224)) ) { strInput[len++] = c; strInput[len] = '\0'; } else if (c == CH_DEL) { if (len) strInput[--len] = '\0'; } } while (c != CH_ENTER); cursor(0); refreshMainScreen(); return strInput; }
/** * Show or refresh the Screen which reports the Flash IDs. */ void refreshMainScreen(void) { const char* str; screenPrintFrame(); // menu entries gotoxy (1, 1); textcolor(COLOR_EXTRA); cputc('M'); textcolor(COLOR_FOREGROUND); cputs("enu "); textcolor(COLOR_EXTRA); cputc('O'); textcolor(COLOR_FOREGROUND); cputs("ptions "); textcolor(COLOR_EXTRA); cputc('E'); textcolor(COLOR_FOREGROUND); cputs("xpert "); textcolor(COLOR_EXTRA); cputc('H'); textcolor(COLOR_FOREGROUND); cputs("elp"); textcolor(COLOR_LIGHTFRAME); screenPrintBox(16, 4, 23, 11); screenPrintSepLine(16, 38, 6); screenPrintSepLine(16, 38, 8); screenPrintSepLine(16, 38, 10); screenPrintSepLine(16, 38, 12); textcolor(COLOR_FOREGROUND); gotoxy(6, 5); cputs("File name:"); gotox(17); cputs(g_strFileName); gotoxy(7, 7); cputs("CRT Type:"); gotox(17); cputs(aStrInternalCartTypeName[internalCartType]); gotoxy(3, 9); cputs("Flash Driver:"); gotox(17); cputs(pStrFlashDriver); gotoxy(10, 11); cputs("Slots:"); gotox(17); cputs(strMemSize); gotoxy(3, 13); cputs("Time elapsed:"); refreshElapsedTime(); progressShow(); refreshStatusLine(); }