Skip to content

Commit

Permalink
Decompiled and merged func_us_801BB200/func_psp_0926D5E0
Browse files Browse the repository at this point in the history
Decompiled func_us_801BB53C/func_psp_09254288 and pseudo merged it
  • Loading branch information
ProjectOblivion authored and ProjectOblivion committed Feb 20, 2025
1 parent ffce97b commit 62945c1
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile.psp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $(BUILD_DIR)/dra.elf: $(BUILD_DIR)/dra.ld $(addprefix $(BUILD_DIR)/src/dra/,$(ad
$(BUILD_DIR)/tt_%.elf: $(BUILD_DIR)/tt_%.ld $$(call list_o_files_psp,servant/tt_$$*) $(BUILD_DIR)/assets/servant/tt_%/mwo_header.bin.o
$(call link_with_deadstrip,tt_$*,$@)

ST_LIB_MERGE = collision e_chair st_update create_entity e_red_door e_room_fg st_common prim_helpers e_bloody_zombie e_misc en_thornweed_corpseweed e_skeleton e_life_up e_flea_man e_mist_door e_flea_armor e_candle_table st_debug e_lock_camera
ST_LIB_MERGE = collision e_chair st_update create_entity e_red_door e_room_fg st_common prim_helpers e_bloody_zombie e_misc en_thornweed_corpseweed e_skeleton e_life_up e_flea_man e_mist_door e_flea_armor e_candle_table st_debug e_lock_camera unk_3B200
$(BUILD_DIR)/stlib.elf: $(BUILD_DIR)/stlib.ld $(addprefix $(BUILD_DIR)/src/st/lib/,$(addsuffix .c.o,$(ST_LIB_MERGE))) $$(call list_o_files_psp,st/lib_psp) $(BUILD_DIR)/assets/st/lib/mwo_header.bin.o
$(call link_with_deadstrip,stlib,$@)
ST_NO4_MERGE =
Expand Down
4 changes: 2 additions & 2 deletions config/splat.pspeu.stlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ segments:
- [0x290C8, c, lib_psp/e_shop]
- [0x2BC10, c, lib_psp/2BC10]
- [0x35798, c, lib/e_lock_camera]
- [0x35F60, c, lib_psp/35F60]
- [0x35F60, c, lib/unk_3B200]
- [0x36428, c, lib/e_candle_table]
- [0x367C0, data]
- [0x36800, .data, lib/e_bloody_zombie]
Expand Down Expand Up @@ -125,7 +125,7 @@ segments:
- [0x6DAD8, .rodata, lib_psp/unk_25CD0]
- [0x6DB78, .rodata, lib_psp/e_shop]
- [0x6DBB8, .rodata, lib_psp/2BC10]
- [0x6DD20, .rodata, lib_psp/35F60]
- [0x6DD20, .rodata, lib/unk_3B200]
- [0x6DD80, .bss, lib/create_entity]
- [0x6DDA0, .bss, lib/e_life_up]
- [0x6DDA8, .bss, lib_psp/e_collect]
Expand Down
10 changes: 6 additions & 4 deletions config/splat.us.stlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ segments:
- [0x2D278, .rodata, unk_36F30]
- [0x2D760, .rodata, cutscene]
- [0x2D804, .rodata, e_candle_table]
- [0x2D808, .rodata, unk_3BEB0]
- [0x2D868, .rodata, unk_3C57C]
- [0x2D810, .rodata, unk_3B200]
- [0x2D828, .rodata, unk_3B53C]
- [0x2D848, .rodata, e_lesser_demon]
- [0x2D980, .rodata, e_chair]
- [0x2D9C4, .rodata, e_red_door]
- [0x2D9DC, .rodata, e_collect]
Expand Down Expand Up @@ -107,8 +108,9 @@ segments:
- [0x36324, c, unk_36F30]
- [0x395EC, c, cutscene]
- [0x3AF60, c, e_candle_table]
- [0x3B200, c, unk_3BEB0]
- [0x3C57C, c, unk_3C57C]
- [0x3B200, c, unk_3B200]
- [0x3B53C, c, unk_3B53C]
- [0x3B8DC, c, e_lesser_demon]
- [0x3EDD8, c, e_chair]
- [0x3EFEC, c, unk_3EFEC]
- [0x3F130, c, st_update]
Expand Down
8 changes: 8 additions & 0 deletions config/symbols.pspeu.stlib.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
D_80097910 = 0x091CE5A0;
D_80097928 = 0x091CE5B0;
D_80076E98 = 0x091E5140;
CreateEntityFromLayout = 0x09237700;
CreateEntityWhenInVerticalRange = 0x09237820;
CreateEntityWhenInHorizontalRange = 0x092379B8;
Expand Down Expand Up @@ -102,6 +105,7 @@ PrimDecreaseBrightness = 0x09251098;
EntityThornweed = 0x09251168;
EntityCorpseweed = 0x092515F8;
EntityCorpseweedProjectile = 0x09252858;
func_us_801BB53C = 0x09254288;
EntityBreakable = 0x092546D0;
EntityChair = 0x09254DC0;
func_us_801BB8DC = 0x09255D78;
Expand All @@ -119,6 +123,7 @@ LIB_EntityBackgroundBlock = 0x0925D350;
EntityLibrarianChair = 0x0925E018;
PlayerIsWithinHitbox = 0x0926CE18;
EntityLockCamera = 0x0926CF18;
func_us_801BB200 = 0x0926D5E0;
EntityCandleTable = 0x0926DAA8;
explosionVariantSizes = 0x0926F738;
g_UnkRecursPrim2Inds = 0x0926F798;
Expand Down Expand Up @@ -147,6 +152,7 @@ g_EInitThornweed = 0x09276138;
g_EInitCorpseweed = 0x09276148;
g_EInitCorpseweedProjectile = 0x09276158;
D_us_801808FC = 0x09276168;
D_us_8018095C = 0x092761D8;
g_EInitSkeleton = 0x09276228;
g_EInitSkeletonPieces = 0x09276238;
g_EInitSkeletonBone = 0x09276248;
Expand All @@ -166,6 +172,7 @@ D_us_801812C0 = 0x092A4600;
D_us_801812C8 = 0x092A4608;
D_us_801812D0 = 0x092A4610;
D_us_801812D8 = 0x092A4618;
D_us_80181AA8 = 0x092A4DC8;
D_us_80181A68 = 0x092A4DE8;
D_us_80181A78 = 0x092A4DF8;
g_LayoutObjPosVertical = 0x092A5400;
Expand All @@ -178,6 +185,7 @@ D_psp_0924BC68 = 0x092A5470;
D_psp_0924BC70 = 0x092A5478;
D_psp_0924BC78 = 0x092A5480;
LIB_cutscene_data = 0x092A54F8;
D_us_80181AC8 = 0x092A56F8;
D_us_80181ACC = 0x092A5700;
D_us_80181AD0 = 0x092A5708;
g_IsCutsceneDone = 0x092A5728;
Expand Down
7 changes: 7 additions & 0 deletions include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,12 @@ typedef struct {
/* 0x84 */ s16 unk84;
} ET_801B56E4;

typedef struct {
/* 0x7C */ s32 : 32;
/* 0x80 */ s32 : 32;
/* 0x84 */ u8 unk84;
} ET_801BB200;

typedef union { // offset=0x7C
struct Primitive* prim;
ET_Placeholder ILLEGAL;
Expand Down Expand Up @@ -3119,6 +3125,7 @@ typedef union { // offset=0x7C
ET_801AE8E8 et_801AE8E8;
ET_FleaArmor fleaArmor;
ET_801B56E4 et_801B56E4;
ET_801BB200 et_801BB200;
} Ext;

#define SYNC_FIELD(struct1, struct2, field) \
Expand Down
24 changes: 17 additions & 7 deletions src/st/lib/unk_3C57C.c → src/st/lib/e_lesser_demon.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "lib.h"

INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BC57C);
// Lesser demon start
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BB8DC);

INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BC814);
u8 func_us_801BBAB4(void);
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BBAB4);

INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BBEB0);

INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BC28C);

INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BC57C);

INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BC814);

INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BCC10);
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BCC10);

INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BCFD4);
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BCFD4);

// Lesser Demon minion spawn?
// Seems like the vertical tractor beam effect that spawns
// Mudmen, Skeleton, Ectoplasm
INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BD268);
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BD268);

u8 func_us_801BDA34(void);
INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BDA34);
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BDA34);

u8 func_us_801BBAB4(void);

Expand Down Expand Up @@ -605,4 +615,4 @@ void func_us_801BDAE4(Entity* self) {
}
}

INCLUDE_ASM("st/lib/nonmatchings/unk_3C57C", func_us_801BED48);
INCLUDE_ASM("st/lib/nonmatchings/e_lesser_demon", func_us_801BED48);
4 changes: 4 additions & 0 deletions src/st/lib/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ typedef enum EntityIDs {
// /* 0x0F */ E_DUMMY_0F,
// /* 0x10 */ E_DUMMY_10,
// /* 0x11 */ E_ID_11,
/* 0x12 */ E_ID_12 = 0x12,
// /* 0x13 */ E_UNK_ID_13,
/* 0x14 */ E_ID_14 = 0x14,
/* 0x15 */ E_GREY_PUFF,
/* 0x1C */ E_ID_1C = 0x1C,
/* 0x1D */ E_BLOOD_DRIPS,
/* 0x1E */ E_BLOOD_SPLATTER,
/* 0x1F */ E_ID_1F,
/* 0x20 */ E_ID_20 = 0x20,
/* 0x21 */ E_ID_21,
/* 0x22 */ E_ID_22,
Expand All @@ -50,6 +52,8 @@ typedef enum EntityIDs {
/* 0x3C */ E_CORPSEWEED_PROJECTILE,
/* 0x3D */ E_CANDLE_TABLE,
/* 0x3E */ E_ID_3E = 0x3E,
/* 0x40 */ E_ID_40 = 0x40,
/* 0x42 */ E_ID_42 = 0x42,
/* 0x43 */ E_SKELETON = 0x43,
/* 0x44 */ E_SKELETON_THROWN_BONE,
/* 0x45 */ E_SKELETON_PIECES,
Expand Down
116 changes: 116 additions & 0 deletions src/st/lib/unk_3B200.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "lib.h"

#ifdef VERSION_PSP
extern s32 D_psp_092A5578;
#endif
extern u16 D_us_8018095C;
extern u16 D_us_80181AA8[][2];
extern s32 D_us_80181AC8;

// This seems to be related to the Lesser Demon boss fight somehow, but not the
// Lesser Demon itself.
void func_us_801BB200(Entity* self) {
s32 i;
s32 params;
s32 adjustedY;
s32 upperParams;
s32 tilePos;
Entity* newEntity;

switch (self->step) {
case 0:
InitializeEntity(&D_us_8018095C);
params = self->params & 0xFF;
self->animCurFrame = params + 0xF;
self->zPriority = 0x69;
if (self->params & 0x100) {
self->facingLeft = 1;
}
self->ext.et_801BB200.unk84 = 0;
if (!self->params) {
newEntity = self + 1;
for (i = 1; i < 4; i++, newEntity++) {
#ifdef VERSION_PSP
CreateEntityFromCurrentEntity(D_psp_092A5578, newEntity);
#else
CreateEntityFromCurrentEntity(E_ID_40, newEntity);
#endif
newEntity->params = i;
}
for (i = 0; i < 4; i++, newEntity++) {
#ifdef VERSION_PSP
CreateEntityFromCurrentEntity(D_psp_092A5578, newEntity);
#else
CreateEntityFromCurrentEntity(E_ID_40, newEntity);
#endif
newEntity->params = i + 0x100;
}
}
self->posY.i.hi = 0x258 - g_Tilemap.scrollY.i.hi;
if (self->params & 0x100) {
self->posX.i.hi = 0x2E0 - g_Tilemap.scrollX.i.hi;
} else {
self->posX.i.hi = 0x120 - g_Tilemap.scrollX.i.hi;
}
break;
case 1:
if ((D_us_80181AC8) && (!(self->params & 0xFF))) {
self->step = 2;
}
if (self->ext.et_801BB200.unk84) {
self->step = 2;
}
break;
case 2:
self->velocityY = FIX(4.0);
self->step++;
/* fallthrough */
case 3:
MoveEntity();
self->velocityY += FIX(0.125);
params = self->params & 0xFF;
upperParams = self->params >> 8;
adjustedY = ((3 - params) * 16) + 0x268 - (g_Tilemap.scrollY.i.hi);
if (adjustedY < self->posY.i.hi) {
if (params != 4) {
newEntity = self + 1;
newEntity->ext.et_801BB200.unk84 = 1;
}
self->posY.i.hi = adjustedY;
tilePos = 0xBF2;
if (self->params & 0x100) {
g_api.PlaySfx(SFX_DOOR_CLOSE_B);
tilePos = 0xC0D;
}
tilePos += ((3 - params) * 0x50);
g_Tilemap.fg[tilePos] = D_us_80181AA8[7 - params][upperParams];
self->velocityY = 0;
self->step++;
}
break;
case 4:
if (!D_us_80181AC8) {
self->step++;
}
break;
case 5:
tilePos = 0xBF2;
params = self->params & 0xFF;
upperParams = self->params >> 8;
if (self->params & 0x100) {
tilePos = 0xC0D;
}
tilePos += ((3 - params) * 0x50);
g_Tilemap.fg[tilePos] = D_us_80181AA8[3 - params][upperParams];
newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (newEntity != NULL) {
CreateEntityFromEntity(2, self, newEntity);
newEntity->params = 3;
}
self->animCurFrame = 0;
self->step++;
case 6:
break;
}
}
6 changes: 6 additions & 0 deletions src/st/lib/unk_3B53C.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "lib.h"

// Using an include to consolidate the code because it doesn't seem that PSP can
// be split in a way to allow merging at this time.
#include "unk_3B53C.h"
Loading

0 comments on commit 62945c1

Please sign in to comment.