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 

psplinkusb access other files

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



Joined: 19 May 2008
Posts: 19

PostPosted: Fri May 23, 2008 5:29 pm    Post subject: psplinkusb access other files Reply with quote

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
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri May 23, 2008 5:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Fri May 23, 2008 5:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri May 23, 2008 6:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Fri May 23, 2008 6:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Fri May 23, 2008 6:25 pm    Post subject: Reply with quote

I cannot get the error message. Is it possible for a PRX to print to pspsh?

Thanks
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Fri May 23, 2008 9:00 pm    Post subject: Reply with quote

"printf" should print to the psplink shell.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sat May 24, 2008 1:18 am    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Sat May 24, 2008 3:43 am    Post subject: Reply with quote

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
View user's profile Send private message
psPea



Joined: 01 Sep 2007
Posts: 64

PostPosted: Sat May 24, 2008 6:18 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Sat May 24, 2008 6:29 am    Post subject: Reply with quote

endl is equivalent to "\n" and flush.
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sat May 24, 2008 8:25 am    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Sat May 24, 2008 9:20 am    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Sat May 24, 2008 3:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sat May 24, 2008 9:52 pm    Post subject: Reply with quote

I am talking about printing to psp creen not pspsh
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sun May 25, 2008 12:26 am    Post subject: Reply with quote

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
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Sun May 25, 2008 5:23 am    Post subject: Reply with quote

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
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Sun May 25, 2008 5:42 am    Post subject: Reply with quote

Yes :)
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sun May 25, 2008 9:30 pm    Post subject: Reply with quote

that's the most updated toolchain now you must update the sdk.
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
cyberfish



Joined: 19 May 2008
Posts: 19

PostPosted: Mon May 26, 2008 9:42 am    Post subject: Reply with quote

updating the toolchain to svn fixed everything =). Thanks for the help.
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