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 

mounting a drive to a data file

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



Joined: 17 Nov 2006
Posts: 28

PostPosted: Thu Mar 27, 2008 1:26 am    Post subject: mounting a drive to a data file Reply with quote

Hi,

I've searched for a while but haven't found what I need, maybe someone has an answer...
What I'd like to do is mount a virtual drive pointing to a data file (in iso-like format). I need this so I can "pack" my external files for my homebrews in a transparent way: I could then use c++ streams, and oslib load functions, and everything I wrote until now without caring where the file is really stored.
For example, I'd like to pack some images in an iso-like file "images.dat" and mount that file as a drive lets say "vfs0:/". I counld then use oslLoadImageFilePng("vfs0:/image1.png", ...) transparently. I really only need read access.
I'm pretty sure it is possible since we have iso loaders isn't it?

Thanks for anyone who can lead me to a clue.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Thu Mar 27, 2008 4:07 am    Post subject: Reply with quote

I don't really know how to do it, but i feel that adding virtual drives overhead only to avoid writing down a couple of paths and configuration strings doesn't look like a good programming practice... if you want your homebrew in a well looking packed form, why don't you use the zip library?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Thu Mar 27, 2008 5:03 am    Post subject: Reply with quote

You'll find PhysFS here:
http://forums.ps2dev.org/viewtopic.php?t=9120

That's about the closest you'll come to what you want.
Back to top
View user's profile Send private message AIM Address
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Thu Mar 27, 2008 6:17 pm    Post subject: Reply with quote

Thanks for your answers.

jean wrote:
I don't really know how to do it, but i feel that adding virtual drives overhead only to avoid writing down a couple of paths and configuration strings doesn't look like a good programming practice...

If you know how to do it by only writing down a couple of paths and configuration strings I'd really like to see your explanation.
jean wrote:
if you want your homebrew in a well looking packed form, why don't you use the zip library?

I never used the zip library, and I will look at it, but I'm pretty sure it's like every other library like "PhysFS" (thanks J.F. but that's not what I need I think): you have to make calls to an API to get pointers to usually a special FILE structure/class containing your data. And that is what I want to avoid. The thing is, I already wrote many many things (really a LOT), and also I'm using oslib. If I want to be able to use libraries like those, I would have to integrate it at every place where I'm loading files in my actual code, and even in OSLib's code, which would be stupide because I'm using OSLib to avoid dealing with low levels things.
That is the reason I thought about a virtual drive. With this, no need to modify any code I already wrote or OSLib, it will be totally transparent, I'd just need to use the special drive instead of ms0:/.
Jean, as I said maybe I'm totally wrong for the zip library as I never used it, I'll take a look.

So does somebody know how I can do what I want? Or have other ideas?
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Mar 27, 2008 8:14 pm    Post subject: Reply with quote

You just have to implement a filesystem driver using sceIoAddDrv, look at pspiofilemgr_kernel.h, and psplink usbhostfs as an example of a filesystem driver. You don't have to implement every function, just the ones your virtual filesystem will alow (e.g you can skip things you won't use like IoIoctl, IoDevctl, or IoWrite if the filesystem will be read-only).

Just be sure to call sceKernelExtendKernelStack in each driver function (or at least the ones in which you will call some sceIo* funcs) or you will end with a kernel stack overflow.
Back to top
View user's profile Send private message
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Fri Mar 28, 2008 7:15 pm    Post subject: Reply with quote

thanks moonlight, I just hope I'll figure out how that works.
edit: pspiofilemgr_kernel.h does that mean it won't work on slims? or that I'll have to do smth different given the psp version?
Back to top
View user's profile Send private message
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Fri Mar 28, 2008 8:40 pm    Post subject: Reply with quote

sorry to bother you again but can someone please upload the sources of psplink somewhere I can get them by http? I can't connect to the svn here from my work (proxies and evrything) and I won't have internet at home for a while?
thanks.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat Mar 29, 2008 2:27 am    Post subject: Reply with quote

Let's catch the moment for a little OT: what the heck is going on with http access to SVN??
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sat Mar 29, 2008 5:09 am    Post subject: Reply with quote

http://forums.ps2dev.org/viewtopic.php?t=9908
http://forums.ps2dev.org/viewtopic.php?t=9782
Back to top
View user's profile Send private message
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Mon Mar 31, 2008 6:01 pm    Post subject: Reply with quote

thanks for the links.
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