| View previous topic :: View next topic |
| Author |
Message |
daaa57150
Joined: 17 Nov 2006 Posts: 28
|
Posted: Thu Mar 27, 2008 1:26 am Post subject: mounting a drive to a data file |
|
|
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 |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Thu Mar 27, 2008 4:07 am Post subject: |
|
|
| 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 |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
|
| Back to top |
|
 |
daaa57150
Joined: 17 Nov 2006 Posts: 28
|
Posted: Thu Mar 27, 2008 6:17 pm Post subject: |
|
|
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 |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Thu Mar 27, 2008 8:14 pm Post subject: |
|
|
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 |
|
 |
daaa57150
Joined: 17 Nov 2006 Posts: 28
|
Posted: Fri Mar 28, 2008 7:15 pm Post subject: |
|
|
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 |
|
 |
daaa57150
Joined: 17 Nov 2006 Posts: 28
|
Posted: Fri Mar 28, 2008 8:40 pm Post subject: |
|
|
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 |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Sat Mar 29, 2008 2:27 am Post subject: |
|
|
| Let's catch the moment for a little OT: what the heck is going on with http access to SVN?? |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
|
| Back to top |
|
 |
daaa57150
Joined: 17 Nov 2006 Posts: 28
|
Posted: Mon Mar 31, 2008 6:01 pm Post subject: |
|
|
| thanks for the links. |
|
| Back to top |
|
 |
|