diff options
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/scrcmd_11.c | 120 | ||||
-rw-r--r-- | arm9/src/scrcmd_23.c | 169 | ||||
-rw-r--r-- | arm9/src/scrcmd_25.c | 8 | ||||
-rw-r--r-- | arm9/src/scrcmd_daycare.c | 192 | ||||
-rw-r--r-- | arm9/src/scrcmd_names.c | 540 |
5 files changed, 1025 insertions, 4 deletions
diff --git a/arm9/src/scrcmd_11.c b/arm9/src/scrcmd_11.c new file mode 100644 index 00000000..8553adfa --- /dev/null +++ b/arm9/src/scrcmd_11.c @@ -0,0 +1,120 @@ +#include "scrcmd.h" +#include "unk_02029FB0.h" + +extern void* FUN_02039438(struct UnkSavStruct80*, int idx); + +extern void FUN_0202A0E8(struct UnkStruct_02029FB0*, int); +extern void FUN_0202A170(struct UnkStruct_02029FB0*, int); +extern u8 FUN_0204B5FC(struct UnkSavStruct80*, void*); +extern void FUN_0204B57C(struct UnkSavStruct80*, void*, int); +extern u16 FUN_0204B63C(struct UnkSavStruct80*, void*); +extern u16 FUN_0204B660(struct UnkSavStruct80*, void*); +extern u16 FUN_0204B684(struct UnkSavStruct80*, void*); +extern u16 FUN_0204B6A4(struct UnkSavStruct80*, void*); +extern void FUN_0204B9CC(struct UnkSavStruct80*); +extern void FUN_0204B5A8(struct UnkSavStruct80*, void*, u16); +extern void FUN_0204B9A0(struct UnkSavStruct80*); +extern void FUN_0204B4FC(struct UnkSavStruct80*, void*); + +THUMB_FUNC BOOL ScrCmd_Unk017D(struct ScriptContext* ctx) +{ + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void** unk = FUN_02039438(ctx->unk80, 10); + + *ret_ptr = FUN_0204B5FC(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk017E(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B63C(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk017F(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B660(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0180(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B684(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0181(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *ret_ptr = FUN_0204B6A4(ctx->unk80, *unk); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0182(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_0204B57C(ctx->unk80, *unk, unk2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0183(struct ScriptContext* ctx) +{ + void** unk = FUN_02039438(ctx->unk80, 10); + struct UnkStruct_02029FB0* unk2 = FUN_02029FC8(ctx->unk80->saveBlock2); + u16 unk3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_0204B5A8(ctx->unk80, *unk, unk3); + FUN_0202A0E8(unk2, 3); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx) +{ + u16 unk = ScriptReadHalfword(ctx); + + switch (unk) + { + case 0: + FUN_0204B9A0(ctx->unk80); + break; + case 1: + FUN_0204B9CC(ctx->unk80); + break; + default: + GF_ASSERT(FALSE); + break; + } + + return TRUE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0185(struct ScriptContext* ctx) +{ + struct UnkStruct_02029FB0* unk = FUN_02029FC8(ctx->unk80->saveBlock2); + void** unk2 = FUN_02039438(ctx->unk80, 10); + + FUN_0204B4FC(ctx->unk80, *unk2); + FUN_0202A170(unk, 0); + + return FALSE; +} diff --git a/arm9/src/scrcmd_23.c b/arm9/src/scrcmd_23.c new file mode 100644 index 00000000..0c9907a5 --- /dev/null +++ b/arm9/src/scrcmd_23.c @@ -0,0 +1,169 @@ +#include "scrcmd.h" + +extern BOOL FUN_02025D6C(void*, u16); +extern BOOL FUN_02025D94(void*, u16); +extern BOOL FUN_02026298(void*, u16); +extern void* FUN_02026CC4(struct SaveBlock2* sav2); +extern BOOL FUN_020260C4(void*, u16, u16); + +THUMB_FUNC BOOL ScrCmd_Unk0083(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk2 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_02025D6C(unk2, unk1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0084(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0085(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk2 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_02025D94(unk2, unk1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0086(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0087(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk2 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_02026298(unk2, unk1); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0088(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0089(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008A(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008B(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unused3 = FUN_02026CC4(sav2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008C(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008D(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008E(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk008F(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + void* unk3 = FUN_02026CC4(sav2); + + *ret_ptr = (u16)FUN_020260C4(unk3, unk1, unk2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0090(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0091(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0092(struct ScriptContext* ctx) +{ + u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + return FALSE; +} diff --git a/arm9/src/scrcmd_25.c b/arm9/src/scrcmd_25.c index e3638675..5124ad9a 100644 --- a/arm9/src/scrcmd_25.c +++ b/arm9/src/scrcmd_25.c @@ -1,26 +1,26 @@ #include "scrcmd.h" -THUMB_FUNC BOOL ScrCmd_Unk02EF(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk023F(struct ScriptContext * ctx) { #pragma unused(ctx) GF_ASSERT(FALSE); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk02F0(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk0240(struct ScriptContext * ctx) { #pragma unused(ctx) GF_ASSERT(FALSE); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk02F1(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk0241(struct ScriptContext * ctx) { #pragma unused(ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk02F2(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_Unk0242(struct ScriptContext * ctx) { #pragma unused(ctx) return FALSE; diff --git a/arm9/src/scrcmd_daycare.c b/arm9/src/scrcmd_daycare.c new file mode 100644 index 00000000..4e2f925e --- /dev/null +++ b/arm9/src/scrcmd_daycare.c @@ -0,0 +1,192 @@ +#include "scrcmd.h" +#include "daycare.h" +#include "party.h" +#include "script_buffers.h" + +extern void* FUN_02039438(struct UnkSavStruct80*, int idx); + +extern void MOD05_021EC57C(struct PlayerParty* party, u8 idx, struct DayCare* daycare, struct SaveBlock2* sav2); +extern u16 MOD05_021EC71C(struct PlayerParty* party, struct ScrStrBufs* mgr, struct DayCare* daycare, u8 idx); +extern u16 MOD05_021EC854(struct DayCare* daycare, u8 idx, struct ScrStrBufs* mgr); +extern u8 MOD05_021EC864(struct DayCare* daycare, int idx, struct ScrStrBufs* mgr); +extern void MOD05_021ECD64(struct DayCare* daycare); +extern void MOD05_DayCare_GiveEggToPlayer(struct DayCare* daycare, struct PlayerParty* party, struct PlayerData* player); +extern void MOD05_021ED4E0(struct DayCare* daycare, struct ScrStrBufs* mgr); +extern void MOD05_021ED52C(struct DayCare* daycare, u8 idx1, u8 idx2, u8 idx3, u8 idx4, struct ScrStrBufs* mgr); +extern u16 MOD05_021ED5C4(struct PlayerParty* party, int idx, struct ScrStrBufs* mgr); +extern u16 MOD05_021ED5EC(struct DayCare* daycare); +extern u32 MOD05_021ED644(struct DayCare* daycare); + +THUMB_FUNC BOOL ScrCmd_Unk016D(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + struct DayCare* daycare = Sav2_DayCare_get(sav2); + + MOD05_021ED4E0(daycare, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk016E(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = MOD05_021ED5EC(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A8(struct ScriptContext* ctx) +{ + struct DayCare* daycare = SavArray_get(ctx->unk80->saveBlock2, 8); + MOD05_021ECD64(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A9(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct DayCare* daycare = SavArray_get(sav_ptr->saveBlock2, 8); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(ctx->unk80); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(sav2); + + MOD05_DayCare_GiveEggToPlayer(daycare, party, player); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A4(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + + *ret_ptr = MOD05_021EC71C(party, *mgr, daycare, (u8)idx); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AA(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = MOD05_021EC854(daycare, (u8)idx, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AE(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = MOD05_021EC864(daycare, idx, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AF(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u16 unused = ScriptReadHalfword(ctx); + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + + *ret_ptr = MOD05_021ED5C4(party, idx, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01B0(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct SaveBlock2* sav2 = sav_ptr->saveBlock2; + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct DayCare* daycare = SavArray_get(sav2, 8); + + MOD05_021EC57C(party, (u8)idx, daycare, sav2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01BC(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u16 idx1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx3 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 idx4 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = Sav2_DayCare_get(sav2); + + MOD05_021ED52C(daycare, (u8)idx1, (u8)idx2, (u8)idx3, (u8)idx4, *mgr); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01BE(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = (u16)MOD05_021ED644(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01BF(struct ScriptContext* ctx) +{ + struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; + u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + struct DayCare* daycare = SavArray_get(sav2, 8); + + *ret_ptr = (u16)Sav2_DayCare_GetEggPID(daycare); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A5(struct ScriptContext* ctx) +{ + u16* unused = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A6(struct ScriptContext* ctx) +{ +#pragma unused(ctx) + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01A7(struct ScriptContext* ctx) +{ +#pragma unused(ctx) + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk01AD(struct ScriptContext* ctx) +{ + u16* unused = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + return FALSE; +} diff --git a/arm9/src/scrcmd_names.c b/arm9/src/scrcmd_names.c new file mode 100644 index 00000000..cf721328 --- /dev/null +++ b/arm9/src/scrcmd_names.c @@ -0,0 +1,540 @@ +#include "scrcmd.h" +#include "event_data.h" +#include "itemtool.h" +#include "nutdata.h" +#include "party.h" +#include "player_data.h" +#include "script_buffers.h" +#include "unk_02024E64.h" +#include "unk_02064E4C.h" +#include "unk_0207FC5C.h" + +extern void* FUN_02039438(struct UnkSavStruct80* sav_ptr, int idx); + +extern u32 FUN_020536D0(u32 gender, u32 avatar, u32 a2); +extern u32 FUN_0205F388(struct ScriptState* state); +extern u32 FUN_0205F398(struct ScriptState* state); +extern struct PCStorage* GetStoragePCPointer(struct SaveBlock2* sav2); +extern u32 FUN_0205F3C0(struct ScriptState* state); +extern u32 FUN_02054C14(u32 number); + +THUMB_FUNC BOOL ScrCmd_GetPlayerName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(sav_ptr); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(sav2); + + BufferPlayersName(*mgr, idx, player); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetRivalName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + + BufferRivalsName(*mgr, idx, sav_ptr->saveBlock2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetFriendName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + + BufferFriendsName(*mgr, idx, sav_ptr->saveBlock2); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D0(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct Pokemon* mon = GetPartyMonByIndex(party, mon_idx); + + BufferBoxMonSpeciesName(*mgr, idx, &mon->box); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetItemName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferItemName(*mgr, idx, item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetPocketName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 pocket = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferPocketName(*mgr, idx, pocket); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetTMHMMoveName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 tmhm = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 move = TMHMGetMove(tmhm); + + BufferMoveName(*mgr, idx, move); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetMoveName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 move = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferMoveName(*mgr, idx, move); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D5(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u32 digits = FUN_02054C14(unk); + + BufferIntegerAsString(*mgr, idx, unk, digits, 1, TRUE); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0280(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u8 unk2 = ScriptReadByte(ctx); + u8 digits = ScriptReadByte(ctx); + if (unk2 == 0) + { + digits = (u8)FUN_02054C14(unk); + } + + BufferIntegerAsString(*mgr, idx, unk, digits, unk2, TRUE); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D6(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); + + BufferBoxMonNickname(*mgr, idx, &pokemon->box); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0251(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct PCStorage* pc = GetStoragePCPointer(sav_ptr->saveBlock2); + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 box_mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + s32 box_no = box_mon_idx / 30; + s32 slot_no = box_mon_idx % 30; + struct BoxPokemon* box_mon = PCStorage_GetMonByIndexPair(pc, box_no, slot_no); + + BufferBoxMonNickname(*mgr, idx, box_mon); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetPoketchAppName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 app = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferPoketchAppName(*mgr, idx, app); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetTrainerClassName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 trainer_class = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferTrainerClassName(*mgr, idx, trainer_class); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00D9(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct SaveBlock2* sav2 = ScriptEnvironment_GetSav2Ptr(sav_ptr); + struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(sav2); + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u32 gender = PlayerProfile_GetTrainerGender(player); + u32 avatar = PlayerProfile_GetAvatar(player); + u32 trainer_class = FUN_020536D0(gender, avatar, 2); + + BufferTrainerClassNameWithArticle(*mgr, idx, trainer_class); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DA(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 msg_no = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk1 = ScriptReadHalfword(ctx); + u8 unk2 = ScriptReadByte(ctx); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, unk1, unk2, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC struct String* FUN_02040AE4(u32 msg_no, u32 heap_id) +{ + struct MsgData* msg_data = NewMsgDataFromNarc(1, NARC_MSGDATA_MSG, 362, heap_id); + struct String* ret = NewString_ReadMsgData(msg_data, msg_no); + DestroyMsgData(msg_data); + + return ret; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DB(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 msg_no = FUN_0205F388(state); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DC(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 msg_no = FUN_0205F398(state); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00DD(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 msg_no = FUN_0205F3C0(state); + struct String* str = FUN_02040AE4(msg_no, 4); + + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetDecorationName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 decoration = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferDecorationName(*mgr, idx, decoration); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundTrapName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_trap = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundTrapName(*mgr, idx, underground_trap); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundItemName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundItemName(*mgr, idx, underground_item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk00E2(struct ScriptContext* ctx) +{ + struct String* str = String_ctor(22, 4); + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 map_no = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + FUN_02064E60(map_no, 4, str); + BufferString(*mgr, idx, str, 0, 1, 2); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk017B(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 berry = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct String* nut_name = GetNutName((u16)(berry - FIRST_BERRY_IDX), 32); + + BufferString(*mgr, idx, nut_name, 0, unk < 2, 2); + String_dtor(nut_name); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetNatureName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 nature = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferNatureName(*mgr, idx, nature); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetFashionName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 fashion = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferFashionName(*mgr, idx, fashion); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0272(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct String* str = String_ctor(11, 11); + struct UnkStruct_02024E64* unk = FUN_02024EB4(ctx->unk80->saveBlock2); + u16* unk_buffer = FUN_02024F0C(unk); + + CopyU16ArrayToString(str, unk_buffer); + BufferString(*mgr, idx, str, 0, 0, gGameLanguage); + String_dtor(str); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetPokemonMoveName(struct ScriptContext* ctx) +{ + struct UnkSavStruct80* sav_ptr = ctx->unk80; + struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); + u8 idx = ScriptReadByte(ctx); + u16 mon_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 mon_move_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + struct PlayerParty* party = SavArray_PlayerParty_get(sav_ptr->saveBlock2); + struct Pokemon* pokemon = GetPartyMonByIndex(party, mon_idx); + u16 move = (u16)GetMonData(pokemon, MON_DATA_MOVE1 + mon_move_idx, NULL); + + BufferMoveName(*mgr, idx, move); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk0232(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u8 unk = (u8)VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 ribbon = (u16)FUN_0207FC5C(unk, 3); + + BufferRibbonNameOrDesc(*mgr, idx, ribbon); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetSealName(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 seal = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferSealName(*mgr, idx, (u16)(seal - 1)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetItemNameWithIndefArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferItemNameWithIndefArticle(*mgr, idx, item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetItemNamePlural(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferItemNamePlural(*mgr, idx, item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetDecorationNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 decoration = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferDecorationNameWithArticle(*mgr, idx, decoration); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundTrapNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_trap = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundTrapNameWithArticle(*mgr, idx, underground_trap); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetUndergroundItemNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 underground_item = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferUndergroundItemNameWithArticle(*mgr, idx, underground_item); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02C9(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 species = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 unused1 = ScriptReadHalfword(ctx); + u8 unused2 = ScriptReadByte(ctx); + + BufferSpeciesNameWithArticle(*mgr, idx, species); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02CA(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); + u32 species = FUN_0205F3C0(state); + + BufferSpeciesNameWithArticle(*mgr, idx, species); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetFashionNameWithArticle(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 fashion = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferFashionNameWithArticle(*mgr, idx, fashion); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_Unk02CC(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 trainer_class = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferTrainerClassNameWithArticle(*mgr, idx, trainer_class); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_GetSealNamePlural(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + u16 seal = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + + BufferSealNamePlural(*mgr, idx, (u16)(seal - 1)); + + return FALSE; +} + +THUMB_FUNC BOOL ScrCmd_CapitalizeFirstChar(struct ScriptContext* ctx) +{ + struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); + u8 idx = ScriptReadByte(ctx); + + ScrStrBufs_UpperFirstChar(*mgr, idx); + + return FALSE; +} |