Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to generate compile_commands.json #650

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CompileFlags:
Remove: [-mthumb-interwork, -fhex-asm]
Add: [-mcpu=arm7tdmi, -Itools/agbcc/include, -iquoteinclude, -D__INTELLISENSE__, -DFIRERED, -DREVISION=0, -DENGLISH, -DMODERN=0, -Wno-deprecated-non-prototype, -Wno-unknown-escape-sequence, -Wno-pointer-sign, -Wno-constant-conversion, -Wno-gnu-folding-constant]
Compiler: /usr/bin/arm-none-eabi-gcc
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ prefabs.json
.vscode/*.*
*.js
*.sym
.cache
compile_commands.json
7 changes: 7 additions & 0 deletions gen_compile_commands.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

which compiledb || { echo compiledb not found, please install using "pip install compiledb"; exit 1; }

CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ compiledb make
10 changes: 5 additions & 5 deletions graphics_file_rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ $(INTERFACEGFXDIR)/hp_numbers.4bpp: $(INTERFACEGFXDIR)/hp_bar_anim.4bpp \
$(INTERFACEGFXDIR)/numbers2.4bpp
@cat $^ >$@

$(UNUSEDGFXDIR)/redyellowgreen_frame.bin: $(UNUSEDGFXDIR)/red_frame.bin \
$(UNUSEDGFXDIR)/yellow_frame.bin \
$(UNUSEDGFXDIR)/green_frame.bin \
$(UNUSEDGFXDIR)/blank_frame.bin
@cat $^ >$@
# $(UNUSEDGFXDIR)/redyellowgreen_frame.bin: $(UNUSEDGFXDIR)/red_frame.bin \
# $(UNUSEDGFXDIR)/yellow_frame.bin \
# $(UNUSEDGFXDIR)/green_frame.bin \
# $(UNUSEDGFXDIR)/blank_frame.bin
# @cat $^ >$@

$(UNUSEDGFXDIR)/color_frames.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 353 -Wnum_tiles
Expand Down
2 changes: 0 additions & 2 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef GUARD_CONFIG_H
#define GUARD_CONFIG_H

#include "global.h"

// In the Generation 3 games, Asserts were used in various debug builds.
// Ruby/Sapphire and Emerald do not have these asserts while Fire Red
// still has them in the ROM. This is because the developers forgot
Expand Down
2 changes: 1 addition & 1 deletion include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))

#if MODERN
#if MODERN || defined(__INTELLISENSE__)
#define abs(x) (((x) < 0) ? -(x) : (x))
#endif

Expand Down
23 changes: 23 additions & 0 deletions install-devkitpro-pacman
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
if ! [ $(id -u) = 0 ]; then
echo "Need root privilege to install!"
exit 1
fi

# ensure apt is set up to work with https sources
apt-get install apt-transport-https

# Store devkitPro gpg key locally if we don't have it already
if ! [ -f /usr/local/share/keyring/devkitpro-pub.gpg ]; then
mkdir -p /usr/local/share/keyring/
wget -O /usr/local/share/keyring/devkitpro-pub.gpg https://apt.devkitpro.org/devkitpro-pub.gpg
fi

# Add the devkitPro apt repository if we don't have it set up already
if ! [ -f /etc/apt/sources.list.d/devkitpro.list ]; then
echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list
fi

# Finally install devkitPro pacman
apt-get update
apt-get install devkitpro-pacman
2 changes: 1 addition & 1 deletion src/battle_ai_switch_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void AI_TrySwitchOrUseItem(void)
}
for (monToSwitchId = 0; monToSwitchId < PARTY_SIZE; ++monToSwitchId)
{
if ((!GetMonData(&gEnemyParty[monToSwitchId], MON_DATA_HP) == 0)
if ((GetMonData(&gEnemyParty[monToSwitchId], MON_DATA_HP) != 0)
&& (monToSwitchId != gBattlerPartyIndexes[battlerIn1])
&& (monToSwitchId != gBattlerPartyIndexes[battlerIn2])
&& (monToSwitchId != *(gBattleStruct->monToSwitchIntoId + battlerIn1))
Expand Down
2 changes: 1 addition & 1 deletion src/battle_anim_utility_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static void StatsChangeAnimation_Step2(u8 taskId)
}
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
if (sAnimStatsChangeData->data[0] == 1)
if (sAnimStatsChangeData->data[0] == 1)
{
gBattle_BG1_X = 64;
gTasks[taskId].data[1] = -3;
Expand Down
2 changes: 1 addition & 1 deletion src/battle_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ void BufferStringBattle(u16 stringId)

u32 BattleStringExpandPlaceholdersToDisplayedString(const u8 *src)
{
BattleStringExpandPlaceholders(src, gDisplayedStringBattle);
return BattleStringExpandPlaceholders(src, gDisplayedStringBattle);
}

static const u8 *TryGetStatusString(u8 *src)
Expand Down
12 changes: 6 additions & 6 deletions src/menu_indicators.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,15 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
s32 i, j, id = 0;

subsprites[id] = sSubsprite_RedOutline1;
subsprites[id].x = 136;
subsprites[id].y = 136;
subsprites[id].x = -120;
subsprites[id].y = -120;
id++;
subsprites[id] = sSubsprite_RedOutline2;
subsprites[id].x = rowWidth + 128;
subsprites[id].y = 136;
subsprites[id].y = -120;
id++;
subsprites[id] = sSubsprite_RedOutline7;
subsprites[id].x = 136;
subsprites[id].x = -120;
subsprites[id].y = rowHeight + 128;
id++;
subsprites[id] = sSubsprite_RedOutline8;
Expand All @@ -500,7 +500,7 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
{
subsprites[id] = sSubsprite_RedOutline3;
subsprites[id].x = i - 120;
subsprites[id].y = 136;
subsprites[id].y = -120;
id++;

subsprites[id] = sSubsprite_RedOutline6;
Expand All @@ -514,7 +514,7 @@ void ListMenuSetUpRedOutlineCursorSpriteOamTable(u16 rowWidth, u16 rowHeight, st
for (j = 8; j < rowHeight - 8; j += 8)
{
subsprites[id] = sSubsprite_RedOutline4;
subsprites[id].x = 136;
subsprites[id].x = -120;
subsprites[id].y = j - 120;
id++;
subsprites[id] = sSubsprite_RedOutline5;
Expand Down
6 changes: 3 additions & 3 deletions src/metatile_behavior.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ bool8 MetatileBehavior_IsJumpEast(u8 metatileBehavior)
bool8 MetatileBehavior_IsJumpWest(u8 metatileBehavior)
{
if (metatileBehavior == MB_JUMP_WEST)
return TRUE;
else
return FALSE;
return TRUE;
else
return FALSE;
}

bool8 MetatileBehavior_IsJumpNorth(u8 metatileBehavior)
Expand Down
2 changes: 1 addition & 1 deletion src/overworld.c
Original file line number Diff line number Diff line change
Expand Up @@ -3540,7 +3540,7 @@ static void SpriteCB_LinkPlayer(struct Sprite *sprite)
SetObjectSubpriorityByElevation(objEvent->previousElevation, sprite, 1);
sprite->oam.priority = ElevationToPriority(objEvent->previousElevation);

if (!linkPlayerObjEvent->movementMode != MOVEMENT_MODE_FREE)
if (linkPlayerObjEvent->movementMode == MOVEMENT_MODE_FREE)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(linkDirection(objEvent)));
else
StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(linkDirection(objEvent)));
Expand Down