diff options
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/gf_gfx_loader.c | 349 | ||||
-rw-r--r-- | arm9/src/main.c | 1 | ||||
-rw-r--r-- | arm9/src/scrcmd.c | 8 | ||||
-rw-r--r-- | arm9/src/scrcmd_20.c | 35 | ||||
-rw-r--r-- | arm9/src/scrcmd_8.c | 21 | ||||
-rw-r--r-- | arm9/src/scrcmd_berry_trees.c (renamed from arm9/src/scrcmd_11.c) | 18 | ||||
-rw-r--r-- | arm9/src/scrcmd_coins.c | 6 | ||||
-rw-r--r-- | arm9/src/scrcmd_daycare.c | 10 | ||||
-rw-r--r-- | arm9/src/scrcmd_flags.c | 48 | ||||
-rw-r--r-- | arm9/src/scrcmd_fossils.c (renamed from arm9/src/scrcmd_19.c) | 38 | ||||
-rw-r--r-- | arm9/src/scrcmd_mart.c | 442 | ||||
-rw-r--r-- | arm9/src/scrcmd_money.c | 6 | ||||
-rw-r--r-- | arm9/src/scrcmd_names.c | 18 | ||||
-rw-r--r-- | arm9/src/scrcmd_prizes.c | 36 | ||||
-rw-r--r-- | arm9/src/scrcmd_sound.c | 38 | ||||
-rw-r--r-- | arm9/src/scrcmd_underground.c (renamed from arm9/src/scrcmd_23.c) | 32 | ||||
-rw-r--r-- | arm9/src/script_buffers.c | 6 | ||||
-rw-r--r-- | arm9/src/text.c | 4 | ||||
-rw-r--r-- | arm9/src/unk_0200BB14.c | 1323 | ||||
-rw-r--r-- | arm9/src/unk_02016B94.c | 2 | ||||
-rw-r--r-- | arm9/src/unk_0208A300.c | 38 |
21 files changed, 2316 insertions, 163 deletions
diff --git a/arm9/src/gf_gfx_loader.c b/arm9/src/gf_gfx_loader.c new file mode 100644 index 00000000..769c90d9 --- /dev/null +++ b/arm9/src/gf_gfx_loader.c @@ -0,0 +1,349 @@ +#include "global.h"
+#include "filesystem.h"
+#include "NNS_g2d.h"
+#include "gf_gfx_loader.h"
+
+THUMB_FUNC u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct UnkStruct_02016B94_2 * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id)
+{
+ NNSG2dCharacterData * pCharData;
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberNo, isCompressed, heap_id, FALSE);
+ if (pFile != NULL)
+ {
+ if (NNS_G2dGetUnpackedBGCharacterData(pFile, &pCharData))
+ {
+ if (szByte == 0)
+ szByte = pCharData->szByte;
+ FUN_02017E14(unkStruct02016B94_2, (u8)a3, pCharData->pRawData, szByte, a4);
+ }
+ FreeToHeap(pFile);
+ }
+ return szByte;
+}
+
+THUMB_FUNC void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct UnkStruct_02016B94_2 * unkStruct02016B94_2, u32 a3, u32 a4, u32 szByte, BOOL isCompressed, u32 heap_id)
+{
+ NNSG2dScreenData * pScreenData;
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberNo, isCompressed, heap_id, TRUE);
+ if (pFile != NULL)
+ {
+ if (NNS_G2dGetUnpackedScreenData(pFile, &pScreenData))
+ {
+ if (szByte == 0)
+ szByte = pScreenData->szByte;
+ if (FUN_0201886C(unkStruct02016B94_2, (u8)a3) != NULL)
+ FUN_02017DFC(unkStruct02016B94_2, (u8)a3, pScreenData->rawData, szByte);
+ FUN_02017CE8(unkStruct02016B94_2, (u8)a3, pScreenData->rawData, szByte, a4);
+ }
+ FreeToHeap(pFile);
+ }
+}
+
+THUMB_FUNC void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, u32 whichRoutine, u32 baseAddr, u32 szByte, u32 heap_id)
+{
+ GfGfxLoader_GXLoadPalWithSrcOffset(narcId, memberNo, whichRoutine, 0, baseAddr, szByte, heap_id);
+}
+
+THUMB_FUNC void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, u32 whichRoutine, u32 srcOffset, u32 baseAddr, u32 szByte, u32 heap_id)
+{
+ static void (*const load_funcs[])(void *, u32, u32) = {
+ GX_LoadBGPltt,
+ GX_LoadOBJPltt,
+ GX_LoadBGExtPltt,
+ GX_LoadOBJExtPltt,
+ GXS_LoadBGPltt,
+ GXS_LoadOBJPltt,
+ GXS_LoadBGExtPltt,
+ GXS_LoadOBJExtPltt
+ };
+ NNSG2dPaletteData * pPltData;
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberNo, FALSE, heap_id, TRUE);
+ if (pFile != NULL)
+ {
+ if (NNS_G2dGetUnpackedPaletteData(pFile, &pPltData))
+ {
+ pPltData->pRawData = (void *)((u32)pPltData->pRawData + srcOffset);
+ if (szByte == 0)
+ szByte = pPltData->szByte - srcOffset;
+ DC_FlushRange(pPltData->pRawData, szByte);
+ switch (whichRoutine)
+ {
+ case 2:
+ GX_BeginLoadBGExtPltt();
+ load_funcs[whichRoutine](pPltData->pRawData, baseAddr, szByte);
+ GX_EndLoadBGExtPltt();
+ break;
+ case 6:
+ GXS_BeginLoadBGExtPltt();
+ load_funcs[whichRoutine](pPltData->pRawData, baseAddr, szByte);
+ GXS_EndLoadBGExtPltt();
+ break;
+ case 3:
+ GX_BeginLoadOBJExtPltt();
+ load_funcs[whichRoutine](pPltData->pRawData, baseAddr, szByte);
+ GX_EndLoadOBJExtPltt();
+ break;
+ case 7:
+ GXS_BeginLoadOBJExtPltt();
+ load_funcs[whichRoutine](pPltData->pRawData, baseAddr, szByte);
+ GXS_EndLoadOBJExtPltt();
+ break;
+ default:
+ load_funcs[whichRoutine](pPltData->pRawData, baseAddr, szByte);
+ break;
+ }
+ }
+ FreeToHeap(pFile);
+ }
+}
+
+THUMB_FUNC u32 GfGfxLoader_LoadWholePalette(NarcId narcId, s32 memberId, u32 whichRoutine, u32 baseAddr, u32 szByte, BOOL isCompressed, u32 heap_id)
+{
+ static void (*const load_funcs[])(void *, u32, u32) = {
+ GX_LoadOBJ,
+ GXS_LoadOBJ
+ };
+
+ NNSG2dCharacterData* pCharData;
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, TRUE);
+ if (pFile != NULL)
+ {
+ if (NNS_G2dGetUnpackedCharacterData(pFile, &pCharData))
+ {
+ if (szByte == 0)
+ szByte = pCharData->szByte;
+ DC_FlushRange(pCharData->pRawData, szByte);
+ load_funcs[whichRoutine](pCharData->pRawData, baseAddr, szByte);
+ }
+ FreeToHeap(pFile);
+ }
+ return szByte;
+}
+
+THUMB_FUNC void GfGfxLoader_PartiallyLoadPalette(NarcId narcId, s32 memberId, NNS_G2D_VRAM_TYPE vramType, u32 baseAddr, u32 heap_id, NNSG2dImagePaletteProxy * pPltProxy)
+{
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, FALSE, heap_id, TRUE);
+ NNSG2dPaletteData* pPlttData;
+ NNSG2dPaletteCompressInfo* pCompressInfo;
+ if (pFile != NULL)
+ {
+ BOOL isCompressed = NNS_G2dGetUnpackedPaletteCompressInfo(pFile, &pCompressInfo);
+ if (NNS_G2dGetUnpackedPaletteData(pFile, &pPlttData))
+ {
+ if (isCompressed)
+ {
+ NNS_G2dLoadPaletteEx(pPlttData, pCompressInfo, baseAddr, vramType, pPltProxy);
+ }
+ else
+ {
+ NNS_G2dLoadPalette(pPlttData, baseAddr, vramType, pPltProxy);
+ }
+ }
+ FreeToHeap(pFile);
+ }
+}
+
+THUMB_FUNC u32 GfGfxLoader_LoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 whichRoutine, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy *pImgProxy)
+{
+ static void (*const load_funcs[])(const NNSG2dCharacterData *, u32, NNS_G2D_VRAM_TYPE, NNSG2dImageProxy *) = {
+ NNS_G2dLoadImage1DMapping,
+ NNS_G2dLoadImage2DMapping
+ };
+
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, TRUE);
+ u32 retSize = 0;
+ NNSG2dCharacterData * pSrcData;
+ if (pFile != NULL)
+ {
+ if (NNS_G2dGetUnpackedCharacterData(pFile, &pSrcData))
+ {
+ if (szByte != 0)
+ pSrcData->szByte = szByte;
+ load_funcs[whichRoutine](pSrcData, baseAddr, type, pImgProxy);
+ retSize = pSrcData->szByte;
+ }
+ FreeToHeap(pFile);
+ }
+ return retSize;
+}
+
+THUMB_FUNC void GfGfxLoader_SetObjCntFlagsAndLoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 whichRoutine, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy * pImageProxy)
+{
+ static void (*const load_funcs[])(const NNSG2dCharacterData *, u32, NNS_G2D_VRAM_TYPE, NNSG2dImageProxy *) = {
+ NNS_G2dLoadImage1DMapping,
+ NNS_G2dLoadImage2DMapping
+ };
+ NNSG2dCharacterData * pCharacterData;
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, TRUE);
+ if (pFile != NULL)
+ {
+ if (NNS_G2dGetUnpackedCharacterData(pFile, &pCharacterData))
+ {
+ if (szByte != 0)
+ pCharacterData->szByte = szByte;
+ switch (type)
+ {
+ case NNS_G2D_VRAM_TYPE_2DMAIN:
+ pCharacterData->mapingType = (GXOBJVRamModeChar)(reg_GX_DISPCNT & (REG_GX_DISPCNT_EXOBJ_CH_MASK | REG_GX_DISPCNT_OBJMAP_CH_MASK));
+ break;
+ case NNS_G2D_VRAM_TYPE_2DSUB:
+ pCharacterData->mapingType = (GXOBJVRamModeChar)(reg_GXS_DB_DISPCNT & (REG_GXS_DB_DISPCNT_EXOBJ_MASK | REG_GXS_DB_DISPCNT_OBJMAP_CH_MASK));
+ break;
+ default:
+ ;
+ }
+ load_funcs[whichRoutine](pCharacterData, baseAddr, type, pImageProxy);
+ }
+ FreeToHeap(pFile);
+ }
+}
+
+THUMB_FUNC void * GfGfxLoader_GetCharData(NarcId narcId, s32 memberId, BOOL isCompressed, NNSG2dCharacterData ** ppCharData, u32 heap_id)
+{
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, FALSE);
+ if (pFile != NULL)
+ {
+ if (!NNS_G2dGetUnpackedBGCharacterData(pFile, ppCharData))
+ {
+ FreeToHeap(pFile);
+ return NULL;
+ }
+ }
+ return pFile;
+}
+
+THUMB_FUNC void * GfGfxLoader_GetScrnData(NarcId narcId, s32 memberId, BOOL isCompressed, NNSG2dScreenData ** ppScrData, u32 heap_id)
+{
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, FALSE);
+ if (pFile != NULL)
+ {
+ if (!NNS_G2dGetUnpackedScreenData(pFile, ppScrData))
+ {
+ FreeToHeap(pFile);
+ return NULL;
+ }
+ }
+ return pFile;
+}
+
+THUMB_FUNC void * GfGfxLoader_GetPlttData(NarcId narcId, s32 memberId, NNSG2dPaletteData ** ppPltData, u32 heap_id)
+{
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, FALSE, heap_id, FALSE);
+ if (pFile != NULL)
+ {
+ if (!NNS_G2dGetUnpackedPaletteData(pFile, ppPltData))
+ {
+ FreeToHeap(pFile);
+ return NULL;
+ }
+ }
+ return pFile;
+}
+
+THUMB_FUNC void * GfGfxLoader_GetCellBank(NarcId narcId, s32 memberId, BOOL isCompressed, NNSG2dCellDataBank ** ppCellBank, u32 heap_id)
+{
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, FALSE);
+ if (pFile != NULL)
+ {
+ if (!NNS_G2dGetUnpackedCellBank(pFile, ppCellBank))
+ {
+ FreeToHeap(pFile);
+ return NULL;
+ }
+ }
+ return pFile;
+}
+
+THUMB_FUNC void * GfGfxLoader_GetAnimBank(NarcId narcId, s32 memberId, BOOL isCompressed, NNSG2dAnimBankData ** ppAnimBank, u32 heap_id)
+{
+ void * pFile = GfGfxLoader_LoadFromNarc(narcId, memberId, isCompressed, heap_id, FALSE);
+ if (pFile != NULL)
+ {
+ if (!NNS_G2dGetUnpackedAnimBank(pFile, ppAnimBank))
+ {
+ FreeToHeap(pFile);
+ return NULL;
+ }
+ }
+ return pFile;
+}
+
+THUMB_FUNC void * GfGfxLoader_UncompressFromNarc(NarcId narcId, s32 memberId, u32 heap_id)
+{
+ return GfGfxLoader_LoadFromNarc(narcId, memberId, TRUE, heap_id, FALSE);
+}
+
+THUMB_FUNC void * GfGfxLoader_LoadFromNarc(NarcId narcId, s32 memberNo, BOOL isCompressed, u32 heap_id, BOOL allocAtEnd)
+{
+ void * dest;
+ void * dest2;
+ if (isCompressed || allocAtEnd == TRUE)
+ {
+ u32 size = GetNarcMemberSizeByIdPair(narcId, memberNo);
+ dest = AllocFromHeapAtEnd(heap_id, size);
+ }
+ else
+ {
+ u32 size = GetNarcMemberSizeByIdPair(narcId, memberNo);
+ dest = AllocFromHeap(heap_id, size);
+ }
+ if (dest != NULL)
+ {
+ ReadWholeNarcMemberByIdPair(dest, narcId, memberNo);
+ if (isCompressed)
+ {
+ if (allocAtEnd == FALSE)
+ {
+ dest2 = AllocFromHeap(heap_id, (*(u32 *)dest) >> 8);
+ }
+ else
+ {
+ dest2 = AllocFromHeapAtEnd(heap_id, (*(u32 *)dest) >> 8);
+ }
+ if (dest2 != NULL)
+ {
+ MI_UncompressLZ8(dest, dest2);
+ FreeToHeap(dest);
+ }
+ dest = dest2; // UB: if dest2 is NULL, dest is never freed
+ }
+ }
+ return dest;
+}
+
+THUMB_FUNC void * GfGfxLoader_LoadFromNarc_GetSizeOut(NarcId narcId, s32 memberNo, BOOL isCompressed, u32 heap_id, BOOL allocAtEnd, u32 *size_p)
+{
+ void * dest;
+ void * dest2;
+ *size_p = GetNarcMemberSizeByIdPair(narcId, memberNo);
+ if (isCompressed || allocAtEnd == TRUE)
+ {
+ dest = AllocFromHeapAtEnd(heap_id, *size_p);
+ }
+ else
+ {
+ dest = AllocFromHeap(heap_id, *size_p);
+ }
+ if (dest != NULL)
+ {
+ ReadWholeNarcMemberByIdPair(dest, narcId, memberNo);
+ if (isCompressed)
+ {
+ *size_p = (*(u32 *)dest) >> 8;
+ if (allocAtEnd == FALSE)
+ {
+ dest2 = AllocFromHeap(heap_id, *size_p);
+ }
+ else
+ {
+ dest2 = AllocFromHeapAtEnd(heap_id, *size_p);
+ }
+ if (dest2 != NULL)
+ {
+ MI_UncompressLZ8(dest, dest2);
+ FreeToHeap(dest);
+ }
+ dest = dest2; // UB: if dest2 is NULL, dest is never freed
+ }
+ }
+ return dest;
+}
diff --git a/arm9/src/main.c b/arm9/src/main.c index 7a8a14d8..749bec41 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -16,7 +16,6 @@ #include "unk_0202F150.h" #include "module_52.h" - FS_EXTERN_OVERLAY(MODULE_52); FS_EXTERN_OVERLAY(MODULE_63); diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 75ddbc8e..7adb1fe8 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -578,7 +578,7 @@ THUMB_FUNC BOOL ScrCmd_Unk01FF(struct ScriptContext *ctx) return TRUE; } -THUMB_FUNC BOOL ScrCmd_Unk026D(struct ScriptContext *ctx) //message unown font? +THUMB_FUNC BOOL ScrCmd_MessageUnown(struct ScriptContext *ctx) { struct UnkStruct_0203A288 myLocalStruct; u16 msg = ScriptReadHalfword(ctx); @@ -743,7 +743,7 @@ THUMB_FUNC static BOOL FUN_0203A4E0(struct ScriptContext *ctx) return TRUE; } -THUMB_FUNC BOOL ScrCmd_Unk0032(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_WaitButtonABPad(struct ScriptContext *ctx) { SetupNativeScript(ctx, FUN_0203A570); return TRUE; @@ -773,7 +773,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0033(struct ScriptContext *ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0034(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_CloseMessageBox(struct ScriptContext* ctx) { struct UnkSavStruct80 *unk80 = ctx->unk80; struct Window *unk = FUN_02039438(unk80, 0x1); @@ -1302,7 +1302,7 @@ THUMB_FUNC BOOL ScrCmd_Unk02D0(struct ScriptContext *ctx) return TRUE; } -THUMB_FUNC BOOL ScrCmd_Unk005E(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_Unk005E(struct ScriptContext *ctx) //ApplyMovement? { u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u32 unk2 = ScriptReadWord(ctx); diff --git a/arm9/src/scrcmd_20.c b/arm9/src/scrcmd_20.c deleted file mode 100644 index 882126a0..00000000 --- a/arm9/src/scrcmd_20.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "scrcmd.h" - -const u16 UNK_020F452A[19][2] = { - { 0x00FB, 0x03E8 }, - { 0x0109, 0x03E8 }, - { 0x0114, 0x03E8 }, - { 0x0115, 0x03E8 }, - { 0x01A1, 0x07D0 }, - { 0x0181, 0x07D0 }, - { 0x0192, 0x0FA0 }, - { 0x0167, 0x0FA0 }, - { 0x0173, 0x1770 }, - { 0x01A0, 0x1770 }, - { 0x0151, 0x1770 }, - { 0x0162, 0x1F40 }, - { 0x015C, 0x1F40 }, - { 0x016A, 0x2710 }, - { 0x015F, 0x2710 }, - { 0x0154, 0x2710 }, - { 0x0164, 0x2710 }, - { 0x0191, 0x3A98 }, - { 0x018B, 0x4E20 }, -}; - -THUMB_FUNC BOOL ScrCmd_Unk02A6(struct ScriptContext * ctx) -{ - u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); - u16 * ret_ptr1 = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); - u16 * ret_ptr2 = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); - - *ret_ptr1 = UNK_020F452A[idx][0]; - *ret_ptr2 = UNK_020F452A[idx][1]; - - return FALSE; -} diff --git a/arm9/src/scrcmd_8.c b/arm9/src/scrcmd_8.c index ba35b302..0c47594b 100644 --- a/arm9/src/scrcmd_8.c +++ b/arm9/src/scrcmd_8.c @@ -8,51 +8,52 @@ extern void FUN_020385CC(struct UnkStruct_0204639C*, u32, u32, u32, u32, u16*, u extern BOOL FUN_020612EC(struct UnkSavStruct80*); extern BOOL FUN_020612F8(struct UnkSavStruct80*); -THUMB_FUNC BOOL ScrCmd_Unk021D(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_Unk021D(struct ScriptContext* ctx) //docs has this command as ScrCmd_Group, with a comment saying + //"This command is the devil" { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); struct UnkSaveStruct_020286F8* unk_sav_ptr = FUN_0202881C(ctx->unk80->saveBlock2); struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; - u16 unk = ScriptReadHalfword(ctx); - switch (unk) + u16 option = ScriptReadHalfword(ctx); + switch (option) { - case 0: { + case 0: { //check if group ID exists u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); *ret_ptr = (u16)FUN_02028828(unk_sav_ptr, unk_var); return FALSE; } - case 1: { + case 1: { //check if group ID is accessible u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); *ret_ptr = (u16)FUN_02028840(unk_sav_ptr, unk_var); return FALSE; } - case 2: { + case 2: { //writes group ID to string buffer u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); BufferEasyChatWord(*mgr, sav2, unk_var, idx, 0); break; } - case 3: { + case 3: { //writes group leader name to string buffer u16 unk_var = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); BufferEasyChatWord(*mgr, sav2, unk_var, idx, 1); break; } - case 4: { + case 4: { //opens keyboard, 2 if group id exists, 1 if cancel, 0 otherwise u16* unk_str_ptr = FUN_020287A8(unk_sav_ptr, 0, 0); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); FUN_020385CC(ctx->unk74, 5, 0, 7, 0, unk_str_ptr, ret_ptr); return TRUE; } - case 5: { + case 5: { //enter in group id (whatever this means, needs more investigation) u16 src_idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); BOOL unk_bool = FUN_02028828(unk_sav_ptr, 1); @@ -64,7 +65,7 @@ THUMB_FUNC BOOL ScrCmd_Unk021D(struct ScriptContext* ctx) return FALSE; } - case 6: { + case 6: { //create a group struct String* player_name = String_ctor(64, 32); struct PlayerData* player = Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2); diff --git a/arm9/src/scrcmd_11.c b/arm9/src/scrcmd_berry_trees.c index 8553adfa..53715ca1 100644 --- a/arm9/src/scrcmd_11.c +++ b/arm9/src/scrcmd_berry_trees.c @@ -16,7 +16,7 @@ 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) +THUMB_FUNC BOOL ScrCmd_GetBerryTreeGrowth(struct ScriptContext* ctx) { u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); void** unk = FUN_02039438(ctx->unk80, 10); @@ -26,7 +26,7 @@ THUMB_FUNC BOOL ScrCmd_Unk017D(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk017E(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetBerryTreeType(struct ScriptContext* ctx) { void** unk = FUN_02039438(ctx->unk80, 10); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -36,7 +36,7 @@ THUMB_FUNC BOOL ScrCmd_Unk017E(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk017F(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetBerryTreeMulch(struct ScriptContext* ctx) { void** unk = FUN_02039438(ctx->unk80, 10); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -46,7 +46,7 @@ THUMB_FUNC BOOL ScrCmd_Unk017F(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0180(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetBerryTreeWater(struct ScriptContext* ctx) { void** unk = FUN_02039438(ctx->unk80, 10); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -56,7 +56,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0180(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0181(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetBerryTreeAmount(struct ScriptContext* ctx) { void** unk = FUN_02039438(ctx->unk80, 10); u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -66,7 +66,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0181(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0182(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_SetBerryTreeMulch(struct ScriptContext* ctx) { void** unk = FUN_02039438(ctx->unk80, 10); u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -76,7 +76,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0182(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0183(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_SetBerryTreeType(struct ScriptContext* ctx) { void** unk = FUN_02039438(ctx->unk80, 10); struct UnkStruct_02029FB0* unk2 = FUN_02029FC8(ctx->unk80->saveBlock2); @@ -88,7 +88,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0183(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx) //SetBerryTreeWater/WaterBerryTree, or just the animation? { u16 unk = ScriptReadHalfword(ctx); @@ -108,7 +108,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0184(struct ScriptContext* ctx) return TRUE; } -THUMB_FUNC BOOL ScrCmd_Unk0185(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_TakeBerryTreeBerries(struct ScriptContext* ctx) { struct UnkStruct_02029FB0* unk = FUN_02029FC8(ctx->unk80->saveBlock2); void** unk2 = FUN_02039438(ctx->unk80, 10); diff --git a/arm9/src/scrcmd_coins.c b/arm9/src/scrcmd_coins.c index 59638c83..f4fea1de 100644 --- a/arm9/src/scrcmd_coins.c +++ b/arm9/src/scrcmd_coins.c @@ -7,7 +7,7 @@ extern u32 MOD05_021E2950(struct UnkSavStruct80* arg, u8, u8); extern MOD05_021E29B4(); extern MOD05_021E29C8(); -THUMB_FUNC BOOL ScrCmd_Unk0075(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_ShowCoinBox(struct ScriptContext * ctx) { struct UnkSavStruct80* sav_ptr = ctx->unk80; u32 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -20,7 +20,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0075(struct ScriptContext * ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0076(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_HideCoinBox(struct ScriptContext * ctx) { u16 ** unk = FUN_02039438(ctx->unk80, 0x26); MOD05_021E29B4(*unk); @@ -28,7 +28,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0076(struct ScriptContext * ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0077(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_UpdateCoinBox(struct ScriptContext * ctx) { u16 ** unk = FUN_02039438(ctx->unk80, 0x26); MOD05_021E29C8(ctx->unk80, *unk); diff --git a/arm9/src/scrcmd_daycare.c b/arm9/src/scrcmd_daycare.c index 4e2f925e..34abab1e 100644 --- a/arm9/src/scrcmd_daycare.c +++ b/arm9/src/scrcmd_daycare.c @@ -17,7 +17,7 @@ extern u16 MOD05_021ED5C4(struct PlayerParty* party, int idx, struct ScrStrBufs* extern u16 MOD05_021ED5EC(struct DayCare* daycare); extern u32 MOD05_021ED644(struct DayCare* daycare); -THUMB_FUNC BOOL ScrCmd_Unk016D(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetDaycarePokemonNames(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); @@ -28,7 +28,7 @@ THUMB_FUNC BOOL ScrCmd_Unk016D(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk016E(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetDaycareStatus(struct ScriptContext* ctx) { struct UnkSavStruct80* sav_ptr = ctx->unk80; struct SaveBlock2* sav2 = sav_ptr->saveBlock2; @@ -40,7 +40,7 @@ THUMB_FUNC BOOL ScrCmd_Unk016E(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01A8(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_DeleteDaycareEgg(struct ScriptContext* ctx) { struct DayCare* daycare = SavArray_get(ctx->unk80->saveBlock2, 8); MOD05_021ECD64(daycare); @@ -48,7 +48,7 @@ THUMB_FUNC BOOL ScrCmd_Unk01A8(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01A9(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GiveDaycareEgg(struct ScriptContext* ctx) { struct UnkSavStruct80* sav_ptr = ctx->unk80; struct DayCare* daycare = SavArray_get(sav_ptr->saveBlock2, 8); @@ -90,7 +90,7 @@ THUMB_FUNC BOOL ScrCmd_Unk01AA(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01AE(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetDaycareLevel(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); diff --git a/arm9/src/scrcmd_flags.c b/arm9/src/scrcmd_flags.c index c0f6a519..ee13ebc0 100644 --- a/arm9/src/scrcmd_flags.c +++ b/arm9/src/scrcmd_flags.c @@ -47,7 +47,7 @@ THUMB_FUNC BOOL ScrCmd_GiveSinnohDex(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0159(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_HasRunningShoes(struct ScriptContext* ctx) { u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); void* unk_sav_ptr = FUN_02034E30(ctx->unk80->saveBlock2); @@ -58,7 +58,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0159(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk015A(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GiveRunningShoes(struct ScriptContext* ctx) { void* unk_sav_ptr = FUN_02034E30(ctx->unk80->saveBlock2); void* unk = FUN_02034E20(unk_sav_ptr); @@ -91,7 +91,7 @@ THUMB_FUNC BOOL ScrCmd_GiveBadge(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk015E(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GiveBag(struct ScriptContext* ctx) { u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); @@ -121,7 +121,7 @@ THUMB_FUNC BOOL ScrCmd_GetTotalEarnedBadges(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk015F(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_HasBag(struct ScriptContext* ctx) { struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); @@ -186,7 +186,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0165(struct ScriptContext* ctx) return 0; } -THUMB_FUNC BOOL ScrCmd_Unk0166(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_CheckGameCompleted(struct ScriptContext* ctx) { u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); @@ -196,7 +196,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0166(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0167(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_SetGameCompleted(struct ScriptContext* ctx) { struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); @@ -205,21 +205,21 @@ THUMB_FUNC BOOL ScrCmd_Unk0167(struct ScriptContext* ctx) return 0; } -THUMB_FUNC BOOL ScrCmd_Unk01CF(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetSetStrength(struct ScriptContext* ctx) { struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); - u8 unk = ScriptReadByte(ctx); + u8 option = ScriptReadByte(ctx); u16* ret_ptr; - switch (unk) + switch (option) { - case 1: + case 1: //set strength to on FUN_0205F264(state, 1); break; - case 0: + case 0: //set strength to off FUN_0205F264(state, 0); break; - case 2: + case 2: //get whether strength is on or off ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); *ret_ptr = (u16)FUN_0205F264(state, 2); break; @@ -231,21 +231,21 @@ THUMB_FUNC BOOL ScrCmd_Unk01CF(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01D0(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetSetFlash(struct ScriptContext* ctx) { struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); - u8 unk = ScriptReadByte(ctx); + u8 option = ScriptReadByte(ctx); u16* ret_ptr; - switch (unk) + switch (option) { - case 1: + case 1: //set flash to on FUN_0205F274(state); break; - case 0: + case 0: //set flash to off FUN_0205F284(state); break; - case 2: + case 2: //get whether flash is on or off ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); *ret_ptr = (u16)FUN_0205F294(state); break; @@ -257,21 +257,21 @@ THUMB_FUNC BOOL ScrCmd_Unk01D0(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01D1(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetSetDefog(struct ScriptContext* ctx) { struct ScriptState* state = SavArray_Flags_get(ctx->unk80->saveBlock2); - u8 unk = ScriptReadByte(ctx); + u8 option = ScriptReadByte(ctx); u16* ret_ptr; - switch (unk) + switch (option) { - case 1: + case 1: //set defog to on FUN_0205F2A4(state); break; - case 0: + case 0: //set defog to off FUN_0205F2B4(state); break; - case 2: + case 2: //get whether defog is on or off ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); *ret_ptr = (u16)FUN_0205F2C4(state); break; diff --git a/arm9/src/scrcmd_19.c b/arm9/src/scrcmd_fossils.c index b0a201b7..e4177382 100644 --- a/arm9/src/scrcmd_19.c +++ b/arm9/src/scrcmd_fossils.c @@ -1,45 +1,45 @@ #include "scrcmd.h" #include "bag.h" -const u16 UNK_020F450C[7][2] = { - { 0x0067, 0x008E }, - { 0x0065, 0x008A }, - { 0x0066, 0x008C }, - { 0x0063, 0x0159 }, - { 0x0064, 0x015B }, - { 0x0068, 0x019A }, - { 0x0069, 0x0198 }, +const u16 gFossilPokemonMap[7][2] = { + { ITEM_OLD_AMBER, SPECIES_AERODACTYL }, + { ITEM_HELIX_FOSSIL, SPECIES_OMANYTE }, + { ITEM_DOME_FOSSIL, SPECIES_KABUTO }, + { ITEM_ROOT_FOSSIL, SPECIES_LILEEP }, + { ITEM_CLAW_FOSSIL, SPECIES_ANORITH }, + { ITEM_ARMOR_FOSSIL, SPECIES_SHIELDON }, + { ITEM_SKULL_FOSSIL, SPECIES_CRANIDOS }, }; -THUMB_FUNC BOOL ScrCmd_Unk01F1(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_CountFossils(struct ScriptContext * ctx) { struct UnkSavStruct80 * sav_ptr = ctx->unk80; - u16 * ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 *ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); u8 i; u16 total; for (i = 0, total = 0; i < 7; i++) { - total += Bag_GetQuantity(Sav2_Bag_get(sav_ptr->saveBlock2), UNK_020F450C[i][0], 4); + total += Bag_GetQuantity(Sav2_Bag_get(sav_ptr->saveBlock2), gFossilPokemonMap[i][0], 4); } *ret_ptr = total; return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01F4(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_GetFossilPokemon(struct ScriptContext * ctx) { - u16 * ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); - u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16 *ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16 fossilId = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); *ret_ptr = 0; for (u16 i = 0; i < 7; i++) { - if (UNK_020F450C[i][0] == unk) + if (gFossilPokemonMap[i][0] == fossilId) { - *ret_ptr = UNK_020F450C[i][1]; + *ret_ptr = gFossilPokemonMap[i][1]; break; } } @@ -47,7 +47,7 @@ THUMB_FUNC BOOL ScrCmd_Unk01F4(struct ScriptContext * ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk01F5(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_GetFossilMinimumAmount(struct ScriptContext * ctx) { struct UnkSavStruct80* sav_ptr = ctx->unk80; u16 * ret_ptr1 = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -61,10 +61,10 @@ THUMB_FUNC BOOL ScrCmd_Unk01F5(struct ScriptContext * ctx) u16 total = 0; for (; i < 7; i++) { - total += Bag_GetQuantity(Sav2_Bag_get(sav_ptr->saveBlock2), UNK_020F450C[i][0], 4); + total += Bag_GetQuantity(Sav2_Bag_get(sav_ptr->saveBlock2), gFossilPokemonMap[i][0], 4); if (total >= needed_amount) { - *ret_ptr1 = UNK_020F450C[i][0]; + *ret_ptr1 = gFossilPokemonMap[i][0]; *ret_ptr2 = i; break; } diff --git a/arm9/src/scrcmd_mart.c b/arm9/src/scrcmd_mart.c new file mode 100644 index 00000000..6803617c --- /dev/null +++ b/arm9/src/scrcmd_mart.c @@ -0,0 +1,442 @@ +#include "global.h"
+#include "constants/items.h"
+#include "constants/seal_constants.h"
+#include "constants/decorations.h"
+#include "scrcmd.h"
+#include "module_06.h"
+
+extern void FUN_02038AD0(struct UnkStruct_0204639C *);
+
+static const u16 UNK_020F40A6[] = {
+ ITEM_AIR_MAIL,
+ ITEM_HEAL_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40A0[] = {
+ ITEM_STEEL_MAIL,
+ ITEM_LUXURY_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40B4[] = {
+ ITEM_TUNNEL_MAIL,
+ ITEM_HEAL_BALL,
+ ITEM_NET_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40AC[] = {
+ ITEM_BLOOM_MAIL,
+ ITEM_HEAL_BALL,
+ ITEM_NET_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40BC[] = {
+ ITEM_AIR_MAIL,
+ ITEM_HEAL_BALL,
+ ITEM_NET_BALL,
+ ITEM_NEST_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40F8[] = {
+ ITEM_HEART_MAIL,
+ ITEM_HEAL_BALL,
+ ITEM_NET_BALL,
+ ITEM_NEST_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4102[] = {
+ ITEM_AIR_MAIL,
+ ITEM_QUICK_BALL,
+ ITEM_TIMER_BALL,
+ ITEM_REPEAT_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40DA[] = {
+ ITEM_AIR_MAIL,
+ ITEM_NET_BALL,
+ ITEM_NEST_BALL,
+ ITEM_DUSK_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40EE[] = {
+ ITEM_AIR_MAIL,
+ ITEM_DUSK_BALL,
+ ITEM_QUICK_BALL,
+ ITEM_TIMER_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40D0[] = {
+ ITEM_SNOW_MAIL,
+ ITEM_DUSK_BALL,
+ ITEM_QUICK_BALL,
+ ITEM_TIMER_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40C6[] = {
+ ITEM_HEAL_POWDER,
+ ITEM_ENERGYPOWDER,
+ ITEM_ENERGY_ROOT,
+ ITEM_REVIVAL_HERB,
+ 0xFFFF
+};
+
+static const u16 UNK_020F40E4[] = {
+ ITEM_AIR_MAIL,
+ ITEM_NEST_BALL,
+ ITEM_DUSK_BALL,
+ ITEM_QUICK_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F410C[] = {
+ DECORATION_YELLOW_CUSHION,
+ DECORATION_CUPBOARD,
+ DECORATION_TV,
+ DECORATION_REFRIGERATOR,
+ DECORATION_PRETTY_SINK,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4118[] = {
+ DECORATION_MUNCHLAX_DOLL,
+ DECORATION_BONSLY_DOLL,
+ DECORATION_MIME_JR__DOLL,
+ DECORATION_MANTYKE_DOLL,
+ DECORATION_BUIZEL_DOLL,
+ DECORATION_CHATOT_DOLL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4126[] = {
+ ITEM_PROTEIN,
+ ITEM_IRON,
+ ITEM_CALCIUM,
+ ITEM_ZINC,
+ ITEM_CARBOS,
+ ITEM_HP_UP,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4134[] = {
+ ITEM_TM38,
+ ITEM_TM25,
+ ITEM_TM14,
+ ITEM_TM22,
+ ITEM_TM52,
+ ITEM_TM15,
+ 0xFFFF
+};
+
+static const u16 UNK_020F41B2[] = {
+ SEAL_STAR_A,
+ SEAL_A,
+ SEAL_FIRE_A,
+ SEAL_SONG_A,
+ SEAL_LINE_B,
+ SEAL_ELE_B,
+ SEAL_PARTY_D,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4142[] = {
+ SEAL_HEART_B,
+ SEAL_STAR_C,
+ SEAL_FIRE_C,
+ SEAL_FLORA_B,
+ SEAL_SONG_C,
+ SEAL_SMOKE_A,
+ SEAL_ELE_D,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4152[] = {
+ SEAL_FOAMY_D,
+ SEAL_PARTY_C,
+ SEAL_FLORA_F,
+ SEAL_SONG_G,
+ SEAL_HEART_F,
+ SEAL_LINE_A,
+ SEAL_ELE_A,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4162[] = {
+ SEAL_HEART_C,
+ SEAL_STAR_D,
+ SEAL_FIRE_D,
+ SEAL_FLORA_C,
+ SEAL_SONG_D,
+ SEAL_SMOKE_B,
+ SEAL_FOAMY_A,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4172[] = {
+ SEAL_HEART_D,
+ SEAL_FOAMY_B,
+ SEAL_PARTY_A,
+ SEAL_FLORA_D,
+ SEAL_SONG_E,
+ SEAL_STAR_E,
+ SEAL_SMOKE_C,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4182[] = {
+ ITEM_TM83,
+ ITEM_TM17,
+ ITEM_TM54,
+ ITEM_TM20,
+ ITEM_TM33,
+ ITEM_TM16,
+ ITEM_TM70,
+ 0xFFFF
+};
+
+static const u16 UNK_020F4192[] = {
+ SEAL_HEART_A,
+ SEAL_STAR_B,
+ SEAL_FIRE_B,
+ SEAL_SONG_B,
+ SEAL_LINE_C,
+ SEAL_ELE_C,
+ SEAL_FLORA_A,
+ 0xFFFF
+};
+
+static const u16 UNK_020F41A2[] = {
+ SEAL_FOAMY_C,
+ SEAL_PARTY_B,
+ SEAL_FLORA_E,
+ SEAL_SONG_F,
+ SEAL_HEART_E,
+ SEAL_STAR_F,
+ SEAL_SMOKE_D,
+ 0xFFFF
+};
+
+static const u16 UNK_020F41D4[] = {
+ ITEM_X_SPEED,
+ ITEM_X_ATTACK,
+ ITEM_X_DEFENSE,
+ ITEM_GUARD_SPEC_,
+ ITEM_DIRE_HIT,
+ ITEM_X_ACCURACY,
+ ITEM_X_SPECIAL,
+ ITEM_X_SP__DEF,
+ 0xFFFF
+};
+
+static const u16 UNK_020F41C2[] = {
+ ITEM_HEAL_BALL,
+ ITEM_NET_BALL,
+ ITEM_NEST_BALL,
+ ITEM_DUSK_BALL,
+ ITEM_QUICK_BALL,
+ ITEM_TIMER_BALL,
+ ITEM_REPEAT_BALL,
+ ITEM_LUXURY_BALL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F41E6[] = {
+ ITEM_POTION,
+ ITEM_SUPER_POTION,
+ ITEM_HYPER_POTION,
+ ITEM_MAX_POTION,
+ ITEM_REVIVE,
+ ITEM_ANTIDOTE,
+ ITEM_PARLYZ_HEAL,
+ ITEM_BURN_HEAL,
+ ITEM_ICE_HEAL,
+ ITEM_AWAKENING,
+ ITEM_FULL_HEAL,
+ 0xFFFF
+};
+
+static const u16 UNK_020F41FE[] = {
+ ITEM_POKE_BALL,
+ ITEM_GREAT_BALL,
+ ITEM_ULTRA_BALL,
+ ITEM_ESCAPE_ROPE,
+ ITEM_POKE_DOLL,
+ ITEM_REPEL,
+ ITEM_SUPER_REPEL,
+ ITEM_MAX_REPEL,
+ ITEM_GRASS_MAIL,
+ ITEM_FLAME_MAIL,
+ ITEM_BUBBLE_MAIL,
+ ITEM_SPACE_MAIL,
+ 0xFFFF
+};
+
+static const u16 sNormalMartBadgeThresholds[][2] = {
+ // Balls
+ {ITEM_POKE_BALL, 1},
+ {ITEM_GREAT_BALL, 3},
+ {ITEM_ULTRA_BALL, 4},
+ // Potions
+ {ITEM_POTION, 1},
+ {ITEM_SUPER_POTION, 2},
+ {ITEM_HYPER_POTION, 4},
+ {ITEM_MAX_POTION, 5},
+ {ITEM_FULL_RESTORE, 6},
+ // Revives
+ {ITEM_REVIVE, 3},
+ // Status heal
+ {ITEM_ANTIDOTE, 1},
+ {ITEM_PARLYZ_HEAL, 1},
+ {ITEM_AWAKENING, 2},
+ {ITEM_BURN_HEAL, 2},
+ {ITEM_ICE_HEAL, 2},
+ {ITEM_FULL_HEAL, 4},
+ // Dungeon items
+ {ITEM_ESCAPE_ROPE, 2},
+ // Repels
+ {ITEM_REPEL, 2},
+ {ITEM_SUPER_REPEL, 3},
+ {ITEM_MAX_REPEL, 4},
+};
+
+const u16 *sDecorationMartPointers[] = {
+ UNK_020F410C,
+ UNK_020F4118,
+};
+
+const u16 *sSpecialMartPointers[] = {
+ UNK_020F40A6,
+ UNK_020F40B4,
+ UNK_020F40AC,
+ UNK_020F40BC,
+ UNK_020F40C6,
+ UNK_020F40F8,
+ UNK_020F40DA,
+ UNK_020F40E4,
+ UNK_020F41E6,
+ UNK_020F41FE,
+ UNK_020F41D4,
+ UNK_020F4126,
+ UNK_020F4182,
+ UNK_020F4134,
+ UNK_020F40EE,
+ UNK_020F40D0,
+ UNK_020F4102,
+ UNK_020F40A0,
+ UNK_020F41C2,
+};
+
+const u16 *sSealsMartPointers[] = {
+ UNK_020F4192,
+ UNK_020F4142,
+ UNK_020F4162,
+ UNK_020F4172,
+ UNK_020F41A2,
+ UNK_020F4152,
+ UNK_020F41B2,
+};
+
+THUMB_FUNC BOOL ScrCmd_NormalMart(struct ScriptContext * ctx)
+{
+ u16 whichMart = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ s32 param;
+ u16 martItems[64];
+ u8 martIdx = 0;
+ u8 badgeCount = 0;
+ u8 i;
+
+ for (i = 0; i < 8; i++)
+ {
+ if (PlayerProfile_TestBadgeFlag(Sav2_PlayerData_GetProfileAddr(ctx->unk80->saveBlock2), i) == TRUE)
+ badgeCount++;
+ }
+ switch (badgeCount)
+ {
+ case 0:
+ param = 1;
+ break;
+ case 1:
+ case 2:
+ param = 2;
+ break;
+ case 3:
+ case 4:
+ param = 3;
+ break;
+ case 5:
+ case 6:
+ param = 4;
+ break;
+ case 7:
+ param = 5;
+ break;
+ case 8:
+ param = 6;
+ break;
+ default:
+ param = 1;
+ break;
+ }
+ for (i = 0; i < NELEMS(sNormalMartBadgeThresholds); i++)
+ {
+ if (param >= sNormalMartBadgeThresholds[i][1])
+ {
+ martItems[martIdx] = sNormalMartBadgeThresholds[i][0];
+ martIdx++;
+ }
+ }
+ martItems[martIdx] = 0xFFFF; // terminator
+ MOD06_0223D3D0(ctx->unk74, ctx->unk80, martItems, MART_ITEMS, 0);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL ScrCmd_SpecialMart(struct ScriptContext * ctx)
+{
+ u16 whichMart = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u32 sp0;
+
+ // Fakematch?
+ if ((u16)(whichMart + (u16)(-8u)) <= 5)
+ sp0 = 1;
+ else
+ sp0 = 0;
+
+ MOD06_0223D3D0(ctx->unk74, ctx->unk80, sSpecialMartPointers[whichMart], MART_ITEMS, sp0);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL ScrCmd_GoodsMart(struct ScriptContext * ctx)
+{
+ u16 whichMart = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+ u32 sp0;
+
+ if (whichMart <= 1)
+ sp0 = 1;
+ else
+ sp0 = 0;
+
+ MOD06_0223D3D0(ctx->unk74, ctx->unk80, sDecorationMartPointers[whichMart], MART_DECORATIONS, sp0);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL ScrCmd_SealsMart(struct ScriptContext * ctx)
+{
+ u16 whichMart = VarGet(ctx->unk80, ScriptReadHalfword(ctx));
+
+ MOD06_0223D3D0(ctx->unk74, ctx->unk80, sSealsMartPointers[whichMart], MART_SEALS, 0);
+ return TRUE;
+}
+
+THUMB_FUNC BOOL ScrCmd_AccessoriesShop(struct ScriptContext * ctx)
+{
+ FUN_02038AD0(ctx->unk80->unk10);
+ return TRUE;
+}
diff --git a/arm9/src/scrcmd_money.c b/arm9/src/scrcmd_money.c index d2254844..6f18d65d 100644 --- a/arm9/src/scrcmd_money.c +++ b/arm9/src/scrcmd_money.c @@ -82,7 +82,7 @@ THUMB_FUNC BOOL ScrCmd_HasEnoughMoneyAddress(struct ScriptContext * ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0072(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_ShowMoneyBox(struct ScriptContext * ctx) { struct UnkSavStruct80 * sav_ptr = ctx->unk80; u32 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -94,7 +94,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0072(struct ScriptContext * ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0073(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_HideMoneyBox(struct ScriptContext * ctx) { u32 ** unk = FUN_02039438(ctx->unk80, 0x27); MOD05_021E288C(*unk); @@ -102,7 +102,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0073(struct ScriptContext * ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0074(struct ScriptContext * ctx) +THUMB_FUNC BOOL ScrCmd_UpdateMoneyBox(struct ScriptContext * ctx) { u32 ** unk = FUN_02039438(ctx->unk80, 0x27); MOD05_021E28A0(ctx->unk80, *unk); diff --git a/arm9/src/scrcmd_names.c b/arm9/src/scrcmd_names.c index cf721328..ec1d8c92 100644 --- a/arm9/src/scrcmd_names.c +++ b/arm9/src/scrcmd_names.c @@ -53,7 +53,7 @@ THUMB_FUNC BOOL ScrCmd_GetFriendName(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk00D0(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetPokemonName(struct ScriptContext* ctx) { struct UnkSavStruct80* sav_ptr = ctx->unk80; struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); @@ -145,7 +145,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0280(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk00D6(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetPokemonNickname(struct ScriptContext* ctx) { struct UnkSavStruct80* sav_ptr = ctx->unk80; struct ScrStrBufs** mgr = FUN_02039438(sav_ptr, 15); @@ -237,7 +237,7 @@ THUMB_FUNC struct String* FUN_02040AE4(u32 msg_no, u32 heap_id) return ret; } -THUMB_FUNC BOOL ScrCmd_Unk00DB(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetPlayerStarterName(struct ScriptContext* ctx) { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); u8 idx = ScriptReadByte(ctx); @@ -251,7 +251,7 @@ THUMB_FUNC BOOL ScrCmd_Unk00DB(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk00DC(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetRivalStarterName(struct ScriptContext* ctx) { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); u8 idx = ScriptReadByte(ctx); @@ -265,7 +265,7 @@ THUMB_FUNC BOOL ScrCmd_Unk00DC(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk00DD(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetCounterpartStarterName(struct ScriptContext* ctx) { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); u8 idx = ScriptReadByte(ctx); @@ -312,7 +312,7 @@ THUMB_FUNC BOOL ScrCmd_GetUndergroundItemName(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk00E2(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetMapName(struct ScriptContext* ctx) { struct String* str = String_ctor(22, 4); struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); @@ -326,7 +326,7 @@ THUMB_FUNC BOOL ScrCmd_Unk00E2(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk017B(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetBerryName(struct ScriptContext* ctx) { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); u8 idx = ScriptReadByte(ctx); @@ -362,7 +362,7 @@ THUMB_FUNC BOOL ScrCmd_GetFashionName(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0272(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetWhiteRockInscription(struct ScriptContext* ctx) { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); u8 idx = ScriptReadByte(ctx); @@ -393,7 +393,7 @@ THUMB_FUNC BOOL ScrCmd_GetPokemonMoveName(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0232(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetRibbonName(struct ScriptContext* ctx) { struct ScrStrBufs** mgr = FUN_02039438(ctx->unk80, 15); u8 idx = ScriptReadByte(ctx); diff --git a/arm9/src/scrcmd_prizes.c b/arm9/src/scrcmd_prizes.c new file mode 100644 index 00000000..9a6cde41 --- /dev/null +++ b/arm9/src/scrcmd_prizes.c @@ -0,0 +1,36 @@ +#include "scrcmd.h" +#include "constants/items.h" + +const u16 gGameCornerPrizes[19][2] = { + { ITEM_SILK_SCARF, 1000 }, + { ITEM_WIDE_LENS, 1000 }, + { ITEM_ZOOM_LENS, 1000 }, + { ITEM_METRONOME, 1000 }, + { ITEM_TM90, 2000 }, + { ITEM_TM58, 2000 }, + { ITEM_TM75, 4000 }, + { ITEM_TM32, 4000 }, + { ITEM_TM44, 6000 }, + { ITEM_TM89, 6000 }, + { ITEM_TM10, 6000 }, + { ITEM_TM27, 8000 }, + { ITEM_TM21, 8000 }, + { ITEM_TM35, 10000 }, + { ITEM_TM24, 10000 }, + { ITEM_TM13, 10000 }, + { ITEM_TM29, 10000 }, + { ITEM_TM74, 15000 }, + { ITEM_TM68, 20000 }, +}; + +THUMB_FUNC BOOL ScrCmd_GetPrizeItemIdAndCost(struct ScriptContext* ctx) +{ + u16 idx = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); + u16* prize_item_id = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + u16* prize_cost_in_coins = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); + + *prize_item_id = gGameCornerPrizes[idx][0]; + *prize_cost_in_coins = gGameCornerPrizes[idx][1]; + + return FALSE; +} diff --git a/arm9/src/scrcmd_sound.c b/arm9/src/scrcmd_sound.c index df611ec7..ec5ab7f8 100644 --- a/arm9/src/scrcmd_sound.c +++ b/arm9/src/scrcmd_sound.c @@ -7,7 +7,7 @@ extern void FUN_0200433C(u32, u32, u32); extern u32 FUN_02005E28(void); extern void FUN_02005E64(void); extern BOOL FUN_02005CBC(void); -extern void PlayBGM(u16); +extern void PlaySound(u16); extern u32 FUN_02004124(u16); extern void FUN_0204AB20(struct UnkSavStruct80 *ctx, u16); extern u16 FUN_0204ABA8(struct UnkSavStruct80 *ctx, u32); @@ -38,33 +38,33 @@ THUMB_FUNC BOOL ScrCmd_Unk02AE(struct ScriptContext *ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0050(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_PlayBgm(struct ScriptContext *ctx) { FUN_0200521C(ScriptReadHalfword(ctx)); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0051(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_StopBgm(struct ScriptContext *ctx) { u32 unk0 = FUN_02004124(ScriptReadHalfword(ctx)); FUN_02005350(unk0, 0); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0052(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_PlayDefaultBgm(struct ScriptContext *ctx) { u16 unk0 = FUN_0204ABA8(ctx->unk80, *ctx->unk80->mapId); FUN_0200521C(unk0); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0053(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_Unk0053(struct ScriptContext *ctx) //Special BGM? { FUN_0204AB20(ctx->unk80, ScriptReadHalfword(ctx)); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0054(struct ScriptContext *ctx) +THUMB_FUNC BOOL ScrCmd_FadeOutBgm(struct ScriptContext *ctx) { u16 unk1 = ScriptReadHalfword(ctx); u16 unk2 = ScriptReadHalfword(ctx); @@ -85,7 +85,7 @@ THUMB_FUNC BOOL FUN_02041464(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0055(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_FadeInBgm(struct ScriptContext* ctx) { u16 unk = ScriptReadHalfword(ctx); @@ -120,21 +120,21 @@ THUMB_FUNC BOOL ScrCmd_Unk0058(struct ScriptContext* ctx) } -THUMB_FUNC BOOL ScrCmd_Unk0049(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_PlayFanfare(struct ScriptContext* ctx) { u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); FUN_020054C8(unk); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk004A(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_StopFanfare(struct ScriptContext* ctx) { u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); FUN_020054F0(unk, 0); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk004B(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_PlayFanfareWait(struct ScriptContext* ctx) { u16 unk = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -152,7 +152,7 @@ THUMB_FUNC BOOL FUN_02041540(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk004C(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_PlayCry(struct ScriptContext* ctx) { u16 unk0 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -176,15 +176,15 @@ THUMB_FUNC BOOL FUN_02041598(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_PlayBgm(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_PlaySound(struct ScriptContext* ctx) { u16 bgm_id = ScriptReadHalfword(ctx); - PlayBGM(bgm_id); + PlaySound(bgm_id); return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk004F(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_PlaySoundWait(struct ScriptContext* ctx) { SetupNativeScript(ctx, FUN_020415CC); return TRUE; @@ -199,7 +199,7 @@ THUMB_FUNC BOOL FUN_020415CC(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0059(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_CheckChatotCry(struct ScriptContext* ctx) { u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -216,7 +216,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0059(struct ScriptContext* ctx) } } -THUMB_FUNC BOOL ScrCmd_Unk005A(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_StartChatotRecord(struct ScriptContext* ctx) { u16* ret_ptr = GetVarPointer(ctx->unk80, ScriptReadHalfword(ctx)); @@ -232,14 +232,14 @@ THUMB_FUNC BOOL ScrCmd_Unk005A(struct ScriptContext* ctx) } } -THUMB_FUNC BOOL ScrCmd_Unk005B(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_StopChatotRecord(struct ScriptContext* ctx) { #pragma unused(ctx) FUN_02005E64(); return TRUE; } -THUMB_FUNC BOOL ScrCmd_Unk005C(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_SaveChatotCry(struct ScriptContext* ctx) { void* unk = Sav2_Chatot_get(ctx->unk80->saveBlock2); FUN_02005E6C(unk); @@ -254,7 +254,7 @@ THUMB_FUNC BOOL ScrCmd_Unk005D(struct ScriptContext* ctx) return TRUE; } -THUMB_FUNC BOOL ScrCmd_Unk0283(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_SetVolume(struct ScriptContext* ctx) { u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unk2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); diff --git a/arm9/src/scrcmd_23.c b/arm9/src/scrcmd_underground.c index 0c9907a5..5d273c9b 100644 --- a/arm9/src/scrcmd_23.c +++ b/arm9/src/scrcmd_underground.c @@ -6,7 +6,7 @@ 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) +THUMB_FUNC BOOL ScrCmd_GiveSecretBaseDecoration(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -19,7 +19,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0083(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0084(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_TakeSecretBaseDecoration(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -28,7 +28,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0084(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0085(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_HasSpaceForDecoration(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -41,7 +41,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0085(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0086(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetDecorationCount(struct ScriptContext* ctx) //somewhat unsure on name, was originally CheckGoods { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -50,7 +50,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0086(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0087(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GiveUndergroundTrap(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -63,7 +63,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0087(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0088(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_TakeUndergroundTrap(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -72,7 +72,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0088(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0089(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_HasSpaceForTrap(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -81,7 +81,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0089(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk008A(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetTrapCount(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -90,7 +90,7 @@ THUMB_FUNC BOOL ScrCmd_Unk008A(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk008B(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GiveTreasure(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -101,7 +101,7 @@ THUMB_FUNC BOOL ScrCmd_Unk008B(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk008C(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_TakeTreasure(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -110,7 +110,7 @@ THUMB_FUNC BOOL ScrCmd_Unk008C(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk008D(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_HasSpaceForTreasure(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -119,7 +119,7 @@ THUMB_FUNC BOOL ScrCmd_Unk008D(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk008E(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetTreasureCount(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -128,7 +128,7 @@ THUMB_FUNC BOOL ScrCmd_Unk008E(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk008F(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GiveUndergroundSphere(struct ScriptContext* ctx) { struct SaveBlock2* sav2 = ctx->unk80->saveBlock2; u16 unk1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -141,7 +141,7 @@ THUMB_FUNC BOOL ScrCmd_Unk008F(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0090(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_TakeUndergroundSphere(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -150,7 +150,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0090(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0091(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_HasSpaceForSphere(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); @@ -159,7 +159,7 @@ THUMB_FUNC BOOL ScrCmd_Unk0091(struct ScriptContext* ctx) return FALSE; } -THUMB_FUNC BOOL ScrCmd_Unk0092(struct ScriptContext* ctx) +THUMB_FUNC BOOL ScrCmd_GetSphereCount(struct ScriptContext* ctx) { u16 unused1 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); u16 unused2 = VarGet(ctx->unk80, ScriptReadHalfword(ctx)); diff --git a/arm9/src/script_buffers.c b/arm9/src/script_buffers.c index 596056b1..1242d550 100644 --- a/arm9/src/script_buffers.c +++ b/arm9/src/script_buffers.c @@ -20,8 +20,8 @@ extern u32 GetCityNamesMsgdataIdByCountry(u32); extern void GetECWordIntoStringByIndex(u32 a0, struct String * a1); extern void StringCat_HandleTrainerName(struct String * dest, const struct String * src); extern void StrAddChar(struct String * str, u16 val); -extern void * FUN_02006BB0(NarcId, s32, s32, struct UnkStruct_0200B870_sub **, u32); -extern void * UncompressFromNarc(NarcId narcId, s32 memberNo, BOOL isCompressed, u32 heap_id, BOOL allocAtEnd); +extern void * GfGfxLoader_GetCharData(NarcId, s32, s32, struct UnkStruct_0200B870_sub **, u32); +extern void * GfGfxLoader_LoadFromNarc(NarcId narcId, s32 memberNo, BOOL isCompressed, u32 heap_id, BOOL allocAtEnd); const u16 UNK_020ECE6C[][2] = { { 0x0140, 0x0008 }, @@ -751,7 +751,7 @@ struct UnkStruct_0200B870 * MessagePrinter_new(u32 r5, u32 r6, u32 sp4, u32 r4) struct UnkStruct_0200B870 * sp8 = AllocFromHeap(r4, sizeof(struct UnkStruct_0200B870)); if (sp8 != NULL) { - sp8->unk_0 = FUN_02006BB0(NARC_GRAPHIC_FONT, 4, 1, &sp8->unk_4, r4); + sp8->unk_0 = GfGfxLoader_GetCharData(NARC_GRAPHIC_FONT, 4, 1, &sp8->unk_4, r4); int i; u8 * ptr = sp8->unk_4->unk_14; for (i = 0; i < sp8->unk_4->unk_10; i++) diff --git a/arm9/src/text.c b/arm9/src/text.c index 8676cbcc..36349b8b 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -21,7 +21,7 @@ extern void FUN_0201C1A8(struct TextPrinter *printer); extern u32 FontFunc(u8 fontId, struct TextPrinter *printer); -extern void * FUN_02006BB0(NarcId, s32, s32, struct UnkStruct_0200B870_sub **, u32); +extern void * GfGfxLoader_GetCharData(NarcId, s32, s32, struct UnkStruct_0200B870_sub **, u32); THUMB_FUNC void SetFontsPointer(const struct FontInfo *fonts) @@ -330,7 +330,7 @@ THUMB_FUNC u16 *FUN_0201C1B0(void) { void *res = AllocFromHeap(0, 32 * 24 * sizeof(u16)); struct UnkStruct_0200B870_sub * var; - void *tmp = FUN_02006BB0(NARC_GRAPHIC_FONT, 5, 0, &var, 0); + void *tmp = GfGfxLoader_GetCharData(NARC_GRAPHIC_FONT, 5, 0, &var, 0); MI_CpuCopy32(var->unk_14, res, 32 * 24 * sizeof(u16)); FreeToHeap(tmp); return res; diff --git a/arm9/src/unk_0200BB14.c b/arm9/src/unk_0200BB14.c new file mode 100644 index 00000000..45850885 --- /dev/null +++ b/arm9/src/unk_0200BB14.c @@ -0,0 +1,1323 @@ +#include "global.h" +#include "unk_0200BB14.h" +#include "game_init.h" +#include "heap.h" + +extern void FUN_0201D060(u32 *param0, u32 param1, u32 param2); +extern void FUN_0201E00C(u32 param0, u32 param1); +extern void NNS_G2dInitOamManagerModule(); +extern void FUN_02009EAC(u32 param0, + u32 param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + u32 param6, + u32 param7, + u32 param8); +extern u32 FUN_0201C328(u32 param0, u32 param1); +extern void FUN_0201D168(); +extern void FUN_0201E0BC(); +extern u32 FUN_02008C9C(u32 param0, void *param1, u32 param2); +extern void FUN_0201FFC8(u32 param0); +extern void FUN_0201FDEC(u32 param0); +extern void FUN_02009F80(); +extern void FUN_0201C348(); +extern void FUN_0201FD58(u32 param0); +extern void FUN_02008C80(u32 param0); +extern u32 FUN_02009660(u32 *param0, s32 param1); +extern void FUN_020096B4(u32 param0); +extern void FUN_02009C30(u32 *param0); +extern void FUN_02009E28(u32 *param0); +extern void FUN_02009448(u32 *param0); +extern void FUN_02008E2C(u32 param0); +extern void FUN_0201C350(u32 param0); +extern void FUN_0201D12C(); +extern void FUN_0201E08C(); +extern void FUN_02009FA0(); +extern u32 FUN_0200965C(s32 param0); +extern void FUN_02009668(void *param0, u32 param1, u32 param2); +extern u32 FUN_020096CC(u32 param0); +extern u32 FUN_02008DEC(u32 param0, s32 param1, u32 param2); +extern u32 *FUN_02009424(u32 param0, u32 param1); +extern u32 FUN_020093A8(u32 param0, u32 param1, u32 *param2, u32 param3); +extern void FUN_02009A90(u32 *param0); +extern void FUN_02009D34(u32 *param0); +extern u32 FUN_02008BE0(void *param0, + u32 param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + u32 param6, + u32 param7); +extern u32 FUN_0201FE94(struct UnkStruct_0200BB14_4 *param0); +extern void FUN_02020130(u32 param0, u32 param1); +extern void FUN_02020248(u32 param0, u32 param1); +extern u32 FUN_0200945C(u32 param0, s32 param1); +extern u32 FUN_02008F34( + u32 param0, u32 param1, u32 param2, u32 param3, s32 param4, u32 param5, u32 param6); +extern void FUN_02009B04(u32 param0); +extern u32 FUN_02008FEC( + u32 param0, u32 param1, u32 param2, u32 param3, s32 param4, u32 param5, u32 param6, u32 param7); +extern u32 FUN_02009D68(u32 param0); +extern u32 FUN_02009E88(u32 param0, u32 param1); +extern void FUN_02003108(u32 param0, u32 param1, u16 param2, u32 param3); +extern void FUN_02008AA4(struct UnkStruct_0200BB14_sub *param0, + s32 param1, + s32 param2, + s32 param3, + s32 param4, + s32 param5, + s32 param6, + u32 param7, + u32 param8, + u32 param9, + u32 param10, + u32 param11, + u32 param12, + u32 param13, + u32 param14); +extern u8 FUN_020202A0(u32 param0); +extern u32 FUN_020094F0(u32 param0, u32 param1); +extern u32 FUN_02009E54(u32 param0, u32 param1); +extern void FUN_02009CDC(u32 param0); +extern u32 FUN_020090AC( + u32 param0, u32 param1, u32 param2, u32 param3, s32 param4, u32 param5, u32 param6); +extern u32 FUN_02009530(u32 param0); +extern void FUN_02009490(u32 param0, u32 param1); +extern void FUN_0201D324(u32 param0); +extern void FUN_0201E1C8(u32 param0); +extern void FUN_020201E4(u32 param0, u32 param1); +extern u32 FUN_020201DC(u32 param0); +extern void FUN_020200BC(u32 param0, u32 param1); +extern void FUN_020200D8(u32 param0, u32 param1); +extern u32 FUN_02020388(u32 param0); +extern void FUN_02020208(u32 param0); +extern void FUN_0202022C(u32 param0); +extern void FUN_020200A0(u32 param0, u32 param1); +extern u8 FUN_02020128(u32 param0); +extern void FUN_020202A8(u32 param0, u32 param1); +extern u8 FUN_02020300(u32 param0); +extern void FUN_02020238(u32 param0, u8 param1); +extern u8 FUN_02020240(u32 param0); +extern void FUN_02020310(u32 param0, u32 param1); +extern u16 FUN_0202032C(u32 param0); +extern u32 FUN_02020380(u32 param0); +extern void FUN_02020044(u32 param0, u32 *param1); +extern u32 *FUN_0202011C(u32 param0, u16 *param1, u16 *param2); +extern void FUN_020200EC(u32 param0, u32 param1); +extern u32 *FUN_02020120(u32 param0); +extern void FUN_02020064(u32 param0, s32 *param1); +extern void FUN_02020088(u32 param0, u16 param1); +extern u16 FUN_02020124(u32 param0); +extern void FUN_02020100(u32 param0, u32 param1); +extern void FUN_02020054(u32 param0, u32 *param1); +extern void FUN_02020358(u32 param0, u32 param1); +extern void FUN_02020398(u32 param0, u32 param1); +extern void FUN_02009AC4(u32 param0); +extern void FUN_02009B78(u32 param0); +extern void FUN_020090FC(u32 param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); +extern void FUN_02009BE8(u32 param0); +extern void FUN_02009168(u32 param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); +extern void FUN_02009DE0(u32 param0); + +THUMB_FUNC struct UnkStruct_0200BB14_1 *FUN_0200BB14(u32 heap_id) +{ + struct UnkStruct_0200BB14_1 *ptr = AllocFromHeap(heap_id, sizeof(struct UnkStruct_0200BB14_1)); + if (ptr == NULL) + { + return NULL; + } + + ptr->unk000 = heap_id; + ptr->unk004 = 0; + ptr->unk008 = 1; + + return ptr; +} + +THUMB_FUNC struct UnkStruct_0200BB14_2 *FUN_0200BB34(struct UnkStruct_0200BB14_1 *param0) +{ + GF_ASSERT(param0 != NULL); + + struct UnkStruct_0200BB14_2 *ptr = + AllocFromHeap(param0->unk000, sizeof(struct UnkStruct_0200BB14_2)); + if (ptr == NULL) + { + return NULL; + } + + param0->unk004++; + + for (s32 i = 0; i < 6; i++) + { + ptr->unk0c[i] = 0; + } + + return ptr; +} + +THUMB_FUNC u32 FUN_0200BB68(u32 param0) +{ + return param0 + 0x10; +} + +THUMB_FUNC BOOL FUN_0200BB6C( + struct UnkStruct_0200BB14_1 *param0, u32 *param1, u32 *param2, u32 param3) +{ + GF_ASSERT(param0 != NULL); + + if (param0 == NULL) + { + return FALSE; + } + + u32 st14[4] = { param2[0], param2[1], param2[2], param0->unk000 }; + + FUN_0201D060(st14, param2[3], param2[4]); + FUN_0201E00C(param3, param0->unk000); + NNS_G2dInitOamManagerModule(); + + if (param0->unk008 == 1) + { + FUN_02009EAC(param1[0], + param1[1], + param1[2], + param1[3], + param1[4], + param1[5], + param1[6], + param1[7], + param0->unk000); + } + + param0->unk00c = FUN_0201C328(0x20, param0->unk000); + FUN_0201D168(); + FUN_0201E0BC(); + + return TRUE; +} + +THUMB_FUNC BOOL FUN_0200BBF0( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1, u32 param2) +{ + if (param0 == NULL || param1 == NULL) + { + return FALSE; + } + + param1->unk00 = FUN_02008C9C(param2, param0->unk010, param0->unk000); + + return TRUE; +} + +THUMB_FUNC void FUN_0200BC14(u32 param0) +{ + FUN_0201FFC8(param0); +} + +THUMB_FUNC void FUN_0200BC1C(u32 *param0) +{ + GF_ASSERT(param0 != NULL); + + FUN_0201FDEC(*param0); +} + +THUMB_FUNC void FUN_0200BC30() +{ + FUN_02009F80(); +} + +THUMB_FUNC void FUN_0200BC38() +{ + FUN_0201C348(); +} + +THUMB_FUNC void FUN_0200BC40(struct UnkStruct_0200BB14_2 *param0) +{ + FUN_0201FD58(param0->unk00); +} + +THUMB_FUNC void FUN_0200BC4C(struct UnkStruct_0200BB14_2 *param0) +{ + if (param0->unk04 != 0) + { + FUN_02008C80(param0->unk04); + } +} + +THUMB_FUNC void FUN_0200BC5C(struct UnkStruct_0200BB14_2 *param0) +{ + for (s32 i = 0; i < param0->unk54; i++) + { + FUN_020096B4(FUN_02009660(param0->unk08, i)); + } + + FreeToHeap(param0->unk08); + FUN_02009C30(param0->unk24[0]); + FUN_02009E28(param0->unk24[1]); + + for (s32 i = 0; i < param0->unk54; i++) + { + FUN_02009448(param0->unk24[i]); + FUN_02008E2C(param0->unk0c[i]); + } +} + +THUMB_FUNC void FUN_0200BCB0(u32 *param0) +{ + FUN_0201C350(param0[3]); + FUN_0201D12C(); + FUN_0201E08C(); + + if (param0[2] == 1) + { + FUN_02009FA0(); + } +} + +THUMB_FUNC void FUN_0200BCD0( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1) +{ + param0->unk004--; + FreeToHeap(param1); +} + +THUMB_FUNC void FUN_0200BCE0( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1) +{ + FUN_0200BC40(param1); + FUN_0200BC4C(param1); + FUN_0200BC5C(param1); + FUN_0200BCD0(param0, param1); +} + +THUMB_FUNC void FUN_0200BD04(u32 *param0) +{ + GF_ASSERT(param0[1] == 0); + FUN_0200BCB0(param0); + FreeToHeap(param0); +} + +THUMB_FUNC BOOL FUN_0200BD20( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1, const char **param2) +{ + s32 st14 = 6; + const char **st10 = param2; + + if (param0 == NULL || param1 == NULL) + { + return FALSE; + } + + if (param2[4] == 0) + { + st14 = 4; + } + + param1->unk54 = st14; + u32 r2 = FUN_0200965C(st14); + param1->unk08 = AllocFromHeap(param0->unk000, r2 * st14); + + for (s32 i = 0; i < st14; i++) + { + u32 st18 = FUN_02009660(param1->unk08, i); + void *st1c = FUN_020161A4(param0->unk000, st10[i]); + + FUN_02009668(st1c, st18, param0->unk000); + FreeToHeap(st1c); + } + + for (s32 i = 0; i < st14; i++) + { + param1->unk0c[i] = + FUN_02008DEC(FUN_020096CC(FUN_02009660(param1->unk08, i)), i, param0->unk000); + } + + for (s32 i = 0; i < st14; i++) + { + u32 st20 = FUN_02009660(param1->unk08, i); + param1->unk24[i] = FUN_02009424(FUN_020096CC(st20), param0->unk000); + param1->unk3c[i] = FUN_020093A8(param1->unk0c[i], st20, param1->unk24[i], param0->unk000); + } + + FUN_02009A90(param1->unk24[0]); + FUN_02009D34(param1->unk24[1]); + void *r6 = FUN_020161A4(param0->unk000, st10[6]); + param1->unk04 = FUN_02008BE0(r6, + param0->unk000, + param1->unk0c[0], + param1->unk0c[1], + param1->unk0c[2], + param1->unk0c[3], + param1->unk0c[4], + param1->unk0c[5]); + FreeToHeap(r6); + + return TRUE; +} + +THUMB_FUNC u32 FUN_0200BE38(u32 *param0, u32 *param1, struct UnkStruct_0200BB14_3 *param2) +{ + return FUN_0200BE74(param0, + param1, + param2->unk00, + param2->unk04, + param2->unk06, + param2->unk04, + param2->unk0a, + param2->unk0c, + param2->unk10, + param2->unk14, + param2->unk18, + param2->unk1c, + param2->unk20, + param2->unk24); +} + +THUMB_FUNC u32 FUN_0200BE74(u32 *param0, + u32 *param1, + u32 param2, + s16 param3, + s16 param4, + s16 param5, + u16 param6, + u32 param7, + u32 param8, + u32 param9, + u32 param10, + u32 param11, + u32 param12, + u32 param13) +{ +#pragma unused(param10) +#pragma unused(param11) +#pragma unused(param12) +#pragma unused(param13) + + struct UnkStruct_0200BB14_4 st0; + st0.unk00 = param1[0]; + st0.unk04 = &(*(struct UnkStruct_0200BB14_sub **)(param1[1]))[param2]; + + f32 r0; + if (param3 > 0) + { + r0 = ((f32)(param3 * 0x1000) + (f32)0.5); + } + else + { + r0 = ((f32)(param3 * 0x1000) - (f32)0.5); + } + st0.unk08 = (s32)r0; + + if (param4 > 0) + { + r0 = ((f32)(param4 * 0x1000) + (f32)0.5); + } + else + { + r0 = ((f32)(param4 * 0x1000) - (f32)0.5); + } + st0.unk0c = (s32)r0; + + if (param5 > 0) + { + r0 = ((f32)(param5 * 0x1000) + (f32)0.5); + } + else + { + r0 = ((f32)(param5 * 0x1000) - (f32)0.5); + } + st0.unk10 = (s32)r0; + + if (param9 == 2) + { + st0.unk0c += 0xC0000; + } + + st0.unk14 = 0x1000; + st0.unk18 = 0x1000; + st0.unk1c = 0x1000; + st0.unk20 = 0; + st0.unk24 = param7; + st0.unk28 = param9; + st0.unk2c = param0[0]; + + u32 r4 = FUN_0201FE94(&st0); + if (r4 != 0) + { + FUN_02020130(r4, param6); + + FUN_02020248(r4, param8); + } + + return r4; +} + +THUMB_FUNC BOOL FUN_0200BF60( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1, u32 *param2) +{ + struct UnkStruct_0200BB14_1 *st0 = param0; + s32 i; + s32 st4 = 6; + + if (st0 == NULL || param1 == NULL) + { + return FALSE; + } + + if (param2[4] == 0 || param2[5] == 0) + { + st4 = 4; + } + + param1->unk54 = st4; + + for (i = 0; i < st4; i++) + { + param1->unk0c[i] = FUN_02008DEC(param2[i], i, st0->unk000); + } + + for (i = 0; i < st4; i++) + { + if (param2[i] != 0) + { + param1->unk24[i] = FUN_02009424(param2[i], st0->unk000); + param1->unk3c[i] = 0; + + for (s32 j = 0; j < (s32)param1->unk24[i][1]; j++) + { + ((u32 *)param1->unk24[i][0])[j] = 0; + } + } + } + + return TRUE; +} + +THUMB_FUNC BOOL FUN_0200C00C(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + s32 param6) +{ + if (FUN_0200945C(param1->unk0c[0], param6) == 0) + { + return FALSE; + } + + u32 r5 = FUN_02008F34(param1->unk0c[0], param2, param3, param4, param6, param5, param0[0]); + if (r5 != 0) + { + FUN_02009B04(r5); + FUN_0200C474(param1->unk24[0], r5); + return TRUE; + } + + GF_AssertFail(); + if (r5 != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC s32 FUN_0200C06C(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + u32 param6, + s32 param7) +{ + if (FUN_0200945C(param1->unk0c[1], param7) == 0) + { + return -1; + } + + u32 r5 = + FUN_02008FEC(param1->unk0c[1], param2, param3, param4, param7, param6, param5, param0[0]); + if (r5 != 0) + { + GF_ASSERT(FUN_02009D68(r5) == 1); + FUN_0200C474(param1->unk24[1], r5); + return (s8)FUN_02009E88(r5, param6); + } + + GF_AssertFail(); + return -1; +} + +THUMB_FUNC u8 FUN_0200C0DC(u32 param0, + u32 param1, + u32 *param2, + struct UnkStruct_0200BB14_2 *param3, + u32 param4, + u32 param5, + u32 param6, + u32 param7, + u32 param8, + s32 param9) +{ + s32 r4 = FUN_0200C06C(param2, param3, param4, param5, param6, param7, param8, param9); + if (r4 != -1) + { + FUN_02003108(param0, param1, (u16)(r4 << 4), param7 << 5); + } + + return (u8)r4; +} + +THUMB_FUNC u32 FUN_0200C124(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + s32 param5) +{ + return FUN_0200C404(param0, param1, param2, param3, param4, 2, param5); +} + +THUMB_FUNC u32 FUN_0200C13C(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + s32 param5) +{ + return FUN_0200C404(param0, param1, param2, param3, param4, 3, param5); +} + +THUMB_FUNC struct UnkStruct_0200BB14_5 *FUN_0200C154( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1, u32 *param2) +{ + struct UnkStruct_0200BB14_4 st44; + s32 st2c[6]; + + struct UnkStruct_0200BB14_5 *ptr = + AllocFromHeap(param0->unk000, sizeof(struct UnkStruct_0200BB14_5)); + if (ptr == NULL) + { + return NULL; + } + + ptr->unk08 = AllocFromHeap(param0->unk000, sizeof(struct UnkStruct_0200BB14_6)); + if (ptr->unk08 == 0) + { + return NULL; + } + + ptr->unk08->unk0 = AllocFromHeap(param0->unk000, sizeof(struct UnkStruct_0200BB14_sub)); + ptr->unk04 = ptr->unk08->unk0; + if (ptr->unk08->unk0 == NULL) + { + if (ptr->unk08 != NULL) + { + FreeToHeap(ptr->unk08); + } + + return NULL; + } + + for (s32 i = 0; i < 6; i++) + { + st2c[i] = (s32)param2[5 + i]; + } + + if (param1->unk0c[4] == 0 || param1->unk0c[5] == 0) + { + st2c[4] = -1; + st2c[5] = -1; + } + else + { + if (st2c[4] != -1 && FUN_0200945C(param1->unk0c[4], st2c[4]) == 0) + { + st2c[4] = -1; + } + + if (st2c[5] != -1 && FUN_0200945C(param1->unk0c[5], st2c[5]) == 0) + { + st2c[5] = -1; + } + } + + FUN_02008AA4(ptr->unk04, + st2c[0], + st2c[1], + st2c[2], + st2c[3], + st2c[4], + st2c[5], + param2[12], + param2[11], + param1->unk0c[0], + param1->unk0c[1], + param1->unk0c[2], + param1->unk0c[3], + param1->unk0c[4], + param1->unk0c[5]); + + st44.unk00 = param1->unk00; + st44.unk04 = ptr->unk04; + f32 r0; + if (((s16 *)param2)[0] > 0) + { + r0 = ((f32)(((s16 *)param2)[0] << 0xc) + (f32)0.5); + } + else + { + r0 = ((f32)(((s16 *)param2)[0] << 0xc) - (f32)0.5); + } + st44.unk08 = (s32)r0; + + if (((s16 *)param2)[1] > 0) + { + r0 = ((f32)(((s16 *)param2)[1] << 0xc) + (f32)0.5); + } + else + { + r0 = ((f32)(((s16 *)param2)[1] << 0xc) - (f32)0.5); + } + st44.unk0c = (s32)r0; + + if (((s16 *)param2)[2] > 0) + { + r0 = ((f32)(((s16 *)param2)[2] << 0xc) + (f32)0.5); + } + else + { + r0 = ((f32)(((s16 *)param2)[2] << 0xc) - (f32)0.5); + } + st44.unk10 = (s32)r0; + + if (param2[4] == 2) + { + st44.unk0c += 0xC0000; + } + + st44.unk14 = 0x1000; + st44.unk18 = 0x1000; + st44.unk1c = 0x1000; + st44.unk20 = 0; + st44.unk24 = param2[2]; + st44.unk28 = param2[4]; + st44.unk2c = param0->unk000; + + ptr->unk00 = FUN_0201FE94(&st44); + ptr->unk0c = param2[12]; + + if (ptr->unk00 != 0) + { + u8 r6 = FUN_020202A0(ptr->unk00); + + FUN_02020130(ptr->unk00, ((u16 *)param2)[3]); + FUN_02020248(ptr->unk00, r6 + param2[3]); + } + else + { + GF_AssertFail(); + } + + return ptr; +} + +THUMB_FUNC u32 FUN_0200C334(u32 *param0, u32 param1) +{ + return FUN_02009E54(FUN_020094F0(param0[4], param1), 0); +} + +THUMB_FUNC u32 FUN_0200C344(u32 *param0, u32 param1, u32 param2) +{ + return FUN_02009E88(FUN_020094F0(param0[4], param1), param2); +} + +THUMB_FUNC u32 FUN_0200C358(struct UnkStruct_0200BB14_2 *param0, u32 param1) +{ + return FUN_0200C4F4(param0->unk0c[0], param0->unk24[0], param1); +} + +THUMB_FUNC u32 FUN_0200C368(struct UnkStruct_0200BB14_2 *param0, u32 param1) +{ + return FUN_0200C548(param0->unk0c[1], param0->unk24[1], param1); +} + +THUMB_FUNC u32 FUN_0200C378(struct UnkStruct_0200BB14_2 *param0, u32 param1) +{ + return FUN_0200C4A8(param0->unk0c[2], param0->unk24[2], param1); +} + +THUMB_FUNC u32 FUN_0200C388(struct UnkStruct_0200BB14_2 *param0, u32 param1) +{ + return FUN_0200C4A8(param0->unk0c[3], param0->unk24[3], param1); +} + +THUMB_FUNC void FUN_0200C398( + struct UnkStruct_0200BB14_1 *param0, struct UnkStruct_0200BB14_2 *param1) +{ + FUN_0200BC40(param1); + FUN_02009C30(param1->unk24[0]); + FUN_02009E28(param1->unk24[1]); + + for (s32 i = 0; i < param1->unk54; i++) + { + FUN_02009448(param1->unk24[i]); + FUN_02008E2C(param1->unk0c[i]); + } + + FUN_0200BCD0(param0, param1); +} + +THUMB_FUNC void FUN_0200C3DC(u32 *param0) +{ + if (param0[3] != 0) + { + FUN_02009CDC(*(u32 *)param0[1]); + } + + FUN_0201FFC8(param0[0]); + FUN_02008C80(param0[2]); + FreeToHeap(param0); +} + +THUMB_FUNC BOOL FUN_0200C404(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + s32 param6) +{ + if (FUN_0200945C(param1->unk0c[param5], param6) == 0) + { + return FALSE; + } + + u32 r5 = FUN_020090AC(param1->unk0c[param5], param2, param3, param4, param6, param5, param0[0]); + if (r5 != 0) + { + u32 r4 = FUN_0200C474(param1->unk24[param5], r5); + GF_ASSERT(r4 == 1); + return r4; + } + GF_AssertFail(); + if (r5 != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0200C474(u32 *param0, u32 param1) +{ + for (s32 i = 0; i < (s32)param0[1]; i++) + { + if (((u32 *)param0[0])[i] == 0) + { + ((u32 *)param0[0])[i] = param1; + param0[2]++; + return TRUE; + } + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0200C4A8(u32 param0, u32 *param1, u32 param2) +{ + for (s32 i = 0; i < (s32)param1[1]; i++) + { + if (((u32 *)param1[0])[i] != 0) + { + u32 r0 = FUN_02009530(((u32 *)param1[0])[i]); + if (r0 == param2) + { + + FUN_02009490(param0, ((u32 *)param1[0])[i]); + ((u32 *)param1[0])[i] = 0; + param1[2]--; + + return TRUE; + } + } + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0200C4F4(u32 param0, u32 *param1, u32 param2) +{ + for (s32 i = 0; i < (s32)param1[1]; i++) + { + if (((u32 *)param1[0])[i] != 0) + { + u32 r0 = FUN_02009530(((u32 *)param1[0])[i]); + if (r0 == param2) + { + FUN_0201D324(param2); + + FUN_02009490(param0, ((u32 *)param1[0])[i]); + ((u32 *)param1[0])[i] = 0; + param1[2]--; + + return TRUE; + } + } + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0200C548(u32 param0, u32 *param1, u32 param2) +{ + for (s32 i = 0; i < (s32)param1[1]; i++) + { + if (((u32 *)param1[0])[i] != 0) + { + u32 r0 = FUN_02009530(((u32 *)param1[0])[i]); + if (r0 == param2) + { + FUN_0201E1C8(param2); + + FUN_02009490(param0, ((u32 *)param1[0])[i]); + ((u32 *)param1[0])[i] = 0; + param1[2]--; + + return TRUE; + } + } + } + + return FALSE; +} + +THUMB_FUNC void FUN_0200C59C(u32 param0) +{ + FUN_020201E4(param0, 0x1000); +} + +THUMB_FUNC void FUN_0200C5A8(u32 *param0) +{ + FUN_0200C59C(param0[0]); +} + +THUMB_FUNC void FUN_0200C5B4(u32 *param0, u32 param1) +{ + FUN_020201E4(param0[0], param1); +} + +THUMB_FUNC void FUN_0200C5C0(u32 *param0, u32 param1) +{ + FUN_02020130(param0[0], param1); +} + +THUMB_FUNC u32 FUN_0200C5CC(u32 *param0) +{ + return FUN_020201DC(param0[0]); +} + +THUMB_FUNC void FUN_0200C5D8(u32 param0, u32 param1) +{ + FUN_020200BC(param0, param1); +} + +THUMB_FUNC void FUN_0200C5E0(u32 *param0, u32 param1) +{ + FUN_0200C5D8(param0[0], param1); +} + +THUMB_FUNC void FUN_0200C5EC(u32 param0, u32 param1) +{ + FUN_020200D8(param0, param1); +} + +THUMB_FUNC void FUN_0200C5F4(u32 *param0, u32 param1) +{ + FUN_0200C5EC(*param0, param1); +} + +THUMB_FUNC u32 FUN_0200C600(u32 param0) +{ + return FUN_02020388(param0); +} + +THUMB_FUNC u32 FUN_0200C608(u32 *param0) +{ + return FUN_0200C600(*param0); +} + +THUMB_FUNC void FUN_0200C614(u32 param0) +{ + FUN_02020208(param0); +} + +THUMB_FUNC void FUN_0200C61C(u32 *param0) +{ + FUN_0200C614(*param0); +} + +THUMB_FUNC void FUN_0200C628(u32 param0) +{ + FUN_0202022C(param0); +} + +THUMB_FUNC void FUN_0200C630(u32 *param0) +{ + FUN_0200C628(*param0); +} + +THUMB_FUNC void FUN_0200C63C(u32 param0, u32 param1) +{ + FUN_020200A0(param0, param1); +} + +THUMB_FUNC void FUN_0200C644(u32 *param0, u32 param1) +{ + FUN_0200C63C(*param0, param1); +} + +THUMB_FUNC u8 FUN_0200C650(u32 param0) +{ + return FUN_02020128(param0); +} + +THUMB_FUNC u8 FUN_0200C658(u32 *param0) +{ + return FUN_0200C650(*param0); +} + +THUMB_FUNC void FUN_0200C664(u32 param0, u32 param1) +{ + FUN_02020248(param0, param1); +} + +THUMB_FUNC void FUN_0200C66C(u32 *param0, u32 param1) +{ + FUN_0200C664(*param0, param1); +} + +THUMB_FUNC void FUN_0200C678(u32 param0, u32 param1) +{ + FUN_020202A8(param0, param1); +} + +THUMB_FUNC void FUN_0200C680(u32 *param0, u32 param1) +{ + FUN_0200C678(*param0, param1); +} + +THUMB_FUNC u8 FUN_0200C68C(u32 *param0) +{ + return FUN_02020300(*param0); +} + +THUMB_FUNC void FUN_0200C698(u32 param0, u32 param1) +{ + FUN_02020238(param0, (u8)param1); +} + +THUMB_FUNC u8 FUN_0200C6A4(u32 *param0) +{ + return FUN_02020240(*param0); +} + +THUMB_FUNC void FUN_0200C6B0(u32 *param0, u32 param1) +{ + FUN_0200C698(*param0, param1); +} + +THUMB_FUNC void FUN_0200C6BC(u32 param0, u32 param1) +{ + FUN_02020310(param0, param1); +} + +THUMB_FUNC void FUN_0200C6C4(u32 *param0, u32 param1) +{ + FUN_0200C6BC(*param0, param1); +} + +THUMB_FUNC u16 FUN_0200C6D0(u32 param0) +{ + return FUN_0202032C(param0); +} + +THUMB_FUNC u16 FUN_0200C6D8(u32 *param0) +{ + return FUN_0200C6D0(*param0); +} + +THUMB_FUNC void FUN_0200C6E4(u32 param0, u32 param1, u32 param2) +{ + u32 st0[3]; + st0[0] = param1 << 12; + st0[1] = param2 << 12; + if (FUN_02020380(param0) == 2) + { + st0[1] += 0xc0000; + } + st0[2] = 0; + + FUN_02020044(param0, st0); +} + +THUMB_FUNC void FUN_0200C714(u32 *param0, u32 param1, u32 param2) +{ + FUN_0200C6E4(*param0, param1, param2); +} + +THUMB_FUNC void FUN_0200C720(u32 param0, u32 param1, u32 param2, u32 param3) +{ + u32 st0[3]; + + st0[0] = param1 << 12; + st0[1] = param2 << 12; + if (FUN_02020380(param0) == 2) + { + st0[1] += param3; + } + st0[2] = 0; + + FUN_02020044(param0, st0); +} + +THUMB_FUNC void FUN_0200C750(u32 *param0, u32 param1, u32 param2, u32 param3) +{ + FUN_0200C720(*param0, param1, param2, param3); +} + +THUMB_FUNC void FUN_0200C75C(u32 param0, u16 *param1, u16 *param2) +{ + s32 *r4 = FUN_0202011C(param0, param1, param2); + + param1[0] = r4[0] / 0x1000; + + if (FUN_02020380(param0) == 2) + { + s32 r1 = r4[1] - 0xc0000; + + param2[0] = r1 / 0x1000; + + return; + } + + param2[0] = r4[1] / 0x1000; +} + +THUMB_FUNC void FUN_0200C7A0(u32 *param0, u16 *param1, u16 *param2) +{ + FUN_0200C75C(*param0, param1, param2); +} + +THUMB_FUNC void FUN_0200C7AC(u32 param0, u16 *param1, u16 *param2, u32 param3) +{ + s32 *r4 = FUN_0202011C(param0, param1, param2); + + param1[0] = r4[0] / 0x1000; + + if (FUN_02020380(param0) == 2) + { + s32 r1 = r4[1] - param3; + + param2[0] = r1 / 0x1000; + + return; + } + + param2[0] = r4[1] / 0x1000; +} + +THUMB_FUNC void FUN_0200C7F0(u32 *param0, u16 *param1, u16 *param2, u32 param3) +{ + FUN_0200C7AC(*param0, param1, param2, param3); +} + +THUMB_FUNC void FUN_0200C7FC(u32 param0, u16 *param1, u16 *param2) +{ + u32 st0[3]; + + u32 *r0 = FUN_0202011C(param0, param1, param2); + + st0[0] = r0[0] + ((u32)param1 << 0xc); + st0[1] = r0[1] + ((u32)param2 << 0xc); + st0[2] = r0[2]; + + FUN_02020044(param0, st0); +} + +THUMB_FUNC void FUN_0200C82C(u32 *param0, u16 *param1, u16 *param2) +{ + FUN_0200C7FC(*param0, param1, param2); +} + +THUMB_FUNC void FUN_0200C838(u32 param0, u32 param1) +{ + FUN_020200EC(param0, param1); +} + +THUMB_FUNC void FUN_0200C840(u32 *param0, u32 param1) +{ + FUN_0200C838(*param0, param1); +} + +THUMB_FUNC void FUN_0200C84C(u32 param0, f32 param1, f32 param2) +{ + s32 *r4 = FUN_02020120(param0); + + r4[0] = (s32)(param1 * 0x1000); + r4[1] = (s32)(param2 * 0x1000); + + FUN_02020064(param0, r4); +} + +THUMB_FUNC void FUN_0200C884(u32 *param0, f32 param1, f32 param2) +{ + FUN_0200C84C(*param0, param1, param2); +} + +THUMB_FUNC void FUN_0200C890(u32 param0, u16 param1) +{ + FUN_02020088(param0, param1); +} + +THUMB_FUNC void FUN_0200C898(u32 *param0, u16 param1) +{ + FUN_0200C890(*param0, param1); +} + +THUMB_FUNC void FUN_0200C8A4(u32 param0, u32 param1) +{ + u16 r0 = FUN_02020124(param0); + r0 += param1; + FUN_02020088(param0, r0); +} + +THUMB_FUNC void FUN_0200C8BC(u32 *param0, u32 param1) +{ + FUN_0200C8A4(*param0, param1); +} + +THUMB_FUNC void FUN_0200C8C8(u32 param0, u32 param1) +{ + FUN_02020100(param0, param1); +} + +THUMB_FUNC void FUN_0200C8D0(u32 *param0, u32 param1) +{ + FUN_0200C8C8(*param0, param1); +} + +THUMB_FUNC void FUN_0200C8DC(u32 *param0, u32 param1, u32 param2) +{ + u32 st0[3]; + st0[0] = param1 << 12; + st0[1] = param2 << 12; + st0[2] = 0; + + FUN_02020054(*param0, st0); +} + +THUMB_FUNC void FUN_0200C8F8(u32 *param0, u32 param1) +{ + FUN_02020358(*param0, param1); +} + +THUMB_FUNC void FUN_0200C904(u32 param0, u32 param1) +{ + FUN_02020398(param0, param1); +} + +THUMB_FUNC void FUN_0200C90C(u32 *param0, u32 param1) +{ + FUN_0200C904(*param0, param1); +} + +THUMB_FUNC BOOL FUN_0200C918(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + s32 param6) +{ + if (FUN_0200945C(param1->unk0c[0], param6) == 0) + { + return FALSE; + } + + u32 r5 = FUN_02008F34(param1->unk0c[0], param2, param3, param4, param6, param5, param0[0]); + if (r5 != 0) + { + FUN_02009AC4(r5); + FUN_0200C474(param1->unk24[0], r5); + + return TRUE; + } + + GF_AssertFail(); + if (r5 != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC BOOL FUN_0200C978(u32 *param0, + struct UnkStruct_0200BB14_2 *param1, + u32 param2, + u32 param3, + u32 param4, + u32 param5, + s32 param6) +{ + if (FUN_0200945C(param1->unk0c[0], param6) == 0) + { + return FALSE; + } + + u32 r5 = FUN_02008F34(param1->unk0c[0], param2, param3, param4, param6, param5, param0[0]); + if (r5 != 0) + { + FUN_02009B78(r5); + FUN_0200C474(param1->unk24[0], r5); + + return TRUE; + } + + GF_AssertFail(); + if (r5 != 0) + { + return TRUE; + } + + return FALSE; +} + +THUMB_FUNC void FUN_0200C9D8( + u32 *param0, u32 *param1, u32 param2, u32 param3, u32 param4, u32 param5) +{ + u32 r6 = FUN_020094F0(param1[3], param5); + FUN_020090FC(param1[3], r6, param2, param3, param4, param0[0]); + + FUN_02009BE8(r6); +} + +THUMB_FUNC void FUN_0200CA0C( + u32 *param0, u32 *param1, u32 param2, u32 param3, u32 param4, u32 param5) +{ + u32 r6 = FUN_020094F0(param1[4], param5); + FUN_02009168(param1[4], r6, param2, param3, param4, param0[0]); + + FUN_02009DE0(r6); +} + +THUMB_FUNC u32 FUN_0200CA40(u32 *param0) +{ + return *param0; +} diff --git a/arm9/src/unk_02016B94.c b/arm9/src/unk_02016B94.c index e01b3133..6a9dd194 100644 --- a/arm9/src/unk_02016B94.c +++ b/arm9/src/unk_02016B94.c @@ -3361,7 +3361,7 @@ THUMB_FUNC u8 (*FUN_02018848(u8 *param0, u32 param1, u8 param2, u32 heap_id))[2] return ptr; } -THUMB_FUNC void *FUN_0201886C(struct UnkStruct_02016B94_2 *param0, u32 param1) +THUMB_FUNC void *FUN_0201886C(struct UnkStruct_02016B94_2 *param0, u8 param1) { return param0->unk08[param1].unk08; } diff --git a/arm9/src/unk_0208A300.c b/arm9/src/unk_0208A300.c new file mode 100644 index 00000000..3c4a496b --- /dev/null +++ b/arm9/src/unk_0208A300.c @@ -0,0 +1,38 @@ +#include "global.h" +#include "heap.h" +#include "unk_0208A300.h" + +THUMB_FUNC struct UnkStruct_0208A300* FUN_0208A300(u32 heap_id) +{ + struct UnkStruct_0208A300* ret = AllocFromHeap(heap_id, sizeof(struct UnkStruct_0208A300)); + + __builtin__clear(ret, sizeof(struct UnkStruct_0208A300)); + ret->unk4 = 2; + + return ret; +} + +THUMB_FUNC void FUN_0208A320(struct UnkStruct_0208A300* unk) +{ + FreeToHeap(unk); +} + +THUMB_FUNC u32 FUN_0208A328(struct UnkStruct_0208A300* unk) +{ + return unk->unk0; +} + +THUMB_FUNC void FUN_0208A32C(struct UnkStruct_0208A300* unk, u32 a1) +{ + unk->unk0 = a1; +} + +THUMB_FUNC u32 FUN_0208A330(struct UnkStruct_0208A300* unk) +{ + return unk->unk4; +} + +THUMB_FUNC void FUN_0208A334(struct UnkStruct_0208A300* unk, u32 a1) +{ + unk->unk4 = a1; +} |