- 3
- Posts
- 1
- Years
- Seen Oct 11, 2023
Hi all,
I've recently gotten into messing around with decomps, and was attempting to add some of the later generation pokemon to my game. However, I started running into the issue while compiling that certain fields in hall_of_fame.c are always a certain value:
Looking at them, they all have to do with comparing the pokemon species to the SPECIES_EGG:
...and so on. My SPECIES_EGG in species.h is set to 519, one more that my last added pokemon. The issue is in struct HallofFameMon, where species has a max value of 511 due to the sizing restriction: u16 species:9;
Bumping this up to u16 species:10; gives seems to make the SaveFile too large:
Code that triggers it:
Does anyone know what I need to change to fix this? It's probably an easy fix, I just couldn't find anything in any of the existing guides. I noticed that pokeemerald-expansion doesn't have this size restriction in struct HallofFameMon, so I'm confused on how that one is able to compile.
Any help is appreciated!
TIA
I've recently gotten into messing around with decomps, and was attempting to add some of the later generation pokemon to my game. However, I started running into the issue while compiling that certain fields in hall_of_fame.c are always a certain value:
Code:
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/hall_of_fame.o src/hall_of_fame.c
agbcc: warnings being treated as errors
src/hall_of_fame.c: In function `Task_Hof_DisplayMon':
src/hall_of_fame.c:583: warning: comparison is always zero due to width of bitfield
src/hall_of_fame.c: In function `Task_HofPC_DrawSpritesPrintText':
src/hall_of_fame.c:929: warning: comparison is always zero due to width of bitfield
src/hall_of_fame.c: In function `Task_HofPC_PrintMonInfo':
src/hall_of_fame.c:978: warning: comparison is always one due to width of bitfield
src/hall_of_fame.c: In function `HallOfFame_PrintMonInfo':
src/hall_of_fame.c:1125: warning: comparison is always one due to width of bitfield
src/hall_of_fame.c:1152: warning: comparison is always zero due to width of bitfield
make: *** [Makefile:338: build/emerald/src/hall_of_fame.o] Error 1
make: *** Deleting file 'build/emerald/src/hall_of_fame.o'
Looking at them, they all have to do with comparing the pokemon species to the SPECIES_EGG:
Code:
if (currMon->species == SPECIES_EGG)
destY += 10;
...and so on. My SPECIES_EGG in species.h is set to 519, one more that my last added pokemon. The issue is in struct HallofFameMon, where species has a max value of 511 due to the sizing restriction: u16 species:9;
Code:
struct HallofFameMon
{
u32 tid;
u32 personality;
[B]u16 species:9;[/B]
u16 lvl:7;
u8 nickname[POKEMON_NAME_LENGTH];
};
Bumping this up to u16 species:10; gives seems to make the SaveFile too large:
Code:
tools/agbcc/bin/agbcc <flags> -o build/emerald/src/save.o src/save.c
src/save.c:78: size of array `SaveBlock2FreeSpace' is negative
make: *** [Makefile:338: build/emerald/src/save.o] Error 1
make: *** Deleting file 'build/emerald/src/save.o'
Code that triggers it:
Code:
// These will produce an error if a save struct is larger than the space
// alloted for it in the flash.
STATIC_ASSERT(sizeof(struct SaveBlock2) <= SECTOR_DATA_SIZE, SaveBlock2FreeSpace);
Does anyone know what I need to change to fix this? It's probably an easy fix, I just couldn't find anything in any of the existing guides. I noticed that pokeemerald-expansion doesn't have this size restriction in struct HallofFameMon, so I'm confused on how that one is able to compile.
Any help is appreciated!
TIA