diff --git a/data/data_8115F5C_2.s b/data/data_8115F5C_2.s index fbd19e8e4..a249c9547 100644 --- a/data/data_8115F5C_2.s +++ b/data/data_8115F5C_2.s @@ -4,117 +4,6 @@ .align 2,0 -.global gUnknown_8116134 -gUnknown_8116134: @ 8116134 -.byte 0x01, 0x00, 0x00, 0x00 -.byte 0x01, 0x00, 0x00, 0x00 -.byte 0x01, 0x00, 0x00, 0x00 -.byte 0x01, 0x00, 0x00, 0x00 -.byte 0x01, 0x00, 0x00, 0x00 - -.global gUnknown_8116148 -gUnknown_8116148: @ 8116148 -.byte 0xe2, 0x00 -.byte 0xc2, 0x00 -.byte 0xc2, 0x01 -.byte 0xc2, 0x02 -.byte 0x01, 0x00 -.byte 0x21, 0x01 -.byte 0x01, 0x01 -.byte 0x0d, 0x01 -.byte 0x05, 0x01 -.byte 0x00, 0x00 - -.global gInvalidityText -gInvalidityText: @ 811615C -.string "{COLOR RED_W}invalidity{RESET}\0" -.align 2,0 - -.global gUndefineText -gUndefineText: @ 811616C -.string "{COLOR RED_W}undefine{RESET}\0" -.align 2,0 - -.global gSpeechBubbleChar -gSpeechBubbleChar: @ 811617C -.byte 0x87, 0x45, 0x00, 0x00 - -.global gFormattedSpeechBubble -gFormattedSpeechBubble: @ 8116180 -.string "{COLOR YELLOW_N}{SPEECH_BUBBLE}{RESET}\0" - -.global gUnknown_8116188 -gUnknown_8116188: @ 8116188 -.string "{COLOR YELLOW_N}%s{RESET}\0" -.align 2,0 - -.global gUnknown_8116190 -gUnknown_8116190: @ 8116190 -@ replacing .incbin "baserom.gba", 0x00116190, 0x18 -.byte 0x25, 0x73, 0x23, 0x5b, 0x49, 0x5d, 0x23, 0x7e, 0x20, 0x81, 0x40, 0x23, 0x57, 0x0a, 0x23, 0x5b, 0x4f, 0x5d, 0x23, 0x7e, 0x20, 0x81, 0x40, 0x00 - -.global gUnknown_81161A8 -gUnknown_81161A8: @ 81161A8 -.4byte 1 -.4byte 0 -.4byte sub_809C39C -.4byte sub_801D0DC - -.global gUnknown_81161B8 -gUnknown_81161B8: @ 81161B8 -.4byte 1 -.4byte 0 -.4byte sub_809C3D8 -.4byte sub_801D0DC - -.global gUnknown_81161C8 -gUnknown_81161C8: @ 81161C8 -.4byte 1 -.4byte 0 -.4byte DeleteKangaskhanStorage -.4byte KangaskhanStorageCallback - -.global gUnknown_81161D8 -gUnknown_81161D8: @ 81161D8 -.4byte 1 -.4byte sub_8017E1C -.4byte sub_8017EF4 -.4byte sub_8017E54 - -.global gUnknown_81161E8 -gUnknown_81161E8: @ 81161E8 -.4byte 1 -.4byte 0 -.4byte DestroyFelicityBank -.4byte FelicityBankCallback - -.global gUnknown_81161F8 -gUnknown_81161F8: @ 81161F8 -.4byte 1 -.4byte 0 -.4byte DeleteKecleonBros -.4byte KecleonBrosCallback - -.global gUnknown_8116208 -gUnknown_8116208: @ 8116208 -.4byte 1 -.4byte 0 -.4byte sub_801FD7C -.4byte sub_801FC40 - -.global gUnknown_8116218 -gUnknown_8116218: @ 8116218 -.4byte 1 -.4byte 0 -.4byte CleanWigglytuffShop -.4byte sub_8021C5C - -.global gUnknown_8116228 -gUnknown_8116228: @ 8116228 -.4byte 1 -.4byte sub_8027F88 -.4byte sub_809C504 -.4byte sub_8028078 .global gUnknown_8116238 gUnknown_8116238: @ 8116238 diff --git a/include/code_801D014.h b/include/code_801D014.h index 63168f5b7..e808c5a8c 100644 --- a/include/code_801D014.h +++ b/include/code_801D014.h @@ -32,7 +32,7 @@ struct TeamBadgeData }; bool8 sub_801D014(PokemonStruct1 *); -u32 sub_801D0DC(void); +s32 sub_801D0DC(void); u32 sub_801D178(void); u8 sub_801D1D4(void); void sub_801D1E0(void); diff --git a/include/felicity_bank.h b/include/felicity_bank.h index 42c65e138..4c8598284 100644 --- a/include/felicity_bank.h +++ b/include/felicity_bank.h @@ -28,6 +28,6 @@ typedef struct FelicityBankWork bool8 CreateFelicityBank(s32 mode); void DestroyFelicityBank(void); void DrawTeamMoneyBox(u32); -u32 FelicityBankCallback(void); +s32 FelicityBankCallback(void); #endif // GUARD_FELICITY_BANK_H diff --git a/include/gulpin_shop_801FB50.h b/include/gulpin_shop_801FB50.h index a3bc8f0f8..dfbeea9c7 100644 --- a/include/gulpin_shop_801FB50.h +++ b/include/gulpin_shop_801FB50.h @@ -39,7 +39,7 @@ typedef struct unkStruct_203B27C } unkStruct_203B27C; bool8 sub_801FB50(u32 mode); -u32 sub_801FC40(void); +s32 sub_801FC40(void); void sub_801FD7C(void); #endif // GUARD_GULPIN_SHOP_801FB50_H diff --git a/include/kangaskhan_storage1.h b/include/kangaskhan_storage1.h index 08f4edffe..b569e45a8 100644 --- a/include/kangaskhan_storage1.h +++ b/include/kangaskhan_storage1.h @@ -52,6 +52,6 @@ struct KangaskhanStorageWork bool8 CreateKangaskhanStorage(u32 mode); void DeleteKangaskhanStorage(void); -u32 KangaskhanStorageCallback(void); +s32 KangaskhanStorageCallback(void); #endif // GUARD_KANGASKHAN_STORAGE1_H diff --git a/include/kangaskhan_storage2.h b/include/kangaskhan_storage2.h index 24238ba41..b18001a89 100644 --- a/include/kangaskhan_storage2.h +++ b/include/kangaskhan_storage2.h @@ -31,7 +31,7 @@ typedef struct unkStruct_203B20C } unkStruct_203B20C; bool8 sub_8017E1C(void); -u32 sub_8017E54(void); +s32 sub_8017E54(void); void sub_8017EF4(void); #endif // GUARD_KANGASKHAN_STORAGE2_H diff --git a/include/kecleon_bros1.h b/include/kecleon_bros1.h index 43427d2db..ec35c5c88 100644 --- a/include/kecleon_bros1.h +++ b/include/kecleon_bros1.h @@ -71,6 +71,6 @@ typedef struct KecleonBrosWork1 // mode corresponds to the enum: KecleonBrosMode bool8 CreateKecleonBros(u32 mode); void DeleteKecleonBros(void); -u32 KecleonBrosCallback(void); +s32 KecleonBrosCallback(void); #endif // GUARD_KECLEON_BROS1_H diff --git a/include/structs/str_3001B64.h b/include/structs/str_3001B64.h index 4e7b13f92..486650c3d 100644 --- a/include/structs/str_3001B64.h +++ b/include/structs/str_3001B64.h @@ -37,7 +37,7 @@ struct unkStruct_3001B64_unk418 { u16 unk0; u8 (*unk4)(void); - u8 (*unk8)(void); + void (*unk8)(void); s32 (*unkC)(void); }; diff --git a/include/wigglytuff_shop3.h b/include/wigglytuff_shop3.h index 48a12c019..25c662092 100644 --- a/include/wigglytuff_shop3.h +++ b/include/wigglytuff_shop3.h @@ -60,7 +60,7 @@ typedef struct WigglytuffShop3Work } WigglytuffShop3Work; bool8 CreateWigglytuffShop(u32 mode); -u32 sub_8021C5C(void); +s32 sub_8021C5C(void); void CleanWigglytuffShop(void); #endif // GUARD_WIGGLYTUFF_SHOP3_H diff --git a/include/wonder_mail.h b/include/wonder_mail.h index fc0d120ae..0ae0ceb57 100644 --- a/include/wonder_mail.h +++ b/include/wonder_mail.h @@ -34,4 +34,7 @@ typedef struct WonderMailStruct_203B2C0 /* 0x544 */ s16 speciesNum; } WonderMailStruct_203B2C0; +u8 sub_8027F88(void); +s32 sub_8028078(void); + #endif // GUARD_WONDER_MAIL_H diff --git a/ld_script.txt b/ld_script.txt index 00b0f4ce7..df326bdd4 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -319,7 +319,6 @@ SECTIONS { src/code_8099360.o(.text); asm/code_8099360.o(.text); src/code_809A560.o(.text); - src/code_809A560_1.o(.text); src/code_809C5C4.o(.text); asm/code_809C5C4.o(.text); src/code_809D148.o(.text); diff --git a/src/code_801D014.c b/src/code_801D014.c index 0769db871..62c55765b 100644 --- a/src/code_801D014.c +++ b/src/code_801D014.c @@ -95,7 +95,7 @@ bool8 sub_801D014(PokemonStruct1 *a0) return TRUE; } -u32 sub_801D0DC(void) +s32 sub_801D0DC(void) { switch (sUnknown_203B250->state) { case 0: diff --git a/src/code_809A560.c b/src/code_809A560.c index d52854c41..d45e33462 100644 --- a/src/code_809A560.c +++ b/src/code_809A560.c @@ -14,14 +14,25 @@ #include "wigglytuff_shop1.h" #include "event_flag.h" #include "input.h" +#include "ground_main.h" +#include "code_801D014.h" +#include "kangaskhan_storage1.h" +#include "kangaskhan_storage2.h" +#include "felicity_bank.h" +#include "kecleon_bros1.h" +#include "gulpin_shop_801FB50.h" +#include "wigglytuff_shop3.h" +#include "wonder_mail.h" +#include "flash.h" +#include "code_80118A4.h" +#include "friend_list_menu.h" +#include "personality_test1.h" +#include "credits2.h" IWRAM_INIT struct unkStruct_3001B64 *gUnknown_3001B64 = {NULL}; extern u16 gUnknown_20399DC; extern u16 gUnknown_20399DE; -extern u8 gInvalidityText[]; -extern u8 gUndefineText[]; -extern const u8 gSpeechBubbleChar[]; extern bool8 sub_802FCF0(void); u8 ScriptPrintText_809B2B8(struct unkStruct_3001B64_unkC *, s32, s32, const char *); @@ -94,6 +105,24 @@ static const MenuItem gUnknown_811612C[] = {NULL, 0}, }; +static const u32 gUnknown_8116134[] = +{ + 1, 1, 1, 1, 1 +}; + +static const u16 gUnknown_8116148[] = +{ + 226, 194, 450, 706, 1, 289, 257, 269, 261, 0 +}; + +ALIGNED(4) static const u8 sInvalidText[] = _("{COLOR RED_W}invalidity{RESET}"); +ALIGNED(4) static const u8 sUndefineText[] = _("{COLOR RED_W}undefine{RESET}"); +ALIGNED(4) static const u8 sSpeechBubbleText[] = _("{SPEECH_BUBBLE}"); +ALIGNED(4) static const u8 sYellowSpeechBubbleText[] = _("{COLOR YELLOW_N}{SPEECH_BUBBLE}{RESET}"); +ALIGNED(4) static const u8 sYellowStringText[] = _("{COLOR YELLOW_N}%s{RESET}"); +// TODO: Convert to actual string +ALIGNED(4) static const u8 gUnknown_8116190[] = {0x25, 0x73, 0x23, 0x5b, 0x49, 0x5d, 0x23, 0x7e, 0x20, 0x81, 0x40, 0x23, 0x57, 0x0a, 0x23, 0x5b, 0x4f, 0x5d, 0x23, 0x7e, 0x20, 0x81, 0x40, 0x00}; + void sub_809A560(void) { sub_8014144(); @@ -281,8 +310,8 @@ void sub_809A83C(s16 param_1) temp->monPortrait.faceFile = NULL; temp->monPortrait.faceData = NULL; temp->monPortrait.spriteId = 0; - strcpy(gFormatBuffer_Monsters[param_1], gInvalidityText); - strcpy(gFormatBuffer_Names[param_1], gInvalidityText); + strcpy(gFormatBuffer_Monsters[param_1], sInvalidText); + strcpy(gFormatBuffer_Names[param_1], sInvalidText); if(temp->faceFile) { CloseFile(temp->faceFile); @@ -380,8 +409,8 @@ bool8 sub_809A8B8(s32 param_1, s32 param_2) if (sVar3 >= 0) { unkPtr->unk0 = local_28; unkPtr->speciesID = sub_80A8BFC(sVar3); - strcpy(gFormatBuffer_Monsters[iVar5], gUndefineText); - strcpy(gFormatBuffer_Names[iVar5], gUndefineText); + strcpy(gFormatBuffer_Monsters[iVar5], sUndefineText); + strcpy(gFormatBuffer_Names[iVar5], sUndefineText); unkPtr->unk4 = uVar9; unkPtr->unk5 = byte1; unkPtr->unk6 = 0xff; @@ -396,8 +425,8 @@ bool8 sub_809A8B8(s32 param_1, s32 param_2) else if (local_26 != 0) { unkPtr->unk0 = local_28; unkPtr->speciesID = local_26; - strcpy(gFormatBuffer_Monsters[iVar5], gUndefineText); - strcpy(gFormatBuffer_Names[iVar5], gUndefineText); + strcpy(gFormatBuffer_Monsters[iVar5], sUndefineText); + strcpy(gFormatBuffer_Names[iVar5], sUndefineText); unkPtr->unk4 = uVar9; unkPtr->unk5 = byte1; unkPtr->unk6 = 0xff; @@ -430,7 +459,7 @@ bool8 sub_809AB4C(s32 a0_, s32 a1_) if (sub_809A8B8(a0, a1)) { CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[a0], unkPtr->speciesID); - strcpy(gFormatBuffer_Names[a0], gSpeechBubbleChar); + strcpy(gFormatBuffer_Names[a0], sSpeechBubbleText); return TRUE; } else { @@ -591,9 +620,6 @@ struct MonPortraitMsg *sub_809AE3C(s32 a0_) return NULL; } -extern const u32 gUnknown_8116134[]; -extern const u16 gUnknown_8116148[]; - bool8 ScriptPrintText(s32 a0, s32 a1_, const char *text) { s32 a1 = (s16) a1_; @@ -664,9 +690,6 @@ struct unkStruct_8096AF8 /* 0x4 */ s16 targetSpecies; }; -extern const char gUnknown_8116188[]; -extern const char gUnknown_8116190[]; -extern const char gFormattedSpeechBubble[]; void sub_809B028(const MenuItem *, s32 a1_, s32 a2, s32 a3, s32 a4_, const char *text); bool8 sub_809B18C(s32 *sp); extern void sub_8099A34(s32 a0); @@ -703,11 +726,9 @@ bool8 HasEvolutionCompleted(); void GroundMap_ExecuteEvent(); void SetScriptVarValue(u8 *localVarBuf, s32 varId, s32 val); void CleanLuminousCave(); -u8 CreateFelicityBank(u8); u8 sub_80023E4(); u8 CreateFriendListMenu(); void PlayMenuSoundEffect(); -void sub_801D014(); bool8 sub_8015080(u8 *buffer, const MenuItem *menuItems); s32 sub_801516C(); void sub_80151A4(); @@ -741,6 +762,12 @@ u8 CreateHelperPelipperMenu(); u8 CreateWigglytuffShop(); u8 sub_8099328(); void GetScriptVarScenario(s32 varId,u32 *outMain,u32 *outSub); +u32 sub_802E90C(); +void sub_802E918(); +u32 sub_80282DC(u8 *r0); +void sub_809927C(u8); +void sub_80282FC(void); +void sub_8001064(void); void sub_809AFC8(s32 a0_, s32 a1, s32 a2_, const char *text) { @@ -778,10 +805,10 @@ void sub_809B028(const MenuItem * menuItems, s32 a1_, s32 a2, s32 a3, s32 a4_, c gUnknown_3001B64->unk430 = a2; if (gUnknown_8116148[a3] & 0x100) { if (a4 < 0) { - strcpy(gSpeakerNameBuffer, gFormattedSpeechBubble); + strcpy(gSpeakerNameBuffer, sYellowSpeechBubbleText); } else { - sprintfStatic(gSpeakerNameBuffer, gUnknown_8116188, gFormatBuffer_Names[a4]); + sprintfStatic(gSpeakerNameBuffer, sYellowStringText, gFormatBuffer_Names[a4]); } } @@ -874,10 +901,10 @@ u8 ScriptPrintText_809B2B8(struct unkStruct_3001B64_unkC *ptr, s32 a1_, s32 a2_, ptr->unk4 = 1; if (a1 & 0x100) { if (a2 < 0) { - strcpy(gSpeakerNameBuffer, gFormattedSpeechBubble); + strcpy(gSpeakerNameBuffer, sYellowSpeechBubbleText); } else { - sprintfStatic(gSpeakerNameBuffer, gUnknown_8116188, gFormatBuffer_Names[a2]); + sprintfStatic(gSpeakerNameBuffer, sYellowStringText, gFormatBuffer_Names[a2]); } } @@ -1052,10 +1079,83 @@ void nullsub_210(void) } -extern const struct unkStruct_3001B64_unk418 gUnknown_81161E8; +void sub_809C39C(void); +void sub_809C3D8(void); +void sub_809C504(void); + +static const struct unkStruct_3001B64_unk418 gUnknown_81161A8 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = sub_809C39C, + .unkC = sub_801D0DC, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_81161B8 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = sub_809C3D8, + .unkC = sub_801D0DC, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_81161C8 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = DeleteKangaskhanStorage, + .unkC = KangaskhanStorageCallback, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_81161D8 = +{ + .unk0 = 1, + .unk4 = sub_8017E1C, + .unk8 = sub_8017EF4, + .unkC = sub_8017E54, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_81161E8 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = DestroyFelicityBank, + .unkC = FelicityBankCallback, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_81161F8 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = DeleteKecleonBros, + .unkC = KecleonBrosCallback, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_8116208 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = sub_801FD7C, + .unkC = sub_801FC40, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_8116218 = +{ + .unk0 = 1, + .unk4 = NULL, + .unk8 = CleanWigglytuffShop, + .unkC = sub_8021C5C, +}; + +static const struct unkStruct_3001B64_unk418 gUnknown_8116228 = +{ + .unk0 = 1, + .unk4 = sub_8027F88, + .unk8 = sub_809C504, + .unkC = sub_8028078, +}; + extern const struct unkStruct_3001B64_unk418 gUnknown_81162F8; -extern const struct unkStruct_3001B64_unk418 gUnknown_81161A8; -extern const struct unkStruct_3001B64_unk418 gUnknown_81161B8; extern const struct unkStruct_3001B64_unk418 gUnknown_8116298; extern const struct unkStruct_3001B64_unk418 gUnknown_81162A8; extern const struct unkStruct_3001B64_unk418 gUnknown_81162B8; @@ -1064,18 +1164,12 @@ extern const struct unkStruct_3001B64_unk418 gUnknown_81162D8; extern const struct unkStruct_3001B64_unk418 gUnknown_81162E8; extern const struct unkStruct_3001B64_unk418 gUnknown_8116308; extern const struct unkStruct_3001B64_unk418 gUnknown_8116318; -extern const struct unkStruct_3001B64_unk418 gUnknown_81161F8; -extern const struct unkStruct_3001B64_unk418 gUnknown_81161C8; -extern const struct unkStruct_3001B64_unk418 gUnknown_81161D8; -extern const struct unkStruct_3001B64_unk418 gUnknown_8116218; -extern const struct unkStruct_3001B64_unk418 gUnknown_8116228; extern const struct unkStruct_3001B64_unk418 gUnknown_8116238; extern const struct unkStruct_3001B64_unk418 gUnknown_8116248; extern const struct unkStruct_3001B64_unk418 gUnknown_8116258; extern const struct unkStruct_3001B64_unk418 gUnknown_8116268; extern const struct unkStruct_3001B64_unk418 gUnknown_8116278; extern const struct unkStruct_3001B64_unk418 gUnknown_8116288; -extern const struct unkStruct_3001B64_unk418 gUnknown_8116208; bool8 sub_809B648(void) { @@ -1189,12 +1283,12 @@ bool8 sub_809B648(void) } return 1; case 7: - sub_801D014(gUnknown_3001B64->unk42C); + sub_801D014((void *) gUnknown_3001B64->unk42C); gUnknown_3001B64->unk418 = &gUnknown_81161A8; PlayMenuSoundEffect(4); return 1; case 8: - sub_801D014(gUnknown_3001B64->unk42C); + sub_801D014((void *) gUnknown_3001B64->unk42C); gUnknown_3001B64->unk418 = &gUnknown_81161B8; PlayMenuSoundEffect(4); return 1; @@ -1700,3 +1794,153 @@ bool8 sub_809B648(void) return 0; } + +void sub_809C39C(void) +{ + gUnknown_3001B64->unk430 = sub_801D178(); + if(gUnknown_3001B64->unk430 == 3) + GroundMainGroundRequest(sub_8002694(sub_801D1D4()), 0, -1); + sub_801D1E0(); +} + +void sub_809C3D8(void) +{ + gUnknown_3001B64->unk430 = sub_801D178(); + if(gUnknown_3001B64->unk430 == 3) + GroundMainGroundRequest(sub_8002694(sub_801D1D4()), 0, -1); + sub_801D1E0(); +} + +void sub_809C414(void) +{ + u8 val; + + val = sub_802540C(); + + if(val != 0) + { + gUnknown_3001B64->unk430 = val; + GroundMainGroundRequest(sub_8002694(val), 0, -1); + } + else +{ + gUnknown_3001B64->unk430 = -1; + } + CleanFriendListMenu(); + +} + +void sub_809C464(void) +{ + DeleteTestTracker(); + sub_8001064(); + sub_809965C(); +} + +void sub_809C478(void) +{ + s32 temp; + s32 temp1; + + if(sub_80356A0() == 0x3) + { + PlaySound(0x313); + InitFlash(); + ClearFlashData(); + } + + sub_8035758(); + + GetScriptVarScenario(SCENARIO_MAIN, &temp, &temp1); + sub_80993C0(0); +} + +// https://decomp.me/scratch/WyHAL - (84.32% matching - Seth) +NAKED +void sub_809C4B0(void) +{ + asm_unified( + "\tpush {r4,r5,lr}\n" + "\tmovs r4, 0x1\n" + "\tnegs r4, r4\n" + "\tldr r5, _0809C4FC\n" + "\tldr r0, [r5]\n" + "\tmovs r2, 0x86\n" + "\tlsls r2, 3\n" + "\tadds r1, r0, r2\n" + "\tldr r0, [r1]\n" + "\tcmp r0, 0\n" + "\tbne _0809C4DE\n" + "\tbl sub_803B168\n" + "\tlsls r0, 16\n" + "\tldr r1, [r5]\n" + "\tldr r3, _0809C500\n" + "\tadds r2, r1, r3\n" + "\tasrs r4, r0, 16\n" + "\tlsrs r0, 16\n" + "\tstrh r0, [r2]\n" + "\tmovs r0, 0x86\n" + "\tlsls r0, 3\n" + "\tadds r1, r0\n" +"_0809C4DE:\n" + "\tstr r4, [r1]\n" + "\tbl sub_803B1BC\n" + "\tmovs r0, 0x1\n" + "\tnegs r0, r0\n" + "\tcmp r4, r0\n" + "\tbeq _0809C4F4\n" + "\tadds r0, r4, 0\n" + "\tmovs r1, 0\n" + "\tbl GroundMap_ExecuteEvent\n" +"_0809C4F4:\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_0809C4FC: .4byte gUnknown_3001B64\n" +"_0809C500: .4byte 0x000005a4"); +} + + +void sub_809C504(void) +{ + u8 temp; + + if(sub_80282DC(&temp) == 1) + { + sub_809927C(temp); + gUnknown_3001B64->unk430 = 1; + } + else + { + gUnknown_3001B64->unk430 = -1; + } + sub_80282FC(); +} + +void sub_809C550(void) +{ + u32 ret; + s32 val; + + ret = sub_802E90C(); + val = 0; + sub_802E918(); + + switch(ret) + { + case 1: + if(ScriptVarScenarioBefore(SCENARIO_SUB1, 0x1D, 0x3)) + val = 1; + break; + case 2: + if(ScriptVarScenarioBefore(SCENARIO_SUB1, 0x1F, 0x2)) + val = 2; + break; + case 3: + if(ScriptVarScenarioBefore(SCENARIO_SUB8, 0x33, 0x8)) + val = 3; + break; + } + gUnknown_3001B64->unk430 = val; +} diff --git a/src/code_809A560_1.c b/src/code_809A560_1.c deleted file mode 100644 index 1f224e3d0..000000000 --- a/src/code_809A560_1.c +++ /dev/null @@ -1,169 +0,0 @@ -#include "global.h" -#include "structs/str_3001B64.h" -#include "code_80118A4.h" -#include "code_801D014.h" -#include "code_8099360.h" -#include "credits2.h" -#include "event_flag.h" -#include "flash.h" -#include "friend_list_menu.h" -#include "ground_main.h" -#include "personality_test1.h" - -extern struct unkStruct_3001B64 *gUnknown_3001B64; - -u32 sub_802E90C(); -void sub_802E918(); -u32 sub_80282DC(u8 *r0); -void sub_809927C(u8); -void sub_80282FC(void); -void sub_8001064(void); - -void sub_809C39C(void) { - gUnknown_3001B64->unk430 = sub_801D178(); - if(gUnknown_3001B64->unk430 == 3) - GroundMainGroundRequest(sub_8002694(sub_801D1D4()), 0, -1); - sub_801D1E0(); -} - -void sub_809C3D8(void) -{ - gUnknown_3001B64->unk430 = sub_801D178(); - if(gUnknown_3001B64->unk430 == 3) - GroundMainGroundRequest(sub_8002694(sub_801D1D4()), 0, -1); - sub_801D1E0(); -} - -void sub_809C414(void) -{ - u8 val; - - val = sub_802540C(); - - if(val != 0) - { - gUnknown_3001B64->unk430 = val; - GroundMainGroundRequest(sub_8002694(val), 0, -1); - } - else -{ - gUnknown_3001B64->unk430 = -1; - } - CleanFriendListMenu(); - -} - -void sub_809C464(void) -{ - DeleteTestTracker(); - sub_8001064(); - sub_809965C(); -} - -void sub_809C478(void) -{ - s32 temp; - s32 temp1; - - if(sub_80356A0() == 0x3) - { - PlaySound(0x313); - InitFlash(); - ClearFlashData(); - } - - sub_8035758(); - - GetScriptVarScenario(SCENARIO_MAIN, &temp, &temp1); - sub_80993C0(0); -} - -// https://decomp.me/scratch/WyHAL - (84.32% matching - Seth) -NAKED -void sub_809C4B0(void) -{ - asm_unified( - "\tpush {r4,r5,lr}\n" - "\tmovs r4, 0x1\n" - "\tnegs r4, r4\n" - "\tldr r5, _0809C4FC\n" - "\tldr r0, [r5]\n" - "\tmovs r2, 0x86\n" - "\tlsls r2, 3\n" - "\tadds r1, r0, r2\n" - "\tldr r0, [r1]\n" - "\tcmp r0, 0\n" - "\tbne _0809C4DE\n" - "\tbl sub_803B168\n" - "\tlsls r0, 16\n" - "\tldr r1, [r5]\n" - "\tldr r3, _0809C500\n" - "\tadds r2, r1, r3\n" - "\tasrs r4, r0, 16\n" - "\tlsrs r0, 16\n" - "\tstrh r0, [r2]\n" - "\tmovs r0, 0x86\n" - "\tlsls r0, 3\n" - "\tadds r1, r0\n" -"_0809C4DE:\n" - "\tstr r4, [r1]\n" - "\tbl sub_803B1BC\n" - "\tmovs r0, 0x1\n" - "\tnegs r0, r0\n" - "\tcmp r4, r0\n" - "\tbeq _0809C4F4\n" - "\tadds r0, r4, 0\n" - "\tmovs r1, 0\n" - "\tbl GroundMap_ExecuteEvent\n" -"_0809C4F4:\n" - "\tpop {r4,r5}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.align 2, 0\n" -"_0809C4FC: .4byte gUnknown_3001B64\n" -"_0809C500: .4byte 0x000005a4"); -} - - -void sub_809C504(void) -{ - u8 temp; - - if(sub_80282DC(&temp) == 1) - { - sub_809927C(temp); - gUnknown_3001B64->unk430 = 1; - } - else - { - gUnknown_3001B64->unk430 = -1; - } - sub_80282FC(); -} - -void sub_809C550(void) -{ - u32 ret; - s32 val; - - ret = sub_802E90C(); - val = 0; - sub_802E918(); - - switch(ret) - { - case 1: - if(ScriptVarScenarioBefore(SCENARIO_SUB1, 0x1D, 0x3)) - val = 1; - break; - case 2: - if(ScriptVarScenarioBefore(SCENARIO_SUB1, 0x1F, 0x2)) - val = 2; - break; - case 3: - if(ScriptVarScenarioBefore(SCENARIO_SUB8, 0x33, 0x8)) - val = 3; - break; - } - gUnknown_3001B64->unk430 = val; -} diff --git a/src/felicity_bank.c b/src/felicity_bank.c index 1280b9034..d0a733622 100644 --- a/src/felicity_bank.c +++ b/src/felicity_bank.c @@ -78,7 +78,7 @@ bool8 CreateFelicityBank(s32 mode) return TRUE; } -u32 FelicityBankCallback(void) +s32 FelicityBankCallback(void) { switch (sFelicityBankWork->currState) { case 1: diff --git a/src/gulpin_shop_801FB50.c b/src/gulpin_shop_801FB50.c index 5909e414b..2f72a12da 100644 --- a/src/gulpin_shop_801FB50.c +++ b/src/gulpin_shop_801FB50.c @@ -108,7 +108,7 @@ bool8 sub_801FB50(u32 mode) return TRUE; } -u32 sub_801FC40(void) +s32 sub_801FC40(void) { switch (gUnknown_203B27C->state) { case 0: diff --git a/src/kangaskhan_storage1.c b/src/kangaskhan_storage1.c index 410fbd3c3..c4082436e 100644 --- a/src/kangaskhan_storage1.c +++ b/src/kangaskhan_storage1.c @@ -74,7 +74,7 @@ bool8 CreateKangaskhanStorage(u32 mode) return TRUE; } -u32 KangaskhanStorageCallback(void) +s32 KangaskhanStorageCallback(void) { switch (gKangaskhanStorageWork->currState) { case KANGASKHAN_STORAGE_INIT: diff --git a/src/kangaskhan_storage2.c b/src/kangaskhan_storage2.c index 830d2490c..0a23f9015 100644 --- a/src/kangaskhan_storage2.c +++ b/src/kangaskhan_storage2.c @@ -51,7 +51,7 @@ bool8 sub_8017E1C(void) return TRUE; } -u32 sub_8017E54(void) +s32 sub_8017E54(void) { switch (sUnknown_203B20C->state) { case KANGASKHAN_STORAGE_2_INIT: diff --git a/src/kecleon_bros1.c b/src/kecleon_bros1.c index f42766aca..31c4338e3 100644 --- a/src/kecleon_bros1.c +++ b/src/kecleon_bros1.c @@ -114,7 +114,7 @@ bool8 CreateKecleonBros(u32 mode) return TRUE; } -u32 KecleonBrosCallback(void) +s32 KecleonBrosCallback(void) { switch (sKecleonBrosWork1->currState) { case KECLEON_STORE_INIT: diff --git a/src/wigglytuff_shop3.c b/src/wigglytuff_shop3.c index eabf966ef..66e0e0ee6 100644 --- a/src/wigglytuff_shop3.c +++ b/src/wigglytuff_shop3.c @@ -81,7 +81,7 @@ bool8 CreateWigglytuffShop(u32 mode) return TRUE; } -u32 sub_8021C5C(void) +s32 sub_8021C5C(void) { switch (sWigglytuffShop3Work->state) { case WIGGLYTUFF_INIT: diff --git a/src/wonder_mail.c b/src/wonder_mail.c index d53fd48cb..c92ccdc28 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -180,7 +180,7 @@ enum MenuActions { void SetFriendRescueCounterState(u32 r0); -u32 sub_8027F88(void) +u8 sub_8027F88(void) { char *monName; OpenedFile *faceFile; @@ -212,7 +212,7 @@ u32 sub_8027F88(void) return 1; } -u32 sub_8028078(void) +s32 sub_8028078(void) { switch(sUnknown_203B2C0->state) {