1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +00:00

Merge commit '7fcbf3f4b2' into doc_pause_menu

This commit is contained in:
Dragorn421 2024-08-01 21:47:44 +02:00
commit 9169d886bc
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
12 changed files with 1381 additions and 459 deletions

View file

@ -220,22 +220,29 @@ endif
# create extracted directories # create extracted directories
$(shell mkdir -p $(EXTRACTED_DIR) $(EXTRACTED_DIR)/assets $(EXTRACTED_DIR)/text) $(shell mkdir -p $(EXTRACTED_DIR) $(EXTRACTED_DIR)/assets $(EXTRACTED_DIR)/text)
ASSET_BIN_DIRS := $(shell find $(EXTRACTED_DIR)/assets -type d) ASSET_BIN_DIRS_EXTRACTED := $(shell find $(EXTRACTED_DIR)/assets -type d)
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) ASSET_BIN_DIRS_COMMITTED := $(shell find assets -type d -not -path "assets/xml*" -not -path assets/text)
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \ ASSET_BIN_DIRS := $(ASSET_BIN_DIRS_EXTRACTED) $(ASSET_BIN_DIRS_COMMITTED)
$(foreach f,$(wildcard assets/text/*.c),$(BUILD_DIR)/$(f:.c=.o))
ASSET_FILES_BIN_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.bin))
ASSET_FILES_BIN_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.bin))
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN_EXTRACTED:.bin=.bin.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
$(foreach f,$(ASSET_FILES_BIN_COMMITTED:.bin=.bin.inc.c),$(BUILD_DIR)/$f) \
$(foreach f,$(wildcard assets/text/*.c),$(BUILD_DIR)/$(f:.c=.o))
UNDECOMPILED_DATA_DIRS := $(shell find data -type d) UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
BASEROM_BIN_FILES := $(wildcard $(EXTRACTED_DIR)/baserom/*) BASEROM_BIN_FILES := $(wildcard $(EXTRACTED_DIR)/baserom/*)
# source files # source files
ASSET_C_FILES_EXTRACTED := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.c)))
ASSET_C_FILES_COMMITTED := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.c)))
SRC_C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))) SRC_C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)))
ASSET_C_FILES := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)))
S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s)) S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s))
O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \ O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(SRC_C_FILES:.c=.o),$(BUILD_DIR)/$f) \ $(foreach f,$(SRC_C_FILES:.c=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(ASSET_C_FILES:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \ $(foreach f,$(ASSET_C_FILES_EXTRACTED:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
$(foreach f,$(ASSET_C_FILES_COMMITTED:.c=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o) $(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o)
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' ) OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' )
@ -245,10 +252,14 @@ OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | g
DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d)
TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png)) TEXTURE_FILES_PNG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.png))
TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg)) TEXTURE_FILES_PNG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.png))
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \ TEXTURE_FILES_JPG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.jpg))
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) TEXTURE_FILES_JPG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.jpg))
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG_EXTRACTED:.png=.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
$(foreach f,$(TEXTURE_FILES_PNG_COMMITTED:.png=.inc.c),$(BUILD_DIR)/$f) \
$(foreach f,$(TEXTURE_FILES_JPG_EXTRACTED:.jpg=.jpg.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
$(foreach f,$(TEXTURE_FILES_JPG_COMMITTED:.jpg=.jpg.inc.c),$(BUILD_DIR)/$f)
# create build directories # create build directories
$(shell mkdir -p $(BUILD_DIR)/baserom $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(BUILD_DIR)/$(dir)) $(foreach dir,$(ASSET_BIN_DIRS),$(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%))) $(shell mkdir -p $(BUILD_DIR)/baserom $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(BUILD_DIR)/$(dir)) $(foreach dir,$(ASSET_BIN_DIRS),$(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)))
@ -464,6 +475,10 @@ else
endif endif
$(OBJCOPY) -O binary -j.rodata $@ $@.bin $(OBJCOPY) -O binary -j.rodata $@ $@.bin
$(BUILD_DIR)/assets/%.o: assets/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(OBJCOPY) -O binary $@ $@.bin
$(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c $(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(OBJCOPY) -O binary $@ $@.bin $(OBJCOPY) -O binary $@ $@.bin
@ -515,12 +530,21 @@ $(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/$(SPEC)
$(FADO) $$(tools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d) $(FADO) $$(tools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d)
$(AS) $(ASFLAGS) $(@:.o=.s) -o $@ $(AS) $(ASFLAGS) $(@:.o=.s) -o $@
$(BUILD_DIR)/assets/%.inc.c: assets/%.png
$(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@
$(BUILD_DIR)/assets/%.inc.c: $(EXTRACTED_DIR)/assets/%.png $(BUILD_DIR)/assets/%.inc.c: $(EXTRACTED_DIR)/assets/%.png
$(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@ $(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@
$(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin
$(ZAPD) bblb -eh -i $< -o $@
$(BUILD_DIR)/assets/%.bin.inc.c: $(EXTRACTED_DIR)/assets/%.bin $(BUILD_DIR)/assets/%.bin.inc.c: $(EXTRACTED_DIR)/assets/%.bin
$(ZAPD) bblb -eh -i $< -o $@ $(ZAPD) bblb -eh -i $< -o $@
$(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg
$(ZAPD) bren -eh -i $< -o $@
$(BUILD_DIR)/assets/%.jpg.inc.c: $(EXTRACTED_DIR)/assets/%.jpg $(BUILD_DIR)/assets/%.jpg.inc.c: $(EXTRACTED_DIR)/assets/%.jpg
$(ZAPD) bren -eh -i $< -o $@ $(ZAPD) bren -eh -i $< -o $@

View file

@ -776,7 +776,8 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize);
void KaleidoSetup_Update(PlayState* play); void KaleidoSetup_Update(PlayState* play);
void KaleidoSetup_Init(PlayState* play); void KaleidoSetup_Init(PlayState* play);
void KaleidoSetup_Destroy(PlayState* play); void KaleidoSetup_Destroy(PlayState* play);
void func_8006EE50(Font* font, u16 arg1, u16 arg2); s32 Kanji_OffsetFromShiftJIS(s32 character);
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex);
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); void Font_LoadChar(Font* font, u8 character, u16 codePointIndex);
void Font_LoadMessageBoxIcon(Font* font, u16 icon); void Font_LoadMessageBoxIcon(Font* font, u16 icon);
void Font_LoadOrderedFont(Font* font); void Font_LoadOrderedFont(Font* font);

View file

@ -75,6 +75,38 @@
#define MESSAGE_WIDE_HIGHSCORE 0x869F #define MESSAGE_WIDE_HIGHSCORE 0x869F
#define MESSAGE_WIDE_TIME 0x81A1 #define MESSAGE_WIDE_TIME 0x81A1
/*
* Message character constants
*/
// Non-Wide (nes/ger/fra)
#define MESSAGE_CHAR_SPACE 0x20 // ' '
// Wide (jpn)
#define MESSAGE_WIDE_CHAR_SPACE 0x8140 // ' '
#define MESSAGE_WIDE_CHAR_TOUTEN 0x8141 // '、'
#define MESSAGE_WIDE_CHAR_KUTEN 0x8142 // '。'
#define MESSAGE_WIDE_CHAR_PERIOD 0x8144 // ''
#define MESSAGE_WIDE_CHAR_NAKATEN 0x8145 // '・'
#define MESSAGE_WIDE_CHAR_QUESTION_MARK 0x8148 // ''
#define MESSAGE_WIDE_CHAR_EXCLAMATION_MARK 0x8149 // ''
#define MESSAGE_WIDE_CHAR_CIRCUMFLEX_ACCENT 0x814F // ''
#define MESSAGE_WIDE_CHAR_DOUBLE_QUOTATION_MARK_LEFT 0x8167 // '“'
#define MESSAGE_WIDE_CHAR_DOUBLE_QUOTATION_MARK_RIGHT 0x8168 // '”'
#define MESSAGE_WIDE_CHAR_PARENTHESES_LEFT 0x8169 // ''
#define MESSAGE_WIDE_CHAR_PARENTHESES_RIGHT 0x816A // ''
#define MESSAGE_WIDE_CHAR_KAGIKAKKO_LEFT 0x8175 // '「'
#define MESSAGE_WIDE_CHAR_KAGIKAKKO_RIGHT 0x8176 // '」'
#define MESSAGE_WIDE_CHAR_NUMBER_SIGN 0x8194 // ''
#define MESSAGE_WIDE_CHAR_ASTERISK 0x8196 // ''
#define MESSAGE_WIDE_CHAR_ZERO 0x824F // ''
#define MESSAGE_WIDE_CHAR_ONE 0x8250 // ''
#define MESSAGE_WIDE_CHAR_HOURS 0x8E9E // '時'
#define MESSAGE_WIDE_CHAR_SECONDS 0x9562 // '秒'
#define MESSAGE_WIDE_CHAR_MINUTES 0x95AA // '分'
/* /*
* Colors * Colors
*/ */

View file

@ -106,8 +106,15 @@ typedef enum {
// An option is to implement and use `ANIM_FLAG_OVERRIDE_MOVEMENT`. // An option is to implement and use `ANIM_FLAG_OVERRIDE_MOVEMENT`.
#define ANIM_FLAG_UPDATE_Y (1 << 1) #define ANIM_FLAG_UPDATE_Y (1 << 1)
// (player-only) Related to scaling an animation from/to child/adult // When this flag is set, Player's root limb position adjustment as child is disabled.
#define ANIM_FLAG_PLAYER_2 (1 << 2) // Many of Player's animations are originally created for Adult Link. When playing those
// animations as Child Link without any adjustment, he will appear to be floating in the air.
// To fix this, Child Link's root position is scaled down by default to fit his smaller size.
// However, if an animation is created specifically for Child Link, it is desirable to disable
// this scaling of the root position by using this flag.
// Note that this flag will be ignored if `ANIM_FLAG_UPDATE_XZ` or `ANIM_FLAG_UPDATE_Y` are also
// set. The adjustment will be applied in this case regardless of this flag being enabled.
#define ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT (1 << 2)
// (player-only) Call AnimTaskQueue_AddActorMove // (player-only) Call AnimTaskQueue_AddActorMove
#define ANIM_FLAG_PLAYER_SETMOVE (1 << 3) #define ANIM_FLAG_PLAYER_SETMOVE (1 << 3)
@ -123,7 +130,7 @@ typedef enum {
// Some animations have translation data that does not begin at the "origin". This is common when a // Some animations have translation data that does not begin at the "origin". This is common when a
// longer sequence of animation is broken up into different parts as seperate animations. // longer sequence of animation is broken up into different parts as seperate animations.
// In this case, when one animation starts its translation at the same position where a different animation // In this case, when one animation starts its translation at the same position where a different animation
// left off, resetting `prevTransl` is not desireable. This will cause the actor's position to noticeably change // left off, resetting `prevTransl` is not desirable. This will cause the actor's position to noticeably change
// when the translation data from the first frame of the new animation is applied. // when the translation data from the first frame of the new animation is applied.
// //
// When this flag is used during a transition between two animations, the first frame of movement is not applied. // When this flag is used during a transition between two animations, the first frame of movement is not applied.

View file

@ -235,8 +235,10 @@ typedef struct {
/* 0xE2FE */ u8 textBoxPos; // text box position /* 0xE2FE */ u8 textBoxPos; // text box position
/* 0xE300 */ s32 msgLength; // original name : "msg_data" /* 0xE300 */ s32 msgLength; // original name : "msg_data"
/* 0xE304 */ u8 msgMode; // original name: "msg_mode" /* 0xE304 */ u8 msgMode; // original name: "msg_mode"
/* 0xE305 */ char unk_E305[0x1]; /* 0xE306 */ union {
/* 0xE306 */ u8 msgBufDecoded[200]; // decoded message buffer, may be smaller than this u8 msgBufDecoded[200];
u16 msgBufDecodedWide[100];
};
/* 0xE3CE */ u16 msgBufPos; // original name : "rdp" /* 0xE3CE */ u16 msgBufPos; // original name : "rdp"
/* 0xE3D0 */ u16 unk_E3D0; // unused, only ever set to 0 /* 0xE3D0 */ u16 unk_E3D0; // unused, only ever set to 0
/* 0xE3D2 */ u16 textDrawPos; // draw all decoded characters up to this buffer position /* 0xE3D2 */ u16 textDrawPos; // draw all decoded characters up to this buffer position

View file

@ -1,7 +1,15 @@
#include "global.h" #include "global.h"
#include "message_data_static.h" #include "message_data_static.h"
void func_8006EE50(Font* font, u16 arg1, u16 arg2) { /**
* Loads a texture from kanji for the requested `character` into the character texture buffer
* at `codePointIndex`. The value of `character` is the SHIFT-JIS encoding of the character.
*/
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
#if OOT_NTSC
DmaMgr_RequestSync(&font->charTexBuf[codePointIndex],
(uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE);
#endif
} }
/** /**
@ -33,14 +41,34 @@ void Font_LoadMessageBoxIcon(Font* font, u16 icon) {
* the font buffer. * the font buffer.
*/ */
void Font_LoadOrderedFont(Font* font) { void Font_LoadOrderedFont(Font* font) {
s32 size;
s32 len; s32 len;
s32 codePointIndex; s32 codePointIndex;
s32 fontBufIndex; s32 fontBufIndex;
u32 offset; u32 offset;
font->msgOffset = FONT_MESSAGE_OFFSET; font->msgOffset = FONT_MESSAGE_OFFSET;
len = font->msgLength = FONT_MESSAGE_LENGTH; size = font->msgLength = FONT_MESSAGE_LENGTH;
#if OOT_NTSC
len = (u32)size / 2;
DmaMgr_RequestSync(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size);
fontBufIndex = 0;
for (codePointIndex = 0; font->msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
if (len < codePointIndex) {
return;
}
if (font->msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) {
offset = Kanji_OffsetFromShiftJIS(font->msgBufWide[codePointIndex]);
DmaMgr_RequestSync(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE);
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
}
}
#else
len = size;
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len, DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len,
"../z_kanfont.c", 122); "../z_kanfont.c", 122);
@ -62,4 +90,5 @@ void Font_LoadOrderedFont(Font* font) {
fontBufIndex += FONT_CHAR_TEX_SIZE / 8; fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
} }
} }
#endif
} }

File diff suppressed because it is too large Load diff

View file

@ -1125,13 +1125,14 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
sCurBodyPartPos = &this->bodyPartsPos[0] - 1; sCurBodyPartPos = &this->bodyPartsPos[0] - 1;
if (!LINK_IS_ADULT) { if (!LINK_IS_ADULT) {
if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) || if (!(this->skelAnime.moveFlags & ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT) ||
(this->skelAnime.moveFlags & ANIM_FLAG_UPDATE_XZ)) { (this->skelAnime.moveFlags & ANIM_FLAG_UPDATE_XZ)) {
pos->x *= 0.64f; pos->x *= 0.64f;
pos->z *= 0.64f; pos->z *= 0.64f;
} }
if (!(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) || (this->skelAnime.moveFlags & ANIM_FLAG_UPDATE_Y)) { if (!(this->skelAnime.moveFlags & ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT) ||
(this->skelAnime.moveFlags & ANIM_FLAG_UPDATE_Y)) {
pos->y *= 0.64f; pos->y *= 0.64f;
} }
} }
@ -1522,6 +1523,11 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
func_80090A28(this, spE4); func_80090A28(this, spE4);
func_800906D4(play, this, spE4); func_800906D4(play, this, spE4);
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) { } else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) {
//! @bug When Player is actively using shield, the `itemAction` value will be set to -1.
//! If shield is used at the same time a bottle is in hand, `Player_ActionToBottle` will
//! return -1, which results in an out of bounds access behind the `sBottleColors` array.
//! A value of -1 happens to access `gLinkChildBottleDL` (0x06018478). The last 3 bytes of
//! this pointer are read as a color, which results in a dark teal color used for the bottle.
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemAction)]; Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemAction)];
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710); OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710);

View file

@ -12,7 +12,7 @@
#include "terminal.h" #include "terminal.h"
// For retail BSS ordering, the block number of sStreamSfxProjectedPos must be 0. // For retail BSS ordering, the block number of sStreamSfxProjectedPos must be 0.
#pragma increment_block_number 208 #pragma increment_block_number 206
#define FLAGS ACTOR_FLAG_4 #define FLAGS ACTOR_FLAG_4

View file

@ -2008,7 +2008,8 @@ void Player_AnimReplacePlayOnceAdjusted(PlayState* play, Player* this, LinkAnima
void Player_AnimReplaceNormalPlayOnceAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { void Player_AnimReplaceNormalPlayOnceAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) {
Player_AnimReplacePlayOnceAdjusted(play, this, anim, Player_AnimReplacePlayOnceAdjusted(play, this, anim,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS); ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_ADJUST_STARTING_POS);
} }
void Player_AnimReplacePlayLoopSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, void Player_AnimReplacePlayLoopSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags,
@ -2027,7 +2028,8 @@ void Player_AnimReplacePlayLoopAdjusted(PlayState* play, Player* this, LinkAnima
void Player_AnimReplaceNormalPlayLoopAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) { void Player_AnimReplaceNormalPlayLoopAdjusted(PlayState* play, Player* this, LinkAnimationHeader* anim) {
Player_AnimReplacePlayLoopAdjusted(play, this, anim, Player_AnimReplacePlayLoopAdjusted(play, this, anim,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS); ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_ADJUST_STARTING_POS);
} }
void Player_ProcessControlStick(PlayState* play, Player* this) { void Player_ProcessControlStick(PlayState* play, Player* this) {
@ -5056,7 +5058,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) {
func_80832224(this); func_80832224(this);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_OVERRIDE_MOVEMENT);
// If this door is the second half of a double door (spawned as child) // If this door is the second half of a double door (spawned as child)
@ -5367,9 +5369,9 @@ s32 func_8083A6AC(Player* this, PlayState* play) {
this->stateFlags1 |= PLAYER_STATE1_21; this->stateFlags1 |= PLAYER_STATE1_21;
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
this->av2.actionVar2 = -1; this->av2.actionVar2 = -1;
this->av1.actionVar1 = sp50; this->av1.actionVar1 = sp50;
@ -6062,7 +6064,7 @@ s32 Player_ActionChange_11(Player* this, PlayState* play) {
LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f);
if (Player_IsChildWithHylianShield(this)) { if (Player_IsChildWithHylianShield(this)) {
Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_PLAYER_2); Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT);
} }
Player_PlaySfx(this, NA_SE_IT_SHIELD_POSTURE); Player_PlaySfx(this, NA_SE_IT_SHIELD_POSTURE);
@ -6892,8 +6894,8 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) {
Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98); Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_OVERRIDE_MOVEMENT);
chest->unk_1F4 = 1; chest->unk_1F4 = 1;
Camera_RequestSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS); Camera_RequestSetting(Play_GetCamera(play, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS);
} else { } else {
@ -7069,10 +7071,10 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) {
func_80832224(this); func_80832224(this);
Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos);
Player_AnimPlayOnce(play, this, anim); Player_AnimPlayOnce(play, this, anim);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_2 | play, this,
ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
return true; return true;
} }
@ -7152,8 +7154,9 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall
this->actor.prevPos = this->actor.world.pos; this->actor.prevPos = this->actor.world.pos;
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT |
ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS |
ANIM_FLAG_OVERRIDE_MOVEMENT);
return true; return true;
} }
@ -7242,8 +7245,9 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) {
this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; this->actor.shape.rot.y = this->actor.wallYaw + 0x8000;
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_end); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_end);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT |
ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS |
ANIM_FLAG_OVERRIDE_MOVEMENT);
OnePointCutscene_Init(play, 9601, 999, NULL, CAM_ID_MAIN); OnePointCutscene_Init(play, 9601, 999, NULL, CAM_ID_MAIN);
} else { } else {
// Leaving a crawlspace backwards // Leaving a crawlspace backwards
@ -7252,8 +7256,9 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) {
Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE,
0.0f); 0.0f);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT |
ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS |
ANIM_FLAG_OVERRIDE_MOVEMENT);
OnePointCutscene_Init(play, 9602, 999, NULL, CAM_ID_MAIN); OnePointCutscene_Init(play, 9602, 999, NULL, CAM_ID_MAIN);
} }
@ -8661,7 +8666,7 @@ void Player_Action_80843188(Player* this, PlayState* play) {
LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_clink_normal_defense_ALL, 1.0f, LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_clink_normal_defense_ALL, 1.0f,
Animation_GetLastFrame(&gPlayerAnim_clink_normal_defense_ALL), 0.0f, Animation_GetLastFrame(&gPlayerAnim_clink_normal_defense_ALL), 0.0f,
ANIMMODE_ONCE, 0.0f); ANIMMODE_ONCE, 0.0f);
Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_PLAYER_2); Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT);
} else { } else {
if (this->itemAction < 0) { if (this->itemAction < 0) {
func_8008EC70(this); func_8008EC70(this);
@ -9972,7 +9977,8 @@ void func_808467D4(PlayState* play, Player* this) {
0.0f); 0.0f);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
func_80846720(play, this, 0); func_80846720(play, this, 0);
} }
@ -11350,8 +11356,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
if (this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_SETMOVE) { if (this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_SETMOVE) {
AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime, AnimTaskQueue_AddActorMove(play, &this->actor, &this->skelAnime,
(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2) ? 1.0f (this->skelAnime.moveFlags & ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT)
: this->ageProperties->unk_08); ? 1.0f
: this->ageProperties->unk_08);
} }
Player_UpdateShapeYaw(this, play); Player_UpdateShapeYaw(this, play);
@ -14549,8 +14556,8 @@ void func_808510D4(PlayState* play, Player* this, void* anim) {
void func_808510F4(PlayState* play, Player* this, void* anim) { void func_808510F4(PlayState* play, Player* this, void* anim) {
Player_AnimReplacePlayOnce(play, this, anim, Player_AnimReplacePlayOnce(play, this, anim,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
} }
void func_80851114(PlayState* play, Player* this, void* anim) { void func_80851114(PlayState* play, Player* this, void* anim) {
@ -14559,8 +14566,8 @@ void func_80851114(PlayState* play, Player* this, void* anim) {
void func_80851134(PlayState* play, Player* this, void* anim) { void func_80851134(PlayState* play, Player* this, void* anim) {
Player_AnimReplacePlayLoop(play, this, anim, Player_AnimReplacePlayLoop(play, this, anim,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
} }
void func_80851154(PlayState* play, Player* this, void* anim) { void func_80851154(PlayState* play, Player* this, void* anim) {
@ -14807,7 +14814,8 @@ void func_808519EC(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_9C); Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_9C);
Player_AnimReplaceApplyFlags(play, this, Player_AnimReplaceApplyFlags(play, this,
ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y | ANIM_REPLACE_APPLY_FLAG_9 | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_UPDATE_Y |
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT);
} }
static struct_808551A4 D_808551A4[] = { static struct_808551A4 D_808551A4[] = {
@ -14924,16 +14932,16 @@ void func_80851E64(PlayState* play, Player* this, CsCmdActorCue* cue) {
void func_80851E90(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851E90(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimReplacePlayOnce(play, this, &gPlayerAnim_clink_op3_negaeri, Player_AnimReplacePlayOnce(play, this, &gPlayerAnim_clink_op3_negaeri,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
func_80832698(this, NA_SE_VO_LI_GROAN); func_80832698(this, NA_SE_VO_LI_GROAN);
} }
void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue) {
if (LinkAnimation_Update(play, &this->skelAnime)) { if (LinkAnimation_Update(play, &this->skelAnime)) {
Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait2, Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait2,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
} }
} }
@ -14960,8 +14968,8 @@ static AnimSfxEntry D_808551BC[] = {
void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) {
if (LinkAnimation_Update(play, &this->skelAnime)) { if (LinkAnimation_Update(play, &this->skelAnime)) {
Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3, Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3,
ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT | ANIM_FLAG_PLAYER_SETMOVE |
ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT);
this->av2.actionVar2 = 1; this->av2.actionVar2 = 1;
} else if (this->av2.actionVar2 == 0) { } else if (this->av2.actionVar2 == 0) {
Player_ProcessAnimSfxList(this, D_808551BC); Player_ProcessAnimSfxList(this, D_808551BC);
@ -14985,8 +14993,9 @@ void func_80852048(PlayState* play, Player* this, CsCmdActorCue* cue) {
void func_80852080(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852080(PlayState* play, Player* this, CsCmdActorCue* cue) {
Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_clink_demo_futtobi, Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_clink_demo_futtobi,
ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_PLAYER_2 | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_UPDATE_XZ | ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT |
ANIM_FLAG_ADJUST_STARTING_POS | ANIM_FLAG_OVERRIDE_MOVEMENT); ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_ADJUST_STARTING_POS |
ANIM_FLAG_OVERRIDE_MOVEMENT);
func_80832698(this, NA_SE_VO_LI_FALL_L); func_80832698(this, NA_SE_VO_LI_FALL_L);
} }
@ -15273,7 +15282,8 @@ void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_808
arg3->func(play, this, cue); arg3->func(play, this, cue);
} }
if ((D_80858AA0 & ANIM_FLAG_PLAYER_2) && !(this->skelAnime.moveFlags & ANIM_FLAG_PLAYER_2)) { if ((D_80858AA0 & ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT) &&
!(this->skelAnime.moveFlags & ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT)) {
this->skelAnime.morphTable[0].y /= this->ageProperties->unk_08; this->skelAnime.morphTable[0].y /= this->ageProperties->unk_08;
D_80858AA0 = 0; D_80858AA0 = 0;
} }

View file

@ -94,7 +94,7 @@ def read_s16(f: BinaryIO, offset: int) -> int:
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Report data/bss reorderings between the baserom and the current build " description="Report bss reorderings between the baserom and the current build "
"by parsing relocations from the built object files and comparing their final values " "by parsing relocations from the built object files and comparing their final values "
"between the baserom and the current build. " "between the baserom and the current build. "
"Assumes that the only differences are due to ordering and that the text sections of the " "Assumes that the only differences are due to ordering and that the text sections of the "
@ -112,6 +112,11 @@ def main():
type=str, type=str,
help="ROM segment to check, e.g. 'boot', 'code', or 'ovl_player_actor' (default: all)", help="ROM segment to check, e.g. 'boot', 'code', or 'ovl_player_actor' (default: all)",
) )
parser.add_argument(
"--all-sections",
action="store_true",
help="Check ordering for all section types, not just .bss",
)
args = parser.parse_args() args = parser.parse_args()
version = args.oot_version version = args.oot_version
@ -176,10 +181,9 @@ def main():
else: else:
assert False, "Invalid relocation" assert False, "Invalid relocation"
if base_value != build_value: pointers.append(
pointers.append( Pointer(reloc.name, reloc.addend, base_value, build_value)
Pointer(reloc.name, reloc.addend, base_value, build_value) )
)
# Remove duplicates and sort by baserom address # Remove duplicates and sort by baserom address
pointers = list({p.base_value: p for p in pointers}.values()) pointers = list({p.base_value: p for p in pointers}.values())
@ -188,6 +192,9 @@ def main():
# Go through sections and report differences # Go through sections and report differences
for mapfile_segment in source_code_segments: for mapfile_segment in source_code_segments:
for file in mapfile_segment: for file in mapfile_segment:
if not args.all_sections and not file.sectionType == ".bss":
continue
pointers_in_section = [ pointers_in_section = [
p p
for p in pointers for p in pointers
@ -196,6 +203,17 @@ def main():
if not pointers_in_section: if not pointers_in_section:
continue continue
# Try to detect if the section is shifted by comparing the lowest
# address among any pointer into the section between base and build
base_min_address = min(p.base_value for p in pointers_in_section)
build_min_address = min(p.build_value for p in pointers_in_section)
section_shift = build_min_address - base_min_address
if all(
p.build_value == p.base_value + section_shift
for p in pointers_in_section
):
continue
print(f"{file.filepath} {file.sectionType} is reordered:") print(f"{file.filepath} {file.sectionType} is reordered:")
for i, p in enumerate(pointers_in_section): for i, p in enumerate(pointers_in_section):
if p.addend > 0: if p.addend > 0:

View file

@ -1169,7 +1169,7 @@ Jpeg_Decode = 0x8005B1AC; // type:func
KaleidoSetup_Update = 0x8005B4E0; // type:func KaleidoSetup_Update = 0x8005B4E0; // type:func
KaleidoSetup_Init = 0x8005B74C; // type:func KaleidoSetup_Init = 0x8005B74C; // type:func
KaleidoSetup_Destroy = 0x8005B8A0; // type:func KaleidoSetup_Destroy = 0x8005B8A0; // type:func
func_8006EE50 = 0x8005B8B0; // type:func Font_LoadCharWide = 0x8005B8B0; // type:func
Font_LoadChar = 0x8005B904; // type:func Font_LoadChar = 0x8005B904; // type:func
Font_LoadMessageBoxIcon = 0x8005B954; // type:func Font_LoadMessageBoxIcon = 0x8005B954; // type:func
Font_LoadOrderedFont = 0x8005B998; // type:func Font_LoadOrderedFont = 0x8005B998; // type:func
@ -3072,8 +3072,8 @@ Message_SetTextColor = 0x800D7514; // type:func
Message_DrawTextboxIcon = 0x800D77C8; // type:func Message_DrawTextboxIcon = 0x800D77C8; // type:func
Message_DrawItemIcon = 0x800D7F0C; // type:func Message_DrawItemIcon = 0x800D7F0C; // type:func
Message_HandleOcarina = 0x800D8258; // type:func Message_HandleOcarina = 0x800D8258; // type:func
Message_DrawTextJPN = 0x800D8468; // type:func Message_DrawTextWide = 0x800D8468; // type:func
Message_DrawTextNES = 0x800D985C; // type:func Message_DrawText = 0x800D985C; // type:func
Message_LoadItemIcon = 0x800DAAD4; // type:func Message_LoadItemIcon = 0x800DAAD4; // type:func
Message_Decode = 0x800DAC74; // type:func Message_Decode = 0x800DAC74; // type:func
Message_OpenText = 0x800DD19C; // type:func Message_OpenText = 0x800DD19C; // type:func