Skip to content

Console: improvements by porting code from libctru#220

Merged
DacoTaco merged 9 commits into
masterfrom
console-improvements
Jun 8, 2025
Merged

Console: improvements by porting code from libctru#220
DacoTaco merged 9 commits into
masterfrom
console-improvements

Conversation

@WinterMute
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

@DacoTaco DacoTaco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general comments on first glance, didn't test anything yet ^^;

Comment thread libogc/console.c Outdated
if( !(con = curr_con) ) return;
if( !(con = currentConsole) ) return;

unsigned int bgcolor = con->bg;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space/tabbing :D

Comment thread libogc/console.c Outdated

con->foreground = COLOR_WHITE;
con->background = COLOR_BLACK;
con->fg = 7;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is 7, 0 and the flags 0?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DacoTaco I think if there are standard values for these in OS headers we should use those rather than just inventing defines

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ye, if the values are available in OS headers those are indeed preferred !
my problem is just about magic values hehe

Comment thread libogc/console.c Outdated
con->bg = 0;

con->flags = 0;
con->tabSize = 4;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space/tabbing

Comment thread libogc/console_internal.h
@DacoTaco
Copy link
Copy Markdown
Member

DacoTaco commented Jun 7, 2025

Validated in apps using dolphin :

  • Priiloader
  • YAWM-ModMii-Edition
  • ansi-escape-demo
  • test all 3 apps on actual hardware (wii, wiiu, gc) once i have builds of all 3 applications

console-tests.zip

@DacoTaco DacoTaco changed the title Console improvements Console: improvements by porting code from libctru Jun 8, 2025
@DacoTaco DacoTaco merged commit 49162d1 into master Jun 8, 2025
2 checks passed
@WinterMute WinterMute deleted the console-improvements branch June 10, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants