Console: improvements by porting code from libctru#220
Conversation
extends ansi escape code support and allows codes to be spread across multiple prints
DacoTaco
left a comment
There was a problem hiding this comment.
general comments on first glance, didn't test anything yet ^^;
| if( !(con = curr_con) ) return; | ||
| if( !(con = currentConsole) ) return; | ||
|
|
||
| unsigned int bgcolor = con->bg; |
|
|
||
| con->foreground = COLOR_WHITE; | ||
| con->background = COLOR_BLACK; | ||
| con->fg = 7; |
There was a problem hiding this comment.
I can answer that- flags 0 means there are no modifications to text done besides color from table, and 0 and 7 are indices into the color table, 0 for black and 7 for white. I absolutely acknowledge that it's not the clearest system (and probably could do with a comment) since fg and bg are sometimes table color and other times a straight-up color value, but in my defense, that's just how it was before I got to the 3DS version.
There was a problem hiding this comment.
@piepie62 : thats fine, but i think maybe the flags could use a define, but i didn't look at its usage and if defines were used to explain the magic values it gets ^^;
i think things like COLOR_BLACK or something would say more than just 7 hehe
There was a problem hiding this comment.
@DacoTaco I think if there are standard values for these in OS headers we should use those rather than just inventing defines
There was a problem hiding this comment.
oh ye, if the values are available in OS headers those are indeed preferred !
my problem is just about magic values hehe
| con->bg = 0; | ||
|
|
||
| con->flags = 0; | ||
| con->tabSize = 4; |
|
Validated in apps using dolphin :
|
Extends ansi escape code support in the console. Added codes 90-97, 100-107, light text, strike through, underline, 256 color LUT ( ESC[38;5;⟨n⟩m, ESC[48;5;⟨n⟩m ) and RGB colors ( ESC[38;2;⟨r⟩;⟨g⟩;⟨b⟩m and ESC[48;2;⟨r⟩;⟨g⟩;⟨b⟩m ).
Code mostly ported from code written for libctru by @piepie62