| View previous topic :: View next topic |
| Author |
Message |
Gary13579
Joined: 15 Aug 2005 Posts: 93
|
Posted: Mon May 15, 2006 3:25 am Post subject: sceIoDread woes |
|
|
First thing I want to say: I have searched, and the only thing I've found close to this is here. I can't use the way he managed to solve it due to OSLib wouldn't work properly then.
I can call sceIoDopen and get a valid SceUID (3), but as soon as I call sceIoDread on that UID, the PSP crashes (sometimes with the mem stick light on and sometimes with it off).
Here's some code:
| Code: |
void loadDirectory(char* path) {
int dfd, f = 0, i = 0;
SceIoDirent dir;
oslDebug("hi\n");
dfd = sceIoDopen("ms0:/PSP/GAME/");
if (dfd <= 0)
oslFatalError("sceIoDopen returned %i", dfd);
oslDebug("sceIoDopen returned: %i\n", dfd);
while (sceIoDread(dfd, &dir) > 0) {
oslDebug("%s\n", dir.d_name);
if (!dir.d_stat.st_attr & FIO_SO_IFDIR) {
if (dir.d_name[0] != '.') {
strcpy(cwdFolders[f], dir.d_name);
f++;
}
} else {
strcpy(cwdFiles[i], dir.d_name);
i++;
}
}
oslDebug("bye\n");
sceIoDclose(dfd);
}
|
I get the debug message "hi", and the "sceIoDopen returned: 3", but it crashes on the call to sceIoDread. I never see the name or "bye" messages.
Edit: Just installed a quick exception handler if it helps.
Exception: Bus error (data)
EPC: 8802BAB8
Cause: 0000001C
Status: 60008603
BadVAddr: 412090C8
zr:00000000
a0:FFFFFFFF
t0:0000002E
t4:0000000D
s0:88229E88
s4:882E8878
t8:000001A1
gp:08950530
at:BC600000
a1:88229FAA
t1:00000000
t5:00001220
s1:882E8820
s5:00010000
t9:000001AE
sp:882E87A0
v0:00000000
a2:0000000D
t2:00000001
t6:00000244
s2:88229FA9
s6:08940000
k0:00000000
fp:08940000
v1:00000000
a3:FFFFFFFF
t3:88040000
t7:00000068
s3:00000003
s7:08940000
k1:00000003
ra:88151B88 |
|
| Back to top |
|
 |
jonny
Joined: 22 Sep 2005 Posts: 351
|
Posted: Mon May 15, 2006 4:01 am Post subject: |
|
|
this:
memset(&dir, 0, sizeof(SceIoDirent));
at the start of the function should solve |
|
| Back to top |
|
 |
Gary13579
Joined: 15 Aug 2005 Posts: 93
|
Posted: Mon May 15, 2006 4:06 am Post subject: |
|
|
Thanks, a friend on IRC was just telling me this. I'll try it in a sec and see if it works.
What's throwing me off is that samples/kernel/fileio/main.c (function dump_filesystem) does not do this, so I assumed it wasn't needed.
Edit: It's working great now. |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Mon May 15, 2006 4:47 am Post subject: |
|
|
| jonny wrote: | this:
memset(&dir, 0, sizeof(SceIoDirent));
at the start of the function should solve |
It seems that all of us had the same problem in the past ;)
(the curious thing is that isn't needed when listing files from the flash, that made more difficult to point that out the first and last time i had that problem :S )
The lesson: always memzero a structure before using it...
P.S.: someone should edit the example that comes in the pspsdk that copies the files from the flash, to avoid spreading more this error. |
|
| Back to top |
|
 |
jonny
Joined: 22 Sep 2005 Posts: 351
|
Posted: Mon May 15, 2006 5:04 am Post subject: |
|
|
| Quote: |
It seems that all of us had the same problem in the past ;)
|
hehe yes, i'll never forget sceIoDread :) |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Mon May 15, 2006 8:07 am Post subject: |
|
|
:P indeed fixy fix _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
|