Convert to -g; will be required for eliminating fakematches.

This commit is contained in:
Kaz 2020-09-16 19:27:55 -04:00
parent 327dd877b5
commit 171154a097
8 changed files with 24 additions and 42 deletions

View File

@ -63,13 +63,13 @@ ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN)
ifeq ($(MODERN),0) ifeq ($(MODERN),0)
CC1 := tools/agbcc/bin/agbcc$(EXE) CC1 := tools/agbcc/bin/agbcc$(EXE)
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g
ROM := pokeemerald.gba ROM := pokeemerald.gba
OBJ_DIR := build/emerald OBJ_DIR := build/emerald
LIBPATH := -L ../../tools/agbcc/lib LIBPATH := -L ../../tools/agbcc/lib
else else
CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mcpu=arm7tdmi -fno-toplevel-reorder -Wno-pointer-to-int-cast override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mcpu=arm7tdmi -fno-toplevel-reorder -Wno-pointer-to-int-cast -g
ROM := pokeemerald_modern.gba ROM := pokeemerald_modern.gba
OBJ_DIR := build/modern OBJ_DIR := build/modern
LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))" LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))"

View File

@ -2288,8 +2288,7 @@ static const u8* TryGetStatusString(u8 *src)
statusPtr = status; statusPtr = status;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
if (*src == EOS) if (*src == EOS) break; // one line required to match -g
break;
*statusPtr = *src; *statusPtr = *src;
src++; src++;
statusPtr++; statusPtr++;

View File

@ -5035,14 +5035,9 @@ static void Cmd_openpartyscreen(void)
hitmarkerFaintBits = gHitMarker >> 0x1C; hitmarkerFaintBits = gHitMarker >> 0x1C;
gBattlerFainted = 0; gBattlerFainted = 0;
while (1) while (!(gBitTable[gBattlerFainted] & hitmarkerFaintBits)
{ && gBattlerFainted < gBattlersCount)
if (gBitTable[gBattlerFainted] & hitmarkerFaintBits)
break;
if (gBattlerFainted >= gBattlersCount)
break;
gBattlerFainted++; gBattlerFainted++;
}
if (gBattlerFainted == gBattlersCount) if (gBattlerFainted == gBattlersCount)
gBattlescriptCurrInstr = jumpPtr; gBattlescriptCurrInstr = jumpPtr;

View File

@ -1565,8 +1565,7 @@ static s32 TrainerIdToRematchTableId(const struct RematchTrainer *table, u16 tra
{ {
for (j = 0; j < REMATCHES_COUNT; j++) for (j = 0; j < REMATCHES_COUNT; j++)
{ {
if (table[i].trainerIds[j] == 0) if (table[i].trainerIds[j] == 0) break; // one line required to match -g
break;
if (table[i].trainerIds[j] == trainerId) if (table[i].trainerIds[j] == trainerId)
return i; return i;
} }

View File

@ -202,7 +202,7 @@ struct BerryCrushGame
static void VBlankCB(void); static void VBlankCB(void);
static void MainCB(void); static void MainCB(void);
static void MainTask(u8); static void MainTask(u8);
static void InitGame(struct BerryCrushGame *); static void ParseName_Options(struct BerryCrushGame *);
void sub_8022BEC(u16, u8, u8 *); void sub_8022BEC(u16, u8, u8 *);
static void BerryCrush_SetPaletteFadeParams(u8 *, bool8, u32, s8, u8, u8, u16); static void BerryCrush_SetPaletteFadeParams(u8 *, bool8, u32, s8, u8, u8, u16);
static int sub_8021450(struct BerryCrushGame *); static int sub_8021450(struct BerryCrushGame *);
@ -880,7 +880,7 @@ void StartBerryCrush(MainCallback callback)
gBerryCrushGame->unk0 = callback; gBerryCrushGame->unk0 = callback;
gBerryCrushGame->unk8 = multiplayerId; gBerryCrushGame->unk8 = multiplayerId;
gBerryCrushGame->unk9 = playerCount; gBerryCrushGame->unk9 = playerCount;
InitGame(gBerryCrushGame); ParseName_Options(gBerryCrushGame);
gBerryCrushGame->unk12 = 1; gBerryCrushGame->unk12 = 1;
gBerryCrushGame->unkE = 1; gBerryCrushGame->unkE = 1;
gBerryCrushGame->unkF = 6; gBerryCrushGame->unkF = 6;
@ -907,23 +907,23 @@ static void GetBerryFromBag(void)
SetMainCallback2(MainCB); SetMainCallback2(MainCB);
} }
static void InitMainTask(void) static void BerryCrush_SetupMainTask(void)
{ {
DestroyTask(gBerryCrushGame->mainTask); DestroyTask(gBerryCrushGame->mainTask);
ChooseBerryForMachine(GetBerryFromBag); ChooseBerryForMachine(GetBerryFromBag);
} }
static void SetVBlankCB(void) static void BerryCrush_SetVBlankCB(void)
{ {
SetVBlankCallback(VBlankCB); SetVBlankCallback(VBlankCB);
} }
static void InitVBlankCB(void) static void BerryCrush_InitVBlankCB(void)
{ {
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
} }
static void SaveResults(void) static void BerryCrush_SaveResults(void)
{ {
u32 var0, var1; u32 var0, var1;
@ -1002,7 +1002,7 @@ static void MainTask(u8 taskId)
+ offsetof(struct BerryCrushGame_68_x, unk30) \ + offsetof(struct BerryCrushGame_68_x, unk30) \
+ sizeof(struct BerryCrushGame_Player) * (i)) + sizeof(struct BerryCrushGame_Player) * (i))
static void InitGame(struct BerryCrushGame *arg0) static void ParseName_Options(struct BerryCrushGame *arg0)
{ {
u8 i = 0; u8 i = 0;
@ -1028,7 +1028,7 @@ static void InitGame(struct BerryCrushGame *arg0)
} }
} }
// TODO: Everything from here on is likely in a separate file. // TODO: Everything from here on is likely in separate files.
s32 InitBerryCrushDisplay(void) s32 InitBerryCrushDisplay(void)
{ {
struct BerryCrushGame *game = GetBerryCrushGame(); struct BerryCrushGame *game = GetBerryCrushGame();
@ -1118,7 +1118,7 @@ s32 InitBerryCrushDisplay(void)
ShowBg(2); ShowBg(2);
ShowBg(3); ShowBg(3);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
SetVBlankCB(); BerryCrush_SetVBlankCB();
game->unkC = 0; game->unkC = 0;
return 1; return 1;
} }
@ -2155,7 +2155,7 @@ static u32 sub_8022EAC(struct BerryCrushGame *r4, u8 *r5)
static u32 sub_8022F04(struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1) static u32 sub_8022F04(struct BerryCrushGame *r0, __attribute__((unused)) u8 *r1)
{ {
r0->unk4 = NULL; r0->unk4 = NULL;
SetMainCallback2(InitMainTask); SetMainCallback2(BerryCrush_SetupMainTask);
return 0; return 0;
} }
@ -2942,7 +2942,7 @@ static u32 sub_8023CAC(struct BerryCrushGame *r7, __attribute__((unused)) u8 *r1
r7->unk10 = 0; r7->unk10 = 0;
break; break;
case 7: case 7:
SaveResults(); BerryCrush_SaveResults();
sub_8022BEC(18, 1, NULL); sub_8022BEC(18, 1, NULL);
r7->unk12 = 11; r7->unk12 = 11;
r7->unkC = 0; r7->unkC = 0;

View File

@ -1295,22 +1295,19 @@ static bool8 GetAvailableObjectEventId(u16 localId, u8 mapNum, u8 mapGroup, u8 *
{ {
u8 i = 0; u8 i = 0;
for (i = 0; i < OBJECT_EVENTS_COUNT; i++) for (i = 0; i < OBJECT_EVENTS_COUNT && gObjectEvents[i].active; i++)
{ {
if (!gObjectEvents[i].active)
break;
if (gObjectEvents[i].localId == localId && gObjectEvents[i].mapNum == mapNum && gObjectEvents[i].mapGroup == mapGroup) if (gObjectEvents[i].localId == localId && gObjectEvents[i].mapNum == mapNum && gObjectEvents[i].mapGroup == mapGroup)
return TRUE; return TRUE;
} }
if (i >= OBJECT_EVENTS_COUNT) if (i >= OBJECT_EVENTS_COUNT)
return TRUE; return TRUE;
*objectEventId = i; *objectEventId = i;
do for (; i < OBJECT_EVENTS_COUNT; i++)
{ {
if (gObjectEvents[i].active && gObjectEvents[i].localId == localId && gObjectEvents[i].mapNum == mapNum && gObjectEvents[i].mapGroup == mapGroup) if (gObjectEvents[i].active && gObjectEvents[i].localId == localId && gObjectEvents[i].mapNum == mapNum && gObjectEvents[i].mapGroup == mapGroup)
return TRUE; return TRUE;
i++; }
} while (i < OBJECT_EVENTS_COUNT);
return FALSE; return FALSE;
} }

View File

@ -228,8 +228,7 @@ bool8 SetUpFieldMove_Cut(void)
tileCuttable = TRUE; tileCuttable = TRUE;
for (j = 0; j < 2; ++j) { for (j = 0; j < 2; ++j) {
if (sHyperCutStruct[i].unk2[j] == 0) if (sHyperCutStruct[i].unk2[j] == 0) break; // one line required to match -g
break;
if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE) if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE)
{ {
tileCuttable = FALSE; tileCuttable = FALSE;

View File

@ -1100,16 +1100,9 @@ const u8 *MatchCall_GetOverrideFlavorText(u32 idx, u32 offset)
{ {
if (sCheckPageOverrides[i].idx == idx) if (sCheckPageOverrides[i].idx == idx)
{ {
while (1) for (; i + 1 < ARRAY_COUNT(sCheckPageOverrides) &&
{ sCheckPageOverrides[i + 1].idx == idx &&
if (i + 1 >= ARRAY_COUNT(sCheckPageOverrides)) FlagGet(sCheckPageOverrides[i + 1].flag); i++);
break;
if (sCheckPageOverrides[i + 1].idx != idx)
break;
if (!FlagGet(sCheckPageOverrides[i + 1].flag))
break;
i++;
}
return sCheckPageOverrides[i].flavorTexts[offset]; return sCheckPageOverrides[i].flavorTexts[offset];
} }
} }