| View previous topic :: View next topic |
| Author |
Message |
skwi
Joined: 16 May 2006 Posts: 22
|
Posted: Mon Jun 09, 2008 12:45 am Post subject: file access problem with BUILD_PRX = 1 |
|
|
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: |
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: |
PSP_MODULE_INFO("3D Test", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER); |
and I acces file this way :
| Code: | FILE * fi1;
fi1 = fopen ( nomobj , "rb" ); |
thanks if you can help |
|
| Back to top |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Mon Jun 09, 2008 8:56 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Wally

Joined: 26 Sep 2005 Posts: 672
|
Posted: Mon Jun 09, 2008 9:05 pm Post subject: |
|
|
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* |
|
| Back to top |
|
 |
skwi
Joined: 16 May 2006 Posts: 22
|
Posted: Mon Jun 09, 2008 10:17 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Mon Jun 09, 2008 11:52 pm Post subject: |
|
|
| Wally meant PSP_HEAP_SIZE_KB(20480); |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Jun 10, 2008 12:56 am Post subject: |
|
|
| 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. :) |
|
| Back to top |
|
 |
|