News:

11 March 2016 - Forum Rules

Main Menu

Adding Overlay files for NDS

Started by EoLambda, April 05, 2014, 08:41:45 AM

Previous topic - Next topic

EoLambda

Hello, I'm not sure this is the good section, so excuse me if I'm not in the right place.

I'm hacking a NDS games which probably works like every other : there is two main binary files (arm.7 / arm.9) and some files are loaded in the RAM when needed, the overlays.

My problem is that finding space in the files or the ram is quite hard, due to this architecture.

So I was wondering If it is possible to add my own Overlay file, and how to do it, what are the functions for calling it ?

Thanks in advance.

henke37

An overlay is nothing more than a chunk of code that is being loaded at a fixed address. They are easy to setup if you are using the official sdk. But since you asked here and not on the NDA forums, you obviously don't have that.

There really aren't many editors around for the overlay table. In fact, I don't think that there are any at all!

This should be rather easy to write one yourself if you are able to make use of the overlays to begin with.

EoLambda

Thanks for your answer.

Well, Overlay seems to be just raw data like you said, with maybe some header. My problem is how can I call it during the course of the game and load it into the ram.

If you know how to do it or you have some documentations about it, I'm interested !

FAST6191

I saw a discussion on the matter not so long ago. http://gbatemp.net/threads/how-to-create-an-overlay.348821/ has it though it will say much the same as what I am about to say and what henke37 already said.

Most people editing overlays like this though will be more focused on disabling compression (it is easy enough if you just fiddle with the overlay.bin). As on the link above I have still not had an awful lot of cause to investigate this yet, there is nothing special about overlays as far as the system is concerned so if you can get the data in there and jump/branch accordingly you should be good (or should be good until something branches to what it thinks is the original overlay anyway).

Also if you are looking for free ram then http://gbatemp.net/threads/unofficial-desmume-build-unused-memory-finder-tool.349332/

Going a bit further back an older version of DSATM would add deadbeef padding (floods the ram with deadbeef, anything that still reads deadbeef however far in you need it might well be free). http://filetrip.net/nds-downloads/utilities/download-dsatm-4-3-4-f27609.html has a copy of it.

KC

A safer method would be to allocate the memory using whatever functions the game has for that. My preferred way of getting code into memory is to use a game function to load it as a file, as early as possible. The system state is deterministic, so it will always be at the same position if you do it early enough.
Adding a new overlay wouldn't work, as the game is not aware of it and likely won't reserve the memory it occupies.

EoLambda

#5
Thanks for your answer, my problem is indeed a lack of place due do the nature of the NDS architecture. Most of the files are fixed and you can't simply add your stuff in the endlike in GBA games.

QuoteMy preferred way of getting code into memory is to use a game function to load it as a file

Isn't it the same as loading an overlay into the game in the end ?

My problem is more " how can I load the file at the beginning of the game", is it a NDS function shared for every game or each game has it's own way of loading files ?

I believe I can adding the Overlay by editing the overlay table but then, I still need to load its content in the game once it started.

As for the free RAM tool, it's quite usefull, thanks for the link.

henke37

I think that the overlay system is part of the base system libraries. All games should contain a copy of it.