- Joined
- Feb 10, 2016
- Messages
- 52
- Trophies
- 0
- Age
- 32
- Location
- mast:3rw0rld
- Website
- oddity.comxa.com
- XP
- 101
- Country
void _start()
{
fillScreenTV(0,0,0,0);
drawStringTV(0, 0, "Restart your Wii U.\n\n\n\n\nSorry.")
flipBuffers();
}
Oh freak. Thanks.You're missing flipBuffers() that's the problem.
Code:void _start() { fillScreenTV(0,0,0,0); drawStringTV(0, 0, "Restart your Wii U.\n\n\n\n\nSorry.") flipBuffers(); }
I don't know the technical reason why you need flipBuffers(), but it's always required when drawing stuff. Take a look at some source code of other apps and study how the program actually works. It will give you a good steady boost of knowledge of how to actually code a homebrew app.Oh freak. Thanks.
1. What does flipBuffers do?
2. What if I want it to be on the gamepad?
What if I want it to be on the gamepad?I don't know the technical reason why you need flipBuffers(), but it's always required when drawing stuff. Take a look at some source code of other apps and study how the program actually works. It will give you a good steady boost of knowledge of how to actually code a homebrew app.
Oh god, I forgot. I'm using my own custom drawing library so it wouldn't be like that. It'd just be drawString in your average libwiiu.What if I want it to be on the gamepad?
Just change drawStringTV and fillScreenTV to drawString and fillScreen?
void drawStringGamePad(int x, int line, char * string)
{
unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int line, void * buffer);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx);
OSScreenPutFontEx(1, x, line, string);
}
And for the TV? :3Oh god, I forgot. I'm using my own custom drawing library so it wouldn't be like that. It'd just be drawString in your average libwiiu.
for you, I'd add this code into draw.c in libwiiu/src/draw.c if you want to just draw a string to the GamePad:
Code:void drawStringGamePad(int x, int line, char * string) { unsigned int coreinit_handle; OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int line, void * buffer); OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); OSScreenPutFontEx(1, x, line, string); }
And for the TV? :3
void drawStringTV(int x, int line, char * string)
{
unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int line, void * buffer);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx);
OSScreenPutFontEx(0, x, line, string);
}
Yes, for TV it's:Code:void drawStringTV(int x, int line, char * string) { unsigned int coreinit_handle; OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int line, void * buffer); OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); OSScreenPutFontEx(0, x, line, string); }
Notice any difference between the two functions?
OSScreenPutFontEx(0, x, line, string);
OSScreenPutFontEx(1, x, line, string);
We're finally getting somewhere now!Yes, for TV it's:
And for gamepad it's:Code:OSScreenPutFontEx(0, x, line, string);
Code:OSScreenPutFontEx(1, x, line, string);
But why it's called bufferNum, if it's changing the display?We're finally getting somewhere now!
It's "double buffered", 0 is TV and 1 is Gamepad, think of it like a piece of paper, the program writes it on the bottom and you have to flip it over to see it. There's 2 pieces of paper, one for TV and one for Gamepad.But why it's called bufferNum, if it's changing the display?
--------------------- MERGED ---------------------------
Can somebody tell it?
And for fillScreenTV and fillScreenGamePad?Oh god, I forgot. I'm using my own custom drawing library so it wouldn't be like that. It'd just be drawString in your average libwiiu.
for you, I'd add this code into draw.c in libwiiu/src/draw.c if you want to just draw a string to the GamePad:
Code:void drawStringGamePad(int x, int line, char * string) { unsigned int coreinit_handle; OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int line, void * buffer); OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); OSScreenPutFontEx(1, x, line, string); }
Oh! I figured it out! I just need to call OSClearBufferEx with 0 or 1 bufferNum!And for fillScreenTV and fillScreenGamePad?
Do I need to run this in a loop, like this?You're missing flipBuffers() that's the problem.
Code:void _start() { fillScreenTV(0,0,0,0); drawStringTV(0, 0, "Restart your Wii U.\n\n\n\n\nSorry.") flipBuffers(); }
void _start()
{
while(1){
fillScreenTV(0,0,0,0);
drawStringTV(0, 0, "Restart your Wii U.\n\n\n\n\nSorry.");
flipBuffers();
}
}
Nah, only need to call it once, the back buffer and front buffer won't change unless you run code to, that's just doing unnecessary work for the same result. and yeah, OSScreenTemplates is also pretty helpful. I should commit my old Mario sprite test thereDo I need to run this in a loop, like this?
Code:void _start() { while(1){ fillScreenTV(0,0,0,0); drawStringTV(0, 0, "Restart your Wii U.\n\n\n\n\nSorry."); flipBuffers(); } }
--------------------- MERGED ---------------------------
:insert emoji of my profile picture here:
I'm so stupid.
Can somebody lock/delete these threads?
P.S.: Nobody said there's an osscreentemplates folder...