Skip to content

Commit 2a323d4

Browse files
committed
console: implement 90 - 97 (bright fg) and 100 - 107 (bright bg)
1 parent 32f64da commit 2a323d4

2 files changed

Lines changed: 30 additions & 16 deletions

File tree

libogc/console.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,16 @@ static void __console_drawc(int c)
175175
bgcolor = currentConsole->bg;
176176

177177
if (!(currentConsole->flags & CONSOLE_FG_CUSTOM)) {
178-
if (currentConsole->flags & CONSOLE_COLOR_BOLD) {
179-
fgcolor = colorTable[fgcolor + 8];
178+
if (currentConsole->flags & (CONSOLE_COLOR_BOLD | CONSOLE_COLOR_FG_BRIGHT)) {
179+
fgcolor += 8;
180180
} else if (currentConsole->flags & CONSOLE_COLOR_FAINT) {
181-
fgcolor = colorTable[fgcolor + 16];
182-
} else {
183-
fgcolor = colorTable[fgcolor];
181+
fgcolor += 16;
184182
}
183+
fgcolor = colorTable[fgcolor];
185184
}
186185

187186
if (!(currentConsole->flags & CONSOLE_BG_CUSTOM)) {
187+
if (currentConsole->flags & CONSOLE_COLOR_BG_BRIGHT) bgcolor +=8;
188188
bgcolor = colorTable[bgcolor];
189189
}
190190

@@ -630,6 +630,18 @@ static void consoleHandleColorEsc(int code)
630630
escapeSeq.color.flags &= ~CONSOLE_BG_CUSTOM;
631631
escapeSeq.color.fg = 0;
632632
break;
633+
case 90 ... 97: // bright foreground
634+
escapeSeq.color.flags &= ~CONSOLE_COLOR_FAINT;
635+
escapeSeq.color.flags |= CONSOLE_COLOR_FG_BRIGHT;
636+
escapeSeq.color.flags &= ~CONSOLE_BG_CUSTOM;
637+
escapeSeq.color.fg = code - 90;
638+
break;
639+
case 100 ... 107: // bright background
640+
escapeSeq.color.flags &= ~CONSOLE_COLOR_FAINT;
641+
escapeSeq.color.flags |= CONSOLE_COLOR_BG_BRIGHT;
642+
escapeSeq.color.flags &= ~CONSOLE_BG_CUSTOM;
643+
escapeSeq.color.bg = code - 100;
644+
break;
633645
}
634646
break;
635647
case ESC_BUILDING_FORMAT_FG:

libogc/console_internal.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#ifndef __CONSOLE_INTERNAL_H__
22
#define __CONSOLE_INTERNAL_H__
33

4-
#define CONSOLE_COLOR_BOLD (1<<0) ///< Bold text
5-
#define CONSOLE_COLOR_FAINT (1<<1) ///< Faint text
6-
#define CONSOLE_ITALIC (1<<2) ///< Italic text
7-
#define CONSOLE_UNDERLINE (1<<3) ///< Underlined text
8-
#define CONSOLE_BLINK_SLOW (1<<4) ///< Slow blinking text
9-
#define CONSOLE_BLINK_FAST (1<<5) ///< Fast blinking text
10-
#define CONSOLE_COLOR_REVERSE (1<<6) ///< Reversed color text
11-
#define CONSOLE_CONCEAL (1<<7) ///< Concealed text
12-
#define CONSOLE_CROSSED_OUT (1<<8) ///< Crossed out text
13-
#define CONSOLE_FG_CUSTOM (1<<9) ///< Foreground custom color
14-
#define CONSOLE_BG_CUSTOM (1<<10) ///< Background custom color
4+
#define CONSOLE_COLOR_BOLD (1<<0)
5+
#define CONSOLE_COLOR_FAINT (1<<1)
6+
#define CONSOLE_ITALIC (1<<2)
7+
#define CONSOLE_UNDERLINE (1<<3)
8+
#define CONSOLE_BLINK_SLOW (1<<4)
9+
#define CONSOLE_BLINK_FAST (1<<5)
10+
#define CONSOLE_COLOR_REVERSE (1<<6)
11+
#define CONSOLE_CONCEAL (1<<7)
12+
#define CONSOLE_CROSSED_OUT (1<<8)
13+
#define CONSOLE_FG_CUSTOM (1<<9)
14+
#define CONSOLE_BG_CUSTOM (1<<10)
15+
#define CONSOLE_COLOR_FG_BRIGHT (1<<11)
16+
#define CONSOLE_COLOR_BG_BRIGHT (1<<11)
1517

1618
#define FONT_XSIZE 8
1719
#define FONT_YSIZE 16

0 commit comments

Comments
 (0)