summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@users.noreply.github.com>2020-04-12 10:12:37 -0400
committerGitHub <noreply@github.com>2020-04-12 10:12:37 -0400
commit6001e107993d1da69decdf479abf8a661ad57dda (patch)
tree9a430f0b70e0a24965378724f1bd28cd1a193dc1 /include
parent2880cf2a51ea36fa36f00d9ecf07177e5955c882 (diff)
parent7a562d6bae78fd7c62ed2f804fd8dcc555d85d18 (diff)
Merge pull request #321 from PikalaxALT/modern_gcc
Get pokefirered_modern to build
Diffstat (limited to 'include')
-rw-r--r--include/battle.h1
-rw-r--r--include/berry.h6
-rw-r--r--include/berry_crush.h176
-rw-r--r--include/bg.h2
-rw-r--r--include/config.h12
-rw-r--r--include/dma3.h26
-rw-r--r--include/field_specials.h2
-rw-r--r--include/fieldmap.h6
-rw-r--r--include/gba/defines.h6
-rw-r--r--include/gba/isagbprint.h5
-rw-r--r--include/global.h4
-rw-r--r--include/item_pc.h4
-rw-r--r--include/math_util.h12
-rw-r--r--include/menu_helpers.h2
-rw-r--r--include/mon_markings.h2
-rw-r--r--include/overworld.h10
-rw-r--r--include/pokemon_storage_system_internal.h4
-rw-r--r--include/save.h2
-rw-r--r--include/strings.h18
-rw-r--r--include/task.h2
-rw-r--r--include/util.h4
-rw-r--r--include/vs_seeker.h2
-rw-r--r--include/window.h10
23 files changed, 199 insertions, 119 deletions
diff --git a/include/battle.h b/include/battle.h
index aac94da7b..43f4c5115 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -1,6 +1,7 @@
#ifndef GUARD_BATTLE_H
#define GUARD_BATTLE_H
+#include <limits.h>
#include "global.h"
#include "constants/battle.h"
#include "battle_util.h"
diff --git a/include/berry.h b/include/berry.h
index 905ce291b..ec0caf11b 100644
--- a/include/berry.h
+++ b/include/berry.h
@@ -67,11 +67,11 @@ const struct Berry * GetBerryInfo(u8 berryIdx);
extern const struct Berry gBerries[];
-struct UnkStruct_0858AB24 {
+struct BerryCrushStats {
u8 unk0;
- u16 unk1;
+ u16 powder;
};
-extern const struct UnkStruct_0858AB24 gUnknown_83DFC9C[];
+extern const struct BerryCrushStats gBerryCrushStats[];
#endif // GUARD_BERRY_H
diff --git a/include/berry_crush.h b/include/berry_crush.h
index 9077b966e..999fb59f3 100644
--- a/include/berry_crush.h
+++ b/include/berry_crush.h
@@ -1,9 +1,49 @@
#ifndef GUARD_BERRY_CRUSH_H
#define GUARD_BERRY_CRUSH_H
+enum {
+ BCTEXT_AREYOUREADY,
+ BCTEXT_WAITFOROTHERS,
+ BCTEXT_GAINEDPOWDER,
+ BCTEXT_RECORDINGRESULTS,
+ BCTEXT_ASKPLAYAGAIN,
+ BCTEXT_CANCEL_NOBERRIES,
+ BCTEXT_CANCEL_DROPPEDOUT,
+ BCTEXT_TIMEUP,
+ BCTEXT_COMMSTANDBY,
+};
+
+enum {
+ BCCMD_BeginNormalPaletteFade = 1,
+ BCCMD_WaitPaletteFade,
+ BCCMD_PrintMessage,
+ BCCMD_InitGfx,
+ BCCMD_TeardownGfx,
+ BCCMD_SignalReadyToBegin,
+ BCCMD_AskPickBerry,
+ BCCMD_GoToBerryPouch,
+ BCCMD_WaitForOthersToPickBerries,
+ BCCMD_DropBerriesIntoCrusher,
+ BCCMD_DropLid,
+ BCCMD_Countdown,
+ BCCMD_PlayGame_Master,
+ BCCMD_PlayGame_Slave,
+ BCCMD_FinishGame,
+ BCCMD_HandleTimeUp,
+ BCCMD_TabulateResults,
+ BCCMD_ShowResults,
+ BCCMD_SaveTheGame,
+ BCCMD_AskPlayAgain,
+ BCCMD_CommunicatePlayAgainResponses,
+ BCCMD_FadeOutToPlayAgain,
+ BCCMD_PlayAgainFailureMessage,
+ BCCMD_GracefulExit,
+ BCCMD_Quit,
+};
+
struct BerryCrushGame_Player
{
- u16 unk0;
+ u16 berryId;
u16 unk2;
union
{
@@ -13,40 +53,26 @@ struct BerryCrushGame_Player
u8 unk14[12];
};
-struct __attribute__((packed, aligned(2))) BerryCrushGame_4E
-{
- u16 unk0;
- u16 filler2;
- u8 unk4_0:1;
- u8 unk4_1:1;
- s8 unk5;
- u16 unk6;
- u16 unk8;
- u16 unkA;
- u16 unkC;
-};
-
-struct __attribute__((packed)) BerryCrushGame_40
-{
- u8 unk0[2];
- u16 unk2[6];
- struct BerryCrushGame_4E unkE;
-};
-
struct BerryCrushGame_5C
{
u16 unk00;
u8 unk02_0:1;
u8 unk02_1:1;
- u8 unk02_2:1;
+ u8 pushedAButton:1;
u8 unk02_3:5;
- u8 unk03;
+ s8 unk03;
u16 unk04;
u16 unk06;
u16 unk08;
u16 unk0A;
};
+struct __attribute__((packed, aligned(2))) BerryCrushGame_4E
+{
+ u16 unk0;
+ struct BerryCrushGame_5C data;
+};
+
union BerryCrushGame_68
{
struct BerryCrushGame_68_x
@@ -58,7 +84,9 @@ union BerryCrushGame_68
s16 unk06;
u16 unk08;
u16 unk0A;
- u16 unk0C[2][5];
+ // 0: Number of A presses
+ // 1: Neatness
+ u16 stats[2][5];
u8 filler20[16];
} unk00;
u8 unk30[12];
@@ -68,12 +96,12 @@ union BerryCrushGame_68
struct BerryCrushGame_68_y
{
u8 filler00[28];
- struct BerryCrushGame_Player unk1C[5];
+ struct BerryCrushGame_Player players[5];
u8 fillerBC[20];
} as_five_players;
};
-struct BerryCrushGame_138_C
+struct BerryCrushPlayerSeatCoords
{
u8 unk0;
u8 unk1;
@@ -86,19 +114,19 @@ struct BerryCrushGame_138_C
struct BerryCrushGame_138
{
- u8 unk0;
+ u8 animBerryIdx;
u8 unk1;
u8 unk2;
u8 unk3;
- s16 unk4;
- s16 unk6;
- s16 unk8;
- const struct BerryCrushGame_138_C *unkC[5];
- struct Sprite *unk20;
- struct Sprite *unk24[5];
- struct Sprite *unk38[5];
- struct Sprite *unk4C[11];
- struct Sprite *unk78[2];
+ s16 minutes;
+ s16 secondsInt;
+ s16 secondsFrac;
+ const struct BerryCrushPlayerSeatCoords * seatCoords[5];
+ struct Sprite *coreSprite;
+ struct Sprite *impactSprites[5];
+ struct Sprite *berrySprites[5];
+ struct Sprite *sparkleSprites[11];
+ struct Sprite *timerSprites[2];
u8 unk80;
u8 filler81;
u8 unk82;
@@ -107,23 +135,23 @@ struct BerryCrushGame_138
struct BerryCrushGame
{
- MainCallback unk0;
- u32 (*unk4)(struct BerryCrushGame *, u8 *);
- u8 unk8;
- u8 unk9;
- u8 unkA;
- u8 unkB;
- u8 unkC;
+ MainCallback savedCallback;
+ u32 (*cmdCallback)(struct BerryCrushGame *, u8 *);
+ u8 localId;
+ u8 playerCount;
+ u8 taskId;
+ u8 textSpeed;
+ u8 cmdState;
u8 unkD;
- u8 unkE;
- u8 unkF;
+ u8 nextCmd;
+ u8 afterPalFadeCmd;
u16 unk10;
- u16 unk12;
+ u16 gameState;
u16 unk14;
- u16 unk16;
+ u16 pressingSpeed;
s16 unk18;
s16 unk1A;
- int unk1C;
+ int powder;
s32 unk20;
u8 unk24;
u8 unk25_0:1;
@@ -133,52 +161,52 @@ struct BerryCrushGame
u8 unk25_4:1;
u8 unk25_5:3;
u16 unk26;
- u16 unk28;
- s16 unk2A;
- s16 unk2C;
+ u16 timer;
+ s16 depth;
+ s16 vibration;
s16 unk2E;
s16 unk30;
s16 unk32;
s16 unk34;
- u8 unk36[0xA];
- struct BerryCrushGame_40 unk40;
- struct BerryCrushGame_5C unk5C;
+ u8 commandParams[10];
+ u16 sendCmd[7];
+ u16 recvCmd[7];
+ struct BerryCrushGame_5C localState;
union BerryCrushGame_68 unk68;
- struct BerryCrushGame_138 unk138;
- u8 unk1C0[0x1000];
+ struct BerryCrushGame_138 spritesManager;
+ u8 bg1Buffer[0x1000];
u8 unk11C0[0x1000];
- u8 unk21C0[0x1000];
- u8 unk31C0[0x1000];
+ u8 bg2Buffer[0x1000];
+ u8 bg3Buffer[0x1000];
};
-#define PLAYER_UNK14(game, i) \
+#define BERRYCRUSH_PLAYER_NAME(game, i) \
((u8 *)(game) \
+ offsetof(struct BerryCrushGame, unk68) \
+ offsetof(struct BerryCrushGame_68_x, unk30) \
+ sizeof(struct BerryCrushGame_Player) * (i))
-struct BerryCrushGame *sub_814B6F0(void);
+struct BerryCrushGame *GetBerryCrushGame(void);
void StartBerryCrush(MainCallback callback);
-u32 sub_814B6FC(MainCallback callback);
-void sub_814B8F0(void);
-void sub_814B914(void);
-void sub_814B924(void);
-void sub_814B930(void);
-void sub_814BABC(struct BerryCrushGame *arg0);
-void sub_814BB4C(u16, u8, u8 *);
-void sub_814D564(u8 *, u32, s32, u32, u32, u32, u32);
+u32 ExitBerryCrushWithCallback(MainCallback callback);
+void CB2_BerryCrush_GoToBerryPouch(void);
+void BerryCrush_SetVBlankCallback(void);
+void BerryCrush_UnsetVBlankCallback(void);
+void BerryCrush_UpdateSav2Records(void);
+void BerryCrush_RunOrScheduleCommand(u16 command, u8 runMode, u8 *params);
+void BerryCrush_SetPaletteFadeParams(u8 *params, bool8 communicateAfter, u32 selectedPals, s8 delay, u8 startY, u8 targetY, u16 palette);
int sub_814D9CC(struct BerryCrushGame *arg0);
-int sub_814D5C8(void);
-int sub_814D888(void);
-void sub_814DA24(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
-void sub_814DC24(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
+int BerryCrush_InitBgs(void);
+int BerryCrush_TeardownBgs(void);
+void BerryCrush_CreateBerrySprites(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
+void BerryCrushFreeBerrySpriteGfx(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
void sub_814DC5C(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
bool32 sub_814DE50(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
bool32 sub_814E644(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1);
void sub_814E80C(struct BerryCrushGame *arg0);
void sub_814DA04(struct BerryCrushGame *arg0);
-void sub_814EB04(struct BerryCrushGame_138 *arg0);
-void sub_814DB84(struct Sprite * sprite);
+void BerryCrush_HideTimerSprites(struct BerryCrushGame_138 *arg0);
+void SpriteCB_DropBerryIntoCrusher(struct Sprite * sprite);
void ShowBerryCrushRankings(void);
#endif //GUARD_BERRY_CRUSH_H
diff --git a/include/bg.h b/include/bg.h
index 8d7367871..f6c307146 100644
--- a/include/bg.h
+++ b/include/bg.h
@@ -34,7 +34,7 @@ enum
BG_ATTR_MOSAIC = 5,
BG_ATTR_WRAPAROUND = 6,
BG_ATTR_PRIORITY = 7,
- BG_ATTR_TEXTORAFFINEMODE = 8,
+ BG_ATTR_MAPSIZE = 8,
BG_ATTR_BGTYPE = 9,
BG_ATTR_BASETILE = 10
};
diff --git a/include/config.h b/include/config.h
index 4577f1b60..bdad6bb28 100644
--- a/include/config.h
+++ b/include/config.h
@@ -18,14 +18,14 @@
#define GAME_VERSION VERSION_FIRE_RED
#else // Default version seems to be LeafGreen
#define GAME_VERSION VERSION_LEAF_GREEN
-#endif
+#endif // GAME_VERSION
// rev1 renamed the source folder for reasons
#if REVISION == 0
#define CODE_ROOT "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/"
#else
#define CODE_ROOT "C:/WORK/POKeFRLG/Src/pm_lgfr_ose/source/"
-#endif
+#endif // REVISION
#define ABSPATH(x) (CODE_ROOT x)
@@ -33,6 +33,12 @@
#define UNITS_IMPERIAL
#else
#define UNITS_METRIC
-#endif
+#endif // ENGLISH
+
+// Crashes may occur due to section reordering in the modern build,
+// so we force BUGFIX here.
+#if MODERN
+#define BUGFIX
+#endif // MODERN
#endif // GUARD_CONFIG_H
diff --git a/include/dma3.h b/include/dma3.h
index 381e1e322..266fa0716 100644
--- a/include/dma3.h
+++ b/include/dma3.h
@@ -6,6 +6,14 @@
// Maximum amount of data we will transfer in one operation
#define MAX_DMA_BLOCK_SIZE 0x1000
+#define DMA_REQUEST_COPY32 1
+#define DMA_REQUEST_FILL32 2
+#define DMA_REQUEST_COPY16 3
+#define DMA_REQUEST_FILL16 4
+
+#define DMA3_16BIT 0
+#define DMA3_32BIT 1
+
#define Dma3CopyLarge_(src, dest, size, bit) \
{ \
const void *_src = src; \
@@ -48,10 +56,26 @@
#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16)
#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32)
+// Cancel pending DMA3 requests
void ClearDma3Requests(void);
+
+// Handle pending DMA3 requests
void ProcessDma3Requests(void);
+
+// Copy size bytes from src to dest.
+// mode takes a DMA3_*BIT macro
+// Returns the request index
s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode);
+
+// Fill size bytes at dest with value.
+// mode takes a DMA3_*BIT macro
+// Returns the request index
s16 RequestDma3Fill(s32 value, void *dest, u16 size, u8 mode);
-s16 CheckForSpaceForDma3Request(s16 index);
+
+// index is the return value from RequestDma3*
+// if index = -1, will check if any request is pending
+// otherwise, checks if the specified request is pending
+// Returns -1 if pending, 0 otherwise
+s16 WaitDma3Request(s16 index);
#endif // GUARD_DMA3_H
diff --git a/include/field_specials.h b/include/field_specials.h
index 5beeba928..0a4ea7bce 100644
--- a/include/field_specials.h
+++ b/include/field_specials.h
@@ -13,7 +13,7 @@ enum HiddenItemAttr
u8 GetLeadMonIndex(void);
s32 CountDigits(s32 number);
-void TV_PrintIntToStringVar(u8, int);
+void TV_PrintIntToStringVar(u8 varidx, s32 number);
u16 GetStarterSpecies(void);
void StopPokemonLeagueLightingEffectTask(void);
void nullsub_60(void);
diff --git a/include/fieldmap.h b/include/fieldmap.h
index 40aa1c916..c12dea340 100644
--- a/include/fieldmap.h
+++ b/include/fieldmap.h
@@ -14,11 +14,11 @@
extern struct BackupMapLayout VMap;
extern const struct MapLayout Route1_Layout;
-u32 MapGridGetMetatileIdAt(int, int);
+u32 MapGridGetMetatileIdAt(s32, s32);
u32 MapGridGetMetatileBehaviorAt(s16, s16);
u8 MapGridGetMetatileLayerTypeAt(s16 x, s16 y);
-void MapGridSetMetatileIdAt(int, int, u16);
-void MapGridSetMetatileEntryAt(int, int, u16);
+void MapGridSetMetatileIdAt(s32, s32, u16);
+void MapGridSetMetatileEntryAt(s32, s32, u16);
u8 MapGridGetZCoordAt(s32 x, s32 y);
void GetCameraCoords(u16*, u16*);
bool8 MapGridIsImpassableAt(s32, s32);
diff --git a/include/gba/defines.h b/include/gba/defines.h
index 9e822358a..28f804dff 100644
--- a/include/gba/defines.h
+++ b/include/gba/defines.h
@@ -14,6 +14,12 @@
#define EWRAM_DATA __attribute__((section("ewram_data")))
#endif
+#if MODERN
+#define NOINLINE __attribute__((noinline))
+#else
+#define NOINLINE
+#endif
+
#define ALIGNED(n) __attribute__((aligned(n)))
#define SOUND_INFO_PTR (*(struct SoundInfo **)0x3007FF0)
diff --git a/include/gba/isagbprint.h b/include/gba/isagbprint.h
index c5eb456c3..8a64b8223 100644
--- a/include/gba/isagbprint.h
+++ b/include/gba/isagbprint.h
@@ -35,6 +35,10 @@ void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopP
// for matching purposes
+#if MODERN
+#define AGB_ASSERT_EX(exp, file, line) AGB_ASSERT(exp)
+#define AGB_WARNING_EX(exp, file, line) AGB_WARNING(exp)
+#else
#ifdef NDEBUG
#define AGB_ASSERT_EX(exp, file, line)
#else
@@ -46,5 +50,6 @@ void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopP
#else
#define AGB_WARNING_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 0);
#endif
+#endif
#endif // GUARD_GBA_ISAGBPRINT_H
diff --git a/include/global.h b/include/global.h
index 67084f2ef..18645efd8 100644
--- a/include/global.h
+++ b/include/global.h
@@ -50,6 +50,10 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
+#if MODERN
+#define abs(x) (((x) < 0) ? -(x) : (x))
+#endif
+
// There are many quirks in the source code which have overarching behavioral differences from
// a number of other files. For example, diploma.c seems to declare rodata before each use while
// other files declare out of order and must be at the beginning. There are also a number of
diff --git a/include/item_pc.h b/include/item_pc.h
index 2fecf69a8..9c0f6d21d 100644
--- a/include/item_pc.h
+++ b/include/item_pc.h
@@ -1,7 +1,7 @@
#ifndef GUARD_ITEM_PC_H
#define GUARD_ITEM_PC_H
-void ItemPc_Init(u8 a0, MainCallback callback);
-void ItemPc_SetInitializedFlag(u8);
+void ItemPc_Init(u8 kind, MainCallback callback);
+void ItemPc_SetInitializedFlag(bool8 flag);
#endif //GUARD_ITEM_PC_H
diff --git a/include/math_util.h b/include/math_util.h
index 71e87dad1..9f9677463 100644
--- a/include/math_util.h
+++ b/include/math_util.h
@@ -1,11 +1,11 @@
#ifndef GUARD_MATH_UTIL_H
#define GUARD_MATH_UTIL_H
-s16 sub_80D8B90(s16 y);
-s16 sub_80D8AA0(s16 x, s16 y);
-s32 sub_80D8B68(s32 x, s32 y);
-s32 sub_80D8AE0(s32 x, s32 y);
-s16 sub_80D8B40(u8 s, s16 x, s16 y);
-s16 sub_80D8ABC(u8 s, s16 x, s16 y);
+s16 MathUtil_Inv16(s16 y);
+s16 MathUtil_Mul16(s16 x, s16 y);
+s32 MathUtil_Div32(s32 x, s32 y);
+s32 MathUtil_Mul32(s32 x, s32 y);
+s16 MathUtil_Div16Shift(u8 s, s16 x, s16 y);
+s16 MathUtil_Mul16Shift(u8 s, s16 x, s16 y);
#endif //GUARD_MATH_UTIL_H
diff --git a/include/menu_helpers.h b/include/menu_helpers.h
index fda77d1b6..0c0623cc0 100644
--- a/include/menu_helpers.h
+++ b/include/menu_helpers.h
@@ -21,7 +21,7 @@ bool8 MenuHelpers_LinkSomething(void);
void SetVBlankHBlankCallbacksToNull(void);
void ResetAllBgsCoordinatesAndBgCntRegs(void);
u8 GetDialogBoxFontId(void);
-bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1);
+bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity_p, u16 qmax);
void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 tileNum, u8 paletteNum, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc);
void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 fontId, u8 left, u8 top, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo);
u8 GetLRKeysState(void);
diff --git a/include/mon_markings.h b/include/mon_markings.h
index 2547a7322..ddda73931 100644
--- a/include/mon_markings.h
+++ b/include/mon_markings.h
@@ -28,6 +28,6 @@ void TeardownMonMarkingsMenu(void);
bool8 MonMarkingsHandleInput(void);
struct Sprite * CreateMonMarkingSprite_SelectCombo(u16 tileTag, u16 paletteTag, const u16 *palette);
struct Sprite * CreateMonMarkingSprite_AllOff(u16 tileTag, u16 paletteTag, const u16 *palette);
-void sub_80BEBD0(u8 markings, void * dest);
+void RequestDma3LoadMonMarking(u8 markings, void * dest);
#endif //GUARD_MON_MARKINGS_H
diff --git a/include/overworld.h b/include/overworld.h
index 42451636f..e28a75064 100644
--- a/include/overworld.h
+++ b/include/overworld.h
@@ -71,8 +71,8 @@ void Overworld_SetObjEventTemplateMovementType(u8, u8);
void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
-void SetDynamicWarp(int unused, s8 mapGroup, s8 mapNum, s8 warpId);
-void SetDynamicWarpWithCoords(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
+void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId);
+void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
@@ -158,7 +158,7 @@ void ResetGameStats(void);
void Overworld_CreditsMainCB(void);
bool32 Overworld_DoScrollSceneForCredits(u8 *, const struct CreditsOverworldCmd *, u8);
-bool32 sub_8058318(void);
+bool32 IsSendingKeysOverCable(void);
void CB2_ReturnToFieldWithOpenMenu(void);
void CB2_WhiteOut(void);
@@ -170,8 +170,8 @@ void SetContinueGameWarpToHealLocation(u8 loc);
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
void SetWarpDestinationToHealLocation(u8 a0);
-bool32 sub_80582E0(void);
-bool32 sub_8058274(void);
+bool32 Overworld_SendKeysToLinkIsRunning(void);
+bool32 Overworld_RecvKeysFromLinkIsRunning(void);
void OverworldWhiteOutGetMoneyLoss(void);
u8 GetCurrentMapBattleScene(void);
void Overworld_ResetStateAfterFly(void);
diff --git a/include/pokemon_storage_system_internal.h b/include/pokemon_storage_system_internal.h
index ba109640b..f08144243 100644
--- a/include/pokemon_storage_system_internal.h
+++ b/include/pokemon_storage_system_internal.h
@@ -335,9 +335,9 @@ struct PokemonStorageSystemData
/* 0d88 */ bool8 (*monPlaceChangeFunc)(void);
/* 0d8c */ u8 monPlaceChangeState;
/* 0d8d */ u8 field_D91;
- /* 0d90 */ struct Sprite *field_D94;
+ /* 0d90 */ struct Sprite *monMarkingSprite;
/* 0d94 */ struct Sprite *field_D98[2];
- /* 0d9c */ u16 *field_DA0;
+ /* 0d9c */ u16 *monMarkingSpriteTileStart;
/* 0da0 */ struct PokemonMarkMenu field_DA4;
/* 1e58 */ struct UnkPSSStruct_2002370 field_1E5C;
/* 20a0 */ struct Pokemon movingMon;
diff --git a/include/save.h b/include/save.h
index 32c09896a..24c03b0fa 100644
--- a/include/save.h
+++ b/include/save.h
@@ -114,6 +114,6 @@ bool8 sub_80DA4A0(void);
u8 Save_LoadGameData(u8 saveType);
u32 TryCopySpecialSaveSection(u8 sector, u8* dst);
u32 TryWriteSpecialSaveSection(u8 sector, u8* src);
-void sub_80DA634(u8 taskId);
+void Task_SaveGame_UpdatedLinkRecords(u8 taskId);
#endif // GUARD_SAVE_H
diff --git a/include/strings.h b/include/strings.h
index 57db7d509..50c132829 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -1149,15 +1149,15 @@ extern const u8 gUnknown_841DF99[];
extern const u8 gUnknown_841DFA0[];
// berry_crush
-extern const u8 gUnknown_841CE3C[];
-extern const u8 gUnknown_841CE78[];
-extern const u8 gUnknown_841CEA8[];
-extern const u8 gUnknown_841CF14[];
-extern const u8 gUnknown_841CF50[];
-extern const u8 gUnknown_841CF70[];
-extern const u8 gUnknown_841CFA0[];
-extern const u8 gUnknown_841CFD4[];
-extern const u8 gUnknown_841D008[];
+extern const u8 gText_BerryCrush_AreYouReady[];
+extern const u8 gText_BerryCrush_WaitForOthersToChooseBerry[];
+extern const u8 gText_BerryCrush_GainedXUnitsOfPowder[];
+extern const u8 gText_BerryCrush_RecordingGameResults[];
+extern const u8 gText_BerryCrush_WantToPlayAgain[];
+extern const u8 gText_BerryCrush_NoBerries[];
+extern const u8 gText_BerryCrush_MemberDroppedOut[];
+extern const u8 gText_BerryCrush_TimeUp[];
+extern const u8 gText_BerryCrush_CommunicationStandby[];
extern const u8 gText_1_ClrLtGryShdwBlk_Dynamic0[];
extern const u8 gText_1_Dynamic0[];
extern const u8 gText_SpaceTimes[];
diff --git a/include/task.h b/include/task.h
index 0d605b04d..fd7f5a4e1 100644
--- a/include/task.h
+++ b/include/task.h
@@ -33,7 +33,7 @@ void SwitchTaskToFollowupFunc(u8 taskId);
bool8 FuncIsActiveTask(TaskFunc func);
u8 FindTaskIdByFunc(TaskFunc func);
u8 GetTaskCount(void);
-void SetWordTaskArg(u8 taskId, u8 dataElem, u32 value);
+void SetWordTaskArg(u8 taskId, u8 dataElem, unsigned long value);
u32 GetWordTaskArg(u8 taskId, u8 dataElem);
#endif // GUARD_TASK_H
diff --git a/include/util.h b/include/util.h
index ef1c15faa..8dc5e9bb6 100644
--- a/include/util.h
+++ b/include/util.h
@@ -9,8 +9,8 @@ extern const u8 gMiscBlank_Gfx[]; // unused in Emerald
extern const u32 gBitTable[];
u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *));
-void StoreWordInTwoHalfwords(u16 *, u32);
-void LoadWordFromTwoHalfwords(u16 *, u32 *);
+void StoreWordInTwoHalfwords(u16 *, unsigned);
+void LoadWordFromTwoHalfwords(u16 *, unsigned *);
int CountTrailingZeroBits(u32 value);
u16 CalcCRC16(const u8 *data, u32 length);
u16 CalcCRC16WithTable(const u8 *data, u32 length);
diff --git a/include/vs_seeker.h b/include/vs_seeker.h
index 43796b215..a4b78cba0 100644
--- a/include/vs_seeker.h
+++ b/include/vs_seeker.h
@@ -6,7 +6,7 @@
void Task_VsSeeker_0(u8 taskId);
void ClearRematchStateByTrainerId(void);
void ClearRematchStateOfLastTalked(void);
-int GetRematchTrainerId(u16 a0);
+int GetRematchTrainerId(u16 trainerId);
bool8 UpdateVsSeekerStepCounter(void);
void MapResetTrainerRematches(u16 mapGroup, u16 mapNum);
diff --git a/include/window.h b/include/window.h
index c8b83af7a..3cb904626 100644
--- a/include/window.h
+++ b/include/window.h
@@ -54,8 +54,15 @@ u16 AddWindow(const struct WindowTemplate *template);
int AddWindowWithoutTileMap(const struct WindowTemplate *template);
void RemoveWindow(u8 windowId);
void FreeAllWindowBuffers(void);
+
+// Mode parameter for funcs below
+#define COPYWIN_MAP 1
+#define COPYWIN_GFX 2
+#define COPYWIN_BOTH 3
+
void CopyWindowToVram(u8 windowId, u8 mode);
-void CopyWindowRectToVram(u32 windowId, u32 mode, u32 x, u32 y, u32 w, u32 h);
+void CopyWindowToVram8Bit(u8 windowId, u8 mode);
+
void PutWindowTilemap(u8 windowId);
void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 palette);
void ClearWindowTilemap(u8 windowId);
@@ -73,7 +80,6 @@ u16 AddWindow8Bit(const struct WindowTemplate *template);
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue);
void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum);
-void CopyWindowToVram8Bit(u8 windowId, u8 mode);
extern void *gWindowBgTilemapBuffers[];
extern struct Window gWindows[];