Fix screen corruption with more than 255 virtual channels

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
master
Claudio Matsuoka 10 years ago
parent 8190b2790b
commit e7eb6ef47a
  1. 2
      Changelog
  2. 31
      src/info.c

@ -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):

@ -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:

Loading…
Cancel
Save