more of recorded battle done

This commit is contained in:
DizzyEggg 2017-11-13 18:07:23 +01:00
parent 3b43668286
commit 209b6eb467
14 changed files with 1456 additions and 2097 deletions

View File

@ -25722,7 +25722,7 @@ sub_81D3AD8: @ 81D3AD8
adds r5, r0, 0 adds r5, r0, 0
adds r4, r1, 0 adds r4, r1, 0
movs r0, 0x1E movs r0, 0x1E
bl sub_81535DC bl TryCopySpecialSaveSection
cmp r0, 0x1 cmp r0, 0x1
bne _081D3B04 bne _081D3B04
ldr r2, =0x00000ee8 ldr r2, =0x00000ee8

File diff suppressed because it is too large Load Diff

View File

@ -5000,7 +5000,7 @@ _080C5240:
adds r0, r2 adds r0, r2
ldrh r0, [r0] ldrh r0, [r0]
strh r0, [r1, 0x6] strh r0, [r1, 0x6]
bl sub_8185290 bl CanCopyRecordedBattleSaveData
ldr r3, [r5] ldr r3, [r5]
movs r1, 0x1 movs r1, 0x1
ands r0, r1 ands r0, r1
@ -5825,7 +5825,7 @@ _080C5970:
strh r0, [r1, 0x6] strh r0, [r1, 0x6]
bl sub_80C52E4 bl sub_80C52E4
ldr r0, =sub_80C58D4 ldr r0, =sub_80C58D4
bl sub_8185E24 bl PlayRecordedBattle
b _080C599A b _080C599A
.pool .pool
_080C5994: _080C5994:

View File

@ -169,6 +169,26 @@ struct BerryCrush
#define PLAYER_NAME_LENGTH 8 #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 struct SaveBlock2
{ {
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH]; /*0x00*/ u8 playerName[PLAYER_NAME_LENGTH];
@ -203,7 +223,8 @@ struct SaveBlock2
// All below could be a one giant struct // 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; /*0xBD4*/ u16 field_BD4;
/*0xBD6*/ u16 field_BD6; /*0xBD6*/ u16 field_BD6;
/*0xBD8*/ u8 field_BD8[11]; /*0xBD8*/ u8 field_BD8[11];
@ -220,7 +241,7 @@ struct SaveBlock2
/*0xCAA*/ u16 field_CAA[0x2e]; /*0xCAA*/ u16 field_CAA[0x2e];
/*0xD06*/ u8 field_D06; /*0xD06*/ u8 field_D06;
/*0xD07*/ u8 field_D07; /*0xD07*/ u8 field_D07;
/*0xd08*/ u8 filler_D08[0x112]; /*0xD08*/ u8 filler_D08[0x112];
/*0xE1A*/ u16 battlePyramidFloor; // possibly? /*0xE1A*/ u16 battlePyramidFloor; // possibly?
/*0xE1C*/ u8 field_E1C[16]; /*0xE1C*/ u8 field_E1C[16];
/*0xE2C*/ struct PyramidBag pyramidBag; /*0xE2C*/ struct PyramidBag pyramidBag;

View File

@ -68,7 +68,7 @@ struct LinkPlayer
/* 0x08 */ u8 name[11]; /* 0x08 */ u8 name[11];
/* 0x13 */ u8 gender; /* 0x13 */ u8 gender;
/* 0x14 */ u32 linkType; /* 0x14 */ u32 linkType;
/* 0x18 */ u16 lp_field_18; /* 0x18 */ u16 lp_field_18; // battle bank in battles
/* 0x1A */ u16 language; /* 0x1A */ u16 language;
}; };

View File

@ -12,13 +12,14 @@ void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear);
void sub_8185F90(u16 arg0); void sub_8185F90(u16 arg0);
bool8 sub_8186450(void); bool8 sub_8186450(void);
u8 sub_8185FAC(void); u8 sub_8185FAC(void);
u8 sub_8185FB8(void); u8 GetBattleStyleInRecordedBattle(void);
u8 MoveRecordedBattleToSaveData(void); u32 MoveRecordedBattleToSaveData(void);
void sub_818603C(u8); void sub_818603C(u8);
void sub_8185FD0(void); void RecordedBattle_CopyBankMoves(void);
void sub_8186444(void); void sub_8186444(void);
void sub_8185EB8(void); void sub_8185EB8(void);
u8 sub_81850DC(u8 *arg0); u8 sub_81850DC(u8 *arg0);
u8 sub_8185F40(void); u8 GetActiveBankLinkPlayerGender(void);
void RecordedBattle_SaveParties(void);
#endif // GUARD_RECORDED_BATTLE_H #endif // GUARD_RECORDED_BATTLE_H

View File

@ -56,41 +56,42 @@ enum
HOF_DELETE_SAVE // unused HOF_DELETE_SAVE // unused
}; };
#define SECTION_ID_RECORDED_BATTLE 31
void ClearSaveData(void); void ClearSaveData(void);
void ResetSaveCounters(void); void ResetSaveCounters(void);
//bool32 ManipulateSectorBits(u8 op, u8 bit); bool32 SetDamagedSectorBits(u8 op, u8 bit);
//u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *a2); u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location);
u8 HandleWriteSector(u16, const struct SaveSectionLocation *); u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location);
//u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size); u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size);
u8 TryWriteSector(u8, u8 *); u8 TryWriteSector(u8 sector, u8 *data);
//u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location); u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location);
//u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location); u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location);
//u8 sub_812550C(u16 a1, const struct SaveSectionLocation *location); u8 sub_81529D4(u16 a1, const struct SaveSectionLocation *location);
u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location); u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location);
u8 ClearSaveData_2(u16, const struct SaveSectionLocation *location); u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location);
//u8 sub_8125758(u16 a1, const struct SaveSectionLocation *location); u8 sav12_xor_get(u16 a1, const struct SaveSectionLocation *location);
//u8 sub_81257F0(u16 a1, const struct SaveSectionLocation *location); u8 sub_8152CAC(u16 a1, const struct SaveSectionLocation *location);
//u8 sub_812587C(u16 a1, const struct SaveSectionLocation *location); u8 sub_8152D44(u16 a1, const struct SaveSectionLocation *location);
u8 sub_8152E10(u16, 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 GetSaveValidStatus(const struct SaveSectionLocation *location);
//u8 sub_8125B88(u8 a1, u8 *data, u16 size); u8 sub_81530DC(u8 a1, u8 *data, u16 size);
u8 DoReadFlashWholeSection(u8, struct SaveSection *); u8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section);
u16 CalculateChecksum(void *, u16); u16 CalculateChecksum(void *data, u16 size);
void UpdateSaveAddresses(void);
u8 HandleSavingData(u8 saveType); u8 HandleSavingData(u8 saveType);
//u8 TrySavingData(u8 saveType); u8 TrySavingData(u8 saveType);
//u8 sub_8125D80(void); u8 sub_8153380(void);
//bool8 sub_8125DA8(void); bool8 sub_81533AC(void);
//u8 sub_8125DDC(void); u8 sub_81533E0(void);
//u8 sub_8125E04(void); u8 sub_8153408(void);
//u8 sub_8125E2C(void); u8 sub_8153430(void);
//bool8 sub_8125E6C(void); bool8 sub_8153474(void);
//u8 sub_8125EC8(u8 a1); u8 sub_81534D0(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);
u16 sub_815355C(void); 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 #endif // GUARD_SAVE_H

View File

@ -2811,7 +2811,7 @@ static void BattleStartClearSetData(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && gSaveBlock2Ptr->optionsBattleSceneOff == TRUE) if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && gSaveBlock2Ptr->optionsBattleSceneOff == TRUE)
gHitMarker |= HITMARKER_NO_ANIMATIONS; 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; gHitMarker |= HITMARKER_NO_ANIMATIONS;
gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle;
@ -3928,7 +3928,7 @@ static void HandleTurnActionSelectionState(void)
switch (gBattleCommunication[gActiveBank]) switch (gBattleCommunication[gActiveBank])
{ {
case STATE_TURN_START_RECORD: // recorded battle related on start of every turn case STATE_TURN_START_RECORD: // recorded battle related on start of every turn
sub_8185FD0(); RecordedBattle_CopyBankMoves();
gBattleCommunication[gActiveBank] = STATE_BEFORE_ACTION_CHOSEN; gBattleCommunication[gActiveBank] = STATE_BEFORE_ACTION_CHOSEN;
break; break;
case STATE_BEFORE_ACTION_CHOSEN: // choose an action case STATE_BEFORE_ACTION_CHOSEN: // choose an action

View File

@ -1261,7 +1261,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
} }
else else
{ {
trainerPicId = PlayerGenderToFrontTrainerPicId(sub_8185F40()); trainerPicId = PlayerGenderToFrontTrainerPicId(GetActiveBankLinkPlayerGender());
} }
} }
else else

View File

@ -1229,7 +1229,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_x2000000) if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
trainerPicId = sub_8185F40(); trainerPicId = GetActiveBankLinkPlayerGender();
else else
trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender; trainerPicId = gLinkPlayers[gUnknown_0203C7B4].gender;
} }

View File

@ -113,7 +113,7 @@ void sub_8032768(void)
sub_8184DA4(2); sub_8184DA4(2);
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
sub_8185EB8(); RecordedBattle_SaveParties();
if (gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_LINK)
SetControllersVariablesInLinkBattle(); SetControllersVariablesInLinkBattle();

View File

@ -58,7 +58,7 @@ extern const u8* GetTrainer1LoseText(void); // battle_setup
extern const u8* GetTrainer2LoseText(void); // battle_setup extern const u8* GetTrainer2LoseText(void); // battle_setup
extern void GetFrontierTrainerName(u8 *dst, u16 trainerId); extern void GetFrontierTrainerName(u8 *dst, u16 trainerId);
extern s32 GetStringCenterAlignXOffsetWithLetterSpacing(u8 fontId, const u8 *str, s32 totalWidth, s16 letterSpacing); 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); extern u8 sav2_get_text_speed(void);
// this file's functions // this file's functions
@ -2264,7 +2264,7 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1)
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
speed = 1; speed = 1;
else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
speed = sRecordedBattleTextSpeeds[sub_8185FC4()]; speed = sRecordedBattleTextSpeeds[GetTextSpeedInRecordedBattle()];
else else
speed = sav2_get_text_speed(); speed = sav2_get_text_speed();

File diff suppressed because it is too large Load Diff

View File

@ -797,7 +797,7 @@ u16 sub_815355C(void)
return 0; return 0;
} }
u32 sub_81535DC(u8 sector, u8* dst) u32 TryCopySpecialSaveSection(u8 sector, u8* dst)
{ {
s32 i; s32 i;
s32 size; s32 size;
@ -826,6 +826,7 @@ u32 sub_8153634(u8 sector, u8* src)
if (sector != 30 && sector != 31) if (sector != 30 && sector != 31)
return 0xFF; return 0xFF;
savDataBuffer = &gSaveDataBuffer; savDataBuffer = &gSaveDataBuffer;
*(u32*)(savDataBuffer) = 0xB39D; *(u32*)(savDataBuffer) = 0xB39D;