Skip to content

Commit

Permalink
WIP File split for HandleAction_UseItem on DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Sep 17, 2024
1 parent b48e974 commit 4b3c155
Show file tree
Hide file tree
Showing 22 changed files with 5,802 additions and 5,768 deletions.
6 changes: 3 additions & 3 deletions asmdiff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb"
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
$OBJDUMP $OPTIONS pokeruby.gba > pokeruby.dump
diff -u baserom.dump pokeruby.dump
$OBJDUMP $OPTIONS baserom_$1.gba > baserom_$1.dump
$OBJDUMP $OPTIONS $1.gba > $1.dump
diff -u baserom_$1.dump $1.dump
32 changes: 32 additions & 0 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,37 @@ extern u8 gDisplayedStringBattle[];
extern u16 gBattleTypeFlags;
extern u8 gUnknown_02023A14_50;
extern u16 gTrainerBattleOpponent;
extern u8 gCurrentTurnActionNumber;
extern u8 gCritMultiplier;
extern u8 gMultiHitCounter;
extern u16 gChosenMove;
extern u16 gLockedMoves[MAX_BATTLERS_COUNT];
extern const u8 * const gBattleScriptsForMoveEffects[];
extern const u8 * const gBattlescriptsForBallThrow[];
extern const u8 * const gBattlescriptsForRunningByItem[];
extern const u8 * const gBattlescriptsForUsingItem[];
extern const u8 * const gBattlescriptsForSafariActions[];
extern const u8 BattleScript_LocalTrainerBattleWon[];
extern const u8 BattleScript_LocalBattleLost[];
extern const u8 BattleScript_GotAwaySafely[];
extern const u8 BattleScript_SmokeBallEscape[];
extern const u8 BattleScript_RanAwayUsingMonAbility[];
extern const u8 BattleScript_WildMonFled[];
extern const u8 BattleScript_ActionSwitch[];
extern const u8 BattleScript_PrintFailedToRunString[];
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gActionsByTurnOrder[MAX_BATTLERS_COUNT];
extern u16 gLastHitByType[MAX_BATTLERS_COUNT];
extern u16 gLastLandedMoves[MAX_BATTLERS_COUNT];
extern u8 gBattleOutcome;
extern u8 gActionForBanks[MAX_BATTLERS_COUNT];
extern u8 gNumSafariBalls;
extern u8 gBattleCommunication[8];
extern u8 gBattleTerrain;
extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT];
extern MainCallback gPreBattleCallback1;
extern u16 gCurrentMove;

// src/battle_bg.o
void sub_800D6D4();
Expand Down Expand Up @@ -714,5 +745,6 @@ void sub_80324E0(u8 a);
void SetBankFuncToLinkOpponentBufferRunCommand(void);

void GameClear(void);
void SpecialStatusesClear(void);

#endif // GUARD_BATTLE_H
8 changes: 6 additions & 2 deletions ld_script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ SECTIONS {
src/battle_controllers.o(.text);
src/decompress.o(.text);
src/battle_bg.o(.text);
src/battle_main.o(.text);
src/battle_main1.o(.text);
src/debug/battle.o(.text);
src/battle_main2.o(.text);
src/battle_util.o(.text);
src/battle_script_commands.o(.text);
src/battle_controller_player.o(.text);
Expand Down Expand Up @@ -494,7 +496,9 @@ SECTIONS {
src/battle_ai_switch_items.o(.rodata);
src/battle_controller_link_opponent.o(.rodata);
src/data/battle_moves.o(.rodata);
src/battle_main.o(.rodata);
src/battle_main1.o(.rodata);
src/debug/battle.o(.rodata);
src/battle_main2.o(.rodata);
src/battle_util.o(.rodata);
src/pokemon_1.o(.rodata);
src/pokemon_1.o(.data); /* gEvolutionTable needs to be non-const to match */
Expand Down
2 changes: 0 additions & 2 deletions src/battle_ai_switch_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ extern u8 gAbsentBattlerFlags;
extern s32 gBattleMoveDamage;
extern u8 gMoveResultFlags;
extern u16 gDynamicBasePower;
extern u8 gCritMultiplier;
extern u16 gBattlerPartyIndexes[];
extern u16 gLastLandedMoves[];
extern const u8 gTypeEffectiveness[];
extern struct BattlePokemon gBattleMons[];
extern u32 gStatuses3[MAX_BATTLERS_COUNT];
Expand Down
1 change: 0 additions & 1 deletion src/battle_controller_link_opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ extern u8 gAnimMoveTurn;
extern struct Window gWindowTemplate_Contest_MoveDescription;
extern u8 gUnknown_0300434C[];
extern u32 gBattleControllerExecFlags;
extern MainCallback gPreBattleCallback1;
extern struct MusicPlayerInfo gMPlayInfo_BGM;

extern u8 sub_8077F68();
Expand Down
17 changes: 0 additions & 17 deletions src/battle_controller_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ extern u8 gBattlerTarget;
extern u32 gOamMatrixAllocBitmap;
extern u8 gUnknown_020297ED;
extern u8 gActiveBattler;
extern u8 gActionSelectionCursor[];
extern u8 gDisplayedStringBattle[];
extern u8 gMoveSelectionCursor[];
extern u8 gBattleBufferA[][0x200];
extern u8 gBankInMenu;
extern u16 gBattlerPartyIndexes[];
Expand Down Expand Up @@ -127,32 +125,17 @@ extern u8 sub_8077F68();
extern u8 StartSendOutMonAnimation();
extern void sub_802D798(void);
extern void bx_0802E404(void);
extern u8 gActiveBattler;
extern void (*gBattlerControllerFuncs[])(void);
extern bool8 gDoingBattleAnim;
extern u16 gBattleTypeFlags;
extern u32 gBattleControllerExecFlags;
extern u8 gBattleBufferA[][0x200];
extern u8 gBattlerSpriteIds[];
extern u8 gActionSelectionCursor[];
extern u8 gMoveSelectionCursor[];
extern u8 gAbsentBattlerFlags;
extern u8 gUnknown_03004344;
extern u8 gBattlersCount;
extern u16 gBattlerPartyIndexes[];
extern struct Window gWindowTemplate_Contest_MoveDescription;
extern const u8 BattleText_SwitchWhich[];
extern u8 gUnknown_03004348;
extern struct BattlePokemon gBattleMons[];
extern MainCallback gPreBattleCallback1;
extern u8 gHealthboxSpriteIds[];
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern u8 gUnknown_0300434C[];
extern u8 gUnknown_0202E8F4;
extern u8 gUnknown_0202E8F5;
extern u8 gBattlePartyCurrentOrder[];
extern u16 gSpecialVar_ItemId;
extern u8 gDisplayedStringBattle[];
extern const u8 BattleText_LinkStandby[];

extern void dp11b_obj_instanciate(u8, u8, s8, s8);
Expand Down
1 change: 0 additions & 1 deletion src/battle_controller_safari.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

extern struct Window gWindowTemplate_Contest_MoveDescription;
extern u8 gDisplayedStringBattle[];
extern u8 gActionSelectionCursor[];

extern const u8 BattleText_PlayerMenu[];
extern u8 gActiveBattler;
Expand Down
2 changes: 0 additions & 2 deletions src/battle_controllers.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ extern u8 gAbsentBattlerFlags;
extern u8 gMultiHitCounter;
extern u8 gUnknown_02024C78;
extern u8 gBattleOutcome;
extern u8 gActionSelectionCursor[];
extern u8 gMoveSelectionCursor[];
extern u8 gBattleTextBuff1[];
extern u8 gBattleTextBuff2[];
extern u8 gBattleTextBuff3[];
Expand Down
Loading

0 comments on commit 4b3c155

Please sign in to comment.