FE4 portrait insertion/replacement : Need help

Hello!
I wanted to insert a custom portrait into FE4 using this tutorial : FE4 Portrait Inserting Tutorial - Resources - Serenes Forest Forums
I did everything up to step 5 because I had many issues with it.

What I did and the results :

Replacing all of Sigurd's portrait data

I figured I had to do the same thing as the tuto. I copied all of the data from my portrait and pasted it, deleting Sigurd’s remaining bytes in the process. (The one I tried to insert has 505 bytes, less than him)
What happened is that the rom wasn’t even able to load afterwards, maybe because of the loss of some bytes, I don’t know.
I tried the same thing but with adding some zeroes at the end to fill the void (ironic), had the same result.
PS : please forgive me

Replacing some of Sigurd's data

So, same thing, except there was still leftovers. Didn’t work either, Sigurd and Noish turned into MissingNo, lol.

Replacing Noish's data, this time

Because Noish’s portrait has 504 bytes, I thought “hey, mine is only one byte larger, what can go wrong?”
So I replaced it and he, once again, turned into a MissingNo.

TLDR : They either turn into a bunch of pixels or the rom doesn’t load at all.

Well now the thing is that I have no clue how to fix this issue and that one tutorial isn’t really clear about this part either.

Could someone guide me? I’m open to pretty much any suggestion. (or redirecting another post to me or any link that could help would be appreciated, even if it’s just to tell me why this happens)

Thanks in advance!

2 Likes

I think you’re running into two separate problems here.

First off, it is very important when hex editing ROMs to not remove bytes from or add bytes to the ROM. The code in the ROM expects things to be in very specific locations and can break entirely if things are moved around. Generally hex editors will make a distinction between inserting data vs overwriting it - you want to only ever overwrite. (This also means that trying to replace existing data with data that is longer than it is generally a bad idea, because you’ll likely be replacing the start of what ever is stored after it.) I think this is what caused the ROM to not load after your first attempt.

Secondly, some copies of FE4’s ROM have $200 bytes of mostly empty space at the start of them called a header while some do not. So when hex editing, it’s important to know a) whether or not your copy of the ROM has a header and b) if the address you have for the data you want to change expects the header to be there or not.

Now, I happen to know that the addresses for the compressed portrait data that that tutorial provides are for ROMs with the header present. Since your attempt to replace some of Sigurd’s portrait data affected both Sigurd and Noish’s portraits, I think the copy of FE 4 you have doesn’t have a header. That would cause Sigurd’s portrait data to start at $0A65B5, not $0A67B5, and as a result your data replacement would extend partially into Noish’s portrait data if you started from the second address.

My suggestion would be to try replacing Sigurd’s portrait data again, but starting the replacement at $0A65B5 this time.

I think that was my exact problem. It’s true, I have an unheadered rom, as it doesn’t start with empty space.

But does it mean everything is moved by 200 bytes? Just need to be sure.

Anyway, I’d like to thank you. This is very helpful.

1 Like

Yes, everything is moved by 200 bytes compared to the addresses in a headered ROM. And a lot of the existing documentation about FE 4 uses headered ROM addresses, as well as the Nightmare modules for it, so it’s definitely something you’ll need to watch out for in the future if you want to do more of this kind of thing.

And I’m glad I was able to help. :^)

1 Like