Document overlay 36

This commit is contained in:
PikalaxALT 2022-03-13 12:14:35 -04:00
parent fa8953bb1a
commit 812d538f25
11 changed files with 80 additions and 74 deletions

View File

@ -312,7 +312,7 @@ ov53_OakSpeech_OvyExit: ; 0x021E5B48
add r0, r5, #0
bl DestroyHeap
ldr r0, _021E5BC4 ; =FS_OVERLAY_ID(OVY_36)
ldr r1, _021E5BC8 ; =ov36_021E5C14
ldr r1, _021E5BC8 ; =ov36_App_InitGameState_AfterOakSpeech
bl RegisterMainOverlay
mov r0, #0
bl sub_02002B8C
@ -320,7 +320,7 @@ ov53_OakSpeech_OvyExit: ; 0x021E5B48
pop {r4, r5, r6, pc}
nop
_021E5BC4: .word FS_OVERLAY_ID(OVY_36)
_021E5BC8: .word ov36_021E5C14
_021E5BC8: .word ov36_App_InitGameState_AfterOakSpeech
thumb_func_end ov53_OakSpeech_OvyExit
thumb_func_start ov53_021E5BCC

View File

@ -367,7 +367,7 @@ _021E5BD0:
add r0, r6, #0
add r1, r4, r1
lsr r2, r2, #0x18
bl Mail_CopyToUnk20Array
bl Mail_SetMessage
add r0, r5, #1
lsl r0, r0, #0x10
lsr r5, r0, #0x10

View File

@ -841,7 +841,7 @@
.public MailMsg_init_fromTemplate
.public MailMsg_init_withBank
.public MailToItemId
.public Mail_CopyToUnk20Array
.public Mail_SetMessage
.public Mail_GetAuthorGender
.public Mail_GetAuthorNamePtr
.public Mail_GetLanguage
@ -14524,19 +14524,19 @@ FS_EXTERN_OVERLAY(OV_101)
.public ov34_0225E630
.public ov35_02259D80
.public ov35_02259DB8
.public ov36_021E5900
.public ov36_021E5918
.public ov36_TitleScreen_SwitchToNewGame
.public ov36_TitleScreen_NewGame_AppInit
.public ov36_TitleScreen_NewGame_AppExec
.public ov36_TitleScreen_NewGame_AppExit
.public ov36_021E5948
.public ov36_021E5960
.public ov36_021E5980
.public ov36_021E599C
.public ov36_021E59B4
.public ov36_021E5A1C
.public ov36_App_MainMenu_SelectOption_Continue_AppInit
.public ov36_App_MainMenu_SelectOption_Continue_AppExec
.public ov36_App_MainMenu_SelectOption_Continue_AppExit
.public ov36_021E5A38
.public ov36_021E5BB4
.public ov36_021E5BC8
.public ov36_021E5C14
.public ov36_App_InitGameState_AfterOakSpeech
.public ov37_021E5900
.public ov37_021E5A84
.public ov37_021E5B94
@ -27204,7 +27204,7 @@ FS_EXTERN_OVERLAY(OV_101)
.public sub_020271A0
.public SaveBlock2_get
.public Save_DeleteAllData
.public sub_020273B0
.public SaveData_TryLoadOnContinue
.public SaveGameNormal
.public Save_NowWriteFile_AfterMGInit
.public Save_FlashChipIsDetected
@ -27230,7 +27230,7 @@ FS_EXTERN_OVERLAY(OV_101)
.public Sav2_SysInfo_SetField4C
.public sub_02028E1C
.public Sav2_SysInfo_RTC_SubField34
.public sub_02028E4C
.public SysInfoRTC_HandleContinueOnNewConsole
.public sub_02029084
.public sub_020290B4
.public sub_020290B8

View File

@ -27,7 +27,7 @@ u8 Mail_GetLanguage(const MAIL *mail);
u8 Mail_GetVersion(const MAIL *mail);
u16 sub_0202B404(MAIL *mail, u8 r1, u8 r4, u16 r3);
u16 sub_0202B4E4(const MAIL *mail);
void Mail_CopyToUnk20Array(MAIL *mail, const MAIL_MESSAGE *src, int i);
void Mail_SetMessage(MAIL *mail, const MAIL_MESSAGE *src, int i);
MAILBOX *Sav2_Mailbox_get(SAVEDATA *saveData);
u32 Sav2_Mailbox_sizeof(void);
void Sav2_Mailbox_init(MAILBOX *mailbox);

View File

@ -12,7 +12,7 @@ typedef struct POKEWALKER {
u8 filler_08C[0x6C];
u16 unk_0F8;
u16 unk_0FA;
u8 unk_0FC[0x28];
u32 unk_0FC[10];
u16 unk_124;
u8 filler_126[2];
u32 unk_128;

View File

@ -41,6 +41,6 @@ void Sav2_SysInfo_SetField4C(SYSINFO* sys_info, void*);
void Sav2_SysInfo_RTC_init(SYSINFO_RTC* rtc_info);
BOOL sub_02028E1C(SYSINFO_RTC* rtc_info);
void Sav2_SysInfo_RTC_SubField34(SYSINFO_RTC* rtc_info, u32);
void sub_02028E4C(SYSINFO_RTC* rtc_info);
void SysInfoRTC_HandleContinueOnNewConsole(SYSINFO_RTC* rtc_info);
#endif

View File

@ -21,7 +21,7 @@ SAVEDATA *SaveBlock2_get(void);
void *SavArray_get(SAVEDATA *saveData, int id);
const void *SavArray_const_get(const SAVEDATA *saveData, int id);
BOOL Save_DeleteAllData(SAVEDATA *saveData);
BOOL sub_020273B0(SAVEDATA *saveData);
BOOL SaveData_TryLoadOnContinue(SAVEDATA *saveData);
int SaveGameNormal(SAVEDATA *saveData);
int Save_NowWriteFile_AfterMGInit(SAVEDATA *saveData, int a1);
void Sav2_InitDynamicRegion(SAVEDATA *saveData);

View File

@ -248,7 +248,7 @@ MAIL_MESSAGE *Mail_GetUnk20Array(MAIL *mail, int i) {
}
}
void Mail_CopyToUnk20Array(MAIL *mail, const MAIL_MESSAGE *src, int i) {
void Mail_SetMessage(MAIL *mail, const MAIL_MESSAGE *src, int i) {
if (i < NELEMS(mail->unk_20)) {
MailMsg_copy(&mail->unk_20[i], src);
}

View File

@ -20,6 +20,9 @@
#include "sys_flags.h"
#include "sys_vars.h"
#include "unk_0205B3DC.h"
#include "msgdata/msg/msg_0445.h"
#define HEAPID_OV36 ((HeapID)75)
extern const OVY_MGR_TEMPLATE _020FA15C;
extern const OVY_MGR_TEMPLATE _020FA16C;
@ -30,125 +33,127 @@ extern u32 sub_020674BC(SAVEDATA* savedata);
extern void Save_CurrentLocation_BackUp(SAVEDATA* savedata);
extern void sub_0202C7C0(SAV_FRIEND_GRP* friend_groups, u32 group_idx, u32 a2);
static BOOL ov36_021E599C(OVY_MANAGER* man, int* state);
static BOOL ov36_021E59B4(OVY_MANAGER* man, int* state);
static BOOL ov36_021E5A1C(OVY_MANAGER* man, int* state);
static BOOL ov36_021E5948(OVY_MANAGER* man, int* state);
static BOOL ov36_021E5960(OVY_MANAGER* man, int* state);
static BOOL ov36_021E5980(OVY_MANAGER* man, int* state);
static BOOL ov36_021E5900(OVY_MANAGER* man, int* state);
static BOOL ov36_021E5918(OVY_MANAGER* man, int* state);
static BOOL ov36_TitleScreen_SwitchToNewGame(OVY_MANAGER* man, int* state);
static void ov36_021E5A38(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_id);
static void ov36_021E5BB4(HeapID heap_id, SAVEDATA* savedata);
static void ov36_021E5BC8(HeapID heap_id, SAVEDATA* savedata);
static BOOL ov36_App_MainMenu_SelectOption_Continue_AppInit(OVY_MANAGER* man, int* state);
static BOOL ov36_App_MainMenu_SelectOption_Continue_AppExec(OVY_MANAGER* man, int* state);
static BOOL ov36_App_MainMenu_SelectOption_Continue_AppExit(OVY_MANAGER* man, int* state);
static BOOL ov36_App_InitGameState_AfterOakSpeech_AppInit(OVY_MANAGER* man, int* state);
static BOOL ov36_App_InitGameState_AfterOakSpeech_AppExec(OVY_MANAGER* man, int* state);
static BOOL ov36_App_InitGameState_AfterOakSpeech_AppExit(OVY_MANAGER* man, int* state);
static BOOL ov36_TitleScreen_NewGame_AppInit(OVY_MANAGER* man, int* state);
static BOOL ov36_TitleScreen_NewGame_AppExec(OVY_MANAGER* man, int* state);
static BOOL ov36_TitleScreen_NewGame_AppExit(OVY_MANAGER* man, int* state);
static void InitGameStateAfterOakSpeech_Internal(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_id);
static void Continue_LoadSaveData_HandleError(HeapID heap_id, SAVEDATA* savedata);
static void NewGame_InitSaveData(HeapID heap_id, SAVEDATA* savedata);
const OVY_MGR_TEMPLATE ov36_App_MainMenu_SelectOption_NewGame = {
.init = ov36_021E5900,
.exec = ov36_021E5918,
.exit = ov36_TitleScreen_SwitchToNewGame,
.init = ov36_TitleScreen_NewGame_AppInit,
.exec = ov36_TitleScreen_NewGame_AppExec,
.exit = ov36_TitleScreen_NewGame_AppExit,
.ovy_id = FS_OVERLAY_ID_NONE,
};
const OVY_MGR_TEMPLATE ov36_021E5C14 = {
.init = ov36_021E5948,
.exec = ov36_021E5960,
.exit = ov36_021E5980,
const OVY_MGR_TEMPLATE ov36_App_InitGameState_AfterOakSpeech = {
.init = ov36_App_InitGameState_AfterOakSpeech_AppInit,
.exec = ov36_App_InitGameState_AfterOakSpeech_AppExec,
.exit = ov36_App_InitGameState_AfterOakSpeech_AppExit,
.ovy_id = FS_OVERLAY_ID_NONE,
};
const OVY_MGR_TEMPLATE ov36_App_MainMenu_SelectOption_Continue = {
.init = ov36_021E599C,
.exec = ov36_021E59B4,
.exit = ov36_021E5A1C,
.init = ov36_App_MainMenu_SelectOption_Continue_AppInit,
.exec = ov36_App_MainMenu_SelectOption_Continue_AppExec,
.exit = ov36_App_MainMenu_SelectOption_Continue_AppExit,
.ovy_id = FS_OVERLAY_ID_NONE,
};
static const MAIL_MSG_TEMPLATE sMailMsgTemplates[2] = {
{
.msg_bank = 2,
.msg_no = 4,
// ADVENTURE! EXCITED!
.msg_bank = MAILMSG_BANK_0292_GMM,
.msg_no = msg_0292_00004,
.ec_groups = { EC_GROUP_FEELINGS, EC_GROUP_TOUGH_WORDS },
.ec_words = { EC_WORD_FEELINGS_ADVENTURE - EC_WORDS_FEELINGS_MIN, EC_WORD_TOUGH_WORDS_EXCITED - EC_WORDS_TOUGH_WORDS_MIN },
},
{
.msg_bank = 3,
.msg_no = 1,
// I love POKEMON!
.msg_bank = MAILMSG_BANK_0293_GMM,
.msg_no = msg_0293_00001,
.ec_groups = { EC_GROUP_QUESTION_MARKS, 0xFF },
.ec_words = { EC_WORD_QUESTION_MARKS_POKEMON - EC_WORDS_QUESTION_MARKS_MIN, 0 },
},
};
BOOL ov36_021E5900(OVY_MANAGER* man, int* state) {
BOOL ov36_TitleScreen_NewGame_AppInit(OVY_MANAGER* man, int* state) {
#pragma unused(man, state)
CreateHeap(3, 75, 0x20000);
CreateHeap(3, HEAPID_OV36, 0x20000);
InitializeMainRNG();
return TRUE;
}
BOOL ov36_021E5918(OVY_MANAGER* man, int* state) {
BOOL ov36_TitleScreen_NewGame_AppExec(OVY_MANAGER* man, int* state) {
#pragma unused(state)
SAVEDATA* savedata = ((struct UnkStruct_02111868_sub*)OverlayManager_GetParentWork(man))->savedata;
ov36_021E5BC8(75, savedata);
NewGame_InitSaveData(HEAPID_OV36, savedata);
return TRUE;
}
BOOL ov36_TitleScreen_SwitchToNewGame(OVY_MANAGER* man, int* state) {
BOOL ov36_TitleScreen_NewGame_AppExit(OVY_MANAGER* man, int* state) {
#pragma unused(man, state)
DestroyHeap(75);
DestroyHeap(HEAPID_OV36);
RegisterMainOverlay(FS_OVERLAY_ID_NONE, &_02106068);
return TRUE;
}
BOOL ov36_021E5948(OVY_MANAGER* man, int* state) {
BOOL ov36_App_InitGameState_AfterOakSpeech_AppInit(OVY_MANAGER* man, int* state) {
#pragma unused(man, state)
CreateHeap(3, 75, 0x20000);
CreateHeap(3, HEAPID_OV36, 0x20000);
InitializeMainRNG();
return TRUE;
}
BOOL ov36_021E5960(OVY_MANAGER* man, int* state) {
BOOL ov36_App_InitGameState_AfterOakSpeech_AppExec(OVY_MANAGER* man, int* state) {
#pragma unused(state)
struct UnkStruct_02111868_sub* unk_work = OverlayManager_GetParentWork(man);
SAVEDATA* savedata = unk_work->savedata;
ov36_021E5A38(75, savedata, 1);
InitGameStateAfterOakSpeech_Internal(HEAPID_OV36, savedata, TRUE);
sub_0201838C(Sav2_PlayerData_GetIGTAddr(savedata));
return TRUE;
}
BOOL ov36_021E5980(OVY_MANAGER* man, int* state) {
BOOL ov36_App_InitGameState_AfterOakSpeech_AppExit(OVY_MANAGER* man, int* state) {
#pragma unused(man, state)
DestroyHeap(75);
DestroyHeap(HEAPID_OV36);
RegisterMainOverlay(FS_OVERLAY_ID_NONE, &_020FA15C);
return TRUE;
}
BOOL ov36_021E599C(OVY_MANAGER* man, int* state) {
BOOL ov36_App_MainMenu_SelectOption_Continue_AppInit(OVY_MANAGER* man, int* state) {
#pragma unused(man, state)
CreateHeap(3, 75, 0x20000);
CreateHeap(3, HEAPID_OV36, 0x20000);
InitializeMainRNG();
return TRUE;
}
BOOL ov36_021E59B4(OVY_MANAGER* man, int* state) {
BOOL ov36_App_MainMenu_SelectOption_Continue_AppExec(OVY_MANAGER* man, int* state) {
#pragma unused(state)
struct UnkStruct_02111868_sub* unk_work = OverlayManager_GetParentWork(man);
SAVEDATA* savedata = unk_work->savedata;
SYSINFO* sys_info = Sav2_SysInfo_get(savedata);
ov36_021E5BB4(75, savedata);
Continue_LoadSaveData_HandleError(HEAPID_OV36, savedata);
Options_SetButtonModeOnMain(savedata, 0);
if (!Sav2_SysInfo_MacAddressIsMine(sys_info) || !Sav2_SysInfo_RTCOffsetIsMine(sys_info)) {
sub_02028E4C(Sav2_SysInfo_RTC_get(savedata));
SysInfoRTC_HandleContinueOnNewConsole(Sav2_SysInfo_RTC_get(savedata));
Sav2_BerryPotRTC_init(Sav2_BerryPotRTC_get(savedata));
Sav2_SysInfo_InitFromSystem(sys_info);
Party_ResetAllShayminToLandForme(SavArray_PlayerParty_get(savedata));
@ -159,15 +164,15 @@ BOOL ov36_021E59B4(OVY_MANAGER* man, int* state) {
return TRUE;
}
BOOL ov36_021E5A1C(OVY_MANAGER* man, int* state) {
BOOL ov36_App_MainMenu_SelectOption_Continue_AppExit(OVY_MANAGER* man, int* state) {
#pragma unused(man, state)
DestroyHeap(75);
DestroyHeap(HEAPID_OV36);
RegisterMainOverlay(FS_OVERLAY_ID_NONE, &_020FA16C);
return TRUE;
}
static void ov36_021E5A38(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_id) {
static void InitGameStateAfterOakSpeech_Internal(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_id) {
#pragma unused(heap_id)
s32 i;
MSGDATA* friend_names_msgdata;
@ -198,18 +203,19 @@ static void ov36_021E5A38(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_i
pokewalker_unk[i] = MTRandom();
}
// Put an email from your friend into your PC.
friend_names_msgdata = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0445_bin, 3);
MAILBOX* mailbox = Sav2_Mailbox_get(savedata);
POKEMON* friend_pokemon = AllocMonZeroed(3);
CreateMon(friend_pokemon, SPECIES_MARILL, 1, 0, FALSE, 0, 0, 0);
CreateMon(friend_pokemon, SPECIES_MARILL, 1, 0, FALSE, 0, OT_ID_PLAYER_ID, 0);
MAIL* mail;
if (PlayerProfile_GetTrainerGender(profile) == PLAYER_GENDER_MALE) {
author_name = NewString_ReadMsgData(friend_names_msgdata, 1);
author_name = NewString_ReadMsgData(friend_names_msgdata, msg_0445_00001);
mail = CreateKenyaMail(friend_pokemon, MAIL_AIR, MON_FEMALE, author_name, 0);
} else {
author_name = NewString_ReadMsgData(friend_names_msgdata, 0);
author_name = NewString_ReadMsgData(friend_names_msgdata, msg_0445_00000);
mail = CreateKenyaMail(friend_pokemon, MAIL_AIR, MON_MALE, author_name, 0);
}
@ -217,11 +223,11 @@ static void ov36_021E5A38(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_i
for (i = 0; i < (s32)NELEMS(sMailMsgTemplates); i++) {
MailMsg_init_fromTemplate(&mail_message, &sMailMsgTemplates[i]);
Mail_CopyToUnk20Array(mail, &mail_message, (u8)i);
Mail_SetMessage(mail, &mail_message, (u8)i);
}
MailMsg_init(&mail_message);
Mail_CopyToUnk20Array(mail, &mail_message, 2);
Mail_SetMessage(mail, &mail_message, 2);
Mailbox_CopyMailToSlotI(mailbox->msgs, FALSE, 0, mail);
FreeToHeap(friend_pokemon);
@ -230,14 +236,14 @@ static void ov36_021E5A38(HeapID heap_id, SAVEDATA* savedata, BOOL set_trainer_i
DestroyMsgData(friend_names_msgdata);
}
static void ov36_021E5BB4(HeapID heap_id, SAVEDATA* savedata) {
static void Continue_LoadSaveData_HandleError(HeapID heap_id, SAVEDATA* savedata) {
#pragma unused(heap_id)
if (!sub_020273B0(savedata)) {
if (!SaveData_TryLoadOnContinue(savedata)) {
OS_ResetSystem(0);
}
}
static void ov36_021E5BC8(HeapID heap_id, SAVEDATA* savedata) {
static void NewGame_InitSaveData(HeapID heap_id, SAVEDATA* savedata) {
#pragma unused(heap_id)
Sav2_InitDynamicRegion(savedata);
Save_CurrentLocation_BackUp(savedata);

View File

@ -101,7 +101,7 @@ void Sav2_SysInfo_RTC_SubField34(SYSINFO_RTC* rtc_info, u32 a1) {
rtc_info->unk34 -= a1;
}
void sub_02028E4C(SYSINFO_RTC* rtc_info) {
void SysInfoRTC_HandleContinueOnNewConsole(SYSINFO_RTC* rtc_info) {
rtc_info->unk34 = 1440;
GF_RTC_CopyDateTime(&rtc_info->date, &rtc_info->time);
rtc_info->days_since_nitro_epoch = RTC_ConvertDateToDay(&rtc_info->date);

View File

@ -227,7 +227,7 @@ BOOL Save_DeleteAllData(SAVEDATA *saveData) {
return TRUE;
}
BOOL sub_020273B0(SAVEDATA *saveData) {
BOOL SaveData_TryLoadOnContinue(SAVEDATA *saveData) {
int sp4;
int sp0;