plugins: use lcd_putsf/lcd_putsxyf

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27926 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-08-28 21:46:45 +00:00
parent 8418a2c94a
commit ab9fd1840b
52 changed files with 173 additions and 412 deletions

View file

@ -54,14 +54,12 @@ const struct custom_format format_null = {
.get_size = get_size_null .get_size = get_size_null
}; };
static char output_buf[256];
static int output_y = 0; static int output_y = 0;
static int font_h; static int font_h;
#define lcd_printf(...) \ #define lcd_printf(...) \
do { \ do { \
rb->snprintf(output_buf, sizeof(output_buf), __VA_ARGS__); \ rb->lcd_putsxyf(0, output_y, __VA_ARGS__); \
rb->lcd_putsxy(0, output_y, output_buf); \
rb->lcd_update_rect(0, output_y, LCD_WIDTH, font_h); \ rb->lcd_update_rect(0, output_y, LCD_WIDTH, font_h); \
output_y += font_h; \ output_y += font_h; \
} while (0) } while (0)

View file

@ -29,7 +29,6 @@ static unsigned char output;
static int output_y = 0; static int output_y = 0;
static int font_h; static int font_h;
static unsigned char *plugin_buf; static unsigned char *plugin_buf;
char output_buf[256];
struct img_part part; struct img_part part;
/* a null output plugin to save memory and better isolate scale cost */ /* a null output plugin to save memory and better isolate scale cost */
@ -77,8 +76,7 @@ const struct custom_format format_null = {
#define lcd_printf(...) \ #define lcd_printf(...) \
do { \ do { \
rb->snprintf(output_buf, sizeof(output_buf), __VA_ARGS__); \ rb->lcd_putsxyf(0, output_y, __VA_ARGS__); \
rb->lcd_putsxy(0, output_y, output_buf); \
rb->lcd_update_rect(0, output_y, LCD_WIDTH, font_h); \ rb->lcd_update_rect(0, output_y, LCD_WIDTH, font_h); \
output_y += font_h; \ output_y += font_h; \
} while (0) } while (0)

View file

@ -946,7 +946,6 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
signed int upper_limit, signed int upper_limit,
signed int start) { signed int start) {
int button; int button;
char str[9];
bool breakout = false, changed = false; bool breakout = false, changed = false;
unsigned int w, h; unsigned int w, h;
signed int amount; signed int amount;
@ -968,8 +967,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
#if LCD_HEIGHT <= 64 #if LCD_HEIGHT <= 64
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_puts(0, 1, message); rb->lcd_puts(0, 1, message);
rb->snprintf(str, 9, "$%d", amount); rb->lcd_putsf(0, 2, "$%d", amount);
rb->lcd_puts(0, 2, str);
rb->lcd_puts(0, 3, "RIGHT: +1"); rb->lcd_puts(0, 3, "RIGHT: +1");
rb->lcd_puts(0, 4, "LEFT: -1"); rb->lcd_puts(0, 4, "LEFT: -1");
rb->lcd_puts(0, 5, "UP: +10"); rb->lcd_puts(0, 5, "UP: +10");
@ -983,8 +981,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
rb->lcd_drawrect(LCD_WIDTH/2 - 9*w - 1, LCD_HEIGHT/2 - 4*h - 3, rb->lcd_drawrect(LCD_WIDTH/2 - 9*w - 1, LCD_HEIGHT/2 - 4*h - 3,
37*w / 2, 8*h -3); 37*w / 2, 8*h -3);
rb->lcd_putsxy(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 4*h - 1, message); rb->lcd_putsxy(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 4*h - 1, message);
rb->snprintf(str, 9, "$%d", amount); rb->lcd_putsxyf(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, "$%d", amount);
rb->lcd_putsxy(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, str);
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_3G_PAD) || \ (CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD) || \ (CONFIG_KEYPAD == IPOD_1G2G_PAD) || \
@ -1063,15 +1060,14 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
} }
if(changed) { if(changed) {
rb->snprintf(str, 9, "$%d", amount);
#if LCD_HEIGHT <= 64 #if LCD_HEIGHT <= 64
rb->lcd_puts(0, 2, str); rb->lcd_putsf(0, 2, "$%d", amount);
rb->lcd_update(); rb->lcd_update();
#else #else
rb->lcd_set_drawmode(DRMODE_BG+DRMODE_INVERSEVID); rb->lcd_set_drawmode(DRMODE_BG+DRMODE_INVERSEVID);
rb->lcd_fillrect(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, 5*w, h); rb->lcd_fillrect(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, 5*w, h);
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_putsxy(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, str); rb->lcd_putsxyf(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, "$%d", amount);
rb->lcd_update_rect(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, 5*w, h); rb->lcd_update_rect(LCD_WIDTH/2 - 9*w, LCD_HEIGHT/2 - 3*h, 5*w, h);
#endif #endif
changed = false; changed = false;

View file

@ -582,7 +582,6 @@ static int loopit(void)
int show=0; int show=0;
int timeout=0; int timeout=0;
char buffer[30];
rb->lcd_clear_display(); rb->lcd_clear_display();
while(1) while(1)
@ -628,9 +627,8 @@ static int loopit(void)
show=NUM_LAST-1; show=NUM_LAST-1;
break; break;
} }
rb->snprintf(buffer, 30, "%s: %d", rb->lcd_putsxyf(0, LCD_HEIGHT - 8, "%s: %d",
values[show].what, values[show].num); values[show].what, values[show].num);
rb->lcd_putsxy(0, LCD_HEIGHT - 8, (unsigned char *)buffer);
timeout--; timeout--;
} }
for(i=0, yy=y, xx=x; for(i=0, yy=y, xx=x;

View file

@ -1573,11 +1573,11 @@ static int brickmania_game_loop(void)
/* write life num */ /* write life num */
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
rb->snprintf(s, sizeof(s), "L:%d", life); #define LIFE_STR "L:%d"
#else #else
rb->snprintf(s, sizeof(s), "Life: %d", life); #define LIFE_STR "Life: %d"
#endif #endif
rb->lcd_putsxy(0, 0, s); rb->lcd_putsxyf(0, 0, LIFE_STR, life);
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
rb->snprintf(s, sizeof(s), "L%d", level+1); rb->snprintf(s, sizeof(s), "L%d", level+1);

View file

@ -451,7 +451,6 @@ static void draw_calendar(struct shown *shown)
int w, h; int w, h;
int x, y, pos, days_per_month, j; int x, y, pos, days_per_month, j;
int wday; int wday;
char buffer[12];
const char *monthname[] = { const char *monthname[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
@ -472,10 +471,6 @@ static void draw_calendar(struct shown *shown)
y = Y_OFFSET + h; y = Y_OFFSET + h;
for (j = 1; j <= days_per_month; j++) for (j = 1; j <= days_per_month; j++)
{ {
if ( (day_has_memo[j]) || (wday_has_memo[wday]) )
rb->snprintf(buffer, 4, "%02d.", j);
else
rb->snprintf(buffer, 4, "%02d", j);
if (shown->mday == j) if (shown->mday == j)
{ {
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
@ -487,7 +482,10 @@ static void draw_calendar(struct shown *shown)
{ {
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
} }
rb->lcd_putsxy(x, y, buffer); if ( (day_has_memo[j]) || (wday_has_memo[wday]) )
rb->lcd_putsxyf(x, y, "%02d.", j);
else
rb->lcd_putsxyf(x, y, "%02d", j);
x += CELL_WIDTH; x += CELL_WIDTH;
wday++; wday++;
if (wday >= 7) if (wday >= 7)
@ -504,9 +502,8 @@ static void draw_calendar(struct shown *shown)
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_vline(LCD_WIDTH-w*8-10, LCD_HEIGHT-h-3, LCD_HEIGHT-1); rb->lcd_vline(LCD_WIDTH-w*8-10, LCD_HEIGHT-h-3, LCD_HEIGHT-1);
rb->lcd_hline(LCD_WIDTH-w*8-10, LCD_WIDTH-1, LCD_HEIGHT-h-3); rb->lcd_hline(LCD_WIDTH-w*8-10, LCD_WIDTH-1, LCD_HEIGHT-h-3);
rb->snprintf(buffer, sizeof(buffer), "%s %04d", rb->lcd_putsxyf(LCD_WIDTH-w*8-8, LCD_HEIGHT-h-1, "%s %04d",
monthname[shown->mon-1], shown->year); monthname[shown->mon-1], shown->year);
rb->lcd_putsxy(LCD_WIDTH-w*8-8, LCD_HEIGHT-h-1, buffer);
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -408,23 +408,19 @@ static void clix_draw_cell(struct clix_game_state_t* state, const int x, const i
static void clix_draw(struct clix_game_state_t* state) static void clix_draw(struct clix_game_state_t* state)
{ {
int i,j; int i,j;
char str[30];
/* Clear screen */ /* Clear screen */
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_set_foreground( LCD_WHITE); rb->lcd_set_foreground( LCD_WHITE);
rb->lcd_putsxy( MARGIN, MARGIN, "Score:"); rb->lcd_putsxy( MARGIN, MARGIN, "Score:");
rb->snprintf( str, sizeof(str), "%d", state->score); rb->lcd_putsxyf( 43, MARGIN, "%d", state->score);
rb->lcd_putsxy( 43, MARGIN, str);
#if LCD_WIDTH <= 100 #if LCD_WIDTH <= 100
rb->lcd_putsxy( 75, MARGIN, "L:"); rb->lcd_putsxy( 75, MARGIN, "L:");
rb->snprintf( str, sizeof(str), "%d", state->level); rb->lcd_putsxyf( 90, MARGIN, "%d", state->level);
rb->lcd_putsxy( 90, MARGIN, str);
#else #else
rb->lcd_putsxy( 75, MARGIN, "Level:"); rb->lcd_putsxy( 75, MARGIN, "Level:");
rb->snprintf( str, sizeof(str), "%d", state->level); rb->lcd_putsxyf( 113, MARGIN, "%d", state->level);
rb->lcd_putsxy( 113, MARGIN, str);
#endif #endif
for( i = 0; i < BOARD_WIDTH; ++i) for( i = 0; i < BOARD_WIDTH; ++i)
{ {

View file

@ -174,7 +174,7 @@ static void draw_piece(int x, int y, int w, int h, int color_id, bool emph) {
if (settings.labeling && color_id >= 0) { if (settings.labeling && color_id >= 0) {
char text[2]; char text[2];
rb->snprintf(text, 2, "%d", color_id); rb->snprintf(text, sizeof(text), "%d", color_id);
int fw, fh; rb->font_getstringsize(text, &fw, &fh, FONT_SYSFIXED); int fw, fh; rb->font_getstringsize(text, &fw, &fh, FONT_SYSFIXED);
rb->lcd_putsxy(x + get_margin(fw, w), y + get_margin(fh, h), text); rb->lcd_putsxy(x + get_margin(fw, w), y + get_margin(fh, h), text);

View file

@ -331,10 +331,8 @@ static void roll_credits(void)
rb->lcd_putsxy(CREDITS_TARGETPOS, 0, elapsednames); rb->lcd_putsxy(CREDITS_TARGETPOS, 0, elapsednames);
for(i=0; i<NUM_VISIBLE_LINES; i++) for(i=0; i<NUM_VISIBLE_LINES; i++)
{ rb->lcd_putsxyf(0, font_h*(i+1), "%s", credits[j+i]);
rb->snprintf(name, sizeof(name), "%s", credits[j+i]);
rb->lcd_putsxy(0, font_h*(i+1), name);
}
rb->lcd_update(); rb->lcd_update();
rb->yield(); rb->yield();

View file

@ -701,10 +701,9 @@ enum plugin_status plugin_start(const void* parameter)
if (t_disp == DISP_TIME) if (t_disp == DISP_TIME)
{ {
rb->lcd_puts(5, 0, axes[curr].label); rb->lcd_puts(5, 0, axes[curr].label);
rb->snprintf(buffer, sizeof(buffer), "%d %c", rb->lcd_putsf(5, 1, "%d %c",
paused ? axes[curr].angle : axes[curr].speed, paused ? axes[curr].angle : axes[curr].speed,
highspeed ? 'H' : ' '); highspeed ? 'H' : ' ');
rb->lcd_puts(5, 1, buffer);
} }
t_disp--; t_disp--;
if (t_disp == 0) if (t_disp == 0)

View file

@ -160,15 +160,12 @@ bool tidy_remove_item(char *item, int attr)
void tidy_lcd_status(const char *name, int *removed) void tidy_lcd_status(const char *name, int *removed)
{ {
char text[24]; /* "Cleaned up nnnnn items" */
/* display status text */ /* display status text */
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_puts(0, 0, "Working ..."); rb->lcd_puts(0, 0, "Working ...");
rb->lcd_puts(0, 1, name); rb->lcd_puts(0, 1, name);
rb->snprintf(text, 24, "Cleaned up %d items", *removed);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
rb->lcd_puts(0, 2, text); rb->lcd_putsf(0, 2, "Cleaned up %d items", *removed);
#endif #endif
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -556,8 +556,6 @@ int WaitForButton(void)
/* helper for DoUserDialog() */ /* helper for DoUserDialog() */
void ShowFlashInfo(tFlashInfo* pInfo) void ShowFlashInfo(tFlashInfo* pInfo)
{ {
char buf[32];
if (!pInfo->manufacturer) if (!pInfo->manufacturer)
{ {
rb->lcd_puts(0, 0, "Flash: M=?? D=??"); rb->lcd_puts(0, 0, "Flash: M=?? D=??");
@ -565,16 +563,14 @@ void ShowFlashInfo(tFlashInfo* pInfo)
} }
else else
{ {
rb->snprintf(buf, sizeof(buf), "Flash: M=%02x D=%02x", rb->lcd_putsf(0, 0, "Flash: M=%02x D=%02x",
pInfo->manufacturer, pInfo->id); pInfo->manufacturer, pInfo->id);
rb->lcd_puts(0, 0, buf);
if (pInfo->size) if (pInfo->size)
{ {
rb->lcd_puts(0, 1, pInfo->name); rb->lcd_puts(0, 1, pInfo->name);
rb->snprintf(buf, sizeof(buf), "Size: %d KB", pInfo->size / 1024); rb->lcd_puts(0, 2, "Size: %d KB", pInfo->size / 1024);
rb->lcd_puts(0, 2, buf);
} }
else else
{ {
@ -591,7 +587,6 @@ void ShowFlashInfo(tFlashInfo* pInfo)
void DoUserDialog(char* filename) void DoUserDialog(char* filename)
{ {
tFlashInfo FlashInfo; tFlashInfo FlashInfo;
char buf[32];
char default_filename[32]; char default_filename[32];
int button; int button;
int rc; /* generic return code */ int rc; /* generic return code */
@ -761,8 +756,7 @@ void DoUserDialog(char* filename)
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_puts(0, 0, "Panic:"); rb->lcd_puts(0, 0, "Panic:");
rb->lcd_puts(0, 1, "Programming fail!"); rb->lcd_puts(0, 1, "Programming fail!");
rb->snprintf(buf, sizeof(buf), "%d errors", rc); rb->lcd_putsf(0, 2, "%d errors", rc);
rb->lcd_puts(0, 2, buf);
rb->lcd_update(); rb->lcd_update();
button = WaitForButton(); button = WaitForButton();
} }
@ -782,8 +776,7 @@ void DoUserDialog(char* filename)
{ {
rb->lcd_puts(0, 0, "Panic:"); rb->lcd_puts(0, 0, "Panic:");
rb->lcd_puts(0, 1, "Verify fail!"); rb->lcd_puts(0, 1, "Verify fail!");
rb->snprintf(buf, sizeof(buf), "%d errors", rc); rb->lcd_putsf(0, 2, "%d errors", rc);
rb->lcd_puts(0, 2, buf);
} }
rb->lcd_puts(0, 7, "Any key to exit"); rb->lcd_puts(0, 7, "Any key to exit");
rb->lcd_update(); rb->lcd_update();

View file

@ -496,11 +496,8 @@ static void draw_cursor(void)
/* draw the info panel ... duh */ /* draw the info panel ... duh */
static void draw_info_panel(void) static void draw_info_panel(void)
{ {
char s[16];
rb->lcd_puts( 6, 0, "Flips" ); rb->lcd_puts( 6, 0, "Flips" );
rb->snprintf( s, sizeof(s), "%d", moves ); rb->lcd_putsf( 6, 1, "%d", moves );
rb->lcd_puts( 6, 1, s );
} }
#endif /* LCD */ #endif /* LCD */

View file

@ -120,7 +120,6 @@
/******************************* Globals ***********************************/ /******************************* Globals ***********************************/
GREY_INFO_STRUCT GREY_INFO_STRUCT
static char pbuf[32]; /* global printf buffer */
static unsigned char *gbuf; static unsigned char *gbuf;
static size_t gbuf_size = 0; static size_t gbuf_size = 0;
@ -298,9 +297,7 @@ int main(void)
time = *rb->current_tick - time; /* end time measurement */ time = *rb->current_tick - time; /* end time measurement */
rb->snprintf(pbuf, sizeof(pbuf), "Shades: 129, %d.%02ds", rb->lcd_putsf(0, 0, "Shades: 129, %d.%02ds", time / 100, time % 100);
time / 100, time % 100);
rb->lcd_puts(0, 0, pbuf);
grey_deferred_lcd_update(); /* schedule an lcd_update() */ grey_deferred_lcd_update(); /* schedule an lcd_update() */
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false); rb->cpu_boost(false);

View file

@ -209,11 +209,8 @@ int load_image(char *filename, struct image_info *info,
if (!running_slideshow) if (!running_slideshow)
{ {
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_update(); rb->lcd_putsf(0, 1, "loading %dx%d%s",
rb->snprintf(print, sizeof(print), "loading %dx%d%s",
bmp.width, bmp.height, ds == 1?"":"(resize on load)"); bmp.width, bmp.height, ds == 1?"":"(resize on load)");
rb->lcd_puts(0, 1, print);
rb->lcd_update(); rb->lcd_update();
} }
@ -260,8 +257,7 @@ int load_image(char *filename, struct image_info *info,
if (!running_slideshow) if (!running_slideshow)
{ {
rb->snprintf(print, sizeof(print), "image %dx%d", bmp.width, bmp.height); rb->lcd_putsf(0, 2, "image %dx%d", bmp.width, bmp.height);
rb->lcd_puts(0, 2, print);
rb->lcd_update(); rb->lcd_update();
} }
@ -308,9 +304,7 @@ int get_image(struct image_info *info, int ds)
if (!running_slideshow) if (!running_slideshow)
{ {
rb->snprintf(print, sizeof(print), "resizing %d*%d", rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
info->width, info->height);
rb->lcd_puts(0, 3, print);
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -97,7 +97,6 @@ static fb_data rgb_linebuf[LCD_WIDTH]; /* Line buffer for scrolling when
#endif #endif
/* my memory pool (from the mp3 buffer) */ /* my memory pool (from the mp3 buffer) */
static char print[32]; /* use a common snprintf() buffer */
/* the remaining free part of the buffer for loaded+resized images */ /* the remaining free part of the buffer for loaded+resized images */
static unsigned char* buf; static unsigned char* buf;
static size_t buf_size; static size_t buf_size;
@ -777,9 +776,7 @@ static int load_and_show(char* filename, struct image_info *info)
if(!running_slideshow) if(!running_slideshow)
{ {
rb->snprintf(print, sizeof(print), "showing %dx%d", rb->lcd_putsf(0, 3, "showing %dx%d", info->width, info->height);
info->width, info->height);
rb->lcd_puts(0, 3, print);
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -157,10 +157,7 @@ int load_image(char *filename, struct image_info *info,
if(!running_slideshow) if(!running_slideshow)
{ {
rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1);
rb->lcd_update(); rb->lcd_putsf(0, 1, "loading %d bytes", filesize);
rb->snprintf(print, sizeof(print), "loading %d bytes", filesize);
rb->lcd_puts(0, 1, print);
rb->lcd_update(); rb->lcd_update();
} }
@ -195,9 +192,7 @@ int load_image(char *filename, struct image_info *info,
if(!running_slideshow) if(!running_slideshow)
{ {
rb->snprintf(print, sizeof(print), "image %dx%d", rb->lcd_putsf(0, 2, "image %dx%d", p_jpg->x_size, p_jpg->y_size);
p_jpg->x_size, p_jpg->y_size);
rb->lcd_puts(0, 2, print);
rb->lcd_update(); rb->lcd_update();
} }
@ -269,9 +264,7 @@ int get_image(struct image_info *info, int ds)
if(!running_slideshow) if(!running_slideshow)
{ {
rb->snprintf(print, sizeof(print), "decoding %d*%d", rb->lcd_putsf(0, 3, "decoding %d*%d", info->width, info->height);
info->width, info->height);
rb->lcd_puts(0, 3, print);
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -1359,8 +1359,7 @@ int load_image(char *filename, struct image_info *info,
} else { } else {
if (!running_slideshow) { if (!running_slideshow) {
rb->snprintf(print, sizeof(print), "loading %lu bytes", (unsigned long)image_size); rb->lcd_putsf(0, 1, "loading %zu bytes", image_size);
rb->lcd_puts(0, 1, print);
rb->lcd_update(); rb->lcd_update();
} }
@ -1388,14 +1387,10 @@ int load_image(char *filename, struct image_info *info,
if (!decoder->error) { if (!decoder->error) {
if (!running_slideshow) { if (!running_slideshow) {
rb->snprintf(print, sizeof(print), "image %dx%d", rb->lcd_putsf(0, 2, "image %dx%d",
decoder->infoPng.width, decoder->infoPng.height); decoder->infoPng.width, decoder->infoPng.height);
rb->lcd_puts(0, 2, print); rb->lcd_putsf(0, 3, "decoding %d*%d",
rb->lcd_update();
rb->snprintf(print, sizeof(print), "decoding %d*%d",
decoder->infoPng.width, decoder->infoPng.height); decoder->infoPng.width, decoder->infoPng.height);
rb->lcd_puts(0, 3, print);
rb->lcd_update(); rb->lcd_update();
} }
@ -1481,9 +1476,7 @@ int get_image(struct image_info *info, int ds)
if (ds > 1) { if (ds > 1) {
if (!running_slideshow) if (!running_slideshow)
{ {
rb->snprintf(print, sizeof(print), "resizing %d*%d", rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
info->width, info->height);
rb->lcd_puts(0, 3, print);
rb->lcd_update(); rb->lcd_update();
} }
struct bitmap bmp_src, bmp_dst; struct bitmap bmp_src, bmp_dst;

View file

@ -187,8 +187,6 @@ int wait_for_button(void)
/* helper for DoUserDialog() */ /* helper for DoUserDialog() */
void ShowFlashInfo(struct flash_info* pInfo) void ShowFlashInfo(struct flash_info* pInfo)
{ {
char buf[32];
if (!pInfo->manufacturer) if (!pInfo->manufacturer)
{ {
rb->lcd_puts(0, 0, "Flash: M=?? D=??"); rb->lcd_puts(0, 0, "Flash: M=?? D=??");
@ -196,16 +194,14 @@ void ShowFlashInfo(struct flash_info* pInfo)
} }
else else
{ {
rb->snprintf(buf, sizeof(buf), "Flash: M=%02x D=%02x", rb->lcd_putsf(0, 0, "Flash: M=%02x D=%02x",
pInfo->manufacturer, pInfo->id); pInfo->manufacturer, pInfo->id);
rb->lcd_puts(0, 0, buf);
if (pInfo->size) if (pInfo->size)
{ {
rb->lcd_puts(0, 1, pInfo->name); rb->lcd_puts(0, 1, pInfo->name);
rb->snprintf(buf, sizeof(buf), "Size: %d KB", pInfo->size / 1024); rb->lcd_putsf(0, 2, "Size: %d KB", pInfo->size / 1024);
rb->lcd_puts(0, 2, buf);
} }
else else
{ {
@ -235,11 +231,9 @@ bool show_info(void)
bool confirm(const char *msg) bool confirm(const char *msg)
{ {
char buf[128];
bool ret; bool ret;
rb->snprintf(buf, sizeof buf, "%s ([PLAY] to CONFIRM)", msg); rb->splashf(0, "%s ([PLAY] to CONFIRM)", msg);
rb->splash(0, buf);
ret = (wait_for_button() == BUTTON_ON); ret = (wait_for_button() == BUTTON_ON);
show_info(); show_info();
@ -338,7 +332,6 @@ static int get_section_address(int section)
int flash_rockbox(const char *filename, int section) int flash_rockbox(const char *filename, int section)
{ {
struct flash_header hdr; struct flash_header hdr;
char buf[64];
int pos, i, len, rc; int pos, i, len, rc;
unsigned long checksum, sum; unsigned long checksum, sum;
unsigned char *p8; unsigned char *p8;
@ -378,9 +371,8 @@ int flash_rockbox(const char *filename, int section)
if (pos+sizeof(struct flash_header) != *p32) if (pos+sizeof(struct flash_header) != *p32)
{ {
rb->snprintf(buf, sizeof(buf), "Incorrect relocation: 0x%08lx/0x%08lx", rb->splashf(HZ*10, "Incorrect relocation: 0x%08lx/0x%08lx",
*p32, pos+sizeof(struct flash_header)); *p32, pos+sizeof(struct flash_header));
rb->splash(HZ*10, buf);
return -1; return -1;
} }
@ -393,9 +385,7 @@ int flash_rockbox(const char *filename, int section)
if (i + pos < SEC_SIZE) if (i + pos < SEC_SIZE)
return -1; return -1;
rb->snprintf(buf, sizeof(buf), "Erasing... %d%%", rb->lcd_putsf(0, 3, "Erasing... %d%%", (i+SEC_SIZE)*100/len);
(i+SEC_SIZE)*100/len);
rb->lcd_puts(0, 3, buf);
rb->lcd_update(); rb->lcd_update();
rc = cfi_erase_sector(FB + (i + pos)/2); rc = cfi_erase_sector(FB + (i + pos)/2);
@ -408,8 +398,7 @@ int flash_rockbox(const char *filename, int section)
// rb->strncpy(hdr.version, rb->rbversion , sizeof(hdr.version)-1); // rb->strncpy(hdr.version, rb->rbversion , sizeof(hdr.version)-1);
p16 = (uint16_t *)&hdr; p16 = (uint16_t *)&hdr;
rb->snprintf(buf, sizeof(buf), "Programming..."); rb->lcd_puts(0, 4, "Programming...");
rb->lcd_puts(0, 4, buf);
rb->lcd_update(); rb->lcd_update();
pos = get_section_address(section)/2; pos = get_section_address(section)/2;
@ -424,9 +413,7 @@ int flash_rockbox(const char *filename, int section)
{ {
if (i % SEC_SIZE == 0) if (i % SEC_SIZE == 0)
{ {
rb->snprintf(buf, sizeof(buf), "Programming... %d%%", rb->lcd_putsf(0, 4, "Programming... %d%%", (i+1)*100/(len/2));
(i+1)*100/(len/2));
rb->lcd_puts(0, 4, buf);
rb->lcd_update(); rb->lcd_update();
} }
@ -434,8 +421,7 @@ int flash_rockbox(const char *filename, int section)
} }
/* Verify */ /* Verify */
rb->snprintf(buf, sizeof(buf), "Verifying"); rb->lcd_puts(0, 5, "Verifying");
rb->lcd_puts(0, 5, buf);
rb->lcd_update(); rb->lcd_update();
p8 = (char *)get_section_address(section); p8 = (char *)get_section_address(section);
@ -560,13 +546,10 @@ int flash_bootloader(const char *filename)
int flash_original_fw(int len) int flash_original_fw(int len)
{ {
unsigned char reset_vector[8]; unsigned char reset_vector[8];
char buf[32];
int pos, i, rc; int pos, i, rc;
unsigned char *p8; unsigned char *p8;
uint16_t *p16; uint16_t *p16;
(void)buf;
rb->lcd_puts(0, 3, "Critical section..."); rb->lcd_puts(0, 3, "Critical section...");
rb->lcd_update(); rb->lcd_update();
@ -586,13 +569,11 @@ int flash_original_fw(int len)
for (i = 1; i < BOOTLOADER_ERASEGUARD && (i-1)*4096 < len; i++) for (i = 1; i < BOOTLOADER_ERASEGUARD && (i-1)*4096 < len; i++)
{ {
rc = cfi_erase_sector(FB + (SEC_SIZE/2) * i); rc = cfi_erase_sector(FB + (SEC_SIZE/2) * i);
rb->snprintf(buf, sizeof(buf), "Erase: 0x%03x (%d)", i, rc); rb->lcd_putsf(0, 5, "Erase: 0x%03x (%d)", i, rc);
rb->lcd_puts(0, 5, buf);
rb->lcd_update(); rb->lcd_update();
} }
rb->snprintf(buf, sizeof(buf), "Programming"); rb->lcd_puts(0, 6, "Programming");
rb->lcd_puts(0, 6, buf);
rb->lcd_update(); rb->lcd_update();
pos = 0x00000008/2; pos = 0x00000008/2;
@ -600,8 +581,7 @@ int flash_original_fw(int len)
for (i = 0; i < len/2 && pos + i < (BOOTLOADER_ENTRYPOINT/2); i++) for (i = 0; i < len/2 && pos + i < (BOOTLOADER_ENTRYPOINT/2); i++)
cfi_program_word(FB + pos + i, p16[i]); cfi_program_word(FB + pos + i, p16[i]);
rb->snprintf(buf, sizeof(buf), "Verifying"); rb->lcd_puts(0, 7, "Verifying");
rb->lcd_puts(0, 7, buf);
rb->lcd_update(); rb->lcd_update();
/* Verify reset vectors. */ /* Verify reset vectors. */
@ -623,8 +603,7 @@ int flash_original_fw(int len)
if (p8[i] != audiobuf[i]) if (p8[i] != audiobuf[i])
{ {
rb->splash(HZ*3, "Verify failed!"); rb->splash(HZ*3, "Verify failed!");
rb->snprintf(buf, sizeof buf, "at: 0x%08x", i); rb->splashf(HZ*10, "at: 0x%08x", i);
rb->splash(HZ*10, buf);
return -5; return -5;
} }
} }

View file

@ -629,8 +629,7 @@ static void jewels_drawboard(struct game_context* bj) {
#endif #endif
/* print text */ /* print text */
rb->snprintf(str, 10, "%s %d", title, bj->level); rb->lcd_putsxyf(1, LCD_HEIGHT-10, "%s %d", title, bj->level);
rb->lcd_putsxy(1, LCD_HEIGHT-10, str);
if (bj->type == GAME_TYPE_NORMAL) { if (bj->type == GAME_TYPE_NORMAL) {
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score); rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
@ -671,8 +670,8 @@ static void jewels_drawboard(struct game_context* bj) {
#endif #endif
/* print text */ /* print text */
rb->snprintf(str, 10, "%s %d", title, bj->level); rb->lcd_putsxyf(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3,"%s %d",
rb->lcd_putsxy(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str); title, bj->level);
if (bj->type == GAME_TYPE_NORMAL) { if (bj->type == GAME_TYPE_NORMAL) {
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score); rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);

View file

@ -125,7 +125,6 @@ void highscore_show(int position, struct highscore *scores, int num_scores,
bool show_level) bool show_level)
{ {
int i, w, h; int i, w, h;
char str[30];
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
unsigned bgcolor = rb->lcd_get_background(); unsigned bgcolor = rb->lcd_get_background();
unsigned fgcolor = rb->lcd_get_foreground(); unsigned fgcolor = rb->lcd_get_foreground();
@ -155,14 +154,11 @@ void highscore_show(int position, struct highscore *scores, int num_scores,
rb->lcd_set_foreground(LCD_RGBPACK(245,0,0)); rb->lcd_set_foreground(LCD_RGBPACK(245,0,0));
} }
#endif #endif
rb->snprintf (str, sizeof (str), "%d)", i+1); rb->lcd_putsxyf (MARGIN,3*h + h*i, "%d)", i+1);
rb->lcd_putsxy (MARGIN,3*h + h*i, str); rb->lcd_putsxyf (LCD_WIDTH/4-w/4,3*h + h*i, "%d", scores[i].score);
rb->snprintf (str, sizeof (str), "%d", scores[i].score);
rb->lcd_putsxy (LCD_WIDTH/4-w/4,3*h + h*i, str);
if(show_level) { if(show_level) {
rb->snprintf (str, sizeof (str), "%d", scores[i].level); rb->lcd_putsxyf (LCD_WIDTH*3/4-w/4,3*h + h*i, "%d", scores[i].level);
rb->lcd_putsxy (LCD_WIDTH*3/4-w/4,3*h + h*i, str);
} }
if(i == position) { if(i == position) {

View file

@ -2137,15 +2137,13 @@ void set_scale_facs(int *mdct_freq)
void compress(void) void compress(void)
{ {
int i, gr, gr_cnt; int i, gr, gr_cnt;
char stg[20];
uint32_t max; uint32_t max;
while(1) while(1)
{ {
if((frames & 7) == 0) if((frames & 7) == 0)
{ rb->lcd_clear_display(); { rb->lcd_clear_display();
rb->snprintf(stg, 20, "Frame %d / %d", frames, wav_size/SAMPL2/8); rb->lcd_putsxyf(4, 20, "Frame %d / %d", frames, wav_size/SAMPL2/8);
rb->lcd_putsxy(4, 20, stg);
rb->lcd_update(); rb->lcd_update();
} }
/* encode one mp3 frame in this loop */ /* encode one mp3 frame in this loop */
@ -2496,7 +2494,6 @@ enum plugin_status plugin_start(const void* parameter)
int rat, srat, nrat; /* for rate selection */ int rat, srat, nrat; /* for rate selection */
int cont = 1, butt; int cont = 1, butt;
long tim = 0; long tim = 0;
char stg[40];
static const char* bstrg[] = { static const char* bstrg[] = {
"64", "80", "96", "112", "128", "160", "192", "224", "256", "320" "64", "80", "96", "112", "128", "160", "192", "224", "256", "320"
}; };
@ -2568,18 +2565,15 @@ enum plugin_status plugin_start(const void* parameter)
else else
{ {
rb->close(wavfile); rb->close(wavfile);
rb->snprintf(stg, 20, "WaveOpen failed %d", wave_open()); rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", wave_open());
rb->lcd_putsxy(0, 20, stg);
rb->lcd_update(); rb->lcd_update();
rb->sleep(5*HZ); rb->sleep(5*HZ);
} }
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->snprintf(stg, 30, " Conversion: %ld.%02lds ", tim/100, tim%100); rb->lcd_putsxyf(0, 30, " Conversion: %ld.%02lds ", tim/100, tim%100);
rb->lcd_putsxy(0, 30, stg);
tim = frames * SAMP_PER_FRAME * 100 / 44100; /* unit=.01s */ tim = frames * SAMP_PER_FRAME * 100 / 44100; /* unit=.01s */
rb->snprintf(stg, 30, " WAV-Length: %ld.%02lds ", tim/100, tim%100); rb->lcd_putsxyf(0, 20, " WAV-Length: %ld.%02lds ", tim/100, tim%100);
rb->lcd_putsxy(0, 20, stg);
rb->lcd_update(); rb->lcd_update();
rb->sleep(5*HZ); rb->sleep(5*HZ);
} }

View file

@ -56,7 +56,6 @@ static unsigned char pattern3[]={0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15}; /*3
static unsigned char pattern2[]={0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}; /*2 parts*/ static unsigned char pattern2[]={0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}; /*2 parts*/
static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/ static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/
static unsigned char str[12]; /*String use to display the first line*/
static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/ static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/
static bool end; /*If true game is finished*/ static bool end; /*If true game is finished*/
@ -101,8 +100,7 @@ static void display_first_line(int x)
{ {
int i; int i;
rb->snprintf(str,sizeof(str)," =%d",x); rb->lcd_putsf(0,0," =%d",x);
rb->lcd_puts(0,0,str);
rb->lcd_define_pattern(h1,pattern3); rb->lcd_define_pattern(h1,pattern3);
for (i=0;i<x/3;i++) for (i=0;i<x/3;i++)
@ -179,8 +177,7 @@ enum plugin_status plugin_start(const void* parameter)
y=1; y=1;
display_first_line(x); display_first_line(x);
rb->snprintf(str,sizeof(str),"[%d..%d]?=%d",min,v,y); rb->lcd_putsf(0,1,"[%d..%d]?=%d",min,v,y);
rb->lcd_puts(0,1,str);
rb->lcd_update(); rb->lcd_update();
go=false; go=false;
@ -215,8 +212,7 @@ enum plugin_status plugin_start(const void* parameter)
break; break;
} }
display_first_line(x); display_first_line(x);
rb->snprintf(str,sizeof(str),"[%d..%d]?=%d",min,v,y); rb->lcd_putsf(0,1,"[%d..%d]?=%d",min,v,y);
rb->lcd_puts(0,1,str);
rb->lcd_update(); rb->lcd_update();
} }
@ -276,8 +272,7 @@ enum plugin_status plugin_start(const void* parameter)
} }
v=y*2; v=y*2;
x-=y; x-=y;
rb->snprintf(str,sizeof(str),"I take=%d",y); rb->lcd_putsf(0,1,"I take=%d",y);
rb->lcd_puts(0,1,str);
rb->lcd_update(); rb->lcd_update();
rb->sleep(HZ); rb->sleep(HZ);
} }

View file

@ -367,7 +367,6 @@ static void stop_sound(void)
static int gameProc( void ) static int gameProc( void )
{ {
int fps; int fps;
char str[80];
int status; int status;
long end_time; long end_time;
int frame_counter = 0; int frame_counter = 0;
@ -469,9 +468,7 @@ static int gameProc( void )
if (settings.showfps) { if (settings.showfps) {
fps = (video_frames*HZ*100) / (*rb->current_tick-start_time); fps = (video_frames*HZ*100) / (*rb->current_tick-start_time);
rb->snprintf(str,sizeof(str),"%d.%02d / %d fps ", rb->lcd_putsxyf(0,0,"%d.%02d / %d fps ",fps/100,fps%100,FPS);
fps/100,fps%100,FPS);
rb->lcd_putsxy(0,0,str);
} }
#if !defined(HAVE_LCD_MODES) || \ #if !defined(HAVE_LCD_MODES) || \

View file

@ -773,7 +773,6 @@ static void pegbox_draw_board(struct game_context* pb)
{ {
unsigned int r, c, type; unsigned int r, c, type;
pb->num_left = 0; pb->num_left = 0;
char str[5];
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef WIDE_LAYOUT #ifdef WIDE_LAYOUT
@ -819,15 +818,11 @@ static void pegbox_draw_board(struct game_context* pb)
} }
#ifdef WIDE_LAYOUT #ifdef WIDE_LAYOUT
rb->snprintf(str, 3, "%d", pb->level); rb->lcd_putsxyf(TEXT_X, LEVEL_TEXT_Y, "%d", pb->level);
rb->lcd_putsxy(TEXT_X, LEVEL_TEXT_Y, str); rb->lcd_putsxyf(TEXT_X, PEGS_TEXT_Y, "%d", pb->num_left);
rb->snprintf(str, 3, "%d", pb->num_left);
rb->lcd_putsxy(TEXT_X, PEGS_TEXT_Y, str);
#else #else
rb->snprintf(str, 3, "%d", pb->level); rb->lcd_putsxyf(LEVEL_TEXT_X, TEXT_Y, "%d", pb->level);
rb->lcd_putsxy(LEVEL_TEXT_X, TEXT_Y, str); rb->lcd_putsxyf(PEGS_TEXT_X, TEXT_Y, "%d", pb->num_left);
rb->snprintf(str, 3, "%d", pb->num_left);
rb->lcd_putsxy(PEGS_TEXT_X, TEXT_Y, str);
#endif /*WIDE_LAYOUT*/ #endif /*WIDE_LAYOUT*/
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR

View file

@ -613,7 +613,6 @@ enum plugin_status plugin_start(const void *parameter) {
int lastbutton = BUTTON_NONE; int lastbutton = BUTTON_NONE;
int row, col; int row, col;
int w_cnt, b_cnt; int w_cnt, b_cnt;
char msg_buf[30];
/* Initialize Font Width and height */ /* Initialize Font Width and height */
rb->lcd_getstringsize("0", &font_width, &font_height); rb->lcd_getstringsize("0", &font_width, &font_height);
@ -671,10 +670,8 @@ enum plugin_status plugin_start(const void *parameter) {
/* TODO: Don't duplicate end of game check */ /* TODO: Don't duplicate end of game check */
if (reversi_game_is_finished(&game, cur_player)) { if (reversi_game_is_finished(&game, cur_player)) {
reversi_count_occupied_cells(&game, &w_cnt, &b_cnt); reversi_count_occupied_cells(&game, &w_cnt, &b_cnt);
rb->snprintf(msg_buf, sizeof(msg_buf), rb->splashf(HZ*2, "Game over. %s won.",
"Game over. %s won.",
(w_cnt>b_cnt?"WHITE":"BLACK")); (w_cnt>b_cnt?"WHITE":"BLACK"));
rb->splash(HZ*2, msg_buf);
draw_screen = true; /* Must update screen after splash */ draw_screen = true; /* Must update screen after splash */
game_finished = true; game_finished = true;
} }
@ -743,10 +740,8 @@ enum plugin_status plugin_start(const void *parameter) {
cur_player = reversi_flipped_color(cur_player); cur_player = reversi_flipped_color(cur_player);
if (reversi_game_is_finished(&game, cur_player)) { if (reversi_game_is_finished(&game, cur_player)) {
reversi_count_occupied_cells(&game, &w_cnt, &b_cnt); reversi_count_occupied_cells(&game, &w_cnt, &b_cnt);
rb->snprintf(msg_buf, sizeof(msg_buf), rb->splashf(HZ*2, "Game over. %s won.",
"Game over. %s won.",
(w_cnt>b_cnt?"WHITE":"BLACK")); (w_cnt>b_cnt?"WHITE":"BLACK"));
rb->splash(HZ*2, msg_buf);
draw_screen = true; /* Must update screen after splash */ draw_screen = true; /* Must update screen after splash */
game_finished = true; game_finished = true;
} }

View file

@ -598,11 +598,9 @@ int screen[X_MAX + 1][Y_MAX + 1];
* *
*****************************************************************************/ *****************************************************************************/
static void drawchar(int x, int y, char c) static inline void drawchar(int x, int y, char c)
{ {
char str[2]; rb->lcd_putsxyf(x*SYSFONT_WIDTH, y*SYSFONT_HEIGHT, "%c", c);
rb->snprintf(str, sizeof(str), "%c", c);
rb->lcd_putsxy(x*SYSFONT_WIDTH, y*SYSFONT_HEIGHT, str);
} }
static void draw(struct screen_object o) static void draw(struct screen_object o)

View file

@ -810,25 +810,18 @@ static void init_board (void)
/* show the score, level and lines */ /* show the score, level and lines */
static void show_details (void) static void show_details (void)
{ {
char str[25]; /* for strings */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#if LCD_DEPTH >= 2 #if LCD_DEPTH >= 2
rb->lcd_set_foreground (LCD_BLACK); rb->lcd_set_foreground (LCD_BLACK);
rb->lcd_set_background (LCD_WHITE); rb->lcd_set_background (LCD_WHITE);
#endif #endif
rb->snprintf (str, sizeof (str), "%d", rockblox_status.score); rb->lcd_putsxyf (LABEL_X, SCORE_Y, "%d", rockblox_status.score);
rb->lcd_putsxy (LABEL_X, SCORE_Y, str); rb->lcd_putsxyf (LEVEL_X, LEVEL_Y, "%d", rockblox_status.level);
rb->snprintf (str, sizeof (str), "%d", rockblox_status.level); rb->lcd_putsxyf (LINES_X, LINES_Y, "%d", rockblox_status.lines);
rb->lcd_putsxy (LEVEL_X, LEVEL_Y, str);
rb->snprintf (str, sizeof (str), "%d", rockblox_status.lines);
rb->lcd_putsxy (LINES_X, LINES_Y, str);
#else /* HAVE_LCD_CHARCELLS */ #else /* HAVE_LCD_CHARCELLS */
rb->snprintf (str, sizeof (str), "L%d/%d", rockblox_status.level, rb->lcd_putsf (5, 0, "L%d/%d", rockblox_status.level,
rockblox_status.lines); rockblox_status.lines);
rb->lcd_puts (5, 0, str); rb->lcd_putsf (5, 1, "S%d", rockblox_status.score);
rb->snprintf (str, sizeof (str), "S%d", rockblox_status.score);
rb->lcd_puts (5, 1, str);
#endif #endif
} }
@ -836,14 +829,10 @@ static void show_details (void)
static void show_highscores (void) static void show_highscores (void)
{ {
int i; int i;
char str[25]; /* for strings */
for (i = 0; i<NUM_SCORES; i++) for (i = 0; i<NUM_SCORES; i++)
{ rb->lcd_putsxyf (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * i),
rb->snprintf (str, sizeof (str), "%06d" _SPACE "L%1d", "%06d" _SPACE "L%1d", highscores[i].score, highscores[i].level);
highscores[i].score, highscores[i].level);
rb->lcd_putsxy (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * i), str);
}
} }
#endif #endif

View file

@ -206,7 +206,6 @@ enum plugin_status plugin_start(const void* parameter)
int type_next_brick = 0; int type_next_brick = 0;
unsigned long int score = 34126; unsigned long int score = 34126;
char score_buf[10];
(void)parameter; (void)parameter;
@ -278,8 +277,7 @@ enum plugin_status plugin_start(const void* parameter)
} }
/* Score box */ /* Score box */
rb->snprintf(score_buf, sizeof(score_buf), "%8ld0", score); rb->lcd_putsxyf(score_x, SCORE_Y, "%8ld0", score);
rb->lcd_putsxy(score_x, SCORE_Y, score_buf);
rb->lcd_update(); rb->lcd_update();

View file

@ -559,7 +559,6 @@ static void DoUserDialog(char* filename)
{ {
tImageHeader ImageHeader; tImageHeader ImageHeader;
tFlashInfo FlashInfo; tFlashInfo FlashInfo;
static char buf[MAX_PATH];
int button; int button;
int rc; /* generic return code */ int rc; /* generic return code */
UINT32 space, aligned_size, true_size; UINT32 space, aligned_size, true_size;
@ -612,8 +611,7 @@ static void DoUserDialog(char* filename)
bl_version = BootloaderVersion(); bl_version = BootloaderVersion();
if (bl_version < LATEST_BOOTLOADER_VERSION) if (bl_version < LATEST_BOOTLOADER_VERSION)
{ {
rb->snprintf(buf, sizeof(buf), "Bootloader V%d", bl_version); rb->lcd_putsf(0, 0, "Bootloader V%d", bl_version);
rb->lcd_puts(0, 0, buf);
rb->lcd_puts(0, 1, "Hint: You're not "); rb->lcd_puts(0, 1, "Hint: You're not ");
rb->lcd_puts(0, 2, "using the latest "); rb->lcd_puts(0, 2, "using the latest ");
rb->lcd_puts(0, 3, "bootloader. "); rb->lcd_puts(0, 3, "bootloader. ");
@ -722,10 +720,9 @@ static void DoUserDialog(char* filename)
if (rc) if (rc)
{ /* errors */ { /* errors */
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->snprintf(buf, sizeof(buf), "%d errors", rc);
rb->lcd_puts(0, 0, "Error:"); rb->lcd_puts(0, 0, "Error:");
rb->lcd_puts(0, 1, "Programming fail!"); rb->lcd_puts(0, 1, "Programming fail!");
rb->lcd_puts(0, 2, buf); rb->lcd_putsf(0, 2, "%d errors", rc);
rb->lcd_update(); rb->lcd_update();
button = WaitForButton(); button = WaitForButton();
} }
@ -743,10 +740,9 @@ static void DoUserDialog(char* filename)
} }
else else
{ {
rb->snprintf(buf, sizeof(buf), "%d errors", rc);
rb->lcd_puts(0, 0, "Error:"); rb->lcd_puts(0, 0, "Error:");
rb->lcd_puts(0, 1, "Verify fail!"); rb->lcd_puts(0, 1, "Verify fail!");
rb->lcd_puts(0, 2, buf); rb->lcd_putsf(0, 2, "%d errors", rc);
rb->lcd_puts(0, 3, "Use safe image"); rb->lcd_puts(0, 3, "Use safe image");
rb->lcd_puts(0, 4, "if booting hangs:"); rb->lcd_puts(0, 4, "if booting hangs:");
rb->lcd_puts(0, 5, "F1 during power-on"); rb->lcd_puts(0, 5, "F1 during power-on");

View file

@ -571,7 +571,7 @@ void debug_disassemble(addr a, int c)
static int opaddr; static int opaddr;
static char mnemonic[256]; static char mnemonic[256];
static char *pattern; static char *pattern;
char meow[500],buf[300]; char ops_str[300];
if(!debug_trace) return; if(!debug_trace) return;
while (c > 0) while (c > 0)
@ -600,8 +600,7 @@ void debug_disassemble(addr a, int c)
case 'B': case 'B':
case 'b': case 'b':
ops[k] = readb(a); a++; ops[k] = readb(a); a++;
j += snprintf(mnemonic + j,255-j, j += snprintf(mnemonic + j,255-j, "%02Xh", ops[k++]);
"%02Xh", ops[k++]);
break; break;
case 'W': case 'W':
case 'w': case 'w':
@ -614,8 +613,7 @@ void debug_disassemble(addr a, int c)
case 'O': case 'O':
case 'o': case 'o':
ops[k] = readb(a); a++; ops[k] = readb(a); a++;
j += snprintf(mnemonic + j, 255-j,"%+d", j += snprintf(mnemonic + j, 255-j,"%+d", (n8)(ops[k++]));
(n8)(ops[k++]));
break; break;
} }
i++; i++;
@ -626,52 +624,19 @@ void debug_disassemble(addr a, int c)
} }
} }
mnemonic[j] = 0; mnemonic[j] = 0;
snprintf(buf,299,"%04X ", opaddr);
strcpy(meow,buf);
switch (operand_count[ops[0]]) { switch (operand_count[ops[0]]) {
case 1: case 1:
snprintf(buf,299,"%02X ", ops[0]); snprintf(ops_str,sizeof(ops_str),"%02X ", ops[0]);
strcat(meow,buf);
break; break;
case 2: case 2:
snprintf(buf,299,"%02X %02X ", ops[0], ops[1]); snprintf(ops_str,sizeof(ops_str),"%02X %02X ", ops[0], ops[1]);
strcat(meow,buf);
break; break;
case 3: case 3:
snprintf(buf,299,"%02X %02X %02X ", ops[0], ops[1], ops[2]); snprintf(ops_str,sizeof(ops_str),"%02X %02X %02X", ops[0], ops[1], ops[2]);
strcat(meow,buf);
break; break;
} }
snprintf(buf,"%-16.16s", mnemonic); rb->lcd_putsxyf(0,0,"%04X %s %-16.16s", opaddr, ops_str, mnemonic);
strcat(meow,buf);
rb->lcd_putsxy(0,0,meow);
rb->lcd_update(); rb->lcd_update();
c--; c--;
} }
} }

View file

@ -1009,10 +1009,6 @@ void setvidmode(void)
void lcd_refreshline(void) void lcd_refreshline(void)
{ {
#ifdef HAVE_LCD_COLOR
char frameout[30];
#endif
if (!(R_LCDC & 0x80)) if (!(R_LCDC & 0x80))
return; /* should not happen... */ return; /* should not happen... */
@ -1112,8 +1108,8 @@ void lcd_refreshline(void)
{ {
if(options.showstats) if(options.showstats)
{ {
snprintf(frameout,sizeof(frameout),"FPS: %d Frameskip: %d ",options.fps, options.frameskip); rb->lcd_putsxyf(0,LCD_HEIGHT-10,"FPS: %d Frameskip: %d ",
rb->lcd_putsxy(0,LCD_HEIGHT-10,frameout); options.fps, options.frameskip);
rb->lcd_update_rect(0,LCD_HEIGHT-10, LCD_WIDTH, 10); rb->lcd_update_rect(0,LCD_HEIGHT-10, LCD_WIDTH, 10);
} }

View file

@ -171,7 +171,7 @@ static void build_slot_path(char *buf, size_t bufsiz, int slot_id) {
* *
*/ */
static bool do_file(char *path, char *desc, bool is_load) { static bool do_file(char *path, char *desc, bool is_load) {
char buf[200], desc_buf[20]; char desc_buf[20];
int fd, file_mode; int fd, file_mode;
/* set file mode */ /* set file mode */
@ -191,8 +191,7 @@ static bool do_file(char *path, char *desc, bool is_load) {
loadstate(fd); loadstate(fd);
/* print out a status message so the user knows the state loaded */ /* print out a status message so the user knows the state loaded */
snprintf(buf, 200, "Loaded state from \"%s\"", path); rb->splashf(HZ * 1, "Loaded state from \"%s\"", path);
rb->splash(HZ * 1, buf);
} }
else else
{ {

View file

@ -90,7 +90,6 @@ unsigned char grid_b[GRID_W][GRID_H];
int generation = 0; int generation = 0;
int population = 0; int population = 0;
int status_line = 0; int status_line = 0;
char buf[30];
static inline bool is_valid_cell(int x, int y) { static inline bool is_valid_cell(int x, int y) {
@ -308,11 +307,10 @@ static void show_grid(char *pgrid){
} }
} }
if(status_line){ if(status_line){
rb->snprintf(buf, sizeof(buf), "g:%d p:%d", generation, population);
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_foreground( LCD_BLACK ); rb->lcd_set_foreground( LCD_BLACK );
#endif #endif
rb->lcd_puts(0, 0, buf); rb->lcd_putsf(0, 0, "g:%d p:%d", generation, population);
} }
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -977,8 +977,6 @@ static unsigned int color_chooser( unsigned int color )
enum BaseColor current = Red; enum BaseColor current = Red;
bool has_changed; bool has_changed;
char str[6] = "";
restore_screen(); restore_screen();
rgb2hsv( red, green, blue, &hue, &saturation, &value ); rgb2hsv( red, green, blue, &hue, &saturation, &value );
@ -1028,18 +1026,14 @@ static unsigned int color_chooser( unsigned int color )
#undef POSITION #undef POSITION
rb->lcd_set_background(COLOR_LIGHTGRAY); rb->lcd_set_background(COLOR_LIGHTGRAY);
rb->lcd_setfont( FONT_SYSFIXED ); rb->lcd_setfont( FONT_SYSFIXED );
rb->snprintf( str, 6, "%d", hue/10 ); rb->lcd_putsxyf( left + 117, top + 20, "%d", hue/10 );
rb->lcd_putsxy( left + 117, top + 20, str ); rb->lcd_putsxyf( left + 117, top + 30, "%d.%d",
rb->snprintf( str, 6, "%d.%d", saturation/255, ((saturation*100)/255)%100 ); saturation/255, ((saturation*100)/255)%100 );
rb->lcd_putsxy( left + 117, top + 30, str ); rb->lcd_putsxyf( left + 117, top + 40, "%d.%d",
rb->snprintf( str, 6, "%d.%d", value/255, ((value*100)/255)%100 ); value/255, ((value*100)/255)%100 );
rb->lcd_putsxy( left + 117, top + 40, str ); rb->lcd_putsxyf( left + 117, top + 50, "%d", red );
rb->snprintf( str, 6, "%d", red ); rb->lcd_putsxyf( left + 117, top + 60, "%d", green );
rb->lcd_putsxy( left + 117, top + 50, str ); rb->lcd_putsxyf( left + 117, top + 70, "%d", blue );
rb->snprintf( str, 6, "%d", green );
rb->lcd_putsxy( left + 117, top + 60, str );
rb->snprintf( str, 6, "%d", blue );
rb->lcd_putsxy( left + 117, top + 70, str );
rb->lcd_setfont( FONT_UI ); rb->lcd_setfont( FONT_UI );
#define CURSOR( l ) \ #define CURSOR( l ) \

View file

@ -489,8 +489,7 @@ static void move_spot(int x, int y)
moves_y, s); moves_y, s);
#else #else
(void)w; (void)w;
rb->snprintf(s, sizeof(s), "Moves: %d", moves); rb->lcd_putsxyf(3, moves_y, "Moves: %d", moves);
rb->lcd_putsxy(3, moves_y, s);
#endif #endif
for(i=1;i<=4;i++) for(i=1;i<=4;i++)
{ {
@ -532,8 +531,7 @@ static void draw_playfield(void)
#else #else
(void)w; (void)w;
rb->lcd_hline(0, LCD_WIDTH-1, IMAGE_HEIGHT); rb->lcd_hline(0, LCD_WIDTH-1, IMAGE_HEIGHT);
rb->snprintf(s, sizeof(s), "Moves: %d", moves); rb->lcd_putsxyf(3, moves_y, "Moves: %d", moves);
rb->lcd_putsxy(3, moves_y, s);
#endif #endif
/* draw spots to the lcd */ /* draw spots to the lcd */

View file

@ -260,18 +260,14 @@ static struct configdata config[] = {
static void snake_die (void) static void snake_die (void)
{ {
char pscore[17];
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->snprintf(pscore,sizeof(pscore),"Your score: %d",score);
rb->lcd_puts(0,0,"Oops..."); rb->lcd_puts(0,0,"Oops...");
rb->lcd_puts(0,1, pscore); rb->lcd_putsf(0,1,"Your score: %d",score);
if (highscore_update(score, level, "", highscores, NUM_SCORES) == 0) { if (highscore_update(score, level, "", highscores, NUM_SCORES) == 0) {
rb->lcd_puts(0,2,"New High Score!"); rb->lcd_puts(0,2,"New High Score!");
} }
else { else {
rb->snprintf(pscore, sizeof(pscore), rb->lcd_putsf(0,2,"High Score: %d", highscores[0].score);
"High Score: %d", highscores[0].score);
rb->lcd_puts(0,2,pscore);
} }
rb->lcd_update(); rb->lcd_update();
rb->sleep(3*HZ); rb->sleep(3*HZ);

View file

@ -982,14 +982,11 @@ static void update_screen(void)
#define BOARD_WIDTH LCD_WIDTH #define BOARD_WIDTH LCD_WIDTH
#define BOARD_HEIGHT (LCD_HEIGHT - STAT_HEIGHT) #define BOARD_HEIGHT (LCD_HEIGHT - STAT_HEIGHT)
rb->lcd_putsxy(STAT_X + 4, STAT_Y + 4, "Level"); rb->lcd_putsxy(STAT_X + 4, STAT_Y + 4, "Level");
rb->snprintf(buf, sizeof(buf), "%d", current_info.level.index + 1); rb->lcd_putsxyf(STAT_X + 7, STAT_Y + 14, "%d", current_info.level.index + 1);
rb->lcd_putsxy(STAT_X + 7, STAT_Y + 14, buf);
rb->lcd_putsxy(STAT_X + 41, STAT_Y + 4, "Moves"); rb->lcd_putsxy(STAT_X + 41, STAT_Y + 4, "Moves");
rb->snprintf(buf, sizeof(buf), "%d", current_info.level.moves); rb->lcd_putsxyf(STAT_X + 44, STAT_Y + 14, "%d", current_info.level.moves);
rb->lcd_putsxy(STAT_X + 44, STAT_Y + 14, buf);
rb->lcd_putsxy(STAT_X + 79, STAT_Y + 4, "Pushes"); rb->lcd_putsxy(STAT_X + 79, STAT_Y + 4, "Pushes");
rb->snprintf(buf, sizeof(buf), "%d", current_info.level.pushes); rb->lcd_putsxyf(STAT_X + 82, STAT_Y + 14, "%d", current_info.level.pushes);
rb->lcd_putsxy(STAT_X + 82, STAT_Y + 14, buf);
rb->lcd_drawrect(STAT_X, STAT_Y, 38, STAT_HEIGHT); rb->lcd_drawrect(STAT_X, STAT_Y, 38, STAT_HEIGHT);
rb->lcd_drawrect(STAT_X + 37, STAT_Y, 39, STAT_HEIGHT); rb->lcd_drawrect(STAT_X + 37, STAT_Y, 39, STAT_HEIGHT);
@ -1005,18 +1002,15 @@ static void update_screen(void)
#define BOARD_WIDTH (LCD_WIDTH - STAT_WIDTH) #define BOARD_WIDTH (LCD_WIDTH - STAT_WIDTH)
#define BOARD_HEIGHT LCD_HEIGHT #define BOARD_HEIGHT LCD_HEIGHT
rb->lcd_putsxy(STAT_X + 1, STAT_Y + 2, "Level"); rb->lcd_putsxy(STAT_X + 1, STAT_Y + 2, "Level");
rb->snprintf(buf, sizeof(buf), "%d", current_info.level.index + 1); rb->lcd_putsxyf(STAT_X + 4, STAT_Y + 12, "%d", current_info.level.index + 1);
rb->lcd_putsxy(STAT_X + 4, STAT_Y + 12, buf);
rb->lcd_putsxy(STAT_X + 1, STAT_Y + 23, "Moves"); rb->lcd_putsxy(STAT_X + 1, STAT_Y + 23, "Moves");
rb->snprintf(buf, sizeof(buf), "%d", current_info.level.moves); rb->lcd_putsxyf(STAT_X + 4, STAT_Y + 33, "%d", current_info.level.moves);
rb->lcd_putsxy(STAT_X + 4, STAT_Y + 33, buf);
#if STAT_WIDTH < 38 #if STAT_WIDTH < 38
rb->lcd_putsxy(STAT_X + 1, STAT_Y + 44, "Push"); rb->lcd_putsxy(STAT_X + 1, STAT_Y + 44, "Push");
#else #else
rb->lcd_putsxy(STAT_X + 1, STAT_Y + 44, "Pushes"); rb->lcd_putsxy(STAT_X + 1, STAT_Y + 44, "Pushes");
#endif #endif
rb->snprintf(buf, sizeof(buf), "%d", current_info.level.pushes); rb->lcd_putsxyf(STAT_X + 4, STAT_Y + 54, "%d", current_info.level.pushes);
rb->lcd_putsxy(STAT_X + 4, STAT_Y + 54, buf);
rb->lcd_drawrect(STAT_X, STAT_Y + 0, STAT_WIDTH, 64); rb->lcd_drawrect(STAT_X, STAT_Y + 0, STAT_WIDTH, 64);
rb->lcd_hline(STAT_X, LCD_WIDTH - 1, STAT_Y + 21); rb->lcd_hline(STAT_X, LCD_WIDTH - 1, STAT_Y + 21);

View file

@ -1826,7 +1826,6 @@ static int spacerocks_menu(void)
static int spacerocks_game_loop(void) static int spacerocks_game_loop(void)
{ {
char str[20];
int button; int button;
int end; int end;
int position; int position;
@ -1861,8 +1860,7 @@ static int spacerocks_game_loop(void)
break; break;
case PAUSE_MODE: case PAUSE_MODE:
rb->snprintf(str, sizeof(str), "score %d ", current_score); rb->lcd_putsxyf(1,LCD_HEIGHT-8, "score %d ", current_score);
rb->lcd_putsxy(1,LCD_HEIGHT-8, str);
rb->lcd_putsxy(CENTER_LCD_X - 15, rb->lcd_putsxy(CENTER_LCD_X - 15,
CENTER_LCD_Y + CENTER_LCD_Y/2 - 4, "pause"); CENTER_LCD_Y + CENTER_LCD_Y/2 - 4, "pause");
draw_and_move_missiles(); draw_and_move_missiles();
@ -1871,8 +1869,7 @@ static int spacerocks_game_loop(void)
break; break;
case PLAY_MODE: case PLAY_MODE:
rb->snprintf(str, sizeof(str), "score %d ", current_score); rb->lcd_putsxyf(1, LCD_HEIGHT-8, "score %d ", current_score);
rb->lcd_putsxy(1, LCD_HEIGHT-8, str);
draw_and_move_missiles(); draw_and_move_missiles();
draw_lives(); draw_lives();
check_collisions(); check_collisions();
@ -1880,11 +1877,10 @@ static int spacerocks_game_loop(void)
break; break;
case SHOW_LEVEL: case SHOW_LEVEL:
rb->snprintf(str, sizeof(str), "score %d ", current_score); rb->lcd_putsxyf(1, LCD_HEIGHT-8, "score %d ", current_score);
rb->lcd_putsxy(1, LCD_HEIGHT-8, str); rb->lcd_putsxyf(CENTER_LCD_X - 20,
rb->snprintf(str, sizeof(str), "stage %d ", current_level); CENTER_LCD_Y + CENTER_LCD_Y/2 - 4,
rb->lcd_putsxy(CENTER_LCD_X - 20, "stage %d ", current_level);
CENTER_LCD_Y + CENTER_LCD_Y/2 - 4, str);
draw_lives(); draw_lives();
draw_and_move_ship(); draw_and_move_ship();
show_level_timeout--; show_level_timeout--;

View file

@ -759,7 +759,6 @@ static void star_transition_update(void)
static void star_display_board_info(int current_level) static void star_display_board_info(int current_level)
{ {
int label_pos_y, tile_pos_y; int label_pos_y, tile_pos_y;
char str_info[32];
if (TILE_HEIGHT > char_height) if (TILE_HEIGHT > char_height)
{ {
@ -772,10 +771,9 @@ static void star_display_board_info(int current_level)
tile_pos_y = label_pos_y + (char_height - TILE_HEIGHT) / 2; tile_pos_y = label_pos_y + (char_height - TILE_HEIGHT) / 2;
} }
rb->snprintf(str_info, sizeof(str_info), "L:%02d", current_level + 1); rb->lcd_putsxyf(STAR_OFFSET_X, label_pos_y, "L:%02d", current_level + 1);
rb->lcd_putsxy(STAR_OFFSET_X, label_pos_y, str_info); rb->lcd_putsxyf(LCD_WIDTH/2 - 2 * char_width, label_pos_y, "S:%02d",
rb->snprintf(str_info, sizeof(str_info), "S:%02d", star_count); star_count);
rb->lcd_putsxy(LCD_WIDTH/2 - 2 * char_width, label_pos_y, str_info);
rb->lcd_putsxy(STAR_OFFSET_X + (STAR_WIDTH-1) * TILE_WIDTH - 2 * char_width, rb->lcd_putsxy(STAR_OFFSET_X + (STAR_WIDTH-1) * TILE_WIDTH - 2 * char_width,
label_pos_y, "C:"); label_pos_y, "C:");

View file

@ -377,7 +377,6 @@ static struct starfield starfield;
int plugin_main(void) int plugin_main(void)
{ {
char str_buffer[40];
int button, avg_peak, t_disp=0; int button, avg_peak, t_disp=0;
int font_h, font_w; int font_h, font_w;
bool pulse=true; bool pulse=true;
@ -449,14 +448,11 @@ int plugin_main(void)
if (t_disp > 0) if (t_disp > 0)
{ {
--t_disp; --t_disp;
rb->snprintf(str_buffer, sizeof(str_buffer),
"star:%d speed:%d",
starfield.nb_stars,
starfield.z_move);
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
rb->lcd_set_foreground(LCD_WHITE); rb->lcd_set_foreground(LCD_WHITE);
#endif #endif
rb->lcd_putsxy(0, LCD_HEIGHT-font_h, str_buffer); rb->lcd_putsxyf(0, LCD_HEIGHT-font_h, "star:%d speed:%d",
starfield.nb_stars, starfield.z_move);
} }
rb->lcd_update(); rb->lcd_update();

View file

@ -500,13 +500,9 @@ void update_score(void) {
rb->lcd_fillrect(5,LCD_HEIGHT-20,105,20); rb->lcd_fillrect(5,LCD_HEIGHT-20,105,20);
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
strength = calc_strength(COLOUR_LIGHT, cursor.x, cursor.y); strength = calc_strength(COLOUR_LIGHT, cursor.x, cursor.y);
rb->snprintf(buf, sizeof(buf), "Your power: %d.%d", rb->lcd_putsxyf(5,LCD_HEIGHT-20,"Your power: %d.%d",strength/10,strength%10);
strength/10, strength%10);
rb->lcd_putsxy(5,LCD_HEIGHT-20, buf);
strength = calc_strength(COLOUR_DARK, cursor.x, cursor.y); strength = calc_strength(COLOUR_DARK, cursor.x, cursor.y);
rb->snprintf(buf, sizeof(buf), "Comp power: %d.%d", rb->lcd_putsxyf(5,LCD_HEIGHT-10,"Comp power: %d.%d",strength/10,strength%10);
strength/10, strength%10);
rb->lcd_putsxy(5,LCD_HEIGHT-10, buf);
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
} }
@ -733,8 +729,7 @@ int get_number(char* param, int* value, int max) {
button_labels[i][j]); button_labels[i][j]);
} }
} }
rb->snprintf(buf,sizeof(buf), "%d", *value); rb->lcd_putsxyf(NUM_MARGIN_X+10, NUM_MARGIN_Y+4*NUM_BOX_HEIGHT+10,"%d",*value);
rb->lcd_putsxy(NUM_MARGIN_X+10, NUM_MARGIN_Y+4*NUM_BOX_HEIGHT+10, buf);
rb->lcd_getstringsize(param, &width, &height); rb->lcd_getstringsize(param, &width, &height);
if(width < LCD_WIDTH) if(width < LCD_WIDTH)
rb->lcd_putsxy((LCD_WIDTH-width)/2, (NUM_MARGIN_Y-height)/2, param); rb->lcd_putsxy((LCD_WIDTH-width)/2, (NUM_MARGIN_Y-height)/2, param);
@ -772,9 +767,8 @@ int get_number(char* param, int* value, int max) {
rb->lcd_fillrect(0, NUM_MARGIN_Y+4*NUM_BOX_HEIGHT+10, rb->lcd_fillrect(0, NUM_MARGIN_Y+4*NUM_BOX_HEIGHT+10,
LCD_WIDTH, 30); LCD_WIDTH, 30);
rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_set_drawmode(DRMODE_SOLID);
rb->snprintf(buf,sizeof(buf), "%d", *value); rb->lcd_putsxyf(NUM_MARGIN_X+10,NUM_MARGIN_Y+4*NUM_BOX_HEIGHT+10,
rb->lcd_putsxy(NUM_MARGIN_X+10, "%d", *value);
NUM_MARGIN_Y+4*NUM_BOX_HEIGHT+10, buf);
break; break;
case SUPERDOM_CANCEL: case SUPERDOM_CANCEL:
*value = 0; *value = 0;
@ -1404,10 +1398,8 @@ int select_square(void) {
update_score(); update_score();
#if LCD_WIDTH >= 220 #if LCD_WIDTH >= 220
rb->lcd_setfont(FONT_SYSFIXED); rb->lcd_setfont(FONT_SYSFIXED);
rb->snprintf(buf, sizeof(buf), "Cash: %d", humanres.cash); rb->lcd_putsxyf(125, LCD_HEIGHT-20,"Cash: %d", humanres.cash);
rb->lcd_putsxy(125, LCD_HEIGHT-20, buf); rb->lcd_putsxyf(125, LCD_HEIGHT-10,"Food: %d", humanres.food);
rb->snprintf(buf, sizeof(buf), "Food: %d", humanres.food);
rb->lcd_putsxy(125, LCD_HEIGHT-10, buf);
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
#endif #endif
rb->lcd_update(); rb->lcd_update();

View file

@ -152,7 +152,6 @@ static void timer_isr(void)
int plugin_main(void) int plugin_main(void)
{ {
unsigned char buf[32];
int button; int button;
bool done = false; bool done = false;
bool change = true; bool change = true;
@ -186,9 +185,8 @@ int plugin_main(void)
{ {
/* The actual frequency is twice the displayed value */ /* The actual frequency is twice the displayed value */
rb->timer_set_period(TIMER_FREQ * 5 / scan_rate); rb->timer_set_period(TIMER_FREQ * 5 / scan_rate);
rb->snprintf(buf, sizeof(buf), "f: %d.%d Hz", scan_rate / 10, rb->lcd_putsxyf(TEXT_X, TEXT_Y, "f: %d.%d Hz", scan_rate / 10,
scan_rate % 10); scan_rate % 10);
rb->lcd_putsxy(TEXT_X, TEXT_Y, buf);
need_refresh = true; need_refresh = true;
change = false; change = false;
} }

View file

@ -29,10 +29,7 @@ char tmpname[MAX_PATH];
static void xingupdate(int percent) static void xingupdate(int percent)
{ {
char buf[32]; rb->lcd_putsf(0, 1, "%d%%", percent);
rb->snprintf(buf, 32, "%d%%", percent);
rb->lcd_puts(0, 1, buf);
rb->lcd_update(); rb->lcd_update();
} }

View file

@ -465,7 +465,6 @@ void save_settings(void) {
} }
void change_volume(int delta) { void change_volume(int delta) {
char curr_vol[5];
int minvol = rb->sound_min(SOUND_VOLUME); int minvol = rb->sound_min(SOUND_VOLUME);
int maxvol = rb->sound_max(SOUND_VOLUME); int maxvol = rb->sound_max(SOUND_VOLUME);
int vol = rb->global_settings->volume + delta; int vol = rb->global_settings->volume + delta;
@ -475,8 +474,7 @@ void change_volume(int delta) {
if (vol != rb->global_settings->volume) { if (vol != rb->global_settings->volume) {
rb->sound_set(SOUND_VOLUME, vol); rb->sound_set(SOUND_VOLUME, vol);
rb->global_settings->volume = vol; rb->global_settings->volume = vol;
rb->snprintf(curr_vol, sizeof(curr_vol), "%d", vol); rb->lcd_putsxyf(0,0, "%d", vol);
rb->lcd_putsxy(0,0, curr_vol);
rb->lcd_update(); rb->lcd_update();
rb->sleep(HZ/12); rb->sleep(HZ/12);
} }

View file

@ -58,7 +58,6 @@ static void wvupdate (int32_t start_tick,
{ {
int32_t elapsed_ticks = *rb->current_tick - start_tick; int32_t elapsed_ticks = *rb->current_tick - start_tick;
int compression = 0, progress = 0, realtime = 0; int compression = 0, progress = 0, realtime = 0;
char buf[32];
if (total_samples) if (total_samples)
progress = (int)(((int64_t) samples_converted * 100 + progress = (int)(((int64_t) samples_converted * 100 +
@ -72,18 +71,11 @@ static void wvupdate (int32_t start_tick,
compression = (int)(((int64_t)(bytes_read - bytes_written) * 100 + compression = (int)(((int64_t)(bytes_read - bytes_written) * 100 +
(bytes_read/2)) / bytes_read); (bytes_read/2)) / bytes_read);
rb->snprintf(buf, 32, "elapsed time: %ld secs", rb->lcd_putsf(0, 2, "elapsed time: %ld secs",
(long)(elapsed_ticks + (HZ/2)) / HZ); (long)(elapsed_ticks + (HZ/2)) / HZ);
rb->lcd_puts(0, 2, (unsigned char *)buf); rb->lcd_putsf(0, 4, "progress: %d%%", progress);
rb->lcd_putsf(0, 6, "realtime: %d%% ", realtime);
rb->snprintf(buf, 32, "progress: %d%%", progress); rb->lcd_putsf(0, 8, "compression: %d%% ", compression);
rb->lcd_puts(0, 4, (unsigned char *)buf);
rb->snprintf(buf, 32, "realtime: %d%% ", realtime);
rb->lcd_puts(0, 6, (unsigned char *)buf);
rb->snprintf(buf, 32, "compression: %d%% ", compression);
rb->lcd_puts(0, 8, (unsigned char *)buf);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
rb->lcd_update(); rb->lcd_update();

View file

@ -3454,7 +3454,6 @@ void cleanup(void *fd)
int play_file(char* filename) int play_file(char* filename)
{ {
char buf[32];
int button; int button;
int fd; int fd;
int wanted, got; int wanted, got;
@ -3540,11 +3539,9 @@ int play_file(char* filename)
time = bytes / (samplerate * 2 * channels); time = bytes / (samplerate * 2 * channels);
rb->lcd_puts(0, 0, "Playing WAV file"); rb->lcd_puts(0, 0, "Playing WAV file");
rb->snprintf(buf, sizeof(buf), "%dHz %s", samplerate, rb->lcd_putsf(0, 1, "%dHz %s", samplerate,
(channels == 1) ? "mono" : "stereo"); (channels == 1) ? "mono" : "stereo");
rb->lcd_puts(0, 1, buf); rb->lcd_putsf(0, 2, "Length: %d:%02d", time / 60, time % 60);
rb->snprintf(buf, sizeof(buf), "Length: %d:%02d", time / 60, time % 60);
rb->lcd_puts(0, 2, buf);
rb->lcd_update(); rb->lcd_update();
rb->sound_set_pitch(PITCH_SPEED_100); /* reset pitch */ rb->sound_set_pitch(PITCH_SPEED_100); /* reset pitch */

View file

@ -3480,7 +3480,6 @@ static bool update_wav_header(char *filename, int sample_rate,
static int record_file(char *filename) static int record_file(char *filename)
{ {
bool recording, saving; bool recording, saving;
char buf[32];
int fd, low_water, i; int fd, low_water, i;
int bytes_written; int bytes_written;
int button; int button;
@ -3514,8 +3513,6 @@ static int record_file(char *filename)
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_puts(0, 0, filename); rb->lcd_puts(0, 0, filename);
rb->snprintf(buf, sizeof(buf), "%sHz 16bit %s",
samplerate_str[reccfg.samplerate], channel_str[reccfg.channels]);
switch (reccfg.source) switch (reccfg.source)
{ {
@ -3535,12 +3532,18 @@ static int record_file(char *filename)
#ifdef HAVE_SPDIF_REC #ifdef HAVE_SPDIF_REC
case WAV_SRC_SPDIF: case WAV_SRC_SPDIF:
rb->mas_codec_writereg(0, 0x01); rb->mas_codec_writereg(0, 0x01);
rb->snprintf(buf, sizeof(buf), "16bit %s",
channel_str[reccfg.channels]);
break; break;
#endif #endif
} }
rb->lcd_puts(0, 1, buf);
#ifdef HAVE_SPDIF_REC
if (reccfg.source == WAV_SRC_SPDIF)
rb->lcd_putsf(0, 1, "16bit %s", channel_str[reccfg.channels]);
else
#endif
rb->lcd_putsf(0, 1, "%sHz 16bit %s",
samplerate_str[reccfg.samplerate], channel_str[reccfg.channels]);
rb->lcd_update(); rb->lcd_update();
mas = 0x0060 /* no framing, little endian */ mas = 0x0060 /* no framing, little endian */
@ -3649,8 +3652,7 @@ static int record_file(char *filename)
recording = false; recording = false;
saving = true; saving = true;
} }
rb->snprintf(buf, sizeof(buf), "Bytes: %d", num_rec_bytes); rb->lcd_puts(0, 2, "Bytes: %d", num_rec_bytes);
rb->lcd_puts(0, 2, buf);
rb->lcd_update(); rb->lcd_update();
} }
/* read sample rate from MAS */ /* read sample rate from MAS */

View file

@ -109,7 +109,6 @@ static int readwavpeaks(const char *filename)
int file; int file;
uint32_t total_bytes_read = 0; uint32_t total_bytes_read = 0;
char tstr[128];
int hours; int hours;
int minutes; int minutes;
int seconds; int seconds;
@ -156,25 +155,20 @@ static int readwavpeaks(const char *filename)
rb->lcd_puts_scroll(0, 1, (unsigned char *)filename); rb->lcd_puts_scroll(0, 1, (unsigned char *)filename);
rb->lcd_update(); rb->lcd_update();
rb->snprintf(tstr,127, "Channels: %s", rb->lcd_putsf(0, 2, "Channels: %s",
header.numchannels == 1 ? "mono" : "stereo"); header.numchannels == 1 ? "mono" : "stereo");
rb->lcd_puts(0, 2, tstr); rb->lcd_putsf(0, 3, "Bits/sample: %d", header.bitspersample);
rb->lcd_putsf(0, 4, "Samplerate: %"PRIu32" Hz", header.samplerate);
rb->snprintf(tstr,127, "Bits/sample: %d", header.bitspersample);
rb->lcd_puts(0, 3, tstr);
rb->snprintf(tstr,127, "Samplerate: %d Hz", (int)(header.samplerate));
rb->lcd_puts(0, 4, tstr);
seconds = header.datachunksize / header.byterate; seconds = header.datachunksize / header.byterate;
hours = seconds / 3600; hours = seconds / 3600;
seconds -= hours * 3600; seconds -= hours * 3600;
minutes = seconds / 60; minutes = seconds / 60;
seconds -= minutes * 60; seconds -= minutes * 60;
rb->snprintf(tstr,127, "Length (hh:mm:ss): %02d:%02d:%02d", hours,
minutes, rb->lcd_putsf(0, 5, "Length (hh:mm:ss): %02d:%02d:%02d", hours,
seconds); minutes,
rb->lcd_puts(0, 5, tstr); seconds);
rb->lcd_puts(0, 6, "Searching for peaks... "); rb->lcd_puts(0, 6, "Searching for peaks... ");
rb->lcd_update(); rb->lcd_update();
@ -246,10 +240,9 @@ static int readwavpeaks(const char *filename)
} }
/* update progress */ /* update progress */
rb->snprintf(tstr,127, "Searching for peaks... %d%%",(int) rb->lcd_putsf(0, 6, "Searching for peaks... %"PRIu32"%%",
(total_bytes_read / ((header.datachunksize + (total_bytes_read / ((header.datachunksize +
sizeof(struct wav_header)) / 100))); sizeof(struct wav_header)) / 100)));
rb->lcd_puts(0, 6, tstr);
rb->lcd_update(); rb->lcd_update();
/* allow user to abort */ /* allow user to abort */

View file

@ -549,7 +549,7 @@ static int percentage (void)
static void refresh_board (void) static void refresh_board (void)
{ {
int i, j; int i, j;
char str[25]; int x;
#if LCD_DEPTH>=2 #if LCD_DEPTH>=2
rb->lcd_set_background (LCD_BLACK); rb->lcd_set_background (LCD_BLACK);
@ -590,21 +590,18 @@ static void refresh_board (void)
#else #else
rb->lcd_set_drawmode (DRMODE_COMPLEMENT); rb->lcd_set_drawmode (DRMODE_COMPLEMENT);
#endif #endif
rb->snprintf (str, sizeof (str), "Level %d", player.level + 1); rb->lcd_putsxyf (BOARD_X, BOARD_Y, "Level %d", player.level + 1);
rb->lcd_putsxy (BOARD_X, BOARD_Y, str); rb->lcd_putsxyf (BOARD_X + CUBE_SIZE * BOARD_W - 24, BOARD_Y, "%d%%",
rb->snprintf (str, sizeof (str), "%d%%", percentage_cache); percentage_cache);
rb->lcd_putsxy (BOARD_X + CUBE_SIZE * BOARD_W - 24, BOARD_Y, str); rb->lcd_putsxyf (BOARD_X, BOARD_Y + CUBE_SIZE * BOARD_H - 8, "Score: %d",
rb->snprintf (str, sizeof (str), "Score: %d", player.score); player.score);
rb->lcd_putsxy (BOARD_X, BOARD_Y + CUBE_SIZE * BOARD_H - 8, str);
rb->snprintf (str, sizeof (str),
(player.lives != 1) ? "%d Lives" : "%d Life", player.lives);
#if LCD_DEPTH>=2 #if LCD_DEPTH>=2
rb->lcd_putsxy (BOARD_X + CUBE_SIZE * BOARD_W - 60, x = BOARD_X + CUBE_SIZE * BOARD_W - 60;
BOARD_Y + CUBE_SIZE * BOARD_H - 8, str);
#else #else
rb->lcd_putsxy (BOARD_X + CUBE_SIZE * BOARD_W - 40, x = BOARD_X + CUBE_SIZE * BOARD_W - 40;
BOARD_Y + CUBE_SIZE * BOARD_H - 8, str);
#endif #endif
rb->lcd_putsxyf (x, BOARD_Y + CUBE_SIZE * BOARD_H - 8,
(player.lives != 1) ? "%d Lives" : "%d Life", player.lives);
#if LCD_DEPTH>=2 #if LCD_DEPTH>=2
rb->lcd_set_foreground (PLR_COL); rb->lcd_set_foreground (PLR_COL);

View file

@ -49,7 +49,6 @@ void init_spect_scr(void)
void update_screen(void) void update_screen(void)
{ {
char str[80];
fb_data *frameb; fb_data *frameb;
int y=0; int y=0;
@ -88,10 +87,7 @@ void update_screen(void)
int TPF = HZ/50;/* ticks per frame */ int TPF = HZ/50;/* ticks per frame */
if ((*rb->current_tick-start_time) > TPF ) if ((*rb->current_tick-start_time) > TPF )
percent = 100*video_frames/((*rb->current_tick-start_time)/TPF); percent = 100*video_frames/((*rb->current_tick-start_time)/TPF);
rb->snprintf(str,sizeof(str),"%d %%",percent); rb->lcd_putsxyf(0,0,"%d %%",percent);
rb->lcd_putsxy(0,0,str);
} }
rb -> lcd_update(); rb -> lcd_update();
} }

View file

@ -41,8 +41,6 @@ void init_spect_scr(void)
} }
void update_screen(void) void update_screen(void)
{ {
char str[80];
fb_data *frameb; fb_data *frameb;
int y=0; int y=0;
int x=0; int x=0;
@ -106,8 +104,7 @@ void update_screen(void)
int TPF = HZ/50;/* ticks per frame */ int TPF = HZ/50;/* ticks per frame */
if ((*rb->current_tick-start_time) > TPF ) if ((*rb->current_tick-start_time) > TPF )
percent = 100*video_frames/((*rb->current_tick-start_time)/TPF); percent = 100*video_frames/((*rb->current_tick-start_time)/TPF);
rb->snprintf(str,sizeof(str),"%d %%",percent); rb->lcd_putsxyf(0,0,"%d %%",percent);
rb->lcd_putsxy(0,0,str);
} }