mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-23 12:59:44 +00:00
Decompile Bg_Fu_Kaiten. Add some method to generate overlays, refinement needed
This commit is contained in:
parent
664bb49a5d
commit
37969fbe50
56
Makefile
56
Makefile
@ -21,6 +21,7 @@ build/src/libultra/%: CFLAGS := $(CFLAGS) -Wab,-r4300_mul
|
||||
build/src/boot_O1/%: OPTIMIZATION := -O1
|
||||
build/src/boot_O2_g3/%: OPTIMIZATION := -O2 -g3
|
||||
build/src/code/%: CFLAGS := $(CFLAGS) -Wab,-r4300_mul
|
||||
build/src/actors/%: CFLAGS := $(CFLAGS) -Wab,-r4300_mul
|
||||
test.txt: OPTIMIZATION := -O2 -g3
|
||||
test.txt: CC := $(QEMU_IRIX) -L $(IRIX_71_ROOT) $(IRIX_71_ROOT)/usr/bin/cc
|
||||
test.txt: CFLAGS := $(CFLAGS) -Wab,-r4300_mul
|
||||
@ -30,6 +31,7 @@ CC := $(QEMU_IRIX) -L $(IRIX_71_ROOT) $(IRIX_71_ROOT)/usr/bin/cc
|
||||
test.txt: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
build/src/boot_O2_g3/%: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
build/src/code/%: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
build/src/actors/%: CC := ./tools/preprocess.py $(CC) -- $(AS) $(ASFLAGS) --
|
||||
|
||||
BASEROM_FILES := $(wildcard baserom/*)
|
||||
# Exclude dmadata, it will be generated right before packing the rom
|
||||
@ -51,29 +53,33 @@ C_FILES := $(wildcard src/libultra/*) \
|
||||
$(wildcard src/libultra/gu/*) \
|
||||
$(wildcard src/code/*) \
|
||||
$(wildcard src/boot_O2_g3/*) \
|
||||
$(wildcard src/boot_O1/*)
|
||||
$(wildcard src/boot_O1/*) \
|
||||
$(wildcard src/actors/Bg_Fu_Kaiten/*)
|
||||
C_O_FILES = $(C_FILES:src/%.c=build/src/%.o)
|
||||
ROM_FILES := $(shell cat ./tables/makerom_files.txt)
|
||||
|
||||
|
||||
ROM := rom.z64
|
||||
|
||||
BUILD_DIR := ./build
|
||||
|
||||
# make build directories
|
||||
$(shell mkdir -p build/asm)
|
||||
$(shell mkdir -p build/baserom)
|
||||
$(shell mkdir -p build/baserom_pre_dmadata)
|
||||
$(shell mkdir -p build/comp)
|
||||
$(shell mkdir -p build/decomp)
|
||||
$(shell mkdir -p build/decomp_pre_dmadata)
|
||||
$(shell mkdir -p build/src)
|
||||
$(shell mkdir -p build/src/libultra)
|
||||
$(shell mkdir -p build/src/libultra/os)
|
||||
$(shell mkdir -p build/src/libultra/io)
|
||||
$(shell mkdir -p build/src/libultra/libc)
|
||||
$(shell mkdir -p build/src/libultra/gu)
|
||||
$(shell mkdir -p build/src/code)
|
||||
$(shell mkdir -p build/src/boot_O2_g3)
|
||||
$(shell mkdir -p build/src/boot_O1)
|
||||
$(shell mkdir -p $(BUILD_DIR)/asm)
|
||||
$(shell mkdir -p $(BUILD_DIR)/baserom)
|
||||
$(shell mkdir -p $(BUILD_DIR)/baserom_pre_dmadata)
|
||||
$(shell mkdir -p $(BUILD_DIR)/comp)
|
||||
$(shell mkdir -p $(BUILD_DIR)/decomp)
|
||||
$(shell mkdir -p $(BUILD_DIR)/decomp_pre_dmadata)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/libultra)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/libultra/os)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/libultra/io)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/libultra/libc)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/libultra/gu)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/code)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/boot_O2_g3)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/boot_O1)
|
||||
$(shell mkdir -p $(BUILD_DIR)/src/actors/Bg_Fu_Kaiten)
|
||||
|
||||
check: $(ROM)
|
||||
@md5sum -c checksum.md5
|
||||
@ -90,6 +96,9 @@ build/code_pre_dmadata.bin: build/code_pre_dmadata.elf
|
||||
build/ovl_title_pre_dmadata.bin: build/code_pre_dmadata.elf
|
||||
$(MIPS_BINUTILS)objcopy --dump-section ovl_title=$@ $<
|
||||
|
||||
build/ovl_Bg_Fu_Kaiten_pre_dmadata.bin: build/code_pre_dmadata.elf
|
||||
$(MIPS_BINUTILS)objcopy --dump-section ovl_Bg_Fu_Kaiten=$@ $<
|
||||
|
||||
build/boot.bin: build/code.elf
|
||||
$(MIPS_BINUTILS)objcopy --dump-section boot=$@ $<
|
||||
|
||||
@ -99,6 +108,9 @@ build/code.bin: build/code.elf
|
||||
build/ovl_title.bin: build/code.elf
|
||||
$(MIPS_BINUTILS)objcopy --dump-section ovl_title=$@ $<
|
||||
|
||||
build/ovl_Bg_Fu_Kaiten.bin: build/code.elf
|
||||
$(MIPS_BINUTILS)objcopy --dump-section ovl_Bg_Fu_Kaiten=$@ $<
|
||||
|
||||
build/code_pre_dmadata.elf: $(S_O_FILES) $(C_O_FILES) linker_scripts/code_script.txt undef.txt linker_scripts/object_script.txt
|
||||
$(LD) -r -T linker_scripts/code_script.txt -T undef.txt -T linker_scripts/object_script.txt --no-check-sections --accept-unknown-input-arch -o $@
|
||||
|
||||
@ -135,6 +147,9 @@ build/decomp/code: build/code.bin
|
||||
build/decomp/ovl_title: build/ovl_title.bin
|
||||
cp $< $@
|
||||
|
||||
build/decomp/ovl_Bg_Fu_Kaiten: build/ovl_Bg_Fu_Kaiten.bin
|
||||
cp $< $@
|
||||
|
||||
build/baserom_pre_dmadata/boot: build/boot_pre_dmadata.bin
|
||||
cp $< $@
|
||||
|
||||
@ -144,9 +159,16 @@ build/decomp_pre_dmadata/code: build/code_pre_dmadata.bin
|
||||
build/decomp_pre_dmadata/ovl_title: build/ovl_title_pre_dmadata.bin
|
||||
cp $< $@
|
||||
|
||||
build/decomp_pre_dmadata/ovl_Bg_Fu_Kaiten: build/ovl_Bg_Fu_Kaiten_pre_dmadata.bin
|
||||
cp $< $@
|
||||
|
||||
build/src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.o: src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.c include/*
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTIMIZATION) -Iinclude -o $@ $<
|
||||
./tools/overlay.py build/src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.o build/src/actors/Bg_Fu_Kaiten/overlay.s
|
||||
$(AS) $(ASFLAGS )build/src/actors/Bg_Fu_Kaiten/overlay.s -o build/src/actors/Bg_Fu_Kaiten/overlay.o
|
||||
|
||||
disasm:
|
||||
@./tools/disasm.py -d ./asm -e ./include -u . -l ./tables/files.py -f ./tables/functions.py -o ./tables/objects.py -v ./tables/variables.py -v ./tables/vrom_variables.py -v ./tables/object_addr_variables.py -v ./tables/pre_boot_variables.py
|
||||
@./tools/disasm.py -d ./asm -e ./include -u . -l ./tables/files.py -f ./tables/functions.py -o ./tables/objects.py -v ./tables/variables.py -v ./tables/vrom_variables.py -v ./tables/pre_boot_variables.py
|
||||
@while read -r file; do \
|
||||
./tools/split_asm.py ./asm/$$file.asm ./asm/nonmatching/$$file; \
|
||||
done < ./tables/files_with_nonmatching.txt
|
||||
|
@ -549,11 +549,11 @@ void func_800ACFD8(void); // func_800ACFD8
|
||||
void func_800AD09C(void); // func_800AD09C
|
||||
void func_800AE2A0(void); // func_800AE2A0
|
||||
void func_800AE434(GlobalContext* ctxt, ColorRGBA8* color, short sParm3, short sParm4); // func_800AE434
|
||||
void func_800AE5A0(void); // func_800AE5A0
|
||||
void func_800AE5A0(GlobalContext* ctxt); // func_800AE5A0
|
||||
void func_800AE5E4(void); // func_800AE5E4
|
||||
void func_800AE778(GlobalContext* ctxt, ColorRGBA8* color, short param_3, short param_4); // func_800AE778
|
||||
void func_800AE8EC(void); // func_800AE8EC
|
||||
void func_800AE930(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // func_800AE930
|
||||
void func_800AE8EC(GlobalContext* ctxt); // func_800AE8EC
|
||||
void func_800AE930(BgCheckContext* bgCtxt, int param_2, float* param_3, float param_4, short param_5, int param_6, int param_7); // func_800AE930
|
||||
void func_800AEF44(void); // func_800AEF44
|
||||
void func_800AEF70(void); // func_800AEF70
|
||||
void func_800AEFA0(void); // func_800AEFA0
|
||||
@ -567,8 +567,8 @@ void func_800AF87C(void); // func_800AF87C
|
||||
void func_800AF890(GlobalContext* ctxt); // func_800AF890
|
||||
void func_800AF960(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE4 param_6); // func_800AF960
|
||||
void func_800AFB24(void); // func_800AFB24
|
||||
void func_800AFC60(void); // func_800AFC60
|
||||
void func_800AFDCC(void); // func_800AFDCC
|
||||
void func_800AFC60(GlobalContext* ctxt); // func_800AFC60
|
||||
void func_800AFDCC(GlobalContext* ctxt, int param_2); // func_800AFDCC
|
||||
void func_800AFF24(void); // func_800AFF24
|
||||
void EffectSS_Init(GlobalContext* ctxt, s32 numEntries); // func_800B0050
|
||||
void EffectSS_Fini(GlobalContext* ctxt); // func_800B0140
|
||||
@ -1031,7 +1031,7 @@ void func_800C636C(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index); // fu
|
||||
void func_800C63C4(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index); // func_800C63C4
|
||||
void func_800C641C(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index); // func_800C641C
|
||||
void func_800C6474(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index); // func_800C6474
|
||||
void func_800C64CC(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index); // func_800C64CC
|
||||
void BgCheck_RemoveActorMesh(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index); // func_800C64CC
|
||||
void func_800C6554(void); // func_800C6554
|
||||
void BgCheck_CalcWaterboxDimensions(Vector3f* minPos, Vector3f* maxXPos, Vector3f* maxZPos, Vector3s* minPosOut, s16* xLength, s16* zLength); // func_800C656C
|
||||
void func_800C6838(GlobalContext* ctxt, BgDynaCollision* dyna, s32 index, s32* currVertices, s32* currPolygons, s32* currWaterboxes); // func_800C6838
|
||||
@ -1753,7 +1753,7 @@ void func_800FB758(void); // func_800FB758
|
||||
void func_800FB9B4(void); // func_800FB9B4
|
||||
void func_800FBCBC(void); // func_800FBCBC
|
||||
void func_800FBDEC(void); // func_800FBDEC
|
||||
void func_800FBF3C(void); // func_800FBF3C
|
||||
void func_800FBF3C(GlobalContext* ctxt); // func_800FBF3C
|
||||
void func_800FC158(void); // func_800FC158
|
||||
void func_800FC3DC(void); // func_800FC3DC
|
||||
void func_800FC444(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6); // func_800FC444
|
||||
@ -2523,7 +2523,7 @@ void func_801353D4(void); // func_801353D4
|
||||
void func_801353F8(void); // func_801353F8
|
||||
void func_8013541C(void); // func_8013541C
|
||||
void func_80135448(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_80135448
|
||||
void func_801358C8(void); // func_801358C8
|
||||
void func_801358C8(UNK_PTR param_1); // func_801358C8
|
||||
void func_801358D4(void); // func_801358D4
|
||||
void func_801358F4(void); // func_801358F4
|
||||
void func_8013591C(void); // func_8013591C
|
||||
@ -2964,7 +2964,7 @@ void func_80165E1C(void); // func_80165E1C
|
||||
void func_80165E7C(void); // func_80165E7C
|
||||
void func_80165EC0(void); // func_80165EC0
|
||||
void func_80166060(void); // func_80166060
|
||||
void func_801660B8(void); // func_801660B8
|
||||
void func_801660B8(GlobalContext* ctxt, UNK_TYPE4 param_2); // func_801660B8
|
||||
void Main_Fini(GlobalContext* ctxt); // func_8016613C
|
||||
void func_801663C4(void); // func_801663C4
|
||||
void func_80166644(void); // func_80166644
|
||||
@ -3814,7 +3814,7 @@ void func_8019F830(void); // func_8019F830
|
||||
void func_8019F88C(void); // func_8019F88C
|
||||
void func_8019F900(void); // func_8019F900
|
||||
void func_8019FA18(void); // func_8019FA18
|
||||
void func_8019FAD8(void); // func_8019FAD8
|
||||
void func_8019FAD8(Vector3f* param_1, u16 param_2, f32 param_3); // func_8019FAD8
|
||||
void func_8019FB0C(void); // func_8019FB0C
|
||||
void func_8019FC20(void); // func_8019FC20
|
||||
void func_8019FCB8(void); // func_8019FCB8
|
||||
@ -3993,8 +3993,8 @@ void func_801AA248(void); // func_801AA248
|
||||
void func_801AA3E4(void); // func_801AA3E4
|
||||
void func_801AA520(void); // func_801AA520
|
||||
void func_801AA610(GlobalContext* ctxt); // func_801AA610
|
||||
void func_801AA624(void); // func_801AA624
|
||||
void func_801AA68C(void); // func_801AA68C
|
||||
void func_801AA624(GlobalContext* ctxt); // func_801AA624
|
||||
void func_801AA68C(UNK_TYPE4 ctxt); // func_801AA68C
|
||||
void nop_801AAAA0(GlobalContext* ctxt); // func_801AAAA0
|
||||
void Title_UpdateCounters(TitleContext* ctxt); // func_80800000
|
||||
void Title_RenderView(TitleContext* ctxt, f32 eyeX, f32 eyeY, f32 eyeZ); // func_8080009C
|
||||
@ -11973,12 +11973,12 @@ void func_80ACB1E0(void); // func_80ACB1E0
|
||||
void func_80ACB220(void); // func_80ACB220
|
||||
void func_80ACB230(void); // func_80ACB230
|
||||
void func_80ACB2B0(void); // func_80ACB2B0
|
||||
void func_80ACB400(void); // func_80ACB400
|
||||
void func_80ACB480(void); // func_80ACB480
|
||||
void func_80ACB4B4(void); // func_80ACB4B4
|
||||
void func_80ACB50C(void); // func_80ACB50C
|
||||
void func_80ACB570(void); // func_80ACB570
|
||||
void func_80ACB5A0(void); // func_80ACB5A0
|
||||
void BgFuKaiten_Init(ActorBgFuKaiten* this, GlobalContext* ctxt); // func_80ACB400
|
||||
void BgFuKaiten_Fini(ActorBgFuKaiten* this, GlobalContext* ctxt); // func_80ACB480
|
||||
void BgFuKaiten_UpdateRotation(ActorBgFuKaiten* this); // func_80ACB4B4
|
||||
void BgFuKaiten_UpdateHeight(ActorBgFuKaiten* this); // func_80ACB50C
|
||||
void BgFuKaiten_Main(ActorBgFuKaiten* this, GlobalContext* ctxt); // func_80ACB570
|
||||
void BgFuKaiten_Draw(ActorBgFuKaiten* this, GlobalContext* ctxt); // func_80ACB5A0
|
||||
void func_80ACB6A0(void); // func_80ACB6A0
|
||||
void func_80ACB7F4(void); // func_80ACB7F4
|
||||
void func_80ACB940(void); // func_80ACB940
|
||||
|
@ -5,9 +5,10 @@
|
||||
|
||||
extern UNK_TYPE D_04029CB0; // D_04029CB0
|
||||
extern UNK_TYPE D_04029CF0; // D_04029CF0
|
||||
extern UNK_TYPE D_060005D0; // D_060005D0
|
||||
extern UNK_TYPE D_06001100; // D_06001100
|
||||
extern UNK_TYPE D_06001228; // D_06001228
|
||||
extern UNK_TYPE D_06002D30; // D_06002D30
|
||||
|
||||
extern Gfx object_fu_kaiten_0005D0[];
|
||||
extern BgMeshHeader object_fu_kaiten_002D30;
|
||||
|
||||
#endif
|
||||
|
@ -1226,6 +1226,8 @@ typedef struct {
|
||||
/* 0x7A */ UNK_TYPE2 unk7A[3];
|
||||
} RoomContext;
|
||||
|
||||
typedef struct ActorBgFuKaiten ActorBgFuKaiten;
|
||||
|
||||
typedef struct ActorBgMbarChair ActorBgMbarChair;
|
||||
|
||||
typedef struct ActorEnBji01 ActorEnBji01;
|
||||
@ -2164,6 +2166,17 @@ struct BgActor {
|
||||
/* 0x159 */ UNK_TYPE1 pad159[3];
|
||||
};
|
||||
|
||||
struct ActorBgFuKaiten {
|
||||
/* 0x000 */ BgActor bg;
|
||||
/* 0x15C */ UNK_TYPE1 pad15C[4];
|
||||
/* 0x160 */ f32 elevation;
|
||||
/* 0x164 */ f32 bouceHeight;
|
||||
/* 0x168 */ s16 rotationSpeed;
|
||||
/* 0x16A */ s16 bounceSpeed;
|
||||
/* 0x16C */ s16 bounce;
|
||||
/* 0x16E */ UNK_TYPE1 pad16E[2];
|
||||
};
|
||||
|
||||
struct ActorBgIknvObj {
|
||||
/* 0x000 */ BgActor bg;
|
||||
/* 0x15C */ ColCylinder collision;
|
||||
|
@ -10942,6 +10942,7 @@ extern UNK_TYPE1 D_80ACB3B0; // D_80ACB3B0
|
||||
extern OverlayBlockSizes bgOpenSpotOverlayInfo; // D_80ACB3C0
|
||||
extern u32 bgOpenSpotOverlayRelocations[7]; // D_80ACB3D4
|
||||
extern u32 bgOpenSpotOverlayInfoOffset; // D_80ACB3FC
|
||||
extern ActorInitData bgFuKaitenInitData; // D_80ACB630
|
||||
extern f32 D_80ACB650; // D_80ACB650
|
||||
extern OverlayBlockSizes bgFuKaitenOverlayInfo; // D_80ACB660
|
||||
extern u32 bgFuKaitenOverlayRelocations[8]; // D_80ACB674
|
||||
@ -13835,7 +13836,7 @@ extern UNK_TYPE4 D_80BD52FC; // D_80BD52FC
|
||||
extern OverlayBlockSizes bgIkanaBombwallOverlayInfo; // D_80BD5300
|
||||
extern u32 bgIkanaBombwallOverlayRelocations[39]; // D_80BD5314
|
||||
extern u32 bgIkanaBombwallOverlayInfoOffset; // D_80BD53BC
|
||||
extern ActorInitData bgIkanaRayInitVar; // D_80BD55D0
|
||||
extern ActorInitData bgIkanaRayInitData; // D_80BD55D0
|
||||
extern UNK_TYPE1 D_80BD55F0; // D_80BD55F0
|
||||
extern ActorInitVar bgIkanaRayCompInit[4]; // D_80BD561C
|
||||
extern UNK_TYPE1 D_80BD562C; // D_80BD562C
|
||||
|
@ -1,5 +1,8 @@
|
||||
SECTIONS
|
||||
{
|
||||
/* Objects with .gptab.data sections error if they are not referenced, for some reason */
|
||||
/DISCARD/ : { *(.gptab.data) }
|
||||
|
||||
boot 0x80080060:
|
||||
{
|
||||
build/src/boot_O2_g3/boot_0x80080060.o(.text)
|
||||
@ -2694,8 +2697,10 @@ SECTIONS
|
||||
|
||||
ovl_Bg_Fu_Kaiten :
|
||||
{
|
||||
build/asm/ovl_Bg_Fu_Kaiten_0x80ACB400.o(.text)
|
||||
build/asm/ovl_Bg_Fu_Kaiten_data.o(.text)
|
||||
build/src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.o(.text)
|
||||
build/src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.o(.data)
|
||||
build/src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.o(.rodata)
|
||||
build/src/actors/Bg_Fu_Kaiten/overlay.o(.ovl)
|
||||
}
|
||||
|
||||
ovl_Obj_Aqua :
|
||||
|
@ -1,6 +1,7 @@
|
||||
D_04029CB0 = 0x04029CB0;
|
||||
D_04029CF0 = 0x04029CF0;
|
||||
D_060005D0 = 0x060005D0;
|
||||
D_06001100 = 0x06001100;
|
||||
D_06001228 = 0x06001228;
|
||||
D_06002D30 = 0x06002D30;
|
||||
|
||||
object_fu_kaiten_0005D0 = 0x060005D0;
|
||||
object_fu_kaiten_002D30 = 0x06002D30;
|
68
src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.c
Normal file
68
src/actors/Bg_Fu_Kaiten/z_bg_fu_kaiten.c
Normal file
@ -0,0 +1,68 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
ActorInitData bgFuKaitenInitData = {
|
||||
0x01AE,
|
||||
1,
|
||||
0,
|
||||
0x30,
|
||||
0x01A0,
|
||||
0, 0,
|
||||
sizeof(ActorBgFuKaiten),
|
||||
(actor_func)&BgFuKaiten_Init,
|
||||
(actor_func)&BgFuKaiten_Fini,
|
||||
(actor_func)&BgFuKaiten_Main,
|
||||
(actor_func)&BgFuKaiten_Draw
|
||||
};
|
||||
|
||||
void BgFuKaiten_Init(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
UNK_TYPE pad0;
|
||||
UNK_TYPE pad1;
|
||||
BgMeshHeader* header = 0;
|
||||
|
||||
Actor_SetScale(&this->bg.base, 1.0);
|
||||
BcCheck3_BgActorInit(&this->bg, 3);
|
||||
BgCheck_RelocateMeshHeader(&object_fu_kaiten_002D30, &header);
|
||||
this->bg.bgActorId = BgCheck_AddActorMesh(ctxt, &ctxt->bgCheckContext.dyna, &this->bg, header);
|
||||
|
||||
this->bouceHeight = 0.0;
|
||||
this->rotationSpeed = 0;
|
||||
this->bounceSpeed = 0;
|
||||
this->bounce = 0;
|
||||
}
|
||||
|
||||
void BgFuKaiten_Fini(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
BgCheck_RemoveActorMesh(ctxt, &ctxt->bgCheckContext.dyna, this->bg.bgActorId);
|
||||
}
|
||||
|
||||
void BgFuKaiten_UpdateRotation(ActorBgFuKaiten* this) {
|
||||
f32 f0;
|
||||
this->bg.base.postDrawParams.rotation.y += this->rotationSpeed;
|
||||
if (this->rotationSpeed > 0)
|
||||
{
|
||||
f0 = this->rotationSpeed * .002f;
|
||||
func_8019FAD8(&this->bg.base.unkEC, 8310, f0);
|
||||
}
|
||||
}
|
||||
|
||||
void BgFuKaiten_UpdateHeight(ActorBgFuKaiten* this) {
|
||||
this->bounce += this->bounceSpeed;
|
||||
this->bg.base.unk24.pos.y = this->bg.base.initPosRot.pos.y + this->elevation + this->bouceHeight;
|
||||
|
||||
this->bg.base.unk24.pos.y -= this->bouceHeight * Lib_cos(this->bounce);
|
||||
}
|
||||
|
||||
void BgFuKaiten_Main(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
BgFuKaiten_UpdateRotation(this);
|
||||
BgFuKaiten_UpdateHeight(this);
|
||||
}
|
||||
|
||||
void BgFuKaiten_Draw(ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
GraphicsContext* gCtxt = ctxt->common.gCtxt;
|
||||
UNK_TYPE pad;
|
||||
|
||||
func_8012C28C(gCtxt);
|
||||
|
||||
gSPMatrix(gCtxt->polyOpa.append++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->common.gCtxt), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gCtxt->polyOpa.append++, object_fu_kaiten_0005D0);
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
typedef struct z_ActorBgFuKaiten_s {
|
||||
/* 0x000 */ Actor baseActor;
|
||||
/* 0x144 */ UNK_TYPE unk144;
|
||||
/* 0x148 */ u8 pad0[0x18];
|
||||
/* 0x160 */ f32 unk160;
|
||||
/* 0x164 */ f32 unk164;
|
||||
/* 0x168 */ s16 unk168;
|
||||
/* 0x16A */ s16 unk16A;
|
||||
/* 0x16C */ s16 unk16C;
|
||||
/* 0x16E */ u8 pad1[0x2];
|
||||
} z_ActorBgFuKaiten;
|
||||
|
||||
void z_bg_fu_kaiten_init(z_ActorBgFuKaiten* this, GlobalContext* ctxt);
|
||||
void z_bg_fu_kaiten_fini(z_ActorBgFuKaiten* this, GlobalContext* ctxt);
|
||||
UNK_RET func_80ACB4B4(z_ActorBgFuKaiten* this);
|
||||
UNK_RET func_80ACB50C(z_ActorBgFuKaiten* this);
|
||||
void z_bg_fu_kaiten_main(z_ActorBgFuKaiten* this, GlobalContext* ctxt);
|
||||
void func_80ACB5A0(z_ActorBgFuKaiten* this, GlobalContext* ctxt);
|
||||
|
||||
ActorInitData bgBgFuKaitenInitVar = {
|
||||
0x01AE,
|
||||
1,
|
||||
0,
|
||||
0x30,
|
||||
0x01A0,
|
||||
sizeof(z_ActorBgFuKaiten),
|
||||
(actor_func)z_bg_fu_kaiten_init,
|
||||
(actor_func)z_bg_fu_kaiten_fini,
|
||||
(actor_func)z_bg_fu_kaiten_main,
|
||||
(actor_func)func_80ACB5A0
|
||||
};
|
||||
|
||||
f32 D_80ACB650 = 0.002;
|
||||
|
||||
|
||||
// Overlay info
|
||||
GLOBAL_ASM(
|
||||
.data
|
||||
glabel D_80ACB654
|
||||
/* 000149 0x80ACB654 */ .word 0x00000000
|
||||
/* 000150 0x80ACB658 */ .word 0x00000000
|
||||
/* 000151 0x80ACB65C */ .word 0x00000000
|
||||
/* 000152 0x80ACB660 */ .word 0x00000230
|
||||
/* 000153 0x80ACB664 */ .word 0x00000020
|
||||
/* 000154 0x80ACB668 */ .word 0x00000010
|
||||
/* 000155 0x80ACB66C */ .word 0x00000000
|
||||
/* 000156 0x80ACB670 */ .word 0x00000008
|
||||
/* 000157 0x80ACB674 */ .word 0x450000D8
|
||||
/* 000158 0x80ACB678 */ .word 0x460000DC
|
||||
/* 000159 0x80ACB67C */ .word 0x44000180
|
||||
/* 000160 0x80ACB680 */ .word 0x44000188
|
||||
/* 000161 0x80ACB684 */ .word 0x82000010
|
||||
/* 000162 0x80ACB688 */ .word 0x82000014
|
||||
/* 000163 0x80ACB68C */ .word 0x82000018
|
||||
/* 000164 0x80ACB690 */ .word 0x8200001C
|
||||
/* 000165 0x80ACB694 */ .word 0x00000000
|
||||
/* 000166 0x80ACB698 */ .word 0x00000000
|
||||
/* 000167 0x80ACB69C */ .word 0x00000040
|
||||
)
|
||||
|
||||
void z_bg_fu_kaiten_init(z_ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
UNK_TYPE pad0;
|
||||
UNK_TYPE pad1;
|
||||
UNK_TYPE sp24 = 0;
|
||||
|
||||
func_800B67E0((Actor*)this, 1.0);
|
||||
func_800CAE10((Actor*)this, 3);
|
||||
func_800C9564((UNK_TYPE)&D_06002D30, &sp24); // XXX: D_06002D30 is probably a constant
|
||||
this->unk144 = func_800C6188(ctxt, &ctxt->unk880, (Actor*)this, sp24);
|
||||
|
||||
this->unk164 = 0.0;
|
||||
this->unk168 = 0;
|
||||
this->unk16A = 0;
|
||||
this->unk16C = 0;
|
||||
}
|
||||
|
||||
void z_bg_fu_kaiten_fini(z_ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
func_800C64CC(ctxt, &ctxt->unk880, this->unk144);
|
||||
}
|
||||
|
||||
UNK_RET func_80ACB4B4(z_ActorBgFuKaiten* this) {
|
||||
s16 v0 = this->unk168;
|
||||
f32 f0;
|
||||
this->baseActor.unkBE += v0;
|
||||
if (v0 > 0)
|
||||
{
|
||||
f0 = (f32)v0 * D_80ACB650;
|
||||
func_8019FAD8(&this->baseActor.unkEC, 8310, f0);
|
||||
}
|
||||
}
|
||||
|
||||
UNK_RET func_80ACB50C(z_ActorBgFuKaiten* this) {
|
||||
this->unk16C += this->unk16A;
|
||||
this->baseActor.unk24.y = this->baseActor.unk8.y + this->unk160 + this->unk164;
|
||||
|
||||
this->baseActor.unk24.y -= this->unk164 * func_800FED44(this->unk16C);
|
||||
}
|
||||
|
||||
void z_bg_fu_kaiten_main(z_ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
func_80ACB4B4(this);
|
||||
func_80ACB50C(this);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
|
||||
void func_80ACB5A0(z_ActorBgFuKaiten* this, GlobalContext* ctxt) {
|
||||
GraphicsContext* sp24 = ctxt->unk0;
|
||||
UNK_TYPE pad;
|
||||
|
||||
// XXX: register allocation is wrong here
|
||||
|
||||
func_8012C28C(sp24);
|
||||
|
||||
{
|
||||
Gfx* v0 = sp24->unk2B0++;
|
||||
v0->words.w0 = 0xDA380003;
|
||||
v0->words.w1 = func_80181A40(ctxt->unk0);
|
||||
}
|
||||
|
||||
{
|
||||
Gfx* v0 = sp24->unk2B0++;
|
||||
v0->words.w0 = 0xDE000000; v0->words.w1 = (u32)&D_060005D0; // XXX: D_060005D0 is probably a constant
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
GLOBAL_ASM("./asm/nonmatching/ovl_Bg_Fu_Kaiten_0x80ACB400/func_80ACB5A0.asm")
|
||||
|
||||
#endif
|
@ -538,11 +538,11 @@
|
||||
0x800AD09C:("func_800AD09C","void","void"),
|
||||
0x800AE2A0:("func_800AE2A0","void","void"),
|
||||
0x800AE434:("func_800AE434","void","GlobalContext* ctxt, ColorRGBA8* color, short sParm3, short sParm4"),
|
||||
0x800AE5A0:("func_800AE5A0","void","void"),
|
||||
0x800AE5A0:("func_800AE5A0","void","GlobalContext* ctxt"),
|
||||
0x800AE5E4:("func_800AE5E4","void","void"),
|
||||
0x800AE778:("func_800AE778","void","GlobalContext* ctxt, ColorRGBA8* color, short param_3, short param_4"),
|
||||
0x800AE8EC:("func_800AE8EC","void","void"),
|
||||
0x800AE930:("func_800AE930","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7"),
|
||||
0x800AE8EC:("func_800AE8EC","void","GlobalContext* ctxt"),
|
||||
0x800AE930:("func_800AE930","void","BgCheckContext* bgCtxt, int param_2, float* param_3, float param_4, short param_5, int param_6, int param_7"),
|
||||
0x800AEF44:("func_800AEF44","void","void"),
|
||||
0x800AEF70:("func_800AEF70","void","void"),
|
||||
0x800AEFA0:("func_800AEFA0","void","void"),
|
||||
@ -556,8 +556,8 @@
|
||||
0x800AF890:("func_800AF890","void","GlobalContext* ctxt"),
|
||||
0x800AF960:("func_800AF960","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE4 param_6"),
|
||||
0x800AFB24:("func_800AFB24","void","void"),
|
||||
0x800AFC60:("func_800AFC60","void","void"),
|
||||
0x800AFDCC:("func_800AFDCC","void","void"),
|
||||
0x800AFC60:("func_800AFC60","void","GlobalContext* ctxt"),
|
||||
0x800AFDCC:("func_800AFDCC","void","GlobalContext* ctxt, int param_2"),
|
||||
0x800AFF24:("func_800AFF24","void","void"),
|
||||
0x800B0050:("EffectSS_Init","void","GlobalContext* ctxt, s32 numEntries"),
|
||||
0x800B0140:("EffectSS_Fini","void","GlobalContext* ctxt"),
|
||||
@ -1020,7 +1020,7 @@
|
||||
0x800C63C4:("func_800C63C4","void","GlobalContext* ctxt, BgDynaCollision* dyna, s32 index"),
|
||||
0x800C641C:("func_800C641C","void","GlobalContext* ctxt, BgDynaCollision* dyna, s32 index"),
|
||||
0x800C6474:("func_800C6474","void","GlobalContext* ctxt, BgDynaCollision* dyna, s32 index"),
|
||||
0x800C64CC:("func_800C64CC","void","GlobalContext* ctxt, BgDynaCollision* dyna, s32 index"),
|
||||
0x800C64CC:("BgCheck_RemoveActorMesh","void","GlobalContext* ctxt, BgDynaCollision* dyna, s32 index"),
|
||||
0x800C6554:("func_800C6554","void","void"),
|
||||
0x800C656C:("BgCheck_CalcWaterboxDimensions","void","Vector3f* minPos, Vector3f* maxXPos, Vector3f* maxZPos, Vector3s* minPosOut, s16* xLength, s16* zLength"),
|
||||
0x800C6838:("func_800C6838","void","GlobalContext* ctxt, BgDynaCollision* dyna, s32 index, s32* currVertices, s32* currPolygons, s32* currWaterboxes"),
|
||||
@ -1742,7 +1742,7 @@
|
||||
0x800FB9B4:("func_800FB9B4","void","void"),
|
||||
0x800FBCBC:("func_800FBCBC","void","void"),
|
||||
0x800FBDEC:("func_800FBDEC","void","void"),
|
||||
0x800FBF3C:("func_800FBF3C","void","void"),
|
||||
0x800FBF3C:("func_800FBF3C","void","GlobalContext* ctxt"),
|
||||
0x800FC158:("func_800FC158","void","void"),
|
||||
0x800FC3DC:("func_800FC3DC","void","void"),
|
||||
0x800FC444:("func_800FC444","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6"),
|
||||
@ -2512,7 +2512,7 @@
|
||||
0x801353F8:("func_801353F8","void","void"),
|
||||
0x8013541C:("func_8013541C","void","void"),
|
||||
0x80135448:("func_80135448","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5"),
|
||||
0x801358C8:("func_801358C8","void","void"),
|
||||
0x801358C8:("func_801358C8","void","UNK_PTR param_1"),
|
||||
0x801358D4:("func_801358D4","void","void"),
|
||||
0x801358F4:("func_801358F4","void","void"),
|
||||
0x8013591C:("func_8013591C","void","void"),
|
||||
@ -2953,7 +2953,7 @@
|
||||
0x80165E7C:("func_80165E7C","void","void"),
|
||||
0x80165EC0:("func_80165EC0","void","void"),
|
||||
0x80166060:("func_80166060","void","void"),
|
||||
0x801660B8:("func_801660B8","void","void"),
|
||||
0x801660B8:("func_801660B8","void","GlobalContext* ctxt, UNK_TYPE4 param_2"),
|
||||
0x8016613C:("Main_Fini","void","GlobalContext* ctxt"),
|
||||
0x801663C4:("func_801663C4","void","void"),
|
||||
0x80166644:("func_80166644","void","void"),
|
||||
@ -3801,7 +3801,7 @@
|
||||
0x8019F88C:("func_8019F88C","void","void"),
|
||||
0x8019F900:("func_8019F900","void","void"),
|
||||
0x8019FA18:("func_8019FA18","void","void"),
|
||||
0x8019FAD8:("func_8019FAD8","void","void"),
|
||||
0x8019FAD8:("func_8019FAD8","void","Vector3f* param_1, u16 param_2, f32 param_3"),
|
||||
0x8019FB0C:("func_8019FB0C","void","void"),
|
||||
0x8019FC20:("func_8019FC20","void","void"),
|
||||
0x8019FCB8:("func_8019FCB8","void","void"),
|
||||
@ -3980,8 +3980,8 @@
|
||||
0x801AA3E4:("func_801AA3E4","void","void"),
|
||||
0x801AA520:("func_801AA520","void","void"),
|
||||
0x801AA610:("func_801AA610","void","GlobalContext* ctxt"),
|
||||
0x801AA624:("func_801AA624","void","void"),
|
||||
0x801AA68C:("func_801AA68C","void","void"),
|
||||
0x801AA624:("func_801AA624","void","GlobalContext* ctxt"),
|
||||
0x801AA68C:("func_801AA68C","void","UNK_TYPE4 ctxt"),
|
||||
0x801AAAA0:("nop_801AAAA0","void","GlobalContext* ctxt"),
|
||||
0x80800000:("Title_UpdateCounters","void","TitleContext* ctxt"),
|
||||
0x8080009C:("Title_RenderView","void","TitleContext* ctxt, f32 eyeX, f32 eyeY, f32 eyeZ"),
|
||||
@ -11960,12 +11960,12 @@
|
||||
0x80ACB220:("func_80ACB220","void","void"),
|
||||
0x80ACB230:("func_80ACB230","void","void"),
|
||||
0x80ACB2B0:("func_80ACB2B0","void","void"),
|
||||
0x80ACB400:("func_80ACB400","void","void"),
|
||||
0x80ACB480:("func_80ACB480","void","void"),
|
||||
0x80ACB4B4:("func_80ACB4B4","void","void"),
|
||||
0x80ACB50C:("func_80ACB50C","void","void"),
|
||||
0x80ACB570:("func_80ACB570","void","void"),
|
||||
0x80ACB5A0:("func_80ACB5A0","void","void"),
|
||||
0x80ACB400:("BgFuKaiten_Init","void","ActorBgFuKaiten* this, GlobalContext* ctxt"),
|
||||
0x80ACB480:("BgFuKaiten_Fini","void","ActorBgFuKaiten* this, GlobalContext* ctxt"),
|
||||
0x80ACB4B4:("BgFuKaiten_UpdateRotation","void","ActorBgFuKaiten* this"),
|
||||
0x80ACB50C:("BgFuKaiten_UpdateHeight","void","ActorBgFuKaiten* this"),
|
||||
0x80ACB570:("BgFuKaiten_Main","void","ActorBgFuKaiten* this, GlobalContext* ctxt"),
|
||||
0x80ACB5A0:("BgFuKaiten_Draw","void","ActorBgFuKaiten* this, GlobalContext* ctxt"),
|
||||
0x80ACB6A0:("func_80ACB6A0","void","void"),
|
||||
0x80ACB7F4:("func_80ACB7F4","void","void"),
|
||||
0x80ACB940:("func_80ACB940","void","void"),
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Follows the format of Address:(Name, Type, Array Info)
|
||||
{
|
||||
0x04029CB0:("D_04029CB0","UNK_TYPE",""),
|
||||
0x04029CF0:("D_04029CF0","UNK_TYPE",""),
|
||||
0x060005D0:("D_060005D0","UNK_TYPE",""),
|
||||
0x06001100:("D_06001100","UNK_TYPE",""),
|
||||
0x06001228:("D_06001228","UNK_TYPE",""),
|
||||
0x06002D30:("D_06002D30","UNK_TYPE",""),
|
||||
}
|
@ -10929,6 +10929,7 @@
|
||||
0x80ACB3C0:("bgOpenSpotOverlayInfo","OverlayBlockSizes",""),
|
||||
0x80ACB3D4:("bgOpenSpotOverlayRelocations","u32","[7]"),
|
||||
0x80ACB3FC:("bgOpenSpotOverlayInfoOffset","u32",""),
|
||||
0x80ACB630:("bgFuKaitenInitData","ActorInitData",""),
|
||||
0x80ACB650:("D_80ACB650","f32",""),
|
||||
0x80ACB660:("bgFuKaitenOverlayInfo","OverlayBlockSizes",""),
|
||||
0x80ACB674:("bgFuKaitenOverlayRelocations","u32","[8]"),
|
||||
@ -13822,7 +13823,7 @@
|
||||
0x80BD5300:("bgIkanaBombwallOverlayInfo","OverlayBlockSizes",""),
|
||||
0x80BD5314:("bgIkanaBombwallOverlayRelocations","u32","[39]"),
|
||||
0x80BD53BC:("bgIkanaBombwallOverlayInfoOffset","u32",""),
|
||||
0x80BD55D0:("bgIkanaRayInitVar","ActorInitData",""),
|
||||
0x80BD55D0:("bgIkanaRayInitData","ActorInitData",""),
|
||||
0x80BD55F0:("D_80BD55F0","UNK_TYPE1",""),
|
||||
0x80BD561C:("bgIkanaRayCompInit","ActorInitVar","[4]"),
|
||||
0x80BD562C:("D_80BD562C","UNK_TYPE1",""),
|
||||
|
65
tools/overlay.py
Normal file
65
tools/overlay.py
Normal file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys, argparse
|
||||
|
||||
from elftools.elf.elffile import ELFFile
|
||||
from elftools.elf.relocation import RelocationSection
|
||||
|
||||
def get_section_type_from_name(name):
|
||||
if name == '.text':
|
||||
return 1
|
||||
elif name == '.data':
|
||||
return 2
|
||||
elif name == '.rodata':
|
||||
return 3
|
||||
elif name == '.bss': # TODO is this actually a thing? It doesn't fit in 2 bits and why would there be a relocation in .bss?
|
||||
return 4
|
||||
else:
|
||||
assert False, 'Unrecognized section for relocation: ' + name
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('input', help='Input object file to create overlay info', metavar='input')
|
||||
parser.add_argument('output', help='Overlay info output', metavar='output')
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.input, 'rb') as f, open(args.output, 'w') as out:
|
||||
elffile = ELFFile(f)
|
||||
|
||||
out.write('.section .ovl\n');
|
||||
|
||||
relocs = []
|
||||
for section in elffile.iter_sections():
|
||||
if isinstance(section, RelocationSection):
|
||||
symtab = elffile.get_section(section['sh_link'])
|
||||
for reloc in section.iter_relocations():
|
||||
symbol = symtab.get_symbol(reloc['r_info_sym'])
|
||||
if symbol.entry['st_shndx'] != 'SHN_UNDEF':
|
||||
section_id = get_section_type_from_name(section.name[4:])
|
||||
relocation_type = reloc['r_info_type']
|
||||
offset = reloc['r_offset']
|
||||
assert offset <= 0xFFFFFF, 'Object too big to convert into overlay'
|
||||
word = (section_id << 30) | (relocation_type << 24) | (offset)
|
||||
relocs.append(word)
|
||||
|
||||
text_section = elffile.get_section_by_name('.text')
|
||||
data_section = elffile.get_section_by_name('.data')
|
||||
rodata_section = elffile.get_section_by_name('.rodata')
|
||||
bss_section = elffile.get_section_by_name('.bss')
|
||||
|
||||
text_size = text_section.data_size if text_section is not None else 0
|
||||
data_size = data_section.data_size if data_section is not None else 0
|
||||
rodata_size = rodata_section.data_size if rodata_section is not None else 0
|
||||
bss_size = bss_section.data_size if bss_section is not None else 0
|
||||
|
||||
out.write('.word 0x{:08X}\n'.format(text_size));
|
||||
out.write('.word 0x{:08X}\n'.format(data_size));
|
||||
out.write('.word 0x{:08X}\n'.format(rodata_size));
|
||||
out.write('.word 0x{:08X}\n'.format(bss_size));
|
||||
out.write('.word 0x{:08X}\n'.format(len(relocs)));
|
||||
for reloc in relocs:
|
||||
out.write('.word 0x{:08X}\n'.format(reloc));
|
||||
offset = len(relocs) + 5
|
||||
while (offset % 4) != 3:
|
||||
out.write('.word 0\n');
|
||||
offset += 1
|
||||
out.write('.word 0x{:08X}\n'.format(offset*4 + 4));
|
Loading…
Reference in New Issue
Block a user