#39249 - brucesinner - Wed Apr 06, 2005 3:10 pm
Does anyone have some directions to give on how do i append data to the end of my binary (.gba) file so that the artists dont need to give me new art and recompile every time they change something ?
Perhaps I can do a tool for that and give it to my artists. The production time would be much more faster.
In time, if i do manage to append the data, how do i access it ?
Thanks for any tips,
Bruce Sinner
#39253 - Lord Graga - Wed Apr 06, 2005 4:11 pm
A simple method would be to pad the ROM (easiest way to determite which adress to read from), and then make a pointer to the end, like this:
Code: |
void* appended_gfx = (void*)0x8008000 //point to image data at end of original ROM. 0x8000000 + size in bytes |
Then make a batch/shell-script, etc, that converts the data that the graphician is using to a binary format, and append it with cat rom.gba binarydata.bin > rom_withdata.gba (if you have the cat command, i.e, unix, linux, cygwin, msys, etc), or copy /b rom.gba + binarydata.bin rom_withdata.gba (for MS-DOS/Windows, don't know if the syntax is correct).
#39263 - brucesinner - Wed Apr 06, 2005 7:02 pm
Pretty thanks for the tip.
But how do I know where the ROM ends ? You said 0x8008000, it is always that value ?
If I want to access for example a sound sample i put after it, i must count all the data before the sample and then put a pointer directly at it ?
thanks again
#39265 - Lord Graga - Wed Apr 06, 2005 8:04 pm
0x8000000 + size of ROM in bytes, I wrote! How would the GBA know how big the ROM was? :)
An example, "to cut it out in cardboard" (as we say in Denmark):
A ROM at the size of 64 kbyte (65536 == 0x10000) would have an end at 0x8000000 + 0x10000 == 0x8010000
A ROM at the size of 8 kbyte (8192 bytes == 0x2000) would have an end at 0x8000000 + 0x2000 == 0x8002000.
A ROM at the size of 54.244 (0xD3E4) bytes would have it's end at 0x8000000 + 0xD3E4 == 0x800D3E4
Get it now?
#39266 - brucesinner - Wed Apr 06, 2005 8:16 pm
Lord Graga wrote: |
Get it now? |
Yes, SIR !!!
You rock!
Thanks again.
#39267 - tepples - Wed Apr 06, 2005 8:38 pm
Just about all the implementation work has been done for you. Check out GBFS.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39405 - Lupin - Fri Apr 08, 2005 2:53 pm
you can also just use an asm file and use .incbin to include all your files... it would look something like this (i forgot to add the section stuff because i dont know how it has to look like):
Code: |
.export mydata
mydata:
.incbin "myfile.bin" |
and in C you do this to include your data:
Code: |
extern u8 mydata[123];
|
That should be pretty much everything you need to do (just add a section header to the ASM file...), the compiler will handle making the label addresses.
_________________
Team Pokeme
My blog and PM ASM tutorials
#39410 - brucesinner - Fri Apr 08, 2005 3:53 pm
Lupin wrote: |
you can also just use an asm file and use .incbin to include all your files... it would look something like this (i forgot to add the section stuff because i dont know how it has to look like):
Code: | .export mydata
mydata:
.incbin "myfile.bin" |
and in C you do this to include your data:
Code: |
extern u8 mydata[123];
|
That should be pretty much everything you need to do (just add a section header to the ASM file...), the compiler will handle making the label addresses. |
but this way i will have to recompile after any data change, right ?
I want to avoid this.
#39634 - Lupin - Sun Apr 10, 2005 11:14 pm
you always have to re-build the ROM in some way...
_________________
Team Pokeme
My blog and PM ASM tutorials
#39639 - wintermute - Mon Apr 11, 2005 12:28 am
Lupin wrote: |
you always have to re-build the ROM in some way... |
Not if you use GBFS[/url]
#39640 - tepples - Mon Apr 11, 2005 12:28 am
But if your artists can rebuild the ROM with just an image converter, a simple archive builder, and copy /b, then they don't have to install the whole GCC and Binutils toolchains on each system. Rebuilding the ROM with less software > rebuilding the ROM with more software.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39642 - poslundc - Mon Apr 11, 2005 12:50 am
Also, rebuilding the ROM != recompiling.
Recompiling can take anywhere from seconds to hours depending on the size of the project.
Linking/data appending is relatively painless.
Dan.
#39657 - brucesinner - Mon Apr 11, 2005 3:18 am
GBFS seems to be the better solution in this case, i gotta check it out!