Help, opening files on UMD

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

Moderators: cheriff, TyRaNiD

Locked
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Help, opening files on UMD

Post by steddy »

Is there a special way to read files from UMD?

I can open the file with either of the following:-

int fd = sceIoOpen("umd0:/UMD_DATA.BIN", O_RDONLY, 0);
int fd = sceIoOpen("disc0:/UMD_DATA.BIN", O_RDONLY, 0);

However, when I try and read the file with:

res = sceIoRead(fd, buf, read_size);

It fails. Is there some special way to Open these files? Anyone done it?

Steddy
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

Sorry, slight change to the above statement.

umd0: Opens the file without error, but won't read.
disc0: Fails on the Open

The error I get on the read with UMD0: is -2147373053.

Does anyone have a clue what that error means? Someone must have tried this and got it working.

Steddy
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

umd0 is a block device
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

Vampire wrote:umd0 is a block device
Emm... not according to this:-

http://forums.ps2dev.org/viewtopic.php?t=1646

The Open command succeeds with the full path to the file in there, so I don't think it can be a block device.

Steddy
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

steddy wrote:The Open command succeeds with the full path to the file in there, so I don't think it can be a block device.
Much to learn, you still have...my old padawan. ;-)
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

[DELETED]
Last edited by Vampire on Thu Jun 02, 2005 8:30 pm, edited 2 times in total.
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

[DELETED]
0xdeadface
Posts: 62
Joined: Tue May 31, 2005 5:11 am

Post by 0xdeadface »

[DELETED]
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

Really... seems a little odd to me. How long is eventually.

I left it going 2 minutes and it still didn't complete the open.

Code: Select all

	/* Now attempt to dump the UMD file passed */
	int fd;

	do {
	      int fd = sceIoOpen(fromfile, O_RDONLY, 0); 
	&#125; while &#40;fd<0&#41;;
Steddy
tomt
Posts: 12
Joined: Mon May 23, 2005 8:36 pm

Post by tomt »

steddy wrote:Really... seems a little odd to me. How long is eventually.

I left it going 2 minutes and it still didn't complete the open.

Code: Select all

	/* Now attempt to dump the UMD file passed */
	int fd;

	do &#123;
	      int fd = sceIoOpen&#40;fromfile, O_RDONLY, 0&#41;; 
	&#125; while &#40;fd<0&#41;;
Steddy
could you actually read from it then or does that just make the ioopen succeed?

if it is dma then you probably need to register a callback which is called with the address of the data when it arrives..
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

No it doesn't work, it always returns an error.

None of the File IO on the PSP requires callbacks. This is just a snippit of code, you use sceIoRead to actually get the data.

Steddy
0xdeadface
Posts: 62
Joined: Tue May 31, 2005 5:11 am

Post by 0xdeadface »

No, I didn't try a read...and the delay was only a few seconds.

I started with the UMD already in there by the way....might matter?

I'll try some more :)

0xdf
0xdeadface
Posts: 62
Joined: Tue May 31, 2005 5:11 am

Post by 0xdeadface »

Steddy,
There's an error in your code.

You redefine fd inside the while loop again, so the value you check as termination is the one defined outside the loop....that one will never change.
Remove the 'int' from the inner loop :)

0xdf
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

Thanks for offering to try it.

I also haven't got to the read, that above loop never exits.

I boot the device with the Wipeout UMD inserted, then run the code. I have tried ejecting and reinserting also.

I doubt that code running from the UMD needs to do anything special, since its already on the UMD so it must be open. Sony may have made it so the disk needs unlocking in some way when running from another location.

Steddy
0xdeadface
Posts: 62
Joined: Tue May 31, 2005 5:11 am

Post by 0xdeadface »

We posted at the same time...I hope you didn't miss message I posted just above yours.

0xdf
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

0xdeadface wrote:Steddy,
There's an error in your code.

You redefine fd inside the while loop again, so the value you check as termination is the one defined outside the loop....that one will never change.
Remove the 'int' from the inner loop :)

0xdf
I really thought you had it then and I was being really dumb. I introduced that error when I put the delay in, it wasn't there before.

I changed it to this:-

Code: Select all

	int fd;

	do &#123;
	      fd = sceIoOpen&#40;fromfile, O_RDONLY, 0&#41;; 
	&#125; while &#40;fd<0&#41;;
It still fails :( What the heck is going on.

I am wondering if it doesn't like the '_' in the file name. Mine is a JAP PSP and I wonder if it should be encoded differently.

Steddy
0xdeadface
Posts: 62
Joined: Tue May 31, 2005 5:11 am

Post by 0xdeadface »

I guess most of us use a JAP PSP..as the others have no 1.0?

But I tried opening the same file as you and it did pass. I did try it on RR USA btw.

Weird :\

0xdf
0xdeadface
Posts: 62
Joined: Tue May 31, 2005 5:11 am

Post by 0xdeadface »

Okay...

I did have other code in the while to display the result so I could see it change. Because my output macro by default waits for the VBlank, I think that made it work. With the loop as posted above it indeed does not...thread starvation?

However, if you insert a sceDisplayWaitVblankStart() in the while loop.....any better?

0xdf
steddy
Posts: 139
Joined: Mon Apr 04, 2005 3:53 am

Post by steddy »

Code: Select all

	do &#123;
	      fd = sceIoOpen&#40;fromfile, O_RDONLY, 0&#41;; 
		sceDisplayWaitVblankStart&#40;&#41;;
	&#125; while &#40;fd<0&#41;;
Still the same :(
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

As per this ongoing discussion, I'm afraid we can't have threads showing folks how to dump their UMDs.

Vampire I'm a bit surprised you would post that even after the discussion.

steddy if you want to know how to get files off of UMD, you're going to have to find out on your own or somewhere else.

Locked.
Locked