file access problem with BUILD_PRX = 1

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

Moderators: cheriff, TyRaNiD

Post Reply
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

file access problem with BUILD_PRX = 1

Post by skwi »

Hi,
I've got a weird problem when I try to add "BUILD_PRX = 1" in my makefile.
When I add this line, my program can't access file on disk, when it try to open a file, it return NULL.
but without BUILD_PRX = 1, everything work fine

I really don't understand why it wouldn't work

this is my makefile :

Code: Select all

TARGET = 3dtest
OBJS = main.o

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

LIBDIR =
LDFLAGS =
LIBS= -lpspgum -lpspgu -lm

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = 3D Test

BUILD_PRX = 1

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
my program is running in user mode under 3.90 M33

I use this :

Code: Select all

PSP_MODULE_INFO("3D Test", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);


and I acces file this way :

Code: Select all

 FILE * fi1;
    fi1 = fopen ( nomobj , "rb" );
thanks if you can help
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

New custom firmwares basically require a prx to be encapsulated into eboot. So the whole executable is like a library loader. While a program starts with a status setted by executing environment (or operating system...) a library does not, so a prx has _NOT_ (among other status variables) a Current Working Directory.....your program basically doesn't know where to find files you point out.
Solutions:
1) Provide full path filenames
2) find out cwd with some functions i don't remember at the moment (just search now that you have the "cwd" buzzword)

hope this will help!

jean
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

You havent defined a heap_size

Try adding this after the module info:
PSP_HEAP_SIZE(20480);

This will define the area which the program can play with, 20mb is what is allocated in my example. However you may adjust to suit.

I Wish there was a way to rid of this heapsize bullshit for once and for all :) *Bites TyRaNiD*
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

Post by skwi »

thanks for your answers,
Jean wrote:New custom firmwares basically require a prx to be encapsulated into eboot. So the whole executable is like a library loader. While a program starts with a status setted by executing environment (or operating system...) a library does not, so a prx has _NOT_ (among other status variables) a Current Working Directory.....your program basically doesn't know where to find files you point out.
Solutions:
1) Provide full path filenames
2) find out cwd with some functions i don't remember at the moment (just search now that you have the "cwd" buzzword)

hope this will help!

jean
actually it did'nt worked even with absolute path.
Wally4000 wrote: Try adding this after the module info:
PSP_HEAP_SIZE(20480);
I tried to add this, but it refuse to compile :

main.c:17: error: expected declaration specifiers or '...' before numeric constant
main.c:17: warning: data definition has no type or storage class
main.c:17: warning: type defaults to 'int' in declaration of 'PSP_HEAP_SIZE'

(any idea why ?)


so I tried to do this instead :

PSP_HEAP_SIZE_MAX();


and now everything is working fine, even with relative path when I run the prx with psplink

thanks for your help
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

Wally meant PSP_HEAP_SIZE_KB(20480);
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Insert_witty_name wrote:Wally meant PSP_HEAP_SIZE_KB(20480);
And if you have the latest SDK, you can now decide how much to leave instead of how much to take by using something like PSP_HEAP_SIZE_KB(-1024); instead. :)
Post Reply