forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] How to launch .ELF files in 3.90 M33-3

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
vista200



Joined: 19 Mar 2008
Posts: 13

PostPosted: Wed Apr 09, 2008 2:24 am    Post subject: [SOLVED] How to launch .ELF files in 3.90 M33-3 Reply with quote

Hi there!

I'm having a problem with loading ELF files. When I launch my program under 1.50 with TimeMachine, it works. If I try to run it from 3.90 M33-3 with 1.50-Kernel, sceKernelLoadExec returns -2147352247. I'm using the elf_template copied to test.elf in the root of the Memory Stick. Here's the source code:

Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>

PSP_MODULE_INFO("ELF", 0, 1, 1);

#define printf pspDebugScreenPrintf

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}

int startELF(char *path) {
   struct SceKernelLoadExecVSHParam param;
   memset(&param, 0, sizeof(param));
   if (!param.key)
   param.key = "game";
   param.size = sizeof(param);
   param.args = strlen(path)+1;
   param.argp = path;
   int elf = sceKernelLoadExec(path, NULL);
   return elf;
}

int main() {
   pspDebugScreenInit();
   SetupCallbacks();
   printf("Loading...\n");
   printf("%i", startELF("ms0:/test.elf"));
   sceKernelSleepThread();
return 0;
}


Code:
TARGET = elf
OBJS = main.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = ELF
PSP_FW_VERSION = 150

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


I've tried already a lot of things, such as starting my program in user and kernel mode. Also I've used functions like sctrlKernelLoadExecVSHMs2, but they error out with different errors.

Thanks in advantage,
vista200


Last edited by vista200 on Wed Apr 09, 2008 3:26 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jas0nuk



Joined: 27 Apr 2006
Posts: 137

PostPosted: Wed Apr 09, 2008 2:45 am    Post subject: Reply with quote

-2147352247
= 0x80020149
= SCE_KERNEL_ERROR_ILLEGAL_PERM_CALL

Are you sure it's running in the 1.50 kernel?
Back to top
View user's profile Send private message
vista200



Joined: 19 Mar 2008
Posts: 13

PostPosted: Wed Apr 09, 2008 3:25 am    Post subject: Yes, thats it! Reply with quote

Thanks!

Copying my EBOOT to GAME150 folder works. When I launch it then, the ELF loads correctly.

Again, thanks for your help!
vista200
Back to top
View user's profile Send private message Send e-mail MSN Messenger
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Thu Apr 10, 2008 5:29 am    Post subject: Reply with quote

Code:
int startELF(char *path) {
   struct SceKernelLoadExecVSHParam param;
   memset(&param, 0, sizeof(param));
   if (!param.key)
   param.key = "game";
   param.size = sizeof(param);
   param.args = strlen(path)+1;
   param.argp = path;
   int elf = sceKernelLoadExec(path, NULL);
   return elf;
}


Why are you using SceKernelLoadExecVSHParam if you don't really use it? you pass NULL to sceKernelLoadExec....
_________________
Ciao! from Italy
Back to top
View user's profile Send private message
vista200



Joined: 19 Mar 2008
Posts: 13

PostPosted: Thu Apr 10, 2008 5:39 am    Post subject: This was just a test Reply with quote

Hi there!

This was just to see whether this would work. But as stated above, there was another mistake.

Greets from germany!
vista200
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group