mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge pull request #112 from DizzyEggg/decompile_recorded_battle
Decompile recorded battle
This commit is contained in:
commit
5dc8beb034
@ -25722,7 +25722,7 @@ sub_81D3AD8: @ 81D3AD8
|
||||
adds r5, r0, 0
|
||||
adds r4, r1, 0
|
||||
movs r0, 0x1E
|
||||
bl sub_81535DC
|
||||
bl TryCopySpecialSaveSection
|
||||
cmp r0, 0x1
|
||||
bne _081D3B04
|
||||
ldr r2, =0x00000ee8
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5000,7 +5000,7 @@ _080C5240:
|
||||
adds r0, r2
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1, 0x6]
|
||||
bl sub_8185290
|
||||
bl CanCopyRecordedBattleSaveData
|
||||
ldr r3, [r5]
|
||||
movs r1, 0x1
|
||||
ands r0, r1
|
||||
@ -5825,7 +5825,7 @@ _080C5970:
|
||||
strh r0, [r1, 0x6]
|
||||
bl sub_80C52E4
|
||||
ldr r0, =sub_80C58D4
|
||||
bl sub_8185E24
|
||||
bl PlayRecordedBattle
|
||||
b _080C599A
|
||||
.pool
|
||||
_080C5994:
|
||||
|
@ -167,9 +167,31 @@ struct BerryCrush
|
||||
u32 unk;
|
||||
};
|
||||
|
||||
#define PLAYER_NAME_LENGTH 8
|
||||
|
||||
struct UnknownSaveBlock2Struct
|
||||
{
|
||||
u8 field_0;
|
||||
u8 field_1;
|
||||
u8 field_2[2];
|
||||
u8 field_4[8];
|
||||
u8 field_C[16];
|
||||
u16 field_1C[6];
|
||||
u16 field_28[6];
|
||||
u8 field_34[176];
|
||||
u8 field_E4;
|
||||
u8 field_E5;
|
||||
u8 field_E6;
|
||||
u8 field_E7;
|
||||
u8 field_E8;
|
||||
u8 field_E9;
|
||||
u8 field_EA;
|
||||
u8 field_EB;
|
||||
}; // sizeof = 0xEC
|
||||
|
||||
struct SaveBlock2
|
||||
{
|
||||
/*0x00*/ u8 playerName[8];
|
||||
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH];
|
||||
/*0x08*/ u8 playerGender; // MALE, FEMALE
|
||||
/*0x09*/ u8 specialSaveWarp;
|
||||
/*0x0A*/ u8 playerTrainerId[4];
|
||||
@ -201,7 +223,8 @@ struct SaveBlock2
|
||||
|
||||
// All below could be a one giant struct
|
||||
|
||||
/*0x64C*/ u8 field_64C[0x588];
|
||||
/*0x64C*/ u8 field_64C[236];
|
||||
/*0x738*/ struct UnknownSaveBlock2Struct field_738[5]; // No idea here, it's probably wrong, no clue.
|
||||
/*0xBD4*/ u16 field_BD4;
|
||||
/*0xBD6*/ u16 field_BD6;
|
||||
/*0xBD8*/ u8 field_BD8[11];
|
||||
@ -218,7 +241,7 @@ struct SaveBlock2
|
||||
/*0xCAA*/ u16 field_CAA[0x2e];
|
||||
/*0xD06*/ u8 field_D06;
|
||||
/*0xD07*/ u8 field_D07;
|
||||
/*0xd08*/ u8 filler_D08[0x112];
|
||||
/*0xD08*/ u8 filler_D08[0x112];
|
||||
/*0xE1A*/ u16 battlePyramidFloor; // possibly?
|
||||
/*0xE1C*/ u8 field_E1C[16];
|
||||
/*0xE2C*/ struct PyramidBag pyramidBag;
|
||||
|
@ -68,7 +68,7 @@ struct LinkPlayer
|
||||
/* 0x08 */ u8 name[11];
|
||||
/* 0x13 */ u8 gender;
|
||||
/* 0x14 */ u32 linkType;
|
||||
/* 0x18 */ u16 lp_field_18;
|
||||
/* 0x18 */ u16 lp_field_18; // battle bank in battles
|
||||
/* 0x1A */ u16 language;
|
||||
};
|
||||
|
||||
|
@ -2,23 +2,40 @@
|
||||
#define GUARD_RECORDED_BATTLE_H
|
||||
|
||||
extern u32 gRecordedBattleRngSeed;
|
||||
extern u32 gBattlePalaceMoveSelectionRngValue;
|
||||
extern u8 gUnknown_0203C7B4;
|
||||
|
||||
void sub_8184DA4(u8 arg0);
|
||||
void sub_8185F84(void);
|
||||
void sub_8184E58(void);
|
||||
u8 RecordedBattle_ReadBankAction(u8 bank);
|
||||
void RecordedBattle_SetBankAction(u8 bank, u8 action);
|
||||
void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear);
|
||||
void sub_8185F90(u16 arg0);
|
||||
bool8 sub_8186450(void);
|
||||
u8 sub_8185FAC(void);
|
||||
u8 sub_8185FB8(void);
|
||||
u8 MoveRecordedBattleToSaveData(void);
|
||||
void sub_818603C(u8);
|
||||
void sub_8185FD0(void);
|
||||
void sub_8186444(void);
|
||||
void sub_8185EB8(void);
|
||||
u8 RecordedBattle_ReadBankAction(u8 bank);
|
||||
u8 sub_81850D0(void);
|
||||
u8 sub_81850DC(u8 *arg0);
|
||||
u8 sub_8185F40(void);
|
||||
void sub_81851A8(u8 *arg0);
|
||||
bool32 CanCopyRecordedBattleSaveData(void);
|
||||
u32 MoveRecordedBattleToSaveData(void);
|
||||
void PlayRecordedBattle(void (*CB2_After)(void));
|
||||
u8 sub_8185EA0(void);
|
||||
u8 sub_8185EAC(void);
|
||||
void RecordedBattle_SaveParties(void);
|
||||
u8 GetActiveBankLinkPlayerGender(void);
|
||||
void sub_8185F84(void);
|
||||
void sub_8185F90(u16 arg0);
|
||||
u8 sub_8185FAC(void);
|
||||
u8 GetBattleStyleInRecordedBattle(void);
|
||||
u8 GetTextSpeedInRecordedBattle(void);
|
||||
void RecordedBattle_CopyBankMoves(void);
|
||||
void sub_818603C(u8 arg0);
|
||||
u32 GetAiScriptsInRecordedBattle(void);
|
||||
void sub_8186444(void);
|
||||
bool8 sub_8186450(void);
|
||||
void sub_8186468(u8 *dst);
|
||||
u8 sub_818649C(void);
|
||||
u8 sub_81864A8(void);
|
||||
u8 sub_81864B4(void);
|
||||
u8 sub_81864C0(void);
|
||||
void sub_81864CC(void);
|
||||
u16 *sub_81864E0(void);
|
||||
|
||||
#endif // GUARD_RECORDED_BATTLE_H
|
||||
|
@ -56,41 +56,42 @@ enum
|
||||
HOF_DELETE_SAVE // unused
|
||||
};
|
||||
|
||||
#define SECTION_ID_RECORDED_BATTLE 31
|
||||
|
||||
void ClearSaveData(void);
|
||||
void ResetSaveCounters(void);
|
||||
//bool32 ManipulateSectorBits(u8 op, u8 bit);
|
||||
//u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *a2);
|
||||
u8 HandleWriteSector(u16, const struct SaveSectionLocation *);
|
||||
//u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size);
|
||||
u8 TryWriteSector(u8, u8 *);
|
||||
//u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location);
|
||||
//u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location);
|
||||
//u8 sub_812550C(u16 a1, const struct SaveSectionLocation *location);
|
||||
bool32 SetDamagedSectorBits(u8 op, u8 bit);
|
||||
u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size);
|
||||
u8 TryWriteSector(u8 sector, u8 *data);
|
||||
u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location);
|
||||
u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location);
|
||||
u8 sub_81529D4(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 ClearSaveData_2(u16, const struct SaveSectionLocation *location);
|
||||
//u8 sub_8125758(u16 a1, const struct SaveSectionLocation *location);
|
||||
//u8 sub_81257F0(u16 a1, const struct SaveSectionLocation *location);
|
||||
//u8 sub_812587C(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sub_8152E10(u16, const struct SaveSectionLocation *location);
|
||||
u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sav12_xor_get(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sub_8152CAC(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sub_8152D44(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sub_8152DD0(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location);
|
||||
u8 GetSaveValidStatus(const struct SaveSectionLocation *location);
|
||||
//u8 sub_8125B88(u8 a1, u8 *data, u16 size);
|
||||
u8 DoReadFlashWholeSection(u8, struct SaveSection *);
|
||||
u16 CalculateChecksum(void *, u16);
|
||||
u8 sub_81530DC(u8 a1, u8 *data, u16 size);
|
||||
u8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section);
|
||||
u16 CalculateChecksum(void *data, u16 size);
|
||||
void UpdateSaveAddresses(void);
|
||||
u8 HandleSavingData(u8 saveType);
|
||||
//u8 TrySavingData(u8 saveType);
|
||||
//u8 sub_8125D80(void);
|
||||
//bool8 sub_8125DA8(void);
|
||||
//u8 sub_8125DDC(void);
|
||||
//u8 sub_8125E04(void);
|
||||
//u8 sub_8125E2C(void);
|
||||
//bool8 sub_8125E6C(void);
|
||||
//u8 sub_8125EC8(u8 a1);
|
||||
//bool8 unref_sub_8125F4C(struct UnkSaveSection *a1);
|
||||
//u8 unref_sub_8125FA0(void);
|
||||
//u8 unref_sub_8125FF0(u8 *data, u16 size);
|
||||
//u8 unref_sub_8126068(u8 sector, u8 *data, u32 size);
|
||||
//u8 unref_sub_8126080(u8 sector, u8 *data);
|
||||
u8 TrySavingData(u8 saveType);
|
||||
u8 sub_8153380(void);
|
||||
bool8 sub_81533AC(void);
|
||||
u8 sub_81533E0(void);
|
||||
u8 sub_8153408(void);
|
||||
u8 sub_8153430(void);
|
||||
bool8 sub_8153474(void);
|
||||
u8 sub_81534D0(u8 a1);
|
||||
u16 sub_815355C(void);
|
||||
u8 sub_81534D0(u8);
|
||||
u32 TryCopySpecialSaveSection(u8 sector, u8* dst);
|
||||
u32 sub_8153634(u8 sector, u8* src);
|
||||
void sub_8153688(u8 taskId);
|
||||
|
||||
#endif // GUARD_SAVE_H
|
||||
|
@ -232,7 +232,7 @@ SECTIONS {
|
||||
asm/fldeff_teleport.o(.text);
|
||||
asm/battle_link_817C95C.o(.text);
|
||||
asm/pokemon_animation.o(.text);
|
||||
asm/recorded_battle.o(.text);
|
||||
src/recorded_battle.o(.text);
|
||||
src/battle_controller_recorded_opponent.o(.text);
|
||||
src/battle_controller_recorded_player.o(.text);
|
||||
src/battle_dome_cards.o(.text);
|
||||
|
@ -142,7 +142,6 @@ extern u8 gLastUsedAbility;
|
||||
extern u8 gUnknown_0203CF00[];
|
||||
extern const u8* gBattlescriptPtrsForSelection[BATTLE_BANKS_COUNT];
|
||||
extern const u8* gBattlescriptCurrInstr;
|
||||
extern u32 gBattlePalaceMoveSelectionRngValue;
|
||||
extern u8 gActionsByTurnOrder[BATTLE_BANKS_COUNT];
|
||||
extern u8 gCurrentTurnActionNumber;
|
||||
extern u16 gDynamicBasePower;
|
||||
@ -2803,7 +2802,7 @@ static void BattleStartClearSetData(void)
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && gSaveBlock2Ptr->optionsBattleSceneOff == TRUE)
|
||||
gHitMarker |= HITMARKER_NO_ANIMATIONS;
|
||||
}
|
||||
else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) && sub_8185FB8())
|
||||
else if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) && GetBattleStyleInRecordedBattle())
|
||||
gHitMarker |= HITMARKER_NO_ANIMATIONS;
|
||||
|
||||
gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
|
||||
@ -3920,7 +3919,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
switch (gBattleCommunication[gActiveBank])
|
||||
{
|
||||
case STATE_TURN_START_RECORD: // recorded battle related on start of every turn
|
||||
sub_8185FD0();
|
||||
RecordedBattle_CopyBankMoves();
|
||||
gBattleCommunication[gActiveBank] = STATE_BEFORE_ACTION_CHOSEN;
|
||||
break;
|
||||
case STATE_BEFORE_ACTION_CHOSEN: // choose an action
|
||||
|
@ -1261,7 +1261,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerPicId = PlayerGenderToFrontTrainerPicId(sub_8185F40());
|
||||
trainerPicId = PlayerGenderToFrontTrainerPicId(GetActiveBankLinkPlayerGender());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1229,7 +1229,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
trainerPicId = sub_8185F40();
|
||||
trainerPicId = GetActiveBankLinkPlayerGender();
|
||||
else
|
||||
trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ void sub_8032768(void)
|
||||
sub_8184DA4(2);
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
|
||||
sub_8185EB8();
|
||||
RecordedBattle_SaveParties();
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
SetControllersVariablesInLinkBattle();
|
||||
|
@ -58,7 +58,7 @@ extern const u8* GetTrainer1LoseText(void); // battle_setup
|
||||
extern const u8* GetTrainer2LoseText(void); // battle_setup
|
||||
extern void GetFrontierTrainerName(u8 *dst, u16 trainerId);
|
||||
extern s32 GetStringCenterAlignXOffsetWithLetterSpacing(u8 fontId, const u8 *str, s32 totalWidth, s16 letterSpacing);
|
||||
extern u8 sub_8185FC4(void);
|
||||
extern u8 GetTextSpeedInRecordedBattle(void);
|
||||
extern u8 sav2_get_text_speed(void);
|
||||
|
||||
// this file's functions
|
||||
@ -2264,7 +2264,7 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1)
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
|
||||
speed = 1;
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
speed = sRecordedBattleTextSpeeds[sub_8185FC4()];
|
||||
speed = sRecordedBattleTextSpeeds[GetTextSpeedInRecordedBattle()];
|
||||
else
|
||||
speed = sav2_get_text_speed();
|
||||
|
||||
|
1676
src/recorded_battle.c
Normal file
1676
src/recorded_battle.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -797,7 +797,7 @@ u16 sub_815355C(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_81535DC(u8 sector, u8* dst)
|
||||
u32 TryCopySpecialSaveSection(u8 sector, u8* dst)
|
||||
{
|
||||
s32 i;
|
||||
s32 size;
|
||||
@ -826,6 +826,7 @@ u32 sub_8153634(u8 sector, u8* src)
|
||||
|
||||
if (sector != 30 && sector != 31)
|
||||
return 0xFF;
|
||||
|
||||
savDataBuffer = &gSaveDataBuffer;
|
||||
*(u32*)(savDataBuffer) = 0xB39D;
|
||||
|
||||
|
@ -1428,90 +1428,7 @@ gUnknown_0203BD26: @ 203BD26
|
||||
gUnknown_0203BD28: @ 203BD28
|
||||
.space 0x4
|
||||
|
||||
gRecordedBattleRngSeed: @ 203BD2C
|
||||
.space 0x4
|
||||
|
||||
gBattlePalaceMoveSelectionRngValue: @ 203BD30
|
||||
.space 0x4
|
||||
|
||||
gUnknown_0203BD34: @ 203BD34
|
||||
.space 0xA60
|
||||
|
||||
gUnknown_0203C794: @ 203C794
|
||||
.space 0x8
|
||||
|
||||
gUnknown_0203C79C: @ 203C79C
|
||||
.space 0x8
|
||||
|
||||
gUnknown_0203C7A4: @ 203C7A4
|
||||
.space 0x8
|
||||
|
||||
gUnknown_0203C7AC: @ 203C7AC
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7AD: @ 203C7AD
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7AE: @ 203C7AE
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7AF: @ 203C7AF
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7B0: @ 203C7B0
|
||||
.space 0x4
|
||||
|
||||
gUnknown_0203C7B4: @ 203C7B4
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7B5: @ 203C7B5
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7B6: @ 203C7B6
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7B7: @ 203C7B7
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203C7B8: @ 203C7B8
|
||||
.space 0x4
|
||||
|
||||
gUnknown_0203C7BC: @ 203C7BC
|
||||
.space 0x4
|
||||
|
||||
gUnknown_0203C7C0: @ 203C7C0
|
||||
.space 0x258
|
||||
|
||||
gUnknown_0203CA18: @ 203CA18
|
||||
.space 0x258
|
||||
|
||||
gUnknown_0203CC70: @ 203CC70
|
||||
.space 0x10
|
||||
|
||||
gUnknown_0203CC80: @ 203CC80
|
||||
.space 0x4
|
||||
|
||||
gUnknown_0203CC84: @ 203CC84
|
||||
.space 0x4C
|
||||
|
||||
gUnknown_0203CCD0: @ 203CCD0
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203CCD1: @ 203CCD1
|
||||
.space 0x8
|
||||
|
||||
gUnknown_0203CCD9: @ 203CCD9
|
||||
.space 0x1
|
||||
|
||||
gUnknown_0203CCDA: @ 203CCDA
|
||||
.space 0x2
|
||||
|
||||
gUnknown_0203CCDC: @ 203CCDC
|
||||
.space 0xC
|
||||
|
||||
gUnknown_0203CCE8: @ 203CCE8
|
||||
.space 0x4
|
||||
|
||||
.include "src/recorded_battle.o"
|
||||
.include "src/battle_dome_cards.o"
|
||||
.include "src/lilycove_lady.o"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user