limited size of PBP on 303 firmware ?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
blondin
Posts: 18
Joined: Tue Mar 07, 2006 12:16 am
Location: France (Grenoble)

limited size of PBP on 303 firmware ?

Post by blondin »

I build some valid PBP file (like pmpmod avc, atract3, etc.) for my 303OEB but with my own homebrew, I can't understand why, it load and exit with error code 8002013C...
I try much things but I think it is due to the size of my PBP, greater than 3 MB (3618 ko)

I want to know if the size of PBP file are limited on 2.0+ firmware ???
flatwhatson
Posts: 3
Joined: Fri Dec 29, 2006 1:19 pm
Location: Brisbane, Australia

Post by flatwhatson »

Well it wouldn't be a limitation of PBPs per se, as the PBPs created by popstation for D_As custom firmware can come in excess of 700Mb (though admitedly, the actual executable contained within that PBP is only about 1Mb in size)

Have you tried writing a smaller application and packing the PBP using the same method? I think you'll find that small test will answer your immediate question.

Alternatively (someone correct me if I'm wrong here, I haven't tested this with PSP ELFs) but it might be worth running strip on the ELF before packing it... that should cut down on the size somewhat.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

You of course really should find out what that error code means :) Okay well it is SCE_KERNEL_ERROR_LIBRARY_NOTFOUND which means therefore you are trying to link some functions for a module which has not been loaded or it uses a library which is not supported
User avatar
blondin
Posts: 18
Joined: Tue Mar 07, 2006 12:16 am
Location: France (Grenoble)

Post by blondin »

Sorry TyRaNid, it's the good answer ;)
I try to load mpeg modules and use ME like pmpvlc who require kernel mod, it's the cause of my trouble...
Thx again and sorry for my bad english ;)

for people who want to port pmpvlc on 303 firm., read this post :
http://forums.ps2dev.org/viewtopic.php?t=7484
jockyw2001
Posts: 339
Joined: Thu Sep 29, 2005 4:19 pm

Post by jockyw2001 »

TyRaNiD wrote:You of course really should find out what that error code means :) Okay well it is SCE_KERNEL_ERROR_LIBRARY_NOTFOUND which means therefore you are trying to link some functions for a module which has not been loaded or it uses a library which is not supported
I'm having the same problems. How can I find out what isn't found or is not supported?
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Probably the best you can do is use prxtool with the -f switch to dump what functions you are importing and see. Remember as well that you cannot put a kernel prx inside a PBP only a user one which then has to bootstrap a kernel prx.

If you are a user module then the most likely library to cause a problem would be kernel libs, or any libraries such as net which are not currently loaded.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

TyRaNiD wrote:Probably the best you can do is use prxtool with the -f switch to dump what functions you are importing and see. Remember as well that you cannot put a kernel prx inside a PBP only a user one which then has to bootstrap a kernel prx.

If you are a user module then the most likely library to cause a problem would be kernel libs, or any libraries such as net which are not currently loaded.
I have the same problem

Code: Select all

PRXTool v1.0 : (c) TyRaNiD 2k6
Loaded PRX PPA.prx successfully
Module information

Name:    "PMPLAYER_ADVANCE"
Attrib:  0000
Version: 1.1
GP:      002CB4F0

Exports:
Export 0, Name syslib, Functions 1, Variables 1, flags 80000000
Functions:
0xD632ACDB [0x000000AC] - module_start
Variables:
0xF01D73A7 [0x0020CA80] - module_info

Imports:
Import 0, Name sceMpegbase, Functions 1, Variables 0, flags 00090000
Functions:
0xBEA18F91 [0x0020C608] - sceMpegbase_BEA18F91
Import 1, Name scePower, Functions 6, Variables 0, flags 40010000
Functions:
0xEFD3C963 [0x0020C610] - scePower_EFD3C963
0xB4432BC8 [0x0020C618] - scePower_B4432BC8
0x2085D15D [0x0020C620] - scePower_2085D15D
0xD6D016EF [0x0020C628] - scePower_D6D016EF
0x04B7766E [0x0020C630] - scePower_04B7766E
0x737486F2 [0x0020C638] - scePower_737486F2
Import 2, Name sceAudio, Functions 3, Variables 0, flags 40010000
Functions:
0x136CAF51 [0x0020C640] - sceAudio_136CAF51
0x5EC81C55 [0x0020C648] - sceAudio_5EC81C55
0x6FC46853 [0x0020C650] - sceAudio_6FC46853
Import 3, Name sceMpeg, Functions 10, Variables 0, flags 00090000
Functions:
0x682A619B [0x0020C658] - sceMpeg_682A619B
0x874624D6 [0x0020C660] - sceMpeg_874624D6
0xC132E22F [0x0020C668] - sceMpeg_C132E22F
0xD8C5F121 [0x0020C670] - sceMpeg_D8C5F121
0x606A4649 [0x0020C678] - sceMpeg_606A4649
0xA780CF7E [0x0020C680] - sceMpeg_A780CF7E
0xCEB870B1 [0x0020C688] - sceMpeg_CEB870B1
0x0E3C2E9D [0x0020C690] - sceMpeg_0E3C2E9D
0x37295ED8 [0x0020C698] - sceMpeg_37295ED8
0x13407F13 [0x0020C6A0] - sceMpeg_13407F13
Import 4, Name sceRtc, Functions 1, Variables 0, flags 40010000
Functions:
0xE7C27D1B [0x0020C6A8] - sceRtc_E7C27D1B
Import 5, Name sceDisplay, Functions 3, Variables 0, flags 40010000
Functions:
0x0E20F177 [0x0020C6B0] - sceDisplay_0E20F177
0x289D82FE [0x0020C6B8] - sceDisplay_289D82FE
0x984C27E7 [0x0020C6C0] - sceDisplay_984C27E7
Import 6, Name sceGe_user, Functions 7, Variables 0, flags 40010000
Functions:
0xE47E40E4 [0x0020C6C8] - sceGe_user_E47E40E4
0xAB49E76A [0x0020C6D0] - sceGe_user_AB49E76A
0xE0D68148 [0x0020C6D8] - sceGe_user_E0D68148
0x03444EB4 [0x0020C6E0] - sceGe_user_03444EB4
0xB287BD61 [0x0020C6E8] - sceGe_user_B287BD61
0xA4FC06A4 [0x0020C6F0] - sceGe_user_A4FC06A4
0x05DB22CE [0x0020C6F8] - sceGe_user_05DB22CE
Import 7, Name sceCtrl, Functions 4, Variables 0, flags 40010000
Functions:
0x6A2774F3 [0x0020C700] - sceCtrl_6A2774F3
0x1F4011E6 [0x0020C708] - sceCtrl_1F4011E6
0x3A622550 [0x0020C710] - sceCtrl_3A622550
0x1F803938 [0x0020C718] - sceCtrl_1F803938
Import 8, Name IoFileMgrForUser, Functions 15, Variables 0, flags 40010000
Functions:
0xE23EEC33 [0x0020C720] - IoFileMgrForUser_E23EEC33
0xB293727F [0x0020C728] - IoFileMgrForUser_B293727F
0x810C4BC3 [0x0020C730] - IoFileMgrForUser_810C4BC3
0x109F50BC [0x0020C738] - IoFileMgrForUser_109F50BC
0x6A638D83 [0x0020C740] - IoFileMgrForUser_6A638D83
0xA0B5A7C2 [0x0020C748] - IoFileMgrForUser_A0B5A7C2
0x42EC03AC [0x0020C750] - IoFileMgrForUser_42EC03AC
0x27EB27B8 [0x0020C758] - IoFileMgrForUser_27EB27B8
0x68963324 [0x0020C760] - IoFileMgrForUser_68963324
0xB29DDF9C [0x0020C768] - IoFileMgrForUser_B29DDF9C
0xE3EB004C [0x0020C770] - IoFileMgrForUser_E3EB004C
0xEB092469 [0x0020C778] - IoFileMgrForUser_EB092469
0xF27A9C51 [0x0020C780] - IoFileMgrForUser_F27A9C51
0x55F4717D [0x0020C788] - IoFileMgrForUser_55F4717D
0xACE946E8 [0x0020C790] - IoFileMgrForUser_ACE946E8
Import 9, Name ModuleMgrForUser, Functions 3, Variables 0, flags 40010000
Functions:
0x977DE386 [0x0020C798] - ModuleMgrForUser_977DE386
0x50F0C1EC [0x0020C7A0] - ModuleMgrForUser_50F0C1EC
0xD675EBB8 [0x0020C7A8] - ModuleMgrForUser_D675EBB8
Import 10, Name StdioForUser, Functions 3, Variables 0, flags 40010000
Functions:
0x172D316E [0x0020C7B0] - StdioForUser_172D316E
0xA6BAB2E9 [0x0020C7B8] - StdioForUser_A6BAB2E9
0xF78BA90A [0x0020C7C0] - StdioForUser_F78BA90A
Import 11, Name SysMemUserForUser, Functions 4, Variables 0, flags 40000000
Functions:
0xA291F107 [0x0020C7C8] - SysMemUserForUser_A291F107
0x237DBD4F [0x0020C7D0] - SysMemUserForUser_237DBD4F
0xB6D61D02 [0x0020C7D8] - SysMemUserForUser_B6D61D02
0x9D9A5BA1 [0x0020C7E0] - SysMemUserForUser_9D9A5BA1
Import 12, Name ThreadManForUser, Functions 22, Variables 0, flags 40010000
Functions:
0xE81CAF8F [0x0020C7E8] - ThreadManForUser_E81CAF8F
0x82826F70 [0x0020C7F0] - ThreadManForUser_82826F70
0x278C0DF5 [0x0020C7F8] - ThreadManForUser_278C0DF5
0xCEADEB47 [0x0020C800] - ThreadManForUser_CEADEB47
0xD6DA4BA1 [0x0020C808] - ThreadManForUser_D6DA4BA1
0x28B6489C [0x0020C810] - ThreadManForUser_28B6489C
0x3F53E640 [0x0020C818] - ThreadManForUser_3F53E640
0x4E3A1105 [0x0020C820] - ThreadManForUser_4E3A1105
0x55C20A00 [0x0020C828] - ThreadManForUser_55C20A00
0xEF9E4C70 [0x0020C830] - ThreadManForUser_EF9E4C70
0x1FB15A32 [0x0020C838] - ThreadManForUser_1FB15A32
0x7C0DC2A0 [0x0020C840] - ThreadManForUser_7C0DC2A0
0xF0B7DA1C [0x0020C848] - ThreadManForUser_F0B7DA1C
0x876DBFAD [0x0020C850] - ThreadManForUser_876DBFAD
0x884C9F90 [0x0020C858] - ThreadManForUser_884C9F90
0x74829B76 [0x0020C860] - ThreadManForUser_74829B76
0xDF52098F [0x0020C868] - ThreadManForUser_DF52098F
0x33BE4024 [0x0020C870] - ThreadManForUser_33BE4024
0x446D8DE6 [0x0020C878] - ThreadManForUser_446D8DE6
0x9FA03CD3 [0x0020C880] - ThreadManForUser_9FA03CD3
0xF475845D [0x0020C888] - ThreadManForUser_F475845D
0xAA73C935 [0x0020C890] - ThreadManForUser_AA73C935
Import 13, Name UtilsForUser, Functions 4, Variables 0, flags 40010000
Functions:
0x27CC57F0 [0x0020C898] - UtilsForUser_27CC57F0
0x71EC4271 [0x0020C8A0] - UtilsForUser_71EC4271
0x79D1C3FA [0x0020C8A8] - UtilsForUser_79D1C3FA
0xB435DEC5 [0x0020C8B0] - UtilsForUser_B435DEC5
Import 14, Name LoadExecForUser, Functions 2, Variables 0, flags 40010000
Functions:
0x05572A5F [0x0020C8B8] - LoadExecForUser_05572A5F
0x4AC57943 [0x0020C8C0] - LoadExecForUser_4AC57943
Import 15, Name KDebugForKernel, Functions 1, Variables 0, flags 00010000
Functions:
0x84F370BC [0x0020C8C8] - KDebugForKernel_84F370BC
Import 16, Name LoadCoreForKernel, Functions 2, Variables 0, flags 00010000
Functions:
0xD8779AC6 [0x0020C8D0] - LoadCoreForKernel_D8779AC6
0xCCE4A157 [0x0020C8D8] - LoadCoreForKernel_CCE4A157
Import 17, Name sceSysreg_driver, Functions 3, Variables 0, flags 00010000
Functions:
0xDE59DACB [0x0020C8E0] - sceSysreg_driver_DE59DACB
0x2DB0EB28 [0x0020C8E8] - sceSysreg_driver_2DB0EB28
0x44F6CDA7 [0x0020C8F0] - sceSysreg_driver_44F6CDA7
Done

TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

You problems are the ones at the end, Kdebug/Sysreg, you can determine that from the library flags, 0009 indicates late binding and thus probably means user mode and even if not it wouldn't need to link, 4001 means kernel to user syscall gateway, it is the 0001 which in the sdk tends to indicate kernel mode libs
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

TyRaNiD wrote:You problems are the ones at the end, Kdebug/Sysreg, you can determine that from the library flags, 0009 indicates late binding and thus probably means user mode and even if not it wouldn't need to link, 4001 means kernel to user syscall gateway, it is the 0001 which in the sdk tends to indicate kernel mode libs

so what can I do to fix it?
jockyw2001
Posts: 339
Joined: Thu Sep 29, 2005 4:19 pm

Post by jockyw2001 »

It appears that "loadutils.c" (from Dark Alex's SDK) calls function sceKernelFindModuleByUID from LoadCoreForKernel
LoadCoreForKernel has flags 00010000.

EDIT: Figured out what I was doing wrong. No imports from libs with flags 0001 anymore :)
User avatar
blondin
Posts: 18
Joined: Tue Mar 07, 2006 12:16 am
Location: France (Grenoble)

libjpeg problem

Post by blondin »

That's find, pspDebugInstallErrorHandler was removed and homebrew run correctly...
good but now I'm confronted with a new problem with libjpeg:
When I call read_jpeg_file(...) the function hang with jpeg_finish_decompress(&cinfo);

The code:

Code: Select all

my_bmp_type* read_jpeg_file (char * filename)
{
  struct jpeg_decompress_struct cinfo;
  struct jpeg_error_mgr jerr;


  FILE * infile;		/* source file */
  JSAMPARRAY buffer;	/* Output row buffer */
  int row_stride;		/* physical row width in output buffer */
  my_bmp_type *img = NULL;


  if ((infile = fopen(filename, "rb")) == NULL) {
    fprintf(stderr, "can't open %s\n", filename);
    return NULL;
  }

  printf("breakpoint 1\n");
  cinfo.err = jpeg_std_error(&jerr);
  printf("2\n");
  jpeg_create_decompress(&cinfo);
  printf("3\n");
  jpeg_stdio_src(&cinfo, infile);
  printf("4\n");
  (void) jpeg_read_header(&cinfo, TRUE);
  printf("5\n");
  jpeg_calc_output_dimensions( &cinfo );
  printf("6\n");
  row_stride = cinfo.output_width * cinfo.output_components;
  printf("7\n");
  buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
  printf("8\n");
  (void) jpeg_start_decompress(&cinfo);
  printf("9\n");

  if (cinfo.out_color_components >= 3)
  {
    unsigned int x;
    printf("10\n");
    u32 *p_dest;
    img = (my_bmp_type *)malloc(sizeof(my_bmp_type));
    printf("11\n");
	if (img)
	{
                  printf("12\n");
	  img->data = (u32 *)malloc(cinfo.output_width * cinfo.output_height * 4);
	  if (img->data)
	  {
	    u8 r, g, b, a;

	    img->current_frame = 0;
		img->frame = 1;
		img->w = cinfo.output_width;
		img->h = cinfo.output_height;
	  
	    p_dest = img->data;
                    printf("13\n");
	    while &#40;cinfo.output_scanline < cinfo.output_height&#41; 
	    &#123;
		  const JSAMPLE *		p_src;
		  &#91;b&#93;printf&#40;"14\n"&#41;;&#91;/b&#93;
	      &#40;void&#41; jpeg_read_scanlines&#40;&cinfo, buffer, 1&#41;;

		  p_src = *buffer;

		  for &#40; x = 0; x < cinfo.output_width; ++x &#41;
		  &#123;
		    r = *p_src++;
			g = *p_src++;
			b = *p_src++;
			&#91;b&#93;printf&#40;"15\n"&#41;;&#91;/b&#93;
			if &#40;cinfo.out_color_components > 3&#41;
			&#123;
			  a = *p_src++;
			&#125;
			else
			&#123;
			  a = 0x00;
			&#125;
			p_dest&#91;x&#93; = RGBA&#40;r,g,b,a&#41;;
		  &#125;

		  p_dest += &#40; cinfo.output_width &#41;;
        &#125;
	  &#125;
	  else
	  &#123;
	    free&#40;img&#41;;
		img = NULL;
	  &#125;
	&#125;
  &#125;
  printf&#40;"16\n"&#41;;
  /* Step 7&#58; Finish decompression */
  &#40;void&#41; jpeg_finish_decompress&#40;&cinfo&#41;;
  printf&#40;"17\n"&#41;;
  jpeg_destroy_decompress&#40;&cinfo&#41;;
  printf&#40;"18\n"&#41;;
  fclose&#40;infile&#41;;
  printf&#40;"19\n"&#41;;
  return img;
&#125;
the code pass the breakpoint 1,2,3,4,5,6,7,8,9,10,11,12,16 and hang...
the filename is correct and I think it's due to the memory management but I'm not sure, if someone understand... thx ;)
jockyw2001
Posts: 339
Joined: Thu Sep 29, 2005 4:19 pm

Post by jockyw2001 »

I'm sure the 2nd malloc() fails:

Code: Select all

img->data = &#40;u32 *&#41;malloc&#40;cinfo.output_width * cinfo.output_height * 4&#41;;
My PMPVLC 0.0.9 port for 3.03 OE also stumbles over malloc. Atm I have no clue why it does.

EDIT:
Things got better just by increasing the heap:

Code: Select all

PSP_MODULE_INFO&#40;"PMP VLC Player 0.0.9", 0, 1, 1&#41;;
PSP_HEAP_SIZE_KB&#40;4096&#41;;
I'm still experimenting to find the right size.
User avatar
blondin
Posts: 18
Joined: Tue Mar 07, 2006 12:16 am
Location: France (Grenoble)

Thx

Post by blondin »

Thx jocky good work again ;)
Post Reply