Launch a DOL or ELF file from another DOL or ELF file

support for the powerpc toolchain
Post Reply
lacrima08
Posts: 2
Joined: Tue Jun 02, 2009 8:09 pm

Launch a DOL or ELF file from another DOL or ELF file

Post by lacrima08 » Tue Jun 02, 2009 8:18 pm

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 ?

Bloody_Grunt
Posts: 6
Joined: Mon Jun 01, 2009 9:19 pm

Re: Launch a DOL or ELF file from another DOL or ELF file

Post by Bloody_Grunt » Tue Jun 02, 2009 10:37 pm

Is the second elf/dol file loaded at runtime, or included in the program?

lacrima08
Posts: 2
Joined: Tue Jun 02, 2009 8:09 pm

Re: Launch a DOL or ELF file from another DOL or ELF file

Post by lacrima08 » Tue Jun 02, 2009 10:55 pm

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
Last edited by lacrima08 on Wed Jun 03, 2009 7:50 am, edited 1 time in total.

Samson
Posts: 35
Joined: Mon May 19, 2008 8:05 am

Re: Launch a DOL or ELF file from another DOL or ELF file

Post by Samson » Wed Jun 03, 2009 12:31 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests