This commit is contained in:
CrashOveride95 committed 2021-07-13 11:40:46 -04:00
commit 3b6eb5b5e1
197 files changed
+7062 -5160

No files matched your search

+46
View File
@@ -1,3 +1,49 @@
Refresh 14
1.) Label whomp and some object fields (#1174)
2.) Generate MIO0 object files using binutils `ld` instead of `as` (#1173)
3.) Bowser documentation (#1166)
4.) Fix comment syntax in 00_sound_player.0 (#1172)
5.) Rename in-game menu variables (#1163)
6.) Document double red coin sound and JP sound glitch (#1170)
7.) Document different bug in external.c (#1168)
8.) updated names/types of octagonal platform data (#1164)
9.) Label a number of unnamed variables. (#1169)
10.) Document JP PU sound glitch (#1167)
11.) Set model ids to spawn_triangle_break_particles (#1165)
12.) Fix borders in clear_frame_buffer (#1162)
13.) Fix seq header files for 64-bit (#1161)
14.) Game_init.c remaining doc (#1158)
15.) Label a couple static variables in sound_init.c (#1159)
16.) Properly define dialog values (status, flags, cutscenes) (#1153)
17.) Label all of amp's assets. (#1018)
18.) Split audio/synthesis.c into Shindou/non-Shindou files (#1144)
19.) Avoid CC_CHECK warnings when using gcc (#1157)
20.) level_select_menu.c => title_screen.c (#1152)
21.) Use C preprocessor on assembly files (#1126)
22.) Replace output_level_headers.py with sed equivalent (#1109)
23.) Fix CC_CHECK warnings related to unused symbols and UB (#1155)
24.) Define remaining floor lower limit values (#1147)
25.) use r+b mode for libultra.a patch tool (#1148)
26.) Use proper values for gPrevFrameObjectCount ifs (#1146)
27.) Some minor bowser.inc.c labelling. (#1150)
28.) fix king bob-omb texture pointers (#1145)
29.) Split audio/load.c into Shindou/non-Shindou files (#1143)
30.) Small Shindou audio cleanups (#1142)
31.) Fix endians in ALSeqData (#1141)
32.) Document S8 decoder rsp operation and some more (#1139)
33.) Fix Shindou synthesis_process_note fake match (#1140)
34.) More audio documentation, for the new rsp code and other fixes (#1138)
35.) Build fixes for macOS: cpp, clang, recomp, aiff_extract_codebook (#1135)
36.) Add ENABLE_RUMBLE to config.h (#1122)
37.) Reduce recomp memory consumption by using smaller disassembly blocks (#1128)
38.) Makefile fixes (#1123)
39.) Update README.md
40.) Update README.md
41.) Reflect current decompilation status
42.) Allow both archives and ELF objects to be patched (#1127)
43.) Remove WIP mention in README for sh version.
Refresh 13 2
- No more nonmatchings remain for all builds including Shindou.
+6 -10
View File
@@ -504,7 +504,7 @@ $(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SO
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h
ifeq ($(VERSION),sh)
$(BUILD_DIR)/src/audio/load.o: $(SOUND_BIN_DIR)/bank_sets.inc.c $(SOUND_BIN_DIR)/sequences_header.inc.c $(SOUND_BIN_DIR)/ctl_header.inc.c $(SOUND_BIN_DIR)/tbl_header.inc.c
$(BUILD_DIR)/src/audio/load_sh.o: $(SOUND_BIN_DIR)/bank_sets.inc.c $(SOUND_BIN_DIR)/sequences_header.inc.c $(SOUND_BIN_DIR)/ctl_header.inc.c $(SOUND_BIN_DIR)/tbl_header.inc.c
endif
$(CRASH_TEXTURE_C_FILES): TEXTURE_ENCODING := u32
@@ -623,7 +623,7 @@ $(BUILD_DIR)/%.table: %.aiff
$(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@
$(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff
$(call print,Encoding VADPCM:,$<,$@)
$(call print,Encoding ADPCM:,$(word 2,$^),$@)
$(V)$(VADPCM_ENC) -c $^ $@
$(ENDIAN_BITWIDTH): $(TOOLS_DIR)/determine-endian-bitwidth.c
@@ -631,8 +631,8 @@ $(ENDIAN_BITWIDTH): $(TOOLS_DIR)/determine-endian-bitwidth.c
$(V)$(CC) -c $(CFLAGS) -o $@.dummy2 $< 2>$@.dummy1; true
$(V)grep -o 'msgbegin --endian .* --bitwidth .* msgend' $@.dummy1 > $@.dummy2
$(V)head -n1 <$@.dummy2 | cut -d' ' -f2-5 > $@
@$(RM) $@.dummy1
@$(RM) $@.dummy2
$(V)$(RM) $@.dummy1
$(V)$(RM) $@.dummy2
$(SOUND_BIN_DIR)/sound_data.ctl: sound/sound_banks/ $(SOUND_BANK_FILES) $(SOUND_SAMPLE_AIFCS) $(ENDIAN_BITWIDTH)
@$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n"
@@ -668,7 +668,7 @@ $(SOUND_BIN_DIR)/%.m64: $(SOUND_BIN_DIR)/%.o
# Convert binary file to a comma-separated list of byte values for inclusion in C code
$(BUILD_DIR)/%.inc.c: $(BUILD_DIR)/%
$(call print,Piping:,$<,$@)
$(call print,Converting to C:,$<,$@)
$(V)hexdump -v -e '1/1 "0x%X,"' $< > $@
$(V)echo >> $@
@@ -699,7 +699,7 @@ $(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h t
# Level headers
$(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in
$(call print,Preprocessing level headers:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I . levels/level_headers.h.in | $(PYTHON) $(TOOLS_DIR)/output_level_headers.py > $(BUILD_DIR)/include/level_headers.h
$(V)$(CPP) $(CPPFLAGS) -I . $< | sed -E 's|(.+)|#include "\1"|' > $@
# Generate version_data.h
$(BUILD_DIR)/src/game/version_data.h: tools/make_version.sh
@@ -723,10 +723,6 @@ $(BUILD_DIR)/%.o: %.s
$(call print,Assembling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(foreach i,$(INCLUDE_DIRS),-Wa,-I$(i)) -x assembler-with-cpp -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
$(BUILD_DIR)/sound/sequences/00_sound_player.o: sound/sequences/00_sound_player.s
$(call print,Assembling:,$<,$@)
$(V)$(AS) $(ASFLAGS) -MD $(BUILD_DIR)/sound/sequences/00_sound_player.d -o $@ $<
# Assemble RSP assembly code
$(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s
$(call print,Assembling:,$<,$@)
+8 -8
View File
@@ -161,8 +161,8 @@ endef
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
$(BUILD_DIR)/level_rules.mk: levels/level_rules.mk levels/level_defines.h
@$(PRINT) "$(GREEN)Preprocessing level make rules: $(BLUE)$@ $(NO_COL)\n"
@$(CPP) $(VERSION_CFLAGS) -I . -o $@ $<
$(call print,Preprocessing level make rules:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) $(VERSION_CFLAGS) -I . -o $@ $<
include $(BUILD_DIR)/level_rules.mk
endif
endif
@@ -179,11 +179,11 @@ $(eval $(call level_rules,menu,generic)) # Menu (File Select)
# Ending cake textures are generated in a special way
$(BUILD_DIR)/levels/ending/cake_eu.inc.c: levels/ending/cake_eu.png
@$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n"
@$(SKYCONV) --type cake-eu --split $^ $(BUILD_DIR)/levels/ending
$(call print,Splitting:,$<,$@)
$(V)$(SKYCONV) --type cake-eu --split $^ $(BUILD_DIR)/levels/ending
$(BUILD_DIR)/levels/ending/cake.inc.c: levels/ending/cake.png
@$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n"
@$(SKYCONV) --type cake --split $^ $(BUILD_DIR)/levels/ending
$(call print,Splitting:,$<,$@)
$(V)$(SKYCONV) --type cake --split $^ $(BUILD_DIR)/levels/ending
# --------------------------------------
# Texture Bin Rules
@@ -250,8 +250,8 @@ $(BUILD_DIR)/bin/eu/translation_fr.elf: SEGMENT_ADDRESS := 0x19000000
# --------------------------------------
$(BUILD_DIR)/bin/%_skybox.c: textures/skyboxes/%.png
@$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n"
@$(SKYCONV) --type sky --split $^ $(BUILD_DIR)/bin
$(call print,Splitting:,$<,$@)
$(V)$(SKYCONV) --type sky --split $^ $(BUILD_DIR)/bin
$(BUILD_DIR)/bin/%_skybox.elf: SEGMENT_ADDRESS := 0x0A000000
@@ -1,5 +1,4 @@
// 0x08003E30
static const s16 amp_seg8_animvalue_08003E30[] = {
static const s16 dAmpAnimValue[] = {
0x0000, 0x0000, 0x0D79, 0x1AF2, 0x286B, 0x35E4, 0x435D, 0x50D6,
0x5E50, 0x6BC9, 0x7942, 0x86BE, 0x9437, 0xA1B0, 0xAF2A, 0xBCA3,
0xCA1C, 0xD795, 0xE50E, 0xF287, 0x1872, 0x0000, 0x1AF2, 0x35E4,
@@ -23,8 +22,7 @@ static const s16 amp_seg8_animvalue_08003E30[] = {
0xC001, 0x3FFF,
};
// 0x08003F74
static const u16 amp_seg8_animindex_08003F74[] = {
static const u16 dAmpAnimIndex[] = {
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x00A1,
0x0001, 0x0000, 0x0013, 0x008D, 0x0001, 0x00A0,
@@ -40,15 +38,14 @@ static const u16 amp_seg8_animindex_08003F74[] = {
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x004E,
};
// 0x0800401C
static const struct Animation amp_seg8_anim_0800401C = {
static const struct Animation dAmpAnimation = {
0,
0,
0,
0,
0x13,
ANIMINDEX_NUMPARTS(amp_seg8_animindex_08003F74),
amp_seg8_animvalue_08003E30,
amp_seg8_animindex_08003F74,
ANIMINDEX_NUMPARTS(dAmpAnimIndex),
dAmpAnimValue,
dAmpAnimIndex,
0,
};
+1 -1
View File
@@ -1 +1 @@
#include "anim_0800401C.inc.c"
#include "animation.inc.c"
+2 -3
View File
@@ -1,4 +1,3 @@
// 0x08004034
const struct Animation *const amp_seg8_anims_08004034[] = {
&amp_seg8_anim_0800401C,
const struct Animation *const dAmpAnimsList[] = {
&dAmpAnimation,
};
+8 -9
View File
@@ -1,19 +1,18 @@
// 0x0F000028
const GeoLayout amp_geo[] = {
const GeoLayout dAmpGeo[] = {
GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0xC8, 100),
GEO_OPEN_NODE(),
GEO_SCALE(0x00, 16384),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, amp_seg8_dl_08002C88),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, dAmpEyeDl),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_OPEN_NODE(),
GEO_SWITCH_CASE(2, geo_switch_anim_state),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, amp_seg8_dl_08002BA0),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, dAmpElectricityDl),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
@@ -21,7 +20,7 @@ const GeoLayout amp_geo[] = {
GEO_SWITCH_CASE(2, geo_switch_anim_state),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, amp_seg8_dl_08002BA0),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, dAmpElectricityDl),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
@@ -29,7 +28,7 @@ const GeoLayout amp_geo[] = {
GEO_SWITCH_CASE(2, geo_switch_anim_state),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, amp_seg8_dl_08002BA0),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, dAmpElectricityDl),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
@@ -37,16 +36,16 @@ const GeoLayout amp_geo[] = {
GEO_SWITCH_CASE(2, geo_switch_anim_state),
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, amp_seg8_dl_08002BA0),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, dAmpElectricityDl),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, amp_seg8_dl_08002D70),
GEO_ANIMATED_PART(LAYER_ALPHA, 0, 0, 0, dAmpMouthDl),
GEO_ANIMATED_PART(LAYER_OPAQUE, 0, 0, 0, NULL),
GEO_OPEN_NODE(),
GEO_BILLBOARD(),
GEO_OPEN_NODE(),
GEO_DISPLAY_LIST(LAYER_ALPHA, amp_seg8_dl_08002E58),
GEO_DISPLAY_LIST(LAYER_ALPHA, dAmpBodyDl),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
+93 -124
View File
@@ -1,27 +1,22 @@
// Amp
// 0x08000F18
ALIGNED8 static const Texture amp_seg8_texture_08000F18[] = {
ALIGNED8 static const Texture dAmpElectricityTexture[] = {
#include "actors/amp/amp_electricity.rgba16.inc.c"
};
// 0x08001318
ALIGNED8 static const Texture amp_seg8_texture_08001318[] = {
ALIGNED8 static const Texture dAmpEyesTexture[] = {
#include "actors/amp/amp_eyes.rgba16.inc.c"
};
// 0x08001B18
ALIGNED8 static const Texture amp_seg8_texture_08001B18[] = {
ALIGNED8 static const Texture dAmpBodyTexture[] = {
#include "actors/amp/amp_body.rgba16.inc.c"
};
// 0x08002318
ALIGNED8 static const Texture amp_seg8_texture_08002318[] = {
ALIGNED8 static const Texture dAmpMouthTexture[] = {
#include "actors/amp/amp_mouth.rgba16.inc.c"
};
// 0x08002B18
static const Vtx amp_seg8_vertex_08002B18[] = {
static const Vtx dAmpElectricityVertices[] = {
{{{ 224, 0, -89}, 0, { 0, 480}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 187, 149, 0}, 0, { 223, 1078}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 224, 0, 90}, 0, { 479, 478}, {0xff, 0xff, 0xff, 0xff}}},
@@ -29,18 +24,16 @@ static const Vtx amp_seg8_vertex_08002B18[] = {
{{{ 224, 0, -89}, 0, { 0, 478}, {0xff, 0xff, 0xff, 0xff}}},
};
// 0x08002B68 - 0x08002BA0
const Gfx amp_seg8_dl_08002B68[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, amp_seg8_texture_08000F18),
const Gfx dAmpElectricitySubDl[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dAmpElectricityTexture),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 16 * 32 - 1, CALC_DXT(16, G_IM_SIZ_16b_BYTES)),
gsSPVertex(amp_seg8_vertex_08002B18, 5, 0),
gsSPVertex(dAmpElectricityVertices, 5, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 2, 3, 4, 0x0),
gsSPEndDisplayList(),
};
// 0x08002BA0 - 0x08002C10
const Gfx amp_seg8_dl_08002BA0[] = {
const Gfx dAmpElectricityDl[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING | G_CULL_BACK),
@@ -49,7 +42,7 @@ const Gfx amp_seg8_dl_08002BA0[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 4, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (16 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(amp_seg8_dl_08002B68),
gsSPDisplayList(dAmpElectricitySubDl),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@@ -57,26 +50,23 @@ const Gfx amp_seg8_dl_08002BA0[] = {
gsSPEndDisplayList(),
};
// 0x08002C10
static const Vtx amp_seg8_vertex_08002C10[] = {
static const Vtx dAmpEyeVertices[] = {
{{{ 68, 72, 158}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -27, -71, 164}, 0, { 990, 990}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 68, -71, 158}, 0, { 990, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -27, 72, 164}, 0, { 0, 990}, {0xff, 0xff, 0xff, 0xff}}},
};
// 0x08002C50 - 0x08002C88
const Gfx amp_seg8_dl_08002C50[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, amp_seg8_texture_08001318),
const Gfx dAmpEyeSubDl[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dAmpEyesTexture),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsSPVertex(amp_seg8_vertex_08002C10, 4, 0),
gsSPVertex(dAmpEyeVertices, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSPEndDisplayList(),
};
// 0x08002C88 - 0x08002CF8
const Gfx amp_seg8_dl_08002C88[] = {
const Gfx dAmpEyeDl[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING),
@@ -85,7 +75,7 @@ const Gfx amp_seg8_dl_08002C88[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(amp_seg8_dl_08002C50),
gsSPDisplayList(dAmpEyeSubDl),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@@ -93,26 +83,23 @@ const Gfx amp_seg8_dl_08002C88[] = {
gsSPEndDisplayList(),
};
// 0x08002CF8
static const Vtx amp_seg8_vertex_08002CF8[] = {
static const Vtx dAmpMouthVertices[] = {
{{{ -29, 72, 164}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -124, -71, 121}, 0, { 990, 990}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -29, -71, 164}, 0, { 990, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -124, 72, 121}, 0, { 0, 990}, {0xff, 0xff, 0xff, 0xff}}},
};
// 0x08002D38 - 0x08002D70
const Gfx amp_seg8_dl_08002D38[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, amp_seg8_texture_08002318),
const Gfx dAmpMouthSubDl[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dAmpMouthTexture),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsSPVertex(amp_seg8_vertex_08002CF8, 4, 0),
gsSPVertex(dAmpMouthVertices, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSPEndDisplayList(),
};
// 0x08002D70 - 0x08002DE0
const Gfx amp_seg8_dl_08002D70[] = {
const Gfx dAmpMouthDl[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING),
@@ -121,7 +108,7 @@ const Gfx amp_seg8_dl_08002D70[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(amp_seg8_dl_08002D38),
gsSPDisplayList(dAmpMouthSubDl),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@@ -129,26 +116,23 @@ const Gfx amp_seg8_dl_08002D70[] = {
gsSPEndDisplayList(),
};
// 0x08002DE0
static const Vtx amp_seg8_vertex_08002DE0[] = {
static const Vtx dAmpBodyVertices[] = {
{{{ -39, -39, 0}, 0, { 0, 990}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 40, 40, 0}, 0, { 990, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -39, 40, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 40, -39, 0}, 0, { 990, 990}, {0xff, 0xff, 0xff, 0xff}}},
};
// 0x08002E20 - 0x08002E58
const Gfx amp_seg8_dl_08002E20[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, amp_seg8_texture_08001B18),
const Gfx dAmpBodySubDl[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dAmpBodyTexture),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsSPVertex(amp_seg8_vertex_08002DE0, 4, 0),
gsSPVertex(dAmpBodyVertices, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSPEndDisplayList(),
};
// 0x08002E58 - 0x08002EC8
const Gfx amp_seg8_dl_08002E58[] = {
const Gfx dAmpBodyDl[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
gsSPClearGeometryMode(G_LIGHTING),
@@ -157,7 +141,7 @@ const Gfx amp_seg8_dl_08002E58[] = {
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_CLAMP, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(amp_seg8_dl_08002E20),
gsSPDisplayList(dAmpBodySubDl),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
@@ -165,15 +149,18 @@ const Gfx amp_seg8_dl_08002E58[] = {
gsSPEndDisplayList(),
};
// 0x08002EC8
static const Lights1 amp_seg8_lights_08002EC8 = gdSPDefLights1(
/**
* Everything beyond this point is unused, and seems to be an attempt at a 3D modelled
* amp. The model and attempt are overall slightly buggy, with misread lights and a slightly
* broken model.
*/
UNUSED static const Lights1 dAmpUnused3DLights = gdSPDefLights1(
0x33, 0x3f, 0x00,
0xcf, 0xff, 0x00, 0x28, 0x28, 0x28
);
// //! Another malformed entry: Vertex interpreted as light
// 0x08002EE0
static const Vtx amp_seg8_vertex_08002EE0[] = {
UNUSED static const Vtx dAmpUnused3DVtx01[] = {
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
{{{ 240, -160, 0}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
{{{ 280, 0, -35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
@@ -182,8 +169,7 @@ static const Vtx amp_seg8_vertex_08002EE0[] = {
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0x1e, 0x00, 0xff}}},
};
// 0x08002F40
static const Vtx amp_seg8_vertex_08002F40[] = {
UNUSED static const Vtx dAmpUnused3DVtx02[] = {
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
{{{ 240, -160, 0}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
{{{ 280, 0, -35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
@@ -192,8 +178,7 @@ static const Vtx amp_seg8_vertex_08002F40[] = {
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0x1e, 0x00, 0xff}}},
};
// 0x08002FA0
static const Vtx amp_seg8_vertex_08002FA0[] = {
UNUSED static const Vtx dAmpUnused3DVtx03[] = {
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
{{{ 240, -160, 0}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
{{{ 280, 0, -35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0x00}}},
@@ -202,8 +187,7 @@ static const Vtx amp_seg8_vertex_08002FA0[] = {
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0x1e, 0x00, 0xff}}},
};
// 0x08003000
static const Vtx amp_seg8_vertex_08003000[] = {
UNUSED static const Vtx dAmpUnused3DVtx04[] = {
{{{ 280, 0, -35}, 0, { 0, 0}, {0x7b, 0x1e, 0x00, 0x00}}},
{{{ 240, 160, 0}, 0, { 0, 0}, {0x7b, 0x1e, 0x00, 0x00}}},
{{{ 280, 0, 35}, 0, { 0, 0}, {0x7b, 0x1e, 0x00, 0x00}}},
@@ -212,8 +196,7 @@ static const Vtx amp_seg8_vertex_08003000[] = {
{{{ 280, 0, -35}, 0, { 0, 0}, {0x7b, 0xe2, 0x00, 0xff}}},
};
// 0x08003060
static const Vtx amp_seg8_vertex_08003060[] = {
UNUSED static const Vtx dAmpUnused3DVtx05[] = {
{{{ -184, -54, -54}, 0, { 0, 0}, {0x8b, 0xde, 0xde, 0x00}}},
{{{ -184, -76, 0}, 0, { 0, 0}, {0x8b, 0xd0, 0x00, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -232,8 +215,7 @@ static const Vtx amp_seg8_vertex_08003060[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003160
static const Vtx amp_seg8_vertex_08003160[] = {
UNUSED static const Vtx dAmpUnused3DVtx06[] = {
{{{ -184, 0, -76}, 0, { 0, 0}, {0x8b, 0x00, 0xd0, 0xff}}},
{{{ -184, -54, -54}, 0, { 0, 0}, {0x8b, 0xde, 0xde, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -252,8 +234,7 @@ static const Vtx amp_seg8_vertex_08003160[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003260
static const Vtx amp_seg8_vertex_08003260[] = {
UNUSED static const Vtx dAmpUnused3DVtx07[] = {
{{{ -184, 54, -54}, 0, { 0, 0}, {0x8b, 0x22, 0xde, 0xff}}},
{{{ -184, 0, -76}, 0, { 0, 0}, {0x8b, 0x00, 0xd0, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -272,8 +253,7 @@ static const Vtx amp_seg8_vertex_08003260[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003360
static const Vtx amp_seg8_vertex_08003360[] = {
UNUSED static const Vtx dAmpUnused3DVtx08[] = {
{{{ -184, 76, 0}, 0, { 0, 0}, {0x8b, 0x30, 0x00, 0xff}}},
{{{ -184, 54, -54}, 0, { 0, 0}, {0x8b, 0x22, 0xde, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -292,8 +272,7 @@ static const Vtx amp_seg8_vertex_08003360[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003460
static const Vtx amp_seg8_vertex_08003460[] = {
UNUSED static const Vtx dAmpUnused3DVtx09[] = {
{{{ -184, 54, 54}, 0, { 0, 0}, {0x8b, 0x22, 0x22, 0xff}}},
{{{ -184, 76, 0}, 0, { 0, 0}, {0x8b, 0x30, 0x00, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -312,8 +291,7 @@ static const Vtx amp_seg8_vertex_08003460[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003560
static const Vtx amp_seg8_vertex_08003560[] = {
UNUSED static const Vtx dAmpUnused3DVtx10[] = {
{{{ -184, 0, 76}, 0, { 0, 0}, {0x8b, 0x00, 0x30, 0xff}}},
{{{ -184, 54, 54}, 0, { 0, 0}, {0x8b, 0x22, 0x22, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -332,8 +310,7 @@ static const Vtx amp_seg8_vertex_08003560[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003660
static const Vtx amp_seg8_vertex_08003660[] = {
UNUSED static const Vtx dAmpUnused3DVtx11[] = {
{{{ -184, -54, 54}, 0, { 0, 0}, {0x8b, 0xde, 0x22, 0xff}}},
{{{ -184, 0, 76}, 0, { 0, 0}, {0x8b, 0x00, 0x30, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -352,8 +329,7 @@ static const Vtx amp_seg8_vertex_08003660[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003760
static const Vtx amp_seg8_vertex_08003760[] = {
UNUSED static const Vtx dAmpUnused3DVtx12[] = {
{{{ -184, -76, 0}, 0, { 0, 0}, {0x8b, 0xd0, 0x00, 0xff}}},
{{{ -184, -54, 54}, 0, { 0, 0}, {0x8b, 0xde, 0x22, 0x00}}},
{{{ -200, 0, 0}, 0, { 0, 0}, {0x81, 0x00, 0x00, 0x00}}},
@@ -372,70 +348,63 @@ static const Vtx amp_seg8_vertex_08003760[] = {
{{{ 200, 0, 0}, 0, { 0, 0}, {0x7f, 0x00, 0x00, 0xff}}},
};
// 0x08003860
static const Vtx amp_seg8_vertex_08003860[] = {
UNUSED static const Vtx dAmpUnused3DVtx13[] = {
{{{ -37, 90, 205}, 0, { 0, 0}, {0xcc, 0x00, 0x73, 0x00}}},
{{{ -129, 90, 163}, 0, { 0, 0}, {0xcc, 0x00, 0x73, 0x00}}},
{{{ -129, -90, 163}, 0, { 0, 0}, {0xcc, 0x00, 0x73, 0x00}}},
{{{ -37, -90, 205}, 0, { 0, 0}, {0xcc, 0x00, 0x73, 0xff}}},
};
// 0x080038A0
static const Vtx amp_seg8_vertex_080038A0[] = {
UNUSED static const Vtx dAmpUnused3DVtx14[] = {
{{{ 112, -7, 182}, 0, { 0, 0}, {0x4c, 0xd8, 0x5c, 0x00}}},
{{{ 66, -139, 162}, 0, { 0, 0}, {0x4c, 0xd8, 0x5c, 0x00}}},
{{{ 175, -77, 98}, 0, { 0, 0}, {0x4c, 0xd8, 0x5c, 0x00}}},
};
// 0x080038D0
static const Vtx amp_seg8_vertex_080038D0[] = {
UNUSED static const Vtx dAmpUnused3DVtx15[] = {
{{{ 63, 90, 198}, 0, { 0, 0}, {0x08, 0x00, 0x7e, 0x00}}},
{{{ -35, 90, 205}, 0, { 0, 0}, {0x08, 0x00, 0x7e, 0x00}}},
{{{ -35, -90, 205}, 0, { 0, 0}, {0x08, 0x00, 0x7e, 0x00}}},
{{{ 63, -90, 198}, 0, { 0, 0}, {0x08, 0x00, 0x7e, 0xff}}},
};
// 0x08003910 - 0x08003940
const Gfx amp_seg8_dl_08003910[] = {
gsSPLight(&amp_seg8_lights_08002EC8.l, 1),
gsSPLight(&amp_seg8_lights_08002EC8.a, 2),
gsSPVertex(amp_seg8_vertex_08002EE0, 6, 0),
UNUSED const Gfx dAmpUnused3DElectricDl1[] = {
gsSPLight(&dAmpUnused3DLights.l, 1),
gsSPLight(&dAmpUnused3DLights.a, 2),
gsSPVertex(dAmpUnused3DVtx01, 6, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSPEndDisplayList(),
};
// 0x08003940 - 0x08003970
const Gfx amp_seg8_dl_08003940[] = {
gsSPLight(&amp_seg8_lights_08002EC8.l, 1),
gsSPLight(&amp_seg8_lights_08002EC8.a, 2),
gsSPVertex(amp_seg8_vertex_08002F40, 6, 0),
UNUSED const Gfx dAmpUnused3DElectricDl2[] = {
gsSPLight(&dAmpUnused3DLights.l, 1),
gsSPLight(&dAmpUnused3DLights.a, 2),
gsSPVertex(dAmpUnused3DVtx02, 6, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSPEndDisplayList(),
};
// 0x08003970 - 0x080039A0
const Gfx amp_seg8_dl_08003970[] = {
gsSPLight(&amp_seg8_lights_08002EC8.l, 1),
gsSPLight(&amp_seg8_lights_08002EC8.a, 2),
gsSPVertex(amp_seg8_vertex_08002FA0, 6, 0),
UNUSED const Gfx dAmpUnused3DElectricDl3[] = {
gsSPLight(&dAmpUnused3DLights.l, 1),
gsSPLight(&dAmpUnused3DLights.a, 2),
gsSPVertex(dAmpUnused3DVtx03, 6, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSPEndDisplayList(),
};
// 0x080039A0 - 0x080039D0
const Gfx amp_seg8_dl_080039A0[] = {
gsSPLight(&amp_seg8_lights_08002EC8.l, 1),
gsSPLight(&amp_seg8_lights_08002EC8.a, 2),
gsSPVertex(amp_seg8_vertex_08003000, 6, 0),
UNUSED const Gfx dAmpUnused3DElectricDl4[] = {
gsSPLight(&dAmpUnused3DLights.l, 1),
gsSPLight(&dAmpUnused3DLights.a, 2),
gsSPVertex(dAmpUnused3DVtx04, 6, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSPEndDisplayList(),
};
// 0x080039D0 - 0x08003DA8
const Gfx amp_seg8_dl_080039D0[] = {
gsSPLight((const u8*)amp_seg8_vertex_08002EE0 + 0x8, 1),
gsSPLight((const u8*)amp_seg8_vertex_08002EE0, 2),
gsSPVertex(amp_seg8_vertex_08003060, 16, 0),
UNUSED const Gfx dAmpUnused3DModelDl[] = {
//! Vertex interpreted as light
gsSPLight((const u8*)dAmpUnused3DVtx01 + 0x8, 1),
gsSPLight((const u8*)dAmpUnused3DVtx01, 2),
gsSPVertex(dAmpUnused3DVtx05, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -443,7 +412,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003160, 16, 0),
gsSPVertex(dAmpUnused3DVtx06, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -451,7 +420,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003260, 16, 0),
gsSPVertex(dAmpUnused3DVtx07, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -459,7 +428,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003360, 16, 0),
gsSPVertex(dAmpUnused3DVtx08, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -467,7 +436,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003460, 16, 0),
gsSPVertex(dAmpUnused3DVtx09, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -475,7 +444,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003560, 16, 0),
gsSPVertex(dAmpUnused3DVtx10, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -483,7 +452,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003660, 16, 0),
gsSPVertex(dAmpUnused3DVtx11, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -491,7 +460,7 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSP2Triangles( 8, 9, 10, 0x0, 10, 9, 11, 0x0),
gsSP2Triangles(10, 11, 12, 0x0, 12, 11, 13, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 14, 13, 15, 0x0),
gsSPVertex(amp_seg8_vertex_08003760, 16, 0),
gsSPVertex(dAmpUnused3DVtx12, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 1, 0, 3, 0x0),
gsSP2Triangles( 1, 3, 4, 0x0, 4, 3, 5, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 6, 5, 7, 0x0),
@@ -502,29 +471,29 @@ const Gfx amp_seg8_dl_080039D0[] = {
gsSPEndDisplayList(),
};
// 0x08003DA8 - 0x08003DD8
const Gfx amp_seg8_dl_08003DA8[] = {
gsSPLight((const u8*)amp_seg8_vertex_08002EE0 + 0x8, 1),
gsSPLight((const u8*)amp_seg8_vertex_08002EE0, 2),
gsSPVertex(amp_seg8_vertex_08003860, 4, 0),
UNUSED const Gfx dAmpUnused3DElectricDl5[] = {
//! Vertex interpreted as light
gsSPLight((const u8*)dAmpUnused3DVtx01 + 0x8, 1),
gsSPLight((const u8*)dAmpUnused3DVtx01, 2),
gsSPVertex(dAmpUnused3DVtx13, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
// 0x08003DD8 - 0x08003E00
const Gfx amp_seg8_dl_08003DD8[] = {
gsSPLight((const u8*)amp_seg8_vertex_08002EE0 + 0x8, 1),
gsSPLight((const u8*)amp_seg8_vertex_08002EE0, 2),
gsSPVertex(amp_seg8_vertex_080038A0, 3, 0),
UNUSED const Gfx dAmpUnused3DElectricDl6[] = {
//! Vertex interpreted as light
gsSPLight((const u8*)dAmpUnused3DVtx01 + 0x8, 1),
gsSPLight((const u8*)dAmpUnused3DVtx01, 2),
gsSPVertex(dAmpUnused3DVtx14, 3, 0),
gsSP1Triangle( 0, 1, 2, 0x0),
gsSPEndDisplayList(),
};
// 0x08003E00 - 0x08003E30
const Gfx amp_seg8_dl_08003E00[] = {
gsSPLight((const u8*)amp_seg8_vertex_08002EE0 + 0x8, 1),
gsSPLight((const u8*)amp_seg8_vertex_08002EE0, 2),
gsSPVertex(amp_seg8_vertex_080038D0, 4, 0),
UNUSED const Gfx dAmpUnused3DElectricDl7[] = {
//! Vertex interpreted as light
gsSPLight((const u8*)dAmpUnused3DVtx01 + 0x8, 1),
gsSPLight((const u8*)dAmpUnused3DVtx01, 2),
gsSPVertex(dAmpUnused3DVtx15, 4, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0),
gsSPEndDisplayList(),
};
+98
View File
@@ -0,0 +1,98 @@
// 0x060576FC
const s16 dBowserFlamesOrientationValues[] = {
// posX, posY, posZ, rotY, rotX
0, 280, 80, 0x00E9, 0x1A96,
0, 278, 83, 0x00EC, 0x1C7F,
0, 273, 92, 0x00F9, 0x20BF,
0, 268, 102, 0x010F, 0x2519,
0, 263, 109, 0x011D, 0x2751,
0, 263, 110, 0x011C, 0x2714,
0, 265, 106, 0x0112, 0x2601,
0, 268, 102, 0x0109, 0x24C0,
0, 271, 96, 0x00FF, 0x2358,
0, 274, 90, 0x00F7, 0x21CB,
0, 277, 84, 0x00EE, 0x201C,
0, 280, 78, 0x00E7, 0x1E4E,
0, 284, 71, 0x00DF, 0x1C64,
0, 288, 63, 0x00D9, 0x1A61,
0, 291, 56, 0x00D3, 0x184B,
0, 295, 48, 0x00CF, 0x1622,
0, 298, 40, 0x00CA, 0x13E9,
0, 301, 32, 0x00C7, 0x11A5,
0, 304, 23, 0x00C4, 0x0F59,
0, 308, 15, 0x00C1, 0x0D08,
0, 311, 7, 0x00C0, 0x0AB5,
0, 313, 0, 0x00C0, 0x0863,
0, 315, -8, 0x00BF, 0x0615,
0, 317, -15, 0x00CE, 0x03A3,
0, 319, -22, 0x00F8, 0x00ED,
0, 320, -29, 0x0131, 0xFFFF,
0, 322, -36, 0x0172, 0xFFFF,
0, 322, -40, 0x01B5, 0xFFFF,
0, 323, -45, 0x01ED, 0xFFFF,
0, 323, -48, 0x0213, 0xFFFF,
0, 323, -51, 0x0219, 0xFFFF,
0, 323, -52, 0x01F2, 0xFFFF,
0, 323, -51, 0x018F, 0xFFFF,
0, 323, -49, 0x00E5, 0xFFFF,
0, 322, -45, 0xFFFF, 0xFFFF,
0, 320, -35, 0xFFFF, 0xFFFF,
0, 317, -23, 0xFFFF, 0xFFFF,
0, 312, -7, 0xFFFF, 0xFFFF,
0, 306, 11, 0xFFFF, 0xFFFF,
0, 299, 31, 0xFFFF, 0xFFFF,
0, 288, 51, 0xFFFF, 0xFFFF,
0, 278, 70, 0xFFFF, 0xFFFF,
0, 267, 89, 0xFFFF, 0xFFFF,
0, 256, 106, 0xFFFF, 0x023A,
0, 244, 120, 0xFFFF, 0x04AA,
0, 236, 132, 0xFFFF, 0x069F,
0, 229, 139, 0xFFFF, 0x0803,
0, 224, 144, 0xFFFF, 0x08C0,
0, 222, 147, 0xFFFF, 0x0928,
0, 221, 148, 0xFFFF, 0x099D,
0, 221, 149, 0xFFFF, 0x0A16,
0, 221, 150, 0xFFFF, 0x0A8D,
0, 221, 150, 0xFFFF, 0x0AF6,
0, 222, 150, 0xFFFF, 0x0B4A,
0, 222, 150, 0xFFFF, 0x0B84,
0, 222, 149, 0x020A, 0x0BA0,
0, 223, 149, 0x0524, 0x0B9E,
0, 225, 148, 0x07EC, 0x0B84,
0, 226, 147, 0x0A3F, 0x0B57,
0, 227, 145, 0x0BFB, 0x0B1F,
0, 228, 144, 0x0D00, 0x0AE5,
0, 230, 142, 0x0D6F, 0x0AA0,
0, 232, 140, 0x0D8B, 0x0A48,
0, 233, 138, 0x0D5D, 0x09DE,
0, 236, 136, 0x0CED, 0x096A,
0, 238, 134, 0x0C49, 0x08EA,
0, 239, 132, 0x0B76, 0x0863,
0, 241, 130, 0x0A80, 0x07D9,
0, 244, 128, 0x0970, 0x074E,
0, 246, 125, 0x084E, 0x06C7,
0, 248, 122, 0x0723, 0x0649,
0, 251, 120, 0x05F8, 0x05D7,
0, 253, 117, 0x04D6, 0x0579,
0, 254, 114, 0x03C3, 0x0532,
0, 256, 111, 0x02C9, 0x0509,
0, 259, 108, 0x01F0, 0x0504,
0, 261, 105, 0x0141, 0x0525,
0, 262, 103, 0x00C3, 0x0572,
0, 264, 100, 0x006E, 0x0619,
0, 267, 97, 0x0032, 0x0734,
0, 268, 95, 0x000C, 0x08AF,
0, 269, 93, 0xFFFF, 0x0A74,
0, 272, 90, 0xFFFF, 0x0C70,
0, 273, 88, 0xFFFF, 0x0E8E,
0, 274, 86, 0x0014, 0x10B6,
0, 275, 84, 0x0032, 0x12DA,
0, 277, 82, 0x0056, 0x14E1,
0, 277, 82, 0x007E, 0x16B9,
0, 278, 80, 0x00A4, 0x184B,
0, 278, 80, 0x00C6, 0x1983,
0, 279, 80, 0x00DF, 0x1A4D,
0, 280, 80, 0x00E9, 0x1A96,
0, 0, 0, 0x0000, 0x0000,
};
-96
View File
@@ -1,96 +0,0 @@
// 0x060576FC
const s16 bowser_seg6_unkmoveshorts_060576FC[] = {
0x0000, 0x0118, 0x0050, 0x00E9, 0x1A96,
0x0000, 0x0116, 0x0053, 0x00EC, 0x1C7F,
0x0000, 0x0111, 0x005C, 0x00F9, 0x20BF,
0x0000, 0x010C, 0x0066, 0x010F, 0x2519,
0x0000, 0x0107, 0x006D, 0x011D, 0x2751,
0x0000, 0x0107, 0x006E, 0x011C, 0x2714,
0x0000, 0x0109, 0x006A, 0x0112, 0x2601,
0x0000, 0x010C, 0x0066, 0x0109, 0x24C0,
0x0000, 0x010F, 0x0060, 0x00FF, 0x2358,
0x0000, 0x0112, 0x005A, 0x00F7, 0x21CB,
0x0000, 0x0115, 0x0054, 0x00EE, 0x201C,
0x0000, 0x0118, 0x004E, 0x00E7, 0x1E4E,
0x0000, 0x011C, 0x0047, 0x00DF, 0x1C64,
0x0000, 0x0120, 0x003F, 0x00D9, 0x1A61,
0x0000, 0x0123, 0x0038, 0x00D3, 0x184B,
0x0000, 0x0127, 0x0030, 0x00CF, 0x1622,
0x0000, 0x012A, 0x0028, 0x00CA, 0x13E9,
0x0000, 0x012D, 0x0020, 0x00C7, 0x11A5,
0x0000, 0x0130, 0x0017, 0x00C4, 0x0F59,
0x0000, 0x0134, 0x000F, 0x00C1, 0x0D08,
0x0000, 0x0137, 0x0007, 0x00C0, 0x0AB5,
0x0000, 0x0139, 0x0000, 0x00C0, 0x0863,
0x0000, 0x013B, 0xFFF8, 0x00BF, 0x0615,
0x0000, 0x013D, 0xFFF1, 0x00CE, 0x03A3,
0x0000, 0x013F, 0xFFEA, 0x00F8, 0x00ED,
0x0000, 0x0140, 0xFFE3, 0x0131, 0xFFFF,
0x0000, 0x0142, 0xFFDC, 0x0172, 0xFFFF,
0x0000, 0x0142, 0xFFD8, 0x01B5, 0xFFFF,
0x0000, 0x0143, 0xFFD3, 0x01ED, 0xFFFF,
0x0000, 0x0143, 0xFFD0, 0x0213, 0xFFFF,
0x0000, 0x0143, 0xFFCD, 0x0219, 0xFFFF,
0x0000, 0x0143, 0xFFCC, 0x01F2, 0xFFFF,
0x0000, 0x0143, 0xFFCD, 0x018F, 0xFFFF,
0x0000, 0x0143, 0xFFCF, 0x00E5, 0xFFFF,
0x0000, 0x0142, 0xFFD3, 0xFFFF, 0xFFFF,
0x0000, 0x0140, 0xFFDD, 0xFFFF, 0xFFFF,
0x0000, 0x013D, 0xFFE9, 0xFFFF, 0xFFFF,
0x0000, 0x0138, 0xFFF9, 0xFFFF, 0xFFFF,
0x0000, 0x0132, 0x000B, 0xFFFF, 0xFFFF,
0x0000, 0x012B, 0x001F, 0xFFFF, 0xFFFF,
0x0000, 0x0120, 0x0033, 0xFFFF, 0xFFFF,
0x0000, 0x0116, 0x0046, 0xFFFF, 0xFFFF,
0x0000, 0x010B, 0x0059, 0xFFFF, 0xFFFF,
0x0000, 0x0100, 0x006A, 0xFFFF, 0x023A,
0x0000, 0x00F4, 0x0078, 0xFFFF, 0x04AA,
0x0000, 0x00EC, 0x0084, 0xFFFF, 0x069F,
0x0000, 0x00E5, 0x008B, 0xFFFF, 0x0803,
0x0000, 0x00E0, 0x0090, 0xFFFF, 0x08C0,
0x0000, 0x00DE, 0x0093, 0xFFFF, 0x0928,
0x0000, 0x00DD, 0x0094, 0xFFFF, 0x099D,
0x0000, 0x00DD, 0x0095, 0xFFFF, 0x0A16,
0x0000, 0x00DD, 0x0096, 0xFFFF, 0x0A8D,
0x0000, 0x00DD, 0x0096, 0xFFFF, 0x0AF6,
0x0000, 0x00DE, 0x0096, 0xFFFF, 0x0B4A,
0x0000, 0x00DE, 0x0096, 0xFFFF, 0x0B84,
0x0000, 0x00DE, 0x0095, 0x020A, 0x0BA0,
0x0000, 0x00DF, 0x0095, 0x0524, 0x0B9E,
0x0000, 0x00E1, 0x0094, 0x07EC, 0x0B84,
0x0000, 0x00E2, 0x0093, 0x0A3F, 0x0B57,
0x0000, 0x00E3, 0x0091, 0x0BFB, 0x0B1F,
0x0000, 0x00E4, 0x0090, 0x0D00, 0x0AE5,
0x0000, 0x00E6, 0x008E, 0x0D6F, 0x0AA0,
0x0000, 0x00E8, 0x008C, 0x0D8B, 0x0A48,
0x0000, 0x00E9, 0x008A, 0x0D5D, 0x09DE,
0x0000, 0x00EC, 0x0088, 0x0CED, 0x096A,
0x0000, 0x00EE, 0x0086, 0x0C49, 0x08EA,
0x0000, 0x00EF, 0x0084, 0x0B76, 0x0863,
0x0000, 0x00F1, 0x0082, 0x0A80, 0x07D9,
0x0000, 0x00F4, 0x0080, 0x0970, 0x074E,
0x0000, 0x00F6, 0x007D, 0x084E, 0x06C7,
0x0000, 0x00F8, 0x007A, 0x0723, 0x0649,
0x0000, 0x00FB, 0x0078, 0x05F8, 0x05D7,
0x0000, 0x00FD, 0x0075, 0x04D6, 0x0579,
0x0000, 0x00FE, 0x0072, 0x03C3, 0x0532,
0x0000, 0x0100, 0x006F, 0x02C9, 0x0509,
0x0000, 0x0103, 0x006C, 0x01F0, 0x0504,
0x0000, 0x0105, 0x0069, 0x0141, 0x0525,
0x0000, 0x0106, 0x0067, 0x00C3, 0x0572,
0x0000, 0x0108, 0x0064, 0x006E, 0x0619,
0x0000, 0x010B, 0x0061, 0x0032, 0x0734,
0x0000, 0x010C, 0x005F, 0x000C, 0x08AF,
0x0000, 0x010D, 0x005D, 0xFFFF, 0x0A74,
0x0000, 0x0110, 0x005A, 0xFFFF, 0x0C70,
0x0000, 0x0111, 0x0058, 0xFFFF, 0x0E8E,
0x0000, 0x0112, 0x0056, 0x0014, 0x10B6,
0x0000, 0x0113, 0x0054, 0x0032, 0x12DA,
0x0000, 0x0115, 0x0052, 0x0056, 0x14E1,
0x0000, 0x0115, 0x0052, 0x007E, 0x16B9,
0x0000, 0x0116, 0x0050, 0x00A4, 0x184B,
0x0000, 0x0116, 0x0050, 0x00C6, 0x1983,
0x0000, 0x0117, 0x0050, 0x00DF, 0x1A4D,
0x0000, 0x0118, 0x0050, 0x00E9, 0x1A96,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
+18 -22
View File
@@ -110,10 +110,10 @@ const GeoLayout bowser_geo_0000D8[] = {
const GeoLayout bowser_geo_000424[] = {
GEO_SHADOW(SHADOW_CIRCLE_9_VERTS, 0x9B, 400),
GEO_OPEN_NODE(),
#ifdef VERSION_JP
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_06040210),
#else
#if BUGFIX_BOWSER_FADING_OUT
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_06040358),
#else
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_06040210),
#endif
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_TRANSPARENT, -89, -2, -18, NULL),
@@ -200,10 +200,10 @@ const GeoLayout bowser_geo_000424[] = {
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603A4E8),
GEO_CLOSE_NODE(),
#ifdef VERSION_JP
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603B8D0),
#else
#if BUGFIX_BOWSER_FADING_OUT
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603B948),
#else
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603B8D0),
#endif
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
@@ -226,10 +226,10 @@ const GeoLayout bowser_geo_000424[] = {
const GeoLayout bowser_geo_000770[] = {
GEO_NODE_START(),
GEO_OPEN_NODE(),
#ifdef VERSION_JP
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_06040210),
#else
#if BUGFIX_BOWSER_FADING_OUT
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_06040358),
#else
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_06040210),
#endif
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_TRANSPARENT, -89, -2, -18, NULL),
@@ -316,10 +316,10 @@ const GeoLayout bowser_geo_000770[] = {
GEO_OPEN_NODE(),
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603A4E8),
GEO_CLOSE_NODE(),
#ifdef VERSION_JP
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603B8D0),
#else
#if BUGFIX_BOWSER_FADING_OUT
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603B948),
#else
GEO_ANIMATED_PART(LAYER_TRANSPARENT, 0, 0, 0, bowser_seg6_dl_0603B8D0),
#endif
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
@@ -341,7 +341,7 @@ const GeoLayout bowser_geo_000770[] = {
#ifndef VERSION_JP
// 0x0D000AB8
const GeoLayout bowser_shadow_geo[] = {
GEO_SHADOW(0x00, 0x9B, 400),
GEO_SHADOW(SHADOW_CIRCLE_9_VERTS, 0x9B, 400),
GEO_RETURN(),
};
#endif
@@ -351,11 +351,10 @@ const GeoLayout bowser_geo[] = {
GEO_NODE_START(),
GEO_OPEN_NODE(),
GEO_ASM(0, geo_update_layer_transparency),
#ifdef VERSION_JP
GEO_SWITCH_CASE(2, geo_switch_anim_state),
#endif
#ifndef VERSION_JP
GEO_SWITCH_CASE(3, geo_switch_anim_state),
#else
GEO_SWITCH_CASE(2, geo_switch_anim_state),
#endif
GEO_OPEN_NODE(),
GEO_NODE_START(),
@@ -384,19 +383,16 @@ const GeoLayout bowser_geo[] = {
};
// 0x0D000B18 / 0B40
const GeoLayout bowser2_geo[] = {
const GeoLayout bowser_geo_no_shadow[] = {
GEO_NODE_START(),
GEO_OPEN_NODE(),
GEO_ASM(0, geo_update_layer_transparency),
#ifdef VERSION_JP
GEO_SWITCH_CASE(2, geo_switch_anim_state),
#endif
#ifndef VERSION_JP
GEO_SWITCH_CASE(3, geo_switch_anim_state),
#else
GEO_SWITCH_CASE(2, geo_switch_anim_state),
#endif
GEO_OPEN_NODE(),
GEO_NODE_START(),
GEO_OPEN_NODE(),
GEO_ASM(0, geo_bits_bowser_coloring),
+2 -2
View File
@@ -1184,7 +1184,7 @@ const Gfx bowser_seg6_dl_0603B8D0[] = {
gsSPEndDisplayList(),
};
#ifndef VERSION_JP
#if BUGFIX_BOWSER_FADING_OUT
// 0x0603B948 - 0x0603B9C8
const Gfx bowser_seg6_dl_0603B948[] = {
gsDPPipeSync(),
@@ -2870,7 +2870,7 @@ const Gfx bowser_seg6_dl_06040210[] = {
gsSPEndDisplayList(),
};
#ifndef VERSION_JP
#if BUGFIX_BOWSER_FADING_OUT
// 0x06040358 - 0x06040428
const Gfx bowser_seg6_dl_06040358[] = {
gsDPPipeSync(),
+6 -18
View File
@@ -4,24 +4,12 @@
#include "types.h"
// amp
extern const GeoLayout amp_geo[];
extern const Gfx amp_seg8_dl_08002B68[];
extern const Gfx amp_seg8_dl_08002BA0[];
extern const Gfx amp_seg8_dl_08002C50[];
extern const Gfx amp_seg8_dl_08002C88[];
extern const Gfx amp_seg8_dl_08002D38[];
extern const Gfx amp_seg8_dl_08002D70[];
extern const Gfx amp_seg8_dl_08002E20[];
extern const Gfx amp_seg8_dl_08002E58[];
extern const Gfx amp_seg8_dl_08003910[];
extern const Gfx amp_seg8_dl_08003940[];
extern const Gfx amp_seg8_dl_08003970[];
extern const Gfx amp_seg8_dl_080039A0[];
extern const Gfx amp_seg8_dl_080039D0[];
extern const Gfx amp_seg8_dl_08003DA8[];
extern const Gfx amp_seg8_dl_08003DD8[];
extern const Gfx amp_seg8_dl_08003E00[];
extern const struct Animation *const amp_seg8_anims_08004034[];
extern const GeoLayout dAmpGeo[];
extern const Gfx dAmpElectricityDl[];
extern const Gfx dAmpEyeDl[];
extern const Gfx dAmpMouthDl[];
extern const Gfx dAmpBodyDl[];
extern const struct Animation *const dAmpAnimsList[];
// blue_coin_switch
extern const GeoLayout blue_coin_switch_geo[];
+1 -1
View File
@@ -18,7 +18,7 @@ UNUSED static const u64 binid_2 = 2;
#include "bowser/model.inc.c"
#include "bowser/anims/data.inc.c"
#include "bowser/anims/table.inc.c"
#include "bowser/flames_pos.inc.c"
#include "bowser/flames_data.inc.c"
UNUSED static const u64 binid_3 = 3;
#include "bomb/model.inc.c"
+2 -2
View File
@@ -17,7 +17,7 @@ extern const GeoLayout bowser_geo_000424[];
extern const GeoLayout bowser_geo_000770[];
extern const GeoLayout bowser_shadow_geo[];
extern const GeoLayout bowser_geo[];
extern const GeoLayout bowser2_geo[];
extern const GeoLayout bowser_geo_no_shadow[];
extern const Gfx bowser_seg6_dl_06039110[];
extern const Gfx bowser_seg6_dl_060391C8[];
extern const Gfx bowser_seg6_dl_06039260[];
@@ -90,7 +90,7 @@ extern const Gfx bowser_seg6_dl_06043548[];
extern const Gfx bowser_seg6_dl_06043648[];
extern const Gfx bowser_seg6_dl_06043698[];
extern const struct Animation *const bowser_seg6_anims_06057690[];
extern const s16 bowser_seg6_unkmoveshorts_060576FC[];
extern const s16 dBowserFlamesOrientationValues[];
// bowser_flame
extern const GeoLayout bowser_flames_geo[];
+5
View File
@@ -55,6 +55,11 @@ ALIGNED8 static const Texture king_bobomb_seg5_texture_05004878[] = {
#include "actors/king_bobomb/king_bob-omb_eyes.rgba16.inc.c"
};
// 0x05005078 - Unused
ALIGNED8 static const Texture king_bobomb_seg5_texture_05005078[] = {
#include "actors/king_bobomb/king_bob-omb_eyes_blink.rgba16.inc.c"
};
// 0x05005878
ALIGNED8 static const Texture king_bobomb_seg5_texture_05005878[] = {
#include "actors/king_bobomb/king_bob-omb_hand.rgba16.inc.c"
+11 -11
View File
@@ -1,21 +1,21 @@
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
// assembler directives
.set noat // allow manual use of $at
.set noreorder // don't insert nops after branches
.set gp=64
.include "macros.inc"
#include "macros.inc"
# 0xA0000000-0xBFFFFFFF: KSEG1 direct map non-cache mirror of 0x00000000
# 0xA4000000-0xA4000FFF: RSP DMEM
// 0xA0000000-0xBFFFFFFF: KSEG1 direct map non-cache mirror of 0x00000000
// 0xA4000000-0xA4000FFF: RSP DMEM
# 0xA4000000-0xA400003F: ROM header
// 0xA4000000-0xA400003F: ROM header
.section .text, "ax"
# 0xA4000040-0xA4000B6F: IPL3
// 0xA4000040-0xA4000B6F: IPL3
# IPL3 entry point jumped to from IPL2
glabel ipl3_entry # 0xA4000040
// IPL3 entry point jumped to from IPL2
glabel ipl3_entry // 0xA4000040
mtc0 $zero, $13
mtc0 $zero, $9
mtc0 $zero, $11
@@ -797,7 +797,7 @@ func_A4000AD0:
nop
nop
# 0xA4000B70-0xA4000FFF: IPL3 Font
// 0xA4000B70-0xA4000FFF: IPL3 Font
glabel ipl3_font
.incbin "textures/ipl3_raw/ipl3_font_00.ia1"
.incbin "textures/ipl3_raw/ipl3_font_01.ia1"
+5 -5
View File
@@ -1,9 +1,9 @@
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
// assembler directives
.set noat // allow manual use of $at
.set noreorder // don't insert nops after branches
.set gp=64
.include "macros.inc"
#include "macros.inc"
.section .text, "ax"
@@ -25,4 +25,4 @@ entry_point:
lui $sp, %hi(gIdleThreadStack) # Set the high half of the stack pointer to that of the idle thread stack
addiu $t2, %lo(main_func) # Get the low half of the init function address
jr $t2 # Jump to the init function
addiu $sp, %lo(gIdleThreadStack) # Set the low half of the stack pointer to that of the idle thread stack
addiu $sp, %lo(gIdleThreadStack) # Set the low half of the stack pointer to that of the idle thread stack
+10 -9
View File
@@ -14,22 +14,23 @@
.word 0x00000000 /* Checksum 2 */
.word 0x00000000 /* Unknown */
.word 0x00000000 /* Unknown */
.if VERSION_SH == 1
#ifdef VERSION_SH
.ascii "SUPERMARIO64 " /* Internal ROM name */
.else
#else
.ascii "SUPER MARIO 64 " /* Internal ROM name */
.endif
#endif
.word 0x00000000 /* Unknown */
.word 0x0000004E /* Cartridge */
.ascii "SM" /* Cartridge ID */
/* Region */
.if VERSION_US == 1
.ascii "E" /* NTSC-U (North America) */
.elseif (VERSION_JP == 1 || VERSION_SH == 1)
.ascii "J" /* NTSC-J (Japan) */
.else
#ifdef VERSION_EU
.ascii "P" /* PAL (Europe) */
.endif
#elif defined(VERSION_US)
.ascii "E" /* NTSC-U (North America) */
#else
.ascii "J" /* NTSC-J (Japan) */
#endif
.byte 0x00 /* Version */
+3 -2
View File
@@ -266,8 +266,9 @@
"actors/king_bobomb/king_bob-omb_arm.rgba16.png": [32,32,2048,{"jp":[1257760,8312],"us":[1264928,8312],"eu":[1136896,8312],"sh":[1113408,8312]}],
"actors/king_bobomb/king_bob-omb_body_unused.rgba16.png": [64,64,8192,{"jp":[1257760,10360],"us":[1264928,10360],"eu":[1136896,10360],"sh":[1113408,10360]}],
"actors/king_bobomb/king_bob-omb_crown_rim.rgba16.png": [32,16,1024,{"jp":[1257760,24696],"us":[1264928,24696],"eu":[1136896,24696],"sh":[1113408,24696]}],
"actors/king_bobomb/king_bob-omb_eyes.rgba16.png": [32,64,4096,{"jp":[1257760,18552],"us":[1264928,18552],"eu":[1136896,18552],"sh":[1113408,18552]}],
"actors/king_bobomb/king_bob-omb_hand.rgba16.png": [32,32,2048,{"jp":[1215456,64],"us":[1222624,64],"eu":[1094592,64],"sh":[1071104,64]}],
"actors/king_bobomb/king_bob-omb_eyes.rgba16.png": [32,32,2048,{"jp":[1257760,18552],"us":[1264928,18552],"eu":[1136896,18552],"sh":[1113408,18552]}],
"actors/king_bobomb/king_bob-omb_eyes_blink.rgba16.png": [32,32,2048,{"jp":[1257760,20600],"us":[1264928,20600],"eu":[1136896,20600],"sh":[1113408,20600]}],
"actors/king_bobomb/king_bob-omb_hand.rgba16.png": [32,32,2048,{"jp":[1257760,22648],"us":[1264928,22648],"eu":[1136896,22648],"sh":[1113408,22648]}],
"actors/king_bobomb/king_bob-omb_left_side.rgba16.png": [32,64,4096,{"jp":[1257760,33912],"us":[1264928,33912],"eu":[1136896,33912],"sh":[1113408,33912]}],
"actors/king_bobomb/king_bob-omb_right_side.rgba16.png": [32,64,4096,{"jp":[1257760,38008],"us":[1264928,38008],"eu":[1136896,38008],"sh":[1113408,38008]}],
"actors/klepto/klepto_beak.rgba16.png": [32,64,4096,{"jp":[1327760,4104],"us":[1334928,4104],"eu":[1206896,4104],"sh":[1183408,4104]}],
+1 -1
View File
@@ -2498,7 +2498,7 @@ const Texture texture_waterbox_lava[] = {
};
// Unreferenced light group
static const Lights1 segment2_lights_unused = gdSPDefLights1(
UNUSED static const Lights1 segment2_lights_unused = gdSPDefLights1(
0x40, 0x40, 0x40,
0xff, 0xff, 0xff, 0x28, 0x28, 0x28
);
+6 -5
View File
@@ -1965,6 +1965,7 @@ const BehaviorScript bhvBowser[] = {
SPAWN_CHILD(/*Model*/ MODEL_NONE, /*Behavior*/ bhvBowserBodyAnchor),
SPAWN_CHILD(/*Model*/ MODEL_BOWSER_BOMB_CHILD_OBJ, /*Behavior*/ bhvBowserFlameSpawn),
SPAWN_OBJ(/*Model*/ MODEL_NONE, /*Behavior*/ bhvBowserTailAnchor),
// Beta leftover that spawn 50 coins when Bowser is defeated
SET_INT(oNumLootCoins, 50),
SET_OBJ_PHYSICS(/*Wall hitbox radius*/ 0, /*Gravity*/ -400, /*Bounciness*/ -70, /*Drag strength*/ 1000, /*Friction*/ 1000, /*Buoyancy*/ 200, /*Unused*/ 0, 0),
SET_HOME(),
@@ -3023,7 +3024,7 @@ const BehaviorScript bhvHiddenStaircaseStep[] = {
END_LOOP(),
};
const BehaviorScript bhvBooBossSpawnedBridge[] = {
const BehaviorScript bhvBooStaircase[] = {
BEGIN(OBJ_LIST_SURFACE),
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
LOAD_COLLISION_DATA(bbh_seg7_collision_staircase_step),
@@ -3031,7 +3032,7 @@ const BehaviorScript bhvBooBossSpawnedBridge[] = {
SET_FLOAT(oCollisionDistance, 1000),
SET_HOME(),
BEGIN_LOOP(),
CALL_NATIVE(bhv_boo_boss_spawned_bridge_loop),
CALL_NATIVE(bhv_boo_staircase),
CALL_NATIVE(load_object_collision_model),
END_LOOP(),
};
@@ -3141,7 +3142,7 @@ const BehaviorScript bhvUnusedFakeStar[] = {
};
// What is this?
static const BehaviorScript unused_1[] = {
UNUSED static const BehaviorScript unused_1[] = {
BREAK(),
BREAK(),
BREAK(),
@@ -3851,7 +3852,7 @@ const BehaviorScript bhvSignOnWall[] = {
const BehaviorScript bhvHomingAmp[] = {
BEGIN(OBJ_LIST_GENACTOR),
OR_INT(oFlags, (OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_MOVE_XZ_USING_FVEL | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)),
LOAD_ANIMATIONS(oAnimations, amp_seg8_anims_08004034),
LOAD_ANIMATIONS(oAnimations, dAmpAnimsList),
ANIMATE(0),
SET_FLOAT(oGraphYOffset, 40),
SET_INT(oIntangibleTimer, 0),
@@ -3864,7 +3865,7 @@ const BehaviorScript bhvHomingAmp[] = {
const BehaviorScript bhvCirclingAmp[] = {
BEGIN(OBJ_LIST_GENACTOR),
OR_INT(oFlags, (OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO | OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_MOVE_XZ_USING_FVEL | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)),
LOAD_ANIMATIONS(oAnimations, amp_seg8_anims_08004034),
LOAD_ANIMATIONS(oAnimations, dAmpAnimsList),
ANIMATE(0),
SET_FLOAT(oGraphYOffset, 40),
SET_INT(oIntangibleTimer, 0),
+17 -17
View File
@@ -1,13 +1,13 @@
diff --git a/asm/crash.s b/asm/crash.s
new file mode 100644
index 00000000..0b2a5574
index 00000000..033bf952
--- /dev/null
+++ b/asm/crash.s
@@ -0,0 +1,153 @@
+# SM64 Crash Handler
+# See Readme below.
+// SM64 Crash Handler
+// See Readme below.
+
+.include "macros.inc"
+#include "macros.inc"
+
+/* ---------------------------------------------------------------
+ * IMPORTANT README:
@@ -58,7 +58,7 @@ index 00000000..0b2a5574
+ sw $a3, %lo(nAssertStopProgram)($at)
+ beqz $a3, .end_2
+ nop
+ syscall # trigger crash screen
+ syscall // trigger crash screen
+.end_2:
+ jr $ra
+ nop
@@ -75,15 +75,15 @@ index 00000000..0b2a5574
+ jr $ra
+ mfc0 $v0, COP0_BADVADDR
+
+# If the error code field of cop0's cause register is non-zero,
+# draw crash details to the screen and hang
+#
+# If there wasn't an error, continue to the original handler
+// If the error code field of cop0's cause register is non-zero,
+// draw crash details to the screen and hang
+
+// If there wasn't an error, continue to the original handler
+
+glabel __crash_handler_entry
+ mfc0 $k1, COP0_CAUSE
+ andi $k1, $k1, (0x1F << 2)
+ beqzl $k1, .end2 # exit if ExCode is 0
+ beqzl $k1, .end2 // exit if ExCode is 0
+ lui $k0, %hi(__osException)
+ la $k0, exceptionRegContext
+ sd $zero, 0x018 ($k0)
@@ -116,7 +116,7 @@ index 00000000..0b2a5574
+ sd $sp, 0x0F0 ($k0)
+ sd $fp, 0x0F8 ($k0)
+ sd $ra, 0x100 ($k0)
+ # cop unusable exception fired twice on startup so we'll ignore it for now
+ // cop unusable exception fired twice on startup so we'll ignore it for now
+ li $t0, (0x0B << 2)
+ beq $k1, $t0, .end
+ nop
@@ -155,14 +155,14 @@ index 00000000..0b2a5574
+ lui $k0, %hi(__osException)
+ .end2:
+ addiu $k0, $k0, %lo(__osException)
+ jr $k0 # run the original handler
+ jr $k0 // run the original handler
+ nop
diff --git a/lib/asm/__osExceptionPreamble.s b/lib/asm/__osExceptionPreamble.s
index e14928ce..4d12129e 100644
index c3b97993..c552a485 100644
--- a/lib/asm/__osExceptionPreamble.s
+++ b/lib/asm/__osExceptionPreamble.s
@@ -18,8 +18,8 @@
.endif
@@ -11,8 +11,8 @@
#endif
glabel __osExceptionPreamble
- lui $k0, %hi(__osException)
@@ -173,10 +173,10 @@ index e14928ce..4d12129e 100644
nop
diff --git a/sm64.ld b/sm64.ld
index f80f5b4d..569344bc 100755
index 7d9b5b4a..c7bb81b9 100755
--- a/sm64.ld
+++ b/sm64.ld
@@ -116,6 +116,7 @@ SECTIONS
@@ -117,6 +117,7 @@ SECTIONS
BUILD_DIR/src/game/rendering_graph_node.o(.text);
BUILD_DIR/src/game/profiler.o(.text);
BUILD_DIR/asm/decompress.o(.text);
+2 -2
View File
@@ -2,10 +2,10 @@ diff --git a/src/game/area.c b/src/game/area.c
index af9d0156..c68a7f6e 100644
--- a/src/game/area.c
+++ b/src/game/area.c
@@ -21,6 +21,7 @@
#include "engine/geo_layout.h"
@@ -22,6 +22,7 @@
#include "save_file.h"
#include "level_table.h"
#include "dialog_ids.h"
+#include "debug_box.h"
struct SpawnInfo gPlayerSpawnInfos[1];
+7 -7
View File
@@ -1,10 +1,10 @@
diff --git a/src/game/game_init.c b/src/game/game_init.c
index b6334688..62ed106c 100644
index b961ca52..531231cf 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -59,6 +59,47 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
u16 gDemoInputListID = 0;
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check
@@ -82,6 +82,47 @@ struct DemoInput gRecordedDemoInput = { 0 };
// Display
// ----------------------------------------------------------------------------------------------------
+// SDK states that 1 cycle takes about 21.33 nanoseconds
+#define SECONDS_PER_CYCLE 0.00000002133f
@@ -48,9 +48,9 @@ index b6334688..62ed106c 100644
+}
+
/**
* Initializes the Reality Display Processor (RDP).
* This function initializes settings such as texture filtering mode,
@@ -633,5 +674,7 @@ void thread5_game_loop(UNUSED void *arg) {
* Sets the initial RDP (Reality Display Processor) rendering settings.
*/
@@ -694,5 +735,7 @@ void thread5_game_loop(UNUSED void *arg) {
// amount of free space remaining.
print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead);
}
+17 -17
View File
@@ -13,16 +13,16 @@ index 00000000..e60550ab
+extern enum ConsoleType get_console_type(void);
diff --git a/lib/asm/skGetId.s b/lib/asm/skGetId.s
new file mode 100644
index 00000000..8fb4c449
index 00000000..58e7d4f9
--- /dev/null
+++ b/lib/asm/skGetId.s
@@ -0,0 +1,18 @@
+# Code by stuckpixel
+// Code by stuckpixel
+
+.set noreorder
+.set gp=64
+
+.include "macros.inc"
+#include "macros.inc"
+
+glabel skGetId
+ li $v0, 0
@@ -36,10 +36,10 @@ index 00000000..8fb4c449
+ nop
+ nop
diff --git a/lib/src/__osViSwapContext.c b/lib/src/__osViSwapContext.c
index b9d364b1..fa149b5d 100644
index 990cb11f..22756e91 100644
--- a/lib/src/__osViSwapContext.c
+++ b/lib/src/__osViSwapContext.c
@@ -52,7 +52,9 @@ void __osViSwapContext() {
@@ -54,7 +54,9 @@ void __osViSwapContext() {
HW_REG(VI_INTR_REG, u32) = s0->fldRegs[field].vIntr;
HW_REG(VI_X_SCALE_REG, u32) = s1->unk20;
HW_REG(VI_Y_SCALE_REG, u32) = s1->unk2c;
@@ -269,7 +269,7 @@ index 1a86477b..a94f8721 100644
return sp34;
}
diff --git a/lib/src/osInitialize.c b/lib/src/osInitialize.c
index ea247636..4adb45cb 100644
index ba73024b..6deaf407 100644
--- a/lib/src/osInitialize.c
+++ b/lib/src/osInitialize.c
@@ -1,6 +1,7 @@
@@ -280,7 +280,7 @@ index ea247636..4adb45cb 100644
#define PIF_ADDR_START (void *) 0x1FC007FC
@@ -54,6 +55,7 @@ void osInitialize(void) {
@@ -51,6 +52,7 @@ void osInitialize(void) {
UNUSED u32 eu_sp30;
#endif
UNUSED u32 sp2c;
@@ -289,24 +289,24 @@ index ea247636..4adb45cb 100644
__osSetSR(__osGetSR() | 0x20000000);
__osSetFpcCsr(0x01000800);
diff --git a/sm64.ld b/sm64.ld
index f80f5b4d..e53d4e40 100755
index 7d9b5b4a..be853a3b 100755
--- a/sm64.ld
+++ b/sm64.ld
@@ -300,6 +300,8 @@ SECTIONS
#ifdef VERSION_SH
BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text)
@@ -306,6 +306,8 @@ SECTIONS
#if ENABLE_RUMBLE
BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text);
#endif
+ BUILD_DIR/libultra.a:consoleType.o(.text)
+ BUILD_DIR/libultra.a:skGetId.o(.text)
BUILD_DIR/lib/rsp.o(.text);
#else
BUILD_DIR/src/game*.o(.text);
@@ -410,6 +412,8 @@ SECTIONS
BUILD_DIR/libultra.a:__osGetCause.o(.text);
BUILD_DIR/libultra.a:__osAtomicDec.o(.text);
BUILD_DIR/libultra.a:guLookAtRef.o(.text); /* Fast3DEX2 only */
+ BUILD_DIR/libultra.a:consoleType.o(.text);
+ BUILD_DIR/libultra.a:skGetId.o(.text);
@@ -428,6 +430,8 @@ SECTIONS
#if ENABLE_RUMBLE
BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text);
#endif
+ BUILD_DIR/libultra.a:consoleType.o(.text)
+ BUILD_DIR/libultra.a:skGetId.o(.text)
BUILD_DIR/lib/rsp.o(.text);
#endif
+14 -15
View File
@@ -1,8 +1,8 @@
diff --git a/Makefile b/Makefile
index f81fd27b..318140f2 100644
index f50b7622..124c7ec6 100644
--- a/Makefile
+++ b/Makefile
@@ -419,6 +419,7 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
@@ -478,6 +478,7 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
@@ -11,12 +11,12 @@ index f81fd27b..318140f2 100644
#==============================================================================#
diff --git a/include/segments.h b/include/segments.h
index a8c1bf97..84c3d7a4 100644
index a97d6ee8..186c968e 100644
--- a/include/segments.h
+++ b/include/segments.h
@@ -1,6 +1,9 @@
#ifndef SEGMENTS_H
#define SEGMENTS_H
@@ -3,6 +3,9 @@
#include "config.h"
+/* Use expansion pack RAM */
+#define USE_EXT_RAM 1
@@ -58,7 +58,7 @@ index 17c773ed..677a5ae9 100644
+ JUMP(/*target*/ level_script_entry_error_screen),
+};
diff --git a/levels/intro/geo.c b/levels/intro/geo.c
index 7a297fe7..71b16442 100644
index 30a87806..6bf7b79a 100644
--- a/levels/intro/geo.c
+++ b/levels/intro/geo.c
@@ -15,6 +15,24 @@
@@ -100,7 +100,7 @@ index 99277e86..04797cd7 100644
+
#endif
diff --git a/levels/intro/script.c b/levels/intro/script.c
index a130cc04..926c0d09 100644
index 04b8fc4c..ca9058c4 100644
--- a/levels/intro/script.c
+++ b/levels/intro/script.c
@@ -18,6 +18,21 @@
@@ -138,7 +138,7 @@ index d41a91c8..7d047236 100644
struct LevelCommand *level_script_execute(struct LevelCommand *cmd);
diff --git a/src/game/main.c b/src/game/main.c
index 9615f25a..e2d7b3d4 100644
index 1a9d9e7e..f4f7a9e5 100644
--- a/src/game/main.c
+++ b/src/game/main.c
@@ -11,6 +11,7 @@
@@ -149,7 +149,7 @@ index 9615f25a..e2d7b3d4 100644
// Message IDs
#define MESG_SP_COMPLETE 100
@@ -127,6 +128,10 @@ void alloc_pool(void) {
@@ -131,6 +132,10 @@ void alloc_pool(void) {
void *start = (void *) SEG_POOL_START;
void *end = (void *) SEG_POOL_END;
@@ -160,7 +160,7 @@ index 9615f25a..e2d7b3d4 100644
main_pool_init(start, end);
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
}
@@ -332,7 +337,10 @@ void thread3_main(UNUSED void *arg) {
@@ -336,7 +341,10 @@ void thread3_main(UNUSED void *arg) {
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
osStartThread(&gSoundThread);
@@ -174,7 +174,7 @@ index 9615f25a..e2d7b3d4 100644
while (TRUE) {
diff --git a/src/game/mem_error_screen.c b/src/game/mem_error_screen.c
new file mode 100644
index 00000000..81efaf91
index 00000000..f432927c
--- /dev/null
+++ b/src/game/mem_error_screen.c
@@ -0,0 +1,104 @@
@@ -274,15 +274,14 @@ index 00000000..81efaf91
+
+ addr = segmented_to_virtual(level_script_entry_error_screen);
+
+ rendering_init();
+ render_init();
+
+ while (1) {
+ config_gfx_pool();
+ select_gfx_pool();
+ addr = level_script_execute(addr);
+ display_and_vsync();
+ }
+}
\ No newline at end of file
diff --git a/src/game/mem_error_screen.h b/src/game/mem_error_screen.h
new file mode 100644
index 00000000..9fbff34c
+22 -22
View File
@@ -1,5 +1,5 @@
diff --git a/src/game/game_init.c b/src/game/game_init.c
index b6334688..9363074b 100644
index b961ca52..adfde049 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -11,6 +11,7 @@
@@ -10,9 +10,9 @@ index b6334688..9363074b 100644
#include "profiler.h"
#include "save_file.h"
#include "seq_ids.h"
@@ -335,6 +336,45 @@ void display_and_vsync(void) {
gGlobalTimer++;
}
@@ -386,6 +387,45 @@ void display_and_vsync(void) {
// Controls
// ----------------------------------------------------------------------------------------------------
+/*
+ * This enhancement allows you to record gameplay demos for the mario head screen.
@@ -24,7 +24,7 @@ index b6334688..9363074b 100644
+ *
+*/
+
+#include "../src/game/mario.h"
+#include "mario.h"
+
+#define DEMOREC_STATUS_NOT_RECORDING 0
+#define DEMOREC_STATUS_PREPARING 1
@@ -53,15 +53,15 @@ index b6334688..9363074b 100644
+struct DemoInput* gRecordedInputsPtr = (struct DemoInput*)gRecordedInputs;
+struct DemoInput gRecordedDemoInputCopy;
+
// this function records distinct inputs over a 255-frame interval to RAM locations and was likely
// used to record the demo sequences seen in the final game. This function is unused.
static void record_demo(void) {
@@ -368,6 +408,118 @@ static void record_demo(void) {
/**
* This function records distinct inputs over a 255-frame interval to RAM locations and was likely
* used to record the demo sequences seen in the final game. This function is unused.
@@ -420,6 +460,118 @@ UNUSED static void record_demo(void) {
gRecordedDemoInput.timer++;
}
+void record_new_demo_input(void) {
+ if(gRecordedDemoInput.timer == 1 && gRecordedDemoInputCopy.timer > 0) {
+ if (gRecordedDemoInput.timer == 1 && gRecordedDemoInputCopy.timer > 0) {
+ gRecordedInputs[gNumOfRecordedInputs].timer = gRecordedDemoInputCopy.timer;
+ gRecordedInputs[gNumOfRecordedInputs + 1].timer = 0;
+ gRecordedInputs[gNumOfRecordedInputs].rawStickX = gRecordedDemoInputCopy.rawStickX;
@@ -86,13 +86,13 @@ index b6334688..9363074b 100644
+void recording(void) {
+
+ // Force-stop when someone makes too many inputs.
+ if(gNumOfRecordedInputs + 1 > DEMOREC_MAX_INPUTS) {
+ if (gNumOfRecordedInputs + 1 > DEMOREC_MAX_INPUTS) {
+ gRecordingStatus = DEMOREC_STATUS_STOPPING;
+ return;
+ }
+
+ copy_gRecordedDemoInput();
+ record_demo(); // Defined in game.c
+ record_demo();
+ record_new_demo_input();
+}
+
@@ -112,10 +112,10 @@ index b6334688..9363074b 100644
+ case DEMOREC_STATUS_NOT_RECORDING:
+ break;
+ case DEMOREC_STATUS_PREPARING:
+ if(gMarioObject != NULL && gCurrLevelNum >= 5) { // If the game is in an active level
+ if (gMarioObject != NULL && gCurrLevelNum != LEVEL_NONE) { // If the game is in an active level
+ gRecordingStatus = DEMOREC_STATUS_RECORDING;
+
+ // A bit of a hack, but it works.
+ // First 4 values in demo inputs are used to define level ID
+ gNumOfRecordedInputs = 1;
+ gRecordedInputs[0].timer = gCurrLevelNum;
+ gRecordedInputs[0].rawStickX = 0;
@@ -127,7 +127,7 @@ index b6334688..9363074b 100644
+ recording();
+ break;
+ case DEMOREC_STATUS_DONE:
+ if(gDoneDelay > DEMOREC_DONE_DELAY)
+ if (gDoneDelay > DEMOREC_DONE_DELAY)
+ gRecordingStatus = DEMOREC_STATUS_NOT_RECORDING;
+ else
+ gDoneDelay++;
@@ -159,8 +159,8 @@ index b6334688..9363074b 100644
+ // so the debug level select is used for that.
+ gDebugLevelSelect = TRUE;
+
+ if(gPlayer1Controller->buttonPressed & L_TRIG) {
+ if(gRecordingStatus == DEMOREC_STATUS_NOT_RECORDING) {
+ if (gPlayer1Controller->buttonPressed & L_TRIG) {
+ if (gRecordingStatus == DEMOREC_STATUS_NOT_RECORDING) {
+ gRecordingStatus = DEMOREC_STATUS_PREPARING;
+ } else if (gRecordingStatus == DEMOREC_STATUS_RECORDING) {
+ gRecordingStatus = DEMOREC_STATUS_STOPPING;
@@ -172,12 +172,12 @@ index b6334688..9363074b 100644
+ print_status();
+}
+
// take the updated controller struct and calculate
// the new x, y, and distance floats.
void adjust_analog_stick(struct Controller *controller) {
@@ -623,6 +775,7 @@ void thread5_game_loop(UNUSED void *arg) {
/**
* Take the updated controller struct and calculate the new x, y, and distance floats.
*/
@@ -684,6 +836,7 @@ void thread5_game_loop(UNUSED void *arg) {
audio_game_loop_tick();
config_gfx_pool();
select_gfx_pool();
read_controller_inputs();
+ recordingDemo();
addr = level_script_execute(addr);
+3 -1
View File
@@ -20,6 +20,8 @@ def read_local_asset_list(f):
def asset_needs_update(asset, version):
if version <= 6 and asset in ["actors/king_bobomb/king_bob-omb_eyes.rgba16.png", "actors/king_bobomb/king_bob-omb_hand.rgba16.png"]:
return True
if version <= 5 and asset == "textures/spooky/bbh_textures.00800.rgba16.png":
return True
if version <= 4 and asset in ["textures/mountain/ttm_textures.01800.rgba16.png", "textures/mountain/ttm_textures.05800.rgba16.png"]:
@@ -59,7 +61,7 @@ def clean_assets(local_asset_file):
def main():
# In case we ever need to change formats of generated files, we keep a
# revision ID in the local asset file.
new_version = 6
new_version = 7
try:
local_asset_file = open(".assets-local.txt")
+1 -1
View File
@@ -16,4 +16,4 @@ $(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.gz
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting GZIP to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
$(V)$(LD) -r -b binary $< -o $@
+1 -1
View File
@@ -261,7 +261,7 @@ extern const BehaviorScript bhvBoo[];
extern const BehaviorScript bhvMerryGoRoundBoo[];
extern const BehaviorScript bhvGhostHuntBoo[];
extern const BehaviorScript bhvHiddenStaircaseStep[];
extern const BehaviorScript bhvBooBossSpawnedBridge[];
extern const BehaviorScript bhvBooStaircase[];
extern const BehaviorScript bhvBbhTiltingTrapPlatform[];
extern const BehaviorScript bhvHauntedBookshelf[];
extern const BehaviorScript bhvMeshElevator[];
+9 -1
View File
@@ -8,7 +8,7 @@
*/
// Bug Fixes
// --| US Version Nintendo Bug Fixes
// --| Post-JP Version Nintendo Bug Fixes
/// Fixes bug where obtaining over 999 coins sets the number of lives to 999 (or -25)
#define BUGFIX_MAX_LIVES (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where the Boss music won't fade out after defeating King Bob-omb
@@ -22,6 +22,14 @@
#define BUGFIX_PIRANHA_PLANT_SLEEP_DAMAGE (0 || VERSION_US || VERSION_SH)
/// Fixes bug where it shows a star when you grab a key in bowser battle stages
#define BUGFIX_STAR_BOWSER_KEY (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug that enables Mario in time stop even if is not ready to speak
#define BUGFIX_DIALOG_TIME_STOP (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug that causes Mario to still collide with Bowser in BITS after his defeat
#define BUGFIX_BOWSER_COLLIDE_BITS_DEAD (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where Bowser wouldn't reset his speed when fallen off (and adds missing checks)
#define BUGFIX_BOWSER_FALLEN_OFF_STAGE (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where Bowser would look weird while fading out
#define BUGFIX_BOWSER_FADING_OUT (0 || VERSION_US || VERSION_EU || VERSION_SH)
// Support Rumble Pak
#define ENABLE_RUMBLE (1 || VERSION_SH)
+1
View File
@@ -2,6 +2,7 @@
#define DIALOG_IDS_H
enum DialogId {
DIALOG_NONE = -1,
DIALOG_000,
DIALOG_001,
DIALOG_002,
+192 -37
View File
@@ -56,13 +56,14 @@
#define A_ADDMIXER 4
#define A_RESAMPLE_ZOH 6
#define A_INTERL 17
#define A_DMEMMOVE2 16
#define A_DOWNSAMPLE_HALF 17
#define A_ENVSETUP1 18
#define A_ENVMIXER 19
#define A_LOADBUFF 20
#define A_SAVEBUFF 21
#define A_ENVSETUP2 22
#define A_UNK_23 23
#define A_S8DEC 23
#define A_HILOGAIN 24
#define A_UNK_25 25
#define A_DUPLICATE 26
@@ -306,6 +307,8 @@ typedef short ENVMIX_STATE[40];
* address is later used as parameter, the 8 high bits will be an index
* to the segment table and the lower 24 bits are added to the base address
* stored in the segment table for this entry. The result is the physical address.
* With the newer rsp audio code, this segment table is not used. The address is
* used directly instead.
*
* Transfers to/from DRAM are executed using DMA and hence follow these restrictions:
* All DRAM addresses should be aligned by 8 bytes, or they will be
@@ -349,14 +352,6 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t)(s); \
}
#define aADPCM_23(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_UNK_23, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
/*
* Not used in SM64.
*/
@@ -570,15 +565,6 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
#define aInterl(pkt, f, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_INTERL, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(i, 0, 16)); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Sets internal volume parameters.
* See aEnvMixer for more info.
@@ -663,12 +649,50 @@ typedef short ENVMIX_STATE[40];
#undef aEnvMixer
#undef aInterleave
// New or modified operations in the new audio microcode below
/**
* Decompresses S8 data.
* Possible flags: A_INIT and A_LOOP.
*
* First set up internal data in DMEM:
* aSetLoop(cmd++, physicalAddressOfLoopState) (if A_LOOP is set)
*
* Then before this command, call:
* aSetBuffer(cmd++, 0, in, out, count)
*
* Note: count will be rounded up to the nearest multiple of 32 bytes.
*
* S8 decompression works by expanding s8 bytes into s16 numbers,
* by performing a left shift of 8 steps.
*
* Before the algorithm starts, the previous 16 samples are loaded according to flag:
* A_INIT: all zeros
* A_LOOP: the address set by aSetLoop
* no flags: the DRAM address in the s parameter
* These 16 samples are immediately copied to the destination address.
*
* The result of "count" bytes will be written after these 16 initial samples.
* The last 16 samples written to the destination will also be written to
* the state address in DRAM.
*/
#define aS8Dec(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_S8DEC, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
/*
* Mix two tracks by simple clamped addition.
*
* s: DMEM source track 1
* d: DMEM source track 2 and destination
* c: number of bytes to write (rounded down to 16 byte alignment)
* c: number of bytes to write
*
* Note: count is first rounded down to the nearest multiple of 16 bytes
* and then rounded up to the nearest multiple of 64 bytes.
*/
#define aAddMixer(pkt, s, d, c) \
{ \
@@ -726,6 +750,28 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (_SHIFTL(d, 16, 16) | _SHIFTL(0x80, 0, 16)); \
}
/*
* Copies memory in DMEM, second version.
*
* Copies t * c bytes from address i to address o.
*
* Note: count is first rounded up to the nearest multiple of 32 bytes,
* before the multiplication by t.
*
* Note: This acts as memcpy where 32 bytes are moved at a time, therefore
* if input and output overlap, output address should be less than input address.
*
* Not used in SM64.
*/
#define aDMEMMove2(pkt, t, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_DMEMMOVE2, 24, 8) | \
_SHIFTL(t, 16, 8) | _SHIFTL(i, 0, 16); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Fast resample.
*
@@ -734,14 +780,37 @@ typedef short ENVMIX_STATE[40];
*
* This works like the other resample command but just takes the "nearest" sample,
* instead of a function of the four nearest samples.
*
* Initially the current position is calculated as (in << 16) + startFract.
* For every sample to create, the value is simply taken from the sample
* at address ((position >> 17) << 1). Then the current position is incremented
* by (pitch << 2).
*
* Note: count represents the number of output bytes to create, and is
* rounded up to the nearest multiple of 8 bytes.
*/
#define aResampleZoh(pkt, pitch, start_fract) \
#define aResampleZoh(pkt, pitch, startFract) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | \
_SHIFTL(pitch, 0, 16)); \
_a->words.w1 = _SHIFTL(start_fract, 0, 16); \
_a->words.w1 = _SHIFTL(startFract, 0, 16); \
}
/*
* Fast downsampling by taking every other sample, discarding others.
*
* Note: nSamples refers to the number of output samples to create, and
* is first rounded up to the nearest multiple of 8.
*/
#define aDownsampleHalf(pkt, nSamples, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_DOWNSAMPLE_HALF, 24, 8) | \
_SHIFTL(nSamples, 0, 16)); \
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
}
/*
@@ -764,39 +833,87 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
}
#define aEnvSetup1(pkt, a, b, c, d) \
/*
* See aEnvMixer for more info.
*/
#define aEnvSetup1(pkt, initialVolReverb, rampReverb, rampLeft, rampRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | \
_SHIFTL(a, 16, 8) | _SHIFTL(b, 0, 16)); \
_a->words.w1 = _SHIFTL(c, 16, 16) | _SHIFTL(d, 0, 16); \
_SHIFTL(initialVolReverb, 16, 8) | \
_SHIFTL(rampReverb, 0, 16)); \
_a->words.w1 = _SHIFTL(rampLeft, 16, 16) | \
_SHIFTL(rampRight, 0, 16); \
}
#define aEnvSetup2(pkt, volLeft, volRight) \
/*
* See aEnvMixer for more info.
*/
#define aEnvSetup2(pkt, initialVolLeft, initialVolRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \
_a->words.w1 = _SHIFTL(volLeft, 16, 16) | \
_SHIFTL(volRight, 0, 16); \
_a->words.w1 = _SHIFTL(initialVolLeft, 16, 16) | \
_SHIFTL(initialVolRight, 0, 16); \
}
#define aEnvMixer(pkt, inBuf, nSamples, bit1, bit2, bit3, dryLeft, dryRight, wetLeft, wetRight) \
/*
* Mixes an envelope with mono sound into 4 channels.
*
* To allow for many parameters, a sequence of aEnvSetup1, aEnvSetup2,
* aEnvMixer shall always be called.
*
* The function works in blocks of 8 samples.
* However, nSamples is rounded up to the nearest multiple of 16 samples.
*
* For each sample in a block:
* 1. sampleLeft = in * volLeft * (negLeft ? -1 : 1)
* 2. sampleRight = in * volRight * (negRight ? -1 : 1)
* 3. dryLeft += sampleLeft
* 4. dryRight += sampleRight
* 5. if swapReverb: swap sampleLeft and sampleRight
* 6. wetLeft += sampleLeft * volReverb
* 7. wetRight += sampleRight * volReverb
*
* After each block, all vol variables are added by their corresponding
* ramp value.
*
* Each volume variable is treated as a UQ0.16 number. Make sure
* the ramp additions don't overflow, or wrapping will occur.
* The initialVolReverb parameter is only 8 bits, but will be left
* shifted 8 bits by the rsp.
*/
#define aEnvMixer(pkt, inBuf, nSamples, swapReverb, negLeft, negRight, \
dryLeft, dryRight, wetLeft, wetRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | \
_SHIFTL((inBuf) >> 4, 16, 8) | \
_SHIFTL(nSamples, 8, 8)) | \
_SHIFTL(bit1, 2, 1) | _SHIFTL(bit2, 1, 1) | \
_SHIFTL(bit3, 0, 1); \
_SHIFTL(swapReverb, 2, 1) | _SHIFTL(negLeft, 1, 1) |\
_SHIFTL(negRight, 0, 1); \
_a->words.w1 = _SHIFTL((dryLeft) >> 4, 24, 8) | \
_SHIFTL((dryRight) >> 4, 16, 8) | \
_SHIFTL((wetLeft) >> 4, 8, 8) | \
_SHIFTL((wetRight) >> 4, 0, 8); \
}
/*
* Interleaves two mono channels into stereo.
*
* The count refers to the size of each input. Hence 2 * count bytes
* will be written out.
*
* A left sample will be placed before the right sample.
* All addresses (output, left, right) are DMEM addresses.
*
* Note: count will be rounded up to the nearest multiple of 8 bytes.
* The previous version of this function rounded up to the nearest
* multiple of 16 bytes.
*/
#define aInterleave(pkt, o, l, r, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -806,7 +923,26 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
}
// countOrBuf meaning depends on flag
/*
* Linear filter function.
*
* Calculates out[i] = sum all elements in the vector in[i..i-7] * filter[0..7],
* where "*" represents dot multiplication. The input/output contains s16
* samples and filter contains Q1.15 signed fixed point numbers.
* Every result sample is rounded and clamped.
*
* First initiate by calling with the flag f set to 2, countOrBuf contains
* the length in bytes that shall be processed in the next call. The addr
* parameter shall contain the DRAM address to the filter table (16 bytes).
* The count will be rounded up to the nearest multiple of 16 bytes.
*
* The aFilter function shall then be called in direct succession, with flag
* set to either 0 or 1. The countOrBuf parameter shall contain the DMEM
* address for the input/output. The addr parameter shall contain the DRAM
* address for the state, containing the last previous 8 input samples.
* The state is always written to upon exit, but is only read at entry if
* the flag is 0 (otherwise all-zero samples are used instead).
*/
#define aFilter(pkt, f, countOrBuf, addr) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -816,22 +952,41 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t)(addr); \
}
#define aHilogain(pkt, id, buflen, i) \
/*
* Modifies the volume of samples using a simple UQ4.4 gain multiplier.
*
* Performs the following:
*
* 1. Count c is rounded up to 32 byte alignment
* 2. g is a u8 that contains a UQ4.4 number
* 3. Modify each sample s, so that s = clamp_s16(s * g >> 4)
*/
#define aHiLoGain(pkt, g, buflen, i) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_HILOGAIN, 24, 8) | \
_SHIFTL((id), 16, 8) | _SHIFTL((buflen), 0, 16); \
_SHIFTL((g), 16, 8) | _SHIFTL((buflen), 0, 16); \
_a->words.w1 = _SHIFTL((i), 16, 16); \
}
#define aUnknown25(pkt, f, g, i, o) \
/*
* Performs the following:
*
* 1. Count c is rounded up to 64 byte alignment
* 2. f is added to i
* 3. i and o are from now treated as s16 pointers
* 4. 32 s16 samples are loaded from i to tbl
* 5. for (u32 idx = 0; idx * sizeof(s16) < c; idx++)
* o[idx] = clamp_s16((s32)o[idx] * (s32)tbl[idx % 32]);
*/
#define aUnknown25(pkt, f, c, o, i) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_UNK_25, 24, 8) | \
_SHIFTL((f), 16, 8) | _SHIFTL((g), 0, 16)); \
_a->words.w1 = _SHIFTL((i), 16, 16) | _SHIFTL((o), 0, 16); \
_SHIFTL((f), 16, 8) | _SHIFTL((c), 0, 16)); \
_a->words.w1 = _SHIFTL((o), 16, 16) | _SHIFTL((i), 0, 16); \
}
#endif
+4 -1
View File
@@ -8,7 +8,8 @@ typedef struct
u8 *offset;
s32 len;
#ifdef VERSION_SH
s8 magic[2]; // tbl: 0x0204, otherwise: 0x0203
s8 medium;
s8 magic; // tbl: 0x04, otherwise: 0x03
// for ctl (else zeros):
union {
@@ -38,7 +39,9 @@ typedef struct
#ifdef VERSION_SH
s16 unk2;
u8 *data;
#if !IS_64_BIT
s32 pad[2];
#endif
#endif
ALSeqData seqArray[1];
} ALSeqFile;
+1 -1
View File
@@ -1,4 +1,4 @@
# Assembly Macros
/* Assembly Macros */
.set K0BASE, 0x80000000
.set K1BASE, 0xA0000000
+3 -3
View File
@@ -410,12 +410,12 @@
// second set of actor bins, (0x64-0x73)
// group 12
#define MODEL_BOWSER 0x64 // bowser_geo - 2nd geo loaded is bowser_geo_000424, starts with shadow command
#define MODEL_BOWSER 0x64 // bowser_geo
#define MODEL_BOWSER_BOMB_CHILD_OBJ 0x65 // bowser_bomb_geo - Spawns as a chill object in bowser's behavior command, causing an explosion if it touches a bomb
#define MODEL_BOWSER_SMOKE 0x66 // bowser_impact_smoke_geo
#define MODEL_BOWSER_FLAMES 0x67 // bowser_flames_geo
#define MODEL_BOWSER_WAVE 0x68 // invisible_bowser_accessory_geo
#define MODEL_BOWSER2 0x69 // bowser2_geo - 2nd geo loaded is bowser_geo_000770, starts with node command, only difference
#define MODEL_BOWSER_NO_SHADOW 0x69 // bowser_geo_no_shadow
// group 13
#define MODEL_BUB 0x64 // cheep_cheep_geo
@@ -531,7 +531,7 @@
#define MODEL_KOOPA_WITHOUT_SHELL 0xBF // koopa_without_shell_geo
#define MODEL_GOOMBA 0xC0 // goomba_geo
#define MODEL_SEAWEED 0xC1 // seaweed_geo
#define MODEL_AMP 0xC2 // amp_geo
#define MODEL_AMP 0xC2 // dAmpGeo
#define MODEL_BOBOMB_BUDDY 0xC3 // bobomb_buddy_geo
// find me
// find me
+192 -37
View File
@@ -56,13 +56,14 @@
#define A_ADDMIXER 4
#define A_RESAMPLE_ZOH 6
#define A_INTERL 17
#define A_DMEMMOVE2 16
#define A_DOWNSAMPLE_HALF 17
#define A_ENVSETUP1 18
#define A_ENVMIXER 19
#define A_LOADBUFF 20
#define A_SAVEBUFF 21
#define A_ENVSETUP2 22
#define A_UNK_23 23
#define A_S8DEC 23
#define A_HILOGAIN 24
#define A_UNK_25 25
#define A_DUPLICATE 26
@@ -306,6 +307,8 @@ typedef short ENVMIX_STATE[40];
* address is later used as parameter, the 8 high bits will be an index
* to the segment table and the lower 24 bits are added to the base address
* stored in the segment table for this entry. The result is the physical address.
* With the newer rsp audio code, this segment table is not used. The address is
* used directly instead.
*
* Transfers to/from DRAM are executed using DMA and hence follow these restrictions:
* All DRAM addresses should be aligned by 8 bytes, or they will be
@@ -349,14 +352,6 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t)(s); \
}
#define aADPCM_23(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_UNK_23, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
/*
* Not used in SM64.
*/
@@ -570,15 +565,6 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
#define aInterl(pkt, f, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_INTERL, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(i, 0, 16)); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Sets internal volume parameters.
* See aEnvMixer for more info.
@@ -663,12 +649,50 @@ typedef short ENVMIX_STATE[40];
#undef aEnvMixer
#undef aInterleave
// New or modified operations in the new audio microcode below
/**
* Decompresses S8 data.
* Possible flags: A_INIT and A_LOOP.
*
* First set up internal data in DMEM:
* aSetLoop(cmd++, physicalAddressOfLoopState) (if A_LOOP is set)
*
* Then before this command, call:
* aSetBuffer(cmd++, 0, in, out, count)
*
* Note: count will be rounded up to the nearest multiple of 32 bytes.
*
* S8 decompression works by expanding s8 bytes into s16 numbers,
* by performing a left shift of 8 steps.
*
* Before the algorithm starts, the previous 16 samples are loaded according to flag:
* A_INIT: all zeros
* A_LOOP: the address set by aSetLoop
* no flags: the DRAM address in the s parameter
* These 16 samples are immediately copied to the destination address.
*
* The result of "count" bytes will be written after these 16 initial samples.
* The last 16 samples written to the destination will also be written to
* the state address in DRAM.
*/
#define aS8Dec(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_S8DEC, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
/*
* Mix two tracks by simple clamped addition.
*
* s: DMEM source track 1
* d: DMEM source track 2 and destination
* c: number of bytes to write (rounded down to 16 byte alignment)
* c: number of bytes to write
*
* Note: count is first rounded down to the nearest multiple of 16 bytes
* and then rounded up to the nearest multiple of 64 bytes.
*/
#define aAddMixer(pkt, s, d, c) \
{ \
@@ -726,6 +750,28 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (_SHIFTL(d, 16, 16) | _SHIFTL(0x80, 0, 16)); \
}
/*
* Copies memory in DMEM, second version.
*
* Copies t * c bytes from address i to address o.
*
* Note: count is first rounded up to the nearest multiple of 32 bytes,
* before the multiplication by t.
*
* Note: This acts as memcpy where 32 bytes are moved at a time, therefore
* if input and output overlap, output address should be less than input address.
*
* Not used in SM64.
*/
#define aDMEMMove2(pkt, t, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_DMEMMOVE2, 24, 8) | \
_SHIFTL(t, 16, 8) | _SHIFTL(i, 0, 16); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Fast resample.
*
@@ -734,14 +780,37 @@ typedef short ENVMIX_STATE[40];
*
* This works like the other resample command but just takes the "nearest" sample,
* instead of a function of the four nearest samples.
*
* Initially the current position is calculated as (in << 16) + startFract.
* For every sample to create, the value is simply taken from the sample
* at address ((position >> 17) << 1). Then the current position is incremented
* by (pitch << 2).
*
* Note: count represents the number of output bytes to create, and is
* rounded up to the nearest multiple of 8 bytes.
*/
#define aResampleZoh(pkt, pitch, start_fract) \
#define aResampleZoh(pkt, pitch, startFract) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | \
_SHIFTL(pitch, 0, 16)); \
_a->words.w1 = _SHIFTL(start_fract, 0, 16); \
_a->words.w1 = _SHIFTL(startFract, 0, 16); \
}
/*
* Fast downsampling by taking every other sample, discarding others.
*
* Note: nSamples refers to the number of output samples to create, and
* is first rounded up to the nearest multiple of 8.
*/
#define aDownsampleHalf(pkt, nSamples, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_DOWNSAMPLE_HALF, 24, 8) | \
_SHIFTL(nSamples, 0, 16)); \
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
}
/*
@@ -764,39 +833,87 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
}
#define aEnvSetup1(pkt, a, b, c, d) \
/*
* See aEnvMixer for more info.
*/
#define aEnvSetup1(pkt, initialVolReverb, rampReverb, rampLeft, rampRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | \
_SHIFTL(a, 16, 8) | _SHIFTL(b, 0, 16)); \
_a->words.w1 = _SHIFTL(c, 16, 16) | _SHIFTL(d, 0, 16); \
_SHIFTL(initialVolReverb, 16, 8) | \
_SHIFTL(rampReverb, 0, 16)); \
_a->words.w1 = _SHIFTL(rampLeft, 16, 16) | \
_SHIFTL(rampRight, 0, 16); \
}
#define aEnvSetup2(pkt, volLeft, volRight) \
/*
* See aEnvMixer for more info.
*/
#define aEnvSetup2(pkt, initialVolLeft, initialVolRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \
_a->words.w1 = _SHIFTL(volLeft, 16, 16) | \
_SHIFTL(volRight, 0, 16); \
_a->words.w1 = _SHIFTL(initialVolLeft, 16, 16) | \
_SHIFTL(initialVolRight, 0, 16); \
}
#define aEnvMixer(pkt, inBuf, nSamples, bit1, bit2, bit3, dryLeft, dryRight, wetLeft, wetRight) \
/*
* Mixes an envelope with mono sound into 4 channels.
*
* To allow for many parameters, a sequence of aEnvSetup1, aEnvSetup2,
* aEnvMixer shall always be called.
*
* The function works in blocks of 8 samples.
* However, nSamples is rounded up to the nearest multiple of 16 samples.
*
* For each sample in a block:
* 1. sampleLeft = in * volLeft * (negLeft ? -1 : 1)
* 2. sampleRight = in * volRight * (negRight ? -1 : 1)
* 3. dryLeft += sampleLeft
* 4. dryRight += sampleRight
* 5. if swapReverb: swap sampleLeft and sampleRight
* 6. wetLeft += sampleLeft * volReverb
* 7. wetRight += sampleRight * volReverb
*
* After each block, all vol variables are added by their corresponding
* ramp value.
*
* Each volume variable is treated as a UQ0.16 number. Make sure
* the ramp additions don't overflow, or wrapping will occur.
* The initialVolReverb parameter is only 8 bits, but will be left
* shifted 8 bits by the rsp.
*/
#define aEnvMixer(pkt, inBuf, nSamples, swapReverb, negLeft, negRight, \
dryLeft, dryRight, wetLeft, wetRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | \
_SHIFTL((inBuf) >> 4, 16, 8) | \
_SHIFTL(nSamples, 8, 8)) | \
_SHIFTL(bit1, 2, 1) | _SHIFTL(bit2, 1, 1) | \
_SHIFTL(bit3, 0, 1); \
_SHIFTL(swapReverb, 2, 1) | _SHIFTL(negLeft, 1, 1) |\
_SHIFTL(negRight, 0, 1); \
_a->words.w1 = _SHIFTL((dryLeft) >> 4, 24, 8) | \
_SHIFTL((dryRight) >> 4, 16, 8) | \
_SHIFTL((wetLeft) >> 4, 8, 8) | \
_SHIFTL((wetRight) >> 4, 0, 8); \
}
/*
* Interleaves two mono channels into stereo.
*
* The count refers to the size of each input. Hence 2 * count bytes
* will be written out.
*
* A left sample will be placed before the right sample.
* All addresses (output, left, right) are DMEM addresses.
*
* Note: count will be rounded up to the nearest multiple of 8 bytes.
* The previous version of this function rounded up to the nearest
* multiple of 16 bytes.
*/
#define aInterleave(pkt, o, l, r, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -806,7 +923,26 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
}
// countOrBuf meaning depends on flag
/*
* Linear filter function.
*
* Calculates out[i] = sum all elements in the vector in[i..i-7] * filter[0..7],
* where "*" represents dot multiplication. The input/output contains s16
* samples and filter contains Q1.15 signed fixed point numbers.
* Every result sample is rounded and clamped.
*
* First initiate by calling with the flag f set to 2, countOrBuf contains
* the length in bytes that shall be processed in the next call. The addr
* parameter shall contain the DRAM address to the filter table (16 bytes).
* The count will be rounded up to the nearest multiple of 16 bytes.
*
* The aFilter function shall then be called in direct succession, with flag
* set to either 0 or 1. The countOrBuf parameter shall contain the DMEM
* address for the input/output. The addr parameter shall contain the DRAM
* address for the state, containing the last previous 8 input samples.
* The state is always written to upon exit, but is only read at entry if
* the flag is 0 (otherwise all-zero samples are used instead).
*/
#define aFilter(pkt, f, countOrBuf, addr) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -816,22 +952,41 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t)(addr); \
}
#define aHilogain(pkt, id, buflen, i) \
/*
* Modifies the volume of samples using a simple UQ4.4 gain multiplier.
*
* Performs the following:
*
* 1. Count c is rounded up to 32 byte alignment
* 2. g is a u8 that contains a UQ4.4 number
* 3. Modify each sample s, so that s = clamp_s16(s * g >> 4)
*/
#define aHiLoGain(pkt, g, buflen, i) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_HILOGAIN, 24, 8) | \
_SHIFTL((id), 16, 8) | _SHIFTL((buflen), 0, 16); \
_SHIFTL((g), 16, 8) | _SHIFTL((buflen), 0, 16); \
_a->words.w1 = _SHIFTL((i), 16, 16); \
}
#define aUnknown25(pkt, f, g, i, o) \
/*
* Performs the following:
*
* 1. Count c is rounded up to 64 byte alignment
* 2. f is added to i
* 3. i and o are from now treated as s16 pointers
* 4. 32 s16 samples are loaded from i to tbl
* 5. for (u32 idx = 0; idx * sizeof(s16) < c; idx++)
* o[idx] = clamp_s16((s32)o[idx] * (s32)tbl[idx % 32]);
*/
#define aUnknown25(pkt, f, c, o, i) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_UNK_25, 24, 8) | \
_SHIFTL((f), 16, 8) | _SHIFTL((g), 0, 16)); \
_a->words.w1 = _SHIFTL((i), 16, 16) | _SHIFTL((o), 0, 16); \
_SHIFTL((f), 16, 8) | _SHIFTL((c), 0, 16)); \
_a->words.w1 = _SHIFTL((o), 16, 16) | _SHIFTL((i), 0, 16); \
}
#endif
+4 -1
View File
@@ -8,7 +8,8 @@ typedef struct
u8 *offset;
s32 len;
#ifdef VERSION_SH
s8 magic[2]; // tbl: 0x0204, otherwise: 0x0203
s8 medium;
s8 magic; // tbl: 0x04, otherwise: 0x03
// for ctl (else zeros):
union {
@@ -38,7 +39,9 @@ typedef struct
#ifdef VERSION_SH
s16 unk2;
u8 *data;
#if !IS_64_BIT
s32 pad[2];
#endif
#endif
ALSeqData seqArray[1];
} ALSeqFile;
+117 -16
View File
@@ -53,23 +53,18 @@
#define HELD_DROPPED 3
/* oDialogState */
#define DIALOG_UNK1_ENABLE_TIME_STOP 0
#define DIALOG_UNK1_INTERRUPT_MARIO_ACTION 1
#define DIALOG_UNK1_BEGIN_DIALOG 2
#define DIALOG_UNK1_AWAIT_DIALOG 3
#define DIALOG_UNK1_DISABLE_TIME_STOP 4
#define DIALOG_STATUS_ENABLE_TIME_STOP 0
#define DIALOG_STATUS_INTERRUPT 1
#define DIALOG_STATUS_START_DIALOG 2
#define DIALOG_STATUS_STOP_DIALOG 3
#define DIALOG_STATUS_DISABLE_TIME_STOP 4
#define DIALOG_UNK1_FLAG_DEFAULT (1 << 1) // 0x02
#define DIALOG_UNK1_FLAG_RESPONSE (1 << 2) // 0x04
#define DIALOG_UNK1_FLAG_4 (1 << 4) // 0x10
#define DIALOG_UNK2_ENABLE_TIME_STOP 0
#define DIALOG_UNK2_TURN_AND_INTERRUPT_MARIO_ACTION 1
#define DIALOG_UNK2_AWAIT_DIALOG 2
#define DIALOG_UNK2_END_DIALOG 3
#define DIALOG_UNK2_FLAG_0 (1 << 0) // 0x01
#define DIALOG_UNK2_LEAVE_TIME_STOP_ENABLED (1 << 4) // 0x10
#define DIALOG_FLAG_NONE 0
#define DIALOG_FLAG_TURN_TO_MARIO (1 << 0) // 0x01 // cutscene only
#define DIALOG_FLAG_TEXT_DEFAULT (1 << 1) // 0x02
#define DIALOG_FLAG_TEXT_RESPONSE (1 << 2) // 0x04 // non-cutscene only
#define DIALOG_FLAG_UNK_CAPSWITCH (1 << 3) // 0x08 // not defined
#define DIALOG_FLAG_TIME_STOP_ENABLED (1 << 4) // 0x10
/* oMoveFlags */
#define OBJ_MOVE_LANDED (1 << 0) // 0x0001
@@ -191,6 +186,112 @@
#define BOBOMB_BUDDY_HAS_NOT_TALKED 0
#define BOBOMB_BUDDY_HAS_TALKED 2
/* Bowser */
/* Tail oAction */
#define BOWSER_ACT_TAIL_DEFAULT 0
#define BOWSER_ACT_TAIL_THROWN 1
#define BOWSER_ACT_TAIL_TOUCHED_MARIO 2
/* oAction */
#define BOWSER_ACT_DEFAULT 0
#define BOWSER_ACT_THROWN 1
#define BOWSER_ACT_JUMP_ONTO_STAGE 2
#define BOWSER_ACT_DANCE 3
#define BOWSER_ACT_DEAD 4
#define BOWSER_ACT_WAIT 5
#define BOWSER_ACT_INTRO_WALK 6
#define BOWSER_ACT_CHARGE_MARIO 7
#define BOWSER_ACT_SPIT_FIRE_INTO_SKY 8
#define BOWSER_ACT_SPIT_FIRE_ONTO_FLOOR 9
#define BOWSER_ACT_HIT_EDGE 10
#define BOWSER_ACT_TURN_FROM_EDGE 11
#define BOWSER_ACT_HIT_MINE 12
#define BOWSER_ACT_BIG_JUMP 13
#define BOWSER_ACT_WALK_TO_MARIO 14
#define BOWSER_ACT_BREATH_FIRE 15
#define BOWSER_ACT_TELEPORT 16
#define BOWSER_ACT_QUICK_JUMP 17
#define BOWSER_ACT_UNUSED_SLOW_WALK 18
#define BOWSER_ACT_TILT_LAVA_PLATFORM 19
/* Animations */
#define BOWSER_ANIM_STAND_UP 0
#define BOWSER_ANIM_STAND_UP_UNUSED 1 // slightly different
#define BOWSER_ANIM_SHAKING 2
#define BOWSER_ANIM_GRABBED 3
#define BOWSER_ANIM_BROKEN 4 // broken animation
#define BOWSER_ANIM_FALL_DOWN 5 // unused
#define BOWSER_ANIM_BREATH 6
#define BOWSER_ANIM_JUMP 7 // unused, short jump, replaced by start/stop
#define BOWSER_ANIM_JUMP_STOP 8
#define BOWSER_ANIM_JUMP_START 9
#define BOWSER_ANIM_DANCE 10
#define BOWSER_ANIM_BREATH_UP 11
#define BOWSER_ANIM_IDLE 12
#define BOWSER_ANIM_SLOW_GAIT 13
#define BOWSER_ANIM_LOOK_DOWN_STOP_WALK 14
#define BOWSER_ANIM_LOOK_UP_START_WALK 15
#define BOWSER_ANIM_FLIP_DOWN 16
#define BOWSER_ANIM_LAY_DOWN 17
#define BOWSER_ANIM_RUN_START 18
#define BOWSER_ANIM_RUN 19
#define BOWSER_ANIM_RUN_STOP 20
#define BOWSER_ANIM_RUN_SLIP 21
#define BOWSER_ANIM_BREATH_QUICK 22
#define BOWSER_ANIM_EDGE_MOVE 23
#define BOWSER_ANIM_EDGE_STOP 24
#define BOWSER_ANIM_FLIP 25
#define BOWSER_ANIM_STAND_UP_FROM_FLIP 26
/* oBehParams2ndByte */
#define BOWSER_BP_BITDW 0
#define BOWSER_BP_BITFS 1
#define BOWSER_BP_BITS 2
/* oBowserCamAct */
#define BOWSER_CAM_ACT_IDLE 0
#define BOWSER_CAM_ACT_WALK 1
#define BOWSER_CAM_ACT_END 2
/* oBowserStatus */
#define BOWSER_STATUS_ANGLE_MARIO (1 << 1) // 0x00000002
#define BOWSER_STATUS_ANGLE_CENTRE (1 << 2) // 0x00000004
#define BOWSER_STATUS_DIST_MARIO (1 << 3) // 0x00000008
#define BOWSER_STATUS_DIST_CENTRE (1 << 4) // 0x00000010
#define BOWSER_STATUS_BIG_JUMP (1 << 16) // 0x00010000
#define BOWSER_STATUS_FIRE_SKY (1 << 17) // 0x00020000
/* oBowserGrabbedStatus */
#define BOWSER_GRAB_STATUS_NONE 0
#define BOWSER_GRAB_STATUS_GRABBED 1
#define BOWSER_GRAB_STATUS_HOLDING 2
/* oSubAction */
#define BOWSER_SUB_ACT_DEAD_FLY_BACK 0
#define BOWSER_SUB_ACT_DEAD_BOUNCE 1
#define BOWSER_SUB_ACT_DEAD_WAIT 2
#define BOWSER_SUB_ACT_DEAD_DEFAULT_END 3
#define BOWSER_SUB_ACT_DEAD_DEFAULT_END_OVER 4
#define BOWSER_SUB_ACT_DEAD_FINAL_END 10
#define BOWSER_SUB_ACT_DEAD_FINAL_END_OVER 11
#define BOWSER_SUB_ACT_CHARGE_START 0
#define BOWSER_SUB_ACT_CHARGE_RUN 1
#define BOWSER_SUB_ACT_CHARGE_END 2
#define BOWSER_SUB_ACT_CHARGE_SLIP 3
#define BOWSER_SUB_ACT_TELEPORT_START 0
#define BOWSER_SUB_ACT_TELEPORT_MOVE 1
#define BOWSER_SUB_ACT_TELEPORT_STOP 2
#define BOWSER_SUB_ACT_HIT_MINE_START 0
#define BOWSER_SUB_ACT_HIT_MINE_FALL 1
#define BOWSER_SUB_ACT_HIT_MINE_STOP 2
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_IDLE 0
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_START 1
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_LAND 2
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_STOP 3
/* Bowser Bits Platform*/
/* oAction */
#define BOWSER_BITS_PLAT_ACT_START 0
#define BOWSER_BITS_PLAT_ACT_CHECK 1
#define BOWSER_BITS_PLAT_ACT_FALL 2
/* Fish Spawer */
/* oAction */
#define FISH_SPAWNER_ACT_SPAWN 0
+24 -20
View File
@@ -65,8 +65,8 @@
#define /*0x0B4*/ oVelZ OBJECT_FIELD_F32(0x0B)
#define /*0x0B8*/ oForwardVel OBJECT_FIELD_F32(0x0C)
#define /*0x0B8*/ oForwardVelS32 OBJECT_FIELD_S32(0x0C)
#define /*0x0BC*/ oUnkBC OBJECT_FIELD_F32(0x0D)
#define /*0x0C0*/ oUnkC0 OBJECT_FIELD_F32(0x0E)
#define /*0x0BC*/ oLeftVel OBJECT_FIELD_F32(0x0D)
#define /*0x0C0*/ oUpVel OBJECT_FIELD_F32(0x0E)
#define /*0x0C4*/ O_MOVE_ANGLE_INDEX 0x0F
#define /*0x0C4*/ O_MOVE_ANGLE_PITCH_INDEX (O_MOVE_ANGLE_INDEX + 0)
#define /*0x0C4*/ O_MOVE_ANGLE_YAW_INDEX (O_MOVE_ANGLE_INDEX + 1)
@@ -274,24 +274,24 @@
#define /*0x0FC*/ oBBallSpawnerPeriodMinus1 OBJECT_FIELD_S32(0x1D)
/* Bowser */
#define /*0x088*/ oBowserUnk88 OBJECT_FIELD_S32(0x00)
#define /*0x0F4*/ oBowserUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oBowserUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x088*/ oBowserCamAct OBJECT_FIELD_S32(0x00)
#define /*0x0F4*/ oBowserStatus OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oBowserTimer OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oBowserDistToCentre OBJECT_FIELD_F32(0x1D)
#define /*0x106*/ oBowserUnk106 OBJECT_FIELD_S16(0x1F, 1)
#define /*0x108*/ oBowserUnk108 OBJECT_FIELD_S16(0x20, 0)
#define /*0x106*/ oBowserBitsJustJump OBJECT_FIELD_S16(0x1F, 1)
#define /*0x108*/ oBowserRandSplitFloor OBJECT_FIELD_S16(0x20, 0)
#define /*0x10A*/ oBowserHeldAnglePitch OBJECT_FIELD_S16(0x20, 1)
#define /*0x10D*/ oBowserHeldAngleVelYaw OBJECT_FIELD_S16(0x21, 0)
#define /*0x10E*/ oBowserUnk10E OBJECT_FIELD_S16(0x21, 1)
#define /*0x110*/ oBowserUnk110 OBJECT_FIELD_S16(0x22, 0)
#define /*0x10E*/ oBowserGrabbedStatus OBJECT_FIELD_S16(0x21, 1)
#define /*0x110*/ oBowserIsReacting OBJECT_FIELD_S16(0x22, 0)
#define /*0x112*/ oBowserAngleToCentre OBJECT_FIELD_S16(0x22, 1)
#define /*0x1AC*/ oBowserUnk1AC OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AE*/ oBowserUnk1AE OBJECT_FIELD_S16(0x49, 1)
#define /*0x1AC*/ oBowserTargetOpacity OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AE*/ oBowserEyesTimer OBJECT_FIELD_S16(0x49, 1)
#define /*0x1B0*/ oBowserEyesShut OBJECT_FIELD_S16(0x4A, 0)
#define /*0x1B2*/ oBowserUnk1B2 OBJECT_FIELD_S16(0x4A, 1)
#define /*0x1B2*/ oBowserRainbowLight OBJECT_FIELD_S16(0x4A, 1)
/* Bowser Shockwave */
#define /*0x0F4*/ oBowserShockWaveUnkF4 OBJECT_FIELD_F32(0x1B)
#define /*0x0F4*/ oBowserShockWaveScale OBJECT_FIELD_F32(0x1B)
/* Black Smoke Bowser */
#define /*0x0F4*/ oBlackSmokeBowserUnkF4 OBJECT_FIELD_F32(0x1B)
@@ -497,7 +497,7 @@
/* Flame */
#define /*0x0F4*/ oFlameScale OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oFlameSpeedTimerOffset OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oFlameUnkFC OBJECT_FIELD_F32(0x1D)
#define /*0x0FC*/ oFlameUnusedRand OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oFlameBowser OBJECT_FIELD_OBJ(0x1E)
/* Blue Flame */
@@ -626,7 +626,7 @@
#define /*0x0F4*/ oKoopaRaceEndpointRaceBegun OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oKoopaRaceEndpointKoopaFinished OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oKoopaRaceEndpointRaceStatus OBJECT_FIELD_S32(0x1D)
#define /*0x100*/ oKoopaRaceEndpointUnk100 OBJECT_FIELD_S32(0x1E)
#define /*0x100*/ oKoopaRaceEndpointDialog OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ oKoopaRaceEndpointRaceEnded OBJECT_FIELD_S32(0x1F)
/* Koopa Shell Flame */
@@ -770,10 +770,14 @@
#define /*0x0F8*/ oPitouneUnkF8 OBJECT_FIELD_F32(0x1C)
#define /*0x0FC*/ oPitouneUnkFC OBJECT_FIELD_F32(0x1D)
/* Platform */
#define /*0x0F4*/ oPlatformTimer OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oPlatformUnkF8 OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oPlatformUnkFC OBJECT_FIELD_S32(0x1D)
/* Falling Rising Bitfs Platform */
#define /*0x0F4*/ oBitfsPlatformTimer OBJECT_FIELD_S32(0x1B)
/* Falling Bowser Bits Platform */
#define /*0x0F8*/ oBitsPlatformBowser OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oBitsPlatformTimer OBJECT_FIELD_S32(0x1D)
/* WF Platform */
#define /*0x10C*/ oPlatformUnk10C OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oPlatformUnk110 OBJECT_FIELD_F32(0x22)
@@ -877,7 +881,7 @@
// 0x1D-0x21 reserved for pathing
/* Snowman's Head */
#define /*0x0F4*/ oSnowmansHeadUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oSnowmansHeadDialogActive OBJECT_FIELD_S32(0x1B)
/* Snowman Wind Blowing */
#define /*0x0F4*/ oSLSnowmanWindOriginalYaw OBJECT_FIELD_S32(0x1B)
+2
View File
@@ -6,6 +6,8 @@
#define SEQ_BASE_ID 0x7f
#define SEQ_VARIATION 0x80
#define SEQ_MENU_GAME_OVER (SEQ_MENU_TITLE_SCREEN | SEQ_VARIATION)
enum SeqId {
SEQ_SOUND_PLAYER, // 0x00
SEQ_EVENT_CUTSCENE_COLLECT_STAR, // 0x01
+19 -19
View File
@@ -1,7 +1,7 @@
# Macros for disassembled sequence files. This file was automatically generated by seq_decoder.py.
# To regenerate it, run: ./tools/seq_decoder.py --emit-asm-macros >seq_macros.inc
// Macros for disassembled sequence files. This file was automatically generated by seq_decoder.py.
// To regenerate it, run: ./tools/seq_decoder.py --emit-asm-macros > include/seq_macros.inc
# seq commands
// seq commands
.macro seq_testchdisabled a
.byte 0x0 + \a
@@ -155,7 +155,7 @@
.byte 0xff
.endm
.ifdef VERSION_SH
#ifdef VERSION_SH
.macro seq_unreservenotes
.byte 0xf0
@@ -166,9 +166,9 @@
.byte \a
.endm
.else
#else
.ifdef VERSION_EU
#ifdef VERSION_EU
.macro seq_unreservenotes
.byte 0xf0
@@ -179,7 +179,7 @@
.byte \a
.endm
.else
#else
.macro seq_unreservenotes
.byte 0xf1
@@ -190,11 +190,11 @@
.byte \a
.endm
.endif
#endif
.endif
#endif
# chan commands
// chan commands
.macro chan_startchannel a, b
.byte 0x10 + \a
@@ -462,7 +462,7 @@
var_long \a
.endm
.ifdef VERSION_SH
#ifdef VERSION_SH
.macro chan_setnotepriority a
.byte 0xe9
@@ -495,7 +495,7 @@
.byte 0x90 + \a
.endm
.else
#else
.macro chan_testlayerfinished a
.byte 0x0 + \a
@@ -514,7 +514,7 @@
.byte 0xa0 + \a
.endm
.ifdef VERSION_EU
#ifdef VERSION_EU
.macro chan_setnotepriority a
.byte 0xe9
@@ -530,7 +530,7 @@
.byte \a
.endm
.else
#else
.macro chan_setnotepriority a
.byte 0x60 + \a
@@ -545,11 +545,11 @@
.byte \a
.endm
.endif
#endif
.endif
#endif
# layer commands
// layer commands
.macro layer_note0 a, b, c, d
.byte 0x0 + \a
@@ -659,7 +659,7 @@
.byte \c
.endm
# envelope commands
// envelope commands
.macro envelope_disable a
.byte 0x0, 0x0
@@ -686,7 +686,7 @@
.byte \b >> 8, \b & 0xff
.endm
# other commands
// other commands
.macro var_long x
.byte (0x80 | (\x & 0x7f00) >> 8), (\x & 0xff)
+1 -1
View File
@@ -59,7 +59,7 @@
#define INPUT_A_DOWN 0x0080
#define INPUT_IN_POISON_GAS 0x0100
#define INPUT_IN_WATER 0x0200
#define INPUT_UNKNOWN_10 0x0400
#define INPUT_STOMPED 0x0400
#define INPUT_INTERACT_OBJ_GRABBABLE 0x0800
#define INPUT_UNKNOWN_12 0x1000
#define INPUT_B_PRESSED 0x2000
+1 -1
View File
@@ -386,7 +386,7 @@
#define SOUND_ENV_UNK12 /* 0x40120000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x12, 0x00, 0) // unverified, unused
#define SOUND_ENV_SLIDING /* 0x40130000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x13, 0x00, 0) // unverified
#define SOUND_ENV_STAR /* 0x40140010 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x14, 0x00, SOUND_LOWER_BACKGROUND_MUSIC) // unverified
#define SOUND_ENV_UNKNOWN4 /* 0x41150000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x15, 0x00, SOUND_NO_VOLUME_LOSS) // unverified
#define SOUND_ENV_MOVING_BIG_PLATFORM /* 0x41150000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x15, 0x00, SOUND_NO_VOLUME_LOSS) // unverified
#define SOUND_ENV_WATER_DRAIN /* 0x41160000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x16, 0x00, SOUND_NO_VOLUME_LOSS) // unverified
#define SOUND_ENV_METAL_BOX_PUSH /* 0x40178000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x17, 0x80, 0) // unverified
#define SOUND_ENV_SINK_QUICKSAND /* 0x40188000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x18, 0x80, 0) // unverified
+2 -23
View File
@@ -32,7 +32,7 @@ struct Controller
/*0x14*/ OSContStatus *statusData;
/*0x18*/ OSContPad *controllerData;
#if ENABLE_RUMBLE
/*0x1C*/ int port;
/*0x1C*/ s32 port;
#endif
};
@@ -262,27 +262,6 @@ struct MarioBodyState
u8 padding[4];
};
struct OffsetSizePair
{
u32 offset;
u32 size;
};
struct MarioAnimDmaRelatedThing
{
u32 count;
u8 *srcAddr;
struct OffsetSizePair anim[1]; // dynamic size
};
struct MarioAnimation
{
struct MarioAnimDmaRelatedThing *animDmaTable;
u8 *currentAnimAddr;
struct Animation *targetAnim;
u8 padding[4];
};
struct MarioState
{
/*0x00*/ u16 unk00;
@@ -328,7 +307,7 @@ struct MarioState
/*0x94*/ struct PlayerCameraState *statusForCamera;
/*0x98*/ struct MarioBodyState *marioBodyState;
/*0x9C*/ struct Controller *controller;
/*0xA0*/ struct MarioAnimation *animation;
/*0xA0*/ struct DmaHandlerList *animList;
/*0xA4*/ u32 collidedObjInteractTypes;
/*0xA8*/ s16 numCoins;
/*0xAA*/ s16 numStars;
+8 -8
View File
@@ -8,7 +8,7 @@
#include "game/area.h"
#include "game/level_update.h"
#include "menu/level_select_menu.h"
#include "menu/title_screen.h"
#include "levels/scripts.h"
#include "levels/menu/header.h"
@@ -33,7 +33,7 @@ const LevelScript level_intro_splash_screen[] = {
// Start animation
LOAD_AREA(/*area*/ 1),
CALL(/*arg*/ 0, /*func*/ lvl_intro_update),
CALL(/*arg*/ LVL_INTRO_PLAY_ITS_A_ME_MARIO, /*func*/ lvl_intro_update),
SLEEP(/*frames*/ 75),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00),
SLEEP(/*frames*/ 16),
@@ -64,10 +64,10 @@ const LevelScript level_intro_mario_head_regular[] = {
SLEEP(/*frames*/ 2),
BLACKOUT(/*active*/ FALSE),
LOAD_AREA(/*area*/ 1),
SET_MENU_MUSIC(/*seq*/ 0x0002),
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00),
SLEEP(/*frames*/ 20),
CALL_LOOP(/*arg*/ 1, /*func*/ lvl_intro_update),
CALL_LOOP(/*arg*/ LVL_INTRO_REGULAR, /*func*/ lvl_intro_update),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2),
JUMP(script_intro_L4),
@@ -91,10 +91,10 @@ const LevelScript level_intro_mario_head_dizzy[] = {
SLEEP(/*frames*/ 2),
BLACKOUT(/*active*/ FALSE),
LOAD_AREA(/*area*/ 1),
SET_MENU_MUSIC(/*seq*/ 0x0082),
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_GAME_OVER),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00),
SLEEP(/*frames*/ 20),
CALL_LOOP(/*arg*/ 2, /*func*/ lvl_intro_update),
CALL_LOOP(/*arg*/ LVL_INTRO_GAME_OVER, /*func*/ lvl_intro_update),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2),
JUMP(script_intro_L4),
@@ -113,10 +113,10 @@ const LevelScript level_intro_entry_4[] = {
FREE_LEVEL_POOL(),
LOAD_AREA(/*area*/ 1),
SET_MENU_MUSIC(/*seq*/ 0x0002),
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
SLEEP(/*frames*/ 16),
CALL_LOOP(/*arg*/ 3, /*func*/ lvl_intro_update),
CALL_LOOP(/*arg*/ LVL_INTRO_LEVEL_SELECT, /*func*/ lvl_intro_update),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_intro_L5),
JUMP(script_intro_L3),
};
+1 -1
View File
@@ -43,7 +43,7 @@ const LevelScript level_main_menu_entry_1[] = {
FREE_LEVEL_POOL(),
LOAD_AREA(/*area*/ 1),
SET_MENU_MUSIC(/*seq*/ 0x0021),
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_FILE_SELECT),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
CALL(/*arg*/ 0, /*func*/ lvl_init_menu_values_and_cursor_pos),
CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_file_selected),
+2 -2
View File
@@ -171,7 +171,7 @@ static const LevelScript script_exec_ ## folder [] = { \
const LevelScript script_func_global_1[] = {
LOAD_MODEL_FROM_GEO(MODEL_BLUE_COIN_SWITCH, blue_coin_switch_geo),
LOAD_MODEL_FROM_GEO(MODEL_AMP, amp_geo),
LOAD_MODEL_FROM_GEO(MODEL_AMP, dAmpGeo),
LOAD_MODEL_FROM_GEO(MODEL_PURPLE_SWITCH, purple_switch_geo),
LOAD_MODEL_FROM_GEO(MODEL_CHECKERBOARD_PLATFORM, checkerboard_platform_geo),
LOAD_MODEL_FROM_GEO(MODEL_BREAKABLE_BOX, breakable_box_geo),
@@ -297,7 +297,7 @@ const LevelScript script_func_global_13[] = {
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_SMOKE, bowser_impact_smoke_geo),
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_FLAMES, bowser_flames_geo),
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_WAVE, invisible_bowser_accessory_geo),
LOAD_MODEL_FROM_GEO(MODEL_BOWSER2, bowser2_geo),
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_NO_SHADOW, bowser_geo_no_shadow),
RETURN(),
};
+1 -1
View File
@@ -6,4 +6,4 @@ $(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting MIO0 to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
$(V)$(LD) -r -b binary $< -o $@
+1 -1
View File
@@ -10,4 +10,4 @@ fi
#echo "Replace $1 with $2?"
#read
grep -rl "$1" text/**/*.{c,h} assets/**/*.c enhancements/*.patch lib/**/*.{c,h,s} asm/**/*.s bin/**/*.c data/*.c levels/**/*.{c,h} actors/**/*.c src/**/*.{c,h} include/**/*.{h,in} undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g"
grep -rl "$1" text/**/*.{c,h} assets/**/*.c enhancements/*.patch lib/**/*.{c,h,s} asm/**/*.s bin/**/*.c data/*.c levels/**/*.{c,h} actors/**/*.{c,h} src/**/*.{c,h} include/**/*.{h,in} undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g"
+1 -1
View File
@@ -6,4 +6,4 @@ $(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting RNC1 to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
$(V)$(LD) -r -b binary $< -o $@
+1 -1
View File
@@ -6,4 +6,4 @@ $(BUILD_DIR)/%.szp: $(BUILD_DIR)/%.bin
# convert binary szp to object file
$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.szp
$(call print,Converting RNC2 to ELF:,$<,$@)
$(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@
$(V)$(LD) -r -b binary $< -o $@
+20 -20
View File
@@ -53,15 +53,15 @@ dispatchTable:
jumpTableEntry cmd_SPNOOP
jumpTableEntry cmd_SETLOOP
jumpTableEntry cmd_17e4
jumpTableEntry cmd_INTERL
jumpTableEntry cmd_DMEMMOVE2
jumpTableEntry cmd_DOWNSAMPLE_HALF
jumpTableEntry cmd_ENVSETUP1
jumpTableEntry cmd_ENVMIXER
jumpTableEntry cmd_LOADBUFF
jumpTableEntry cmd_SAVEBUFF
jumpTableEntry cmd_ENVSETUP2
jumpTableEntry cmd_1b78
jumpTableEntry cmd_S8DEC
jumpTableEntry cmd_HILOGAIN
jumpTableEntry cmd_1c7c
@@ -938,12 +938,12 @@ cmd_RESAMPLE:
.endif
addi $8, $8, -8
.ifdef VERSION_SH
sdv $v16[0], 0x00($8)
sdv $v16[0], 0x00($8)
.endif
@@audio_c410c:
lsv $v23[14], 0x08($23) // saved pitch_accumulator
.ifdef VERSION_SH
ldv $v16[0], 0x00($8)
ldv $v16[0], 0x00($8)
.else
ldv $v16[0], 0x00($23) // saved next 4 unprocessed samples
sdv $v16[0], 0x00($8) // store them before the input samples
@@ -1100,8 +1100,8 @@ cmd_RESAMPLE:
mtc0 $zero, SP_SEMAPHORE
.ifdef VERSION_SH
cmd_17e4:
srl $t7, $k0, 16
cmd_DMEMMOVE2:
srl $t7, $k0, 16
andi $t7, $t7, 0xff
andi $t5, $k0, 0xffff
srl $t6, $t9, 0x10
@@ -1150,7 +1150,7 @@ cmd_DUPLICATE:
j cmd_SPNOOP
nop
cmd_INTERL:
cmd_DOWNSAMPLE_HALF:
andi $t4, $k0, 0xffff
andi $t6, $t9, 0xffff
srl $t5, $t9, 0x10
@@ -1606,24 +1606,24 @@ cmd_MIXER:
j cmd_SPNOOP
nop
cmd_1b78:
lhu $13, 0x0(r24)
cmd_S8DEC:
lhu $13, (audio_in_buf)(r24)
vxor $v2, $v2, $v2
lhu $14, 0x2(r24)
lhu $14, (audio_out_buf)(r24)
vxor $v3, $v3, $v3
lhu $12, 0x4(r24)
lhu $12, (audio_count)(r24)
sll $17, $25, 8
srl $17, $17, 8
sqv $v2[0], 0x0(r14)
srl $17, $17, 8 // state addr
sqv $v2[0], 0x0(r14) // store 0 to first 16 samples if A_INIT
sqv $v3[0], 0x10(r14)
srl $1, $26, 16
andi $1, $1, 0x1
bgtz $1, @audio_4001bd8
bgtz $1, @audio_4001bd8 // A_INIT
srl $1, $26, 16
andi $1, $1, 0x2
beq $0, $1, @audio_4001bbc
beq $0, $1, @audio_4001bbc // A_LOOP
addi $2, $17, 0x0
lw $2, 0x10(r24)
lw $2, (audio_loop_value)(r24)
@audio_4001bbc:
addi $1, $14, 0x0
jal dma_read_start
@@ -1635,10 +1635,10 @@ cmd_1b78:
mtc0 $0, sp_semaphore
@audio_4001bd8:
addi $14, $14, 0x20
beq $12, $0, @audio_4001c04
beq $12, $0, @audio_4001c04 // this of very few ops allows count=0
nop
@audio_4001be4:
lpv $v2[0], 0x0(r13)
lpv $v2[0], 0x0(r13) // load each byte to upper 8 bits per elem
lpv $v3[0], 0x8(r13)
addi $13, $13, 0x10
addi $12, $12, 0xffe0
@@ -1647,7 +1647,7 @@ cmd_1b78:
bgtz $12, @audio_4001be4
addi $14, $14, 0x20
@audio_4001c04:
addi $1, $14, 0xffe0
addi $1, $14, 0xffe0 // write last 16 samples to the state
addi $2, $17, 0x0
jal dma_write_start
addi $3, $0, 0x1f
-2
View File
@@ -238,7 +238,6 @@ SECTIONS
__expansionRamStart = 0x80400000;
ASSERT((. <= __expansionRamStart), "Error: RDRAM expanded into Expansion RAM, despite Expansion RAM not being defined.")
BEGIN_SEG(entry, 0x10000000)
{
BUILD_DIR/levels/entry.o(.data);
@@ -333,7 +332,6 @@ SECTIONS
ASSERT((. <= (SEG_POOL_START + POOL_SIZE)), "Error: extended past pool end.")
/* 0x268020 0x268020-0 [0] */
BEGIN_SEG(intro, 0x14000000)
{
+129 -126
View File
@@ -1,22 +1,16 @@
.include "seq_macros.inc"
#include "seq_macros.inc"
.section .rodata
.align 0
sequence_start:
.ifdef VERSION_SH
.set VERSION_EU_SH, 1
.endif
.ifdef VERSION_EU
.set VERSION_EU_SH, 1
.endif
seq_setmutebhv 0x60
seq_setmutescale 0
.ifdef VERSION_SH
#ifdef VERSION_SH
seq_setvol 100
.else
#else
seq_setvol 127
.endif
#endif
seq_settempo 120
seq_initchannels 0x3ff
seq_startchannel 0, .channel0
@@ -77,7 +71,7 @@ chan_stereoheadseteffects 1
chan_setdyntable .channel59_table
chan_jump .main_loop_023589
# Main loop for standard, non-continuous sound effects
// Main loop for standard, non-continuous sound effects
.main_loop_023589:
chan_delay1
chan_ioreadval 0
@@ -91,17 +85,17 @@ chan_iowriteval 5
chan_ioreadval 4
chan_dyncall
# keep looping until layer 0 finishes or we are told to stop or to play something else
// keep looping until layer 0 finishes or we are told to stop or to play something else
.poll_023589:
chan_delay1
chan_ioreadval 0
chan_bltz .skip_023589 # if we have a signal:
chan_beqz .force_stop_023589 # told to stop
chan_jump .start_playing_023589 # told to play something else
chan_bltz .skip_023589 // if we have a signal:
chan_beqz .force_stop_023589 // told to stop
chan_jump .start_playing_023589 // told to play something else
.skip_023589:
chan_testlayerfinished 0
chan_beqz .poll_023589 # if layer 0 hasn't finished, keep polling
chan_jump .main_loop_023589 # otherwise go back to the main loop
chan_beqz .poll_023589 // if layer 0 hasn't finished, keep polling
chan_jump .main_loop_023589 // otherwise go back to the main loop
.force_stop_023589:
chan_freelayer 0
chan_freelayer 1
@@ -144,7 +138,7 @@ chan_stereoheadseteffects 1
chan_setdyntable .channel6_table
chan_jump .main_loop_146
# Main loop for moving, env and air sound effects, which play continuously
// Main loop for moving, env and air sound effects, which play continuously
.main_loop_146:
chan_delay1
chan_ioreadval 0
@@ -159,7 +153,7 @@ chan_iowriteval 5
chan_ioreadval 4
chan_dyncall
# keep looping until we are told to stop or to play something else
// keep looping until we are told to stop or to play something else
.poll_146:
chan_delay1
chan_ioreadval 0
@@ -181,7 +175,7 @@ chan_iowriteval 5
chan_stereoheadseteffects 1
chan_setdyntable .channel7_table
# Loop for menu sound effects
// Loop for menu sound effects
.main_loop_7:
chan_delay1
chan_ioreadval 0
@@ -198,19 +192,19 @@ chan_setpanmix 127
chan_ioreadval 4
chan_dyncall
# keep looping until layer 0 finishes or we are told to stop or to play something else
// keep looping until layer 0 finishes or we are told to stop or to play something else
.poll_7:
chan_delay1
chan_ioreadval 0
chan_bltz .skip_7 # if we have a signal:
chan_beqz .force_stop_7 # told to stop
chan_bltz .skip_7 // if we have a signal:
chan_beqz .force_stop_7 // told to stop
chan_unreservenotes
chan_jump .start_playing_7 # told to play something else
chan_jump .start_playing_7 // told to play something else
.skip_7:
chan_testlayerfinished 0
chan_beqz .poll_7 # if layer 0 hasn't finished, keep polling
chan_beqz .poll_7 // if layer 0 hasn't finished, keep polling
chan_unreservenotes
chan_jump .main_loop_7 # otherwise go back to the main loop
chan_jump .main_loop_7 // otherwise go back to the main loop
.force_stop_7:
chan_freelayer 0
chan_freelayer 1
@@ -218,7 +212,7 @@ chan_freelayer 2
chan_unreservenotes
chan_jump .main_loop_7
# Delay for a number of ticks (1-255) in an interruptible manner.
// Delay for a number of ticks (1-255) in an interruptible manner.
.delay:
chan_writeseq_nextinstr 0, 1
chan_loop 20
@@ -233,15 +227,15 @@ chan_end
chan_setpanmix 127
chan_setvolscale 127
chan_setvibratoextent 0
chan_ioreadval 1 # IO slots 0-3 are reset to -1 when read; restore the value
chan_ioreadval 1 // IO slots 0-3 are reset to -1 when read; restore the value
chan_iowriteval 0
chan_break # break out of the loop
chan_break # force the caller to return immediately
chan_break // break out of the loop
chan_break // force the caller to return immediately
chan_end
# Set reverb in way that takes area echo level and volume into account. This
# is done by writing to IO slot 5 and letting get_sound_reverb in external.c
# do the necessary math.
// Set reverb in way that takes area echo level and volume into account. This
// is done by writing to IO slot 5 and letting get_sound_reverb in external.c
// do the necessary math.
.set_reverb:
chan_writeseq_nextinstr 0, 1
chan_setreverb 10
@@ -342,15 +336,15 @@ sound_ref .sound_action_bounce_off_object
sound_ref .chan_7ED
sound_ref .sound_action_read_sign
sound_ref .chan_810
.ifdef VERSION_JP
#ifdef VERSION_JP
sound_ref .sound_action_jump_default
sound_ref .sound_action_jump_default
sound_ref .sound_action_jump_default
.else
#else
sound_ref .chan_828
sound_ref .sound_action_intro_unk45e
sound_ref .sound_action_intro_unk45f
.endif
#endif
sound_ref .sound_action_heavy_landing_default
sound_ref .sound_action_heavy_landing_grass
sound_ref .sound_action_heavy_landing_water
@@ -988,7 +982,7 @@ layer_portamento 0x81, 42, 255
layer_note1 37, 0x1e, 105
layer_end
.sound_action_climb_down_tree: # unused
.sound_action_climb_down_tree: // unused
chan_setbank 0
chan_setinstr 1
chan_setlayer 0, .layer_579
@@ -999,7 +993,7 @@ layer_portamento 0x81, 44, 255
layer_note1 40, 0xb4, 100
layer_end
.chan_582: # unused
.chan_582: // unused
chan_setbank 0
chan_setinstr 2
chan_setlayer 0, .layer_58A
@@ -1418,8 +1412,8 @@ layer_note1 39, 0xa, 127
layer_note1 42, 0x8, 127
layer_end
.ifndef VERSION_JP
.chan_828: # unused
#ifndef VERSION_JP
.chan_828: // unused
chan_setbank 7
chan_setinstr 3
chan_setlayer 0, .layer_83C
@@ -1464,7 +1458,7 @@ layer_end
.layer_871:
layer_transpose 8
layer_jump .layer_776
.endif
#endif
.sound_action_heavy_landing_default:
chan_call .heavy_landing_common
@@ -2029,7 +2023,7 @@ sound_ref .sound_mario_punch_wah
sound_ref .sound_mario_uh
sound_ref .sound_mario_hrmm
sound_ref .sound_mario_wah2
.ifdef VERSION_JP
#ifdef VERSION_JP
sound_ref .sound_mario_jump_hoo
sound_ref .sound_mario_jump_hoo
sound_ref .sound_mario_jump_hoo
@@ -2046,7 +2040,7 @@ sound_ref .sound_mario_wah2
sound_ref .sound_mario_jump_hoo
sound_ref .sound_mario_jump_hoo
sound_ref .sound_mario_jump_hoo
.else
#else
sound_ref .sound_peach_dear_mario
sound_ref .sound_mario_jump_hoo
sound_ref .sound_mario_jump_hoo
@@ -2071,7 +2065,7 @@ sound_ref .sound_mario_wah2
sound_ref .sound_peach_bake_a_cake
sound_ref .sound_peach_for_mario
sound_ref .sound_peach_mario2
.endif
#endif
.sound_mario_jump_hoo:
chan_setbank 8
@@ -2080,9 +2074,9 @@ chan_setlayer 0, .layer_C3C
chan_end
.layer_C3C:
.ifdef VERSION_EU_SH
#if defined(VERSION_EU) || defined(VERSION_SH)
layer_transpose 2
.endif
#endif
layer_portamento 0x82, 41, 127
layer_note1 37, 0x14, 127
layer_end
@@ -2119,9 +2113,9 @@ chan_setlayer 0, .layer_C6C
chan_end
.layer_C6C:
.ifdef VERSION_EU_SH
#if defined(VERSION_EU) || defined(VERSION_SH)
layer_transpose 1
.endif
#endif
layer_portamento 0x82, 44, 200
layer_note1 39, 0x30, 127
layer_end
@@ -2482,7 +2476,7 @@ chan_end
layer_transpose -1
layer_jump .layer_C4E
.ifndef VERSION_JP
#ifndef VERSION_JP
.sound_peach_dear_mario:
chan_setbank 10
chan_setinstr 15
@@ -2697,9 +2691,9 @@ layer_jump .layer_C4E
.layer_F8A:
layer_note1 39, 0x50, 127
layer_end
.endif
#endif
.ifdef VERSION_EU_SH
#if defined(VERSION_EU) || defined(VERSION_SH)
.chan_unused_F9A_eu:
chan_setbank 8
chan_setinstr 0
@@ -2709,7 +2703,7 @@ layer_jump .layer_C4E
.layer_FA2_eu:
layer_delay 0x5
layer_end
.endif
#endif
.channel38_table:
sound_ref .sound_general_activate_cap_switch
@@ -2830,7 +2824,7 @@ sound_ref .sound_general_boing3
sound_ref .sound_general_grand_star
sound_ref .sound_general_grand_star_jump
sound_ref .sound_general_boat_rock
.ifdef VERSION_JP
#ifdef VERSION_JP
sound_ref .sound_menu_enter_hole
sound_ref .sound_menu_enter_hole
sound_ref .sound_menu_enter_hole
@@ -2841,7 +2835,7 @@ sound_ref .sound_general_boat_rock
sound_ref .sound_general_bubbles
sound_ref .sound_menu_enter_hole
sound_ref .sound_menu_enter_hole
.else
#else
sound_ref .sound_general_vanish_sfx
sound_ref .sound_menu_enter_hole
sound_ref .sound_general_red_coin
@@ -2852,7 +2846,7 @@ sound_ref .sound_general_boat_rock
sound_ref .sound_general_boing2
sound_ref .sound_general_yoshi_walk
sound_ref .sound_general_enemy_alert1
.endif
#endif
.sound_general_activate_cap_switch:
chan_setbank 5
@@ -3408,17 +3402,17 @@ chan_setbank 9
chan_setinstr 3
chan_setval 40
chan_call .set_reverb
.ifdef VERSION_SH
#ifdef VERSION_SH
chan_setreverb 40
.endif
#endif
chan_setlayer 0, .layer_141A
chan_end
.layer_141A:
layer_transpose 24
.ifdef VERSION_SH
#ifdef VERSION_SH
layer_note1 51, 0xc, 90
.endif
#endif
layer_note1 39, 0x4, 90
layer_note1 51, 0xc, 90
layer_note1 39, 0x4, 50
@@ -3487,18 +3481,18 @@ layer_end
.sound_general_chain_chomp2:
chan_setbank 7
.ifdef VERSION_JP
#ifdef VERSION_JP
chan_setinstr 8
.else
#else
chan_setinstr 14
.endif
#endif
chan_setval 15
chan_call .set_reverb
chan_setlayer 0, .layer_14C6
chan_setlayer 1, .layer_14E3
.ifndef VERSION_JP
#ifndef VERSION_JP
chan_setlayer 2, .layer_14E3
.endif
#endif
chan_setval 1
chan_call .delay
chan_setenvelope .envelope_3368
@@ -3507,11 +3501,11 @@ chan_setinstr 7
chan_setval 13
chan_call .delay
chan_setbank 7
.ifdef VERSION_JP
#ifdef VERSION_JP
chan_setinstr 8
.else
#else
chan_setinstr 14
.endif
#endif
chan_end
.layer_14C6:
@@ -3527,12 +3521,12 @@ layer_end
.layer_14E3:
layer_loop 2
.ifdef VERSION_JP
#ifdef VERSION_JP
layer_portamento 0x81, 36, 255
layer_note1 24, 0x18, 127
.else
#else
layer_note1 34, 0x19, 100
.endif
#endif
layer_loopend
layer_end
@@ -4154,24 +4148,27 @@ layer_note1 31, 0x14, 127
layer_end
.sound_general_red_coin:
.ifdef VERSION_JP
#ifdef VERSION_JP
chan_setbank 9
chan_setinstr 3
chan_setlayer 0, .layer_1909
chan_setlayer 1, .layer_1902
chan_setlayer 2, .layer_1907
.else
.ifdef VERSION_EU_SH
#else
#if defined(VERSION_EU) || defined(VERSION_SH)
chan_setbank 9
chan_setinstr 3
.else
#else
chan_setinstr 128
.endif
#endif
chan_setenvelope .envelope_3378
// Small bugfix: .main_loop_023589 expects layer 0 to live the longest.
// I don't think this actually makes any audible difference given the
// silence at the end.
chan_setlayer 0, .layer_1907
chan_setlayer 1, .layer_1902
chan_setlayer 2, .layer_1909
.endif
#endif
chan_end
.layer_1902:
@@ -4191,6 +4188,12 @@ layer_note0 58, 0x10, 100, 80
layer_note0 58, 0x10, 60, 80
layer_note0 58, 0x10, 40, 80
layer_note0 58, 0x10, 25, 80
// This small delay should not have any effect, but decreases the probability of
// encountering double red coin glitch. Without it, layer 0 finishes in 1.04
// seconds, and with some bad luck around scheduling/lag the sound spawner with
// a lifetime of 30 frames that creates the sound may deactivate on the same
// frame. That leads to double sound glitch on JP, see src/audio/external.c.
// With the delay, the same thing can still happen but requires more CPU lag.
layer_delay 0xa
layer_end
@@ -4422,7 +4425,7 @@ layer_portamento 0x81, 36, 40
layer_note1 41, 0xc, 127
layer_end
.ifdef VERSION_JP
#ifdef VERSION_JP
.sound_general_boat_rock:
chan_setbank 9
chan_setinstr 0
@@ -4438,7 +4441,7 @@ layer_end
layer_portamento 0x1, 32, 0x7f
layer_note1 60, 0x28, 100
layer_end
.else
#else
.sound_general_boat_rock:
chan_setbank 4
chan_setinstr 2
@@ -4476,7 +4479,7 @@ layer_end
layer_portamento 0x81, 19, 255
layer_note1 31, 0x32, 115
layer_end
.endif
#endif
.channel4_table:
sound_ref .sound_env_waterfall1
@@ -4525,21 +4528,21 @@ chan_setbank 5
chan_setinstr 1
chan_setval 25
chan_call .set_reverb
.ifdef VERSION_JP
#ifdef VERSION_JP
chan_setenvelope .envelope_32E4
.else
#else
chan_setenvelope .envelope_32C4
.endif
#endif
chan_setlayer 0, .layer_1B53
chan_end
.layer_1B53:
layer_somethingon
.ifdef VERSION_JP
#ifdef VERSION_JP
layer_delay 0x6
.else
#else
layer_delay 0x4
.endif
#endif
.layer_1B56:
layer_note1 41, 0x12c, 95
layer_jump .layer_1B56
@@ -4694,11 +4697,11 @@ chan_end
.layer_1C69:
layer_portamento 0x81, 15, 255
.ifdef VERSION_JP
#ifdef VERSION_JP
layer_note1 11, 0x1f4, 100
.else
#else
layer_note1 11, 0x1f4, 127
.endif
#endif
layer_end
.sound_env_elevator3:
@@ -5374,11 +5377,11 @@ chan_end
.layer_20D2:
layer_portamento 0x81, 44, 255
.ifdef VERSION_JP
#ifdef VERSION_JP
layer_note1 36, 0x18, 90
.else
#else
layer_note1 36, 0x18, 115
.endif
#endif
layer_delay 0x32
layer_end
@@ -5398,13 +5401,13 @@ layer_note1 31, 0x26, 127
layer_end
.layer_20F4:
.ifdef VERSION_JP
#ifdef VERSION_JP
layer_note1 38, 0x8, 120
layer_note1 33, 0x1e, 120
.else
#else
layer_note1 38, 0x8, 127
layer_note1 33, 0x1e, 127
.endif
#endif
layer_end
.sound_obj_bully_metal:
@@ -6989,7 +6992,7 @@ sound_ref .sound_menu_thank_you_playing_my_game
sound_ref .sound_menu_read_a_sign
sound_ref .sound_menu_exit_a_sign
sound_ref .sound_menu_mario_castle_warp2
.ifdef VERSION_JP
#ifdef VERSION_JP
sound_ref .sound_menu_message_next_page
sound_ref .sound_menu_coin_its_a_me_mario
sound_ref .sound_menu_yoshi_gain_lives
@@ -7003,7 +7006,7 @@ sound_ref .sound_menu_mario_castle_warp2
sound_ref .sound_menu_mario_castle_warp
sound_ref .sound_menu_star_sound
sound_ref .sound_menu_change_select
.else
#else
sound_ref .sound_menu_star_sound_okey_dokey
sound_ref .sound_menu_star_sound_lets_a_go
sound_ref .sound_menu_yoshi_gain_lives
@@ -7033,7 +7036,7 @@ sound_ref .sound_menu_mario_castle_warp2
sound_ref .sound_menu_power_meter
sound_ref .sound_menu_camera_buzz
sound_ref .sound_menu_camera_turn
.endif
#endif
.sound_menu_change_select:
chan_setbank 9
@@ -7506,13 +7509,13 @@ layer_end
chan_reservenotes 4
chan_setbank 9
chan_setinstr 2
.ifdef VERSION_SH
#ifdef VERSION_SH
chan_setval 15
.set EXIT_PIPE_NOTE_VELOCITY, 106
.else
#else
chan_setval 30
.set EXIT_PIPE_NOTE_VELOCITY, 126
.endif
#endif
chan_call .set_reverb
chan_setenvelope .envelope_3464
chan_setdecayrelease 220
@@ -7774,7 +7777,7 @@ chan_setlayer 0, .layer_3041
chan_setlayer 1, .layer_2FC9
chan_end
.ifndef VERSION_JP
#ifndef VERSION_JP
.sound_menu_star_sound_okey_dokey:
chan_setbank 4
chan_setinstr 14
@@ -7828,33 +7831,33 @@ chan_end
.layer_3146:
layer_delay 0x6
.ifdef VERSION_SH
#ifdef VERSION_SH
.set RED_COIN_NOTE_VELOCITY_SUB, 10
.else
#else
.set RED_COIN_NOTE_VELOCITY_SUB, 0
.endif
#endif
.layer_3148:
layer_call .transpose_by_coin_index
layer_note0 46, 0xc, 75 - RED_COIN_NOTE_VELOCITY_SUB, 20
layer_note0 45, 0xc, 75 - RED_COIN_NOTE_VELOCITY_SUB, 20
layer_note0 46, 0xc, 75 - RED_COIN_NOTE_VELOCITY_SUB, 20
layer_note0 58, 0x10, 80 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 58, 0x10, 45 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 58, 0x10, 20 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 58, 0x10, 15 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 46, 0xc, (75 - RED_COIN_NOTE_VELOCITY_SUB), 20
layer_note0 45, 0xc, (75 - RED_COIN_NOTE_VELOCITY_SUB), 20
layer_note0 46, 0xc, (75 - RED_COIN_NOTE_VELOCITY_SUB), 20
layer_note0 58, 0x10, (80 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_note0 58, 0x10, (45 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_note0 58, 0x10, (20 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_note0 58, 0x10, (15 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_end
.layer_3168:
layer_call .transpose_by_coin_index
layer_note0 41, 0xc, 75 - RED_COIN_NOTE_VELOCITY_SUB, 20
layer_note0 40, 0xc, 75 - RED_COIN_NOTE_VELOCITY_SUB, 20
layer_note0 41, 0xc, 75 - RED_COIN_NOTE_VELOCITY_SUB, 20
layer_note0 53, 0x10, 80 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 53, 0x10, 45 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 53, 0x10, 20 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 53, 0x10, 15 - RED_COIN_NOTE_VELOCITY_SUB, 80
layer_note0 41, 0xc, (75 - RED_COIN_NOTE_VELOCITY_SUB), 20
layer_note0 40, 0xc, (75 - RED_COIN_NOTE_VELOCITY_SUB), 20
layer_note0 41, 0xc, (75 - RED_COIN_NOTE_VELOCITY_SUB), 20
layer_note0 53, 0x10, (80 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_note0 53, 0x10, (45 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_note0 53, 0x10, (20 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_note0 53, 0x10, (15 - RED_COIN_NOTE_VELOCITY_SUB), 80
layer_end
.transpose_by_coin_index:
@@ -7877,7 +7880,7 @@ chan_end
layer_transpose 0
layer_note1 32, 0x7f, 115
layer_end
.endif
#endif
.sound_general_bird_chirp2:
chan_setbank 5
@@ -8084,14 +8087,14 @@ envelope_line 1 32700
envelope_line 10 0
envelope_goto 2
.ifndef VERSION_JP
#ifndef VERSION_JP
.envelope_3378:
envelope_line 3 32700
envelope_line 10 30000
envelope_line 10 10000
envelope_line 100 0
envelope_goto 3
.endif
#endif
.envelope_338C:
envelope_line 1 32700
@@ -8150,11 +8153,11 @@ envelope_goto 2
.envelope_341C:
envelope_line 25 32760
envelope_line 60 10000
.ifdef VERSION_SH
#ifdef VERSION_SH
envelope_hang
.else
#else
envelope_goto 2
.endif
#endif
.envelope_3428:
envelope_line 1 10000
-6
View File
@@ -877,12 +877,6 @@ u16 unk_sh_data_4[] = {
0x5FFF, 0x9001,
0x7FFF, 0x8001
};
char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
char shindouDebugPrint2[] = "S->W\n";
char shindouDebugPrint3[] = "W->S\n";
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
// These debug prints are continued in shindou_debug_prints_1.c.
#endif
#ifndef VERSION_SH
+32 -22
View File
@@ -484,15 +484,9 @@ void unused_8031E4F0(void) {
stubbed_printf("\n");
stubbed_printf("BNK ");
#ifdef VERSION_SH
#define count 1
#else
#define count 4
#endif
for (i = 0; i < 40; i += count) {
for (i = 0; i < 40; i += 4) {
stubbed_printf("%1x", 0);
}
#undef count
stubbed_printf("\n");
stubbed_printf("FIXHEAP ");
@@ -1148,8 +1142,8 @@ static void select_current_sounds(u8 bank) {
}
/**
* Given an x and z coordinates, return the pan. This is a value between 0 and
* 1 that represents the audio direction.
* Given x and z coordinates, return the pan. This is a value nominally between
* 0 and 1 that represents the audio direction.
*
* Pan:
* 0.0 - fully left
@@ -1183,12 +1177,17 @@ static f32 get_sound_pan(f32 x, f32 z) {
pan = US_FLOAT(0.5);
} else if (x >= US_FLOAT(0.0) && absX >= absZ) {
// far right pan
pan = US_FLOAT(1.0) - (US_FLOAT(44000.0) - absX) / (US_FLOAT(3.0) * (US_FLOAT(44000.0) - absZ));
pan = US_FLOAT(1.0) - (2 * AUDIO_MAX_DISTANCE - absX) / (US_FLOAT(3.0) * (2 * AUDIO_MAX_DISTANCE - absZ));
} else if (x < 0 && absX > absZ) {
// far left pan
pan = (US_FLOAT(44000.0) - absX) / (US_FLOAT(3.0) * (US_FLOAT(44000.0) - absZ));
pan = (2 * AUDIO_MAX_DISTANCE - absX) / (US_FLOAT(3.0) * (2 * AUDIO_MAX_DISTANCE - absZ));
} else {
// center pan
//! @bug (JP PU sound glitch) If |x|, |z| > AUDIO_MAX_DISTANCE, we'll
// end up in this case, and pan may be set to something outside of [0,1]
// since x is not clamped. On JP, this can lead to an out-of-bounds
// float read in note_set_vel_pan_reverb when x is highly negative,
// causing console crashes when that float is a nan or denormal.
pan = 0.5 + x / (US_FLOAT(6.0) * absZ);
}
@@ -1234,6 +1233,8 @@ static f32 get_sound_volume(u8 bank, u8 soundIndex, f32 volumeRange) {
if (sSoundBanks[bank][soundIndex].soundBits & SOUND_VIBRATO) {
#ifdef VERSION_JP
//! @bug Intensity is 0 when the sound is far away. Due to the subtraction below, it is possible to end up with a negative intensity.
// When it is, objects with a volumeRange of 1 can still occasionally be lightly heard.
if (intensity != 0.0)
#else
if (intensity >= 0.08f)
@@ -1435,7 +1436,7 @@ static void update_game_sound(void) {
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
get_sound_reverb(bank, soundIndex, channelIndex));
#else
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
get_sound_reverb(bank, soundIndex, channelIndex);
#endif
@@ -1476,7 +1477,7 @@ static void update_game_sound(void) {
*sSoundBanks[bank][soundIndex].z);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
get_sound_freq_scale(bank, soundIndex);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
get_sound_reverb(bank, soundIndex, channelIndex);
#endif
break;
@@ -1499,7 +1500,7 @@ static void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bank, soundIndex));
#else
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
get_sound_reverb(bank, soundIndex, channelIndex);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2);
@@ -1515,6 +1516,13 @@ static void update_game_sound(void) {
#ifdef VERSION_JP
// If the sound was marked for deletion (bits set to NO_SOUND), then stop playing it
// and delete it
// @bug (JP double red coin sound) If the sound finished within the same frame as
// being marked for deletion, the signal to stop playing will be interpreted as a
// signal to *start* playing, as .main_loop_023589 in 00_sound_player does not check
// for soundScriptIO[0] being zero. This happens most commonly for red coin sounds
// whose sound spawners deactivate 30 frames after the sound starts to play, while
// the sound itself runs for 1.20 seconds. With enough lag these may coincide.
// Fixed on US by checking that layer0->finished is FALSE.
else if (soundStatus == SOUND_STATUS_STOPPED) {
update_background_music_after_sound(bank, soundIndex);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0;
@@ -1526,17 +1534,19 @@ static void update_game_sound(void) {
sSoundBanks[bank][soundIndex].soundStatus = SOUND_STATUS_STOPPED;
delete_sound_from_bank(bank, soundIndex);
} else if (soundStatus == SOUND_STATUS_STOPPED
&& gSequencePlayers[SEQ_PLAYER_SFX]
.channels[channelIndex]
->layers[0]
->finished
== FALSE) {
&& gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]
->layers[0]->finished == FALSE) {
update_background_music_after_sound(bank, soundIndex);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0;
delete_sound_from_bank(bank, soundIndex);
}
#endif
// If sound has finished playing, then delete it
// @bug (JP sound glitch) On JP, ...->layers[0] has not been checked for null,
// so this access can crash if an earlier layer allocation failed due to too
// many sounds playing at once. This crash is comparatively common; RTA
// speedrunners even have a setup for avoiding it within the SSL pyramid:
// https://www.youtube.com/watch?v=QetyTgbQxcw
else if (gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0]->enabled
== FALSE) {
update_background_music_after_sound(bank, soundIndex);
@@ -1610,7 +1620,7 @@ static void update_game_sound(void) {
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
get_sound_reverb(bank, soundIndex, channelIndex));
#else
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
get_sound_reverb(bank, soundIndex, channelIndex);
#endif
@@ -1651,7 +1661,7 @@ static void update_game_sound(void) {
*sSoundBanks[bank][soundIndex].z);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
get_sound_freq_scale(bank, soundIndex);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
get_sound_reverb(bank, soundIndex, channelIndex);
#endif
break;
@@ -1674,7 +1684,7 @@ static void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bank, soundIndex));
#else
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
get_sound_reverb(bank, soundIndex, channelIndex);
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2);
-3
View File
@@ -25,9 +25,6 @@ extern f32 gGlobalSoundSource[3];
extern u32 gAudioRandom;
struct SPTask *create_next_audio_frame_task(void);
#ifdef VERSION_SH
struct SPTask *func_sh_802f5a80(void);
#endif
void play_sound(s32 soundBits, f32 *pos);
void audio_signal_game_loop_tick(void);
void seq_player_fade_out(u8 player, u16 fadeDuration);
+7 -9
View File
@@ -204,8 +204,6 @@ void discard_bank(s32 bankId) {
#if defined(VERSION_EU)
if (note->noteSubEu.bankId == bankId) {
#elif defined(VERSION_SH)
if (note->unkSH33 == bankId) {
#else
if (note->bankId == bankId) {
#endif
@@ -384,7 +382,7 @@ void temporary_pools_init(struct PoolSplit *a) {
#undef SOUND_ALLOC_FUNC
#if defined(VERSION_JP) || defined(VERSION_US)
static void unused_803163D4(void) {
UNUSED static void unused_803163D4(void) {
}
#endif
@@ -512,7 +510,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
if (poolIdx == 1) {
if (firstVal == SOUND_LOAD_STATUS_4) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (gNotes[i].unkSH33 == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
if (gNotes[i].bankId == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
break;
}
}
@@ -525,7 +523,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
}
if (secondVal == SOUND_LOAD_STATUS_4) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (gNotes[i].unkSH33 == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
if (gNotes[i].bankId == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
break;
}
}
@@ -591,7 +589,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
} else if (poolIdx == 1) {
if (firstVal == SOUND_LOAD_STATUS_COMPLETE) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (gNotes[i].unkSH33 == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
if (gNotes[i].bankId == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
break;
}
}
@@ -602,7 +600,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
}
if (secondVal == SOUND_LOAD_STATUS_COMPLETE) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (gNotes[i].unkSH33 == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
if (gNotes[i].bankId == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
break;
}
}
@@ -1684,7 +1682,7 @@ void func_sh_802f23ec(void) {
s32 i;
s32 idx;
s32 seqCount;
u32 bankId1; // non symmetric fake match? can also change 0xff to 0xffU for same effect
s32 bankId1;
s32 bankId2;
s32 instId;
s32 drumId;
@@ -1697,7 +1695,7 @@ void func_sh_802f23ec(void) {
for (idx = 0; idx < seqCount; idx++) {
bankId1 = gCtlEntries[idx].bankId1;
bankId2 = gCtlEntries[idx].bankId2;
if ((bankId1 != 0xff && entry->bankId == bankId1) || (bankId2 != 0xff && entry->bankId == bankId2) || entry->bankId == 0) {
if ((bankId1 != 0xffu && entry->bankId == bankId1) || (bankId2 != 0xff && entry->bankId == bankId2) || entry->bankId == 0) {
if (get_bank_or_seq(1, 3, idx) != NULL) {
if (IS_BANK_LOAD_COMPLETE(idx) != FALSE) {
for (i = 0; i < gUnkPool2.numEntries; i++) {
+2
View File
@@ -131,12 +131,14 @@ void audio_reset_session(void);
#else
void audio_reset_session(struct AudioSessionSettings *preset);
#endif
void discard_bank(s32 bankId);
#ifdef VERSION_SH
void fill_filter(s16 filter[8], s32 arg1, s32 arg2);
u8 *func_sh_802f1d40(u32 size, s32 bank, u8 *arg2, s8 medium);
u8 *func_sh_802f1d90(u32 size, s32 bank, u8 *arg2, s8 medium);
void *unk_pool1_lookup(s32 poolIdx, s32 id);
void *unk_pool1_alloc(s32 poolIndex, s32 arg1, u32 size);
#endif
#endif // AUDIO_HEAP_H
+29 -20
View File
@@ -41,6 +41,11 @@
#define TATUMS_PER_BEAT 48
// abi.h contains more details about the ADPCM and S8 codecs, "skip" skips codec processing
#define CODEC_ADPCM 0
#define CODEC_S8 1
#define CODEC_SKIP 2
#ifdef VERSION_JP
#define TEMPO_SCALE 1
#else
@@ -378,8 +383,8 @@ union ReverbBits {
/* 0x00 */ u8 asByte;
};
struct ReverbInfo {
u8 reverb;
u8 bankId;
u8 reverbVol;
u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
u8 pan;
union ReverbBits reverbBits;
f32 freqScale;
@@ -390,9 +395,9 @@ struct ReverbInfo {
struct NoteAttributes
{
u8 reverb;
u8 reverbVol;
#ifdef VERSION_SH
u8 unk1;
u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
#endif
#if defined(VERSION_EU) || defined(VERSION_SH)
u8 pan;
@@ -435,7 +440,7 @@ struct SequenceChannel
#endif
/*0x01, 0x02*/ u8 noteAllocPolicy;
/*0x02, 0x03, 0x03*/ u8 muteBehavior;
/*0x03, 0x04, 0x04*/ u8 reverb; // or dry/wet mix
/*0x03, 0x04, 0x04*/ u8 reverbVol; // until EU: Q1.7, after EU: UQ0.8
/*0x04, ????*/ u8 notePriority; // 0-3
#ifdef VERSION_SH
u8 unkSH06; // some priority
@@ -450,7 +455,7 @@ struct SequenceChannel
/*0x06, */ u8 updatesPerFrameUnused;
#endif
#ifdef VERSION_SH
/* 0x0C*/ u8 unkSH0C; // bankId
/* 0x0C*/ u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
#endif
/*0x08, 0x0C, 0x0E*/ u16 vibratoRateStart; // initially 0x800
/*0x0A, 0x0E, 0x10*/ u16 vibratoExtentStart;
@@ -526,7 +531,7 @@ struct SequenceChannelLayer
// 0..0x3f; this makes 0x40..0x7f accessible as well)
/*0x20, 0x24, 0x24*/ f32 freqScale;
#ifdef VERSION_SH
/* 0x28*/ f32 unkSH28;
/* 0x28*/ f32 freqScaleMultiplier;
#endif
/*0x24, 0x28, 0x2C*/ f32 velocitySquare;
#if defined(VERSION_JP) || defined(VERSION_US)
@@ -567,8 +572,8 @@ struct NoteSynthesisState
/*0x04, 0x06*/ u16 samplePosFrac;
/*0x08*/ s32 samplePosInt;
/*0x0C*/ struct NoteSynthesisBuffers *synthesisBuffers;
/*0x10*/ s16 curVolLeft;
/*0x12*/ s16 curVolRight;
/*0x10*/ s16 curVolLeft; // UQ0.16 (EU Q1.15)
/*0x12*/ s16 curVolRight; // UQ0.16 (EU Q1.15)
};
struct NotePlaybackState
{
@@ -577,7 +582,7 @@ struct NotePlaybackState
/* 0x01, 0x01*/ u8 waveId;
/* 0x02, 0x02*/ u8 sampleCountIndex;
#ifdef VERSION_SH
/* 0x03*/ u8 unkSH33; // bankId?
/* 0x03*/ u8 bankId;
/* 0x04*/ u8 unkSH34;
#endif
/*0x08, 0x04, 0x06*/ s16 adsrVolScale;
@@ -605,12 +610,16 @@ struct NoteSubEu
/*0x01*/ u8 bookOffset : 3;
/*0x01*/ u8 isSyntheticWave : 1;
/*0x01*/ u8 hasTwoAdpcmParts : 1;
#ifdef VERSION_EU
/*0x02*/ u8 bankId;
#else
/*0x02*/ u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
#endif
/*0x03*/ u8 headsetPanRight;
/*0x04*/ u8 headsetPanLeft;
/*0x05*/ u8 reverbVol;
/*0x06*/ u16 targetVolLeft;
/*0x08*/ u16 targetVolRight;
/*0x05*/ u8 reverbVol; // UQ0.7 (EU Q1.7)
/*0x06*/ u16 targetVolLeft; // UQ0.12 (EU UQ0.10)
/*0x08*/ u16 targetVolRight; // UQ0.12 (EU UQ0.10)
/*0x0A*/ u16 resamplingRateFixedPoint; // stored as signed but loaded as u16
/*0x0C*/ union {
s16 *samples;
@@ -638,7 +647,7 @@ struct Note
/* 0x31, 0x31*/ u8 waveId;
/* 0x32, 0x32*/ u8 sampleCountIndex;
#ifdef VERSION_SH
/* 0x33*/ u8 unkSH33; // bankId?
/* 0x33*/ u8 bankId;
/* 0x34*/ u8 unkSH34;
#endif
/*0x08, 0x34, 0x36*/ s16 adsrVolScale;
@@ -696,17 +705,17 @@ struct Note
/*0x30, 0x48*/ struct SequenceChannelLayer *wantedParentLayer;
/*0x34*/ struct NoteSynthesisBuffers *synthesisBuffers;
/*0x38*/ f32 frequency;
/*0x3C*/ u16 targetVolLeft;
/*0x3E*/ u16 targetVolRight;
/*0x40*/ u8 reverb;
/*0x3C*/ u16 targetVolLeft; // Q1.15, but will always be non-negative
/*0x3E*/ u16 targetVolRight; // Q1.15, but will always be non-negative
/*0x40*/ u8 reverbVol; // Q1.7
/*0x41*/ u8 unused1; // never read, set to 0x3f
/*0x44*/ struct NoteAttributes attributes;
/*0x54, 0x58*/ struct AdsrState adsr;
/*0x74, 0x7C*/ struct Portamento portamento;
/*0x84, 0x8C*/ struct VibratoState vibratoState;
/*0x9C*/ s16 curVolLeft;
/*0x9E*/ s16 curVolRight;
/*0xA0*/ s16 reverbVol;
/*0x9C*/ s16 curVolLeft; // Q1.15, but will always be non-negative
/*0x9E*/ s16 curVolRight; // Q1.15, but will always be non-negative
/*0xA0*/ s16 reverbVolShifted; // Q1.15
/*0xA2*/ s16 unused2; // never read, set to 0
/*0xA4, 0x00*/ struct AudioListItem listItem;
/* */ u8 pad2[0xc];
+44 -1485
View File
File diff suppressed because it is too large. Load diff
+12 -5
View File
@@ -89,18 +89,25 @@ void patch_audio_bank(s32 bankId, struct AudioBank *mem, struct PatchStruct *pat
#else
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums);
#endif
#ifndef VERSION_SH
#ifdef VERSION_SH
void preload_sequence(u32 seqId, s32 preloadMask);
#else
void preload_sequence(u32 seqId, u8 preloadMask);
#endif
void load_sequence(u32 player, u32 seqId, s32 loadAsync);
#ifdef VERSION_SH
void func_sh_802f3158(s32 index, s32 arg1, s32 arg2, OSMesgQueue *retQueue);
u8 *func_sh_802f3220(u32 index, u32 *a1);
void func_sh_802f3158(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue *retQueue);
u8 *func_sh_802f3220(u32 seqId, u32 *a1);
struct AudioBankSample *func_sh_802f4978(s32 bankId, s32 idx);
void *func_802f3f08(s32 poolIdx, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue *retQueue);
s32 func_sh_802f3368(s32 arg0);
s32 func_sh_802f47c8(s32 bankId, u8 idx, s8 *io);
void *func_sh_802f3f08(s32 poolIdx, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue *retQueue);
void func_sh_802f41e4(s32 audioResetStatus);
BAD_RETURN(s32) func_sh_802f3368(s32 bankId);
void *func_sh_802f3764(s32 arg0, s32 idx, s32 *arg2);
s32 func_sh_802f3024(s32 bankId, s32 instId, s32 arg2);
void func_sh_802f30f4(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue *arg3);
void func_sh_802f3288(s32 idx);
#endif
+1637
View File
File diff suppressed because it is too large. Load diff
+26 -25
View File
@@ -15,7 +15,7 @@ void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput);
#ifdef VERSION_SH
void note_set_vel_pan_reverb(struct Note *note, struct ReverbInfo *reverbInfo)
#else
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverbVol)
#endif
{
struct NoteSubEu *sub = &note->noteSubEu;
@@ -30,7 +30,7 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
UNUSED u32 pad1;
f32 velocity;
u8 pan;
u8 reverb;
u8 reverbVol;
struct ReverbBitsData reverbBits;
#endif
@@ -38,7 +38,7 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
note_set_resampling_rate(note, reverbInfo->freqScale);
velocity = reverbInfo->velocity;
pan = reverbInfo->pan;
reverb = reverbInfo->reverb;
reverbVol = reverbInfo->reverbVol;
reverbBits = reverbInfo->reverbBits.s;
pan &= 0x7f;
#else
@@ -119,7 +119,7 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
}
#ifdef VERSION_SH
if (velocity < 0.0f) {
if (velocity < 0.0f) {
velocity = 0.0f;
}
if (velocity > 1.0f) {
@@ -128,7 +128,7 @@ if (velocity < 0.0f) {
sub->targetVolLeft = ((s32) (velocity * volLeft * 4095.999f));
sub->targetVolRight = ((s32) (velocity * volRight * 4095.999f));
sub->bankId = reverbInfo->bankId;
sub->synthesisVolume = reverbInfo->synthesisVolume;
sub->filter = reverbInfo->filter;
#else
if (velocity < 0.0f) {
@@ -144,11 +144,12 @@ if (velocity < 0.0f) {
sub->targetVolRight = ((s32) (velocity * volRight) & 0xffff) >> 5;
#endif
if (sub->reverbVol != reverb) {
//! @bug for the change to UQ0.7, the if statement should also have been changed accordingly
if (sub->reverbVol != reverbVol) {
#ifdef VERSION_SH
sub->reverbVol = reverb >> 1;
sub->reverbVol = reverbVol >> 1;
#else
sub->reverbVol = reverb;
sub->reverbVol = reverbVol;
#endif
sub->envMixerNeedsInit = TRUE;
return;
@@ -345,7 +346,7 @@ void process_notes(void) {
#ifndef VERSION_SH
f32 frequency;
#if defined(VERSION_JP) || defined(VERSION_US)
u8 reverb;
u8 reverbVol;
#endif
f32 velocity;
#if defined(VERSION_JP) || defined(VERSION_US)
@@ -359,11 +360,11 @@ void process_notes(void) {
struct NoteSubEu *noteSubEu;
#ifndef VERSION_SH
UNUSED u8 pad[12];
u8 reverb;
u8 reverbVol;
UNUSED u8 pad3;
u8 pan;
#else
u8 pad[8];
UNUSED u8 pad[8];
struct ReverbInfo reverbInfo;
#endif
u8 bookOffset;
@@ -508,9 +509,9 @@ void process_notes(void) {
reverbInfo.freqScale = attributes->freqScale;
reverbInfo.velocity = attributes->velocity;
reverbInfo.pan = attributes->pan;
reverbInfo.reverb = attributes->reverb;
reverbInfo.reverbVol = attributes->reverbVol;
reverbInfo.reverbBits = attributes->reverbBits;
reverbInfo.bankId = attributes->unk1;
reverbInfo.synthesisVolume = attributes->synthesisVolume;
reverbInfo.filter = attributes->filter;
bookOffset = noteSubEu->bookOffset;
} else {
@@ -518,8 +519,8 @@ void process_notes(void) {
reverbInfo.velocity = playbackState->parentLayer->noteVelocity;
reverbInfo.pan = playbackState->parentLayer->notePan;
reverbInfo.reverbBits = playbackState->parentLayer->reverbBits;
reverbInfo.reverb = playbackState->parentLayer->seqChannel->reverb;
reverbInfo.bankId = playbackState->parentLayer->seqChannel->unkSH0C;
reverbInfo.reverbVol = playbackState->parentLayer->seqChannel->reverbVol;
reverbInfo.synthesisVolume = playbackState->parentLayer->seqChannel->synthesisVolume;
reverbInfo.filter = playbackState->parentLayer->seqChannel->filter;
bookOffset = playbackState->parentLayer->seqChannel->bookOffset & 0x7;
if (playbackState->parentLayer->seqChannel->seqPlayer->muted
@@ -538,7 +539,7 @@ void process_notes(void) {
frequency = attributes->freqScale;
velocity = attributes->velocity;
pan = attributes->pan;
reverb = attributes->reverb;
reverbVol = attributes->reverbVol;
if (1) {
}
bookOffset = noteSubEu->bookOffset;
@@ -546,7 +547,7 @@ void process_notes(void) {
frequency = playbackState->parentLayer->noteFreqScale;
velocity = playbackState->parentLayer->noteVelocity;
pan = playbackState->parentLayer->notePan;
reverb = playbackState->parentLayer->seqChannel->reverb;
reverbVol = playbackState->parentLayer->seqChannel->reverbVol;
bookOffset = playbackState->parentLayer->seqChannel->bookOffset & 0x7;
}
@@ -554,7 +555,7 @@ void process_notes(void) {
frequency *= gAudioBufferParameters.resampleRate;
velocity = velocity * scale * scale;
note_set_resampling_rate(note, frequency);
note_set_vel_pan_reverb(note, velocity, pan, reverb);
note_set_vel_pan_reverb(note, velocity, pan, reverbVol);
#endif
noteSubEu->bookOffset = bookOffset;
skip:;
@@ -603,12 +604,12 @@ void process_notes(void) {
frequency = attributes->freqScale;
velocity = attributes->velocity;
pan = attributes->pan;
reverb = attributes->reverb;
reverbVol = attributes->reverbVol;
} else {
frequency = note->parentLayer->noteFreqScale;
velocity = note->parentLayer->noteVelocity;
pan = note->parentLayer->notePan;
reverb = note->parentLayer->seqChannel->reverb;
reverbVol = note->parentLayer->seqChannel->reverbVol;
}
scale = note->adsrVolScale;
@@ -621,7 +622,7 @@ void process_notes(void) {
scale *= 4.3498e-5f; // ~1 / 23000
velocity = velocity * scale * scale;
note_set_frequency(note, frequency);
note_set_vel_pan_reverb(note, velocity, pan, reverb);
note_set_vel_pan_reverb(note, velocity, pan, reverbVol);
continue;
}
#endif
@@ -746,9 +747,9 @@ void seq_channel_layer_decay_release_internal(struct SequenceChannelLayer *seqLa
attributes->reverbBits = seqLayer->reverbBits;
#endif
if (seqLayer->seqChannel != NULL) {
attributes->reverb = seqLayer->seqChannel->reverb;
attributes->reverbVol = seqLayer->seqChannel->reverbVol;
#ifdef VERSION_SH
attributes->unk1 = seqLayer->seqChannel->unkSH0C;
attributes->synthesisVolume = seqLayer->seqChannel->synthesisVolume;
attributes->filter = seqLayer->seqChannel->filter;
if (seqLayer->seqChannel->seqPlayer->muted && (seqLayer->seqChannel->muteBehavior & 8) != 0) {
note->noteSubEu.finished = TRUE;
@@ -1159,7 +1160,7 @@ void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLaye
build_synthetic_wave(note, seqLayer, instId);
}
#ifdef VERSION_SH
note->unkSH33 = seqLayer->seqChannel->bankId;
note->bankId = seqLayer->seqChannel->bankId;
#else
sub->bankId = seqLayer->seqChannel->bankId;
#endif
@@ -1444,7 +1445,7 @@ void note_init_all(void) {
#if defined(VERSION_EU) || defined(VERSION_SH)
note->waveId = 0;
#else
note->reverb = 0;
note->reverbVol = 0;
note->usesHeadsetPanEffects = FALSE;
note->sampleCount = 0;
note->instOrWave = 0;
+1 -1
View File
@@ -33,7 +33,7 @@ void note_init_all(void);
#if defined(VERSION_SH)
void note_set_vel_pan_reverb(struct Note *note, struct ReverbInfo *reverbInfo);
#elif defined(VERSION_EU)
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb);
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverbVol);
#endif
#if defined(VERSION_EU) || defined(VERSION_SH)
+1 -2
View File
@@ -34,7 +34,6 @@ extern struct EuAudioCmd sAudioCmd[0x100];
void func_8031D690(s32 player, FadeT fadeInTime);
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime);
void port_eu_init_queues(void);
void decrease_sample_dma_ttls(void);
s32 audio_shut_down_and_reset_step(void);
void func_802ad7ec(u32);
@@ -305,7 +304,7 @@ void func_802ad7ec(u32 arg0) {
chan->changes.as_bitfields.freqScale = TRUE;
break;
case 5:
chan->reverb = cmd->u2.as_s8;
chan->reverbVol = cmd->u2.as_s8;
break;
case 6:
if (cmd->u.s.arg3 < 8) {
@@ -1,4 +1,5 @@
#ifdef VERSION_SH
// TODO: merge this with port_eu.c?
#include <ultra64.h>
@@ -7,6 +8,7 @@
#include "load.h"
#include "synthesis.h"
#include "internal.h"
#include "seqplayer.h"
#define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x80
#define SAMPLES_TO_OVERPRODUCE 0x10
@@ -15,12 +17,13 @@ extern s32 D_SH_80314FC8;
extern struct SPTask *D_SH_80314FCC;
extern u8 D_SH_80315098;
extern u8 D_SH_8031509C;
extern OSMesgQueue *D_SH_80350F68;
void func_sh_802f62e0(s32 playerIndex, s32 numFrames);
void func_sh_802f6288(s32 arg0, s32 numFrames);
void func_sh_802f6554(u32 arg0);
void func_8031D690(s32 playerIndex, s32 numFrames);
void seq_player_fade_to_zero_volume(s32 arg0, s32 numFrames);
void func_802ad7ec(u32 arg0);
struct SPTask *func_sh_802f5a80(void) {
struct SPTask *create_next_audio_frame_task(void) {
u32 samplesRemainingInAI;
s32 writtenCmds;
s32 index;
@@ -59,7 +62,7 @@ struct SPTask *func_sh_802f5a80(void) {
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
func_802f41e4(gAudioResetStatus);
func_sh_802f41e4(gAudioResetStatus);
if (osRecvMesg(D_SH_80350F88, (OSMesg *) &sp38, OS_MESG_NOBLOCK) != -1) {
if (gAudioResetStatus == 0) {
gAudioResetStatus = 5;
@@ -99,7 +102,7 @@ struct SPTask *func_sh_802f5a80(void) {
if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) {
do {
func_sh_802f6554(sp34);
func_802ad7ec(sp34);
} while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1);
}
@@ -143,7 +146,7 @@ struct SPTask *func_sh_802f5a80(void) {
}
}
void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
s32 i;
struct Note *note;
struct NoteSubEu *sub;
@@ -155,8 +158,8 @@ void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
case 0x82:
case 0x88:
func_sh_802F3410(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_sh_802f62e0(cmd->u.s.arg1, cmd->u2.as_s32);
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x83:
@@ -165,7 +168,7 @@ void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
}
else {
func_sh_802f6288(cmd->u.s.arg1, cmd->u2.as_s32);
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
}
}
break;
@@ -220,32 +223,32 @@ void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
}
}
void func_sh_802f6288(s32 arg0, s32 numFrames) {
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
struct SequencePlayer *player;
if (numFrames == 0) {
numFrames = 1;
if (fadeOutTime == 0) {
fadeOutTime = 1;
}
player = &gSequencePlayers[arg0];
player->state = 2;
player->fadeRemainingFrames = numFrames;
player->fadeVelocity = -(player->fadeVolume / (f32) numFrames);
player->fadeRemainingFrames = fadeOutTime;
player->fadeVelocity = -(player->fadeVolume / (f32) fadeOutTime);
}
void func_sh_802f62e0(s32 playerIndex, s32 numFrames) {
void func_8031D690(s32 playerIndex, s32 fadeInTime) {
struct SequencePlayer *player;
if (numFrames != 0) {
if (fadeInTime != 0) {
player = &gSequencePlayers[playerIndex];
player->state = 1;
player->fadeTimerUnkEu = numFrames;
player->fadeRemainingFrames = numFrames;
player->fadeTimerUnkEu = fadeInTime;
player->fadeRemainingFrames = fadeInTime;
player->fadeVolume = 0.0f;
player->fadeVelocity = 0.0f;
}
}
void func_sh_802f6330(void) {
void port_eu_init_queues(void) {
D_SH_80350F18 = 0;
D_SH_80350F19 = 0;
D_SH_80350F38 = &D_SH_80350F20;
@@ -258,8 +261,8 @@ void func_sh_802f6330(void) {
osCreateMesgQueue(D_SH_80350FA8, D_SH_80350F8C, 1);
}
extern struct EuAudioCmd sAudioCmd[0x100]; // sAudioCmd, maybe?
void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8
extern struct EuAudioCmd sAudioCmd[0x100];
void func_802ad6f0(s32 arg0, s32 *arg1) {
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
@@ -269,34 +272,30 @@ void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8
}
}
void func_802ad728(u32 arg0, f32 arg1) { // func_sh_802f6450
void func_802ad728(u32 arg0, f32 arg1) {
func_802ad6f0(arg0, (s32 *) &arg1);
}
void func_802ad74c(u32 arg0, u32 arg1) { // func_sh_802f6474
void func_802ad74c(u32 arg0, u32 arg1) {
func_802ad6f0(arg0, (s32 *) &arg1);
}
void func_802ad770(u32 arg0, s8 arg1) { // func_sh_802f6498
void func_802ad770(u32 arg0, s8 arg1) {
s32 sp1C = arg1 << 24;
func_802ad6f0(arg0, &sp1C);
}
char shindouDebugPrint133[] = "AudioSend: %d -> %d (%d)\n";
extern OSMesgQueue *D_SH_80350F68;
void func_sh_802F64C8(void) {
static s32 D_SH_8031503C = 0;
s32 a0 = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff;
s32 a1;
s32 mesg;
if (D_SH_8031503C < a0) {
D_SH_8031503C = a0;
if (((D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff) > D_SH_8031503C) {
D_SH_8031503C = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff;
}
a0 = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xFF);
a1 = a0;
a0 = D_SH_80350F68;
osSendMesg(a0, a1, 0);
mesg = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xff);
osSendMesg(D_SH_80350F68, (OSMesg)mesg, OS_MESG_NOBLOCK);
D_SH_80350F19 = D_SH_80350F18;
}
@@ -304,16 +303,16 @@ void func_sh_802f6540(void) {
D_SH_80350F19 = D_SH_80350F18;
}
void func_sh_802f6554(u32 arg0) {
void func_802ad7ec(u32 arg0) {
struct EuAudioCmd *cmd;
struct SequencePlayer *seqPlayer;
struct SequenceChannel *chan;
u8 a0;
u8 end;
static char shindouDebugPrint134[] = "Continue Port\n";
static char shindouDebugPrint135[] = "%d -> %d\n";
static char shindouDebugPrint136[] = "Sync-Frame Break. (Remain %d)\n";
static char shindouDebugPrint137[] = "Undefined Port Command %d\n";
UNUSED static char shindouDebugPrint134[] = "Continue Port\n";
UNUSED static char shindouDebugPrint135[] = "%d -> %d\n";
UNUSED static char shindouDebugPrint136[] = "Sync-Frame Break. (Remain %d)\n";
UNUSED static char shindouDebugPrint137[] = "Undefined Port Command %d\n";
static u8 D_SH_80315098 = 0;
static u8 D_SH_8031509C = 0;
@@ -322,10 +321,10 @@ void func_sh_802f6554(u32 arg0) {
D_SH_80315098 = (arg0 >> 8) & 0xff;
}
a0 = arg0 & 0xff;
end = arg0 & 0xff;
for (;;) {
if (D_SH_80315098 == a0) {
if (D_SH_80315098 == end) {
D_SH_8031509C = 0;
break;
}
@@ -336,12 +335,12 @@ void func_sh_802f6554(u32 arg0) {
break;
}
else if ((cmd->u.s.op & 0xf0) == 0xf0) {
func_sh_802f5fb8(cmd);
eu_process_audio_cmd(cmd);
}
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
if ((cmd->u.s.op & 0x80) != 0) {
func_sh_802f5fb8(cmd);
eu_process_audio_cmd(cmd);
}
else if ((cmd->u.s.op & 0x40) != 0) {
switch (cmd->u.s.op) {
@@ -399,8 +398,9 @@ void func_sh_802f6554(u32 arg0) {
}
break;
case 5:
if (chan->reverb != cmd->u2.as_s8) {
chan->reverb = cmd->u2.as_s8;
//! @bug u8 s8 comparison (but harmless)
if (chan->reverbVol != cmd->u2.as_s8) {
chan->reverbVol = cmd->u2.as_s8;
}
break;
case 6:
@@ -489,9 +489,8 @@ s8 func_sh_802f6a6c(s32 playerIndex, s32 index) {
return gSequencePlayers[playerIndex].seqVariationEu[index];
}
void func_sh_802f6a9c(void) {
// creates a bunch of os message queues
func_sh_802f6330();
void port_eu_init(void) {
port_eu_init_queues();
}
char shindouDebugPrint138[] = "specchg conjunction error (Msg:%d Cur:%d)\n";
@@ -525,9 +524,13 @@ char shindouDebugPrint164[] = "Audio: C-Alloc : lowerPrio is NULL\n";
char shindouDebugPrint165[] = "Intterupt UseStop %d (Kill %d)\n";
char shindouDebugPrint166[] = "Intterupt RelWait %d (Kill %d)\n";
char shindouDebugPrint167[] = "Drop Voice (Prio %x)\n";
s32 D_SH_803154CC = 0; // Either an unused variable or a file boundary.
s32 D_SH_803154CC = 0; // file boundary
// effects.c
char shindouDebugPrint168[] = "Audio:Envp: overflow %f\n";
s32 D_SH_803154EC = 0; // Either an unused variable or a file boundary.
s32 D_SH_803154EC = 0; // file boundary
// seqplayer.c
char shindouDebugPrint169[] = "Audio:Track:Warning: No Free Notetrack\n";
char shindouDebugPrint170[] = "SUBTRACK DIM\n";
char shindouDebugPrint171[] = "Audio:Track: Warning :SUBTRACK had been stolen by other Group.\n";
+12 -12
View File
@@ -55,9 +55,9 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) {
seqChannel->panChannelWeight = 1.0f;
seqChannel->noteUnused = NULL;
#endif
seqChannel->reverb = 0;
seqChannel->reverbVol = 0;
#ifdef VERSION_SH
seqChannel->unkSH0C = 0;
seqChannel->synthesisVolume = 0;
#endif
seqChannel->notePriority = NOTE_PRIORITY_DEFAULT;
#ifdef VERSION_SH
@@ -142,7 +142,7 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) {
layer->freqScale = 1.0f;
layer->velocitySquare = 0.0f;
#ifdef VERSION_SH
layer->unkSH28 = 1.0f;
layer->freqScaleMultiplier = 1.0f;
#endif
layer->instOrWave = 0xff;
#else
@@ -989,7 +989,7 @@ void seq_channel_layer_process_script_part1(struct SequenceChannelLayer *layer)
}
s32 seq_channel_layer_process_script_part5(struct SequenceChannelLayer *layer, s32 cmd) {
if (!layer->stopSomething && layer->sound != NULL && layer->sound->sample->codec == 2 &&
if (!layer->stopSomething && layer->sound != NULL && layer->sound->sample->codec == CODEC_SKIP &&
layer->sound->sample->medium != 0) {
layer->stopSomething = TRUE;
return -1;
@@ -1176,7 +1176,7 @@ s32 seq_channel_layer_process_script_part2(struct SequenceChannelLayer *layer) {
case 0xce:
cmd = m64_read_u8(state) + 0x80;
layer->unkSH28 = unk_sh_data_1[cmd];
layer->freqScaleMultiplier = unk_sh_data_1[cmd];
// missing break :)
default:
@@ -1320,7 +1320,7 @@ s32 seq_channel_layer_process_script_part4(struct SequenceChannelLayer *layer, s
}
}
layer->delayUnused = layer->delay;
layer->freqScale *= layer->unkSH28;
layer->freqScale *= layer->freqScaleMultiplier;
return sameSound;
}
@@ -1828,7 +1828,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
#endif
case 0xd4: // chan_setreverb
seqChannel->reverb = m64_read_u8(state);
seqChannel->reverbVol = m64_read_u8(state);
break;
case 0xc6: // chan_setbank; switch bank within set
@@ -1972,8 +1972,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
seqChannel->transposition = (s8) *seqData++;
seqChannel->newPan = *seqData++;
seqChannel->panChannelWeight = *seqData++;
seqChannel->reverb = *seqData++;
seqChannel->reverbIndex = *seqData++; // reverb index?
seqChannel->reverbVol = *seqData++;
seqChannel->reverbIndex = *seqData++;
seqChannel->changes.as_bitfields.pan = TRUE;
break;
@@ -1984,7 +1984,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
seqChannel->transposition = (s8) m64_read_u8(state);
seqChannel->newPan = m64_read_u8(state);
seqChannel->panChannelWeight = m64_read_u8(state);
seqChannel->reverb = m64_read_u8(state);
seqChannel->reverbVol = m64_read_u8(state);
seqChannel->reverbIndex = m64_read_u8(state);
seqChannel->changes.as_bitfields.pan = TRUE;
break;
@@ -2016,7 +2016,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
#endif
#ifdef VERSION_SH
case 0xed:
seqChannel->unkSH0C = m64_read_u8(state);
seqChannel->synthesisVolume = m64_read_u8(state);
break;
case 0xef:
@@ -2112,7 +2112,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
case 0x10:
seqChannel->soundScriptIO[loBits] = -1;
if (func_802f47c8(seqChannel->bankId, (u8)value, &seqChannel->soundScriptIO[loBits]) == -1) {
if (func_sh_802f47c8(seqChannel->bankId, (u8)value, &seqChannel->soundScriptIO[loBits]) == -1) {
}
break;
#else
+12 -2
View File
@@ -1,7 +1,14 @@
#include <ultra64.h>
#ifdef VERSION_SH
// The first four debug prints are in data.c.
// synthesis.c
char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
char shindouDebugPrint2[] = "S->W\n";
char shindouDebugPrint3[] = "W->S\n";
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
s32 shindouDebugPrintPadding1[] = {0,0,0};
// heap.c
char shindouDebugPrint5[] = "Warning:Kill Note %x \n";
char shindouDebugPrint6[] = "Kill Voice %d (ID %d) %d\n";
char shindouDebugPrint7[] = "Warning: Running Sequence's data disappear!\n";
@@ -58,8 +65,9 @@ char shindouDebugPrint57[] = "Request--------Single-Stay, %d\n";
char shindouDebugPrint58[] = "Try Kill %d \n";
char shindouDebugPrint59[] = "Try Kill %x %x\n";
char shindouDebugPrint60[] = "Try Kill %x %x %x\n";
// Zero padding here. These aren't used variables, so they could be either unused variables or a file boundary.
s32 shindouDebugPrintPadding[] = {0, 0, 0};
// load.c
char shindouDebugPrint61[] = "CAUTION:WAVE CACHE FULL %d";
char shindouDebugPrint62[] = "SUPERDMA";
char shindouDebugPrint63[] = "Bank Change... top %d lba %d\n";
@@ -124,6 +132,8 @@ char shindouDebugPrint121[] = "N start %d\n";
char shindouDebugPrint122[] = "============Error: Magic is Broken: %x\n";
char shindouDebugPrint123[] = "Error: No Handle.\n";
char shindouDebugPrint124[] = "Success: %x\n";
// port_eu.c
char shindouDebugPrint125[] = "DAC:Lost 1 Frame.\n";
char shindouDebugPrint126[] = "DMA: Request queue over.( %d )\n";
char shindouDebugPrint127[] = "Spec Change Override. %d -> %d\n";
+100 -776
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -90,7 +90,7 @@ extern s16 D_SH_803479B4;
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen);
#if defined(VERSION_JP) || defined(VERSION_US)
void note_init_volume(struct Note *note);
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb);
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverbVol);
void note_set_frequency(struct Note *note, f32 frequency);
void note_enable(struct Note *note);
void note_disable(struct Note *note);
+910
View File
@@ -0,0 +1,910 @@
#ifdef VERSION_SH
#include <ultra64.h>
#include "synthesis.h"
#include "heap.h"
#include "data.h"
#include "load.h"
#include "seqplayer.h"
#include "internal.h"
#include "external.h"
#define DMEM_ADDR_TEMP 0x450
#define DMEM_ADDR_RESAMPLED 0x470
#define DMEM_ADDR_RESAMPLED2 0x5f0
#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x5f0
#define DMEM_ADDR_NOTE_PAN_TEMP 0x650
#define DMEM_ADDR_COMPRESSED_ADPCM_DATA 0x990
#define DMEM_ADDR_LEFT_CH 0x990
#define DMEM_ADDR_RIGHT_CH 0xb10
#define DMEM_ADDR_WET_LEFT_CH 0xc90
#define DMEM_ADDR_WET_RIGHT_CH 0xe10
#define aSetLoadBufferPair(pkt, c, off) \
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_LEFT_CH, 0, DEFAULT_LEN_1CH - c); \
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.left + (off))); \
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_RIGHT_CH, 0, DEFAULT_LEN_1CH - c); \
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)))
#define aSetSaveBufferPair(pkt, c, d, off) \
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_LEFT_CH, d); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.left + (off))); \
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_RIGHT_CH, d); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)));
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
struct VolumeChange {
u16 sourceLeft;
u16 sourceRight;
u16 targetLeft;
u16 targetRight;
};
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex);
u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex);
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad);
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags);
u64 *process_envelope(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, u32 flags);
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight);
struct SynthesisReverb gSynthesisReverbs[4];
u8 sAudioSynthesisPad[0x10];
s16 gVolume;
s8 gUseReverb;
s8 gNumSynthesisReverbs;
s16 D_SH_803479B4; // contains 4096
struct NoteSubEu *gNoteSubsEu;
// Equivalent functionality as the US/JP version,
// just that the reverb structure is chosen from an array with index
// Identical in EU.
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex) {
struct ReverbRingBufferItem *item;
struct SynthesisReverb *reverb = &gSynthesisReverbs[reverbIndex];
s32 srcPos;
s32 dstPos;
s32 nSamples;
s32 excessiveSamples;
s32 UNUSED pad[3];
if (reverb->downsampleRate != 1) {
if (reverb->framesLeftToIgnore == 0) {
// Now that the RSP has finished, downsample the samples produced two frames ago by skipping
// samples.
item = &reverb->items[reverb->curFrame][updateIndex];
// Touches both left and right since they are adjacent in memory
osInvalDCache(item->toDownsampleLeft, DEFAULT_LEN_2CH);
for (srcPos = 0, dstPos = 0; dstPos < item->lengthA / 2;
srcPos += reverb->downsampleRate, dstPos++) {
reverb->ringBuffer.left[item->startPos + dstPos] =
item->toDownsampleLeft[srcPos];
reverb->ringBuffer.right[item->startPos + dstPos] =
item->toDownsampleRight[srcPos];
}
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += reverb->downsampleRate, dstPos++) {
reverb->ringBuffer.left[dstPos] = item->toDownsampleLeft[srcPos];
reverb->ringBuffer.right[dstPos] = item->toDownsampleRight[srcPos];
}
}
}
item = &reverb->items[reverb->curFrame][updateIndex];
nSamples = chunkLen / reverb->downsampleRate;
excessiveSamples = (nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
if (excessiveSamples < 0) {
// There is space in the ring buffer before it wraps around
item->lengthA = nSamples * 2;
item->lengthB = 0;
item->startPos = (s32) reverb->nextRingBufferPos;
reverb->nextRingBufferPos += nSamples;
} else {
// Ring buffer wrapped around
item->lengthA = (nSamples - excessiveSamples) * 2;
item->lengthB = excessiveSamples * 2;
item->startPos = reverb->nextRingBufferPos;
reverb->nextRingBufferPos = excessiveSamples;
}
// These fields are never read later
item->numSamplesAfterDownsampling = nSamples;
item->chunkLen = chunkLen;
}
u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 len, s32 reverbIndex) {
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[srcOffset]),
addr, len);
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[srcOffset]),
addr + DEFAULT_LEN_1CH, len);
return cmd;
}
u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 len, s32 reverbIndex) {
aSaveBuffer(cmd++, addr,
VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[destOffset]), len);
aSaveBuffer(cmd++, addr + DEFAULT_LEN_1CH,
VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[destOffset]), len);
return cmd;
}
void func_sh_802ed644(s32 updateIndexStart, s32 noteIndex) {
s32 i;
for (i = updateIndexStart + 1; i < gAudioBufferParameters.updatesPerFrame; i++) {
if (!gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].needsInit) {
gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].enabled = FALSE;
} else {
break;
}
}
}
void synthesis_load_note_subs_eu(s32 updateIndex) {
struct NoteSubEu *src;
struct NoteSubEu *dest;
s32 i;
for (i = 0; i < gMaxSimultaneousNotes; i++) {
src = &gNotes[i].noteSubEu;
dest = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (src->enabled) {
*dest = *src;
src->needsInit = FALSE;
} else {
dest->enabled = FALSE;
}
}
}
// TODO: (Scrub C) pointless mask and whitespace
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
s32 i, j;
u32 *aiBufPtr;
u64 *cmd = cmdBuf;
s32 chunkLen;
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
process_sequences(i - 1);
synthesis_load_note_subs_eu(gAudioBufferParameters.updatesPerFrame - i);
}
aiBufPtr = (u32 *) aiBuf;
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
if (i == 1) {
chunkLen = bufLen;
} else {
if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax) {
chunkLen = gAudioBufferParameters.samplesPerUpdateMax;
} else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin) {
chunkLen = gAudioBufferParameters.samplesPerUpdateMin;
} else {
chunkLen = gAudioBufferParameters.samplesPerUpdate;
}
}
for (j = 0; j < gNumSynthesisReverbs; j++) {
if (gSynthesisReverbs[j].useReverb != 0) {
prepare_reverb_ring_buffer(chunkLen, gAudioBufferParameters.updatesPerFrame - i, j);
}
}
cmd = synthesis_do_one_audio_update((s16 *) aiBufPtr, chunkLen, cmd, gAudioBufferParameters.updatesPerFrame - i);
bufLen -= chunkLen;
aiBufPtr += chunkLen;
}
for (j = 0; j < gNumSynthesisReverbs; j++) {
if (gSynthesisReverbs[j].framesLeftToIgnore != 0) {
gSynthesisReverbs[j].framesLeftToIgnore--;
}
gSynthesisReverbs[j].curFrame ^= 1;
}
*writtenCmds = cmd - cmdBuf;
return cmd;
}
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex) {
struct ReverbRingBufferItem *item;
s16 startPad;
s16 paddedLengthA;
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
}
aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
} else {
startPad = (item->startPos % 8u) * 2;
paddedLengthA = ALIGN(startPad + item->lengthA, 4);
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
if (item->lengthB != 0) {
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + paddedLengthA, 0, DEFAULT_LEN_1CH - paddedLengthA, reverbIndex);
}
aSetBuffer(cmd++, 0, DMEM_ADDR_RESAMPLED + startPad, DMEM_ADDR_WET_LEFT_CH, bufLen * 2);
aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateLeft));
aSetBuffer(cmd++, 0, DMEM_ADDR_RESAMPLED2 + startPad, DMEM_ADDR_WET_RIGHT_CH, bufLen * 2);
aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateRight));
aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
}
if (gSynthesisReverbs[reverbIndex].panRight != 0 || gSynthesisReverbs[reverbIndex].panLeft != 0) {
// Leak some audio from the left reverb channel into the right reverb channel and vice versa (pan)
aDMEMMove(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_1CH);
aMix(cmd++, gSynthesisReverbs[reverbIndex].panRight, DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_1CH);
aMix(cmd++, gSynthesisReverbs[reverbIndex].panLeft, DMEM_ADDR_RESAMPLED, DMEM_ADDR_WET_RIGHT_CH, DEFAULT_LEN_1CH);
}
return cmd;
}
u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
struct ReverbRingBufferItem *item;
struct SynthesisReverb *reverb;
reverb = &gSynthesisReverbs[reverbIndex];
item = &reverb->items[reverb->curFrame][updateIndex];
// Get the oldest samples in the ring buffer into the wet channels
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
// Ring buffer wrapped
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex);
}
return cmd;
}
u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
struct ReverbRingBufferItem *item;
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
switch (gSynthesisReverbs[reverbIndex].downsampleRate) {
case 1:
// Put the oldest samples in the ring buffer into the wet channels
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
// Ring buffer wrapped
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
}
break;
default:
// Downsampling is done later by CPU when RSP is done, therefore we need to have double
// buffering. Left and right buffers are adjacent in memory.
aSaveBuffer(cmd++, DMEM_ADDR_WET_LEFT_CH,
VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex].toDownsampleLeft), DEFAULT_LEN_2CH);
break;
}
gSynthesisReverbs[reverbIndex].resampleFlags = 0;
return cmd;
}
u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
struct ReverbRingBufferItem *item;
struct SynthesisReverb *reverb;
reverb = &gSynthesisReverbs[reverbIndex];
item = &reverb->items[reverb->curFrame][updateIndex];
// Put the oldest samples in the ring buffer into the wet channels
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex);
if (item->lengthB != 0) {
// Ring buffer wrapped
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex);
}
return cmd;
}
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) {
struct NoteSubEu *noteSubEu;
u8 noteIndices[56];
s32 temp;
s32 i;
s16 j;
s16 notePos = 0;
if (gNumSynthesisReverbs == 0) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i].enabled) {
noteIndices[notePos++] = i;
}
}
} else {
for (j = 0; j < gNumSynthesisReverbs; j++) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (noteSubEu->enabled && j == noteSubEu->reverbIndex) {
noteIndices[notePos++] = i;
}
}
}
for (i = 0; i < gMaxSimultaneousNotes; i++) {
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs) {
noteIndices[notePos++] = i;
}
}
}
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
i = 0;
for (j = 0; j < gNumSynthesisReverbs; j++) {
gUseReverb = gSynthesisReverbs[j].useReverb;
if (gUseReverb != 0) {
cmd = synthesis_resample_and_mix_reverb(cmd, bufLen, j, updateIndex);
}
for (; i < notePos; i++) {
temp = updateIndex * gMaxSimultaneousNotes;
if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex) {
cmd = synthesis_process_note(noteIndices[i],
&gNoteSubsEu[temp + noteIndices[i]],
&gNotes[noteIndices[i]].synthesisState,
aiBuf, bufLen, cmd, updateIndex);
continue;
} else {
break;
}
}
if (gSynthesisReverbs[j].useReverb != 0) {
if (gSynthesisReverbs[j].unk100 != NULL) {
aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk100);
aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_LEFT_CH, gSynthesisReverbs[j].unk108);
}
if (gSynthesisReverbs[j].unk104 != NULL) {
aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk104);
aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_RIGHT_CH, gSynthesisReverbs[j].unk10C);
}
cmd = synthesis_save_reverb_samples(cmd, j, updateIndex);
if (gSynthesisReverbs[j].unk5 != -1) {
if (gSynthesisReverbs[gSynthesisReverbs[j].unk5].downsampleRate == 1) {
cmd = synthesis_load_reverb_samples(cmd, gSynthesisReverbs[j].unk5, updateIndex);
aMix(cmd++, gSynthesisReverbs[j].unk08, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_2CH);
cmd = func_sh_802EDF24(cmd++, gSynthesisReverbs[j].unk5, updateIndex);
}
}
}
}
for (; i < notePos; i++) {
struct NoteSubEu *noteSubEu2 = &gNoteSubsEu[updateIndex * gMaxSimultaneousNotes + noteIndices[i]];
cmd = synthesis_process_note(noteIndices[i],
noteSubEu2,
&gNotes[noteIndices[i]].synthesisState,
aiBuf, bufLen, cmd, updateIndex);
}
temp = bufLen * 2;
aInterleave(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_LEFT_CH, DMEM_ADDR_RIGHT_CH, temp);
aSaveBuffer(cmd++, DMEM_ADDR_TEMP, VIRTUAL_TO_PHYSICAL2(aiBuf), temp * 2);
return cmd;
}
u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) {
UNUSED s32 pad0[3];
struct AudioBankSample *audioBookSample; // sp164, sp138
struct AdpcmLoop *loopInfo; // sp160, sp134
s16 *curLoadedBook; // sp154, sp130
UNUSED u8 padEU[0x04];
UNUSED u8 pad8[0x04];
s32 noteFinished; // 150 t2, sp124
s32 restart; // 14c t3, sp120
s32 flags; // sp148, sp11C, t8
u16 resamplingRateFixedPoint; // sp5c, sp11A
s32 nSamplesToLoad; //s0, Ec
UNUSED u8 pad7[0x0c]; // sp100
s32 sp130; //sp128, sp104
UNUSED s32 tempBufLen;
UNUSED u32 pad9;
s32 t0;
u8 *sampleAddr; // sp120, spF4
s32 s6;
s32 samplesLenAdjusted; // 108, spEC
s32 nAdpcmSamplesProcessed; // signed required for US // spc0
s32 endPos; // sp110, spE4
s32 nSamplesToProcess; // sp10c/a0, spE0
// Might have been used to store (samplesLenFixedPoint >> 0x10), but doing so causes strange
// behavior with the break near the end of the loop, causing US and JP to need a goto instead
UNUSED s32 samplesLenInt;
s32 s2;
s32 leftRight; //s0
s32 s5; //s4
u32 samplesLenFixedPoint; // v1_1
s32 s3; // spA0
s32 nSamplesInThisIteration; // v1_2
u32 a3;
u8 *v0_2;
s32 unk_s6; // sp90
s32 s5Aligned;
s32 sp88;
s32 sp84;
u32 temp;
s32 nParts; // spE8, spBC
s32 curPart; // spE4, spB8
s32 aligned;
UNUSED u32 padSH1;
s32 resampledTempLen; // spD8, spAC, sp6c
u16 noteSamplesDmemAddrBeforeResampling; // spD6, spAA, sp6a -- 6C
UNUSED u32 padSH2;
UNUSED u32 padSH3;
UNUSED u32 padSH4;
struct Note *note; // sp58
u16 sp56; // sp56
u16 addr;
u8 synthesisVolume;
curLoadedBook = NULL;
note = &gNotes[noteIndex];
flags = 0;
if (noteSubEu->needsInit == TRUE) {
flags = A_INIT;
synthesisState->restart = 0;
synthesisState->samplePosInt = 0;
synthesisState->samplePosFrac = 0;
synthesisState->curVolLeft = 0;
synthesisState->curVolRight = 0;
synthesisState->prevHeadsetPanRight = 0;
synthesisState->prevHeadsetPanLeft = 0;
synthesisState->reverbVol = noteSubEu->reverbVol;
synthesisState->unk5 = 0;
note->noteSubEu.finished = 0;
}
resamplingRateFixedPoint = noteSubEu->resamplingRateFixedPoint;
nParts = noteSubEu->hasTwoAdpcmParts + 1;
samplesLenFixedPoint = (resamplingRateFixedPoint * bufLen * 2) + synthesisState->samplePosFrac;
nSamplesToLoad = (samplesLenFixedPoint >> 0x10);
synthesisState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
if ((synthesisState->unk5 == 1) && (nParts == 2)) {
nSamplesToLoad += 2;
sp56 = 2;
} else if ((synthesisState->unk5 == 2) && (nParts == 1)) {
nSamplesToLoad -= 4;
sp56 = 4;
} else {
sp56 = 0;
}
synthesisState->unk5 = nParts;
if (noteSubEu->isSyntheticWave) {
cmd = load_wave_samples(cmd, noteSubEu, synthesisState, nSamplesToLoad);
noteSamplesDmemAddrBeforeResampling = (synthesisState->samplePosInt * 2) + DMEM_ADDR_UNCOMPRESSED_NOTE;
synthesisState->samplePosInt += nSamplesToLoad;
} else {
// ADPCM note
audioBookSample = noteSubEu->sound.audioBankSound->sample;
loopInfo = audioBookSample->loop;
endPos = loopInfo->end;
sampleAddr = audioBookSample->sampleAddr;
resampledTempLen = 0;
for (curPart = 0; curPart < nParts; curPart++) {
nAdpcmSamplesProcessed = 0; // s8
s5 = 0; // s4
if (nParts == 1) {
samplesLenAdjusted = nSamplesToLoad;
} else if (nSamplesToLoad & 1) {
samplesLenAdjusted = (nSamplesToLoad & ~1) + (curPart * 2);
} else {
samplesLenAdjusted = nSamplesToLoad;
}
if (audioBookSample->codec == CODEC_ADPCM) {
if (curLoadedBook != (*audioBookSample->book).book) {
u32 nEntries;
switch (noteSubEu->bookOffset) {
case 1:
curLoadedBook = euUnknownData_80301950 + 1;
break;
case 2:
curLoadedBook = euUnknownData_80301950 + 2;
break;
case 3:
default:
curLoadedBook = audioBookSample->book->book;
break;
}
nEntries = 16 * audioBookSample->book->order * audioBookSample->book->npredictors;
aLoadADPCM(cmd++, nEntries, VIRTUAL_TO_PHYSICAL2(curLoadedBook));
}
}
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
s32 samplesRemaining; // v1
s32 s0;
noteFinished = FALSE;
restart = FALSE;
s2 = synthesisState->samplePosInt & 0xf;
samplesRemaining = endPos - synthesisState->samplePosInt;
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed;
if (s2 == 0 && synthesisState->restart == FALSE) {
s2 = 16;
}
s6 = 16 - s2; // a1
if (nSamplesToProcess < samplesRemaining) {
t0 = (nSamplesToProcess - s6 + 0xf) / 16;
s0 = t0 * 16;
s3 = s6 + s0 - nSamplesToProcess;
} else {
s0 = samplesRemaining - s6;
s3 = 0;
if (s0 <= 0) {
s0 = 0;
s6 = samplesRemaining;
}
t0 = (s0 + 0xf) / 16;
if (loopInfo->count != 0) {
// Loop around and restart
restart = 1;
} else {
noteFinished = 1;
}
}
switch (audioBookSample->codec) {
case CODEC_ADPCM:
unk_s6 = 9;
sp88 = 0x10;
sp84 = 0;
break;
case CODEC_S8:
unk_s6 = 0x10;
sp88 = 0x10;
sp84 = 0;
break;
case CODEC_SKIP: goto skip;
}
if (t0 != 0) {
temp = (synthesisState->samplePosInt + sp88 - s2) / 16;
if (audioBookSample->medium == 0) {
v0_2 = sp84 + (temp * unk_s6) + sampleAddr;
} else {
v0_2 = dma_sample_data((uintptr_t)(sp84 + (temp * unk_s6) + sampleAddr),
ALIGN(t0 * unk_s6 + 16, 4), flags, &synthesisState->sampleDmaIndex, audioBookSample->medium);
}
a3 = ((uintptr_t)v0_2 & 0xf);
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(v0_2 - a3), addr, ALIGN(t0 * unk_s6 + 16, 4));
} else {
s0 = 0;
a3 = 0;
}
if (synthesisState->restart != FALSE) {
aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state));
flags = A_LOOP; // = 2
synthesisState->restart = FALSE;
}
nSamplesInThisIteration = s0 + s6 - s3;
if (nAdpcmSamplesProcessed == 0) {
switch (audioBookSample->codec) {
case CODEC_ADPCM:
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
aSetBuffer(cmd++, 0, addr + a3, DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2);
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
break;
case CODEC_S8:
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
aSetBuffer(cmd++, 0, addr + a3, DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2);
aS8Dec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
break;
}
sp130 = s2 * 2;
} else {
s5Aligned = ALIGN(s5 + 16, 4);
switch (audioBookSample->codec) {
case CODEC_ADPCM:
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
aSetBuffer(cmd++, 0, addr + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2);
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
break;
case CODEC_S8:
aligned = ALIGN(t0 * unk_s6 + 16, 4);
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
aSetBuffer(cmd++, 0, addr + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2);
aS8Dec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
break;
}
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
}
nAdpcmSamplesProcessed += nSamplesInThisIteration;
switch (flags) {
case A_INIT: // = 1
sp130 = 0x20;
s5 = (s0 + 0x10) * 2;
break;
case A_LOOP: // = 2
s5 = (nSamplesInThisIteration) * 2 + s5;
break;
default:
if (s5 != 0) {
s5 = (nSamplesInThisIteration) * 2 + s5;
} else {
s5 = (s2 + (nSamplesInThisIteration)) * 2;
}
break;
}
flags = 0;
skip:
if (noteFinished) {
aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5,
(samplesLenAdjusted - nAdpcmSamplesProcessed) * 2);
noteSubEu->finished = 1;
note->noteSubEu.finished = 1;
func_sh_802ed644(updateIndex, noteIndex);
break;
}
if (restart != 0) {
synthesisState->restart = TRUE;
synthesisState->samplePosInt = loopInfo->start;
} else {
synthesisState->samplePosInt += nSamplesToProcess;
}
}
switch (nParts) {
case 1:
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + sp130;
break;
case 2:
switch (curPart) {
case 0:
aDownsampleHalf(cmd++, ALIGN(samplesLenAdjusted / 2, 3), DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED);
resampledTempLen = samplesLenAdjusted;
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_RESAMPLED;
if (noteSubEu->finished != FALSE) {
aClearBuffer(cmd++, noteSamplesDmemAddrBeforeResampling + resampledTempLen, samplesLenAdjusted + 0x10);
}
break;
case 1:
aDownsampleHalf(cmd++, ALIGN(samplesLenAdjusted / 2, 3), DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, resampledTempLen + DMEM_ADDR_RESAMPLED);
break;
}
}
if (noteSubEu->finished != FALSE) {
break;
}
}
}
flags = 0;
if (noteSubEu->needsInit == TRUE) {
flags = A_INIT;
noteSubEu->needsInit = FALSE;
}
flags = flags | sp56;
cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint,
noteSamplesDmemAddrBeforeResampling, flags);
if ((flags & 1) != 0) {
flags = 1;
}
if (noteSubEu->filter) {
aFilter(cmd++, 0x02, bufLen * 2, noteSubEu->filter);
aFilter(cmd++, flags, DMEM_ADDR_TEMP, synthesisState->synthesisBuffers->filterBuffer);
}
if (noteSubEu->bookOffset == 3) {
aUnknown25(cmd++, 0, bufLen * 2, DMEM_ADDR_TEMP, DMEM_ADDR_TEMP);
}
synthesisVolume = noteSubEu->synthesisVolume;
if (synthesisVolume != 0) {
if (synthesisVolume < 0x10) {
synthesisVolume = 0x10;
}
aHiLoGain(cmd++, synthesisVolume, (bufLen + 0x10) * 2, DMEM_ADDR_TEMP);
}
if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) {
leftRight = 1;
} else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) {
leftRight = 2;
} else {
leftRight = 0;
}
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, DMEM_ADDR_TEMP, leftRight, flags);
if (noteSubEu->usesHeadsetPanEffects) {
if ((flags & 1) == 0) {
flags = 0;
}
cmd = note_apply_headset_pan_effects(cmd, noteSubEu, synthesisState, bufLen * 2, flags, leftRight);
}
return cmd;
}
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad) {
s32 a3;
s32 repeats;
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(noteSubEu->sound.samples),
DMEM_ADDR_UNCOMPRESSED_NOTE, 128);
synthesisState->samplePosInt &= 0x3f;
a3 = 64 - synthesisState->samplePosInt;
if (a3 < nSamplesToLoad) {
repeats = (nSamplesToLoad - a3 + 63) / 64;
if (repeats != 0) {
aDuplicate(cmd++,
/*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE,
/*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + 128,
/*copies*/ repeats);
}
}
return cmd;
}
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags) {
if (pitch == 0) {
aClearBuffer(cmd++, DMEM_ADDR_TEMP, count);
} else {
aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count);
aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState));
}
return cmd;
}
u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags) {
u16 sourceRight;
u16 sourceLeft;
u16 targetLeft;
u16 targetRight;
s16 rampLeft;
s16 rampRight;
s32 sourceReverbVol;
s16 rampReverb;
s32 reverbVolDiff = 0;
sourceLeft = synthesisState->curVolLeft;
sourceRight = synthesisState->curVolRight;
targetLeft = note->targetVolLeft;
targetRight = note->targetVolRight;
targetLeft <<= 4;
targetRight <<= 4;
if (targetLeft != sourceLeft) {
rampLeft = (targetLeft - sourceLeft) / (nSamples >> 3);
} else {
rampLeft = 0;
}
if (targetRight != sourceRight) {
rampRight = (targetRight - sourceRight) / (nSamples >> 3);
} else {
rampRight = 0;
}
sourceReverbVol = synthesisState->reverbVol;
if (note->reverbVol != sourceReverbVol) {
reverbVolDiff = ((note->reverbVol & 0x7f) - (sourceReverbVol & 0x7f)) << 9;
rampReverb = reverbVolDiff / (nSamples >> 3);
synthesisState->reverbVol = note->reverbVol;
} else {
rampReverb = 0;
}
synthesisState->curVolLeft = sourceLeft + rampLeft * (nSamples >> 3);
synthesisState->curVolRight = sourceRight + rampRight * (nSamples >> 3);
if (note->usesHeadsetPanEffects) {
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DEFAULT_LEN_1CH);
aEnvSetup1(cmd++, (sourceReverbVol & 0x7f) * 2, rampReverb, rampLeft, rampRight);
aEnvSetup2(cmd++, sourceLeft, sourceRight);
switch (headsetPanSettings) {
case 1:
aEnvMixer(cmd++,
inBuf, nSamples,
(sourceReverbVol & 0x80) >> 7,
note->stereoStrongRight, note->stereoStrongLeft,
DMEM_ADDR_NOTE_PAN_TEMP,
DMEM_ADDR_RIGHT_CH,
DMEM_ADDR_WET_LEFT_CH,
DMEM_ADDR_WET_RIGHT_CH);
break;
case 2:
aEnvMixer(cmd++,
inBuf, nSamples,
(sourceReverbVol & 0x80) >> 7,
note->stereoStrongRight, note->stereoStrongLeft,
DMEM_ADDR_LEFT_CH,
DMEM_ADDR_NOTE_PAN_TEMP,
DMEM_ADDR_WET_LEFT_CH,
DMEM_ADDR_WET_RIGHT_CH);
break;
default:
aEnvMixer(cmd++,
inBuf, nSamples,
(sourceReverbVol & 0x80) >> 7,
note->stereoStrongRight, note->stereoStrongLeft,
DMEM_ADDR_LEFT_CH,
DMEM_ADDR_RIGHT_CH,
DMEM_ADDR_WET_LEFT_CH,
DMEM_ADDR_WET_RIGHT_CH);
break;
}
} else {
aEnvSetup1(cmd++, (sourceReverbVol & 0x7f) * 2, rampReverb, rampLeft, rampRight);
aEnvSetup2(cmd++, sourceLeft, sourceRight);
aEnvMixer(cmd++,
inBuf, nSamples,
(sourceReverbVol & 0x80) >> 7,
note->stereoStrongRight, note->stereoStrongLeft,
DMEM_ADDR_LEFT_CH,
DMEM_ADDR_RIGHT_CH,
DMEM_ADDR_WET_LEFT_CH,
DMEM_ADDR_WET_RIGHT_CH);
}
return cmd;
}
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight) {
u16 dest;
u16 pitch;
u8 prevPanShift;
u8 panShift;
UNUSED u8 unkDebug;
switch (leftRight) {
case 1:
dest = DMEM_ADDR_LEFT_CH;
panShift = noteSubEu->headsetPanRight;
note->prevHeadsetPanLeft = 0;
prevPanShift = note->prevHeadsetPanRight;
note->prevHeadsetPanRight = panShift;
break;
case 2:
dest = DMEM_ADDR_RIGHT_CH;
panShift = noteSubEu->headsetPanLeft;
note->prevHeadsetPanRight = 0;
prevPanShift = note->prevHeadsetPanLeft;
note->prevHeadsetPanLeft = panShift;
break;
default:
return cmd;
}
if (flags != 1) { // A_INIT?
// Slightly adjust the sample rate in order to fit a change in pan shift
if (panShift != prevPanShift) {
pitch = (((bufLen << 0xf) / 2) - 1) / ((bufLen + panShift - prevPanShift - 2) / 2);
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, (bufLen + panShift) - prevPanShift);
aResampleZoh(cmd++, pitch, 0);
} else {
aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen);
}
if (prevPanShift != 0) {
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer),
DMEM_ADDR_NOTE_PAN_TEMP, ALIGN(prevPanShift, 4));
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + prevPanShift, bufLen + panShift - prevPanShift);
} else {
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP, bufLen + panShift);
}
} else {
// Just shift right
aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen);
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, panShift);
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + panShift, bufLen);
}
if (panShift) {
// Save excessive samples for next iteration
aSaveBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP + bufLen,
VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer), ALIGN(panShift, 4));
}
aAddMixer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, dest, (bufLen + 0x3f) & 0xffc0);
return cmd;
}
#endif
+3 -3
View File
@@ -31,7 +31,7 @@
static u16 gRandomSeed16;
// Unused function that directly jumps to a behavior command and resets the object's stack index.
static void goto_behavior_unused(const BehaviorScript *bhvAddr) {
UNUSED static void goto_behavior_unused(const BehaviorScript *bhvAddr) {
gCurBhvCommand = segmented_to_virtual(bhvAddr);
gCurrentObject->bhvStackIndex = 0;
}
@@ -107,7 +107,7 @@ static uintptr_t cur_obj_bhv_stack_pop(void) {
return bhvAddr;
}
static void stub_behavior_script_1(void) {
UNUSED static void stub_behavior_script_1(void) {
for (;;) {
;
}
@@ -687,7 +687,7 @@ static s32 bhv_cmd_begin(void) {
// It cannot be simply re-added to the table, as unlike all other bhv commands it takes a parameter.
// Theoretically this command would have been of variable size.
// Included below is a modified/repaired version of this function that would work properly.
static void bhv_cmd_set_int_random_from_table(s32 tableSize) {
UNUSED static void bhv_cmd_set_int_random_from_table(s32 tableSize) {
u8 field = BHV_CMD_GET_2ND_U8(0);
s32 table[16];
s32 i;
+1 -1
View File
@@ -828,7 +828,7 @@ struct LevelCommand *level_script_execute(struct LevelCommand *cmd) {
}
profiler_log_thread5_time(LEVEL_SCRIPT_EXECUTE);
init_render_image();
init_rcp();
render_game();
end_master_display_list();
alloc_display_list(0);
+8 -1
View File
@@ -15,7 +15,14 @@ int gSplineState;
// These functions have bogus return values.
// Disable the compiler warning.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-local-addr"
#ifdef __GNUC__
#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wreturn-stack-address"
#else
#pragma GCC diagnostic ignored "-Wreturn-local-addr"
#endif
#endif
/// Copy vector 'src' to 'dest'
void *vec3f_copy(Vec3f dest, Vec3f src) {
+1 -1
View File
@@ -369,7 +369,7 @@ f32 unused_obj_find_floor_height(struct Object *obj) {
*/
struct FloorGeometry sFloorGeo;
static u8 unused8038BE50[0x40];
UNUSED static u8 unused8038BE50[0x40];
/**
* Return the floor height underneath (xPos, yPos, zPos) and populate `floorGeo`
+2 -2
View File
@@ -291,7 +291,7 @@ static void add_surface(struct Surface *surface, s32 dynamic) {
}
}
static void stub_surface_load_1(void) {
UNUSED static void stub_surface_load_1(void) {
}
/**
@@ -653,7 +653,7 @@ void clear_dynamic_surfaces(void) {
}
}
static void unused_80383604(void) {
UNUSED static void unused_80383604(void) {
}
/**
+10 -8
View File
@@ -21,6 +21,7 @@
#include "engine/geo_layout.h"
#include "save_file.h"
#include "level_table.h"
#include "dialog_ids.h"
struct SpawnInfo gPlayerSpawnInfos[1];
struct GraphNode *D_8033A160[0x100];
@@ -32,7 +33,7 @@ s16 gCurrCourseNum;
s16 gCurrActNum;
s16 gCurrAreaIndex;
s16 gSavedCourseNum;
s16 gPauseScreenMode;
s16 gMenuOptSelectIndex;
s16 gSaveOptSelectIndex;
struct SpawnInfo *gMarioSpawnInfo = &gPlayerSpawnInfos[0];
@@ -196,8 +197,8 @@ void clear_areas(void) {
gAreaData[i].unused28 = NULL;
gAreaData[i].whirlpools[0] = NULL;
gAreaData[i].whirlpools[1] = NULL;
gAreaData[i].dialog[0] = 255;
gAreaData[i].dialog[1] = 255;
gAreaData[i].dialog[0] = DIALOG_NONE;
gAreaData[i].dialog[1] = DIALOG_NONE;
gAreaData[i].musicParam = 0;
gAreaData[i].musicParam2 = 0;
}
@@ -373,19 +374,20 @@ void render_game(void) {
render_text_labels();
do_cutscene_handler();
print_displaying_credits_entry();
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH,
SCREEN_HEIGHT - BORDER_HEIGHT);
gPauseScreenMode = render_menus_and_dialogs();
if (gPauseScreenMode != 0) {
gSaveOptSelectIndex = gPauseScreenMode;
gMenuOptSelectIndex = render_menus_and_dialogs();
if (gMenuOptSelectIndex != MENU_OPT_NONE) {
gSaveOptSelectIndex = gMenuOptSelectIndex;
}
if (D_8032CE78 != NULL) {
make_viewport_clip_rect(D_8032CE78);
} else
} else {
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH,
SCREEN_HEIGHT - BORDER_HEIGHT);
}
if (gWarpTransition.isActive) {
if (gWarpTransDelay == 0) {
+19 -1
View File
@@ -118,6 +118,24 @@ struct WarpTransition
/*0x04*/ struct WarpTransitionData data;
};
enum MenuOption {
MENU_OPT_NONE,
MENU_OPT_1,
MENU_OPT_2,
MENU_OPT_3,
MENU_OPT_DEFAULT = MENU_OPT_1,
// Course Pause Menu
MENU_OPT_CONTINUE = MENU_OPT_1,
MENU_OPT_EXIT_COURSE = MENU_OPT_2,
MENU_OPT_CAMERA_ANGLE_R = MENU_OPT_3,
// Save Menu
MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1,
MENU_OPT_SAVE_AND_QUIT = MENU_OPT_2,
MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3
};
extern struct GraphNode **gLoadedGraphNodes;
extern struct SpawnInfo gPlayerSpawnInfos[];
extern struct GraphNode *D_8033A160[];
@@ -127,7 +145,7 @@ extern s16 gCurrCourseNum;
extern s16 gCurrActNum;
extern s16 gCurrAreaIndex;
extern s16 gSavedCourseNum;
extern s16 gPauseScreenMode;
extern s16 gMenuOptSelectIndex;
extern s16 gSaveOptSelectIndex;
extern struct SpawnInfo *gMarioSpawnInfo;
+13 -18
View File
@@ -23,6 +23,7 @@
#include "level_table.h"
#include "level_update.h"
#include "levels/bob/header.h"
#include "levels/bowser_3/header.h"
#include "levels/castle_inside/header.h"
#include "levels/hmc/header.h"
#include "main.h"
@@ -61,14 +62,6 @@ struct Struct8032F34C {
const void *segAddr;
};
struct Struct8032F698 {
void *unk0;
s16 unk1;
s16 unk2;
s16 unk3;
s16 unk4;
};
struct Struct802C0DF0 {
u8 unk0;
u8 unk1;
@@ -89,10 +82,10 @@ struct OpenableGrill {
const Collision *collision;
};
s32 D_8032F0C0[] = { SAVE_FLAG_HAVE_WING_CAP, SAVE_FLAG_HAVE_METAL_CAP, SAVE_FLAG_HAVE_VANISH_CAP };
static s32 sCapSaveFlags[] = { SAVE_FLAG_HAVE_WING_CAP, SAVE_FLAG_HAVE_METAL_CAP, SAVE_FLAG_HAVE_VANISH_CAP };
// Boo Roll
s16 D_8032F0CC[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046, 2775,
static s16 sBooHitRotations[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046, 2775,
2517, 2271, 2039, 1818, 1611, 1416, 1233, 1063, 906, 761, 629,
509, 402, 308, 226, 157, 100, 56, 25, 4, 0 };
@@ -115,21 +108,21 @@ s16 D_8032F0CC[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046,
#include "behaviors/white_puff_explode.inc.c"
// not in behavior file
struct SpawnParticlesInfo D_8032F270 = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f };
struct SpawnParticlesInfo sMistParticles = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f };
// generate_wind_puffs/dust (something like that)
void spawn_mist_particles_variable(s32 count, s32 offsetY, f32 size) {
D_8032F270.sizeBase = size;
D_8032F270.sizeRange = size / 20.0;
D_8032F270.offsetY = offsetY;
sMistParticles.sizeBase = size;
sMistParticles.sizeRange = size / 20.0;
sMistParticles.offsetY = offsetY;
if (count == 0) {
D_8032F270.count = 20;
sMistParticles.count = 20;
} else if (count > 20) {
D_8032F270.count = count;
sMistParticles.count = count;
} else {
D_8032F270.count = 4;
sMistParticles.count = 4;
}
cur_obj_spawn_particles(&D_8032F270);
cur_obj_spawn_particles(&sMistParticles);
}
#include "behaviors/sparkle_spawn_star.inc.c"
@@ -205,6 +198,8 @@ void spawn_sparkle_particles(s32 n, s32 a1, s32 a2, s32 r) {
#include "behaviors/bowser_key.inc.c"
#include "behaviors/bullet_bill.inc.c"
#include "behaviors/bowser.inc.c"
#include "behaviors/bowser_falling_platform.inc.c"
#include "behaviors/bowser_flame.inc.c"
#include "behaviors/blue_fish.inc.c"
// Not in behavior file, duplicate of vec3f_copy except without bad return.
+1 -1
View File
@@ -231,7 +231,7 @@ void bhv_big_boo_loop(void);
void bhv_courtyard_boo_triplet_init(void);
void obj_set_secondary_camera_focus(void);
void bhv_boo_loop(void);
void bhv_boo_boss_spawned_bridge_loop(void);
void bhv_boo_staircase(void);
void bhv_bbh_tilting_trap_platform_loop(void);
void bhv_haunted_bookshelf_loop(void);
void bhv_merry_go_round_loop(void);
+2 -2
View File
@@ -87,14 +87,14 @@ static void beta_boo_key_dropped_loop(void) {
if (obj_check_if_collided_with_object(o, gMarioObject)) {
// This interaction status is 0x01, the first interaction status flag.
// It was only used for Hoot in the final game, but it seems it could've
// done something else or held some special meaning in beta.
// treated as a TRUE/FALSE statement or held some special meaning in beta.
// Earlier, in beta_boo_key_drop (called when the parent boo is killed),
// o->parentObj is set to the parent boo's parentObj. This means that
// here, the parentObj is actually the parent of the old parent boo.
// One theory about this code is that there was a boo spawner, which
// spawned "false" boos and one "true" boo with the key, and the player
// was intended to find the one with the key to progress.
o->parentObj->oInteractStatus = INT_STATUS_HOOT_GRABBED_BY_MARIO;
o->parentObj->oInteractStatus = TRUE;
// Delete the object and spawn sparkles
obj_mark_for_deletion(o);
+4 -4
View File
@@ -46,7 +46,7 @@ void bobomb_check_interactions(void) {
obj_set_hitbox(o, &sBobombHitbox);
if ((o->oInteractStatus & INT_STATUS_INTERACTED) != 0)
{
if ((o->oInteractStatus & INT_STATUS_MARIO_UNK1) != 0)
if ((o->oInteractStatus & INT_STATUS_MARIO_KNOCKBACK_DMG) != 0)
{
o->oMoveAngleYaw = gMarioObject->header.gfx.angle[1];
o->oForwardVel = 25.0;
@@ -344,7 +344,7 @@ void bobomb_buddy_cannon_dialog(s16 dialogFirstText, s16 dialogSecondText) {
break;
case BOBOMB_BUDDY_CANNON_STOP_TALKING:
set_mario_npc_dialog(0);
set_mario_npc_dialog(MARIO_DIALOG_STOP);
o->activeFlags &= ~ACTIVE_FLAG_INITIATED_TIME_STOP;
o->oBobombBuddyHasTalkedToMario = BOBOMB_BUDDY_HAS_TALKED;
@@ -356,14 +356,14 @@ void bobomb_buddy_cannon_dialog(s16 dialogFirstText, s16 dialogSecondText) {
}
void bobomb_buddy_act_talk(void) {
if (set_mario_npc_dialog(1) == 2) {
if (set_mario_npc_dialog(MARIO_DIALOG_LOOK_FRONT) == MARIO_DIALOG_STATUS_SPEAK) {
o->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP;
switch (o->oBobombBuddyRole) {
case BOBOMB_BUDDY_ROLE_ADVICE:
if (cutscene_object_with_dialog(CUTSCENE_DIALOG, o, o->oBehParams2ndByte)
!= BOBOMB_BUDDY_BP_STYPE_GENERIC) {
set_mario_npc_dialog(0);
set_mario_npc_dialog(MARIO_DIALOG_STOP);
o->activeFlags &= ~ACTIVE_FLAG_INITIATED_TIME_STOP;
o->oBobombBuddyHasTalkedToMario = BOBOMB_BUDDY_HAS_TALKED;
+10 -10
View File
@@ -197,8 +197,8 @@ static void boo_move_during_hit(s32 roll, f32 fVel) {
o->oMoveAngleYaw = o->oBooMoveYawDuringHit;
if (roll != FALSE) {
o->oFaceAngleYaw += D_8032F0CC[o->oTimer];
o->oFaceAngleRoll += D_8032F0CC[o->oTimer];
o->oFaceAngleYaw += sBooHitRotations[o->oTimer];
o->oFaceAngleRoll += sBooHitRotations[o->oTimer];
}
}
@@ -223,7 +223,7 @@ static s32 boo_update_after_bounced_on(f32 a0) {
}
if (o->oTimer < 32) {
boo_move_during_hit(FALSE, D_8032F0CC[o->oTimer]/5000.0f * a0);
boo_move_during_hit(FALSE, sBooHitRotations[o->oTimer]/5000.0f * a0);
} else {
cur_obj_become_tangible();
boo_reset_after_hit();
@@ -243,7 +243,7 @@ static s32 big_boo_update_during_nonlethal_hit(f32 a0) {
}
if (o->oTimer < 32) {
boo_move_during_hit(TRUE, D_8032F0CC[o->oTimer]/5000.0f * a0);
boo_move_during_hit(TRUE, sBooHitRotations[o->oTimer]/5000.0f * a0);
} else if (o->oTimer < 48) {
big_boo_shake_after_hit();
} else {
@@ -464,7 +464,7 @@ static void boo_act_4(void) {
dialogID = DIALOG_107;
}
if (cur_obj_update_dialog(2, 2, dialogID, 0)) {
if (cur_obj_update_dialog(MARIO_DIALOG_LOOK_UP, DIALOG_FLAG_TEXT_DEFAULT, dialogID, 0)) {
create_sound_spawner(SOUND_OBJ_DYING_ENEMY1);
obj_mark_for_deletion(o);
@@ -644,9 +644,9 @@ static void big_boo_act_4(void) {
if (o->oTimer > 60 && o->oDistanceToMario < 600.0f) {
obj_set_pos(o, 973, 0, 717);
spawn_object_relative(0, 0, 0, 0, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
spawn_object_relative(1, 0, 0, -200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
spawn_object_relative(2, 0, 0, 200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
spawn_object_relative(0, 0, 0, 0, o, MODEL_BBH_STAIRCASE_STEP, bhvBooStaircase);
spawn_object_relative(1, 0, 0, -200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooStaircase);
spawn_object_relative(2, 0, 0, 200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooStaircase);
obj_mark_for_deletion(o);
}
@@ -863,7 +863,7 @@ void bhv_boo_in_castle_loop(void) {
cur_obj_move_using_fvel_and_gravity();
}
void bhv_boo_boss_spawned_bridge_loop(void) {
void bhv_boo_staircase(void) {
f32 targetY;
switch (o->oBehParams2ndByte) {
@@ -898,7 +898,7 @@ void bhv_boo_boss_spawned_bridge_loop(void) {
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN4_LOWPRIO);
}
if (cur_obj_move_up_and_down(o->oTimer)) {
if (jiggle_bbh_stair(o->oTimer)) {
o->oAction++;
}
+6
View File
@@ -79,6 +79,9 @@ void bowling_ball_set_waypoints(void) {
void bhv_bowling_ball_roll_loop(void) {
s16 collisionFlags;
s32 sp18;
#ifdef AVOID_UB
sp18 = 0;
#endif
bowling_ball_set_waypoints();
collisionFlags = object_step();
@@ -109,6 +112,9 @@ void bhv_bowling_ball_roll_loop(void) {
void bhv_bowling_ball_initializeLoop(void) {
s32 sp1c;
#ifdef AVOID_UB
sp1c = 0;
#endif
bowling_ball_set_waypoints();
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,90 @@
struct BowserFallingPlatformData {
const Collision *collision;
s16 posX;
s16 posZ;
s16 angle;
};
struct BowserFallingPlatformData sBowserFallingPlatform[] = {
{ NULL, 0, 0, 0 },
{ bowser_3_seg7_collision_07004B94, -800, -1000, -20992 },
{ bowser_3_seg7_collision_07004C18, -1158, 390, -18432 },
{ bowser_3_seg7_collision_07004C9C, -1158, 390, -7680 },
{ bowser_3_seg7_collision_07004D20, 0, 1240, -6144 },
{ bowser_3_seg7_collision_07004DA4, 0, 1240, 6144 },
{ bowser_3_seg7_collision_07004E28, 1158, 390, 7680 },
{ bowser_3_seg7_collision_07004EAC, 1158, 390, 18432 },
{ bowser_3_seg7_collision_07004F30, 800, -1000, 20992 },
{ bowser_3_seg7_collision_07004FB4, 800, -1000, -31744 },
{ bowser_3_seg7_collision_07005038, -800, -1000, 31744 }
};
void falling_bowser_plat_act_start(void) {
o->oBitsPlatformBowser = cur_obj_nearest_object_with_behavior(bhvBowser);
obj_set_collision_data(o, sBowserFallingPlatform[o->oBehParams2ndByte].collision);
if (o->oBitsPlatformBowser != 0)
o->oAction = BOWSER_BITS_PLAT_ACT_CHECK;
}
void falling_bowser_plat_act_check(void) {
UNUSED s32 unused;
struct Object *bowser = o->oBitsPlatformBowser;
if (bowser->platform == o) {
if (bowser->oAction == BOWSER_ACT_BIG_JUMP && bowser->oBowserStatus & BOWSER_STATUS_BIG_JUMP) {
o->oAction = BOWSER_BITS_PLAT_ACT_FALL;
}
}
if (bowser->oHealth == 1 && (bowser->oAction == BOWSER_ACT_DANCE || bowser->oHeldState != HELD_FREE)) {
o->oSubAction = 1;
}
if (o->oSubAction == 0) {
o->oBitsPlatformTimer = 0;
} else {
if ((gDebugInfo[4][6] + 20) * (o->oBehParams2ndByte - 1) < o->oBitsPlatformTimer)
o->oAction = BOWSER_BITS_PLAT_ACT_FALL;
o->oBitsPlatformTimer++;
}
}
void falling_bowser_plat_act_fall(void) {
Vec3f pos;
s16 angle;
f32 val;
UNUSED struct Object *bowser = o->oBitsPlatformBowser;
if (o->oTimer == 0 || o->oTimer == 22) {
cur_obj_play_sound_2(SOUND_GENERAL_BOWSER_PLATFORM_2);
}
if (o->oTimer < 22) {
set_environmental_camera_shake(SHAKE_ENV_FALLING_BITS_PLAT);
o->oVelY = 8.0f;
o->oGravity = 0.0f;
} else
o->oGravity = -4.0f;
if ((o->oTimer & 1) == 0 && o->oTimer < 14) {
angle = sBowserFallingPlatform[o->oBehParams2ndByte].angle + (gDebugInfo[4][1] << 8);
val = -(o->oTimer / 2) * 290 + 1740;
vec3f_copy_2(pos, &o->oPosX);
o->oPosX = sBowserFallingPlatform[o->oBehParams2ndByte].posX + sins(angle + 0x14B0) * val;
o->oPosZ = sBowserFallingPlatform[o->oBehParams2ndByte].posZ + coss(angle + 0x14B0) * val;
o->oPosY = 307.0f;
spawn_mist_particles_variable(4, 0, 100.0f);
o->oPosX = sBowserFallingPlatform[o->oBehParams2ndByte].posX + sins(angle - 0x14B0) * val;
o->oPosZ = sBowserFallingPlatform[o->oBehParams2ndByte].posZ + coss(angle - 0x14B0) * val;
spawn_mist_particles_variable(4, 0, 100);
vec3f_copy_2(&o->oPosX, pos);
}
cur_obj_move_using_fvel_and_gravity();
if (o->oTimer > 300) {
obj_mark_for_deletion(o);
}
}
void (*sFallingBowserPlatformActions[])(void) = {
falling_bowser_plat_act_start,
falling_bowser_plat_act_check,
falling_bowser_plat_act_fall,
};
void bhv_falling_bowser_platform_loop(void) {
cur_obj_call_action_function(sFallingBowserPlatformActions);
}
+263
View File
@@ -0,0 +1,263 @@
struct ObjectHitbox sGrowingBowserFlameHitbox = {
/* interactType: */ INTERACT_FLAME,
/* downOffset: */ 20,
/* damageOrCoinValue: */ 1,
/* health: */ 0,
/* numLootCoins: */ 0,
/* radius: */ 10,
/* height: */ 40,
/* hurtboxRadius: */ 0,
/* hurtboxHeight: */ 0,
};
struct ObjectHitbox sBowserFlameHitbox = {
/* interactType: */ INTERACT_FLAME,
/* downOffset: */ 0,
/* damageOrCoinValue: */ 1,
/* health: */ 0,
/* numLootCoins: */ 0,
/* radius: */ 10,
/* height: */ 40,
/* hurtboxRadius: */ 0,
/* hurtboxHeight: */ 0,
};
void bowser_flame_despawn(void) {
obj_mark_for_deletion(o);
spawn_object_with_scale(o, MODEL_NONE, bhvBlackSmokeUpward, 1.0f);
if (random_float() < 0.1) {
spawn_object(o, MODEL_YELLOW_COIN, bhvTemporaryYellowCoin);
}
}
s32 bowser_flame_should_despawn(s32 maxTime) {
if (maxTime < o->oTimer) {
return TRUE;
}
// Flames should despawn if they fall off the arena.
if (o->oFloorType == SURFACE_BURNING) {
return TRUE;
}
if (o->oFloorType == SURFACE_DEATH_PLANE) {
return TRUE;
}
return FALSE;
}
void bhv_flame_bowser_init(void) {
o->oAnimState = (s32)(random_float() * 10.0f);
o->oMoveAngleYaw = random_u16();
if (random_float() < 0.2) {
o->oVelY = 80.0f;
} else {
o->oVelY = 20.0f;
}
o->oForwardVel = 10.0f;
o->oGravity = -1.0f;
o->oFlameScale = random_float() + 1.0f;
}
void bhv_flame_large_burning_out_init(void) {
o->oAnimState = (s32)(random_float() * 10.0f);
o->oMoveAngleYaw = random_u16();
o->oVelY = 10.0f;
o->oForwardVel = 0.0f;
o->oFlameScale = 7.0f;
}
void bowser_flame_move(void) {
s32 timer;
timer = ((o->oFlameSpeedTimerOffset + gGlobalTimer) & 0x3F) << 10;
o->oPosX += sins(o->oMoveAngleYaw) * sins(timer) * 4.0f;
o->oPosZ += coss(o->oMoveAngleYaw) * sins(timer) * 4.0f;
}
void bhv_flame_bowser_loop(void) {
cur_obj_update_floor_and_walls();
cur_obj_move_standard(78);
if (o->oVelY < -4.0f) {
o->oVelY = -4.0f;
}
if (o->oAction == 0) {
cur_obj_become_intangible();
bowser_flame_move();
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
o->oAction++;
if (cur_obj_has_behavior(bhvFlameLargeBurningOut)) {
o->oFlameScale = 8.0f;
} else {
o->oFlameScale = random_float() * 2 + 6.0f;
}
o->oForwardVel = 0;
o->oVelY = 0;
o->oGravity = 0;
}
} else {
cur_obj_become_tangible();
if (o->oTimer > o->oFlameScale * 10 + 5.0f) {
o->oFlameScale -= 0.15;
if (o->oFlameScale <= 0) {
bowser_flame_despawn();
}
}
}
cur_obj_scale(o->oFlameScale);
o->oGraphYOffset = o->header.gfx.scale[1] * 14.0f;
obj_set_hitbox(o, &sBowserFlameHitbox);
}
void bhv_flame_moving_forward_growing_init(void) {
o->oForwardVel = 30.0f;
obj_translate_xz_random(o, 80.0f);
o->oAnimState = (s32)(random_float() * 10.0f);
o->oFlameScale = 3.0f;
}
void bhv_flame_moving_forward_growing_loop(void) {
UNUSED s32 unused;
UNUSED struct Object *flame;
obj_set_hitbox(o, &sGrowingBowserFlameHitbox);
o->oFlameScale = o->oFlameScale + 0.5;
cur_obj_scale(o->oFlameScale);
if (o->oMoveAnglePitch > 0x800) {
o->oMoveAnglePitch -= 0x200;
}
cur_obj_set_pos_via_transform();
cur_obj_update_floor_height();
if (o->oFlameScale > 30.0f) {
obj_mark_for_deletion(o);
}
if (o->oPosY < o->oFloorHeight) {
o->oPosY = o->oFloorHeight;
flame = spawn_object(o, MODEL_RED_FLAME, bhvFlameBowser);
obj_mark_for_deletion(o);
}
}
void bhv_flame_floating_landing_init(void) {
o->oAnimState = (s32)(random_float() * 10.0f);
o->oMoveAngleYaw = random_u16();
if (o->oBehParams2ndByte != 0) {
o->oForwardVel = random_float() * 5.0f;
} else {
o->oForwardVel = random_float() * 70.0f;
}
o->oVelY = random_float() * 20.0f;
o->oGravity = -1.0f;
o->oFlameSpeedTimerOffset = random_float() * 64.0f;
}
f32 sFlameFloatingYLimit[] = { -8.0f, -6.0f, -3.0f };
void bhv_flame_floating_landing_loop(void) {
UNUSED s32 unused;
cur_obj_update_floor_and_walls();
cur_obj_move_standard(78);
bowser_flame_move();
if (bowser_flame_should_despawn(900)) {
obj_mark_for_deletion(o);
}
if (o->oVelY < sFlameFloatingYLimit[o->oBehParams2ndByte]) {
o->oVelY = sFlameFloatingYLimit[o->oBehParams2ndByte];
}
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
if (o->oBehParams2ndByte == 0) {
spawn_object(o, MODEL_RED_FLAME, bhvFlameLargeBurningOut);
} else {
spawn_object(o, MODEL_NONE, bhvBlueFlamesGroup); //? wonder if they meant MODEL_BLUE_FLAME?
}
obj_mark_for_deletion(o);
}
o->oGraphYOffset = o->header.gfx.scale[1] * 14.0f;
}
void bhv_blue_bowser_flame_init(void) {
obj_translate_xz_random(o, 80.0f);
o->oAnimState = (s32)(random_float() * 10.0f);
o->oVelY = 7.0f;
o->oForwardVel = 35.0f;
o->oFlameScale = 3.0f;
o->oFlameUnusedRand = random_float() * 0.5;
o->oGravity = 1.0f;
o->oFlameSpeedTimerOffset = (s32)(random_float() * 64.0f);
}
void bhv_blue_bowser_flame_loop(void) {
s32 i;
obj_set_hitbox(o, &sGrowingBowserFlameHitbox);
if (o->oFlameScale < 16.0f) {
o->oFlameScale = o->oFlameScale + 0.5;
}
cur_obj_scale(o->oFlameScale);
cur_obj_update_floor_and_walls();
cur_obj_move_standard(78);
if (o->oTimer > 0x14) {
if (o->oBehParams2ndByte == 0) {
for (i = 0; i < 3; i++) {
spawn_object_relative_with_scale(0, 0, 0, 0, 5.0f, o, MODEL_RED_FLAME,
bhvFlameFloatingLanding);
}
} else {
spawn_object_relative_with_scale(1, 0, 0, 0, 8.0f, o, MODEL_BLUE_FLAME,
bhvFlameFloatingLanding);
spawn_object_relative_with_scale(2, 0, 0, 0, 8.0f, o, MODEL_BLUE_FLAME,
bhvFlameFloatingLanding);
}
obj_mark_for_deletion(o);
}
}
void bhv_flame_bouncing_init(void) {
o->oAnimState = (s32)(random_float() * 10.0f);
o->oVelY = 30.0f;
o->oForwardVel = 20.0f;
o->oFlameScale = o->header.gfx.scale[0];
o->oFlameSpeedTimerOffset = (s32)(random_float() * 64.0f);
}
void bhv_flame_bouncing_loop(void) {
struct Object *bowser;
if (o->oTimer == 0) {
o->oFlameBowser = cur_obj_nearest_object_with_behavior(bhvBowser);
}
bowser = o->oFlameBowser;
o->oForwardVel = 15.0f;
o->oBounciness = -1.0f;
cur_obj_scale(o->oFlameScale);
obj_set_hitbox(o, &sGrowingBowserFlameHitbox);
cur_obj_update_floor_and_walls();
cur_obj_move_standard(78);
if (bowser_flame_should_despawn(300)) {
obj_mark_for_deletion(o);
}
if (bowser != NULL) {
if (bowser->oHeldState == HELD_FREE) {
if (lateral_dist_between_objects(o, bowser) < 300.0f) {
obj_mark_for_deletion(o);
}
}
}
}
void bhv_blue_flames_group_loop(void) {
struct Object *flame;
s32 i;
if (o->oTimer == 0) {
o->oMoveAngleYaw = obj_angle_to_object(o, gMarioObject);
o->oBlueFlameNextScale = 5.0f;
}
if (o->oTimer < 16) {
if ((o->oTimer & 1) == 0) {
for (i = 0; i < 3; i++) {
flame = spawn_object(o, MODEL_BLUE_FLAME, bhvFlameBouncing);
flame->oMoveAngleYaw += i * 0x5555;
flame->header.gfx.scale[0] = o->oBlueFlameNextScale;
}
o->oBlueFlameNextScale -= 0.5;
}
} else {
obj_mark_for_deletion(o);
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ void spawn_triangle_break_particles(s16 numTris, s16 triModel, f32 triSize, s16
triangle->oFaceAngleYaw = triangle->oMoveAngleYaw;
triangle->oFaceAnglePitch = random_u16();
triangle->oVelY = random_f32_around_zero(50.0f);
if (triModel == 138 || triModel == 56) {
if (triModel == MODEL_DIRT_ANIMATION || triModel == MODEL_SL_CRACKED_ICE_CHUNK) {
triangle->oAngleVelPitch = 0xF00;
triangle->oAngleVelYaw = 0x500;
triangle->oForwardVel = 30.0f;
+1 -1
View File
@@ -43,7 +43,7 @@ void small_breakable_box_act_move(void) {
if (sp1E & 2) {
spawn_mist_particles();
spawn_triangle_break_particles(20, 138, 0.7f, 3);
spawn_triangle_break_particles(20, MODEL_DIRT_ANIMATION, 0.7f, 3);
obj_spawn_yellow_coins(o, 3);
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
+8 -3
View File
@@ -32,7 +32,7 @@ static void camera_lakitu_intro_act_trigger_cutscene(void) {
&& gMarioObject->oPosZ > -2000.0f && gMarioObject->oPosZ < -177.0f
&& gMarioObject->oPosZ < -177.0f) // always double check your conditions
{
if (set_mario_npc_dialog(2) == 1) {
if (set_mario_npc_dialog(MARIO_DIALOG_LOOK_UP) == MARIO_DIALOG_STATUS_START) {
o->oAction = CAMERA_LAKITU_INTRO_ACT_SPAWN_CLOUD;
}
}
@@ -42,7 +42,7 @@ static void camera_lakitu_intro_act_trigger_cutscene(void) {
* Warp up into the air and spawn cloud, then enter the TODO action.
*/
static void camera_lakitu_intro_act_spawn_cloud(void) {
if (set_mario_npc_dialog(2) == 2) {
if (set_mario_npc_dialog(MARIO_DIALOG_LOOK_UP) == MARIO_DIALOG_STATUS_SPEAK) {
o->oAction = CAMERA_LAKITU_INTRO_ACT_UNK2;
o->oPosX = 1800.0f;
@@ -63,6 +63,10 @@ static void camera_lakitu_intro_act_spawn_cloud(void) {
static void camera_lakitu_intro_act_show_dialog(void) {
s16 targetMovePitch;
s16 targetMoveYaw;
#ifdef AVOID_UB
targetMovePitch = 0;
targetMoveYaw = 0;
#endif
cur_obj_play_sound_1(SOUND_AIR_LAKITU_FLY);
@@ -115,7 +119,8 @@ static void camera_lakitu_intro_act_show_dialog(void) {
}
}
}
} else if (cur_obj_update_dialog_with_cutscene(2, DIALOG_UNK2_FLAG_0, CUTSCENE_DIALOG, DIALOG_034) != 0) {
} else if (cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_UP,
DIALOG_FLAG_TURN_TO_MARIO, CUTSCENE_DIALOG, DIALOG_034)) {
o->oCameraLakituFinishedDialog = TRUE;
}
}
-4
View File
@@ -107,10 +107,6 @@ void (*sOpenedCannonActions[])(void) = { opened_cannon_act_0, opened_cannon_act_
opened_cannon_act_3, opened_cannon_act_4, opened_cannon_act_5,
opened_cannon_act_6 };
u8 unused0EA1FC[] = { 2, 0, 0, 0, 0, 0, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0, 65, 32, 0, 0,
63, 128, 0, 0, 2, 0, 0, 0, 65, 160, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0,
65, 160, 0, 0, 63, 128, 0, 0, 8, 0, 0, 0, 65, 32, 0, 0, 63, 128, 0, 0 };
void bhv_cannon_base_loop(void) {
cur_obj_call_action_function(sOpenedCannonActions);
if (o->oCannonUnkF8)
+10 -4
View File
@@ -1,12 +1,14 @@
// capswitch.c.inc
UNUSED u8 sCapSwitchText[] = { DIALOG_010, DIALOG_011, DIALOG_012 };
void cap_switch_act_0(void) {
o->oAnimState = o->oBehParams2ndByte;
cur_obj_scale(0.5f);
o->oPosY += 71.0f;
spawn_object_relative_with_scale(0, 0, -71, 0, 0.5f, o, MODEL_CAP_SWITCH_BASE, bhvCapSwitchBase);
if (gCurrLevelNum != LEVEL_UNKNOWN_32) {
if (save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte]) {
if (save_file_get_flags() & sCapSaveFlags[o->oBehParams2ndByte]) {
o->oAction = 3;
o->header.gfx.scale[1] = 0.1f;
} else
@@ -17,7 +19,7 @@ void cap_switch_act_0(void) {
void cap_switch_act_1(void) {
if (cur_obj_is_mario_on_platform()) {
save_file_set_flags(D_8032F0C0[o->oBehParams2ndByte]);
save_file_set_flags(sCapSaveFlags[o->oBehParams2ndByte]);
o->oAction = 2;
cur_obj_play_sound_2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
}
@@ -30,13 +32,17 @@ void cap_switch_act_2(void) {
if (o->oTimer == 4) {
cur_obj_shake_screen(SHAKE_POS_SMALL);
spawn_mist_particles();
spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte);
spawn_triangle_break_particles(60, MODEL_CARTOON_STAR, 0.3f, o->oBehParams2ndByte);
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
}
} else {
sp1C = cur_obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
//! Neither of these flags are defined in this function so they do nothing.
// On an extra note, there's a specific check for this cutscene and
// there's no dialog defined since the cutscene itself calls the dialog.
sp1C = cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_FRONT,
(DIALOG_FLAG_TEXT_RESPONSE | DIALOG_FLAG_UNK_CAPSWITCH), CUTSCENE_CAP_SWITCH_PRESS, 0);
if (sp1C)
o->oAction = 3;
}
+4 -4
View File
@@ -256,8 +256,8 @@ static void chain_chomp_released_trigger_cutscene(void) {
//! Can delay this if we get into a cutscene-unfriendly action after the
// last post ground pound and before this
if (set_mario_npc_dialog(2) == 2 && (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND)
&& cutscene_object(CUTSCENE_STAR_SPAWN, o) == 1) {
if (set_mario_npc_dialog(MARIO_DIALOG_LOOK_UP) == MARIO_DIALOG_STATUS_SPEAK
&& (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) && cutscene_object(CUTSCENE_STAR_SPAWN, o) == 1) {
o->oChainChompReleaseStatus = CHAIN_CHOMP_RELEASED_LUNGE_AROUND;
o->oTimer = 0;
}
@@ -342,7 +342,7 @@ static void chain_chomp_released_jump_away(void) {
*/
static void chain_chomp_released_end_cutscene(void) {
if (cutscene_object(CUTSCENE_STAR_SPAWN, o) == -1) {
set_mario_npc_dialog(0);
set_mario_npc_dialog(MARIO_DIALOG_STOP);
o->oAction = CHAIN_CHOMP_ACT_UNLOAD_CHAIN;
}
}
@@ -536,7 +536,7 @@ void bhv_chain_chomp_gate_update(void) {
spawn_mist_particles_with_sound(SOUND_GENERAL_WALL_EXPLOSION);
set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ);
spawn_mist_particles_variable(0, 0x7F, 200.0f);
spawn_triangle_break_particles(30, 0x8A, 3.0f, 4);
spawn_triangle_break_particles(30, MODEL_DIRT_ANIMATION, 3.0f, 4);
obj_mark_for_deletion(o);
}
}
+16 -1
View File
@@ -1,5 +1,17 @@
// chuckya.c.inc
struct UnusedChuckyaData {
u8 unk0;
f32 unk4;
f32 unk8;
};
struct UnusedChuckyaData sUnusedChuckyaData[] = { { 2, 0.f, 1.f },
{ 2, 10.f, 1.f },
{ 2, 20.f, 1.f },
{ 2, 20.f, 1.f },
{ 8, 10.f, 1.f }};
void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
switch (o->parentObj->oChuckyaUnk88) {
case 0:
@@ -72,6 +84,9 @@ s32 approach_forward_vel(f32 *arr, f32 spC, f32 sp10) {
void chuckya_act_0(void) {
s32 sp3C;
#ifdef AVOID_UB
sp3C = 0;
#endif
UNUSED u8 pad[16];
s32 sp28;
if (o->oTimer == 0)
@@ -197,7 +212,7 @@ void bhv_chuckya_loop(void) {
chuckya_move();
break;
case HELD_HELD:
cur_obj_unrender_and_reset_state(2, 0);
cur_obj_unrender_set_action_and_anim(2, 0);
break;
case HELD_THROWN:
case HELD_DROPPED:
+3 -3
View File
@@ -12,7 +12,7 @@ struct ObjectHitbox sYellowCoinHitbox = {
/* hurtboxHeight: */ 0,
};
s16 D_8032F2A4[][2] = { { 0, -150 }, { 0, -50 }, { 0, 50 }, { 0, 150 },
s16 sCoinArrowPositions[][2] = { { 0, -150 }, { 0, -50 }, { 0, 50 }, { 0, 150 },
{ -50, 100 }, { -100, 50 }, { 50, 100 }, { 100, 50 } };
s32 bhv_coin_sparkles_init(void) {
@@ -161,8 +161,8 @@ void spawn_coin_in_formation(s32 sp50, s32 sp54) {
sp40[1] = sins(sp50 << 13) * 200.0f + 200.0f;
break;
case 4:
sp40[0] = D_8032F2A4[sp50][0];
sp40[2] = D_8032F2A4[sp50][1];
sp40[0] = sCoinArrowPositions[sp50][0];
sp40[2] = sCoinArrowPositions[sp50][1];
break;
}
if (sp54 & 0x10)
+10 -10
View File
@@ -1,10 +1,10 @@
// collide_particles.c.inc
s16 D_8032F2CC[] = { 0xD000, 0, 0x3000, 0, 0xDE67, 0x2199,
0x2199, 0x2199, 0xDE67, 0xDE67, 0x2199, 0xDE67 };
static s16 sTinyTriMovementParams[] = { 0xD000, 0, 0x3000, 0, 0xDE67, 0x2199,
0x2199, 0x2199, 0xDE67, 0xDE67, 0x2199, 0xDE67 };
s16 D_8032F2E4[] = { 0xE000, 0, 0, 0, 0x2000, 0, 0xE99A,
0x1666, 0x1666, 0x1666, 0xE99A, 0xE99A, 0x1666, 0xE99A };
static s16 sTinyStarMovementParams[] = { 0xE000, 0, 0, 0, 0x2000, 0, 0xE99A,
0x1666, 0x1666, 0x1666, 0xE99A, 0xE99A, 0x1666, 0xE99A };
void bhv_punch_tiny_triangle_loop(void) {
s16 sp1E;
@@ -28,9 +28,9 @@ void bhv_punch_tiny_triangle_init(void) {
struct Object *triangle;
for (i = 0; i < 6; i++) {
triangle = spawn_object(o, MODEL_DIRT_ANIMATION, bhvPunchTinyTriangle);
triangle->oMoveAngleYaw = gMarioObject->oMoveAngleYaw + D_8032F2CC[2 * i] + 0x8000;
triangle->oVelY = sins(D_8032F2CC[2 * i + 1]) * 25.0f;
triangle->oForwardVel = coss(D_8032F2CC[2 * i + 1]) * 25.0f;
triangle->oMoveAngleYaw = gMarioObject->oMoveAngleYaw + sTinyTriMovementParams[2 * i] + 0x8000;
triangle->oVelY = sins(sTinyTriMovementParams[2 * i + 1]) * 25.0f;
triangle->oForwardVel = coss(sTinyTriMovementParams[2 * i + 1]) * 25.0f;
}
}
@@ -54,9 +54,9 @@ void bhv_tiny_star_particles_init(void) {
struct Object *particle;
for (i = 0; i < 7; i++) {
particle = spawn_object(o, MODEL_CARTOON_STAR, bhvWallTinyStarParticle);
particle->oMoveAngleYaw = gMarioObject->oMoveAngleYaw + D_8032F2E4[2 * i] + 0x8000;
particle->oVelY = sins(D_8032F2E4[2 * i + 1]) * 25.0f;
particle->oForwardVel = coss(D_8032F2E4[2 * i + 1]) * 25.0f;
particle->oMoveAngleYaw = gMarioObject->oMoveAngleYaw + sTinyStarMovementParams[2 * i] + 0x8000;
particle->oVelY = sins(sTinyStarMovementParams[2 * i + 1]) * 25.0f;
particle->oForwardVel = coss(sTinyStarMovementParams[2 * i + 1]) * 25.0f;
}
}
+9 -9
View File
@@ -6,11 +6,11 @@ struct DoorAction
s32 action;
};
struct DoorAction D_8032F300[] = { { 0x40000, 3 }, { 0x80000, 4 }, { 0x10000, 1 }, { 0x20000, 2 }, { -1, 0 }, };
static struct DoorAction sDoorActions[] = { { 0x40000, 3 }, { 0x80000, 4 }, { 0x10000, 1 }, { 0x20000, 2 }, { -1, 0 }, };
s32 D_8032F328[] = { SOUND_GENERAL_OPEN_WOOD_DOOR, SOUND_GENERAL_OPEN_IRON_DOOR };
static s32 sDoorOpenSounds[] = { SOUND_GENERAL_OPEN_WOOD_DOOR, SOUND_GENERAL_OPEN_IRON_DOOR };
s32 D_8032F330[] = { SOUND_GENERAL_CLOSE_WOOD_DOOR, SOUND_GENERAL_CLOSE_IRON_DOOR };
static s32 sDoorCloseSounds[] = { SOUND_GENERAL_CLOSE_WOOD_DOOR, SOUND_GENERAL_CLOSE_IRON_DOOR };
void door_animation_and_reset(s32 sp18) {
cur_obj_init_animation_with_sound(sp18);
@@ -29,27 +29,27 @@ void set_door_camera_event(void) {
void play_door_open_noise(void) {
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
if (o->oTimer == 0) {
cur_obj_play_sound_2(D_8032F328[sp1C]);
cur_obj_play_sound_2(sDoorOpenSounds[sp1C]);
gTimeStopState |= TIME_STOP_MARIO_OPENED_DOOR;
}
if (o->oTimer == 70) {
cur_obj_play_sound_2(D_8032F330[sp1C]);
cur_obj_play_sound_2(sDoorCloseSounds[sp1C]);
}
}
void play_warp_door_open_noise(void) {
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
if (o->oTimer == 30)
cur_obj_play_sound_2(D_8032F330[sp1C]);
cur_obj_play_sound_2(sDoorCloseSounds[sp1C]);
}
void bhv_door_loop(void) {
s32 sp1C = 0;
while (D_8032F300[sp1C].flag != (u32)~0) {
if (cur_obj_clear_interact_status_flag(D_8032F300[sp1C].flag)) {
while (sDoorActions[sp1C].flag != (u32)~0) {
if (cur_obj_clear_interact_status_flag(sDoorActions[sp1C].flag)) {
set_door_camera_event();
cur_obj_change_action(D_8032F300[sp1C].action);
cur_obj_change_action(sDoorActions[sp1C].action);
}
sp1C++;
}
Loaded 100 of 197 files, more files were not shown because too many files have changed in this diff. Show more