Homebrew Homebrew Development

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
  • Some code is taken from AlbertoSONIC! Thanks :)
You're welcome! ;)

Anyway, if you want to clean the screen, you can use:

-To clear the bottom screen:
Code:
screenBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
clearScreen(screenBottom, GFX_BOTTOM);

-and for the top one:
Code:
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
clearScreen(screenTopLeft, GFX_LEFT);
clearScreen(screenTopRight, GFX_LEFT);

But as far as i know it cleans everything you can see on the screen... Not some specific things only...
 
  • Like
Reactions: filfat and Foxi4

filfat

CTO @ Nordcom Group Inc.
Member
Joined
Nov 24, 2012
Messages
1,261
Trophies
1
Location
Gothenburg, Sweden
Website
www.sweetsideofsweden.com
XP
1,749
Country
Sweden
You're welcome! ;)

Anyway, if you want to clean the screen, you can use:

-To clear the bottom screen:
Code:
screenBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
clearScreen(screenBottom, GFX_BOTTOM);

-and for the top one:
Code:
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
clearScreen(screenTopLeft, GFX_LEFT);
clearScreen(screenTopRight, GFX_LEFT);

But as far as i know it cleans everything you can see on the screen... Not some specific things only...
I guess printf prints to the top screen riight(see what I did there)? Still getting started on the 3DS development over here XD

Edit: should also to mention that I have no way as of yet to execute the code(well expect Citra when cMake GUI decides to work properly)
 

PewnyPL

Well-Known Member
Member
Joined
Feb 2, 2014
Messages
771
Trophies
1
XP
2,221
Country
Poland
-and for the top one:
Code:
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
clearScreen(screenTopLeft, GFX_LEFT);
clearScreen(screenTopRight, GFX_LEFT);


Wait, shouldn't for top-right screen both GFX_LEFT be changed to GFX_RIGHT?
 

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
filfat Well, printing isn't that simple.

First of all, if you want to print to the top screen, you have write that:
Code:
char buffer[100];
 
sprintf(buffer, "text");
drawString(buffer, 1, 131, 255, 255, 255, screenTopLeft, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenTopRight, GFX_LEFT);
where "1" and "131" are the text position and "255" "255" "255" are RGB values.
If you want to print to the bottom screen, you have to change "screenTopLeft" and "GFX_LEFT". Here's an example:
Code:
char buffer[100];
 
sprintf(buffer, "text");
drawString(buffer, 1, 131, 255, 255, 255, screenBottom, GFX_BOTTOM);

But this isn't finished. Now you have to render everything (by swapping gfx), so you have to insert that:
Code:
gfxFlushBuffers();
gfxSwapBuffers();
screenBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);

Now, you have to do that again! Yes, you've heard right, you need to print (and render) everything twice!
So, finally, the code to write the word "text" to both the top and the bottom screens should be:

Code:
char buffer[100];
 
sprintf(buffer, "text");
drawString(buffer, 1, 131, 255, 255, 255, screenTopLeft, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenTopRight, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenBottom, GFX_BOTTOM);
 
gfxFlushBuffers();
gfxSwapBuffers();
screenBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
 
char buffer[100];
 
sprintf(buffer, "text");
drawString(buffer, 1, 131, 255, 255, 255, screenTopLeft, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenTopRight, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenBottom, GFX_BOTTOM);
 
gfxFlushBuffers();
gfxSwapBuffers();
screenBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);

It's long, isn'it? But there's a little workaround to simplify this code, which is the one i used in my homebrew. You can write:

Code:
void printtext()
{
char buffer[100];
 
sprintf(buffer, "text");
drawString(buffer, 1, 131, 255, 255, 255, screenTopLeft, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenTopRight, GFX_LEFT);
drawString(buffer, 1, 131, 255, 255, 255, screenBottom, GFX_BOTTOM);
}
 
void render()
{
gfxFlushBuffers();
gfxSwapBuffers();
screenBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_BOTTOM, NULL, NULL);
screenTopLeft = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
screenTopRight = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
}

And then, when you want to write "text", you just have to write this few lines: (Remember that you can use render(); everytime you want to render something. Don't write a lot of rendering -related lines, one is enough!)
Code:
printtext();
render();
printtext();
render();

That's all! I hope i helped you!

P.S. Remember to add printtext(); and render(); to the header (*.h) file!
 
  • Like
Reactions: filfat

AlbertoSONIC

Pasta Team Member
Member
Joined
Jun 27, 2014
Messages
927
Trophies
0
Age
52
Website
www.albertosonic.com
XP
1,396
Country
Italy
He wrong :P probably just clear the TopLeftFrameBuffer two times.

Man you're right!

EDIT: Changed it in my homebrew, it doesn't work with GFX_RIGHT. So i was right, at least with using GFX_LEFT with TopScreenRight while printing text.

This is what happends:
dab94c1a7ae3a393ee1cf651a1c922b0.jpg
 
  • Like
Reactions: st4rk

filfat

CTO @ Nordcom Group Inc.
Member
Joined
Nov 24, 2012
Messages
1,261
Trophies
1
Location
Gothenburg, Sweden
Website
www.sweetsideofsweden.com
XP
1,749
Country
Sweden
DEVELOPERS LOOK HERE
HI! Anyone here who are interested to help develop DownloadMii?
What will DownloadMii become? DownloadMii will hopefully become a marketplace for Homebrew applications that you can download and install with a few clicks, no more pc hassle!

what do I need help in?
That's a very broad question, I obviously would like as much help as possibly. However I mostly need help when it comes to creating a rich GUI for the user, the server and application backend is something I could manage to do by myself if needed.

Other
The absolute best would be if we could get a working prototype to launch with the SSSpwn release so people only need to install one homebrew application using their pc. For updates we could easily just replace the 3dsx file and then use the AppJump function.

Github link: https://github.com/DownloadMii/DownloadMii


I WILL BE THANKFUL FOR ANY HELP!!! :D
 

mocalacace

Well-Known Member
Member
Joined
Sep 28, 2008
Messages
327
Trophies
1
Location
127.0.0.1
XP
960
Country
United States
Hey guys, so I've reinstalled devkirPro and I'm still getting an error trying to compile arm11 homebrew. When I try to compile it tells me c:/devkitpro/devkitarm/lib/gcc/arm-none-eabi/bin/ld.exe: cannot find - lctru, the actual directory it prints out is c:/devkitPro/devkitarm/bin/../lib/gcc-arm-none-eaci/4.8.2/../../../../arm-none-eabi/bin/ld.exe, but that is equivalent to the directory before. Also I have the file ld.exe in that directory. Anybody know whats up?
 

filfat

CTO @ Nordcom Group Inc.
Member
Joined
Nov 24, 2012
Messages
1,261
Trophies
1
Location
Gothenburg, Sweden
Website
www.sweetsideofsweden.com
XP
1,749
Country
Sweden
Hey guys, so I've reinstalled devkirPro and I'm still getting an error trying to compile arm11 homebrew. When I try to compile it tells me c:/devkitpro/devkitarm/lib/gcc/arm-none-eabi/bin/ld.exe: cannot find - lctru, the actual directory it prints out is c:/devkitPro/devkitarm/bin/../lib/gcc-arm-none-eaci/4.8.2/../../../../arm-none-eabi/bin/ld.exe, but that is equivalent to the directory before. Also I have the file ld.exe in that directory. Anybody know whats up?
You need to compile ctrulib ;) (navigate to the libctru folder and type "make" inside a console window)
 

mocalacace

Well-Known Member
Member
Joined
Sep 28, 2008
Messages
327
Trophies
1
Location
127.0.0.1
XP
960
Country
United States
You need to compile ctrulib ;) (navigate to the libctru folder and type "make" inside a console window)

Thank you I got it to build now. I get an error at the end that says
ELF has no symbol table!

make[1]: *** [/c/user/me/desktop/3dsbinaryfolder/3dsdec2binary.3dsx] error 1

make: *** [build] error 2

It created the 3ds and cia and elf file. Will they all work? it just couldn't make the 3dsx file?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    bassviolet @ bassviolet: wth