It would be nice to have a working ELF to PRX converter.
My main goal was to add the support for ELFs to my hb encrypter, and that's the reason why I was looking for a way to use HBL as a built in loader, with every HBL dependencies along with the targeted hb stored in one single EBOOT.
By the way, in the process of cleaning my code, I encountered a weird issue in the launcher in main.c.
This code works fine :
Code: Select all
u32 pos; // offset of the psar section
PSAR_LISTING listing; // a listing in the psar file
FILE *fp = fopen("EBOOT.PBP","rb");
if (fp == 0)
{
sceKernelExitGame();
return 0;
}
fseek(fp, 0x24, SEEK_SET); // go to EBOOT header containing PSAR offset
fread(&pos, sizeof(u32), 1, fp); // read the PSAR offset
fseek(fp, pos + sizeof(PSAR_HEADER), SEEK_SET); // go to the first listing offset after the header
fread(&listing, sizeof(PSAR_LISTING), 1, fp); // read the first listing (should be h.bin infos)
fseek(fp, pos + listing.offset, SEEK_SET); // go to h.bin offset in PSAR
fread((void *)0x09000000,listing.size, 1, fp); // copy h.bin to memory
fclose(fp);
This code crashes :
Code: Select all
u32 pos; // offset of the psar section
PSAR_LISTING listing; // a listing in the psar file
SceUID file = sceIoOpen("EBOOT.PBP", PSP_O_RDONLY, 0777);
if (file < 0) // Error reading file
{
sceKernelExitGame();
return 0;
}
sceIoLseek(file, 0x24, PSP_SEEK_SET); // go to EBOOT header containing PSAR offset
sceIoRead(file, &pos, sizeof(u32)); // read the PSAR offset
sceIoLseek(file, pos + sizeof(PSAR_HEADER), PSP_SEEK_SET); // go to the first listing offset after the header
sceIoRead(file, &listing, sizeof(PSAR_LISTING)); // read the first listing (should be h.bin infos)
sceIoLseek(file, pos + listing.offset, PSP_SEEK_SET); // go to h.bin offset in PSAR
sceIoRead(file, (void *)0x09000000, listing.size); // copy h.bin to memory
sceIoClose(file); // close the file
It's weird since thoses functions worked fine in the original main.c, and they do work fine in h.bin and hbl.bin.
The obvious reason is that I'm blind and can't see that I'm doing something wrong.
Edit : The dgblog says
Code: Select all
ERROR FILE CONTAINS MORE IMPORTS THAN BUFFER SIZE
Maybe my script exporting function addresses is buggy.