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)
ROMFS - ROM File System
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....
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
Makeshift Development
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 ?
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 ?
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 ;)
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
Makeshift Development