sceIoOpen failed to read my file...

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
jiuhu
Posts: 5
Joined: Thu Feb 11, 2010 12:08 am

sceIoOpen failed to read my file...

Post by jiuhu »

hi,

I try to call the function sceIoOpen to read my file, but it fail.
I checked the return id, and it is a huge negative value.

may I know when I run and test my prx, where should I place my file together?

Currently, I am placing the prx and the file together under same dir. And sure, the path is defined correctly in my code. Example code,
buff_id = sceIoOpen("sound.mid",SCE_O_RDONLY,0);

And I am develop with a PSP Development kit.

Thank you.

Regards,
JiuHu
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Hi,

have you tried fopen from stdio.h ?

Regards,
AnMaBaGiMa
jiuhu
Posts: 5
Joined: Thu Feb 11, 2010 12:08 am

Post by jiuhu »

Thanks for the suggestion, I just tried it, but same results...
Do I need to further specify the sound file that I want to use for my PRX?

Thank you.

Regards,
JiuHu
roby65
Posts: 52
Joined: Sun Jun 01, 2008 9:12 pm
Location: Mid Italy
Contact:

Post by roby65 »

jiuhu wrote:Thanks for the suggestion, I just tried it, but same results...
Do I need to further specify the sound file that I want to use for my PRX?

Thank you.

Regards,
JiuHu
Post code, it whould work :)
jiuhu
Posts: 5
Joined: Thu Feb 11, 2010 12:08 am

Post by jiuhu »

SceUID buff_id;
if ((buff_id = sceIoOpen(filename, SCE_O_RDONLY,0)) < 0){
printf("Problems here...");
return -1;
}

it seems like the application couldn't find my sound file...

Here is how my dir structure....I have a working dir named PSPSound
and I have my compiled output (prx...) in PSPSound/PSP_DebugOpt,
Am I going to place my file under the same dir with the prx?

Thank you.

Regards,
JiuHu
roby65
Posts: 52
Joined: Sun Jun 01, 2008 9:12 pm
Location: Mid Italy
Contact:

Post by roby65 »

jiuhu wrote:SceUID buff_id;
if ((buff_id = sceIoOpen(filename, SCE_O_RDONLY,0)) < 0){
printf("Problems here...");
return -1;
}

it seems like the application couldn't find my sound file...

Here is how my dir structure....I have a working dir named PSPSound
and I have my compiled output (prx...) in PSPSound/PSP_DebugOpt,
Am I going to place my file under the same dir with the prx?

Thank you.

Regards,
JiuHu
Uh?
Prx or eboot?
AFAIK it looks for the file in the same dir of eboot
Raiden
Posts: 10
Joined: Sat Nov 14, 2009 7:17 pm

Post by Raiden »

Code: Select all

 if&#40;!&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_RDONLY, 0777&#41;&#41; &#123;
        // error
 &#125;
http://psp.jim.sh/pspsdk-doc/group__Fil ... 6859f69ec8
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

If you are running a prx using your debugger with SAPLINK the file should be in the root directory of the local (hard disk) drive mounted with usbhost. I've currently only used fopen and it works fine for me. If you run the eboot from PSP the file need to be in the same folder as your eboot on the PSP.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

What's the error return value? We can't guess it, you'll have to tell us.
Davee
Posts: 43
Joined: Mon Jun 22, 2009 3:58 am

Post by Davee »

Raiden wrote:

Code: Select all

 if&#40;!&#40;fd = sceIoOpen&#40;"device&#58;/path/to/file", O_RDONLY, 0777&#41;&#41; &#123;
        // error
 &#125;
http://psp.jim.sh/pspsdk-doc/group__Fil ... 6859f69ec8
That's wrong in so many ways...

error is < 0 and there is no "O_RDONLY" defined in the PSP SDK.
jiuhu
Posts: 5
Joined: Thu Feb 11, 2010 12:08 am

Post by jiuhu »

jimparis wrote:What's the error return value? We can't guess it, you'll have to tell us.
is a huge negative number, -2147418110.

Btw, do I need to specify any working directory for all my resources files?
Like specify a UMD dir for the sound files...

Do I need to specify the value for "device:" ?

Thank you.

Regards,
JiuHu
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Well that number is 80010002 in hex (use Windows calculator in Programmer mode to work it out), you can search for that with psp to find out your problem.

Jim
jiuhu
Posts: 5
Joined: Thu Feb 11, 2010 12:08 am

Post by jiuhu »

Thanks guys...
I get my sound file loaded, after specifying the host0 for my path...
"host0:sound.mid"
Post Reply