Page 2 of 2

Re: Some help about HBL basics

Posted: Tue Feb 01, 2011 2:37 pm
by Libre
The reason I don't use the StaticLoader is that it requires to rebuild the Loader based on the ELF extracted stubs, and I didn't have the knowledge to change that into something I could use without the need of compilation every time.

Re: Some help about HBL basics

Posted: Tue Feb 01, 2011 4:52 pm
by m0skit0
Nice job, Libre! ;)

A bit of off-topic: In fact I think it shouldn't be too hard to write a static ELF to PRX converter. I already thought about it, but I don't have the mood or the time to code it...

EDIT: sections containing static pointers would be the hardest part in fact...

Re: Some help about HBL basics

Posted: Tue Feb 01, 2011 6:00 pm
by Libre
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.

Re: Some help about HBL basics

Posted: Tue Feb 01, 2011 6:33 pm
by m0skit0
Maybe because sceIoLseek changed: viewtopic.php?p=28557#p28557

Re: Some help about HBL basics

Posted: Tue Feb 01, 2011 6:42 pm
by JJS
m0skit0 wrote:Maybe because sceIoLseek changed: viewtopic.php?p=28557#p28557
But they cannot change the user mode export because it would break any existing game. The additional parameter can only be relevant for kernel mode modules imho.

Re: Some help about HBL basics

Posted: Tue Feb 01, 2011 6:44 pm
by m0skit0
True

Re: Some help about HBL basics

Posted: Fri Feb 04, 2011 1:11 am
by Libre
Source of this version of HBL (r115M with PSAR packer), which can be used either as a classic HBL with wMenu, or as a loader : here

And my updated encrypter with HBL packing support
Image
Link here

Re: Some help about HBL basics

Posted: Fri Feb 04, 2011 7:47 am
by m0skit0
Nice work. I suggest you publish it on the "Homebrews" section ;)

Re: Some help about HBL basics

Posted: Thu Apr 21, 2011 7:43 am
by taxik
Oh man this is fantastic !