Homebrew Official 5.5.X ELF Loader

  • Thread starter Thread starter NWPlayer123
  • Start date Start date
  • Views Views 104,743
  • Replies Replies 427
  • Likes Likes 63
Did Voxel and Nexo start another thread to discuss their development? I loved reading about their progress (and it was also VERY educational in case I decide to give it a go myself)!!

Don't give up guys!!!

I found it entertaining as well. I do a lot of web and game programming so I'm always interested in how this stuff works. I think they just switched to PMs to discuss it. I wish I knew enough to help, but sadly I don't. The most I can do is wish them luck!
 
  • Like
Reactions: Deleted User
Does someone know why that:
Code:
if (vpad_data.btn_hold & BUTTON_HOME) {
    _osscreenexit();
    _doExit();
}
is not working for me? I'm constantly getting a white screen.
I also tried SonyUSA solution:
Code:
if (vpad_data.btn_hold & BUTTON_HOME) {
    void(*_Exit)();
    OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
    int ii=0;
    for(ii;ii<2;ii++)
    {
        fillScreenQuick(0,0,0,0);
        flipBuffersQuick();
    }
    _Exit();
}
But still whit screen. What am I doing wrong?
 
Last edited by rw-r-r_0644,
Does someone know why that:
Code:
if (vpad_data.btn_hold & BUTTON_HOME) {
    _osscreenexit();
    _doExit();
}
is not working for me? I'm constantly getting a white screen.
I also tried SonyUSA solution:
Code:
if (vpad_data.btn_hold & BUTTON_HOME) {
    void(*_Exit)();
    OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
    int ii=0;
    for(ii;ii<2;ii++)
    {
        fillScreenQuick(0,0,0,0);
        flipBuffersQuick();
    }
    _Exit();
}
But still whit screen. What am I doing wrong?
Are you trying to call that from your main function? Don't, just let the function continue to the end, AFTER you call the screen clear and buffer flips. Do not call exit, let the main function finish and return. No crashes then. Look at how I did it in the LiteNESU code and the Hello World example.

That's assuming you use the same crt0.S which will return the program to the old stack and call the _doExit function, which does the actual exit.
 
Last edited by brienj,
Are you trying to call that from your main function? Don't, just let the function continue to the end, AFTER you call the screen clear and buffer flips. Do not call exit, let the main function finish and return. No crashes then. Look at how I did it in the LiteNESU code and the Hello World example.

That's assuming you use the same crt0.S which will return the program to the old stack and call the _doExit function, which does the actual exit.
I know that after reaching the end of main and calling _osscrennexit() then crt0.s will call doExit() but the problem is that I'm calling it from a while(1) loop function in another void which reads button and touchscreen every quarter of second and check if home is pressed.

EDIT: Maybe I can bypass the obstacle making the void an unsigned int that return 1 to main void when home is pressed so it skip to the end
 
Last edited by rw-r-r_0644,
  • Like
Reactions: brienj
I know that after reaching the end of main and calling _osscrennexit() then crt0.s will call doExit() but the problem is that I'm calling it from a while(1) loop function in another void which reads button and touchscreen every quarter of second and check if home is pressed.

EDIT: Maybe I can bypass the obstacle making the void an unsigned int that return 1 to main void when home is pressed so it skip to the end

It's worth noting that return on its own (without a value) can exit out of a void function. You could also shuffle around your while loops so you can just run "break" to get out of them (immediately stop the current loop and pretend the while condition returned false)
 
  • Like
Reactions: rw-r-r_0644
I know that after reaching the end of main and calling _osscrennexit() then crt0.s will call doExit() but the problem is that I'm calling it from a while(1) loop function in another void which reads button and touchscreen every quarter of second and check if home is pressed.

EDIT: Maybe I can bypass the obstacle making the void an unsigned int that return 1 to main void when home is pressed so it skip to the end

If you really want to exit your programm without reaching the return statement you have to execute the asm instructions from cert0.s.

Code:
void ExitApplication()
{
   // Return to old stack for exit
   asm volatile("lis 1, 0x1ab5 ; ori 1, 1, 0xd138");

   unsigned int coreinit;
  OSDynLoad_Acquire("coreinit.rpl", &coreinit);
   void(*_Exit)();
   OSDynLoad_FindExport(coreinit, 0, "_Exit", &_Exit);

   _Exit();
}

But you have to clear the framebuffers first.
 
Last edited by Blackspoon,
It's worth noting that return on its own (without a value) can exit out of a void function. You could also shuffle around your while loops so you can just run "break" to get out of them (immediately stop the current loop and pretend the while condition returned false)
Actually I am using that code that worked:
Code:
void _main(){
//OS Imports and other code
unsigned int exitornot = mainscreen()
if (exitornot = 1) {
    //run code
}
_osscreenexit();
}
Thank you for the reply!
If you really want to exit your programm without reaching the return statement you have to execute the asm instructions from cert0.s.

Code:
void ExitApplication()
{
   // Return to old stack for exit
   asm volatile("lis 1, 0x1ab5 ; ori 1, 1, 0xd138");

   unsigned int coreinit;
  OSDynLoad_Acquire("coreinit.rpl", &coreinit);
   void(*_Exit)();
   OSDynLoad_FindExport(coreinit, 0, "_Exit", &_Exit);

   _Exit();
}

But you have to clear the framebuffers first.
Thank you, trying right now!

EDIT: Yess!! That worked :)! Thank you
 
Last edited by rw-r-r_0644,
  • Like
Reactions: brienj
If you really want to exit your programm without reaching the return statement you have to execute the asm instructions from cert0.s.

Code:
void ExitApplication()
{
   // Return to old stack for exit
   asm volatile("lis 1, 0x1ab5 ; ori 1, 1, 0xd138");

   unsigned int coreinit;
  OSDynLoad_Acquire("coreinit.rpl", &coreinit);
   void(*_Exit)();
   OSDynLoad_FindExport(coreinit, 0, "_Exit", &_Exit);

   _Exit();
}

But you have to clear the framebuffers first.
Ah yes, that would work too.
 
I'm getting the "curl_easy_getinfo returned an HTTP error" thing. What am I doing wrong?

[ROOT]
. . . . ./payload
. . . . . . . . boot.elf
. . . . . . . . code550.bin (elf loader)
. . . . . . . . the wiiuhax files
 
Last edited by GalladeGuy,
I'm getting the "curl_easy_getinfo returned an HTTP error" thing. What am I doing wrong?

[ROOT]
. . . . ./payload
. . . . . . . . boot.elf
. . . . . . . . code550.bin (elf loader)
. . . . . . . . the wiiuhax files
Well, for one boot.elf should be back a directory cause it loads from the same one payload is in, dunno about the other part tho :\ if that doesn't fix it I'll have you do some OSFatal tests to see what it's actually returning
 
Well, for one boot.elf should be back a directory cause it loads from the same one payload is in, dunno about the other part tho :\ if that doesn't fix it I'll have you do some OSFatal tests to see what it's actually returning
Nope, same error. :(
I'm gonna try and put all these in an additional directory to see if it being on the root has anything to do with it.

EDIT: Nope
 
Last edited by GalladeGuy,
Did your hosting-pc receive a ip over a dhcp server without a static lease? It could be that a old ip can be in the history of your wiiu.

In this case the elf loader use them if it will be find these instead your current ip. (example: maybe 192.168.0.5/payload instead of 192.168.0.4/payload).

The fix is simple:
  1. close all tabs.
  2. clear the history
  3. restart the browser.
Maybe you should define a static lease for your hosting-pc to prevent this error.

If it doesnt help, you need to extend the elfloader to print the curl error. Then you can post it here.
 
Did your hosting-pc receive a ip over a dhcp server without a static lease? It could be that a old ip can be in the history of your wiiu.

In this case the elf loader use them if it will be find these instead your current ip. (example: maybe 192.168.0.5/payload instead of 192.168.0.4/payload).

The fix is simple:
  1. close all tabs.
  2. clear the history
  3. restart the browser.
Maybe you should define a static lease for your hosting-pc to prevent this error.

If it doesnt help, you need to extend the elfloader to print the curl error. Then you can post it here.
I'm hosting everything on a website though.
 
I'm getting the "curl_easy_getinfo returned an HTTP error" thing. What am I doing wrong?

[ROOT]
. . . . ./payload
. . . . . . . . boot.elf
. . . . . . . . code550.bin (elf loader)
. . . . . . . . the wiiuhax files
If you are self-hosting, make sure that elf files have an entry in your MIME types. I had problems at first when I was self-hosting, and then discovered that elf files did not have a MIME type listed. My server didn't even have an mp4 MIME type, so check that as well. To see if that is the problem, you can always go to
Code:
http://<SERVER IP ADDRESS>/payload/boot.elf
in a browser on your computer and see if you get an error that the file isn't available. If you get an error in your PC's browser, then adding the MIME type entry should fix it.

The correct entry to add is:
Filename extension: .elf
MIME type: application/elf
 
Last edited by brienj,
If you are self-hosting, make sure that elf files have an entry in your MIME types. I had problems at first when I was self-hosting, and then discovered that elf files did not have a MIME type listed. My server didn't even have an mp4 MIME type, so check that as well. To see if that is the problem, you can always go to
Code:
http://<SERVER IP ADDRESS>/payload/boot.elf
in a browser on your computer and see if you get an error that the file isn't available. If you get an error in your PC's browser, then adding the MIME type entry should fix it.

The correct entry to add is:
Filename extension: .elf
MIME type: application/elf
On my PC all it does is download the file.
 

Site & Scene News

Popular threads in this forum