From cec8424a09c404074e237adceca4ec5c7d5aa61d Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Fri, 31 May 2024 00:18:36 +0100 Subject: [PATCH] WRP PSP merge e_room_fg.c (#1221) Straightforward PR. Interestingly importing the data doesn't seem to result to a match ad there's some `0x10` aligned padding added. Either we know too little about importing data with MWCC or the file split was wrong and the data belonged together with other functions in another C file. For now I had to use a `#ifdef`. It will probably get forgotten until we decide to import the data from WRP PSP. --- Makefile.psp.mk | 2 +- config/splat.pspeu.stwrp.yaml | 2 +- config/symbols.pspeu.stwrp.txt | 2 +- src/st/wrp/e_room_fg.c | 16 ++++++++++++---- src/st/wrp_psp/e_room_fg.c | 24 ------------------------ 5 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 src/st/wrp_psp/e_room_fg.c diff --git a/Makefile.psp.mk b/Makefile.psp.mk index 2e33175b5..e46dc78fd 100644 --- a/Makefile.psp.mk +++ b/Makefile.psp.mk @@ -74,6 +74,6 @@ $(PSP_BUILD_DIR)/tt_%.ld: $(CONFIG_DIR)/splat.pspeu.tt_%.yaml $(PSX_BASE_SYMS) $ $(PSP_BUILD_DIR)/tt_%.elf: $(PSP_BUILD_DIR)/tt_%.ld $$(call list_o_files_psp,servant/tt_$$*) $(PSP_BUILD_DIR)/assets/servant/tt_%/mwo_header.bin.o $(call link,tt_$*,$@) -ST_WRP_MERGE = st_update st_common st_debug e_breakable +ST_WRP_MERGE = st_update e_room_fg st_common st_debug e_breakable $(PSP_BUILD_DIR)/stwrp.elf: $(PSP_BUILD_DIR)/stwrp.ld $(addprefix $(PSP_BUILD_DIR)/src/st/wrp/,$(addsuffix .c.o,$(ST_WRP_MERGE))) $$(call list_o_files_psp,st/wrp_psp) $(PSP_BUILD_DIR)/assets/st/wrp/mwo_header.bin.o $(call link,stwrp,$@) diff --git a/config/splat.pspeu.stwrp.yaml b/config/splat.pspeu.stwrp.yaml index ccc88f4a3..0223e10c5 100644 --- a/config/splat.pspeu.stwrp.yaml +++ b/config/splat.pspeu.stwrp.yaml @@ -53,7 +53,7 @@ segments: - [0x7448, c, wrp_psp/e_misc] - [0x95D0, c, wrp_psp/collision] - [0xB7A8, c, wrp_psp/popup] - - [0xBDA0, c, wrp_psp/e_room_fg] + - [0xBDA0, c, wrp/e_room_fg] - [0xBEB8, c, wrp/st_common] - [0xC9A0, c, wrp_psp/stage_name_new] - [0xCEA0, c, wrp_psp/prim_helpers] diff --git a/config/symbols.pspeu.stwrp.txt b/config/symbols.pspeu.stwrp.txt index 7c3418063..7c449692a 100644 --- a/config/symbols.pspeu.stwrp.txt +++ b/config/symbols.pspeu.stwrp.txt @@ -81,7 +81,7 @@ D_80181008 = 0x092466A0; D_80181020 = 0x092466B8; D_80181038 = 0x092466D0; D_8018103C = 0x092466D8; -D_80181420 = 0x09246AE0; +D_80181134 = 0x09246AE0; g_eRedDoorTiles = 0x09246E10; g_eBreakableInit = 0x09246E90; g_InitializeData0 = 0x09246EA0; diff --git a/src/st/wrp/e_room_fg.c b/src/st/wrp/e_room_fg.c index acbb9b9bb..db5629b9f 100644 --- a/src/st/wrp/e_room_fg.c +++ b/src/st/wrp/e_room_fg.c @@ -1,5 +1,6 @@ #include "wrp.h" +#if !defined(VERSION_PSP) u8 D_80181120[] = {0x40, 0x01, 0xFF, 0x00}; u8 D_80181124[] = {0x40, 0x02, 0xFF, 0x00}; u8 D_80181128[] = {0x40, 0x02, 0xFF, 0x00}; @@ -13,22 +14,29 @@ ObjInit2 D_80181134[] = { {0x000C, 0x01EC, 0x0000, 0x0000, 0x00, 0x10, 0, D_80181130}, {0x000C, 0x0080, 0x0000, 0x0000, 0x00, 0x10, 0, D_8018112C}, }; + +#else +extern ObjInit2 D_80181134[]; + +#endif + void EntityRoomForeground(Entity* entity) { ObjInit2* objInit = &D_80181134[entity->params]; - if (entity->step == 0) { + + if (!entity->step) { InitializeEntity(g_eInitGeneric2); entity->animSet = objInit->animSet; entity->zPriority = objInit->zPriority; - entity->unk5A = objInit->unk4.s; + entity->unk5A = objInit->unk4.u; entity->palette = objInit->palette; entity->drawFlags = objInit->drawFlags; entity->drawMode = objInit->drawMode; if (objInit->unkC != 0) { entity->flags = objInit->unkC; } - if (entity->params >= 5) { + if (entity->params > 4) { + entity->drawFlags |= DRAW_COLORS; entity->rotZ = 0x800; - entity->drawFlags |= 4; } } AnimateEntity(objInit->unk10, entity); diff --git a/src/st/wrp_psp/e_room_fg.c b/src/st/wrp_psp/e_room_fg.c deleted file mode 100644 index 6e1a2780f..000000000 --- a/src/st/wrp_psp/e_room_fg.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "../wrp/wrp.h" - -extern ObjInit2 D_80181420[]; -void EntityRoomForeground(Entity* entity) { - ObjInit2* objInit = &D_80181420[entity->params]; - - if (!entity->step) { - InitializeEntity(g_eInitGeneric2); - entity->animSet = objInit->animSet; - entity->zPriority = objInit->zPriority; - entity->unk5A = objInit->unk4.u; - entity->palette = objInit->palette; - entity->drawFlags = objInit->drawFlags; - entity->drawMode = objInit->drawMode; - if (objInit->unkC != 0) { - entity->flags = objInit->unkC; - } - if (entity->params > 4) { - entity->drawFlags |= DRAW_COLORS; - entity->rotZ = 0x800; - } - } - AnimateEntity(objInit->unk10, entity); -}