Wii: Load Nintendo SDK ELFs via the HBC

The Homebrew Channel (HBC) was designed to be used with the Homebrew  SDK aka devkitPro. So any files you compile with devkitPro should load OK via the HBC.

If you try to load a file that was compiled with the Nintendo SDK however you will get an error that “This is not a valid Wii application”.  This is because the Homebrew Channel retrieves the load addresses for each ELF program segment from the Physical Address field, and in Nintendo SDK files this field is set to zero.

Hopefully the HBC guys will fix this in the next release, making the HBC more compatible. In the meantime you can use this little tool I made to patch your ELF file. It copies the values from the Virtual Address field into the Physical Address field for each program segment in your ELF file.

WiiElfFix v1.0

10 thoughts on “Wii: Load Nintendo SDK ELFs via the HBC

  1. wouldnt it be illegal?

    those with elfs compiled by nintendo sdk mustve pirated the SDK.
    and other elfs compiled with nintendo SDK mustve been leaked, also illegal? no?

    please give an example of a legal usage of nintendo sdk compiled elfs?

  2. If you have legal access to the sdk, then no.

    Over the years many game development houses have used retail consoles to test and even develop on. Using a retail console for testing builds is simple enough since all you need to do is get the code to run. For testing code you would need something more advanced however. The Wii for example has “homebrew” loaders and debuggers that run on retail units and allow you to execute and debug code. The result is a cheap development kit that costs the same as a retail Wii.

    Of course final game code would be tested on the proper Wii devkits and testkits before submission, but during the development cycle this is a way smaller companies can and do save money.

    Another prime example is the Nintendo DS where a 3rd party flashcard can be used to test game code. Not only are these flashcards a lot cheaper than the official ones from Nintendo, they are also much quicker and easier to write to.

    The Sony PSP is yet another example where you can play test copies of games from the memory stick using custom firmware. Once again this process is quicker and easier and cheaper than using the official alternatives.

  3. I have compiled several examples with official SDK, but after load I got black screen and nothing else.
    Anybody succeded?

  4. I get the same problem, I had a quick attempt at trying to find the issue with no luck. I suspect it is related to the particular way the HBC expects programs to be loaded and executed, ie probabaly crt0 related.

  5. Just a question !!! do not see anything illegal.

    Is this possible to use all lib(.a) and headers(.h) from the official SDK in an environnemnt like devkitppc ??

  6. you need to set the memory and CPU clock in low memory for SDK tools to start.

    *(vu32*)0x800000F8 = 0x0E7BE2C0; // Bus Clock Speed
    *(vu32*)0x800000FC = 0x2B73A840; // CPU Clock Speed

  7. Ah great thanks heaps for that info crediar :)

    Now to get the HBC guys to support SDK elfs automatically by accessing the correct values in the elf files and then setting these values before executing!

  8. The two bus pokes aren’t a problem, nor should be the paddr/vaddr thing — if you can get me a sample binary to test with then I can get this squared away :)

  9. Thanks for the clock speed tip. In my case two more things were needed in order to load an official-sdk-based elf via HBC. First: the OS code throws some errors during boot, I didn’t exactly find out what the problem is, but nopping-out some “fatal error handler” calls (the obvious function name omited due to NDA) seems to keep the program from crashing. The second issue is quite strange – I only get video output in progressive mode. If the video-mode is interlaced, the screen goes black after HBC loads my app and stays black until reset (although the app works fine, only without any visuals). The same binary doesn’t have the video-mode problem when loaded using a trucha-signed disc.

Leave a Reply

Your email address will not be published. Required fields are marked *