Page 1 of 1

How to include IRX files in .ELF ?

Posted: Tue Aug 24, 2004 11:48 pm
by BiB
Hi all,

I see that some programs don't have .IRX files but load modules anyway.
I deduce they are included in the .ELF file.

I saw that in the Altimit project, but when reading source code, i don't know how it loads module.

Can someone tell me how does it works ?

thx

Posted: Wed Aug 25, 2004 12:37 am
by pixel
1) produce a .s file out of the irx file:

Code: Select all

bin2s my_module.irx my_module.s my_module

2) declare the module into your C code:

Code: Select all

extern unsigned char my_module[];
extern unsigned int size_my_module;

3) load the module into your C code:

Code: Select all

int ret;
SifExecModuleBuffer(my_module, size_my_module, 0, NULL, &ret);

4) don't forget to compile the .s file with your C code:

Code: Select all

ee-gcc -o final_binary.elf my_code.c my_module.s

Posted: Wed Aug 25, 2004 1:24 am
by BiB
ok thanks a lot for your quick and very precise answer.

However i still have a problem.

I downloaded Altimit 0.1 (src and bin) ans when i compile sources, i don't have the same size as the original ELF (this last works)
Mine is 328 Ko (uncompressed) whereas the original is 1 Mb

What am i doing wrong

Posted: Wed Aug 25, 2004 1:20 pm
by blackdroid
yours might be stripped from symbols, the distributed 0.1 elf might not, wich would make debugging easier for tombola.

Posted: Wed Aug 25, 2004 6:36 pm
by evilo
very very interesting information, I will certainely resuse it also for my project ;)

thanks for the tip !