Page 1 of 1
Launch a DOL or ELF file from another DOL or ELF file
Posted: Tue Jun 02, 2009 8:18 pm
by lacrima08
Hi everybody,
I'm french and I'm a newbie on wii programming.
As I said in the title, I would to launch a DOL or ELF file from another DOL or ELF file
i.e : I Launch a DOL or ELF file and at a moment the program say "Press any button to launch (any program)" and the choosen program is launched.
I think we could call it a DOL/ELF forwarder ?
Re: Launch a DOL or ELF file from another DOL or ELF file
Posted: Tue Jun 02, 2009 10:37 pm
by Bloody_Grunt
Is the second elf/dol file loaded at runtime, or included in the program?
Re: Launch a DOL or ELF file from another DOL or ELF file
Posted: Tue Jun 02, 2009 10:55 pm
by lacrima08
the second dol/elf file is a separate file because I haven't the source code of this dol file i would launch either specifying path in my code either using a configuration file which would allow me to change the second file whenever I want without recompiling the code at each time
Re: Launch a DOL or ELF file from another DOL or ELF file
Posted: Wed Jun 03, 2009 12:31 am
by Samson
I wrote a bit of code like that a while ago on GameCube. The problem is that a DOL file is not relocatable, and that the GC doesn't do any memory remapping (under normal circumstances). So you've got three choices: when making the second DOL make sure the memory regions don't overlap with the first DOL, or load the second DOL at a separate memory location and have a copy routine in a memory location that isn't used by either DOL move it to its final position, or install a loader outside either DOL's memory location and load the second DOL directly over the first.
The procedure itself is quite simple:
1. Load the DOL header (
http://hitmen.c02.at/files/yagcd/yagcd/chap14.html )
2. Load all sections to the position specified in the header
3. Invalidate the instruction cache (!)
4. Jump to the entry point.
Nothing stops you from making your own non-DOL file format that is
relocatable or uses
position independant code and can be loaded to any memory address. You may have to write your own linker script for that, though.