Sconsole: a simple function for printing strings on PS3
PSL1GHT is a fantastic SDK, growing day after day thanks to help of talented developers like phiren, MattP, AerialX and others.
What I need to start porting Scogger is to print some debug information (like screen size, sprites information and such), but unfortunately for me STDOUT and STDERR are redirected to the lv2 TTY interface.
Right now there are two ways I know for printing debug informations:
- using Kammy
- using libcairo font support provided by ps3libraries
Altought these are valid alternatives, they represent a complexity level that is too much for my lazyness: Kammy requires PS3 attached to the router via ethernet cable, plus it prints information to a pc, not to the screen. Most important it needs a peek/poke capable payaload, and my PSJailbreak dongle doesn’t have it.
Libcairo is new to me, it has amazing power but for now I don’t want to learn another library, also it is a waste to use it just for replacing printf.
That’s why I created very simple console, called Sconsole, whose job is to print some text on framebuffer using 8×16 fonts.
Let’s see how to use it:
Using Sconsole
Using Sconsole is very simple: just add the three files included in the zip file in your source directory and you are almost done.
Let’s see an example.
The first thing to do is actually import the header file:
#include "sconsole.h"
Then we need to initialize it, here it is the syntax:
void sconsoleInit(int bgColor, int fgColor, int screenWidth, int screenHeight);
- bgcolor is the background color of the printed string,
- fcColor is the actual font color
- screenWidth and screenHeight are your screen resolution
Colors are in the 0xAARRGGBB format (alpha channel not available). Few colors are defined in sconsole.h but you can use yours. Also FONT_COLOR_NONE means no color (“transparent”),
ScreenWidth and ScreenHeight are actually the screen resolution you get with videoGetResolution function.
sconsoleInit(FONT_COLOR_NONE, FONT_COLOR_BLACK, res.width, res.height);
Printing function needs X and Y coordinates, plus the pointer to the framebuffer where write into.
print(400, 80, "Hello world", framebuffer);
Or using sprintf before actually print comples strings:
sprintf(tempString, "Video resolution: %dx%d", res.width, res.height); print(540, 160, tempString, framebuffer);
Dead simple
Please note: 108 ASCII characters are included (most used ones). They are from 32 (space) to 126 (~) of the ASCII table . They include digits, uppercase & lowecase letters, pluse other ones like parenthesis, plus minus, commas…
Hope it will help someone, waiting for screen output of STDOUT/STDERR.
Happy coding!
Download
Demo pkg + sources (version 0.1)
Thanks
Bitmaps fonts courtesy of libogc.


[...] Scognito, famous for his PSL1GHT setup guide, has now released a simple funtion for printing strings on the PS3, entitled Sconsole. Sconsole prints out debug output to the screen, which can make debugging much easier. More info after the jump. [...]
PSGroove.com » Blog Archiv » Sconsole: A Simple Function for Printing Strings on PS3 ha detto questo su novembre 7, 2010 a 11:39 pm
[...] fonts courtesy of libogc. Happy Debugging! Source: scognito.wordpress.com Attached [...]
Sconsole: A Simple Function for Printing Strings on PS3 - PSX PS2 PS3 Scene Hacking Modchip & Jailbreak Community ha detto questo su novembre 8, 2010 a 1:34 am
[...] Happy coding! Thanks: Quote: Bitmaps fonts courtesy of libogc. Offizielle Webseite: Sconsole: a simple function for printing strings on PS3 Quelle: Sconsole: A Simple Function for Printing Strings on PS3 – PSX PS2 PS3 Scene Hacking Modchip [...]
PS3: Sconsole - ModControl.Com - GermanysNr1MultiConsoleSceneSource ha detto questo su novembre 8, 2010 a 10:36 pm
[...] – Scogger Running on PS3 Homebrew – Scogger Running on PS3 Scognito, creator of Sconsole and writer of the PSL1GHT Setup Guide has recently informed us via his twitter account about his [...]
Homebrew - Scogger Running on PS3 - PSX PS2 PS3 Scene Modchip & Jailbreak Community ha detto questo su novembre 20, 2010 a 5:52 am
[...] news source [...]
Sconsole: A Simple Function For Printing Strings On PS3 | PS3Hax Network ha detto questo su novembre 22, 2010 a 3:16 pm
Hey – if anyone is interested, I wrote a wrapper class in c++ for this that simulates an actual console buffer with line pruning, line wrap and so on, check it out —> http://rvlution.net/forums/viewtopic.php?f=41&t=836
Franc[e]sco ha detto questo su agosto 12, 2011 a 2:30 pm
Hey, I was looking for something like this. Can you please update this to the latest version of psl1ght? Thans.
mhaqs ha detto questo su febbraio 13, 2013 a 12:16 pm
Sorry I don’t mantain it anymore, feel free to modify it.
If you have some question you can ask here, I hope to be helpful
Scognito ha detto questo su febbraio 13, 2013 a 12:18 pm
No worries, and thanks for the fast response. Here’s the updated code that works with the latest version of psl1ght, feel free to check and update for this post.
http://www.tabinda.net/file/ti-sconsoleDemo.zip
mhaqs ha detto questo su febbraio 13, 2013 a 12:42 pm