why is this function so hard to match

This commit is contained in:
DizzyEggg 2018-10-30 21:45:26 +01:00
parent 3a9eeef844
commit 0da7d7e6ae
8 changed files with 204 additions and 609 deletions

View File

@ -7,590 +7,6 @@
thumb_func_start sub_81A4B14
sub_81A4B14: @ 81A4B14
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
movs r1, 0
ldr r3, =gSaveBlock2Ptr
_081A4B24:
movs r6, 0
lsls r0, r1, 1
adds r2, r1, 0x1
mov r10, r2
adds r0, r1
lsls r0, 5
mov r8, r0
movs r7, 0
movs r0, 0x87
lsls r0, 2
add r0, r8
mov r9, r0
_081A4B3C:
movs r5, 0
adds r2, r7, 0
mov r1, r8
adds r4, r7, r1
_081A4B44:
ldr r0, [r3]
add r0, r9
adds r0, r2
lsls r1, r5, 4
adds r0, r1
movs r1, 0
str r2, [sp]
str r3, [sp, 0x4]
bl CopyUnalignedWord
ldr r3, [sp, 0x4]
ldr r0, [r3]
adds r0, r4
ldr r1, =0x00000222
adds r0, r1
movs r1, 0xFF
strb r1, [r0]
ldr r0, [r3]
adds r0, r4
movs r1, 0x88
lsls r1, 2
adds r0, r1
movs r1, 0
strh r1, [r0]
adds r4, 0x10
adds r5, 0x1
ldr r2, [sp]
cmp r5, 0x2
ble _081A4B44
adds r7, 0x30
adds r6, 0x1
cmp r6, 0x1
ble _081A4B3C
mov r1, r10
cmp r1, 0x8
ble _081A4B24
movs r6, 0
ldr r7, =gSaveBlock2Ptr
movs r2, 0x54
mov r10, r2
movs r3, 0xFF
mov r9, r3
_081A4B98:
adds r0, r6, 0x1
mov r8, r0
mov r1, r10
muls r1, r6
movs r0, 0x54
adds r4, r6, 0
muls r4, r0
movs r2, 0
ldr r3, =0x0000057c
adds r6, r1, r3
movs r5, 0x2
_081A4BAE:
ldr r0, [r7]
adds r0, r6
adds r0, r2
movs r1, 0
str r2, [sp]
bl CopyUnalignedWord
ldr r0, [r7]
adds r0, r6
ldr r2, [sp]
adds r0, r2
adds r0, 0x4
movs r1, 0
bl CopyUnalignedWord
ldr r1, [r7]
adds r1, r4
ldr r0, =0x00000586
adds r1, r0
ldrb r0, [r1]
mov r3, r9
orrs r0, r3
strb r0, [r1]
ldr r1, [r7]
adds r1, r4
ldr r0, =0x0000058e
adds r1, r0
ldrb r0, [r1]
orrs r0, r3
strb r0, [r1]
ldr r0, [r7]
adds r0, r4
ldr r1, =0x00000584
adds r0, r1
movs r1, 0
strh r1, [r0]
adds r4, 0x1C
ldr r2, [sp]
adds r2, 0x1C
subs r5, 0x1
cmp r5, 0
bge _081A4BAE
mov r6, r8
cmp r6, 0x1
ble _081A4B98
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A4B14
thumb_func_start sub_81A4C30
sub_81A4C30: @ 81A4C30
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r0, 0x96
lsls r0, 2
bl AllocZeroed
adds r7, r0, 0
adds r4, r7, 0
movs r5, 0
movs r0, 0xFA
lsls r0, 1
adds r6, r7, r0
ldr r0, =gPlayerParty
mov r8, r0
_081A4C4E:
mov r0, r8
adds r1, r5, r0
adds r0, r4, 0
movs r2, 0x64
bl memcpy
adds r4, 0x64
adds r5, 0x64
cmp r4, r6
ble _081A4C4E
ldr r4, =gPlayerPartyCount
ldrb r5, [r4]
bl LoadPlayerParty
bl sub_8076D5C
movs r0, 0x1
bl TrySavingData
bl sav2_gender2_inplace_and_xFE
strb r5, [r4]
adds r4, r7, 0
ldr r5, =gPlayerParty
movs r0, 0xFA
lsls r0, 1
adds r6, r7, r0
_081A4C84:
adds r0, r5, 0
adds r1, r4, 0
movs r2, 0x64
bl memcpy
adds r4, 0x64
adds r5, 0x64
cmp r4, r6
ble _081A4C84
adds r0, r7, 0
bl Free
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A4C30
thumb_func_start GetFrontierBrainTrainerPicIndex
GetFrontierBrainTrainerPicIndex: @ 81A4CB0
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
ands r0, r1
cmp r0, 0
beq _081A4CD0
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r0, 24
b _081A4CDA
.pool
_081A4CD0:
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r0, 16
_081A4CDA:
ldr r2, =gTrainers
ldr r1, =gFacilityToBrainTrainerId
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
ldrb r0, [r0, 0x3]
pop {r1}
bx r1
.pool
thumb_func_end GetFrontierBrainTrainerPicIndex
thumb_func_start GetFrontierBrainTrainerClass
GetFrontierBrainTrainerClass: @ 81A4D00
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
ands r0, r1
cmp r0, 0
beq _081A4D20
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r0, 24
b _081A4D2A
.pool
_081A4D20:
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r0, 16
_081A4D2A:
ldr r2, =gTrainers
ldr r1, =gFacilityToBrainTrainerId
lsls r0, 1
adds r0, r1
ldrh r1, [r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
ldrb r0, [r0, 0x1]
pop {r1}
bx r1
.pool
thumb_func_end GetFrontierBrainTrainerClass
thumb_func_start CopyFrontierBrainTrainerName
CopyFrontierBrainTrainerName: @ 81A4D50
push {r4,lr}
adds r4, r0, 0
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x80
lsls r1, 17
ands r0, r1
cmp r0, 0
beq _081A4D70
bl GetRecordedBattleFrontierFacility
lsls r0, 24
lsrs r0, 24
b _081A4D7A
.pool
_081A4D70:
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r0, 16
_081A4D7A:
movs r3, 0
lsls r0, 1
ldr r2, =gTrainers
ldr r1, =gFacilityToBrainTrainerId
adds r0, r1
ldrh r1, [r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r2, 0x4
adds r2, r0, r2
_081A4D90:
adds r1, r4, r3
ldrb r0, [r2]
strb r0, [r1]
adds r2, 0x1
adds r3, 0x1
cmp r3, 0x6
ble _081A4D90
adds r1, r4, r3
movs r0, 0xFF
strb r0, [r1]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end CopyFrontierBrainTrainerName
thumb_func_start IsFrontierBrainFemale
IsFrontierBrainFemale: @ 81A4DB8
push {lr}
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
ldr r1, =gUnknown_08611C8C
lsrs r0, 15
adds r1, 0x1
adds r0, r1
ldrb r0, [r0]
pop {r1}
bx r1
.pool
thumb_func_end IsFrontierBrainFemale
thumb_func_start SetFrontierBrainTrainerGfxId
SetFrontierBrainTrainerGfxId: @ 81A4DD8
push {lr}
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
ldr r2, =0x00004010
ldr r1, =gUnknown_08611C8C
lsrs r0, 15
adds r0, r1
ldrb r1, [r0]
adds r0, r2, 0
bl VarSet
pop {r0}
bx r0
.pool
thumb_func_end SetFrontierBrainTrainerGfxId
thumb_func_start CreateFrontierBrainPokemon
CreateFrontierBrainPokemon: @ 81A4E04
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x44
ldr r0, =0x000040cf
bl VarGet
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x20]
bl sub_81A513C
str r0, [sp, 0x24]
ldr r0, [sp, 0x20]
cmp r0, 0x1
bne _081A4E44
ldr r0, =0x000003fe
bl TrainerIdToDomeTournamentId
lsls r0, 16
lsrs r0, 16
bl GetTrainerMonCountInBits
adds r4, r0, 0
b _081A4E46
.pool
_081A4E44:
movs r4, 0x7
_081A4E46:
bl ZeroEnemyPartyMons
movs r1, 0
str r1, [sp, 0x18]
bl SetFacilityPtrsGetLevel
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x1C]
movs r2, 0
str r2, [sp, 0x14]
_081A4E5C:
movs r0, 0x1
ands r0, r4
asrs r4, 1
str r4, [sp, 0x30]
ldr r3, [sp, 0x14]
adds r3, 0x1
str r3, [sp, 0x28]
cmp r0, 0
bne _081A4E70
b _081A4FC4
_081A4E70:
ldr r4, [sp, 0x14]
lsls r4, 2
mov r9, r4
ldr r0, [sp, 0x24]
lsls r0, 4
str r0, [sp, 0x38]
ldr r1, [sp, 0x20]
lsls r1, 4
str r1, [sp, 0x34]
ldr r2, [sp, 0x1C]
lsls r2, 24
str r2, [sp, 0x3C]
ldr r3, [sp, 0x18]
adds r3, 0x1
str r3, [sp, 0x2C]
ldr r0, [sp, 0x14]
add r0, r9
lsls r0, 2
mov r8, r0
_081A4E96:
bl Random
adds r4, r0, 0
bl Random
lsls r4, 16
lsrs r7, r4, 16
lsls r0, 16
orrs r7, r0
ldr r0, =0x0000ef2a
adds r1, r7, 0
bl IsShinyOtIdPersonality
lsls r0, 24
cmp r0, 0
bne _081A4E96
ldr r4, [sp, 0x38]
ldr r1, [sp, 0x24]
subs r0, r4, r1
lsls r5, r0, 2
mov r2, r8
adds r4, r2, r5
ldr r3, [sp, 0x34]
ldr r1, [sp, 0x20]
subs r0, r3, r1
lsls r6, r0, 3
adds r4, r6
ldr r2, =gUnknown_0861156C
adds r4, r2
adds r0, r7, 0
bl GetNatureFromPersonality
ldrb r1, [r4, 0x5]
lsls r0, 24
lsrs r0, 24
cmp r1, r0
bne _081A4E96
ldr r4, [sp, 0x18]
movs r0, 0x64
adds r3, r4, 0
muls r3, r0
mov r8, r3
ldr r1, =gEnemyParty
add r1, r8
mov r10, r1
ldr r4, [sp, 0x14]
add r4, r9
lsls r4, 2
adds r0, r4, r5
adds r0, r6
ldr r2, =gUnknown_0861156C
adds r0, r2
ldrh r1, [r0]
ldr r3, [sp, 0x3C]
lsrs r2, r3, 24
ldrb r3, [r0, 0x4]
movs r0, 0x1
str r0, [sp]
str r7, [sp, 0x4]
str r0, [sp, 0x8]
ldr r0, =0x0000ef2a
str r0, [sp, 0xC]
mov r0, r10
bl CreateMon
ldr r0, =gUnknown_0861156C
adds r5, r0
adds r5, r6, r5
adds r4, r5, r4
adds r4, 0x2
mov r0, r10
movs r1, 0xC
adds r2, r4, 0
bl SetMonData
movs r7, 0
mov r6, r8
ldr r3, =gEnemyParty
_081A4F32:
adds r1, r7, 0
adds r1, 0x1A
ldr r0, [sp, 0x14]
add r0, r9
lsls r4, r0, 2
adds r2, r5, r4
adds r0, r7, 0x6
adds r2, r0
adds r0, r6, r3
str r3, [sp, 0x40]
bl SetMonData
adds r7, 0x1
ldr r3, [sp, 0x40]
cmp r7, 0x5
ble _081A4F32
movs r1, 0xFF
add r0, sp, 0x10
strb r1, [r0]
movs r7, 0
ldr r1, [sp, 0x18]
movs r2, 0x64
adds r6, r1, 0
muls r6, r2
ldr r3, =gUnknown_08611578
mov r8, r3
ldr r3, =gEnemyParty
adds r5, r4, 0
_081A4F6A:
ldr r4, [sp, 0x38]
ldr r0, [sp, 0x24]
subs r1, r4, r0
lsls r1, 2
adds r1, r5, r1
ldr r2, [sp, 0x34]
ldr r4, [sp, 0x20]
subs r0, r2, r4
lsls r0, 3
adds r1, r0
add r1, r8
ldrh r4, [r1]
lsls r2, r7, 24
lsrs r2, 24
adds r0, r6, r3
adds r1, r4, 0
str r3, [sp, 0x40]
bl SetMonMoveSlot
ldr r3, [sp, 0x40]
cmp r4, 0xDA
bne _081A4F9C
movs r1, 0
add r0, sp, 0x10
strb r1, [r0]
_081A4F9C:
adds r5, 0x2
adds r7, 0x1
cmp r7, 0x3
ble _081A4F6A
ldr r0, [sp, 0x18]
movs r1, 0x64
adds r4, r0, 0
muls r4, r1
ldr r0, =gEnemyParty
adds r4, r0
adds r0, r4, 0
movs r1, 0x20
add r2, sp, 0x10
bl SetMonData
adds r0, r4, 0
bl CalculateMonStats
ldr r2, [sp, 0x2C]
str r2, [sp, 0x18]
_081A4FC4:
ldr r4, [sp, 0x30]
ldr r3, [sp, 0x28]
str r3, [sp, 0x14]
cmp r3, 0x2
bgt _081A4FD0
b _081A4E5C
_081A4FD0:
add sp, 0x44
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end CreateFrontierBrainPokemon
thumb_func_start sub_81A4FF0
sub_81A4FF0: @ 81A4FF0
push {r4,r5,lr}
@ -603,7 +19,7 @@ sub_81A4FF0: @ 81A4FF0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r3, =gUnknown_0861156C
ldr r3, =sFrontierBrainsMons
lsls r2, r4, 2
adds r2, r4
lsls r1, r0, 4
@ -657,7 +73,7 @@ sub_81A5060: @ 81A5060
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r2, =gUnknown_0861156C
ldr r2, =sFrontierBrainsMons
lsls r4, 1
lsls r1, r6, 2
adds r1, r6
@ -692,7 +108,7 @@ sub_81A50B0: @ 81A50B0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r3, =gUnknown_0861156C
ldr r3, =sFrontierBrainsMons
lsls r2, r4, 2
adds r2, r4
lsls r1, r0, 4
@ -726,7 +142,7 @@ sub_81A50F0: @ 81A50F0
lsls r5, 16
lsrs r5, 16
bl sub_81A513C
ldr r2, =gUnknown_0861156C
ldr r2, =sFrontierBrainsMons
lsls r1, r6, 2
adds r1, r6
lsls r1, 2

View File

@ -8,7 +8,7 @@
.align 2
gUnknown_0861156C:: @ 861156C
sFrontierBrainsMons:: @ 861156C
.byte 0x41, 0x00, 0xb3, 0x00, 0x18, 0x0f, 0x6a, 0x00, 0x98, 0x98, 0x64, 0x00
.align 2

View File

@ -17,5 +17,6 @@ bool8 sub_81A6BF4(void);
u8 sub_81A6CA8(u8, u8);
void sub_81A3908(void);
u32 GetCurrentFacilityWinStreak(void);
void ClearnRankingHallRecords(void);
#endif // GUARD_FRONTIER_UTIL_H

View File

@ -94,7 +94,7 @@ u16 CalculateChecksum(void *data, u16 size);
void UpdateSaveAddresses(void);
u8 HandleSavingData(u8 saveType);
u8 TrySavingData(u8 saveType);
u8 sub_8153380(void);
bool8 sub_8153380(void);
bool8 sub_81533AC(void);
u8 sub_81533E0(void);
u8 sub_8153408(void);

View File

@ -10,7 +10,7 @@
#include "international_string_util.h"
#include "battle.h"
#include "battle_frontier_1.h"
#include "battle_frontier_2.h"
#include "frontier_util.h"
#include "recorded_battle.h"
#include "easy_chat.h"
#include "gym_leader_rematch.h"

View File

@ -25,6 +25,9 @@
#include "record_mixing.h"
#include "strings.h"
#include "malloc.h"
#include "save.h"
#include "load_save.h"
#include "battle_dome.h"
#include "constants/battle_frontier.h"
#include "constants/trainers.h"
#include "constants/species.h"
@ -1656,3 +1659,174 @@ void ScrollRankingHallRecordsWindow(void)
PrintHallRecords(gSpecialVar_0x8005, FRONTIER_LVL_OPEN);
CopyWindowToVram(gRecordsWindowId, 2);
}
void ClearnRankingHallRecords(void)
{
s32 i, j, k;
for (i = 0; i < HALL_FACILITIES_COUNT; i++)
{
for (j = 0; j < 2; j++)
{
for (k = 0; k < 3; k++)
{
CopyUnalignedWord(gSaveBlock2Ptr->hallRecords1P[i][j][k].id, 0); // BUG: Passing 0 as a pointer instead of a pointer holding a value of 0.
gSaveBlock2Ptr->hallRecords1P[i][j][k].name[0] = EOS;
gSaveBlock2Ptr->hallRecords1P[i][j][k].winStreak = 0;
}
}
}
for (j = 0; j < 2; j++)
{
for (k = 0; k < 3; k++)
{
CopyUnalignedWord(gSaveBlock2Ptr->hallRecords2P[j][k].id1, 0); // BUG: Passing 0 as a pointer instead of a pointer holding a value of 0.
CopyUnalignedWord(gSaveBlock2Ptr->hallRecords2P[j][k].id2, 0); // BUG: Passing 0 as a pointer instead of a pointer holding a value of 0.
gSaveBlock2Ptr->hallRecords2P[j][k].name1[0] = EOS;
gSaveBlock2Ptr->hallRecords2P[j][k].name2[0] = EOS;
gSaveBlock2Ptr->hallRecords2P[j][k].winStreak = 0;
}
}
}
void sub_81A4C30(void)
{
s32 i;
struct Pokemon *monsParty = calloc(PARTY_SIZE, sizeof(struct Pokemon));
for (i = 0; i < PARTY_SIZE; i++)
monsParty[i] = gPlayerParty[i];
i = gPlayerPartyCount;
LoadPlayerParty();
sub_8076D5C();
TrySavingData(SAVE_LINK);
sav2_gender2_inplace_and_xFE();
gPlayerPartyCount = i;
for (i = 0; i < PARTY_SIZE; i++)
gPlayerParty[i] = monsParty[i];
free(monsParty);
}
extern const u16 gFacilityToBrainTrainerId[];
extern const u8 gUnknown_08611C8C[][2];
u8 GetFrontierBrainTrainerPicIndex(void)
{
s32 facility;
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facility = GetRecordedBattleFrontierFacility();
else
facility = VarGet(VAR_FRONTIER_FACILITY);
return gTrainers[gFacilityToBrainTrainerId[facility]].trainerPic;
}
u8 GetFrontierBrainTrainerClass(void)
{
s32 facility;
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facility = GetRecordedBattleFrontierFacility();
else
facility = VarGet(VAR_FRONTIER_FACILITY);
return gTrainers[gFacilityToBrainTrainerId[facility]].trainerClass;
}
void CopyFrontierBrainTrainerName(u8 *dst)
{
s32 i;
s32 facility;
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
facility = GetRecordedBattleFrontierFacility();
else
facility = VarGet(VAR_FRONTIER_FACILITY);
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
dst[i] = gTrainers[gFacilityToBrainTrainerId[facility]].trainerName[i];
dst[i] = EOS;
}
bool8 IsFrontierBrainFemale(void)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
return gUnknown_08611C8C[facility][1];
}
void SetFrontierBrainTrainerGfxId(void)
{
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
VarSet(VAR_OBJ_GFX_ID_0, gUnknown_08611C8C[facility][0]);
}
s32 sub_81A513C(void);
#define FRONTIER_BRAIN_OTID 61226
struct FrontierBrainMon
{
u16 species;
u16 heldItem;
u8 fixedIV;
u8 nature;
u8 evs[6];
u16 moves[4];
};
extern const struct FrontierBrainMon sFrontierBrainsMons[][2][3];
void CreateFrontierBrainPokemon(void)
{
s32 i, j;
s32 monCountInBits;
s32 monPartyId;
s32 monLevel;
u8 friendship;
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
s32 symbol = sub_81A513C();
if (facility == FRONTIER_FACILITY_DOME)
monCountInBits = GetTrainerMonCountInBits(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
else
monCountInBits = 7;
ZeroEnemyPartyMons();
monPartyId = 0;
monLevel = SetFacilityPtrsGetLevel();
for (i = 0; i < 3; monCountInBits >>= 1, i++)
{
if (!(monCountInBits & 1))
continue;
do
{
j = Random32();
} while (IsShinyOtIdPersonality(FRONTIER_BRAIN_OTID, j) || sFrontierBrainsMons[facility][symbol][i].nature != GetNatureFromPersonality(j));
CreateMon(&gEnemyParty[monPartyId],
sFrontierBrainsMons[facility][symbol][i].species,
monLevel,
sFrontierBrainsMons[facility][symbol][i].fixedIV,
TRUE, j,
TRUE, FRONTIER_BRAIN_OTID);
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HELD_ITEM, &sFrontierBrainsMons[facility][symbol][i].heldItem);
for (j = 0; j < 6; j++)
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HP_EV + j, &sFrontierBrainsMons[facility][symbol][i].evs[j]);
friendship = 0xFF;
for (j = 0; j < 4; j++)
{
SetMonMoveSlot(&gEnemyParty[monPartyId], sFrontierBrainsMons[facility][symbol][i].moves[j], j);
if (sFrontierBrainsMons[facility][symbol][i].moves[j] == MOVE_FRUSTRATION)
friendship = 0;
}
SetMonData(&gEnemyParty[monPartyId], MON_DATA_FRIENDSHIP, &friendship);
CalculateMonStats(&gEnemyParty[monPartyId]);
monPartyId++;
}
}

View File

@ -26,6 +26,7 @@
#include "item.h"
#include "pokedex.h"
#include "apprentice.h"
#include "frontier_util.h"
extern u8 gDifferentSaveFile;
extern u16 gSaveFileStatus;
@ -45,7 +46,6 @@ extern void NewGameInitPCItems(void);
extern void ClearDecorationInventories(void);
extern void ResetFanClub(void);
extern void copy_strings_to_sav1(void);
extern void sub_81A4B14(void);
extern void sub_8195E10(void);
extern void sub_801AFD8(void);
extern void sub_800E5AC(void);
@ -204,7 +204,7 @@ void NewGameInitData(void)
copy_strings_to_sav1();
SetLilycoveLady();
ResetAllApprenticeData();
sub_81A4B14();
ClearnRankingHallRecords();
sub_8195E10();
sub_801AFD8();
sub_800E5AC();

View File

@ -712,30 +712,34 @@ u8 HandleSavingData(u8 saveType)
u8 TrySavingData(u8 saveType) // TrySave
{
if(gFlashMemoryPresent == TRUE)
if (gFlashMemoryPresent != TRUE)
{
HandleSavingData(saveType);
if(gDamagedSaveSectors)
DoSaveFailedScreen(saveType);
else
goto OK; // really?
}
gUnknown_03006294 = 0xFF;
return 0xFF;
}
OK:
HandleSavingData(saveType);
if (!gDamagedSaveSectors)
{
gUnknown_03006294 = 1;
return 1;
}
else
{
DoSaveFailedScreen(saveType);
gUnknown_03006294 = 0xFF;
return 0xFF;
}
}
u8 sub_8153380(void) // trade.s save
bool8 sub_8153380(void) // trade.s save
{
if (gFlashMemoryPresent != TRUE)
return 1;
return TRUE;
UpdateSaveAddresses();
SaveSerializedGame();
RestoreSaveBackupVarsAndIncrement(gRamSaveSectionLocations);
return 0;
return FALSE;
}
bool8 sub_81533AC(void) // trade.s save
@ -744,9 +748,9 @@ bool8 sub_81533AC(void) // trade.s save
if (gDamagedSaveSectors)
DoSaveFailedScreen(0);
if (retVal == 0xFF)
return 1;
return TRUE;
else
return 0;
return FALSE;
}
u8 sub_81533E0(void) // trade.s save