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)
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
OBJ_DIR := build/emerald
LIBPATH := -L ../../tools/agbcc/lib
else
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
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))"

View File

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

View File

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

View File

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

View File

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

View File

@ -1295,22 +1295,19 @@ static bool8 GetAvailableObjectEventId(u16 localId, u8 mapNum, u8 mapGroup, u8 *
{
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)
return TRUE;
}
if (i >= OBJECT_EVENTS_COUNT)
return TRUE;
*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)
return TRUE;
i++;
} while (i < OBJECT_EVENTS_COUNT);
}
return FALSE;
}

View File

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

View File

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