Homebrew How do I display an image on the top screen of the 3DS (new or not) in high quality? [C++]

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
Country
United States
I've been dabbling in making mini 3DS C++ video games / homebrew apps, and it's been a blast. (For some reason, Switch just isn't as fun for me.)

But, I've been having some trouble with displaying images.

I would like to display my logo image on the upper / top screen, but I have no idea how to do this in C++ for 3DS.

Any help? Thanks!
 
D

Deleted User

Guest
When you figure out you photo issue, perhaps you could make a homebrew to convert BMP files to JPEG files? Also a homebrew to compress folders to ZIP? Would be very nice.
 
  • Like
Reactions: 3DScool

sup3rgh0st

Top Tier Ghost
Member
Joined
Apr 22, 2010
Messages
456
Trophies
1
XP
2,681
Country
United States
You probably want to use a library like SDL to handle that pretty easily. However if you're committed to rolling your own code, another route is to have your images in saved as some kind of uncompressed bitmap (.bmp) file format and just copy the color values into the frame buffer.

This code is like 5 years old now so things may have changed, but you can grab the top and bottom frame buffers and write to them as you wish.
Code:
u8* fbTop = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
u8* fbBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);

paint_pixel(fbTop, 10, 10, 255, 255, 255);
Code:
// FrameBuffer, XPos, YPos, R,G,B
void paint_pixel(u8* fb, u16 x, u16 y, u8 red, u8 green, u8 blue) {
	if ((x>=400) || (x<0)) {return;}
	if ((y>=240) || (y<0)) {return;}
	
	fb[3*(y+x*240)] = blue;
	fb[3*(y+x*240)+1] = green;
	fb[3*(y+x*240)+2] = red;
}
 
Last edited by sup3rgh0st, , Reason: Code Snippit

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
Country
United States
You probably want to use a library like SDL to handle that pretty easily. However if you're committed to rolling your own code, another route is to have your images in saved as some kind of uncompressed bitmap (.bmp) file format and just copy the color values into the frame buffer.

This code is like 5 years old now so things may have changed, but you can grab the top and bottom frame buffers and write to them as you wish.
Code:
u8* fbTop = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
u8* fbBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);

paint_pixel(fbTop, 10, 10, 255, 255, 255);
Code:
// FrameBuffer, XPos, YPos, R,G,B
void paint_pixel(u8* fb, u16 x, u16 y, u8 red, u8 green, u8 blue) {
    if ((x>=400) || (x<0)) {return;}
    if ((y>=240) || (y<0)) {return;}
   
    fb[3*(y+x*240)] = blue;
    fb[3*(y+x*240)+1] = green;
    fb[3*(y+x*240)+2] = red;
}

Hmm! Thanks :)

--------------------- MERGED ---------------------------

When you figure out you photo issue, perhaps you could make a homebrew to convert BMP files to JPEG files? Also a homebrew to compress folders to ZIP? Would be very nice.

Unless you need it for 3ds homebrew, just find an online converter, e.g. "bmp to jpeg online"
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    realtimesave @ realtimesave: can troll SylverReZ the following day :)