1
0
Fork 0
forked from len0rd/rockbox

mikmod: Properly render with fonts larger than 6x8 pixels.

Change-Id: Ib3f8c2cf84e7b6565bb8a00b74e8a662b9980824
This commit is contained in:
Solomon Peachy 2024-11-06 20:17:22 -05:00
parent 10abb34e54
commit c3d06d21df

View file

@ -36,6 +36,8 @@ static struct event_queue thread_q SHAREDBSS_ATTR;
unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)]; unsigned long thread_stack[THREAD_STACK_SIZE/sizeof(long)];
#endif #endif
static int font_h, font_w;
/* the current full file name */ /* the current full file name */
static char np_file[MAX_PATH]; static char np_file[MAX_PATH];
static int curfile = 0, direction = DIR_NEXT, entries = 0; static int curfile = 0, direction = DIR_NEXT, entries = 0;
@ -304,31 +306,31 @@ static void showinfo(void)
sprintf(statustext, "Name: %s", module->songname); sprintf(statustext, "Name: %s", module->songname);
rb->lcd_putsxy(1, 1, statustext); rb->lcd_putsxy(1, 1, statustext);
sprintf(statustext, "Type: %s", module->modtype); sprintf(statustext, "Type: %s", module->modtype);
rb->lcd_putsxy(1, 11, statustext); rb->lcd_putsxy(1, 1 + 1 * font_h, statustext);
sprintf(statustext, "Samples: %d", module->numsmp); sprintf(statustext, "Samples: %d", module->numsmp);
rb->lcd_putsxy(1, 21, statustext); rb->lcd_putsxy(1, 1 + 2 * font_h, statustext);
if ( module->flags & UF_INST ) if ( module->flags & UF_INST )
{ {
sprintf(statustext, "Instruments: %d", module->numins); sprintf(statustext, "Instruments: %d", module->numins);
rb->lcd_putsxy(1, 31, statustext); rb->lcd_putsxy(1, 1 + 3 * font_h, statustext);
} }
sprintf(statustext, "pat: %03d/%03d %2.2X", sprintf(statustext, "pat: %03d/%03d %2.2X",
module->sngpos, module->numpos - 1, module->patpos); module->sngpos, module->numpos - 1, module->patpos);
rb->lcd_putsxy(1, 51, statustext); rb->lcd_putsxy(1, 1 + 5 * font_h, statustext);
sprintf(statustext, "spd: %d/%d", sprintf(statustext, "spd: %d/%d",
module->sngspd, module->bpm); module->sngspd, module->bpm);
rb->lcd_putsxy(1, 61, statustext); rb->lcd_putsxy(1, 1 + 6 * font_h, statustext);
sprintf(statustext, "vol: %ddB", rb->global_settings->volume); sprintf(statustext, "vol: %ddB", rb->global_settings->volume);
rb->lcd_putsxy(1, 71, statustext); rb->lcd_putsxy(1, 1 + 7 * font_h, statustext);
sprintf(statustext, "time: %d:%02d", sprintf(statustext, "time: %d:%02d",
(playingtime / 60) % 60, playingtime % 60); (playingtime / 60) % 60, playingtime % 60);
rb->lcd_putsxy(1, 81, statustext); rb->lcd_putsxy(1, 1 + 8 * font_h, statustext);
if (module->flags & UF_NNA) if (module->flags & UF_NNA)
{ {
@ -342,7 +344,7 @@ static void showinfo(void)
sprintf(statustext, "chn: %d/%d", sprintf(statustext, "chn: %d/%d",
module->realchn, module->numchn); module->realchn, module->numchn);
} }
rb->lcd_putsxy(0, 91, statustext); rb->lcd_putsxy(0, 1 + 9 * font_h, statustext);
rb->lcd_update(); rb->lcd_update();
} }
@ -360,7 +362,7 @@ static void showsamples(void)
for( i=0; i<MAX_LINES && i+vscroll<module->numsmp; i++ ) for( i=0; i<MAX_LINES && i+vscroll<module->numsmp; i++ )
{ {
sprintf(statustext, "%02d %s", i+vscroll+1, module->samples[i+vscroll].samplename); sprintf(statustext, "%02d %s", i+vscroll+1, module->samples[i+vscroll].samplename);
rb->lcd_putsxy(1, 1+(8*i), statustext); rb->lcd_putsxy(1, 1+(font_h*i), statustext);
} }
rb->lcd_update(); rb->lcd_update();
screenupdated = true; screenupdated = true;
@ -379,7 +381,7 @@ static void showinstruments(void)
for( i=0; i<MAX_LINES && i+vscroll<module->numins; i++ ) for( i=0; i<MAX_LINES && i+vscroll<module->numins; i++ )
{ {
sprintf(statustext, "%02d %s", i+vscroll+1, module->instruments[i+vscroll].insname ? module->instruments[i+vscroll].insname : "[n/a]"); sprintf(statustext, "%02d %s", i+vscroll+1, module->instruments[i+vscroll].insname ? module->instruments[i+vscroll].insname : "[n/a]");
rb->lcd_putsxy(1, 1+(8*i), statustext); rb->lcd_putsxy(1, 1+(font_h*i), statustext);
} }
rb->lcd_update(); rb->lcd_update();
screenupdated = true; screenupdated = true;
@ -406,7 +408,7 @@ static void showcomments(void)
if(module->comment[i] == '\n' || j>LINE_LENGTH-1) if(module->comment[i] == '\n' || j>LINE_LENGTH-1)
{ {
rb->lcd_putsxy(1-(6*hscroll), 1+(8*k)-(8*vscroll), statustext); rb->lcd_putsxy(1-(font_w*hscroll), 1+(font_h*k)-(font_h*vscroll), statustext);
for( l=0; l<LINE_LENGTH; l++ ) for( l=0; l<LINE_LENGTH; l++ )
{ {
statustext[l] = 0; statustext[l] = 0;
@ -417,7 +419,7 @@ static void showcomments(void)
} }
if (j>0) if (j>0)
{ {
rb->lcd_putsxy(1-(6*hscroll), 1+(8*k)-(8*vscroll), statustext); rb->lcd_putsxy(1-(font_w*hscroll), 1+(font_h*k)-(font_h*vscroll), statustext);
} }
rb->lcd_update(); rb->lcd_update();
@ -940,6 +942,8 @@ enum plugin_status plugin_start(const void* parameter)
return PLUGIN_OK; return PLUGIN_OK;
} }
rb->lcd_getstringsize("A", NULL, &font_h);
rb->talk_force_shutup(); rb->talk_force_shutup();
rb->pcm_play_stop(); rb->pcm_play_stop();
#if INPUT_SRC_CAPS != 0 #if INPUT_SRC_CAPS != 0