libdolfs

From WiiBrew
Jump to: navigation, search

libdolfs
General
Author(s)Hornpipe2
TypeLibrary
Version(initial)
Links
Download
Website
Source

libdolfs is a library for accessing a read-only ramdisk (attached to a .dol at compile-time) as though it were a regular filesystem. It provides a convenient way to include support data with an executable, esp. when porting some code where you don't want to change the underlying core to add an alternative to fread()... or when using psoload without an SD card.

This initial release does not support directory access, but does allow long filenames.

This software is in the public domain.

Usage and Sample Code

It's a lot like using bin2o to add binary data to the executable, but this library uses the Newlib devoptab structs to let you then access the data like any attached filesystem using fopen(), fread(), etc.

Usage:

  • first, build the library for your target system. Edit the makefile in dolfs/libdolfs and uncomment the SYSTARGET line to match your system (gamecube or wii). Run "make" then "make install". The library and include are copied to your libogc/ installation.
  • next you need the tool to make a ramdisk. Run "make" in dolfs/ to build dfspack. Note: this requires a working c++ compiler on your system...
  • Now you can use dfspack to build a ramdisk. Make a directory, fill it with files, then from the directory above:
dfspack <directory> <ramdiskname>
This will put all the files in <directory> into a single file, <ramdiskname>.h
  • #include "<ramdiskname>.h" at the top of your main source file
  • mount the ramdisk with dolfsInit(&<ramdiskname>);
  • read files from the ramdisk by prefix the path with <ramdiskname>: e.g.
FILE *cfgfile = fopen("ramdisk:/config.h","r");

External link

Download and feedback to this tehskeen.com post: [1]