Official 5.5.X ELF Loader

Discussion in 'Wii U - Homebrew' started by NWPlayer123, Feb 12, 2016.

  1. SYNYST3R1

    SYNYST3R1 Member

    Newcomer
    2
    Feb 10, 2013
    United States
    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!
     
    Voxel likes this.
  2. brienj

    brienj Trying to avoid getting cancer

    Member
    9
    Jan 3, 2016
    United States
    vgmoose and Voxel like this.
  3. rw-r-r_0644

    rw-r-r_0644 GBAtemp Fan

    Member
    5
    Jan 13, 2016
    Italy
    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, Mar 18, 2016
  4. brienj

    brienj Trying to avoid getting cancer

    Member
    9
    Jan 3, 2016
    United States
    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, Mar 19, 2016
  5. rw-r-r_0644

    rw-r-r_0644 GBAtemp Fan

    Member
    5
    Jan 13, 2016
    Italy
    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, Mar 19, 2016
    brienj likes this.
  6. QuarkTheAwesome

    QuarkTheAwesome Working for Hugs

    Member
    11
    Apr 19, 2015
    Australia
    Stuck in the PowerPC
    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)
     
    rw-r-r_0644 likes this.
  7. Blackspoon

    Blackspoon Member

    Newcomer
    2
    Feb 19, 2016
    Gambia, The
    next to the blackfork
    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, Mar 19, 2016
    brienj and rw-r-r_0644 like this.
  8. rw-r-r_0644

    rw-r-r_0644 GBAtemp Fan

    Member
    5
    Jan 13, 2016
    Italy
    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!
    Thank you, trying right now!

    EDIT: Yess!! That worked :)! Thank you
     
    Last edited by rw-r-r_0644, Mar 19, 2016
    brienj likes this.
  9. brienj

    brienj Trying to avoid getting cancer

    Member
    9
    Jan 3, 2016
    United States
    Ah yes, that would work too.
     
  10. GalladeGuy

    GalladeGuy Cool and Epic

    Member
    11
    Oct 28, 2015
    United States
    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, Apr 6, 2016
  11. NWPlayer123
    OP

    NWPlayer123 GBAtemp Addict

    Member
    17
    Feb 17, 2012
    United States
    The Everfree Forest
    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
     
  12. GalladeGuy

    GalladeGuy Cool and Epic

    Member
    11
    Oct 28, 2015
    United States
    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, Apr 6, 2016
  13. Blackspoon

    Blackspoon Member

    Newcomer
    2
    Feb 19, 2016
    Gambia, The
    next to the blackfork
    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.
     
  14. GalladeGuy

    GalladeGuy Cool and Epic

    Member
    11
    Oct 28, 2015
    United States
    I'm hosting everything on a website though.
     
  15. brienj

    brienj Trying to avoid getting cancer

    Member
    9
    Jan 3, 2016
    United States
    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, Apr 6, 2016
  16. Blackspoon

    Blackspoon Member

    Newcomer
    2
    Feb 19, 2016
    Gambia, The
    next to the blackfork
    Ok i have extend the elfloader with a simple error message. it will print the http error code and the current url.
     

    Attached Files:

    josamilu likes this.
  17. GalladeGuy

    GalladeGuy Cool and Epic

    Member
    11
    Oct 28, 2015
    United States
    On my PC all it does is download the file.
     
  18. brienj

    brienj Trying to avoid getting cancer

    Member
    9
    Jan 3, 2016
    United States
    If it finds and downloads the file, then it should have a MIME type listed, but you may want to double-check, it won't hurt to check.
     
  19. pwsincd

    pwsincd Garage Flower

    Member
    12
    GBAtemp Patron
    pwsincd is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Dec 4, 2011
    Manchester UK
    That MIME edit never did fix the elf loader for me ,, but i gave up trying... nice to see the conversations are opening up again...
     
    brienj likes this.
  20. GalladeGuy

    GalladeGuy Cool and Epic

    Member
    11
    Oct 28, 2015
    United States
    Error 404
    URL: http://mywebsite.com/Simon/payload/boot.elf

    It does that with boot.elf in the payload folder and outside. I've tried 3 times and the file downloads fine from PC.
     
Quick Reply
Draft saved Draft deleted
Loading...