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 

ROMFS - ROM File System

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



Joined: 22 Apr 2004
Posts: 230

PostPosted: Thu Apr 20, 2006 11:59 pm    Post subject: ROMFS - ROM File System Reply with quote

Hi,

I wanted to share our work on Romfs,. Gawd has actually initiated the stuff, but I finally releasing it, since he gave me the permission and since I took it over (if I can say) and enhanced it with (what I thought to be) complete I/O routines (providing fio and libc style functions).

So what is it ? Basically, ROMFS allow to emulate a directory, that directory being an binary image in memory. It allows to embed files and external resources directly in the ELF, while keeping the original i/o routines to access them..

The initial project has been started by Jakub Jelinek on linux, then gawd reused it for flashback, and this is how I discovered it. Drakonite also participated in adding functionality, and since the stuff is starting to be relatively mature (IMHO), it's time to share it !

Sources are here : http://psxdev.info/evilo/download/romfs_0100.zip
I tried to respect the ps2sdk structures, as maybe we could add it into the official SDK :

/ps2sdk/ee/fs/romfs/include
/ps2sdk/ee/fs/romfs/src
-> contains romfs routines

/ps2sdk/ee/fs/romfs/regress
-> regression campaign for i/o routines (based on the libc one)

/ps2sdk/ee/fs/samples
-> makefile.romfs sample (to be reused for any new project)

/ps2sdk/ee/fs/tools/genromfs
-> PC (W32/Linux) side tool to generate the binary (.o) from the directory.


You'll find in the regress directory a good example on how to use it, but it just consist on globally respecting the following steps :
- include makefile.romfs into your makefile (and adapt path,... Of course)
- include <romfs_io.h> in your project
- call rioInit() from your main

And you're done !

All calls to fopen, fread, etc.. Are replaced by calls to ropen, rread, ... Thanks to the defines in the makefile (...)
Feel free to comment on how to do this in a cleaner way (I don't think making an IRX would the best solution, even if it would give the access all the "driver" stuff presents on the IOP).


That's it... Hoping that I have been clear, and that it will be usefull to somebody else ;)


Credit : gawd, drakonite, and myself.. !

[EDIT] Updated the licence in the source code (now LGPL 2.0)
Back to top
View user's profile Send private message Visit poster's website
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Fri Apr 21, 2006 12:43 am    Post subject: Reply with quote

Cool work evilo... I imagine it still fails c++ streams and has issues with open/read/close (NOT fopen/fread/fclose.. ) though?

I didn't think I sent my f* redefines to you, but if I did I hope you didn't use them without a lot of testing ;) They were an unsafe hack I did specifically for dave gnukem...

I would disagree with adding it to ps2sdk, especially in the current form;
however after it's been turned into a lib I don't see a problem with tossing it into ps2sdk-ports.

EDIT: GPL code isn't allowed in ps2sdk, so it definitely can't be put there....
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
evilo



Joined: 22 Apr 2004
Posts: 230

PostPosted: Fri Apr 21, 2006 12:57 am    Post subject: Reply with quote

not anymore, check the source, you'll see all the changes. I added streams ( FILE*), corrected lots of stuff, reorganized the whole source, and it's working like a charm :)

it completely pass the libc regression campaign... :)

which hack did you put for duke ? i'd like to know if I would need it with the current version ?
Back to top
View user's profile Send private message Visit poster's website
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Fri Apr 21, 2006 7:43 pm    Post subject: Reply with quote

Er.. you misunderstood me on many different levels ;)

When I said a hack in dave gnukem, I meant the way I redefined f* functions were hacks, but after looking at your code I see you did it on your own which means I never sent you my horribly ugly hacks :P

Looking at the source, I also see you only have fopen/fread/etc defines.. For some functions, there is more than one version... i.e. open and fopen. The only reason I remember this anymore is because dave gnukem used both of them depending what part of the source it was ;)

When I mentioned c++ streams, I was talking about things like ifstream, not file pointers... Not something I'd worry about, except I had to rewrite some code because I ran across it in Dave Gnukem ;)
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
evilo



Joined: 22 Apr 2004
Posts: 230

PostPosted: Thu May 04, 2006 7:08 am    Post subject: Reply with quote

so as discussed, I turned it into a lib, and commited in svn under ps2sdk-port :)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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