Views: 1,610,116 | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search | 11-24-24 02:08 AM |
Guest: |
0 users reading How does romfs work? | 1 bot |
Main - Homebrew discussion - How does romfs work? | Hide post layouts | New reply |
Eclipse2212 |
| ||
Newcomer Normal user Level: 5 Posts: 1/3 EXP: 285 Next: 244 Since: 08-10-16 Last post: 3027 days ago Last view: 3016 days ago |
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 |
| ||
Member Who knows? Level: 19 Posts: 67/70 EXP: 34520 Next: 1257 Since: 05-21-15 From: Germany Last post: 2995 days ago Last view: 2863 days ago |
Example how to use the RomFS here: https://github.com/devkitPro/3ds-examples/tree/master/romfs |
Eclipse2212 |
| ||
Newcomer Normal user Level: 5 Posts: 2/3 EXP: 285 Next: 244 Since: 08-10-16 Last post: 3027 days ago Last view: 3016 days ago |
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 |
| ||
Member Who knows? Level: 19 Posts: 68/70 EXP: 34520 Next: 1257 Since: 05-21-15 From: Germany Last post: 2995 days ago Last view: 2863 days ago |
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 |
| ||
Newcomer Normal user Level: 5 Posts: 3/3 EXP: 285 Next: 244 Since: 08-10-16 Last post: 3027 days ago Last view: 3016 days ago |
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 |
| ||
Member Who knows? Level: 19 Posts: 69/70 EXP: 34520 Next: 1257 Since: 05-21-15 From: Germany Last post: 2995 days ago Last view: 2863 days ago |
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: 28, rows: 75/75, time: 0.005 seconds. Acmlmboard 2.064 (2018-07-20) © 2005-2008 Acmlm, Xkeeper, blackhole89 et al. |