How to export functions in an eboot.pbp, to loaded PRX?

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

Moderators: cheriff, TyRaNiD

Post Reply
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

How to export functions in an eboot.pbp, to loaded PRX?

Post by usertestprueba »

Hello everybody,

I am making a new application for the PSP, a window environment where the threads can create windows, write in them... etc

Now, I have a problem.

In all the examples that I have seen, there is an EBOOT.PBP that loads a PRX and then, some function in the PRX can be used by the EBOOT.PBP.

But I need just the opposite.

I have an EBOOT.PBP with lots of functions, and I need to export them to all the PRX that this EBOOT loads.

I have tried mixing the PRX export commands and the .S libraries in the EBOO.PBP, but it is not working.

I am able to run my program, but when I load the PRX, it just freezes.

I have also tried to compile my program as a PRX, and load it trough an EBOOT, but it shows nothing in the screen.

I have asked this only in the ps2dev.org forum because I know that someone will solve my problem :-)

Thanks a lot :-D
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Just use BUILD_PRX=1 in the makefile. Your EBOOT will contain a PRX. Export functions normally from it. Any other PRX can import the functions of your EBOOT's PRX.
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Post by usertestprueba »

Torch wrote:Just use BUILD_PRX=1 in the makefile. Your EBOOT will contain a PRX. Export functions normally from it. Any other PRX can import the functions of your EBOOT's PRX.
Hmm I did that, but when I tried to run the eboot it returned to the XMB and shown an error.

Thanks

Edit: The error is "800200D9" (failed to allocate the memory block)

Edit again:
OK I fixed a few lines in the code and now it compiles and run the EBOOT with the PRX and it exports the functions.
Now, the problem is when I load the PRX that tries to use those functions. The PSP just freezes. I have tried with other PRX (music.prx) and it works, so the problem is not loading the PRX, but the PRX itself.

Thanks for your help :-)
Last edited by usertestprueba on Tue Sep 15, 2009 11:34 pm, edited 2 times in total.
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Post by usertestprueba »

Here is the EBOOT.PBP's Makefile:

Code: Select all

PSPSDK = $(shell psp-config --pspsdk-path)
PSPLIBSDIR = $(PSPSDK)/..
TARGET = multiTasKing

OBJS = main.o graphics.o framebuffer.o

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

CFLAGS = -O2 -G0 -Wall

CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti

ASFLAGS = $(CFLAGS)

LIBDIR =

LIBS = -lpspgu -lpsppower -lpng -lz -lm
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP

PSP_EBOOT_TITLE = multiTasKing

#PSP_EBOOT_ICON = ICON0.png


include $(PSPSDK)/lib/build.mak
And the exports.exp:

Code: Select all

# Define the exports for the prx
PSP_BEGIN_EXPORTS

# Export our functions
PSP_EXPORT_START(multiTasKingLib, 0, 0x0001)
PSP_EXPORT_FUNC(delay)
PSP_EXPORT_FUNC(redondear)
PSP_EXPORT_FUNC(limpiarVentana)
PSP_EXPORT_FUNC(numeroDeVentanasAbiertas)
PSP_EXPORT_FUNC(crearNuevaVentana)
PSP_EXPORT_FUNC(eliminarVentana)
PSP_EXPORT_FUNC(ventanaPasaAPrimerPlano)
PSP_EXPORT_FUNC(existeVentana)
PSP_EXPORT_FUNC(printTextImage)
PSP_EXPORT_FUNC(fillImageRect)
PSP_EXPORT_END


PSP_END_EXPORTS
And this is the "multiTasKingLib.S" that I include in the PRX: (generated with prxtools)

Code: Select all

	.set noreorder

#include "pspimport.s"

IMPORT_START "multiTasKingLib",0x00090000
IMPORT_FUNC  "multiTasKingLib",0x024F46AB,delay
IMPORT_FUNC  "multiTasKingLib",0x843B7EAC,redondear
IMPORT_FUNC  "multiTasKingLib",0x33A23BA9,limpiarVentana
IMPORT_FUNC  "multiTasKingLib",0x93952B2A,numeroDeVentanasAbiertas
IMPORT_FUNC  "multiTasKingLib",0xD4467F17,crearNuevaVentana
IMPORT_FUNC  "multiTasKingLib",0x907F84B4,eliminarVentana
IMPORT_FUNC  "multiTasKingLib",0x90435DD8,ventanaPasaAPrimerPlano
IMPORT_FUNC  "multiTasKingLib",0x7EEEDC14,existeVentana
IMPORT_FUNC  "multiTasKingLib",0x630D6778,printTextImage
IMPORT_FUNC  "multiTasKingLib",0x04C6A497,fillImageRect
And also the exports.exp of the PRX:

Code: Select all

# Define the exports for the prx
PSP_BEGIN_EXPORTS

# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END


PSP_END_EXPORTS
And the PRX's makefile:

Code: Select all

release: all



TARGET = aplicacion

OBJS = main.o multiTasKingLib.o



INCDIR = 

CFLAGS = -O2 -G0 -Wall

CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti

ASFLAGS = $(CFLAGS)



LIBDIR =

LDFLAGS =



LIBS = 



USE_KERNEL_LIBC = 1

USE_KERNEL_LIBS = 1



BUILD_PRX = 1
PRX_EXPORTS = exports.exp



PSPSDK=$(shell psp-config --pspsdk-path)

include $(PSPSDK)/lib/build_prx.mak
Thanks again for your help :-)

Edit: I have added the ones that I have now.
The problem is that the PSP freezes when I start the PRX that is suposed to use the functions in "multiTasKingLib"
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Post by usertestprueba »

I have managed to make it work
Lots of searching examples, but finally, it works!!!

I have made a window environment capable of giving each PRX a window where write

Thanks a lot for your help Torch (not much, but I know you would have helped me until I make it work xDD)

Now I have to start programming PRX for my app :-P

Let see where it gets ;-)

Cheers,
Carlos

PD: For the curious: http://psp.scenebeta.com/node/38280
mypspdev
Posts: 178
Joined: Wed Jul 11, 2007 10:30 pm

Post by mypspdev »

usertestprueba wrote: PD: For the curious: http://psp.scenebeta.com/node/38280
wow!!!
great!!
let me try to do something with MyTouchscreen.....
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Post by usertestprueba »

mypspdev wrote:
usertestprueba wrote: PD: For the curious: http://psp.scenebeta.com/node/38280
wow!!!
great!!
let me try to do something with MyTouchscreen.....
Thank you :-D

Sorry, I don't understand the "let me try to do something with MyTouchscreen....." xD
¿What do you mean?

Thanks again :-)

PD: If you are not registered at psp.scenebeta.com, here it is the program:
http://server.carlosgs.es/PSPhomebrew/m ... 70_PDC.rar
mypspdev
Posts: 178
Joined: Wed Jul 11, 2007 10:30 pm

Post by mypspdev »

.sorry ... deleted
... you have a ..PM..
Last edited by mypspdev on Thu Sep 17, 2009 6:29 pm, edited 1 time in total.
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Post by usertestprueba »

mypspdev wrote:.sorry ... deleted
Now I am completely lost xD
pegasus2000
Posts: 160
Joined: Wed Jul 12, 2006 7:09 am

Post by pegasus2000 »

A Nanodesktop SDK clone ?
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Cool

Post by usertestprueba »

pegasus2000 wrote:A Nanodesktop SDK clone ?
I hadn't seen that app before, thanks for the advise ;-)

But I think it is not the same.
That is an SDK, this is only for managing .prx, so you need to use the PSPSDK.
(are you the author?)

Thanks again ;-)
pegasus2000
Posts: 160
Joined: Wed Jul 12, 2006 7:09 am

Re: Cool

Post by pegasus2000 »

usertestprueba wrote:
pegasus2000 wrote:A Nanodesktop SDK clone ?
I hadn't seen that app before, thanks for the advise ;-)

But I think it is not the same.
That is an SDK, this is only for managing .prx, so you need to use the PSPSDK.
(are you the author?)

Thanks again ;-)
Oh, yes. The project is mine.
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Re: Cool

Post by usertestprueba »

pegasus2000 wrote:
usertestprueba wrote:
pegasus2000 wrote:A Nanodesktop SDK clone ?
I hadn't seen that app before, thanks for the advise ;-)

But I think it is not the same.
That is an SDK, this is only for managing .prx, so you need to use the PSPSDK.
(are you the author?)

Thanks again ;-)
Oh, yes. The project is mine.
Cool, congratulations ;-)

You are right, this really sounds like a clone xD
Trust me, it is not.

I'm trying to make multiTasKing as simple as possible, I don't plan to make an SDK for the PSP. Just want to make the coders able to make simple games and apps and have them all in a single EBOOT.PBP.

My first idea was to make only a window environment that uses threads, now I have managed to make .prx to run in it ;-)

And everything in a week ;-) (begun the 9/9/09 :-P)

Your proyect is different, easier to use, but this is lighter, and with less functions.
pegasus2000
Posts: 160
Joined: Wed Jul 12, 2006 7:09 am

Re: Cool

Post by pegasus2000 »

usertestprueba wrote:
pegasus2000 wrote:
usertestprueba wrote: I hadn't seen that app before, thanks for the advise ;-)

But I think it is not the same.
That is an SDK, this is only for managing .prx, so you need to use the PSPSDK.
(are you the author?)

Thanks again ;-)
Oh, yes. The project is mine.
Cool, congratulations ;-)

You are right, this really sounds like a clone xD
Trust me, it is not.

I'm trying to make multiTasKing as simple as possible, I don't plan to make an SDK for the PSP. Just want to make the coders able to make simple games and apps and have them all in a single EBOOT.PBP.

My first idea was to make only a window environment that uses threads, now I have managed to make .prx to run in it ;-)

And everything in a week ;-) (begun the 9/9/09 :-P)

Your proyect is different, easier to use, but this is lighter, and with less functions.
Yes, I understood.
usertestprueba
Posts: 12
Joined: Tue Sep 15, 2009 6:31 pm
Location: Spain

Post by usertestprueba »

Wow
I've tried one of the examples of your app, it is great ;-)

But the best are all the examples you have in your website, you are an expert in image manipulation! (face recognition, edge detector.... simply amazing :-) )

Congratulations for all your job ;-)
Post Reply