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: Select all
#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: Select all
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
Thanks in advantage,
vista200