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.

Coding > Storage of large arrays

#141785 - QuantumDoja - Sat Sep 29, 2007 11:44 pm

Hi, it's been a while since my last post!

I have some HUGE levels that I store in arrays and have ran into a problem where I can only have one level in the game, as If I add another level, and try to run the first level, it wont load and the screen gets some corruption, so I am assuming I am overwriting some memory.

Has anyone got an ideas or suggestions on how to get around this?

My first thoughts are store the arrays in a compressed format and then when its ready to load run a function on it to expand the array into memory big enough for 1 level....but again if I have HUGE levels this may not work...Or have i missed something completely?

Thanks

PS...my maps are like 2400 tiles by 600 tiles - super stupidly huge
_________________
Chris Davis

#141789 - gauauu - Sun Sep 30, 2007 1:07 am

First, make sure that you mark the arrays that hold your level data as const, so they stay on cartridge rom instead of getting loaded into ram.

Second, is your code specifically loading the level data into ram? If so, then you should probably figure out some way of streaming the level data in from the cart in smaller chunks instead of all at once.

As far as compression, depending on what HUGE means, it's probably not a bad idea, but it's not necessarily the automatic solution.

#141804 - Peter - Sun Sep 30, 2007 8:23 am

Maybe you build it as multiboot ROM.
_________________
Kind Regards,
Peter

#141817 - QuantumDoja - Sun Sep 30, 2007 12:01 pm

Hi, thanks for that....How do I compile for multiboot? - or is this default?

Chris
_________________
Chris Davis

#141822 - Peter - Sun Sep 30, 2007 1:43 pm

QuantumDoja wrote:
Hi, thanks for that....How do I compile for multiboot? - or is this default?

How do I build a ROM image that will be multiboot (MBV2,etc) compatible?
_________________
Kind Regards,
Peter

#141824 - tepples - Sun Sep 30, 2007 3:45 pm

The int __gba_multiboot; that Peter's link mentions is for the (obsolete) DevKit Advance.

With devkitARM, you switch between ROM and RAM (multiboot) builds by using a different specs file. If you're using wintermute's GBA project template ($DEVKITPRO/examples/gba/template), change the TARGET from $(shell basename $(CURDIR)) to $(shell basename $(CURDIR))_mb, which triggers a specs change in gba_rules. Otherwise, open your project's makefile and change -specs=gba_specs to -specs=gba_mb.specs.

And yes, it appears that the template is multiboot. If you want to switch from multiboot to a ROM build, remove the _mb.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.