| View previous topic :: View next topic |
| Author |
Message |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Fri May 23, 2008 5:29 pm Post subject: psplinkusb access other files |
|
|
I have a SDL program that loads external bmp files. It works well when I compile it as EBOOT.PBP and transfer it to the PSP and run it the normal way. I then compiled it as prx and tried to run it with psplinkusb. The program starts, but it can't seem to find the bmp. What should I do to fix that?
Many thanks
EDIT: this is firmware 3.90 M33 with psplinkusb svn checked out yesterday, running the 3.0 OE version on the PSP. |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Fri May 23, 2008 5:37 pm Post subject: |
|
|
Add "BUILD_PRX = 1" to your Makefile and add this before your module info:
PSP_HEAP_SIZE_MAX();
or change the heap size for what you need.
should work. _________________
Upgrade your PSP |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Fri May 23, 2008 5:38 pm Post subject: |
|
|
Thanks for the reply.
The program compiles and runs fine, just that it needs an external file which it can't find. |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Fri May 23, 2008 6:16 pm Post subject: |
|
|
isn't the problem loading the image?
make sure is in the correct path.
if it is ./something/image.bmp
make sure its in inside the folder something which must be in the same directory as your EBOOT.PBP.
if it is ms0:/lalala, make the image is in there.
otherwise if you are sure hte path is correct. tell me if it says "error loading image" if you are doing any check like if (!image) print "error loading image"
do what I said if your problem is the last one I said _________________
Upgrade your PSP |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Fri May 23, 2008 6:19 pm Post subject: |
|
|
| The EBOOT.PBP version works fine. I have the images in the same directory. I am just not sure how to do that with the PRX version (as it is launched in pspsh). |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Fri May 23, 2008 6:25 pm Post subject: |
|
|
I cannot get the error message. Is it possible for a PRX to print to pspsh?
Thanks |
|
| Back to top |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Fri May 23, 2008 9:00 pm Post subject: |
|
|
| "printf" should print to the psplink shell. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sat May 24, 2008 1:18 am Post subject: |
|
|
One thing to check, if you are running it on a *nix host make sure you match filename case. By default on systems with case sensitive file systems such as linux then the host file system is also case sensitive, ms fat fs is case insensitive.
You can disable case sensitivity in usbhostfs_pc with either the shell 'nocase on' command or the -c switch.
If this isn't your issue then make sure you are using relative paths from your location. As long as you are using an normal 'main' function then it will have set the current directory to the location where your application started, which should be host in this case. The current directory should work fine through sceIoOpen or open/fopen
And yes stdout/stderr should be hooked up to pspsh, so using printf or fprintf(stderr, ...) should display direct to your pc. |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Sat May 24, 2008 3:43 am Post subject: |
|
|
Thanks for the replies.
The host is 64-bit x86 Linux.
I am assuming everything is case sensitive (everything is in lower case everywhere).
| Quote: |
If this isn't your issue then make sure you are using relative paths from your location. As long as you are using an normal 'main' function then it will have set the current directory to the location where your application started, which should be host in this case. The current directory should work fine through sceIoOpen or open/fopen
|
I am using relative paths (just the file name, in the working dir)
I am using SDL's SDL_LoadBMP(). It works fine if I copy the whole dir to PSP in USB Mode and run it from there (the EBOOT.PBP version).
My main:
| Code: |
extern "C" {
int main(void);
}
int main(void) {
...
}
|
| Quote: |
And yes stdout/stderr should be hooked up to pspsh, so using printf or fprintf(stderr, ...) should display direct to your pc.
|
Ah, I see. I will give it a try once I get back to my development machine. I tried iostream and it didn't work. Nothing was printed (I did flush the stream with endl, as the first line of main). |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Sat May 24, 2008 6:18 am Post subject: |
|
|
| You need to have a backslash n at the end of your string for it to show up in pspsh(using printf). Also just put the bitmap in your project folder. |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Sat May 24, 2008 6:29 am Post subject: |
|
|
| endl is equivalent to "\n" and flush. |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Sat May 24, 2008 8:25 am Post subject: |
|
|
I don't get your problem.
The images don't load.
Have did any debug?
Like:
if (!image) printf("ERROR LOADING IMAGE"); _________________
Upgrade your PSP |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Sat May 24, 2008 9:20 am Post subject: |
|
|
| Quote: |
I don't get your problem.
The images don't load.
Have did any debug?
Like:
if (!image) printf("ERROR LOADING IMAGE");
|
I have tried doing that using iostream. It didn't print anything to pspsh (even if I make it my first line in main). I will try printf later when I get access to my dev machine. |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Sat May 24, 2008 3:41 pm Post subject: |
|
|
Still no luck printing to pspsh. I have simplified my code down to this
| Code: |
#include <pspkernel.h>
#include <pspdisplay.h>
#include <cstdio>
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
PSP_HEAP_SIZE_MAX();
PSP_MODULE_INFO("Hello World", 0, 1, 1);
extern "C" {
int main();
}
int main() {
SetupCallbacks();
printf("a\n");
sceKernelExitGame();
}
|
Nothing is printed on pspsh. I am calling the program from pspsh.
| Code: |
host0:/proj/Test/> ./Test.prx
Load/Start host0:/proj/Test/Test.prx UID: 0x03EE3D7F Name: "Hello World"
host0:/proj/Test/> Resetting psplink
|
I can verify that the prx is actually updated by changing the module name (it is reflected here).
my Makefile:
| Code: |
TARGET = Test
OBJS = main.o
BUILD_PRX=1
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS = -L/usr/local/pspsdk/lib -lfreetype -lstdc++
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test
PSPSDK=$(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin
#CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
#CXXFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
#LIBS += $(shell $(PSPBIN)/sdl-config --libs)
include $(PSPSDK)/lib/build.mak
|
I have commented out the SDL part.
Thanks |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Sat May 24, 2008 9:52 pm Post subject: |
|
|
I am talking about printing to psp creen not pspsh _________________
Upgrade your PSP |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sun May 25, 2008 12:26 am Post subject: |
|
|
Try doing adding this:
sceIoWrite(1, "Hello\n", 6);
and see if you get anything written.
How old is your toolchain, there was bugs with the old toolchain with new psp firmwares due to weirdness from Sony. Of course there is always a chance that printf no longer works at all on newer firmwares. |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Sun May 25, 2008 5:23 am Post subject: |
|
|
| Quote: |
sceIoWrite(1, "Hello\n", 6);
|
Thanks. That worked.
Any way I can get stdout/stderr to work?
My tool chain is dated 20070626. Should I update it to svn? |
|
| Back to top |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Sun May 25, 2008 5:42 am Post subject: |
|
|
| Yes :) |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Sun May 25, 2008 9:30 pm Post subject: |
|
|
that's the most updated toolchain now you must update the sdk. _________________
Upgrade your PSP |
|
| Back to top |
|
 |
cyberfish
Joined: 19 May 2008 Posts: 19
|
Posted: Mon May 26, 2008 9:42 am Post subject: |
|
|
| updating the toolchain to svn fixed everything =). Thanks for the help. |
|
| Back to top |
|
 |
|