Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some JP decomp #1149

Merged
merged 18 commits into from
Jan 16, 2024
12 changes: 10 additions & 2 deletions include/common_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1168,14 +1168,20 @@ typedef struct ItemEntity {
/* 0x58 */ s32 sparkleHeight;
} ItemEntity; // size = 0x5C

#if VERSION_JP
#define PRINT_BUFFER_SIZE 1024
#else
#define PRINT_BUFFER_SIZE 1088 // slightly larger than source buffer
#endif

typedef struct MessagePrintState {
/* 0x000 */ u8* srcBuffer;
/* 0x004 */ u16 printBufferPos;
/* 0x006 */ char unk_06[2];
/* 0x008 */ s32 msgID;
/* 0x00C */ u16 srcBufferPos;
/* 0x00E */ u16 curPrintDelay;
/* 0x010 */ u8 printBuffer[1088]; // slightly larger than source buffer
/* 0x010 */ u8 printBuffer[PRINT_BUFFER_SIZE];
/* 0x450 */ s16 printBufferSize;
/* 0x452 */ u16 effectFrameCounter;
/* 0x454 */ u8 font;
Expand Down Expand Up @@ -1258,8 +1264,10 @@ typedef struct MessagePrintState {
/* 0x548 */ PAL_PTR letterBackgroundPal;
/* 0x54C */ IMG_PTR letterContentImg;
/* 0x550 */ PAL_PTR letterContentPal;
#if !VERSION_JP
/* 0x554 */ char unk_554[0x4];
} MessagePrintState; // size = 0x558
#endif
} MessagePrintState; // size = 0x558, JP size = 0x514

typedef struct MessageDrawState {
/* 0x00 */ s32 clipX[2]; // characters beyond this pos get skipped
Expand Down
368 changes: 368 additions & 0 deletions include/enums.h

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/101b90_len_8f0.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#define SPRITE_ROM_START 0x1943000 + 0x10
#elif VERSION_PAL
#define SPRITE_ROM_START 0x1DF0000 + 0x10
#elif VERSION_JP
#define SPRITE_ROM_START 0x1A40000 + 0x10
#endif

extern s32 spr_allocateBtlComponentsOnWorldHeap;
Expand Down
428 changes: 403 additions & 25 deletions src/8a860_len_3f30.c

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ extern Addr WorldEntityHeapBase;
#define entity_default_VRAM (void*) 0x802BAE00
#endif

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_default_ROM_END;
extern Addr entity_default_ROM_START;
extern Addr entity_jan_iwa_ROM_END;
extern Addr entity_jan_iwa_ROM_START;
extern Addr entity_sbk_omo_ROM_END;
extern Addr entity_sbk_omo_ROM_START;
#endif

s32 D_8014AFB0 = 255;

SHIFT_BSS s32 CreateEntityVarArgBuffer[4];
Expand Down
19 changes: 19 additions & 0 deletions src/entity/Block.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_BrickBlock_ROM_END;
extern Addr entity_model_BrickBlock_ROM_START;
extern Addr entity_model_Hammer1Block_ROM_END;
extern Addr entity_model_Hammer1Block_ROM_START;
extern Addr entity_model_Hammer2Block_ROM_END;
extern Addr entity_model_Hammer2Block_ROM_START;
extern Addr entity_model_Hammer3Block_ROM_END;
extern Addr entity_model_Hammer3Block_ROM_START;
extern Addr entity_model_InertRedBlock_ROM_END;
extern Addr entity_model_InertRedBlock_ROM_START;
extern Addr entity_model_InertYellowBlock_ROM_END;
extern Addr entity_model_InertYellowBlock_ROM_START;
extern Addr entity_model_PowBlock_ROM_END;
extern Addr entity_model_PowBlock_ROM_START;
extern Addr entity_model_PushBlock_ROM_END;
extern Addr entity_model_PushBlock_ROM_START;
#endif

extern Gfx Entity_InertYellowBlock_Render[];
extern Gfx Entity_InertRedBlock_Render[];
extern Gfx Entity_BrickBlock_Render[];
Expand Down
5 changes: 5 additions & 0 deletions src/entity/BlueWarpPipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include "entity.h"
#include "sprite/player.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_BlueWarpPipe_ROM_END;
extern Addr entity_model_BlueWarpPipe_ROM_START;
#endif

extern Gfx Entity_BlueWarpPipe_RenderPipe[];
extern Gfx Entity_BlueWarpPipe_RenderBase[];

Expand Down
5 changes: 5 additions & 0 deletions src/entity/Chest.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "entity.h"
#include "sprite/player.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_Chest_ROM_END;
extern Addr entity_model_Chest_ROM_START;
#endif

extern EntityScript Entity_Chest_ScriptOpened;

extern Gfx Entity_Chest_RenderBox[];
Expand Down
7 changes: 7 additions & 0 deletions src/entity/HeartBlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_HeartBlockContent_ROM_END;
extern Addr entity_model_HeartBlockContent_ROM_START;
extern Addr entity_model_HeartBlock_ROM_END;
extern Addr entity_model_HeartBlock_ROM_START;
#endif

extern EntityModelScript Entity_HeartBlockContent_RenderScriptIdle;
extern EntityModelScript Entity_HeartBlockContent_RenderScriptAfterHit;
extern EntityModelScript Entity_HeartBlockContent_RenderScriptHit;
Expand Down
5 changes: 5 additions & 0 deletions src/entity/HiddenPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_HiddenPanel_ROM_END;
extern Addr entity_model_HiddenPanel_ROM_START;
#endif

s32 entity_HiddenPanel_is_item_on_top(Entity*);
void entity_HiddenPanel_flip_over(Entity*);

Expand Down
19 changes: 19 additions & 0 deletions src/entity/ItemBlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
#include "entity.h"
#include "model.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_HitFloatingYellowBlock_anim_ROM_END;
extern Addr entity_model_HitFloatingYellowBlock_anim_ROM_START;
extern Addr entity_model_HitFloatingYellowBlock_gfx_ROM_END;
extern Addr entity_model_HitFloatingYellowBlock_gfx_ROM_START;
extern Addr entity_model_HitRedBlock_anim_ROM_END;
extern Addr entity_model_HitRedBlock_anim_ROM_START;
extern Addr entity_model_HitRedBlock_gfx_ROM_END;
extern Addr entity_model_HitRedBlock_gfx_ROM_START;
extern Addr entity_model_HitYellowBlock_anim_ROM_END;
extern Addr entity_model_HitYellowBlock_anim_ROM_START;
extern Addr entity_model_HitYellowBlock_gfx_ROM_END;
extern Addr entity_model_HitYellowBlock_gfx_ROM_START;
extern Addr entity_model_RedBlock_ROM_END;
extern Addr entity_model_RedBlock_ROM_START;
extern Addr entity_model_YellowBlock_ROM_END;
extern Addr entity_model_YellowBlock_ROM_START;
#endif

extern Gfx Entity_YellowBlock_Render[];
extern Gfx Entity_RedBlock_Render[];
extern AnimScript Entity_HitYellowBlock_AnimationHit;
Expand Down
5 changes: 5 additions & 0 deletions src/entity/SaveBlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include "entity.h"
#include "message_ids.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_SaveBlock_ROM_END;
extern Addr entity_model_SaveBlock_ROM_START;
#endif

extern Mtx Entity_SaveBlock_Mtx;
extern Gfx Entity_SaveBlock_RenderContent[];
extern Gfx Entity_SaveBlock_RenderBlock[];
Expand Down
11 changes: 11 additions & 0 deletions src/entity/ShatteringBlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_ShatteringBrickBlock_ROM_END;
extern Addr entity_model_ShatteringBrickBlock_ROM_START;
extern Addr entity_model_ShatteringHammer1Block_ROM_END;
extern Addr entity_model_ShatteringHammer1Block_ROM_START;
extern Addr entity_model_ShatteringHammer2Block_ROM_END;
extern Addr entity_model_ShatteringHammer2Block_ROM_START;
extern Addr entity_model_ShatteringHammer3Block_ROM_END;
extern Addr entity_model_ShatteringHammer3Block_ROM_START;
#endif

extern Mtx Entity_ShatteringHammer1Block_FragmentsMatrices[];
extern Gfx* Entity_ShatteringHammer1Block_FragmentsRender[];
extern Mtx Entity_ShatteringHammer2Block_FragmentsMatrices[];
Expand Down
5 changes: 5 additions & 0 deletions src/entity/Signpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_Signpost_ROM_END;
extern Addr entity_model_Signpost_ROM_START;
#endif

extern Gfx Entity_Signpost_Render[];

void entity_Signpost_idle(Entity* entity) {
Expand Down
11 changes: 11 additions & 0 deletions src/entity/SimpleSpring.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
#include "animation_script.h"
#include "ld_addrs.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_ScriptSpring_anim_ROM_END;
extern Addr entity_model_ScriptSpring_anim_ROM_START;
extern Addr entity_model_ScriptSpring_gfx_ROM_END;
extern Addr entity_model_ScriptSpring_gfx_ROM_START;
extern Addr entity_model_SimpleSpring_anim_ROM_END;
extern Addr entity_model_SimpleSpring_anim_ROM_START;
extern Addr entity_model_SimpleSpring_gfx_ROM_END;
extern Addr entity_model_SimpleSpring_gfx_ROM_START;
#endif

extern StaticAnimatorNode* Entity_ScriptSpring_Mesh[];
extern AnimScript Entity_ScriptSpring_AnimLaunch;
extern AnimScript Entity_ScriptSpring_AnimIdle;
Expand Down
11 changes: 11 additions & 0 deletions src/entity/SuperBlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_SuperBlockContent_ROM_END;
extern Addr entity_model_SuperBlockContent_ROM_START;
extern Addr entity_model_SuperBlock_ROM_END;
extern Addr entity_model_SuperBlock_ROM_START;
extern Addr entity_model_UltraBlockContent_ROM_END;
extern Addr entity_model_UltraBlockContent_ROM_START;
extern Addr entity_model_UltraBlock_ROM_END;
extern Addr entity_model_UltraBlock_ROM_START;
#endif

extern EntityBlueprint Entity_SuperBlockContent;

extern Gfx Entity_SuperBlock_Render[];
Expand Down
9 changes: 9 additions & 0 deletions src/entity/Switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_BlueSwitch_ROM_END;
extern Addr entity_model_BlueSwitch_ROM_START;
extern Addr entity_model_GreenStompSwitch_ROM_END;
extern Addr entity_model_GreenStompSwitch_ROM_START;
extern Addr entity_model_RedSwitch_ROM_END;
extern Addr entity_model_RedSwitch_ROM_START;
#endif

#define REFLECTED_SWITCH_HIDDEN 1
#define REFLECTED_SWITCH_LINKED 2

Expand Down
5 changes: 5 additions & 0 deletions src/entity/WoodenCrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include "ld_addrs.h"
#include "entity.h"

#if VERSION_JP // TODO remove once segments are split
extern Addr entity_model_WoodenCrate_ROM_END;
extern Addr entity_model_WoodenCrate_ROM_START;
#endif

extern Gfx Entity_RenderNone[];
extern Gfx Entity_WoodenCrate_Render[];
extern Gfx* Entity_WoodenCrate_FragmentsRender[];
Expand Down
5 changes: 5 additions & 0 deletions src/evt/demo_api.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#include "common.h"
#include "ld_addrs.h"

#if VERSION_JP // TODO remove once this part is split
#define SHADING_NONE 0xFFFFFFFF
extern Addr sprite_shading_profiles_ROM_START;
#endif

// TODO: not sure where these go
u8 D_802D9D70 = 254;
u8 D_802D9D71 = 254;
Expand Down
5 changes: 5 additions & 0 deletions src/imgfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include "sprite.h"
#include "imgfx.h"


#if VERSION_JP // TODO remove once segments are split
extern Addr imgfx_data_ROM_START;
#endif

typedef union ImgFXIntVars {
s32 raw[2][4];
struct {
Expand Down
Loading
Loading