forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Prx troubles

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Tue Jan 06, 2009 4:56 am    Post subject: Prx troubles Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Tue Jan 06, 2009 10:07 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Jan 06, 2009 2:25 pm    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Tue Jan 06, 2009 11:57 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Wed Jan 07, 2009 12:03 am    Post subject: Reply with quote

Quote:
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...
_________________
Get Xplora!
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Wed Jan 07, 2009 12:21 am    Post subject: Reply with quote

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

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

PSP_MODULE_INFO("Xplora_images", 0x1000, 1, 8);

static unsigned char* data;

extern unsigned char mouse_start[];
extern unsigned int mouse_size;

int unsstrcopy(unsigned char* string, unsigned int sizeof_string, unsigned char* data)
{
    int i=0;
    for(;i<(int)sizeof_string; i++)
    {
        data[i]=string[i];
    }
    return i;
}

unsigned char* GetMouse(unsigned int* barra_size)
{
    *barra_size = mouse_size;
    data = (unsigned char*)malloc(*barra_size);
    unsstrcopy(mouse_start, *barra_size, data);
    return (unsigned char*)(((int)data)&~0x80000000);
}

int module_start(SceSize args, void *argp)
{
    return 0;
}

int module_stop(SceSize args, void *argp)
{   
   return 0;
}

Makefile:
Code:
TARGET = X_images
OBJS = main.o data/img/img_mouse.o

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c

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

include $(PSPSDK)/lib/build.mak

all:
   psp-build-exports -s exports.exp
   rm -f $(TARGET).elf
   rm -f *.o
   psp-packer -s $(TARGET).prx $(TARGET).prx

data/img/img_mouse.o: data/mouse.png
   bin2o -i data/mouse.png data/img/img_mouse.o mouse

exports.exp
Code:

PSP_BEGIN_EXPORTS

PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END

PSP_EXPORT_START(Xplora_images, 0, 0x4001)
PSP_EXPORT_FUNC(GetMouse)
PSP_EXPORT_END

PSP_END_EXPORTS

_________________
Get Xplora!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group