1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 22:44:30 +00:00

Set up build system and disassembly for gc-us (#1982)

* Build gc-us

* Set up gc-us disassembly

* Don't disasm unchanged overlays

* Fix gc-eu-mq BSS

* romalign link_animetion for NTSC

* Explicitly set CPP defines to 0/1

* Add #ifs to segment_symbols.h

* Add sButtonTextures now

* Fix message _SHIFTL usage

* Don't ifdef LANGUAGE_MAX
This commit is contained in:
cadmic 2024-07-06 12:38:31 -07:00 committed by GitHub
parent baf1e8c174
commit bf3339a16d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 14124 additions and 205 deletions

View file

@ -7,6 +7,10 @@ s32 gScreenWidth = SCREEN_WIDTH;
s32 gScreenHeight = SCREEN_HEIGHT;
u32 gSystemHeapSize = 0;
// For retail BSS ordering, the block number of gIrqMgr must be greater than the
// the block numbers assigned to extern variables above (declared in variables.h).
#pragma increment_block_number 220
PreNmiBuff* gAppNmiBufferPtr;
Scheduler gScheduler;
PadMgr gPadMgr;

View file

@ -6,7 +6,7 @@
// For retail BSS ordering, the block number of D_8015BD7C
// must be between 88 and 123 inclusive.
#pragma increment_block_number 26
#pragma increment_block_number 30
s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags);
s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange);

View file

@ -50,6 +50,13 @@ void Interface_Init(PlayState* play) {
ASSERT(interfaceCtx->doActionSegment != NULL, "parameter->do_actionSegment != NULL", "../z_construct.c", 169);
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
doActionOffset = LANGUAGE_JPN * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
} else {
doActionOffset = LANGUAGE_ENG * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
}
#else
if (gSaveContext.language == LANGUAGE_ENG) {
doActionOffset = LANGUAGE_ENG * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
} else if (gSaveContext.language == LANGUAGE_GER) {
@ -57,10 +64,18 @@ void Interface_Init(PlayState* play) {
} else {
doActionOffset = LANGUAGE_FRA * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
}
#endif
DMA_REQUEST_SYNC(interfaceCtx->doActionSegment, (uintptr_t)_do_action_staticSegmentRomStart + doActionOffset,
2 * DO_ACTION_TEX_SIZE, "../z_construct.c", 174);
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
doActionOffset = 3 * DO_ACTION_TEX_SIZE + LANGUAGE_JPN * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
} else {
doActionOffset = 3 * DO_ACTION_TEX_SIZE + LANGUAGE_ENG * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
}
#else
if (gSaveContext.language == LANGUAGE_ENG) {
doActionOffset = 3 * DO_ACTION_TEX_SIZE + LANGUAGE_ENG * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
} else if (gSaveContext.language == LANGUAGE_GER) {
@ -68,6 +83,7 @@ void Interface_Init(PlayState* play) {
} else {
doActionOffset = 3 * DO_ACTION_TEX_SIZE + LANGUAGE_FRA * DO_ACTION_MAX * DO_ACTION_TEX_SIZE;
}
#endif
DMA_REQUEST_SYNC(interfaceCtx->doActionSegment + 2 * DO_ACTION_TEX_SIZE,
(uintptr_t)_do_action_staticSegmentRomStart + doActionOffset, DO_ACTION_TEX_SIZE,

View file

@ -115,13 +115,15 @@ void* sUnusedEntranceCsList[] = {
gDekuTreeIntroCs, gJabuJabuIntroCs, gDcOpeningCs, gMinuetCs, gIceCavernSerenadeCs, gTowerBarrierCs,
};
#pragma increment_block_number 248
// Stores the frame the relevant cam data was last applied on
u16 gCamAtSplinePointsAppliedFrame;
u16 gCamEyePointAppliedFrame;
u16 gCamAtPointAppliedFrame;
// For retail BSS ordering, the block number of sReturnToCamId must be greater
// than that of gCamAtPointAppliedFrame (declared in variables.h).
#pragma increment_block_number 180
// Cam ID to return to when a scripted cutscene is finished
s16 sReturnToCamId;

View file

@ -10,7 +10,7 @@
// For retail BSS ordering, the block number of sLensFlareUnused must be lower
// than the extern variables declared in the header (e.g. gLightningStrike)
// while the block number of sNGameOverLightNode must be higher.
#pragma increment_block_number 70
#pragma increment_block_number 80
typedef enum {
/* 0x00 */ LIGHTNING_BOLT_START,
@ -218,7 +218,7 @@ s16 sSunDepthTestY;
// These variables could be moved farther down in the file to reduce the amount
// of block number padding here, but currently this causes BSS ordering issues
// for debug.
#pragma increment_block_number 227
#pragma increment_block_number 217
LightNode* sNGameOverLightNode;
LightInfo sNGameOverLightInfo;

View file

@ -27,9 +27,46 @@ s16 sMessageHasSetSfx = false;
u16 sOcarinaSongBitFlags = 0; // ocarina bit flags
#if OOT_NTSC
MessageTableEntry sJpnMessageEntryTable[] = {
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) /* Not Present */
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
{ textId, (_SHIFTL(type, 4, 4) | _SHIFTL(yPos, 0, 4)), _message_##textId##_jpn },
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage)
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage)
#include "assets/text/message_data.h"
#undef DEFINE_MESSAGE
#undef DEFINE_MESSAGE_NES
#undef DEFINE_MESSAGE_JPN
#undef DEFINE_MESSAGE_FFFC
{ 0xFFFF, 0, NULL },
};
MessageTableEntry sNesMessageEntryTable[] = {
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
{ textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_nes },
{ textId, (_SHIFTL(type, 4, 4) | _SHIFTL(yPos, 0, 4)), _message_##textId##_nes },
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) /* Not Present */
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage)
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) /* Not Present */
#include "assets/text/message_data.h"
#undef DEFINE_MESSAGE
#undef DEFINE_MESSAGE_NES
#undef DEFINE_MESSAGE_JPN
#undef DEFINE_MESSAGE_FFFC
{ 0xFFFF, 0, NULL },
};
#else
MessageTableEntry sNesMessageEntryTable[] = {
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
{ textId, (_SHIFTL(type, 4, 4) | _SHIFTL(yPos, 0, 4)), _message_##textId##_nes },
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) /* Not Present */
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
@ -74,6 +111,8 @@ const char* sFraMessageEntryTable[] = {
NULL,
};
#endif
MessageTableEntry sStaffMessageEntryTable[] = {
#define DEFINE_MESSAGE(textId, type, yPos, staffMessage) \
{ textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_staff },
@ -82,9 +121,15 @@ MessageTableEntry sStaffMessageEntryTable[] = {
{ 0xFFFF, 0, NULL },
};
#if OOT_NTSC
MessageTableEntry* sJpnMessageEntryTablePtr = sJpnMessageEntryTable;
MessageTableEntry* sNesMessageEntryTablePtr = sNesMessageEntryTable;
#else
MessageTableEntry* sNesMessageEntryTablePtr = sNesMessageEntryTable;
const char** sGerMessageEntryTablePtr = sGerMessageEntryTable;
const char** sFraMessageEntryTablePtr = sFraMessageEntryTable;
#endif
MessageTableEntry* sStaffMessageEntryTablePtr = sStaffMessageEntryTable;
s16 sTextboxBackgroundForePrimColors[][3] = {
@ -311,6 +356,8 @@ void Message_GrowTextbox(MessageContext* msgCtx) {
R_TEXTBOX_X = (R_TEXTBOX_X_TARGET + R_TEXTBOX_WIDTH_TARGET) - (R_TEXTBOX_WIDTH / 2);
}
#if OOT_PAL // TODO: implement NTSC version
void Message_FindMessage(PlayState* play, u16 textId) {
const char* foundSeg;
const char* nextSeg;
@ -382,6 +429,8 @@ void Message_FindMessage(PlayState* play, u16 textId) {
font->msgLength = nextSeg - foundSeg;
}
#endif
void Message_FindCreditsMessage(PlayState* play, u16 textId) {
const char* foundSeg;
const char* nextSeg;
@ -1649,6 +1698,7 @@ void Message_OpenText(PlayState* play, u16 textId) {
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_staff_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 1954);
} else {
#if OOT_PAL // TODO: implement NTSC version
if (gSaveContext.language == LANGUAGE_ENG) {
Message_FindMessage(play, textId);
msgCtx->msgLength = font->msgLength;
@ -1665,6 +1715,7 @@ void Message_OpenText(PlayState* play, u16 textId) {
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_fra_message_data_staticSegmentRomStart + font->msgOffset,
font->msgLength, "../z_message_PAL.c", 1990);
}
#endif
}
msgCtx->textBoxProperties = font->charTexBuf[0];
msgCtx->textBoxType = msgCtx->textBoxProperties >> 4;
@ -3372,8 +3423,14 @@ void Message_Update(PlayState* play) {
}
void Message_SetTables(void) {
#if OOT_NTSC
sJpnMessageEntryTablePtr = sJpnMessageEntryTable;
sNesMessageEntryTablePtr = sNesMessageEntryTable;
#else
sNesMessageEntryTablePtr = sNesMessageEntryTable;
sGerMessageEntryTablePtr = sGerMessageEntryTable;
sFraMessageEntryTablePtr = sFraMessageEntryTable;
#endif
sStaffMessageEntryTablePtr = sStaffMessageEntryTable;
}

View file

@ -2103,11 +2103,11 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l
action = DO_ACTION_NONE;
}
if (gSaveContext.language != LANGUAGE_ENG) {
if (gSaveContext.language != 0) { // LANGUAGE_JPN for NTSC versions, LANGUAGE_ENG for PAL versions
action += DO_ACTION_MAX;
}
if (gSaveContext.language == LANGUAGE_FRA) {
if (gSaveContext.language == 2) { // LANGUAGE_FRA for PAL versions
action += DO_ACTION_MAX;
}
@ -2167,11 +2167,11 @@ void Interface_SetNaviCall(PlayState* play, u16 naviCallState) {
void Interface_LoadActionLabelB(PlayState* play, u16 action) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (gSaveContext.language != LANGUAGE_ENG) {
if (gSaveContext.language != 0) { // LANGUAGE_JPN for NTSC versions, LANGUAGE_ENG for PAL versions
action += DO_ACTION_MAX;
}
if (gSaveContext.language == LANGUAGE_FRA) {
if (gSaveContext.language == 2) { // LANGUAGE_FRA for PAL versions
action += DO_ACTION_MAX;
}

View file

@ -4,13 +4,6 @@
#include "z64frame_advance.h"
#if OOT_DEBUG
void* gDebugCutsceneScript = NULL;
UNK_TYPE D_8012D1F4 = 0; // unused
#endif
Input* D_8012D1F8 = NULL;
TransitionTile gTransitionTile;
s32 gTransitionTileState;
VisMono gPlayVisMono;
@ -22,6 +15,13 @@ FaultClient D_801614B8;
s16 sTransitionFillTimer;
#if OOT_DEBUG
void* gDebugCutsceneScript = NULL;
UNK_TYPE D_8012D1F4 = 0; // unused
#endif
Input* D_8012D1F8 = NULL;
void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn);
// This macro prints the number "1" with a file and line number if R_ENABLE_PLAY_LOGS is enabled.