Advertising (This ad goes away for registered users. You can Login or Register)

Some help about HBL basics

This is the development forum of the half-byte loader project. For general Half Byte Loader questions, visit the Half Byte Loader forum.
Forum rules
This forum is for HBL Development discussions ONLY. For User support or HBL general discussions, go to viewforum.php?f=3 . Messages that are not development related will be deleted.
Libre
Posts: 47
Joined: Sat Jan 01, 2011 4:51 pm

Re: Some help about HBL basics

Post 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.
Advertising
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Some help about HBL basics

Post 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...
Advertising
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
Libre
Posts: 47
Joined: Sat Jan 01, 2011 4:51 pm

Re: Some help about HBL basics

Post 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.
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Some help about HBL basics

Post by m0skit0 »

Maybe because sceIoLseek changed: viewtopic.php?p=28557#p28557
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Re: Some help about HBL basics

Post 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.
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Some help about HBL basics

Post by m0skit0 »

True
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
Libre
Posts: 47
Joined: Sat Jan 01, 2011 4:51 pm

Re: Some help about HBL basics

Post 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
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: Some help about HBL basics

Post by m0skit0 »

Nice work. I suggest you publish it on the "Homebrews" section ;)
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
taxik
Posts: 220
Joined: Tue Jan 18, 2011 8:05 pm

Re: Some help about HBL basics

Post by taxik »

Oh man this is fantastic !
Image
Locked

Return to “Half Byte Loader Development”