Share This Page

So right now the only way I've seen on the 3ds to include the resources inside a binary is to turn then into arrays (using bin2cpp or similars). This has several problems like taking a lot of memory and being hard to maintain as the project grows

The current solution seems to be placing the files into a folder on the SD and then read from there. That's better and seems to work perfect for .3dsx (because the 3dsx must be placed in a specific directory for the homebrew launcher to list it). But for .3ds and .cias it is very annoying having to copy some files to the SD and the install the game from the microSD (on the gateway)

Isn't there anything like nitrofs for the DS?

Or just the address to place the resource file system will be enought (we could use zlib for example to read from a zip file)

Someone here appends a zip file at the end of the 3dshttp://4dsdev.org/thread.php?pid=79
problem is, how do I get the address of the zip file... and isn't that loaded into memory?

Click to expand...

The easy way is to append the zip file, then append the size of the zip file. That way you can simply seek to the end, read the int containing the size, then seek back that number of bytes + 4 for the int.
No it obviously doesn't load the entire ROM into memory ROMs are normally much larger than the RAM of the 3DS can hold.
The best solution would be using RomFS, they can be generated but I don't know if there's anything in ctrulib to read them.

The easy way is to append the zip file, then append the size of the zip file. That way you can simply seek to the end, read the int containing the size, then seek back that number of bytes + 4 for the int.
No it obviously doesn't load the entire ROM into memory ROMs are normally much larger than the RAM of the 3DS can hold.
The best solution would be using RomFS, they can be generated but I don't know if there's anything in ctrulib to read them.

Click to expand...

I think that the problem is that makerom doesn't handle ROMFS properly.

The easy way is to append the zip file, then append the size of the zip file. That way you can simply seek to the end, read the int containing the size, then seek back that number of bytes + 4 for the int.

Click to expand...

The problem is that the 3ds is placed inside the micro SD on the Flashcard. I don't know if there is a way to access it so I can search for the .3ds that has been loaded and then locate the .zip inside.
But the approach you are suggesting is interesting.

The problem is that the 3ds is placed inside the micro SD on the Flashcard. I don't know if there is a way to access it so I can search for the .3ds that has been loaded and then locate the .zip inside.
But the approach you are suggesting is interesting.

Click to expand...

Yeah, you're right, that might be a problem. I didn't think of that.

There's definitely a way, since the 3DS loads the game as normal, not sure if it can be read like a regular cartridge though but it's worth a try.
Edit: SaveDataFiler seems able to read the cart like normal (apart from saves) so I think that should work.

So, after reading the documentation here http://3dbrew.org/wiki/FS:OpenFile I found that actually the functions for accessing the romfs are already implemented on libctru (services/fs.h)
I have created a very simple romfs with 3 files just to see if I can get access to it ( I have tried using -romfs with makerom and also using the field HostRoot inside the .rsf)
The code is very simple:

But no matter what I try I am always getting 0xE0E046BE (EINVAL) when FSUSER_OpenFileDirectly is called
Could anyone give me a hand here? If we can make this work we could even implement a devoptab for romfs and access it using stdio functions

So, after reading the documentation here http://3dbrew.org/wiki/FS:OpenFile I found that actually the functions for accessing the romfs are already implemented on libctru (services/fs.h)
I have created a very simple romfs with 3 files just to see if I can get access to it ( I have tried using -romfs with makerom and also using the field HostRoot inside the .rsf)
The code is very simple:

But no matter what I try I am always getting 0xE0E046BE (EINVAL) when FSUSER_OpenFileDirectly is called
Could anyone give me a hand here? If we can make this work we could even implement a devoptab for romfs and access it using stdio functions

Click to expand...

PATH_BINARY looks wrong. Shouldn't it be PATH_CHAR with a length of 21?