gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > appended data

#145455 - pettsu - Thu Nov 15, 2007 7:46 pm

hi, i'm new here so forgive me a little. i'm appending a data file to the .nds file and there's two things i'd like help with:

1. getting the address of the data. i'm guessing NDSHeader.romSize comes into it and i've tried a few values but to no avail

and

2. a cleaner way of appending the data. at the moment i compile the .nds with a makefile from ndslib (using visual c++) then i've got a copy of ndstool and a .bat file which extracts the .nds file and recreates it with my data appended. pretty shabby i know but i've hardly used makefiles and i'm tentative about changing existing ones too much

any help or advice is appreciated, thanks

#145505 - M3d10n - Fri Nov 16, 2007 10:01 pm

LibFAT using the FCSR DLDI driver. Works like a charm on my EZ-Flash 2. U simply did a few changes to the DLDIrc bat files so my build process also rebuilds the appended data.

Do a search for FCSR, there are other threads with details on using it.

#145523 - tepples - Sat Nov 17, 2007 4:35 am

FCSR works on some (most?) SLOT-2 cards. As far as I can tell, it's not designed for SLOT-1 cards.

pettsu: Which flash equipment are you using?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#145564 - pettsu - Sun Nov 18, 2007 4:54 am

ah sorry, i should have said i'm using an r4 (slot 1). i have libfat working well with external file data.

is appended data accessible with slot 1 devices ?

i searched a bit more, but i think i'm out of my depth. i'm only about two weeks into NDS homebrew and i'm just finding out what is and isn't immediately possible.

#145565 - Lazy1 - Sun Nov 18, 2007 5:10 am

Maybe fcsr could be modified to work with images appended to the arm9 binary?
The main problem is that now is that quite a bit of your ram is locked into holding a filesystem.

Why not just read from disc?

Edit #4:
You can just include files directly into your app by renaming them to have a .bin extension and dropping them in your arm9/data folder.

You can access the files like this: (NOTE: From memory, please correct if wrong)

Code:

extern u8 yourfilename_start[ ];
extern int yourfilename_size;

#145567 - tepples - Sun Nov 18, 2007 5:15 am

pettsu wrote:
is appended data accessible with slot 1 devices ?

It is if you use fopen() to open the .nds file.

But this introduces a new problem: How do you find the path of the .nds file that is running? Until flash card menus add support for devkitARM R21's new argv[], the easiest way to do this is probably EFS.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#145573 - pettsu - Sun Nov 18, 2007 6:35 am

i read the "Filesystem idea" thread and it told me a lot of the issues about this.

Lazy1, anything arm9/data/.bin will exist in RAM, i think, which i'll end up doing for small files but eventually i'll have files totalling more than 4MB. (i learnt to access it via #include "file.h", with filename_bin and filename_bin_size being the data address and size)

reading from disc isn't really a problem, i just wanted to know if there were any alternatives.

tepples, thank you. i didn't think to actually open the nds file and just assumed it's contents were already accessible. it's all making more sense to me now though.

thanks to all