ROM Hack How to create an overlay ?

hackotedelaplaqu

Well-Known Member
OP
Member
Joined
Jan 10, 2009
Messages
606
Trophies
1
Website
wiibrew.org
XP
1,196
Country
France
Hi,

For a translation project, I need to create a new overlay.
I know how to edit the overlay table (y9.bin) to add the file but how do I tell the game to load my new overlay in memory on boot ?

I searched the web but din't find anything about this.
Thanks for your help.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
I have never really had cause to investigate overlay loading functions or add new ones for that matter (indeed I would have pegged the annoying part as compiling for the given address) but I will go anyway.

"load my new overlay in memory on boot "
I assume that to mean stick it in memory and branch/jump to it rather than just make sure it is in memory.
You would be doing two things then

1) Figuring out what commands/info to pass the load overlay function or loading the overlay yourself (it is just a file and so able to be catapulted into memory as you would otherwise do things). GBAtek says that the nitro filesystem can load them by ID much it loads other things by filenames, as it should have all the rest of the data in the table you will hopefully only have to pass the ID to the command. Overlays are nothing special as far as the hardware is concerned/it is all a software/compiler arrangement but few things will break from it (basically nothing does an end run around the filesystem).

2) Hooking the code to load it and then jump to it. You know what your overlay does and so you know what point is best to hook -- if it is an intro then the earlier the better really but if it is just modding a few things here and there and never being seen again then it could stand to come a bit later (after IO is set up and such) lest you have to make a full program in your overlay. You could try something complex with interrupts but I would probably opt to just change a command and make that a branch to your overlay or a branch to another portion of the binary that sets up your overlay and then branches to that.

The possible third one is making sure the game returns to the state it left (your overlay gone from memory if it needs to be, the relevant register values/stack popped back in and any overlay that should be there now being there*).

*the ideal would be if you have some free memory/free memory at the time and stuck your overlay there.

I am not too sure where you want to go from here/what you might want elaborated upon so I will stop for now.
 

StorMyu

"I'm way too old for this"
Member
Joined
Jan 2, 2010
Messages
943
Trophies
1
Age
97
XP
1,093
Country
France
Especially since they're just basically bunch of codes so making a function to actually copy paste your own code/file is easier than trying to hook something like this.

So yeah, like FAST said, what do you especially want to do with an overlay because basically... creating one isn't really needed.
 

hackotedelaplaqu

Well-Known Member
OP
Member
Joined
Jan 10, 2009
Messages
606
Trophies
1
Website
wiibrew.org
XP
1,196
Country
France
Thanks both of you.

In my game, there is text in both arm9 and overlays.
With overlays, no problem. I'm writing the excess of translated text at the end of file. Works great.

But with arm9, I can't because just after boot, arm9 from 0x0211D360 until end of file is filed with 00.
I traced back asm and found the guilty opcodes and fixed them. Now the arm9 loaded in ram is ok (full with my text translated) but game crashes later on.

I tried to do the same, but writing my excess text at the end of arm7 instead. In the header, liker most (all ?) games, I can see that the arm7 ram offset is 0x02380000.
It is indeed at boot, but right after, arm7 is erased from 0x02380000 (!!) and I can't find in my dumps (!!)...

I'm just trying to write text (no code). I figured out I could create an overlay and load it in ram, so my text will always be available in the same ram area.
CAPCOM games hate me....
 

StorMyu

"I'm way too old for this"
Member
Joined
Jan 2, 2010
Messages
943
Trophies
1
Age
97
XP
1,093
Country
France
No need to create an overlay then, I basically did this for Tales of Rebirth. I took all the space from the Japanese font (which was quite a lot) to put all of my code / added text.
I'm basically just repointing everything. Same goes for code, everything is just scrambled there since I have all the space needed.
 

StorMyu

"I'm way too old for this"
Member
Joined
Jan 2, 2010
Messages
943
Trophies
1
Age
97
XP
1,093
Country
France
then just find a free place in ram and launch a file there (just need to hook the function that opens the files and uses it, it shouldn't be a long code to add)
 

moonblood666

Well-Known Member
Member
Joined
Feb 24, 2014
Messages
484
Trophies
0
Age
39
XP
1,693
Country
Gambia, The
No need to create an overlay then, I basically did this for Tales of Rebirth. I took all the space from the Japanese font (which was quite a lot) to put all of my code / added text.
I'm basically just repointing everything. Same goes for code, everything is just scrambled there since I have all the space needed.
It's a very old thread, I know, but what exactly did you translate for Rebirth? Did you release it?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtube.com/shorts/WOppJ92RgGU?si=KE79L6A_3jESsGQM