From bb43265c50f7c7d9d283a8940e229d0823bcc62c Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 16 Apr 2022 20:37:58 +0300 Subject: [PATCH] Put const data in npc58 --- data/const/npc/npc58.s | 11 ----------- include/fileselect.h | 2 +- linker.ld | 2 +- src/npc/npc58.c | 6 ++++-- src/npc/phonograph.c | 6 ++++-- src/text.c | 2 +- 6 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 data/const/npc/npc58.s diff --git a/data/const/npc/npc58.s b/data/const/npc/npc58.s deleted file mode 100644 index b42b64e7..00000000 --- a/data/const/npc/npc58.s +++ /dev/null @@ -1,11 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081146B8:: @ 081146B8 - .incbin "npc58/gUnk_081146B8.bin" - -gUnk_081146D0:: @ 081146D0 - .incbin "data_081146D0/gUnk_081146D0.bin" diff --git a/include/fileselect.h b/include/fileselect.h index 375dfeca..f6a2547d 100644 --- a/include/fileselect.h +++ b/include/fileselect.h @@ -52,7 +52,7 @@ extern struct_02019EE0 gMapDataBottomSpecial; // TODO size: 0x8000 from ClearTilemaps? extern void sub_08056FEC(u32, struct_020227E8*); -extern u32 sub_0805F46C(u32, Font*); +extern u32 sub_0805F46C(u32, const Font*); extern void ClearTilemaps(void); extern void sub_0805194C(u32); extern WStruct* sub_0805F2C8(void); diff --git a/linker.ld b/linker.ld index fdd4f88f..6397274f 100644 --- a/linker.ld +++ b/linker.ld @@ -1297,7 +1297,7 @@ SECTIONS { src/npc/cucco.o(.rodata); src/npc/cuccoChick.o(.rodata); src/npc/phonograph.o(.rodata); - data/const/npc/npc58.o(.rodata); + src/npc/npc58.o(.rodata); src/npcDefinitions.o(.rodata); data/data_081146D0.o(.rodata); src/physics.o(.rodata); diff --git a/src/npc/npc58.c b/src/npc/npc58.c index c9b9ab72..8e4202f1 100644 --- a/src/npc/npc58.c +++ b/src/npc/npc58.c @@ -3,7 +3,9 @@ extern void sub_0806FFBC(Entity*, u32, u32, u32); -extern SpriteLoadData gUnk_081146D0; +static const SpriteLoadData gUnk_081146D0[] = { + { 0, 0x61, 0x4 }, { 0x800, 0x61, 0x4 }, { 0x1000, 0x61, 0x4 }, { 0x1800, 0x61, 0x4 }, { 0, 0, 0 }, +}; void NPC58(Entity* this) { s32 sVar1; @@ -12,7 +14,7 @@ void NPC58(Entity* this) { Entity* entity; if (this->action == 0) { - if (LoadExtraSpriteData(this, &gUnk_081146D0) == 0) { + if (LoadExtraSpriteData(this, gUnk_081146D0) == 0) { return; } this->action += 1; diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index a5de78b2..560794d2 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -13,8 +13,6 @@ void sub_0806EABC(Entity* this); void sub_0806EABC(Entity* this, u32 param); #endif -extern Font gUnk_081146B8; - void Phonograph(Entity* this) { if (this->action == 0) { this->action += 1; @@ -187,6 +185,10 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { } #endif +const static Font gUnk_081146B8 = { + (u16*)0x2034fce, (void*)0x0600d000, (void*)0x2000d00, 0, 0xf080, 0xd0, 1, 1, 1, 1, 0, 0, 0, 1, 0 +}; + #ifdef EU void sub_0806EABC(Entity* this) { sub_08050384(); diff --git a/src/text.c b/src/text.c index a56d23ea..a942ed63 100644 --- a/src/text.c +++ b/src/text.c @@ -430,7 +430,7 @@ void sub_0805F440(Token* param_1, u8* param_2) { } } -u32 sub_0805F46C(u32 param_1, Font* param_2) { +u32 sub_0805F46C(u32 param_1, const Font* param_2) { u32 uVar1; WStruct* pWVar4; u32 uVar5;