Geckoloader Wii

From GameBrew
geckoloader
Wii2.png
General
Authordhewg
TypeLoader
Version0.0.3
LicenseMixed
Last Updated2008/03/11
Links
Download
Website
Source

Geckoloader is a native Wii application which helps you to load and execute Wii homebrew binaries in the easiest and fastest way possible. It acts as a server which will receive binaries directly using a USB Gecko adapter. A client tool to transfer such files is included.

Features

  • 100% native Wii mode.
  • No medium ejecting, rewriting and inserting required whatsoever.
  • This is especially useful for wii coders (fast development cycle).
  • Reloading. the stub is placed at the memory location 0x80001800. this is PSO reload compatible, which means that any application can jump back there so that you can load another binary without reboot. the libogc exception handler also jumps to this address (when pressing Z on a GameCube pad).
  • The protocol used for uploading is compatible to the official geckotool (you can use your client of choice).
  • As always, this is open source.

User guide

Requirements

  • A USB Gecko adapter.
  • A way to boot Wii homebrew.

Architecture

geckoloader consists of 3 parts:

  • stub
  • loader
  • boot

The boot code contains the other two code parts, and it is the executable that you have to run. It will write the loader code to the onboard usbgecko flash and place the stub into memory.

The boot code will then execute the stub.

The stub's job is to read the loader code from flash and execute it.

Finally, the loader code will accept incoming Wii executables sent using a client application from the pc side.

The chosen architecture has the advantage that the tiny stub is the only component which has to stay intact in memory. while the usage of the usbgecko onboard flash might seem unnecessary at first, its purpose is the reloading feature. you will upload and run Wii applications. These in return will allocate memory and write to it. If the loader code would stay somewhere in memory, any executed application might overwrite it this way, but since it sits on the onboard usbgecko flash, no application can corrupt it.

Wii-side

  • Use the Twilight hack in combination with the included geckoloader.elf to get this running
  • The boot code will show up.
  • You have to write the loader code to the onboard usbgecko flash once, press the Wii RESET button when asked to.
  • After that you will see the loader code in action.
  • Use a compatible client (like the included one geckoupload, or the official windows geckotool) to send a Wii binary.
  • The transferred binary should execute.
  • If you loaded a game/app which has an option to jump back to 0x80001800, you will be presented with the loader code again. from there, you can transfer another binary again (no reboot required).

Hint: try to upload the included test.elf first. It just prints a string to screen and has an option to jump back to the loader.

Client-side

  • The client uses a default tty device (except on windows), you can overwrite it using the environment variable USBGECKODEVICE
  • Set USBGECKODEVICE too the com your device uses (example, COM4).
  • RESTART AFTER SETTING YOUR ENV VAR !!! ELSE IT WILL NOT WORK.
  • Make sure that your console is ready to receive an executable.
  • Pass the filename of the binary to geckoupload, for example:geckoupload test.elf

You can use this client to transfer:

  • wii .dol's and .elf's to the geckoloader described on this page.
  • gamecube .dol's to the official usbgecko boot dvd.

Windows Driver Setup

If your USBGecko install didn't provide you with a COM port then try the following:

  • Go to device manager and select the device "USB Serial Converter" which is the USB Gecko device.
  • Right click and select properties, then go to the "advanced" tab.
  • Click the "Load VCP" box so its selected then press ok.
  • Unplug the cable and then reinsert.

This should now give you a COM port, which you will need for geckoupload.

Notes

  • You cannot run GameCube binaries with this loader since we're working in Wii mode here (that's a good thing).
  • The default libogc base address for Wii homebrew is at 0x80003f00. This gives a PSO compatible stub 0x1900 bytes of memory for code. Hence, the stub's main() functions were written in c so that it's easy to improve/fix.
  • The loader initially puts a received binary in MEM2 to avoid overlaps. It will be relocated from there. Unfortunately the loader itself has a base address in MEM1. Putting it in MEM2 is on my TODO list.
  • You can use the trucha signer to boot this app straight from dvd.

Changelog

v0.0.4

  • HBC assimilated geckoloader. v0.0.4 is a pure gamecube-only version.

v0.0.3

  • a gamecube pad isn't required anymore, the wii reset button is used to confirm the flash process.
  • The loader code is executed straight away if it has been flashed before (no interaction required).
  • .elf file support thanks to tmbinc.
  • The stub doesn't overwrite the globals anymore, fixed by WinterMute.
  • A received binary is now written to MEM2 before relocating.
  • Ported the client to win32 (binary included).
  • The client now uses default device names on linux and os x.
  • The audio and dsp subsystems are initialized on reloading (no more annoying noise).

v0.0.2b

  • Fixed a timing issue in the usbgecko flash code. since i couldn't reproduce this on my setup, thanks go out to bLAStY and NoNameNo for helping me hunting this one down.
  • The included client now works on os x thanks to bushing.
  • Added an extra check for malformed .dol files (some doltool converted .elf's).
  • Included a tiny test application.

v0.0.2

  • First public release.

Credits

Thanks:

  • shagkur, for helping me getting the stub working and providing the linkerscript.
  • The DevkitPro team.
  • Team tweezers for making all of this possible.
  • All open source Wii coders.
  • nuke for sharing code for his adapter.

External links

Advertising: