diff options
Diffstat (limited to 'arm9/src')
-rw-r--r-- | arm9/src/font.c | 10 | ||||
-rw-r--r-- | arm9/src/unk_02002F08.c | 139 | ||||
-rw-r--r-- | arm9/src/unk_02021934.c | 8 |
3 files changed, 148 insertions, 9 deletions
diff --git a/arm9/src/font.c b/arm9/src/font.c index 98885671..e09b0341 100644 --- a/arm9/src/font.c +++ b/arm9/src/font.c @@ -20,11 +20,11 @@ const struct FontInfo gFontInfos[5] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, }; -extern u32 FUN_02021590(u32, u16, u32, u16, u32); -extern void FUN_020215E0(u32, u32, u32); -extern void FUN_020215C8(u32 param0); -extern void FUN_02021750(void *, u32); -extern u32 FUN_020218D8(void *, u16 *str, u32); +extern struct UnkStruct_0202199C *FUN_02021590(u32, u16, u32, u16, u32); +extern void FUN_020215E0(struct UnkStruct_0202199C *, u32, u32); +extern void FUN_020215C8(struct UnkStruct_0202199C *param0); +extern void FUN_02021750(struct UnkStruct_0202199C *, u32); +extern u32 FUN_020218D8(struct UnkStruct_0202199C *, u16 *str, u32); THUMB_FUNC void FUN_02002C14() { diff --git a/arm9/src/unk_02002F08.c b/arm9/src/unk_02002F08.c new file mode 100644 index 00000000..b81da622 --- /dev/null +++ b/arm9/src/unk_02002F08.c @@ -0,0 +1,139 @@ +#include "global.h" +#include "unk_02002F08.h" +#include "font.h" +#include "gf_gfx_loader.h" +#include "string16.h" +#include "unk_0201B8B8.h" + +THUMB_FUNC s32 FUN_02002F08(u32 param0, struct String *str, u32 param2) +{ + GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL); + + return StringGetWidth(UNK_02106FC8->unk94[param0], String_c_str(str), param2); +} + +THUMB_FUNC u32 FUN_02002F40(u32 param0, struct String *str, u32 param2, u32 param3) +{ + u32 r0 = FUN_02002E14(param0, str, param2); + if (r0 < param3) + { + return (param3 - r0) / 2; + } + + return 0; +} + +THUMB_FUNC u32 FUN_02002F58(const u16 *str) +{ + u32 r5 = 1; + while (*str != EOS) + { + if (*str == 0xFFFE) + { + str = MsgArray_SkipControlCode(str); + continue; + } + + if (*str == 0xE000) + { + r5++; + str++; + continue; + } + + str++; + } + + return r5; +} + +THUMB_FUNC u32 FUN_02002F90(struct String *str) +{ + return FUN_02002F58(String_c_str(str)); +} + +THUMB_FUNC s32 FUN_02002F9C(u32 param0, struct String *str) +{ + GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL); + + return StringGetWidth_SingleLine_HandleClearToControlCode( + UNK_02106FC8->unk94[param0], String_c_str(str)); +} + +THUMB_FUNC struct UnkStruct_02002F08 *FUN_02002FD0(u32 heap_id) +{ + struct UnkStruct_02002F08 *ptr = AllocFromHeap(heap_id, sizeof(struct UnkStruct_02002F08)); + MI_CpuFill8(ptr, 0, sizeof(struct UnkStruct_02002F08)); + + return ptr; +} + +THUMB_FUNC void FUN_02002FEC(struct UnkStruct_02002F08 *ptr) +{ + FreeToHeap(ptr); +} + +THUMB_FUNC void FUN_02002FF4( + struct UnkStruct_02002F08 *param0, u32 param1, void *param2, void *param3, u32 size) +{ + param0->unk000[param1].unk00 = param2; + param0->unk000[param1].unk04 = param3; + param0->unk000[param1].unk08 = size; +} + +THUMB_FUNC void FUN_02003008(struct UnkStruct_02002F08 *param0, u32 param1, u32 size, u32 heap_id) +{ + void *ptr = AllocFromHeap(heap_id, size); + void *ptr2 = AllocFromHeap(heap_id, size); + + FUN_02002FF4(param0, param1, ptr, ptr2, size); +} + +THUMB_FUNC void FUN_02003038(struct UnkStruct_02002F08 *param0, u32 param1) +{ + FreeToHeap(param0->unk000[param1].unk00); + FreeToHeap(param0->unk000[param1].unk04); +} + +THUMB_FUNC void FUN_02003054( + struct UnkStruct_02002F08 *param0, const void *param1, u32 param2, u32 offset, u16 size) +{ + MIi_CpuCopy16(param1, param0->unk000[param2].unk00 + offset, size); + MIi_CpuCopy16(param1, param0->unk000[param2].unk04 + offset, size); +} + +THUMB_FUNC void FUN_02003084(struct UnkStruct_02002F08 *param0, + NarcId narcId, + s32 memberId, + u32 heap_id, + u32 param4, + u32 size, + u16 offset, + u16 param7) +{ + NNSG2dPaletteData *pltData; + void *ptr = GfGfxLoader_GetPlttData(narcId, memberId, &pltData, heap_id); + + GF_ASSERT(ptr != NULL); + + if (size == 0) + { + size = pltData->szByte; + } + + GF_ASSERT(size + offset * 2 <= param0->unk000[param4].unk08); + + FUN_02003054(param0, pltData->pRawData + param7 * 2, param4, offset, (u16)size); + FreeToHeap(ptr); +} + +THUMB_FUNC void FUN_020030E8(struct UnkStruct_02002F08 *param0, + NarcId narcId, + s32 memberId, + u32 heap_id, + u32 param4, + u32 size, + u16 offset) +{ + FUN_02003084(param0, narcId, memberId, heap_id, param4, size, offset, 0); +} diff --git a/arm9/src/unk_02021934.c b/arm9/src/unk_02021934.c index ebc600fa..b12e2d8f 100644 --- a/arm9/src/unk_02021934.c +++ b/arm9/src/unk_02021934.c @@ -10,9 +10,9 @@ void StrAddChar(struct String * str, u16 val); -int StringGetWidth(struct UnkStruct_0202199C * r7, const u16 * arr, u32 r6) +s32 StringGetWidth(struct UnkStruct_0202199C * r7, const u16 * arr, u32 r6) { - int ret = 0; + s32 ret = 0; u32 r4 = 0; while (*arr != 0xFFFF) { @@ -38,9 +38,9 @@ int StringGetWidth(struct UnkStruct_0202199C * r7, const u16 * arr, u32 r6) return ret; } -int StringGetWidth_SingleLine_HandleClearToControlCode(struct UnkStruct_0202199C * r6, const u16 * arr) +s32 StringGetWidth_SingleLine_HandleClearToControlCode(struct UnkStruct_0202199C * r6, const u16 * arr) { - int ret = 0; + s32 ret = 0; while (*arr != 0xFFFF) { if (*arr == 0xFFFE) |