Esempio n. 1
0
/*
 * Sets the position of the text.
 * @param screen The screen to select.
 * @param x The x position to put the text at.
 * @param y The y position to put the text at.
 */
void setText(int screen, int x, int y)
{
	/*
	 * Checks if the screen is <= 0.
	 */
	if (screen <= 0)
	{
		/*
		 * If so, then the bottom screen is selected.
		 */
		consoleSelect(&bottomScreen);
	}
	else
	{
		/*
		 * Otherwise, the top screen is selected.
		 */
		consoleSelect(&topScreen);
	}

	/*
	 * Sets the font position.  The format is \x1b[y;xH
	 */
	printf("\x1b[%d;%dH", y, x);
}
Esempio n. 2
0
void Display::padsUpdate(){	
	u8		noteStatus;
	char*	noteName;

	if (Cfg::pads.updated){
		if (Cfg::pads.oct_updated){
			consoleSelect(&subConsole);
			consoleClear();
		}
		for (u8 i = 0; i < 12; ++i){
			noteStatus = Cfg::notesStatus[Cfg::pads.channel][i + Cfg::pads.baseNote];
			if (Cfg::pads.oct_updated){
				noteName = midi->getNoteName(i + Cfg::pads.baseNote);
				echo(0, 40, 22 - (i/4)*8, (i%4)*8+3, noteName);
			}
			setPadSpriteFrame(i,noteStatus);
		}
		Cfg::pads.updated		= false;
		Cfg::pads.oct_updated	= false;
	}

	octaveSelectSprite->display(25, 231, 144 - Cfg::pads.baseNote, OBJPRIORITY_0, 0);
	consoleSelect(&mainConsole);
	iprintf("\x1b[1;10H%2d", Cfg::pads.channel + 1);

	padsButtonsStatus();
}
Esempio n. 3
0
// Prints a given array
void print_scroll(u8 **scroll_array, enum Direction direction)
{
	if (direction == horizontal)
	{
		consoleSelect(&bottom_screen);
		set_font_color(white);
		set_position(11, 1);
		for(u8 i = 0; i < 28; i++)
			iprintf("%c", *scroll_array[i]);
	} 
	else if (direction == vertical) 
	{
		consoleSelect(&bottom_screen);
		set_font_color(white);
		for(u8 i = 0; i < 21; i++)
		{
			set_position(2+i, 30);
			iprintf("%c", *scroll_array[i]);
		}
	}
	else if (direction == diagonal)
	{
		consoleSelect(&top_screen);
		set_font_color(white);
		for(u8 i = 0; i < 21; i++)
		{
			set_position(2+i, 4+i);
			iprintf("%c", *scroll_array[i]);
		}
	}
}
Esempio n. 4
0
void __attribute__((noreturn)) __sassert(const char* file, int line, const char* cond, const char* msg)
{
	if (isUserMode()) FeOS_swi_assertfail(file, line, cond, msg);

	videoReset();
	videoSetMode(MODE_0_2D);
	videoSetModeSub(MODE_0_2D);
	PrintConsole* conmain = consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 0, 1, true, true);
	memcpy(&oConSub, consoleGetDefault(), sizeof(PrintConsole));
	PrintConsole* consub = consoleInit(&oConSub, 0, BgType_Text4bpp, BgSize_T_256x256, 0, 1, false, true);
	InstallConThunks();

	consoleSelect(conmain);

	BG_PALETTE[0] = RGB15(31,0,31);
	BG_PALETTE[255] = RGB15(31,31,31);
	BG_PALETTE_SUB[0] = RGB15(31,0,31);
	BG_PALETTE_SUB[255] = RGB15(31,31,31);

	iprintf("\x1b[5CKernel assertion failure!\n\nCondition: %s\n\n%s:%d\n\nMessage: %s\n", cond, file, line, msg);

	consoleSelect(consub);

	iprintf("\x1b[5CStacktrace coming soon\n\nInstead, here's a kitten:\n\n");

	const char** i;
	for (i = meow; *i; i ++)
		iprintf("%s\n", *i);

	for (;;)
		swiWaitForVBlank();
}
Esempio n. 5
0
void BndsTicketView::show()
{
  	/// Inicia la consola.
	PrintConsole conSub = g_video->consoleSub();
	consoleSelect( &conSub );

	iprintf("\x1b[0;0H");
	iprintf("\x1b[2J");
	printf("\x1b[0;0H%-15.15s - Total: %.2f", m_ticket->nomTicket().c_str(), m_ticket->total() );

	/// Borra las lineas de texto donde hay que escribir.
	int lineaInicio = 2;
	for (int i = lineaInicio; i < m_maxItemsPerPage + lineaInicio; i++) {
		iprintf("\x1b[%i;0H", i);
	        iprintf("\x1b[2K");
	} // end for

	/// Muestra la paginacion.
	iprintf("\x1b[23;0H");
	iprintf("\x1b[2K");
	iprintf("\x1b[23;0HPag: %i / %i", m_currentPage, m_totalPages);

	int primerElemento = (m_currentPage * m_maxItemsPerPage) - m_maxItemsPerPage;
	int ultimoElemento = primerElemento + m_maxItemsPerPage;

	/// Dibuja la plantilla tactil en la pantalla principal.
	g_video->showTemplateListB( m_totalItemsCurrentPage, 4 );
	
	list<BndsTicketLine*> listaTicketLines = m_ticket->ticketLines();

	consoleSelect( &conSub );

	int contador = 1;
	for (list<BndsTicketLine*>::iterator itTicketLine = listaTicketLines.begin(); itTicketLine != listaTicketLines.end(); itTicketLine++) {

	  /// Muestra los items en pantalla.
	  if ((contador > primerElemento) && (contador <= ultimoElemento) ) {

	    if ( contador == currentLine() + primerElemento ) {
		printf("\x1b[%i;0H\x1b[30m%4i %-20.20s %3.2f", lineaInicio, (*itTicketLine)->quantityArticle() , (*itTicketLine)->article()->nomArticle().c_str(), (*itTicketLine)->subTotalLine() );
		m_currentTicketLine = *itTicketLine;
	    } else {
		printf("\x1b[%i;0H\x1b[39m%4i %-20.20s %3.2f", lineaInicio, (*itTicketLine)->quantityArticle() , (*itTicketLine)->article()->nomArticle().c_str(), (*itTicketLine)->subTotalLine() );
	    } // end if
	    
	    lineaInicio++;
	    
	  } // end if
	  
	  contador++;

	} // end for
	
	/// En la pantalla secundaria se marca el fondo de la linea de ticket seleccionada.
	if (currentLine() > 0) {
	  g_video->showTemplateListC(currentLine(), 1);
	} // end if

}
Esempio n. 6
0
void Display::clearGfx(){
	consoleSelect(&subConsole);
	consoleClear();
	consoleSelect(&mainConsole);
	consoleClear();
	oamClear(&oamSub, 0, 0);
	oamClear(&oamMain, 17, 110);
}
Esempio n. 7
0
/*! print tcp tables */
static void
print_tcp_table(void)
{
  static SOCU_TCPTableEntry tcp_entries[32];
  socklen_t                 optlen;
  size_t                    i;
  int                       rc;

  consoleSelect(&tcp_console);
  console_print("\x1b[0;0H\x1b[K\n");
  optlen = sizeof(tcp_entries);
  rc = SOCU_GetNetworkOpt(SOL_CONFIG, NETOPT_TCP_TABLE, tcp_entries, &optlen);
  if(rc != 0 && errno != ENODEV)
    console_print(RED "tcp table: %d %s\n\x1b[J\n" RESET, errno, strerror(errno));
  else if(rc == 0)
  {
    for(i = 0; i < optlen / sizeof(SOCU_TCPTableEntry); ++i)
    {
      SOCU_TCPTableEntry *entry  = &tcp_entries[i];
      struct sockaddr_in *local  = (struct sockaddr_in*)&entry->local;
      struct sockaddr_in *remote = (struct sockaddr_in*)&entry->remote;

      console_print(GREEN "tcp[%zu]: ", i);
      switch(entry->state)
      {
        case TCP_STATE_CLOSED:
          console_print("CLOSED\x1b[K\n"); break;
        case TCP_STATE_LISTEN:
          console_print("LISTEN\x1b[K\n"); break;
        case TCP_STATE_ESTABLISHED:
          console_print("ESTABLISHED\x1b[K\n"); break;
        case TCP_STATE_FINWAIT1:
          console_print("FINWAIT1\x1b[K\n"); break;
        case TCP_STATE_FINWAIT2:
          console_print("FINWAIT2\x1b[K\n"); break;
        case TCP_STATE_CLOSE_WAIT:
          console_print("CLOSE_WAIT\x1b[K\n"); break;
        case TCP_STATE_LAST_ACK:
          console_print("LAST_ACK\x1b[K\n"); break;
        case TCP_STATE_TIME_WAIT:
          console_print("TIME_WAIT\x1b[K\n"); break;
        default:
          console_print("State %lu\x1b[K\n", entry->state); break;
      }

      console_print(" Local %s:%u\x1b[K\n", inet_ntoa(local->sin_addr),
                               ntohs(local->sin_port));
      console_print(" Peer  %s:%u\x1b[K\n", inet_ntoa(remote->sin_addr),
                                ntohs(remote->sin_port));
    }
    console_print(RESET "\x1b[J");
  }
  else
    console_print("\x1b[2J");

  consoleSelect(&main_console);
}
Esempio n. 8
0
// Clears the screen and rewrites the "Made by" sentence
void reset_screens()
{
	consoleSelect(&top_screen);
	consoleClear();
	set_font_color(cyan);
	iprintf("Made by Lennart Kroes, s1062295");
	consoleSelect(&bottom_screen);
	consoleClear();
	set_font_color(cyan);
	iprintf("Made by Lennart Kroes, s1062295");
}
Esempio n. 9
0
	void init() {

		initMemory();

		//Init backgrounds
		// Main 3D
		init3DSettings();
		// Main Map:
		mapEngine = new MapEngine(1, 4, 1);
		// Main Console:
		consoleInit(&main_console,3,BgType_ExRotation, BgSize_ER_256x256, 31, 0, true, false);
		bg3 = main_console.bgId;
		bgSetCenter(bg3, 254, 0);
		bgSetRotate(bg3, -8192);

		// Sub Console:
		consoleInit(&sub_console,3,BgType_ExRotation, BgSize_ER_256x256, 31, 1, false, false);
		bg3Sub = sub_console.bgId;
		bgSetCenter(bg3Sub, 254, 0);
		bgSetRotate(bg3Sub, -8192);

		// Sub Image:
		bg2Sub = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 4,0);
		dmaCopy(leftmenuBitmap, bgGetGfxPtr(bg2Sub), 256*192);
		dmaCopy(leftmenuPal, BG_PALETTE_SUB, leftmenuPalLen);

		// Init Sprites
		oamInit(&oamMain, SpriteMapping_1D_128, false);

		// Set the priorities
		bgSetPriority(0,1);
		bgSetPriority(1,2);
		bgSetPriority(2,3);
		bgSetPriority(3,0);
		bgSetPriority(bg3Sub, 2);
		bgSetPriority(bg2Sub, 3);

		//Init font
		font.gfx = (u16*)fontTiles;
		font.pal = (u16*)fontPal;
		font.numChars = 95;
		font.numColors =  fontPalLen / 2;
		font.bpp = 8;
		font.asciiOffset = 32;
		font.convertSingleColor = false;
		consoleSetFont(&main_console, &font);
		consoleSetFont(&sub_console, &font);

		consoleSelect(&main_console);
		iprintf("\x1b[2J");
		iprintf("Arkham Tower v0.01");
		consoleSelect(&sub_console);
		iprintf("\x1b[2J");
	}
Esempio n. 10
0
// Clears the screen and rewrites the "Made by" sentence on screen
void reset_screens()
{
	Color default_color = yellow;
	consoleSelect(&top_screen);
	consoleClear();
	set_font_color(default_color);
	puts("Made by Lennart Kroes, s1062295\n");
	consoleSelect(&bottom_screen);
	consoleClear();
	set_font_color(default_color);
	puts("Made by Lennart Kroes, s1062295\n");
}
Esempio n. 11
0
/*! set status bar contents
 *
 *  @param[in] fmt format string
 *  @param[in] ... format arguments
 */
void
console_set_status(const char *fmt, ...)
{
  va_list ap;

  consoleSelect(&status_console);
  va_start(ap, fmt);
  vprintf(fmt, ap);
  vfprintf(stderr, fmt, ap);
  va_end(ap);
  consoleSelect(&main_console);
}
Esempio n. 12
0
Result http_download(httpcContext *context)
{
	ret=0;
	//u8* framebuf_top;
	u32 statuscode=0;
	//u32 size=0;
	u32 contentsize=0;
	u8 *buf;

	ret = httpcBeginRequest(context);
	if(ret!=0)return ret;

	ret = httpcGetResponseStatusCode(context, &statuscode, 0);
	if(ret!=0)return ret;

	//printf("http status code: %i\n", statuscode);

	if(statuscode!=200){
		printf("status code not 200, it was %i", statuscode);
		gfxFlushBuffers();
		return -2;
	}

	ret=httpcGetDownloadSizeState(context, NULL, &contentsize);
	if(ret!=0)return ret;
	unsigned char *buffer = (unsigned char*)malloc(contentsize+1);

	consoleSelect(&topScreen);

	printf("HTTP status code: %i\n", statuscode);
	printf("%i bytes\n", contentsize);
	gfxFlushBuffers();

	buf = (u8*)malloc(contentsize);
	if(buf==NULL)return -1;
	memset(buf, 0, contentsize);


	ret = httpcDownloadData(context, buffer, contentsize, NULL);
	if(ret!=0)
	{
		free(buf);
		return ret;
	}

	consoleSelect(&bottomScreen);
	printf("%s", buffer);

	free(buf);

	return 0;
}
Esempio n. 13
0
/*! set status bar contents
 *
 *  @param[in] fmt format string
 *  @param[in] ... format arguments
 */
void
console_set_status(const char *fmt, ...)
{
  va_list ap;

  consoleSelect(&status_console);
  va_start(ap, fmt);
  vprintf(fmt, ap);
#ifdef ENABLE_LOGGING
  vfprintf(stderr, fmt, ap);
#endif
  va_end(ap);
  consoleSelect(&main_console);
}
Esempio n. 14
0
void BndsArticlesView::show()
{
  
	/// Inicia la consola.
	PrintConsole conSub = g_video->consoleSub();
  	consoleSelect( &conSub );

	iprintf("\x1b[0;0H");
	iprintf("\x1b[2J");
	printf("\x1b[0;0H%-15.15s - Total: %.2f", g_db->currentTicket()->nomTicket().c_str(), g_db->currentTicket()->total() );

	/// Borra las lineas de texto donde hay que escribir.
	int lineaInicio = 2;
	for (int i = lineaInicio; i < m_maxItemsPerPage + lineaInicio; i++) {
		iprintf("\x1b[%i;0H", i);
	        iprintf("\x1b[2K");
	} // end for

	/// Muestra la paginacion.
	iprintf("\x1b[23;0H");
	iprintf("\x1b[2K");
	iprintf("\x1b[23;0HPag: %i / %i - %-15.15s -", m_currentPage, m_totalPages, m_categoryArticle->nomCategoryArticle().c_str());
	

	int primerElemento = (m_currentPage * m_maxItemsPerPage) - m_maxItemsPerPage;
	int ultimoElemento = primerElemento + m_maxItemsPerPage;
	int totalElementosPaginaActual = ((int) m_listaArtic.size() - (m_maxItemsPerPage * (m_currentPage - 1))) >= m_maxItemsPerPage ? m_maxItemsPerPage : ((int) m_listaArtic.size() - (m_maxItemsPerPage * (m_currentPage - 1)));
	
	/// Dibuja la plantilla tactil en la pantalla principal.
	g_video->showTemplateListA( totalElementosPaginaActual, 2, primerElemento, true, true, m_modifierActive );
	
	int contador = 1;
	for (list<BndsArticle*>::iterator itArtic = m_listaArtic.begin(); itArtic != m_listaArtic.end(); itArtic++) {

	  /// Muestra los items en pantalla.
	  if ((contador > primerElemento) && (contador <= ultimoElemento) ) {

	    consoleSelect( &conSub );
	    printf("\x1b[%i;0H%2i %-20.20s %3.2f", lineaInicio, lineaInicio - 1 + primerElemento, (*itArtic)->nomArticle().c_str(), (*itArtic)->pvpArticle() );

	    lineaInicio++;
	    
	  } // end if
	  
	  contador++;

	} // end for

}
Esempio n. 15
0
int main() {
	suInit();
	gfxInitDefault();
	consoleInit(GFX_TOP, &topConsole);
	consoleSelect(&topConsole);

	cfguInit();
	fsInit();
	amInit();

	fbTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
	fbTopRight = gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL);
	fbBottom = gfxGetFramebuffer(GFX_BOTTOM, 0, NULL, NULL);

	u8 next = mainMenu();
	while (aptMainLoop()) {
		switch (next) {
			case 0: break;
			case 1: next = mainMenu(); break;
			//case 2: next = legitInstallMenu(); break;
			case 3: next = downgradeMenu(); break;
			//case 4: next = downgradeMSETMenu(); break;
			//case 5: next = downgradeBrowserMenu(); break;
			default: next = mainMenu();
		}
		if (next == 0) break;
	}

	gfxExit();
	return 0;
}
Esempio n. 16
0
// Clear the screen
void draw_clearscrn(void) {
  consoleSelect(&top_screen);
  printf(RESET_TO_TOP_LEFT);
  // Fill the screen with blank spaces
  for (int i=0; i<37; i++) { printf("%-40.40s", " "); }
  printf(RESET_TO_TOP_LEFT);
}
Esempio n. 17
0
void initConsole(PrintConsole * console) {
	// consoleInit (PrintConsole * console, int layer, BgType type,
	// BgSize size, int mapBase, int tileBase, bool mainDisplay, bool loadGraphics)	
	consoleInit(console, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, false, true);
	consoleSelect(console);
	printf("\x1b[30m");
}
Esempio n. 18
0
void init_consoles(void)
{
	/* debug console on top */
	mainConsole = consoleDemoInit();
	debugConsole = (PrintConsole *) malloc(sizeof(PrintConsole));

	if (!debugConsole)
		exit(1);

	memcpy(debugConsole, consoleGetDefault(), sizeof(PrintConsole));
	videoSetMode(MODE_0_2D);
	vramSetBankA(VRAM_A_MAIN_BG);

	consoleInit(debugConsole, debugConsole->bgLayer, BgType_Text4bpp,
		    BgSize_T_256x256, debugConsole->mapBase,
		    debugConsole->gfxBase, true, true);
#ifdef DEBUG
	printf("Test debug console\n");
#endif
	consoleSelect(mainConsole);
#ifdef DEBUG
	printf("Test main console\n");
#endif
	return;
}
Esempio n. 19
0
File: main.c Progetto: elzk/nds-ide
int
main(void)
{
					// Initialize Bottom Screen for printf()
	PrintConsole topScreen;
        videoSetMode(MODE_0_2D);
        vramSetBankA(VRAM_A_MAIN_BG);
        consoleInit(&topScreen, 3,BgType_Text4bpp, BgSize_T_256x256, 31, 0, true, true);
        consoleSelect(&topScreen);

        videoSetModeSub(MODE_5_2D);
    	vramSetBankC(VRAM_C_SUB_BG);
        bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0,0);
    decompress(drunkenlogoBitmap, BG_GFX_SUB,  LZ77Vram);
	
	
	xTaskCreate(Key_Press,
					     (const signed char * const)"Key_Press",
					     2048,
					     (void *)NULL,
					     tskIDLE_PRIORITY + 2,
					     NULL);
	
	xTaskCreate(Touch_Press,
					     (const signed char * const)"Touch_Press",
					     2048,
					     (void *)NULL,
					     tskIDLE_PRIORITY + 1,
					     NULL);
	vTaskStartScheduler();		// Never returns
	while(1)
		;
	return 0;
}
Esempio n. 20
0
void ui_info_add(const char* info) {
    consoleSelect(&bottom_screen);
    printf(info);
    gfxFlushBuffers();
    gfxSwapBuffers();
    gspWaitForVBlank();
}
Esempio n. 21
0
void DSGM_BoxText(u8 screen, u8 x, u8 y, u8 width, u8 height, u8 delay, const char *format, ...) {
	char text[1024];
	va_list args;
	va_start(args, format);
	vsnprintf(text, 1023, format, args);
	va_end(args);
	
	int i;
	int len = strlen(text);
	u8 dx = x;
	u8 dy = y;
	
	consoleSelect(&DSGM_text[screen][DSGM_textLayer[screen]]);
	
	//consoleSetWindow(&DSGM_text[screen][DSGM_textLayer[screen]], x, y, width, height);
	
	for(i = 0; i < len; i++) {
		DSGM_text[screen][DSGM_textLayer[screen]].cursorX = dx;
		DSGM_text[screen][DSGM_textLayer[screen]].cursorY = dy;
		printf("%c", text[i]);
		
		dx += 1;
		
		if(text[i] == '\n' || (text[i] == ' ' && DSGM_GetWordLength(text + i + 1) + (dx - x) >= width && (dx - x) > 0)) {
			dx = x;
			dy += 1;
		}
		
		DSGM_Delay(delay);
	}
}
Esempio n. 22
0
void err_show(char file_name[], int line, char message[]) {
  quit_for_err = true;
  // Reset all screens
  consoleInit(GFX_TOP, &top_screen);
  consoleInit(GFX_BOTTOM, &debug_screen);
  consoleInit(GFX_BOTTOM, &instruction_screen);
  consoleSelect(&top_screen);
  printf("%s\n\t\tFATAL ERROR\n\n%s", BG_RED, RESET);
  printf("%s\n", file_name);
  printf("line %d\n", line);
  printf(message);
  printf("\n\nPlease raise an issue at:\ngithub.com/thatguywiththatname/3DES/issues\n");
  printf("With details of this error &\nwhat you were doing at the time\n");
  printf("\nPress A to close app\n");
  while (aptMainLoop()) {
    gspWaitForVBlank();
    hidScanInput();
    u32 exitkDown = hidKeysDown();
    if (exitkDown & KEY_A) {
      return;
    }
    gfxFlushBuffers();
    gfxSwapBuffers();
  }
}
Esempio n. 23
0
void DSGM_InitText(DSGM_Layer *layer) {
	DSGM_Debug("Init text: screen %d, layerNumber %d, vramId %d\n", layer->screen, layer->layerNumber, DSGM_text[layer->screen][layer->layerNumber].bgId);
	
	ConsoleFont font;
	
	if(layer->background != DSGM_DEFAULT_FONT) {
		font.gfx = bgGetGfxPtr(layer->vramId);
		
		DSGM_UnlockBackgroundPalette(layer->screen);
		font.pal = (u16 *)&(layer->screen == DSGM_TOP ? VRAM_E_EXT_PALETTE : VRAM_H_EXT_PALETTE)[layer->layerNumber][0];
		font.numColors = 2;
		
		font.numChars = 127;
		font.bpp = 4;
		font.asciiOffset = 0;
		font.convertSingleColor = false;
	}
	
	consoleInit(&DSGM_text[layer->screen][layer->layerNumber], layer->layerNumber, BgType_Text4bpp, BgSize_T_256x256, layer->mapBase, layer->tileBase, layer->screen, layer->background == DSGM_DEFAULT_FONT);
	layer->vramId = DSGM_text[layer->screen][layer->layerNumber].bgId;
	
	if(layer->background != DSGM_DEFAULT_FONT) {
		consoleSetFont(&DSGM_text[layer->screen][layer->layerNumber], &font);
		DSGM_LockBackgroundPalette(layer->screen);
	}
	
	DSGM_textLayer[layer->screen] = layer->layerNumber;
	consoleSelect(&DSGM_text[layer->screen][layer->layerNumber]);
	consoleClear();
}
Esempio n. 24
0
void print_xy_to(PrintConsole * c, int x, int y, char *str)
{
	static char buffer[MAX_X_TEXT + 9];

	consoleSelect(c);
	snprintf(buffer, MAX_X_TEXT + 8, "\x1b[%d;%dH%s", y, x, str);
	iprintf(buffer);
}
Esempio n. 25
0
// DISPLAY UPDATE FUNCTION
//-------------------------------------------------------------------------
void Display::update(){
	consoleSelect(&mainConsole);
	iprintf("\e[37m\x1b[1;20H%4d.%1d.%1d", midi->bars, midi->beats, midi->quarters);
	consoleSelect(&subConsole);

	tempoLeds();
	switch (Cfg::mode){
		case KAOSS:
			if (Cfg::previousMode != KAOSS){
				Cfg::previousMode = KAOSS;
				kaoss();
			}
			if (!input->paused)
				kaossUpdate();
			break;
		case PADS:
			if (Cfg::previousMode != PADS){
				Cfg::previousMode = PADS;
				pads();
			}
			padsUpdate();
			break;
		case MIXER:
			if (Cfg::previousMode != MIXER){
				Cfg::previousMode = MIXER;
				mixer();
			}
			mixerUpdate();
			break;
		case SLIDERS:
			if (Cfg::previousMode != SLIDERS){
				Cfg::previousMode = SLIDERS;
				sliders();
			}
			slidersUpdate();
			break;
	}

	for (u8 c = 0; c < 16; ++c){
		for (u8 v = 0; v < 128; ++v)
			Cfg::ccChangedVblank[c][v] = false;
	}
	oamUpdate(&oamSub);
	oamUpdate(&oamMain);
	++frame;
}
Esempio n. 26
0
void printf_to(PrintConsole * c, char *format, ...)
{
	va_list args;

	consoleSelect(c);
	va_start(args, format);
	vprintf(format, args);
	va_end(args);
}
Esempio n. 27
0
//---------------------------------------------------------------------------------
void consoleSetFont(PrintConsole* console, ConsoleFont* font){
//---------------------------------------------------------------------------------

	console->font = *font;

	consoleLoadFont(console);

	consoleSelect(console);
}
Esempio n. 28
0
File: main.c Progetto: gocario/tvds
void drawHelp(void)
{
	consoleSelect(&logConsole);
	consoleClear();

	printf(" Welcome in tvds, a tdvs clone.\n");
	printf("\n");

	switch (state)
	{
		case STATE_BROWSE:
		{
			printf("> [Up/Down] Select file/folder\n");
			printf("> [L/R] Swap between Save/Sdmc folder\n");
			printf("> [A] Navigate inside a folder\n");
			printf("> [B] Return to the parent folder\n");
			printf("> [X] Delete the current file/folder\n");
			printf("> [Y] Copy the current file/folder\n");
			break;
		}
		case STATE_BACKUP:
		{
			printf("> [Up/Down] Select backup\n");
			printf("> [A] Inject the selected backup back\n");
			printf("> [X] Delete the selected backup\n");
			printf("> [Y] Create a new backup\n");
			break;
		}
		default: break;
	}

	printf("> [Select] Print these instructions\n");
	printf("> [Start] Exit tvds\n");
	printf("\n");

	consoleSelectDefault();

	consoleSelect(&titleConsole);
	consoleClear();

	printf("Title id: 0x%016llx", titleid);

	consoleSelectDefault();
}
Esempio n. 29
0
void DSGM_DrawText(u8 screen, int x, int y, const char *format, ...) {
	consoleSelect(&DSGM_text[screen][DSGM_textLayer[screen]]);
	DSGM_text[screen][DSGM_textLayer[screen]].cursorX = x;
	DSGM_text[screen][DSGM_textLayer[screen]].cursorY = y;
	
	va_list arg;
	va_start(arg, format);
	vfprintf(stdout, format, arg);
	va_end(arg);
}
Esempio n. 30
0
void filePrintFileList(const char *dir, int first, int select, int count, bool cancel = false)
{
	if (select < first)
		select = first;

	consoleSelect(&lowerScreen);
	consoleSetWindow(&lowerScreen, 0, 0, 32, 19);
	consoleClear();

	char *buf = (char*)data;
	for (int i = 0; i < first; i++) {
		buf = strchr(buf, '\n') + 1;
	}

	for (int i = first; (i < first + 18) && (i < count); i++) {
		char *newline = strchr(buf, '\n');
		int linelen = newline - buf;
		
		*newline = 0;
		if (*buf == 'd') {
			if (i != select)		
				iprintf("[%.29s]\n", buf+1);
			else
				iprintf("-->[%.26s]\n", buf+1);
		} else {
			if (i != select)
				iprintf("%.31s\n", buf+1);
			else
				iprintf("-->%.28s\n", buf+1);
		}
		*newline = '\n';
		buf += linelen+1;
	}
	
	consoleSelect(&lowerScreen);
	consoleSetWindow(&lowerScreen, 0, 18, 32, 6);
	consoleClear();
	iprintf("================================");
	if (cancel)
		iprintf(stringsGetMessageString(STR_FS_WRITE));
	else
		iprintf(stringsGetMessageString(STR_FS_READ));
}