You are not logged in.
Hi! I'm making a game based on pokecrystal. So far it's partly a devamp of HGSS, partly an increased difficulty hack, and will eventually work as a base for my own plot set after GSC.
Right now I'm trying to turn Sage Li into Elder Li. Most of the files that need editing are obvious:
* audio/trainer_encounters.asm: Use the table entry after "mysticalman" for "elder" (replace "db MUSIC_HIKER_ENCOUNTER" with "db MUSIC_SAGE_ENCOUNTER").
* constants/trainer_constants.asm: Put "trainerclass ELDER" after "trainerclass MYSTICALMAN" and move "const LI" from "trainerclass SAGE" to it.
* gfx/pics.asm: Put "ElderPic:" right before "SagePic:" so that they both use the same sage.2bpp.lz file. (I'll work on adding a custom pic after the basic trainer function works.)
* gfx/pics/trainer_pic_pointers.asm: Put "add_pic ElderPic" after "add_pic MysticalmanPic".
* gfx/trainers/palette_pointers.asm: Put "ElderPalette:" right before "SagePalette:" so they both use the same sage.pal file.
* maps/SproutTower3F.asm: Change "SAGE, LI" to "ELDER, LI".
(Edit: I also edited these files but forgot to mention them.)
* trainers/attributes.asm: Copy the Sage attributes and paste them after the Mysticalman attributes.
* trainers/dvs.asm: Copy the Sage DVs and paste them after the Mysticalman DVs.
* trainers/trainer_pointers.asm: Put "dw ElderGroup" after "dw MysticalmanGroup".
* trainers/trainers.asm: Put "ElderGroup:" after the one trainer in "MysticalmanGroup:" and move the declaration of Sage Li to it.
* text/trainer_class_names.asm: Put 'db "Elder@"' after 'db "Mystery Man@"'.
(This is really making me appreciate object-oriented programming...)
And here's where I fail. When I try compiling the pokecrystal project after these changes—and before them it worked fine—I get the error message:
rgblink -n pokecrystal.sym -m pokecrystal.map -o pokecrystal.gbc wram.o main.o lib/mobile/main.o home.o audio.o maps.o engine/events.o engine/credits.o data/egg_moves.o data/evos_attacks.o data/pokedex/entries.o misc/crystal_misc.o text/common_text.o gfx/pics.o rgblink: Unable to load fixed ROMX section into bank $4A Makefile:45: recipe for target 'pokecrystal.gbc' failed make: *** [pokecrystal.gbc] Error 1
I know this means that bank $4A contains too much data. But this bank is declared in gfx/pics.asm:
SECTION "Trainer Pic Pointers", ROMX, BANK[TRAINER_PIC_POINTERS] TrainerPicPointers:: INCLUDE "gfx/pics/trainer_pic_pointers.asm"
And all I added to that file is the line "add_pic ElderPic", a macro which adds 3 bytes. In fact, I tried reverting all of these changes and just sticking "db 42; db 42; db 42" after that "INCLUDE" and that was enough to cause the same error. I don't get it—the section declared right before it for the Pokémon sprites contains a lot more pointers, but it doesn't cause any errors:
SECTION "Pic Pointers", ROMX[$4000], BANK[PIC_POINTERS] PicPointers:: INCLUDE "gfx/pics/pic_pointers.asm"
(That's 501 "add_pic" macros for the front and back pics, versus 68 for the trainers.)
Anyway: do I really have to split the trainer sprite pointers into two banks, and edit the GetTrainerPic routine in gfx/load_pics.asm to use the correct one? (Quite a hassle.) Or is there something I can do to fit them all in their current bank, and ideally add a few more? Thanks for any help you can give.
(This isn't the only change I'm making to the Crystal ROM; I've already implemented the Physical/Special split, the Fairy type, the PokéCom Center, and some new maps. But working with ROM banks is still a pain, probably since I'm used to higher-level languages with an OS to handle memory paging.)
Last edited by Rangi (2016-05-13 01:14:52)
SECTION "Trainer Pic Pointers", ROMX, BANK[TRAINER_PIC_POINTERS]
SECTION "Trainer Pic Pointers", ROMX
The BANK part is there so that everything is in the same order as the original rom. If you're making edits it's not necessary.
Alright, that worked! But why did it work? Aren't all the banks the same size? Is the linker finding two contiguous unused banks so that "Trainer Pic Pointers" overflows safely? Or am I wrong, and it's auto-locating a larger bank than the one at $4A?
All banks are the same size. However, more than just that pointer yable was stored in the same bank, so your additions were causing it to fill up. By not declaring a bank, it just put it another bank that still had enough room.
Check them out on Github
Interesting. "grep TRAINER_PIC_POINTERS" and "grep \$4A" only show the "Trainer Pic Pointers" section being placed in that bank, so there must be some other way for data to get stored in it. Anyway, thank you both!
Check them out on Github