Hacking Wii U Hacking & Homebrew Discussion

cmdj13

Well-Known Member
Member
Joined
Aug 28, 2015
Messages
139
Trophies
0
Location
In front of my computer
XP
219
Country
Gambia, The
OSScreenPutFontEx()
I can't get that to work. My code looks like this (I got some parts from the osscreenexample template, but the whole thing didn't work for some friends, so I wnated to do it myself and see whether that works):

loader.c
Code:
#include "loader.h"

void _start()
{
    unsigned int coreinit_handle;
    OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);

    /****************************>       External Prototypes       <****************************/
    void(*_Exit)();
    //OSScreen functions
    void(*OSScreenInit)();
    void(*OSScreenPutFontEx)(int bufferNum, uint32_t posX, uint32_t posY, const char *str);

    /****************************>             Exports             <****************************/
    OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
    //OSScreen functions
    OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenInit", &OSScreenInit);
    OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx);

    OSScreenInit();
    OSScreenPutFontEx(1, 0, 0, "Hello World!");

    int wait = 0x1FFFFF;
    while (wait)
        --wait;

    _Exit;
}

loader.h
Code:
#ifndef LOADER_H
#define LOADER_H

#include "../../../libwiiu/src/coreinit.h"
#include "../../../libwiiu/src/vpad.h"
#include "../../../libwiiu/src/types.h"
#include "../../../libwiiu/src/draw.h"

void _start();

#endif /* LOADER_H */

But when I run it on my WiiU, I just get a messed up screen :(
 

Kakkoii

Old fart
Member
Joined
Sep 14, 2007
Messages
631
Trophies
0
XP
586
Country
Canada
I can't get that to work. My code looks like this (I got some parts from the osscreenexample template, but the whole thing didn't work for some friends, so I wnated to do it myself and see whether that works):
Try this instead:
Code:
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);

We really need some guides how to actually use the kernel exploit to code shit. It's kinda hard now if you're not an asm ninja with just a pong example...
You don't need to know ASM to do this.. Just look up what the functions do, implement them and then utilize them in your code just like you would in any other coding project.
 
Last edited by Kakkoii,
  • Like
Reactions: AboodXD and cmdj13

JaceCearK1

Well-Known Member
Member
Joined
May 18, 2015
Messages
540
Trophies
0
Age
27
XP
415
Country
Gambia, The
We really need some guides how to actually use the kernel exploit to code shit. It's kinda hard now if you're not an asm ninja with just a pong example...
You don't need to know ASM to write good C code yourself! ;) (wouldn't hurt though! ^^)
What program exactly do you expect? :P
 
Last edited by JaceCearK1,

Kakkoii

Old fart
Member
Joined
Sep 14, 2007
Messages
631
Trophies
0
XP
586
Country
Canada
Is there a function to make the WiiU wait for some time? I hate the solution with
Code:
int wait;
while (wait)
    --wait;
Programming 101: If you're going to be doing the same thing over and over again, make it a method/function and/or loop.

Code:
void wait(int wait)
{
    while(wait--) ; //Continue to operate while 'wait' isn't 0. Decrement by 1 each time it checks.
}

Then whenever you want to wait, you simple do something like this: wait(124);

Make sure to place the method outside of start() or any other methods. Preferably at the bottom of your code, out of the way.
 
Last edited by Kakkoii,

Marionumber1

Well-Known Member
Member
Joined
Nov 7, 2010
Messages
1,234
Trophies
3
XP
4,045
Country
United States
We really need some guides how to actually use the kernel exploit to code shit. It's kinda hard now if you're not an asm ninja with just a pong example...

The central idea behind the kernel exploit is that you can map any non-IOSU physical address as read-write, and do whatever you want to it. This includes the loader, system libraries, the kernel, and game code, but you need to know what you're doing with that memory. A guide for all of that would be too broad, in my opinion.
 

ploggy

WAKA! WAKA!
Member
Joined
Aug 29, 2007
Messages
4,818
Trophies
2
XP
7,847
Country
United Kingdom
Has anyone tried to see if it's possible to enable the WiiU tablet Controls while in vWii mode?
I remember there was talk about it early on but nothing has been said about it for a while.
 

cmdj13

Well-Known Member
Member
Joined
Aug 28, 2015
Messages
139
Trophies
0
Location
In front of my computer
XP
219
Country
Gambia, The
Programming 101: If you're going to be doing the same thing over and over again, make it a method/function and/or loop.

Code:
void wait(int wait)
{
    while(wait--) ; //Continue to operate while 'wait' isn't 0. Decrement by 1 each time it checks.
}

Then whenever you want to wait, you simple do something like this: wait(124);

Make sure to place the method outside of start() or any other methods. Preferably at the bottom of your code, out of the way.

I know, my problem with it is that I'd find a function that I can give a certain time to wait much better. I just can't estimate how long wait() will wait for a certain number, but when I call a function sleep(500) which sleeps for 0,5 seconds I know that it will wait exactly 0,5 seconds.
 
Last edited by cmdj13,

Marionumber1

Well-Known Member
Member
Joined
Nov 7, 2010
Messages
1,234
Trophies
3
XP
4,045
Country
United States
I know, my problem with it is that I'd find a function that I can give a certain time to wait much better. I just can't estimate how long wait() will wait for a certain number, but when I call a function sleep(500) which sleeps for 0,5 seconds I know that it will wait exactly 0,5 secands.

OSSleepTicks() exists; it waits for a certain number of ticks of the internal PPC timer. You can experiment/do math to figure out what that is in seconds.
 

cmdj13

Well-Known Member
Member
Joined
Aug 28, 2015
Messages
139
Trophies
0
Location
In front of my computer
XP
219
Country
Gambia, The
I tried to use OSSleepTicks() after loading it like this:
Code:
    void(*OSSleepTicks)(unsigned int ticks);
    OSDynLoad_FindExport(coreinit_handle, 0, "OSSleepTicks", &OSSleepTicks);
but my WiiU doesn't like it that way and crashes :( I also couldn't find OSSleepTicks() on WiiuBrew, so I have no idea how to load it the right way.
 

Marionumber1

Well-Known Member
Member
Joined
Nov 7, 2010
Messages
1,234
Trophies
3
XP
4,045
Country
United States
I tried to use OSSleepTicks() after loading it like this:
Code:
    void(*OSSleepTicks)(unsigned int ticks);
    OSDynLoad_FindExport(coreinit_handle, 0, "OSSleepTicks", &OSSleepTicks);
but my WiiU doesn't like it that way and crashes :( I also couldn't find OSSleepTicks() on WiiuBrew, so I have no idea how to load it the right way.

You can also try the worse method of polling OSGetTick(), which gives you the current PPC tick count. Store the initial value, and keep calling it until a certain number of ticks has elapsed.
 
  • Like
Reactions: cmdj13

cmdj13

Well-Known Member
Member
Joined
Aug 28, 2015
Messages
139
Trophies
0
Location
In front of my computer
XP
219
Country
Gambia, The
You can also try the worse method of polling OSGetTick(), which gives you the current PPC tick count. Store the initial value, and keep calling it until a certain number of ticks has elapsed.
Like this?
Code:
void wait(unsigned int ticks)
{
    unsigned int coreinit_handle;
    OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);

    unsigned int(*OSGetTick)();
    OSDynLoad_FindExport(coreinit_handle, 0, "OSGetTick", &OSGetTick);

    unsigned int start_ticks = OSGetTick();
    unsigned int current_ticks = OSGetTick();

    while (current_ticks != start_ticks + ticks)
        current_ticks = OSGetTick();
}
edit: Hm, seems to do nothing...
btw it seems to just crash on a random base, it mostly works, but sometimes crashes...
 
Last edited by cmdj13,

afra

Well-Known Member
Newcomer
Joined
Jul 13, 2015
Messages
59
Trophies
0
Age
38
XP
208
Country
Iran
Hi and thank u for reading this . my friend's Wii u is on 5.4'( Mario maker bundle) and we have some questions : to aks
1 he has Mario maker physical copy but didn't put it in console . can he play Mario maker offline from disk without any update ? How about online course play ?

2 - For 5.4 F.M is there any iso loader ? Or it's only for 5.3.2 ?

Thank u so much for your time and wait for answer
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: https://www.keepretro.com/products/miyoo-a30