Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-03-25 07:00:34

Fotomac
Member
Registered: 2015-10-25
Post 183/286

What not to do when colorizing

So I finally decided to get around to making that full-color version of my hack. The problem is, Cygwin yelled at me for "DrawMapRow". Did I edit something I wasn't supposed to?

Offline

#2 2016-04-02 06:23:23

Fotomac
Member
Registered: 2015-10-25
Post 188/286

Re: What not to do when colorizing

Well, I managed to get past that. But now Cygwin's yelling at me for a completely different reason:

rgbasm -h -o red/audio.o red/audio.asm
rgbasm -h -o red/main.o red/main.asm
ERROR:  red/main.asm(2) -> main.asm(4979) :
        'GFX' not defined
ERROR:  red/main.asm(2) -> main.asm(4979) :
        ROM bank value $0 out of range (1 to $1ff)
ERROR:  red/main.asm(2) -> main.asm(5233) -> scripts/oakslab.asm(969) :
        'OaksLabText32' already defined
H:\cygwin\usr\local\bin\rgbasm.exe: Section 'bank1E' is too big (old size 16384 + 1 > 16384)
Makefile:75: recipe for target 'red/main.o' failed
make: *** [red/main.o] Error 1

EDIT: I was able to fix most of it, leaving only the bank1E problem.

Last edited by Fotomac (2016-04-02 06:25:51)

Offline

#3 2016-04-02 15:25:53

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,282/3,456

Re: What not to do when colorizing

Well, clearly you have too much stuff in bank 1E. Looking at main.asm in your repo, it looks like you should be able to remove the two "nop" commands that aren't actually part of any routine. That would free up 2 bytes, not a lot, but it's something. Also, the fishingrod graphics are in that bank as well. I don't know about the full colour version, but I'm pretty sure that in the normal version, those tiles can be anywhere, so long as they are all kept in the same bank as each other. So you could probably move those out to free up some room in that bank as well.

Offline

#4 2016-04-02 19:03:40

Fotomac
Member
Registered: 2015-10-25
Post 189/286

Re: What not to do when colorizing

The latest error: "Unable to load fixed ROM0 section at $1DDE"

How do I clear up space in bank 0, so I can fix this error?

Offline

#5 2016-04-02 19:13:41

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,283/3,456

Re: What not to do when colorizing

The problem is in this file. Just remove the part in brackets, so it just says ROM0 instead of ROM0[$1DDE], since there probably isn't a reason that it has to be hardcoded to that offset (there usually isn't unless they were just trying to avoid shifting data originally to maintain compatibility with oldschool tools nobody even uses anymore anyway).

I know that in home.asm, there is a section near the top that has to be that way to save space for the header, but most other instances of a hardcoded start offset in the middle of other code like that is just to avoid shifting things or to place it wherever it was in the original rom. Since the colorized patch has been staying up-to-date, there shouldn't be any other hardcoded addresses I would assume, so that section shouldn't have to stay hardcoded to that offset if it is causing problems.

Last edited by Mateo (2016-04-02 19:16:15)

Offline

#6 2016-04-02 19:24:47

Fotomac
Member
Registered: 2015-10-25
Post 190/286

Re: What not to do when colorizing

That took care of that problem, but if it isn't one thing, it's another:

H:\cygwin\usr\local\bin\rgblink.exe: Unable to load fixed ROMX section into bank $03
Makefile:81: recipe for target 'pokered.gbc' failed
make: *** [pokered.gbc] Error 1

Offline

#7 2016-04-06 20:54:17

Fotomac
Member
Registered: 2015-10-25
Post 194/286

Re: What not to do when colorizing

I think I've figured out part of the problem. Apparently, either the additions made for the Brock rematch, the wild Pokémon data rearrangements (including the addition of the wild Mew in Cerulean City as a mythology gag to the Mew glitch), or something else I added into my hack was enough for bank 3 without the additions made for the barebones Full Color Hack. What I don't know is what I can safely move out of bank 3.

Offline

#8 2016-04-06 21:40:13

Danny-E 33
Administrator
Registered: 2012-06-09
Post 945/1,021

Re: What not to do when colorizing

Think about it this way. If code or data exists in some bank other than the home bank, one of two things needs to happen to correctly access that code or data:
1) Either it needs to be accessed by some code that is guaranteed to exist in the same bank or
2) its bank number needs to be referenced by the code that is accessing it, if that code is in another bank.

So in case 1, the code or data that you are trying to safely move to another bank is being referenced by code in the same bank. This means that to safely move it, that code that references it would have to be rewritten to correctly look in the new bank. This is more ugly and more error prone. Try to avoid case 1 if you can.

In case 2, the only thing that references the code or data you are trying to move already references its bank number. This means you can move that code or data to a new bank and there should be no bugs. I say "should" because hopefully the code that is referencing the bank number of what you are trying to move uses BANK().

So in bank 3, lets look at "MapSongBanks:" and "MapHeaderBanks:" which are in data/map_songs.asm and data/map_header_banks.asm and are included at the top of bank 3 in main.asm.

If you search the repository for "MapSongBanks" you will find that it is only referenced in home/overworld.asm. You will also see that home/overworld.asm has the line "ld a, BANK(MapSongBanks)".
This means that you can simply delete "INCLUDE "data/map_songs.asm"" from bank 3 and add that line back in to any other bank, and it should work with no problems and no other changes should be required. The exact same is true for "MapHeaderBanks".

Therefore, you can move both of these data files to another bank to free some space in bank 3 and without causing any new bugs.
The only thing you have to be careful about is, like I said, making sure that the bank is being referenced with BANK().
home/overworld.asm could have said "ld a, 3" instead "ld a, BANK(MapSongBanks)" and it would still compile and result in the same rom because BANK(MapSongBanks) equals 3.
It's possible that there are still some of those static bank numbers scattered throughout the source code, although there are certainly very few of them at most.
As long as bank references are dynamic, by using BANK(), then you don't have to worry about it.

(Note that you might have case 1 and 2 at the same time. It's possible that some code or data is referenced by code in the same bank as well as code from another bank.)


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#9 2016-04-06 21:58:08

Fotomac
Member
Registered: 2015-10-25
Post 195/286

Re: What not to do when colorizing

Now I need to move some stuff from bank 1C. I think it was the process of adding the female player character (I saw "engine/hall_of_fame.asm" and "engine/overworld/player_animations.asm", two of the files Mateo directed hackers to edit for hacks that allow players to choose between playing as a boy and as a girl), but it appears to me that the problem's not over yet. But at least moving those two you mentioned over to bank 9 solved that previous problem.

Last edited by Fotomac (2016-04-06 21:59:23)

Offline

#10 2016-04-06 22:54:50

Danny-E 33
Administrator
Registered: 2012-06-09
Post 946/1,021

Re: What not to do when colorizing

So use the process I described to determine what can safely be moved to another bank hassle-free.


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

#11 2016-04-06 23:29:26

Fotomac
Member
Registered: 2015-10-25
Post 196/286

Re: What not to do when colorizing

Yes, but... that was just regarding ASM files in the data folder. All of the bank 1C includes are ASM files in the engine folder, which I assume is a bit more complicated.

Offline

#12 2016-04-09 00:29:33

Fotomac
Member
Registered: 2015-10-25
Post 197/286

Re: What not to do when colorizing

Apparently, moving just "engine/gamefreak.asm" fixed that problem, but now I have to move something out of "home.asm":

H:\cygwin\usr\local\bin\rgblink.exe: ROM0 section too large
Makefile:81: recipe for target 'pokered.gbc' failed
make: *** [pokered.gbc] Error 1

Offline

Board footer

Powered by FluxBB