diff --git a/Changelog b/Changelog index cb2b582..10f8800 100644 --- a/Changelog +++ b/Changelog @@ -10,6 +10,8 @@ Stable versions - Add command to display current mixer type - Fix default amplification factor - Fix module-specific configuration file options + - Fix screen corruption when module uses more than 255 virtual + channels (reported by Lionel Debroux) - Remove option --offset-bug-emulation 4.0.11 (20160306): diff --git a/src/info.c b/src/info.c index d6948c8..b3742b6 100644 --- a/src/info.c +++ b/src/info.c @@ -130,10 +130,22 @@ void info_message(char *format, ...) va_end(ap); } +static void fix_info_02x(int val, char *buf) +{ + if (val <= 0xff) { + snprintf(buf, 3, "%02X", val); + } else if (val <= 0xfff) { + snprintf(buf, 3, "+%X", val >> 8); + } else { + strcpy(buf, "++"); + } +} + void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct control *ctl, int reprint) { static int ord = -1, spd = -1, bpm = -1; char rowstr[3], numrowstr[3]; + char chnstr[3], maxchnstr[3]; int time; char x; @@ -191,21 +203,14 @@ void info_frame(struct xmp_module_info *mi, struct xmp_frame_info *fi, struct co spd = fi->speed; } - if (fi->row <= 0xff) { - snprintf(rowstr, 3, "%02X", fi->row); - } else { - strcpy(rowstr, "++"); - } - - if (fi->num_rows <= 0x100) { - snprintf(numrowstr, 3, "%02X", fi->num_rows - 1); - } else { - strcpy(numrowstr, "++"); - } + fix_info_02x(fi->row, rowstr); + fix_info_02x(fi->num_rows - 1, numrowstr); + fix_info_02x(fi->virt_used, chnstr); + fix_info_02x(max_channels, maxchnstr); report("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" - "%2.2s/%2.2s] Chn[%02X/%02X] %c%c%c", - rowstr, numrowstr, fi->virt_used, max_channels, + "%2.2s/%2.2s] Chn[%2.2s/%2.2s] %c%c%c", + rowstr, numrowstr, chnstr, maxchnstr, ctl->explore ? 'Z' : ' ', ctl->loop ? 'L' : ' ', x); print_time: