4dsdev
Views: 1,610,745 Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search 11-27-24 06:46 AM
Guest:

0 users reading How does romfs work? | 1 bot

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


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

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!


Eclipse2212.

profi200
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

Eclipse2212
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?

profi200
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.

Eclipse2212
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

EDIT:

Hmmm...

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);
fclose(fp);
return texture;

exit_close:
fclose(fp);
exit_error:
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)


EDIT 2:

Oh, the files weren't at the good place

profi200
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.012 seconds. (2048KB of memory used)
MySQL - queries: 26, rows: 73/73, time: 0.005 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.