Hacking drawString F R E E Z E

hugofestA

Well-Known Member
OP
Newcomer
Joined
Feb 10, 2016
Messages
52
Trophies
0
Age
32
Location
mast:3rw0rld
Website
oddity.comxa.com
XP
101
Country
Hungary
Hi!
I have problems with drawstring(yes, again).
The problem is the same, so:
Code:
fillScreen(0,0,0,0);
drawString(1, 1, "Hello World! we haxd u");
flipBuffers();
After running this code, Wii U freezes, the .mp4 loading icon freezes, and the GamePad freezes too.
I tried with my custom library, same problem:
Code:
//flipBuffers(int bufferNum)
//This is for "executing drawing to the screen"
//Think about it like a piece of paper
//The program writes it to the bottom of the paper, so you need to flip it to see it
//There are 2 pieces of paper: 1 for the GamePad, 1 for the TV.
//bufferNums:
//TV: 0
//GamePad: 1
void flipBuffers(unsigned int bufferNum){
  //"Including" coreinit module
  unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
  //Setting functions
  void(*DCFlushRange)(void *buffer, uint32_t length);
unsigned int(*OSScreenFlipBuffersEx)(unsigned int bufferNum);
OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &DCFlushRange);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx);
unsigned int(*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx);
  //Grabbing the buffer size for the screen in bufferNum
  int buf_size = OSScreenGetBufferSizeEx(bufferNum);
  //Flushing cache
  DCFlushRange((void *)0xF4000000, buf_size);
  //Flipping the buffer
  OSScreenFlipBuffersEx(bufferNum);
}

//drawstring(unsigned int bufferNum, int x, int line, char * string)
//Drawing a string
//bufferNum = buffer number of display
//x = position on x axis
//line = line on y axis
//string = text to print
void drawString(unsigned int bufferNum, int x, int line, char * string)
{
  //"Including" coreinit module
unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
  //Setting functions
unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int line, void * buffer);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx);
  //Drawing the string
OSScreenPutFontEx(bufferNum, x, line, string);
}
//fillScreen(unsigned int bufferNum, char r,char g,char b,char a)
//Filling screen
//bufferNum = buffer number of display
//r = amount of red
//g = amount of green
//b = amount of blue
//a = ???(maybe darkness)
void fillScreen(unsigned int bufferNum, char r,char g,char b,char a)
{
  //"Including" coreinit module
unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
  //Setting functions
unsigned int(*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx);
  //Crafting a number from r, g, b and a
uint32_t num = (r << 24) | (g << 16) | (b << 8) | a;
  //Filling screen (clearing buffer "with" a custom color)
OSScreenClearBufferEx(bufferNum, num);
}
Can somebody help?
Thanks,
hugo

Edit: SOLVED!!!
 
Last edited by hugofestA,

NWPlayer123

Well-Known Member
Member
Joined
Feb 17, 2012
Messages
2,642
Trophies
0
Location
The Everfree Forest
XP
6,693
Country
United States
Oh, I found your error, not enough arguments. You forgot the bufferNum, drawString(0, 1, 1, "Hello World! we haxd u"); //TV, at pos 1, 1
I'd also include types.h and update your drawString types
http://wiiubrew.org/wiki/Coreinit.rpl#Screen
Code:
void drawString(int bufferNum, uint32_t posX, uint32_t posY, const char *string)
{
    uint32_t coreinit_handle;
    OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); //Get handle
    void (*OSScreenPutFontEx)(int bufferNum, uint32_t posX, uint32_t posY, const char *string); //Define
    OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); //Obtain
    OSScreenPutFontEx(bufferNum, posX, posY, string); //Call
}
 

hugofestA

Well-Known Member
OP
Newcomer
Joined
Feb 10, 2016
Messages
52
Trophies
0
Age
32
Location
mast:3rw0rld
Website
oddity.comxa.com
XP
101
Country
Hungary
Oh, I found your error, not enough arguments. You forgot the bufferNum, drawString(0, 1, 1, "Hello World! we haxd u"); //TV, at pos 1, 1
I'd also include types.h and update your drawString types
http://wiiubrew.org/wiki/Coreinit.rpl#Screen
Code:
void drawString(int bufferNum, uint32_t posX, uint32_t posY, const char *string)
{
    uint32_t coreinit_handle;
    OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); //Get handle
    void (*OSScreenPutFontEx)(int bufferNum, uint32_t posX, uint32_t posY, const char *string); //Define
    OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); //Obtain
    OSScreenPutFontEx(bufferNum, posX, posY, string); //Call
}
No:
Code:
void drawString(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);
 OSScreenPutFontEx(1, x, line, string);
}
 

NWPlayer123

Well-Known Member
Member
Joined
Feb 17, 2012
Messages
2,642
Trophies
0
Location
The Everfree Forest
XP
6,693
Country
United States
No:
Code:
void drawString(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);
OSScreenPutFontEx(1, x, line, string);
}
That's a different snippet than in the OP, but then I don't see what else is wrong :\
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    @Veho, Stepcroc, I'm stuck.
  • Veho @ Veho:
    Those are monitor lizards you dunce.
    +1
  • SylverReZ @ SylverReZ:
    I'm funny. lol.
  • K3Nv2 @ K3Nv2:
    Eggs and roasted potatoes came out good
  • K3Nv2 @ K3Nv2:
    Watching the first omen and so far it's not the priest doing the scaring
  • Veho @ Veho:
    Shouldn't the kid be the scary one?
  • K3Nv2 @ K3Nv2:
    The second omen: the chior boy gets his revenge
  • Veho @ Veho:
    Reverse exorcist: it's when you hire a demon to remove the priest out of a small child.
  • K3Nv2 @ K3Nv2:
    Hire Kendrick Drake possessed a minor again
  • Veho @ Veho:
    Yeah, I'd run away from his singing too.
  • K3Nv2 @ K3Nv2:
    I wonder if Drakes still allowed to use his Instagram
  • ZeroT21 @ ZeroT21:
    sounds like everyone has some great imaginary friends
  • SylverReZ @ SylverReZ:
    @K3Nv2, Yeah, that was insane.
  • SylverReZ @ SylverReZ:
    Don't know what Drake was even thinking.
  • K3Nv2 @ K3Nv2:
    What every rich scumbag thinks that they can put their dick on anything and get away with it
  • ZeroT21 @ ZeroT21:
    I better hide my silicone Tifa doll
    +1
  • Veho @ Veho:
    What did Drake do, exactly? I don't follow celeb gossip.
  • SylverReZ @ SylverReZ:
    @Veho, Supposed accusations that Drake groomed a minor.
  • K3Nv2 @ K3Nv2:
    Allegedly groomed a 17 year old Instagram model or something along those lines
  • SylverReZ @ SylverReZ:
    Yep, something like that.
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=F1MJtV0UPI8