Prx troubles

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

Moderators: cheriff, TyRaNiD

Post Reply
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Prx troubles

Post by coolkehon »

i want to make a prx that can hold files inside of the prx so that they arent loaded in the main eboot and can be loaded and unloaded but i cant get it to work and someone make an example of this and the prx needs to be kernel

my problems:
when i compile i get no lib.stub found (kernel prx) what does this mean and how do i fix it also same

user prx: when i try to load one period it either crashes the program or says no memory for prx so i'm think there isnt any memory for it because my heap size is PSP_HEAP_SIZE_MAX() in the main EBOOT so how do i fix this and i dont really get heap stack and some of the other phrases what are those
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

I made a small example of a user prx for someone else. You might look for it. Use PSP_HEAP_SIZE_KB(val); instead of MAX. "val" would be the number of kB... make the value NEGATIVE and it represents all the memory EXCEPT for that many KB. So -256 means use all the memory for the heap except for 256 KB. Make the negative value larger enough that the user prx will fit in what you leave left over.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Set a smaller heap size in your EBOOT like J.F. said.

You can embed files in a PRX using the bin2o or bin2c tools.
bin2c will output a header file with a char array containing your file.

If your embedded file is another module, then you can load it straight from the char array in memory using that sce load module function that supports buffer (forgot the name).
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

i havent figure out how to use bin2o yet can you explain cause once i pack them then how do i access them and how do i compile them together
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

when i compile i get no lib.stub found (kernel prx) what does this mean and how do i fix it also same
This is because you have no imports...
Anyway, haven't understand your question , some time ago I've writed a module that I'm using for images and I've exported memory addresses to use the images inside the main program..
If you want I can write down a simple example...
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Sorry, I've tried to upload the file but I can't get "Browse" button working... -.-
This is the code:
main.c:

Code: Select all

#include <pspkernel.h>
#include <malloc.h>

PSP_MODULE_INFO&#40;"Xplora_images", 0x1000, 1, 8&#41;;

static unsigned char* data;

extern unsigned char mouse_start&#91;&#93;;
extern unsigned int mouse_size;

int unsstrcopy&#40;unsigned char* string, unsigned int sizeof_string, unsigned char* data&#41;
&#123;
    int i=0;
    for&#40;;i<&#40;int&#41;sizeof_string; i++&#41;
    &#123;
        data&#91;i&#93;=string&#91;i&#93;;
    &#125;
    return i;
&#125;

unsigned char* GetMouse&#40;unsigned int* barra_size&#41;
&#123;
    *barra_size = mouse_size;
    data = &#40;unsigned char*&#41;malloc&#40;*barra_size&#41;;
    unsstrcopy&#40;mouse_start, *barra_size, data&#41;;
    return &#40;unsigned char*&#41;&#40;&#40;&#40;int&#41;data&#41;&~0x80000000&#41;;
&#125;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
    return 0;
&#125;

int module_stop&#40;SceSize args, void *argp&#41;
&#123;   
   return 0;
&#125;
Makefile:

Code: Select all

TARGET = X_images
OBJS = main.o data/img/img_mouse.o

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41; -c

LIBS = -lpspmodulemgr_kernel
LDFLAGS = -mno-crt0 -nostartfiles

include $&#40;PSPSDK&#41;/lib/build.mak

all&#58;
	psp-build-exports -s exports.exp
	rm -f $&#40;TARGET&#41;.elf
	rm -f *.o
	psp-packer -s $&#40;TARGET&#41;.prx $&#40;TARGET&#41;.prx

data/img/img_mouse.o&#58; data/mouse.png
	bin2o -i data/mouse.png data/img/img_mouse.o mouse
exports.exp

Code: Select all

PSP_BEGIN_EXPORTS

PSP_EXPORT_START&#40;syslib, 0, 0x8000&#41;
PSP_EXPORT_FUNC_HASH&#40;module_start&#41;
PSP_EXPORT_VAR_HASH&#40;module_info&#41;
PSP_EXPORT_END

PSP_EXPORT_START&#40;Xplora_images, 0, 0x4001&#41;
PSP_EXPORT_FUNC&#40;GetMouse&#41;
PSP_EXPORT_END

PSP_END_EXPORTS
Post Reply