diff --git a/include/agb_flash.h b/include/agb_flash.h index 3dd60df0f1..ba5820f016 100644 --- a/include/agb_flash.h +++ b/include/agb_flash.h @@ -9,5 +9,6 @@ u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); u16 IdentifyFlash(void); +u32 ProgramFlashSectorAndVerify(u16 sectorNum, u8 *src); #endif //GUARD_AGB_FLASH_H diff --git a/include/battle_anim.h b/include/battle_anim.h index 4e241686fd..ac47cadf14 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -221,6 +221,7 @@ void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, // battle_anim_effects_1.c void sub_810310C(u8 battler, struct Sprite* sprite); +void AnimMoveTwisterParticle(struct Sprite* sprite); // smokescreen.c u8 sub_807521C(s16 x, s16 y, u8 a3); diff --git a/include/dewford_trend.h b/include/dewford_trend.h index 608a925f57..bdb0fc95cf 100644 --- a/include/dewford_trend.h +++ b/include/dewford_trend.h @@ -5,5 +5,7 @@ void InitDewfordTrend(void); void UpdateDewfordTrendPerDay(u16); void UpdateDewfordTrendPerDay(u16 days); bool8 sub_81226D8(u16 *a); +void ReceiveEasyChatPairsData(struct EasyChatPair *a, size_t b, u8 unused); + #endif // GUARD_DEWFORDTREND_H diff --git a/include/match_call.h b/include/match_call.h index 1bf654937d..6803d2f260 100644 --- a/include/match_call.h +++ b/include/match_call.h @@ -15,5 +15,6 @@ void InitMatchCallCounters(void); bool32 TryStartMatchCall(void); bool32 IsMatchCallTaskActive(void); void StartMatchCallFromScript(u8* script); +void sub_8197080(u8 *destStr); #endif //GUARD_MATCH_CALL_H diff --git a/include/pokedex.h b/include/pokedex.h index c3700c8112..a1b7378bfc 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -44,5 +44,6 @@ u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); bool16 HasAllHoennMons(void); void ResetPokedexScrollPositions(void); u16 sub_80C0944(void); +void CB2_Pokedex(void); #endif // GUARD_POKEDEX_H diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 4f27ef2811..c7b895028c 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -23,5 +23,6 @@ void LoadMonIconPalette(u16 species); void sub_80D328C(struct Sprite *sprite); void sub_80D3014(struct Sprite *sprite); void sub_80D32C8(struct Sprite *sprite, u8 animNum); +u8 sub_80D30A0(u16 species); #endif // GUARD_POKEMON_ICON_H diff --git a/include/pokenav.h b/include/pokenav.h index e5dba8ae09..29ccaec3e5 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -30,5 +30,6 @@ u32 sub_81D427C(void); void sub_81D4998(void); void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); +void CB2_InitPokeNav(void); #endif //GUARD_POKENAV_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index 9940a5b441..ac9bbb5c30 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -18,5 +18,6 @@ void sub_801B990(u32, u32); u8 sub_8013F78(void); bool32 sub_802C908(u16); void nullsub_89(u8 taskId); +void var_800D_set_xB(void); #endif //GUARD_rom_8011DC0_H diff --git a/include/save.h b/include/save.h index 7ce86de705..88e5f22806 100644 --- a/include/save.h +++ b/include/save.h @@ -92,4 +92,7 @@ u32 TryCopySpecialSaveSection(u8 sector, u8* dst); u32 sub_8153634(u8 sector, u8* src); void sub_8153688(u8 taskId); +// save_failed_screen.c +void DoSaveFailedScreen(u8 saveType); + #endif // GUARD_SAVE_H diff --git a/include/script.h b/include/script.h index 386b388d02..34f4635bb3 100644 --- a/include/script.h +++ b/include/script.h @@ -61,4 +61,7 @@ bool32 sub_80991F8(void); u8 *sub_8099244(void); void sub_80992A0(u8 *script, u16 scriptSize); +// srccmd.h +void sub_809BE48(u16 npcId); + #endif // GUARD_SCRIPT_H diff --git a/include/secret_base.h b/include/secret_base.h index 699158d0e6..17efc314d3 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -33,6 +33,8 @@ void sub_80E8B6C(void); void sub_80E8BC8(void); void sub_80E8D4C(void); void EnableBothScriptContexts(void); +void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx); + #endif //GUARD_SECRET_BASE_H diff --git a/include/text.h b/include/text.h index 96c5a45071..d8f2fd8a35 100644 --- a/include/text.h +++ b/include/text.h @@ -284,4 +284,8 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese); u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese); void DecompressGlyphFont9(u16 glyphId); +// unk_text_util_2.c +u16 Font6Func(struct TextPrinter *textPrinter); +u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); + #endif // GUARD_TEXT_H diff --git a/src/dewford_trend.c b/src/dewford_trend.c index cad5ef9c2a..ee310af04a 100644 --- a/src/dewford_trend.c +++ b/src/dewford_trend.c @@ -159,7 +159,7 @@ static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c) } } -void ReceiveEasyChatPairsData(void *a, u32 b, u8 unused) +void ReceiveEasyChatPairsData(struct EasyChatPair *a, size_t size, u8 unused) { u16 i, j, r3, players; struct EasyChatPair *buffer1, *buffer2, *src, *dst, *foo_of_buffer2; @@ -176,7 +176,7 @@ void ReceiveEasyChatPairsData(void *a, u32 b, u8 unused) { players = GetLinkPlayerCount(); for (i = 0; i < players; i++) - memcpy(&(buffer1[i * 5]), (u8 *)a + i * b, 40); + memcpy(&(buffer1[i * 5]), (u8 *)a + i * size, 40); src = buffer1; dst = buffer2; r3 = 0; diff --git a/src/pokenav.c b/src/pokenav.c index 41434606cb..62ec75842b 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -141,7 +141,7 @@ void sub_81C7710(void); static void InitKeys_(void); static void FreeVars(void); static void VblankCb_Pokenav(void); -static void Cb2_Pokenav(void); +static void CB2_Pokenav(void); void sub_81C7C28(void); void sub_81C72BC(void); void sub_81C7B74(void); @@ -485,7 +485,7 @@ void sub_81C71E4(u8 taskId) } } -void CB2_PokeNav(void) +void CB2_InitPokeNav(void) { gUnknown_0203CF40 = Alloc(sizeof(*gUnknown_0203CF40)); if (gUnknown_0203CF40 == NULL) @@ -498,7 +498,7 @@ void CB2_PokeNav(void) ResetTasks(); SetVBlankCallback(NULL); CreateTask(sub_81C742C, 0); - SetMainCallback2(Cb2_Pokenav); + SetMainCallback2(CB2_Pokenav); SetVBlankCallback(VblankCb_Pokenav); } } @@ -529,7 +529,7 @@ void sub_81C72BC(void) FreeAllSpritePalettes(); SetVBlankCallback(NULL); CreateTask(sub_81C742C, 0); - SetMainCallback2(Cb2_Pokenav); + SetMainCallback2(CB2_Pokenav); SetVBlankCallback(VblankCb_Pokenav); } } @@ -588,7 +588,7 @@ static bool32 AnyMonHasRibbon(void) return FALSE; } -static void Cb2_Pokenav(void) +static void CB2_Pokenav(void) { RunTasks(); AnimateSprites(); diff --git a/src/pokenav_match_call.c b/src/pokenav_match_call.c index 53f9f05484..b775ed10e3 100644 --- a/src/pokenav_match_call.c +++ b/src/pokenav_match_call.c @@ -1,13 +1,11 @@ - -// Includes #include "global.h" #include "battle_setup.h" #include "event_data.h" #include "string_util.h" #include "battle.h" #include "gym_leader_rematch.h" +#include "match_call.h" -extern void sub_8197080(u8 *dest); extern const u8 gTrainerClassNames[][13]; // Static type declarations diff --git a/src/record_mixing.c b/src/record_mixing.c index aafd7284ba..ce9bacf4cd 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -34,9 +34,8 @@ #include "daycare.h" #include "international_string_util.h" #include "constants/battle_frontier.h" +#include "dewford_trend.h" -extern void ReceiveSecretBasesData(struct SecretBaseRecord *, size_t, u8); -extern void ReceiveEasyChatPairsData(struct EasyChatPair *, size_t, u8); // Static type declarations diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 0926d4569e..dd177f8842 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -2,6 +2,7 @@ #include "reshow_battle_screen.h" #include "battle.h" #include "palette.h" +#include "pokemon.h" #include "main.h" #include "scanline_effect.h" #include "text.h" @@ -18,8 +19,6 @@ extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[]; -extern void SetMultiuseSpriteTemplateToTrainerBack(u16 backPicId, u8 battlerPosition); - // this file's functions static void CB2_ReshowBattleScreenAfterMenu(void); static bool8 LoadBattlerSpriteGfx(u8 battlerId); diff --git a/src/rock.c b/src/rock.c index 14ffc63e01..814b1d88bf 100644 --- a/src/rock.c +++ b/src/rock.c @@ -12,8 +12,6 @@ extern const union AnimCmd *const gUnknown_085950E0[]; extern const union AnimCmd *const gUnknown_085954D0[]; -extern void AnimMoveTwisterParticle(struct Sprite *); - void sub_81109F0(struct Sprite *); void sub_8110AB4(struct Sprite *); void AnimDirtParticleAcrossScreen(struct Sprite *); diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 27472b6e38..b0e861fac3 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -33,8 +33,7 @@ #include "start_menu.h" #include "data2.h" #include "field_screen_effect.h" - -extern void HealPlayerParty(void); +#include "script_pokemon_util_80F87D8.h" struct UnkStruct_Shared { diff --git a/src/save.c b/src/save.c index d07e597661..ff26ce4606 100644 --- a/src/save.c +++ b/src/save.c @@ -1,5 +1,7 @@ #include "global.h" +#include "agb_flash.h" #include "gba/flash_internal.h" +#include "fieldmap.h" #include "save.h" #include "task.h" #include "decompress.h" @@ -8,6 +10,7 @@ #include "pokemon_storage_system.h" #include "main.h" #include "trainer_hill.h" +#include "link.h" #include "constants/game_stat.h" static u16 CalculateChecksum(void *data, u16 size); @@ -70,12 +73,6 @@ const struct SaveSectionOffsets gSaveSectionOffsets[] = SAVEBLOCK_CHUNK(gPokemonStorage, 8), }; -extern void DoSaveFailedScreen(u8); // save_failed_screen -extern bool32 ProgramFlashSectorAndVerify(u8 sector, u8 *data); -extern void save_serialize_map(void); -extern void sub_800ADF8(void); -extern bool8 IsLinkTaskFinished(void); - // iwram common u16 gLastWrittenSector; u32 gLastSaveCounter; diff --git a/src/secret_base.c b/src/secret_base.c index 3e591eba2c..8bb216452d 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -43,8 +43,6 @@ #include "constants/species.h" #include "constants/trainers.h" -extern void mapldr_default(void); - // Static type declarations struct SecretBaseListMenuBuffer { diff --git a/src/start_menu.c b/src/start_menu.c index 79404d0b2d..1052b640c2 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -7,10 +7,12 @@ #include "event_object_movement.h" #include "event_obj_lock.h" #include "event_scripts.h" +#include "fieldmap.h" #include "field_effect.h" #include "field_player_avatar.h" #include "field_specials.h" #include "field_weather.h" +#include "field_screen_effect.h" #include "frontier_pass.h" #include "frontier_util.h" #include "gpu_regs.h" @@ -26,6 +28,7 @@ #include "palette.h" #include "party_menu.h" #include "pokedex.h" +#include "pokenav.h" #include "safari_zone.h" #include "save.h" #include "scanline_effect.h" @@ -40,6 +43,7 @@ #include "trainer_card.h" #include "window.h" #include "constants/songs.h" +#include "rom_8011DC0.h" // Menu actions enum @@ -84,18 +88,6 @@ EWRAM_DATA static u8 sSaveDialogTimer = 0; EWRAM_DATA static bool8 sSavingComplete = FALSE; EWRAM_DATA static u8 sSaveInfoWindowId = 0; -// Extern variables. -extern u8 gLocalLinkPlayerId; - -// Extern functions in not decompiled files. -extern void sub_80AF688(void); -extern void var_800D_set_xB(void); -extern void sub_808B864(void); -extern void CB2_Pokedex(void); -extern void PlayRainStoppingSoundEffect(void); -extern void CB2_PokeNav(void); -extern void save_serialize_map(void); - // Menu action callbacks static bool8 StartMenuPokedexCallback(void); static bool8 StartMenuPokemonCallback(void); @@ -656,7 +648,7 @@ static bool8 StartMenuPokeNavCallback(void) PlayRainStoppingSoundEffect(); RemoveExtraStartMenuWindows(); CleanupOverworldWindowsAndTilemaps(); - SetMainCallback2(CB2_PokeNav); // Display PokeNav + SetMainCallback2(CB2_InitPokeNav); // Display PokeNav return TRUE; } diff --git a/src/text.c b/src/text.c index a439d3ced8..bdc0f14f79 100644 --- a/src/text.c +++ b/src/text.c @@ -12,10 +12,6 @@ #include "menu.h" #include "dynamic_placeholder_text_util.h" -extern u8 GetKeypadIconWidth(u8 keypadIconId); -extern u16 Font6Func(struct TextPrinter *textPrinter); -extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); - EWRAM_DATA struct TextPrinter gTempTextPrinter = {0}; EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS] = {0}; diff --git a/src/trainer_card.c b/src/trainer_card.c index 4fb30f616c..41bf71cd33 100755 --- a/src/trainer_card.c +++ b/src/trainer_card.c @@ -21,6 +21,7 @@ #include "gpu_regs.h" #include "international_string_util.h" #include "pokedex.h" +#include "pokemon_icon.h" #include "graphics.h" #include "pokemon_icon.h" #include "trainer_pokemon_sprites.h" @@ -89,9 +90,6 @@ struct TrainerCardData u8 language; }; -//external functions -extern u8 sub_80D30A0(u16); - // EWRAM EWRAM_DATA struct TrainerCard gTrainerCards[4] = {0}; EWRAM_DATA static struct TrainerCardData *sData = NULL; diff --git a/src/trainer_see.c b/src/trainer_see.c index bc5d9cbc39..16ea88a455 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -17,8 +17,6 @@ #include "constants/event_object_movement_constants.h" #include "constants/field_effects.h" -extern void sub_809BE48(u16 npcId); - // this file's functions static u8 CheckTrainer(u8 eventObjectId); static u8 GetTrainerApproachDistance(struct EventObject *trainerObj); diff --git a/src/unk_text_util_2.c b/src/unk_text_util_2.c index bbc256915f..530bd40852 100644 --- a/src/unk_text_util_2.c +++ b/src/unk_text_util_2.c @@ -214,7 +214,7 @@ static void DecompressGlyphFont6(u16 glyph) gUnknown_03002F90.unk81 = 0x10; } -u8 GetGlyphWidthFont6(void) +u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese) { return 0x10; } diff --git a/src/water.c b/src/water.c index c856b9aa45..20bf2542d3 100644 --- a/src/water.c +++ b/src/water.c @@ -13,34 +13,33 @@ #include "constants/battle.h" #include "constants/rgb.h" -extern void sub_810721C(struct Sprite *); -extern void sub_8107228(struct Sprite *); -extern void sub_8107260(struct Sprite *); -extern void sub_8107380(struct Sprite *); -extern void sub_8107408(struct Sprite *); -extern void sub_8107430(struct Sprite *); -extern void sub_810744C(struct Sprite *); -extern void sub_81074E4(struct Sprite *); -extern void sub_81075EC(struct Sprite *); -extern void sub_8107674(struct Sprite *); -extern void sub_8107730(struct Sprite *); -extern void sub_81077A4(struct Sprite *); -extern void sub_81077C0(struct Sprite *); -extern void sub_80A78AC(struct Sprite *); -extern void sub_8107894(struct Sprite *); -extern void sub_81078D0(struct Sprite *); -extern void sub_810790C(struct Sprite *); -extern void sub_8108034(struct Sprite *); -extern void sub_8108098(struct Sprite *); -extern void sub_810851C(struct Sprite *); -extern void sub_81087C0(struct Sprite *); -extern void sub_810886C(struct Sprite *); -extern void sub_8108B2C(struct Sprite *); -extern void sub_8108B94(struct Sprite *); -extern void sub_8108BE0(struct Sprite *); -extern void sub_8108C08(struct Sprite *); -extern void sub_8108C54(struct Sprite *); -extern void sub_8108CDC(struct Sprite *); +void sub_810721C(struct Sprite *); +void sub_8107228(struct Sprite *); +void sub_8107260(struct Sprite *); +void sub_8107380(struct Sprite *); +void sub_8107408(struct Sprite *); +void sub_8107430(struct Sprite *); +void sub_810744C(struct Sprite *); +void sub_81074E4(struct Sprite *); +void sub_81075EC(struct Sprite *); +void sub_8107674(struct Sprite *); +void sub_8107730(struct Sprite *); +void sub_81077A4(struct Sprite *); +void sub_81077C0(struct Sprite *); +void sub_8107894(struct Sprite *); +void sub_81078D0(struct Sprite *); +void sub_810790C(struct Sprite *); +void sub_8108034(struct Sprite *); +void sub_8108098(struct Sprite *); +void sub_810851C(struct Sprite *); +void sub_81087C0(struct Sprite *); +void sub_810886C(struct Sprite *); +void sub_8108B2C(struct Sprite *); +void sub_8108B94(struct Sprite *); +void sub_8108BE0(struct Sprite *); +void sub_8108C08(struct Sprite *); +void sub_8108C54(struct Sprite *); +void sub_8108CDC(struct Sprite *); void sub_810756C(u8); void sub_81076F4(u8); void sub_8107B84(u8);