Hacking Print on Screen

PandaOnSmack

Well-Known Member
OP
Member
Joined
Nov 3, 2015
Messages
349
Trophies
0
Age
43
XP
315
Country
Is it possible to write values on screen through pure assembly?

Would you have to rely on a print function that the game provides? I am just trying to expand my understanding of PPC / Assembly.
 

Hikari06

Well-Known Member
Member
Joined
Nov 20, 2012
Messages
999
Trophies
0
XP
936
Country
Ecuador
Is it possible to write values on screen through pure assembly?

Would you have to rely on a print function that the game provides? I am just trying to expand my understanding of PPC / Assembly.

I'm not too familiar with the wii u but I guess you could just call the proper functions from your assembly code (OSScreenInit,OSScreenSetBufferEx,OSScreenFlipBuffersEx,OSScreenPutFontEx).

Edit : You could maybe also write the pixels one by one on the screen buffer but I'm not sure what you would gain from doing that.
 
Last edited by Hikari06,

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,467
Country
Germany
How do you call a function via PPC?
You call a function in assembly by doing a bl to the address of the function (yes, you will have to find that) but I don't think you will get anywhere with this overall since the OSScreen functions won't really work. I tried it before in games and it crashes. Maybe I made a mistake though. In C printing to the screen looks similar to this:
Code:
void writeScreen(char message[100], int secondsDelay) {
    OSScreenClearBufferEx(0, 0);
    OSScreenClearBufferEx(1, 0);

    OSScreenPutFontEx(0, 14, 1, message);
    OSScreenPutFontEx(1, 14, 1, message);

    sleep(secondsDelay);

    OSScreenFlipBuffersEx(0);
    OSScreenFlipBuffersEx(1);
}
First of all you have to call OSScreenInit() though to initialize the screen.

I still recommend getting it to work in C first and then maybe try and write it in assembly but if you can use C you may just copy the compiled function's assembly and use that for a code or whatever.
 
Last edited by BullyWiiPlaza,

Hikari06

Well-Known Member
Member
Joined
Nov 20, 2012
Messages
999
Trophies
0
XP
936
Country
Ecuador
You call a function in assembly by doing a bl to the address of the function but I don't think you will get anywhere with this overall since the OSScreen functions won't really work. I tried it before in games and it crashes. Maybe I made a mistake though. In C printing to the screen looks similar to this:
Code:
void writeScreen(char message[100], int secondsDelay) {
    OSScreenClearBufferEx(0, 0);
    OSScreenClearBufferEx(1, 0);

    OSScreenPutFontEx(0, 14, 1, message);
    OSScreenPutFontEx(1, 14, 1, message);

    sleep(secondsDelay);

    OSScreenFlipBuffersEx(0);
    OSScreenFlipBuffersEx(1);
}
First of all you have to call OSScreenInit() though to initialize the screen.

I still recommend getting it to work in C first and then maybe try and write it in assembly but if you can use C you may just copy the compiled function's assembly and use that for a code or whatever.

The OSScreen functions do work from what I can tell.

Maybe you should add this after OSScreenInit():

Code:
int screen_buf0_size = OSScreenGetBufferSizeEx(0);
int screen_buf1_size = OSScreenGetBufferSizeEx(1);
unsigned char *screenBuffer = MEM1_alloc(screen_buf0_size + screen_buf1_size, 0x100);
OSScreenSetBufferEx(0, screenBuffer);
OSScreenSetBufferEx(1, (screenBuffer + screen_buf0_size));

I'm not sure how one would do that directly from assembly though so inspecting the compiled code might be a good idea
 
Last edited by Hikari06,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    ButterScott101 @ ButterScott101: +1