#13390 - RaBBi - Fri Dec 12, 2003 3:15 pm
Hi all ^^
Does someone has managed to use this map editor?
I mean use the exported file format.
I know it's a topic about "graphics" on GBA, but I would like to extend the ask to the fact I'd need to know how to use binary files in GBA projects.
Many map editors export their data to .map files for example.
As a newbie, I use to use .c files (for palette, tiles and map) which are more concrete for me.
With binary files, I didn't know how to "link" them to project and how to "see" their data.
Thank you ^^
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13392 - tepples - Fri Dec 12, 2003 4:18 pm
One way to use binary files in a GBA program is through an appended read-only file system such as GBFS.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#13393 - RaBBi - Fri Dec 12, 2003 4:38 pm
Yeah, thanks, I already got an example of using your GBFS ^^
(exactly with Lua script files)
But, generally, did we must know how the data in the binary file is structured?
What did we must know in fact?
I saw a tool that converts binary to .c but I don't figure out that it works to produce that.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13394 - tepples - Fri Dec 12, 2003 5:01 pm
Yes, you must know how the binary file is structured in order to be able to read it. But usually, export tools will output tiles in one specific format designed to be dma_memcpy()'d directly to VRAM. You might have to read the export documentation to see if it outputs maps linearly (one line of 256 tiles, the next line of 256 tiles, etc) or sorted by pages (one page of 32x32 tiles, the next page of 32x32 tiles, etc).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#13395 - cosmic4z - Fri Dec 12, 2003 5:15 pm
Hi Rabbi,
All the file formats use by Level Mapper can be found here:
http://www.gbatools.com/docs_levelmapper/fileformats.htm
You will most likely be interested in the .TS and .MAP formats.
The Tile Grabber component of Level Mapper can be configured to output different parts (bitmap, palette, bank number, optional metamap etc) of a tileset to raw binary file.
Using binary data for you game projects is pretty standard stuff and there are a few ways you can get the binary data in your project.
I never used GBFS ... I use something simular (I call 'file system') that I developed for the purpose of including binary data in GBA projects.
If there is enough interest ... I'll make this tool available to hobby GBA developers soon.
Good luck with your game dev RaBBi :)
Jamie
www.GBAtools.com
#13396 - cosmic4z - Fri Dec 12, 2003 5:17 pm
RaBBi ...
Please let me know if you have any other problems using Level Mapper output. Or indeed any other probs with it.
Feedback is also very welcome ;)
Jamie
#13397 - RaBBi - Fri Dec 12, 2003 5:26 pm
ok thanks ^^
[edit: this post was initially to tepples, I wrote while comicz too ^^ so I thank both]
I read this page about file formats used by this soft :
http://www.gbatools.com/docs_levelmapper/fileformats.htm
And I understand better how I can work when I know the data sequence of a file.
Be sure I'll explore much more their formats ^^
But, generally in the case someone don't use GBFS for example, how can he input/include a binary to C code to read it?
And do you think a tool like bin2c will convert the binaries into values and arrays like they're structured and typed in the header of the file for example?
Thank you
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13398 - RaBBi - Fri Dec 12, 2003 5:33 pm
cosmic4z wrote: |
If there is enough interest ... I'll make this tool available to hobby GBA developers soon.
|
Sure I'll be interested in that ^^
This is not to put aside GBFS, I didn't use it yet, but I like to have several solutions to choose the one which to my problematic.
So I think that use tools from a same source (levelmapper and gbatools'FS) would be a sure choice.
But are there any other ways than a "File System" ?
(sorry I'm really n00b in that point)
Must we have to own this type of system to manage editors' exported formats?
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13400 - tepples - Fri Dec 12, 2003 6:14 pm
RaBBi wrote: |
But, generally in the case someone don't use GBFS for example, how can he input/include a binary to C code to read it?
And do you think a tool like bin2c will convert the binaries into values and arrays like they're structured and typed in the header of the file for example? |
A file is a stream of bytes. Tools such as b2x will convert a file into an array representing the stream of bytes. You'll have to cast them to the appropriate struct type.
One motivation behind GBFS and appended data is that the artists can work independently of the programmers. You don't get this with binary-to-linkable-object conversion.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#13404 - RaBBi - Fri Dec 12, 2003 7:00 pm
Ok, I thought about exporting tileset into separated raw files (palette, tiles...) then convert them to C with tool like bin2c, and try to load them with HaM.
But I think I will look at GBFS ^^
(highlight me : "raw" means "binary" ?)
EDIT: Wonderful! GBFS is great !
I manage to load a tileset from LevelMapper format (.til) using GBFS with HAM.
In fact, just a part of it, 'cause HaM function needs a parameter that is the size of tiles in 16bits chunks.
And I don't find how and where to know it with the levelMapper format.
So I ask Jamie on how to do that.
Thank you ^^
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13417 - cosmic4z - Sat Dec 13, 2003 12:06 am
Hi RaBBi,
If GBFS works for you, there is no reason not to use it.
It also has an advantage over my 'File System' like Tepples says ... it is useful for artists to create GBA roms with no need to compile.
Although ... my 'File System' does a lot of other very nice things that I think compensate for this. I cannot say too much or compare ... because I have not used GBFS ... only read about it.
With my 'File System' you do need to link in 2 files ... 'objcopy' will convert them from raw binary files to linkable .obj files.
My 'File System' is not likely to be available just yet ... but it will be ... along with some other tools.
So RaBBi ...
What is this 'size of tiles in 16bits chunks' that HaM function needs ?
I am not sure what you are looking for here. Can you explain further so I can help you.
Also RaBBi ... when I say RAW file ... I mean a binary file with no formating and headers etc ... just the raw data.
Jamie
www.GBAtools.com
Last edited by cosmic4z on Sat Dec 13, 2003 12:10 am; edited 1 time in total
#13433 - RaBBi - Sat Dec 13, 2003 12:09 pm
ok Jamie ^^
Don't forget to tell us when your tools will be available ^^
So for this point of "size", the function I use is the following :
Code: |
ham_InitTileset(void * src, u16 size_u16, u8 col_mode, u8 cbb_only_mode)
|
It returns a tile_info_ptr that you can assig to the field ti of a BG struct.
size_u16 : the size of the tiles to be copied into Tile RAM, in number of 16 bits chunks.
First I used gfx2gba for tileset, and it produces arrays I was able to use with this ham function.
Then I used Nessie's Map Editor, and I configured it to produce the same arrays, so it works with Ham too.
But in your file formats documentation, I read :
Quote: |
This is the raw tile bitmap data, in 'GBA ready' format. For 16 colour tile-sets, there are 32 bytes per tile. For 256 colout tile-sets, there are 64 bytes per tile.
|
So I don't manage to have the good "size" of my tiles in 16bits cause I don't know how to know the size of the tileset file.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13438 - cosmic4z - Sat Dec 13, 2003 1:28 pm
Hi RaBBi ...
'GBA ready' ... the tiles can go straight to VRAM ...
size of tiles in 16bit chunks =
for 16 colour tiles :- number_of_tiles * 16
for 256 colour tiles :- number_of_tiles * 32
the number_of_tiles in a tileset (and also colours_per_tile) is specified in the .TS file header.
hope that is useful ... let me know how you get on.
Jamie
www.GBAtools.com
#13439 - RaBBi - Sat Dec 13, 2003 2:09 pm
Thanks Jamie ^^
In fact, I don't use the .TS file but .til and .pal separatly.
So I now have a doubt... .til is the unoptimized tileset, isn't it?
That's the tileset data in.TS file which is optimized, no?
It's recommended to use .ts and .map together for best results, isn't it?
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13443 - cosmic4z - Sat Dec 13, 2003 4:44 pm
Well ...
You need to use the tileset [.TS] file with Level Mapper ...
But ...
To include in your project you can use either ...
The [.TS] file ... OR ... the individual raw data files ... for palette, tile bitmaps, bank numbers (for 16 col tiles).
Then of couse, you can compress them...
Jamie
#13447 - RaBBi - Sat Dec 13, 2003 5:23 pm
oki, the number of tiles is specified in the .TS header, but how can I know this number if I only use .TIL in my code?
Sorry if my question is too stupid, I'm working on a collision detection engine, and my brain is too hot now! ^^
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13469 - cosmic4z - Sun Dec 14, 2003 2:48 am
Hi RaBBi ...
You can use the filesize (length in bytes) of the .TIL file.
Divide that by 32 (for 16 colour tiles) or 64 (for 256 colour tiles).
Depending on the method you use to include binary data files in to your project ... there will be a different way to find the filesize.
My 'File System' lets you query data length for any data item.
GBFS will have something simular (I guess it will).
If you link in as an .OBJ file (first using objcopy in your makefile) ... there are variables set that can be used to determine filesize (have a look in generated mapfile). The variable that is set is determined by the file pathname.
Jamie
#13470 - tepples - Sun Dec 14, 2003 5:17 am
cosmic4z wrote: |
My 'File System' lets you query data length for any data item.
GBFS will have something simular (I guess it will). |
You guessed right.
In the manual for GBFS, tepples wrote: |
const void *gbfs_get_obj(const GBFS_FILE *file, const char *name, u32 *len);
Performs a binary search inside the given file for an object with the given name and returns a pointer to the object. If len is not NULL, gbfs_get_obj() stores the length of the object (in bytes) into the referenced location. |
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#13473 - RaBBi - Sun Dec 14, 2003 11:14 am
Yes, I saw it in the readme of GBFS.
But I don't understand very well the way to use this parameter : u32 * len
and this sentence :
Quote: |
If len is not NULL, gbfs_get_obj() stores the length of the object (in bytes) into the referenced location |
This function returns a pointer so what is the reference location where the length will be stored?
What value do I have to use for len? Any values but NULL?
A last highlight on this point would be a precious help tepples, as I begin to do really cool thing with your GBFS and I didn't imagine it would be so easy ^^
Thank you ^^
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13761 - cosmic4z - Mon Dec 22, 2003 1:45 pm
RaBBi,
I am guessing that you pass to the function (as a parameter) ... the pointer to your u32.
The function will then write to this address.
Maybe you should ask tepples?
_________________
Qwak - www.qwak.co.uk | Forum - www.qwak.co.uk/forum/
#13776 - RaBBi - Mon Dec 22, 2003 6:14 pm
oh!
understood!
I think... ^^
I had not read the sentence in the right sense ^^
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^
#13862 - cosmic4z - Wed Dec 24, 2003 1:44 am
Well ... try it RaBBi ... experiment and find out ... experimentation is always good !!
:)
_________________
Qwak - www.qwak.co.uk | Forum - www.qwak.co.uk/forum/