Edit: Please ignore the whole posting. Looks like a library problem, fiddling with library order solves it.. so must be sucking in some incorrect lib :(
--
After getting some weird results while mucking with some basic code using the defaults in PSPSDK I put together a dumb test case..
#if 1
int fd = 0;
UInt8 buffer [ 3 ] = { 0, 0, 0 };
UInt8 error = 0;
fd = sceIoOpen ( "ms0:/ATARI_ST/TOS.IMG", PSP_O_RDONLY, 0777 );
if ( fd ) {
if ( sceIoRead ( fd, buffer, 3 ) == 3 ) {
// good
} else {
error = 1;
}
sceIoClose ( fd );
}
#endif
And later, in the display loop..
pspDebugScreenSetXY ( 0, 0 );
pspDebugScreenPrintf ( "fd %d err %d bytes %x %x %x", fd, error,
buffer [ 0 ], buffer [ 1 ], buffer [ 2 ] );
So here I get a big -ve number for the fd; it should likely be 0 (failed) or 1 (good). Naturally, the subsequant calls also fail.
The file does exist, but thats irrelevent since I'm not getting a useful return value.
(Building under Windows for now, since PSP easily plugs into Windows :)
jeff
sceIoOpen .. screwy?
-
- Posts: 29
- Joined: Tue Aug 30, 2005 10:37 am
- Contact:
sceIoOpen .. screwy?
Last edited by skeezixcodejedi on Tue Aug 30, 2005 11:36 am, edited 1 time in total.
--
Have you played Atari today?
Have you played Atari today?
-
- Posts: 29
- Joined: Tue Aug 30, 2005 10:37 am
- Contact:
Additionally, biulding sample/kernel/fileio sample compiles flawlessly, but crashes the PSP when run.
Thanks for any ideas!
jeff
edit: Actually the Makefile is missing USE_PSPSDK_LIBC=1 .. adding that and filio.c demo seems to work, so I'll go see if it wrote anything useful out (its a rom dumper).
Thanks for any ideas!
jeff
edit: Actually the Makefile is missing USE_PSPSDK_LIBC=1 .. adding that and filio.c demo seems to work, so I'll go see if it wrote anything useful out (its a rom dumper).
--
Have you played Atari today?
Have you played Atari today?
Re: sceIoOpen .. screwy?
assumption is the mother of all fuck-ups...skeezixcodejedi wrote:So here I get a big -ve number for the fd; it should likely be 0 (failed) or 1 (good). Naturally, the subsequant calls also fail.
go and read up on open() return codes in your favourite "teach yourself C in 24 hours" book: <0 is failed, >=0 is a valid fd
-
- Posts: 29
- Joined: Tue Aug 30, 2005 10:37 am
- Contact:
It really generally depends on the platform; most unix boxes return -1 on error and set errno; some platforms return 0. >0 or >=0 is usually success.
Getting -0xFFF0000 and such seems pretty weird :)
Still, nomatter.. just had to find it out. It helped when it wasn't returnign random values.. when using some mixture of libs, I got no useful returns back, and a different result each run. After futzing with libs, the problem went away so I've not documented it well I'm afraid :(
jeff
Getting -0xFFF0000 and such seems pretty weird :)
Still, nomatter.. just had to find it out. It helped when it wasn't returnign random values.. when using some mixture of libs, I got no useful returns back, and a different result each run. After futzing with libs, the problem went away so I've not documented it well I'm afraid :(
jeff
--
Have you played Atari today?
Have you played Atari today?
-
- Posts: 29
- Joined: Tue Aug 30, 2005 10:37 am
- Contact: