diff --git a/src/gui.c b/src/gui.c index 0523f01..d6981f9 100644 --- a/src/gui.c +++ b/src/gui.c @@ -11,6 +11,9 @@ #include "display.h" /* LCD_HEIGHT; LCD_WIDTH; shouldRender; lcdScreenGS[] */ #include "persistence.h" /* load_file_on_stack(); */ +/***********/ +/* DEFINES */ +/***********/ #define PANEL_FLAG_VISIBLE 0x01 #define UI_PADDING 4 @@ -54,6 +57,9 @@ // Releaseing mouse button 1 anywhere unpushes the button #define BUTTON_B1RELEASE 0x10 +/***********/ +/* TYPEDEF */ +/***********/ typedef struct { int index; int x, y; @@ -79,6 +85,9 @@ typedef struct { SDL_Color below; } colors_t; +/*************/ +/* VARIABLES */ +/*************/ static TTF_Font* ttffont = NULL; static TTF_Font* ttffont2 = NULL; @@ -734,6 +743,9 @@ static SDL_Color pixels_colors[] = { {.r = 37, .g = 61, .b = 84, .a = 255}, }; +/*************/ +/* FUNCTIONS */ +/*************/ static inline bool _init_keyboard_textures() { SDL_Surface* s = NULL; @@ -956,6 +968,9 @@ static inline void button_draw_all() _button_draw( gui_buttons[ i ] ); } +/********************/ +/* PUBLIC FUNCTIONS */ +/********************/ void gui_refresh() { SDL_SetRenderDrawColor( renderer, gui_colors.faceplate.r, gui_colors.faceplate.g, gui_colors.faceplate.b, gui_colors.faceplate.a ); diff --git a/src/persistence.c b/src/persistence.c index 66f1279..94604c6 100644 --- a/src/persistence.c +++ b/src/persistence.c @@ -436,38 +436,38 @@ void rom_init( char* filename ) size = file_size( fullpath ); if ( !size ) { - printf( "ERROR: Can't read ROM file size\n" ); + fprintf( stderr, "ERROR: Can't read ROM file size\n" ); exit( 0x10 ); } if ( size != 256 * 1024 && size != 512 * 1024 && size != 1024 * 1024 ) { - printf( "ERROR: ROM file size invalid\n" ); + fprintf( stderr, "ERROR: ROM file size invalid\n" ); exit( 0x11 ); } buf = malloc( size ); if ( !buf ) { - printf( "ERROR: can't malloc ROM\n" ); + fprintf( stderr, "ERROR: can't malloc ROM\n" ); exit( 0x12 ); } f = fopen( fullpath, "r" ); if ( !f ) { - printf( "ERROR: can't open ROM file\n" ); + fprintf( stderr, "ERROR: can't open ROM file\n" ); exit( 0x13 ); } if ( ( int )fread( buf, sizeof( char ), size, f ) != size ) { // pack_fread - printf( "ERROR: can't read ROM file\n" ); + fprintf( stderr, "ERROR: can't read ROM file\n" ); exit( 0x14 ); } fclose( f ); if ( buf[ 0 ] & 0xF0 || buf[ 1 ] & 0xF0 ) { if ( size == 1024 * 1024 ) { - printf( "ERROR: wrong ROM\n" ); + fprintf( stderr, "ERROR: wrong ROM\n" ); exit( 0x15 ); } buf = realloc( buf, size * 2 ); if ( !buf ) { - printf( "ERROR: can't realloc ROM\n" ); + fprintf( stderr, "ERROR: can't realloc ROM\n" ); exit( 0x16 ); } ptr1 = buf + size - 1; @@ -480,7 +480,6 @@ void rom_init( char* filename ) } bus_info.rom_data = buf; bus_info.rom_mask = size - 1; - printf( "rom_init succeed!\n" ); } void rom_exit( void )