Views: 1,526,855 Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search 07-25-24 12:25 PM

0 users reading How does romfs work? | 1 bot

Main - Homebrew discussion - How does romfs work? Hide post layouts | New reply

Posted on 08-10-16 08:47 PM Link | #1061

I'm working on an homebrew that require to load a crapload of files, essentially sprites and sound.

I've searched a lot over the Internet, but, I don't understand how to link the files to the code
(I'm using sf2d with sftd and sfil, if it can help.)

I tried several times but the only thing that render is a black screen and my console who hangs (I use a 2Ds xD)

I worked when I was using the data folder, so, I really don't understand why it doesn't work.

I will accept any kind of help, beceause this make me crazy.

Oh, if you want the source code, i can link a compressed file.

Have a nice trap!


Posted on 08-10-16 08:51 PM Link | #1062
Example how to use the RomFS here: https://github.com/devkitPro/3ds-examples/tree/master/romfs

Posted on 08-10-16 08:58 PM Link | #1063
Thanks, already found this example,
Actually, I'm using this to try to make my code work.

It leads me to a "silly" question: when i load the files with sfil, do I have to open the file by myself, or the lib do it by itself?

Posted on 08-10-16 09:29 PM Link | #1064
I'm not familiar with that lib. If it is not hardcoded to sdmc:/ and uses fopen and friends you can just pass romfs:/ paths.

Posted on 08-10-16 09:46 PM (rev. 4 of 08-10-16 10:14 PM) Link | #1065
Okay, gonna search in the lib project



Found on png.c in the sfil project:
sf2d_texture *sfil_load_PNG_file(const char *filename, sf2d_place place)
png_byte pngsig[PNG_SIGSIZE];
FILE *fp;

if ((fp = fopen(filename, "rb")) == NULL) {
goto exit_error;

if (fread(pngsig, 1, PNG_SIGSIZE, fp) != PNG_SIGSIZE) {
goto exit_close;

if (png_sig_cmp(pngsig, 0, PNG_SIGSIZE) != 0) {
goto exit_close;

sf2d_texture *texture = _sfil_load_PNG_generic((void *)fp, _sfil_read_png_file_fn, place);
return texture;

return NULL;

So, the Lib open the file as "read binary", so the erroro come from the path of the files?

I declared the load like this:
sf2d_texture *Act0 = sfil_load_PNG_file("romfs:/tex/spr_actbt_center_0.png", SF2D_PLACE_RAM);

Is this Ok?

(Sorry to bother you so much)


Oh, the files weren't at the good place

Posted on 08-10-16 10:17 PM Link | #1066
So yes, the lib should deal fine with files from RomFS. Now you just must make sure the files are actually in the RomFS and at the right location.

Main - Homebrew discussion - How does romfs work? Hide post layouts | New reply

Page rendered in 0.014 seconds. (2048KB of memory used)
MySQL - queries: 26, rows: 73/73, time: 0.007 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.