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 

sceIoOpen failed to read my file...

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



Joined: 11 Feb 2010
Posts: 5

PostPosted: Thu Feb 11, 2010 12:13 am    Post subject: sceIoOpen failed to read my file... Reply with quote

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
Back to top
View user's profile Send private message
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Feb 11, 2010 12:19 am    Post subject: Reply with quote

Hi,

have you tried fopen from stdio.h ?

Regards,
AnMaBaGiMa
Back to top
View user's profile Send private message
jiuhu



Joined: 11 Feb 2010
Posts: 5

PostPosted: Thu Feb 11, 2010 1:36 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
roby65



Joined: 01 Jun 2008
Posts: 55
Location: Mid Italy

PostPosted: Thu Feb 11, 2010 1:41 am    Post subject: Reply with quote

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 :)
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jiuhu



Joined: 11 Feb 2010
Posts: 5

PostPosted: Thu Feb 11, 2010 1:56 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
roby65



Joined: 01 Jun 2008
Posts: 55
Location: Mid Italy

PostPosted: Thu Feb 11, 2010 1:58 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Raiden



Joined: 14 Nov 2009
Posts: 10

PostPosted: Thu Feb 11, 2010 2:12 am    Post subject: Reply with quote

Code:
 if(!(fd = sceIoOpen("device:/path/to/file", O_RDONLY, 0777)) {
        // error
 }

http://psp.jim.sh/pspsdk-doc/group__FileIO.html#g88dc53eaa661c18698ff606859f69ec8
Back to top
View user's profile Send private message
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Feb 11, 2010 5:20 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Thu Feb 11, 2010 6:40 am    Post subject: Reply with quote

What's the error return value? We can't guess it, you'll have to tell us.
Back to top
View user's profile Send private message
Davee



Joined: 22 Jun 2009
Posts: 59

PostPosted: Thu Feb 11, 2010 10:47 am    Post subject: Reply with quote

Raiden wrote:
Code:
 if(!(fd = sceIoOpen("device:/path/to/file", O_RDONLY, 0777)) {
        // error
 }

http://psp.jim.sh/pspsdk-doc/group__FileIO.html#g88dc53eaa661c18698ff606859f69ec8


That's wrong in so many ways...

error is < 0 and there is no "O_RDONLY" defined in the PSP SDK.
Back to top
View user's profile Send private message
jiuhu



Joined: 11 Feb 2010
Posts: 5

PostPosted: Thu Feb 11, 2010 7:07 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Thu Feb 11, 2010 11:09 pm    Post subject: Reply with quote

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
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
jiuhu



Joined: 11 Feb 2010
Posts: 5

PostPosted: Fri Feb 12, 2010 12:01 am    Post subject: Reply with quote

Thanks guys...
I get my sound file loaded, after specifying the host0 for my path...
"host0:sound.mid"
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