Need help loading an ELF from an ELF :)

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
PrimeTime
Posts: 25
Joined: Thu Aug 19, 2004 7:49 pm

Need help loading an ELF from an ELF :)

Post by PrimeTime »

hi, I'm pretty new to this, but for the past couple of days I've been trying
to load an ELF from a location on my memory card.

the location of the program is mc0:/BOOT/SHARED/JPG.ELF
I uploaded it there myself.

my problem is whenever I call SifLoadElf() it tell me it cannot open this elf file.

Code: Select all

char *path = "mc0:/BOOT/SHARED/JPG.ELF";
ret = SifLoadElf(path, &elfdata);
if (elfdata.epc == 0) {
     scr_printf("EE: Could not load file\n");
     return -1;
    }

I've also tried loading the mcman and and sio2man modules before loading the elf, but that didn't help.

Thanks,
Ryan
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Can you try to only open the file ? Only to see if everything is okay with your module loadings...
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Raizor
Posts: 60
Joined: Sun Jan 18, 2004 12:27 am
Location: out there

Post by Raizor »

I could be wrong, but I seem to recall loading elf files from memcard is not allowed. You need to use MrBrown's sbv patches to allow it...

Please correct me if I'm wrong ;)

raizor
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

You're right, you need to use sbv if you use SifLoadElf(), or one of the alternative loading methods (see altimit or Independence).
"He was warned..."
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Argh, yes, of course :) Why didn't I thought of it ?
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
PrimeTime
Posts: 25
Joined: Thu Aug 19, 2004 7:49 pm

Post by PrimeTime »

Thanks for your replies.

I've tried using the sbv-lite library to fix the sif problem, however, it doesn't seem to work, I am still getting the same results as before.

Code: Select all

// Initialise
SifInitRpc(0);
init_scr();
hddPreparePoweroff();
hddSetUserPoweroffCallback((void *)poweroffHandler,(void *)pid);
scr_printf("Loading poweroff.irx %i bytes\n", size_poweroff_irx);
sbv_patch_enable_lmb();
sbv_patch_disable_prefix_check();
SifExecModuleBuffer(&poweroff_irx, size_poweroff_irx, 0, NULL, &ret);
scr_printf("Loading %s\n",HDDpath);
pid = pkoLoadElf("mc0:/BOOT/SHARED/JPG.ELF");
scr_printf("pkoLoadElf returned %i\n",pid);
if &#40;pid < 0&#41;
&#123;
  scr_printf&#40;"Could not execute file %s\n", HDDpath&#41;;
  return -1;
&#125;
my pid is < 0 which returns the error. Inside the pkoLoadElf, which I got from a bit of the ps2menu code, the elfdata.epc, elfdata.gp and elfdata.sp are all 0.

I'm not sure what I should do.

Thanks,
Ryan
PrimeTime
Posts: 25
Joined: Thu Aug 19, 2004 7:49 pm

Post by PrimeTime »

I found part of the solution to my problem:

Originally, I have been uploading my ELF file via ftp.
for example my program is named TEST.ELF and this program
calls JPG.ELF.

By default my ps2 calls PS2 Key Launcher upon booting. I configured PS2 Key Launcher to call my TEST.ELF program and then my TEST.ELF calls JPG.ELF. kinda crazy

anyway, when I tried to execute TEST.ELF using ps2link instead of PS2 Key Launcher; everything worked fine. I suppose it may be something with PS2 Key Launcher.

Ryan
MrSiir[S]
Posts: 32
Joined: Tue Sep 14, 2004 11:08 am

Post by MrSiir[S] »

PrimeTime wrote:I found part of the solution to my problem:

Originally, I have been uploading my ELF file via ftp.
for example my program is named TEST.ELF and this program
calls JPG.ELF.

By default my ps2 calls PS2 Key Launcher upon booting. I configured PS2 Key Launcher to call my TEST.ELF program and then my TEST.ELF calls JPG.ELF. kinda crazy

anyway, when I tried to execute TEST.ELF using ps2link instead of PS2 Key Launcher; everything worked fine. I suppose it may be something with PS2 Key Launcher.

Ryan
Hi, Though PS2 KeyLauncher does not work very well ;-) , it can be that is not a his fault, ps2link it loads modules in memory and does that the execution of the program not her same from MC or from ps2link

MrSiir
L-Burna
Posts: 4
Joined: Mon Sep 20, 2004 5:50 pm

Post by L-Burna »

Hi I know this probably isn't in the right location on the forum here,but I was wondering MrSiir[S] is it possible to launch apps from the keylauncher from the R3 and L3 buttons.I am currently using the keylauncher for my memory card exploit and I do have to say it works like a charm.I am having problems typing in my R3 and L3 buttons though.The example given in the keylauncher exploit doesn't give a example or really explain how to type in the command used for the L3 and R3 buttons for the KL.DAT file.I can get all the other buttons to work except for these two buttons.I used this command for the R3 and L3 buttons,but it seems to always fail me when I try to type it in like this.

Example:
L3=mc0:/BADATA_SYSTEM/PS2LINK.ELF;PS2LINK V1.23

I would appreciate it alot if you could give me an example or tell me where I am going wrong when typing in my command.Thanks in advance and nice exploit MrSiir[S] I appreciate it and it seems to work for me.I have also asked numerous questions all over the place trying to find the answer,but no one that knows is willing to help out or just doesn't know the answer.
Post Reply