 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
vista200
Joined: 19 Mar 2008 Posts: 13
|
Posted: Wed Apr 09, 2008 2:24 am Post subject: [SOLVED] How to launch .ELF files in 3.90 M33-3 |
|
|
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(¶m, 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 |
|
 |
jas0nuk
Joined: 27 Apr 2006 Posts: 137
|
Posted: Wed Apr 09, 2008 2:45 am Post subject: |
|
|
-2147352247
= 0x80020149
= SCE_KERNEL_ERROR_ILLEGAL_PERM_CALL
Are you sure it's running in the 1.50 kernel? |
|
| Back to top |
|
 |
vista200
Joined: 19 Mar 2008 Posts: 13
|
Posted: Wed Apr 09, 2008 3:25 am Post subject: Yes, thats it! |
|
|
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 |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Thu Apr 10, 2008 5:29 am Post subject: |
|
|
| Code: | int startELF(char *path) {
struct SceKernelLoadExecVSHParam param;
memset(¶m, 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 |
|
 |
vista200
Joined: 19 Mar 2008 Posts: 13
|
Posted: Thu Apr 10, 2008 5:39 am Post subject: This was just a test |
|
|
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 |
|
 |
|
|
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
|