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

Match remaining GC retail versions (#2019)

* Match the remaining GC retail versions

* Fix BSS ordering for existing versions

* Disable clang-format for #pragma increment_block_number

* sramResetCode -> sSramResetCode

* Replace 0xFF3F with or-ing all buttons together

* Revert "Disable clang-format for #pragma increment_block_number"

This reverts commit 406b6d26c9.

---------

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
cadmic 2024-08-09 17:58:46 -07:00 committed by GitHub
parent cd2264f018
commit d495436190
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 11405 additions and 49 deletions

View file

@ -100,19 +100,19 @@ static ColliderCylinderInit sLightBallCylinderInit = {
static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 };
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-us:128"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
static EnGanonMant* sCape;
// TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving
// data around. It would be easier if we had more options for controlling BSS ordering in debug.
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-us:128"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
static s32 sSeed1;
static s32 sSeed2;
static s32 sSeed3;
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-us:192"
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192"
static BossGanon* sGanondorf;

View file

@ -28,6 +28,34 @@ ActorProfile En_Mag_Profile = {
static s16 sDelayTimer = 0;
#if OOT_VERSION < OOT_GC_US
void EnMag_ResetSram(void) {
static u8 buffer[0x2000];
bzero(buffer, 0x800);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8001000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8001800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8002000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8002800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8003000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8003800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8004000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8004800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8005000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8005800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8006000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8006800), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8007000), buffer, 0x800, 1);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8007800), buffer, 0x800, 1);
gSaveContext.audioSetting = 0;
gSaveContext.zTargetSetting = 0;
func_800F6700(gSaveContext.audioSetting);
}
#endif
void EnMag_Init(Actor* thisx, PlayState* play) {
EnMag* this = (EnMag*)thisx;
@ -109,10 +137,58 @@ void EnMag_Init(Actor* thisx, PlayState* play) {
void EnMag_Destroy(Actor* thisx, PlayState* play) {
}
#if OOT_VERSION < OOT_GC_US
void EnMag_CheckSramResetCode(PlayState* play, EnMag* this) {
static s32 sSramResetCode[] = {
BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT, BTN_START, BTN_B, BTN_CDOWN,
BTN_L, BTN_CRIGHT, BTN_CLEFT, BTN_A, BTN_CUP, BTN_R, BTN_Z,
};
s32 var_v1;
var_v1 =
play->state.input[2].cur.button & (BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_R | BTN_L | BTN_DRIGHT |
BTN_DLEFT | BTN_DDOWN | BTN_DUP | BTN_START | BTN_Z | BTN_B | BTN_A);
if (this->unk_E31C == var_v1) {
this->unk_E320--;
if (this->unk_E320 < 0) {
this->unk_E320 = 1;
} else {
var_v1 ^= this->unk_E31C;
}
} else {
this->unk_E320 = 16;
this->unk_E31C = var_v1;
}
if (this->unk_E316 < 4) {
if (sSramResetCode[this->unk_E316] & var_v1) {
this->unk_E316++;
} else if (var_v1 != 0) {
this->unk_E316 = 0;
}
} else {
if (CHECK_BTN_ALL(play->state.input[2].press.button, sSramResetCode[this->unk_E316])) {
this->unk_E316++;
} else if (var_v1 != 0) {
this->unk_E316 = 0;
}
}
if (this->unk_E316 == ARRAY_COUNT(sSramResetCode)) {
EnMag_ResetSram();
this->unk_E316 = 0;
}
}
#endif
void EnMag_Update(Actor* thisx, PlayState* play) {
s32 pad[2];
EnMag* this = (EnMag*)thisx;
#if OOT_VERSION < OOT_GC_US
EnMag_CheckSramResetCode(play, this);
#endif
if (gSaveContext.fileNum != 0xFEDC) {
if (this->globalState < MAG_STATE_DISPLAY) {
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) ||
@ -400,8 +476,10 @@ void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) {
// Title logo is shifted to the left in Master Quest
#if !OOT_MQ
#define LOGO_X_SHIFT 0
#define JPN_SUBTITLE_X_SHIFT 0
#else
#define LOGO_X_SHIFT (-8)
#define JPN_SUBTITLE_X_SHIFT (-32)
#endif
void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
@ -503,8 +581,17 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
#if OOT_MQ
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, (s16)this->subAlpha);
#if OOT_VERSION == OOT_GC_JP_MQ
EnMag_DrawImageRGBA32(&gfx, 235, 149, (u8*)gTitleUraLogoTex, 40, 40);
#elif OOT_VERSION == OOT_GC_US_MQ
if (gSaveContext.language == LANGUAGE_JPN) {
EnMag_DrawImageRGBA32(&gfx, 235, 149, (u8*)gTitleUraLogoTex, 40, 40);
} else {
EnMag_DrawImageRGBA32(&gfx, 174, 145, (u8*)gTitleMasterQuestSubtitleTex, 128, 32);
}
#else
EnMag_DrawImageRGBA32(&gfx, 174, 145, (u8*)gTitleMasterQuestSubtitleTex, 128, 32);
#endif
#endif
}
@ -520,8 +607,15 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
}
gDPSetCombineLERP(gfx++, TEXEL1, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT,
COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0);
#if !OOT_MQ
gDPSetPrimColor(gfx++, 0, 0x80, 255, 255, 170, (s16)this->subAlpha);
gDPSetEnvColor(gfx++, 255, 150, 0, 255);
#else
gDPSetPrimColor(gfx++, 0, 0x80, 170, 255, 255, (s16)this->subAlpha);
gDPSetEnvColor(gfx++, ZREG(34), 100 + ZREG(35), 255 + ZREG(36), 255);
#endif
if ((s16)this->subAlpha != 0) {
gDPLoadTextureBlock(gfx++, gTitleTitleJPNTex, G_IM_FMT_I, G_IM_SIZ_8b, 128, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP,
@ -530,7 +624,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 1);
gDPSetTileSize(gfx++, 1, this->unk_E30C & 0x7F, this->effectScroll & 0x7F,
(this->unk_E30C & 0x7F) + ((32 - 1) << 2), (this->effectScroll & 0x7F) + ((32 - 1) << 2));
gSPTextureRectangle(gfx++, 424, 576, 424 + 512, 576 + 64, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(gfx++, 424 + JPN_SUBTITLE_X_SHIFT, 576, 424 + JPN_SUBTITLE_X_SHIFT + 512, 576 + 64,
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
}
#endif
@ -544,7 +639,11 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
(s16)this->copyrightAlpha);
if ((s16)this->copyrightAlpha != 0) {
#if OOT_NTSC
#if OOT_VERSION < OOT_GC_US
gDPLoadTextureBlock(gfx++, gTitleCopyright19982002Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
#elif OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
gDPLoadTextureBlock(gfx++, gTitleCopyright19982002Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 160, 16, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,

View file

@ -53,7 +53,7 @@ ActorProfile En_Wonder_Item_Profile = {
/**/ NULL,
};
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-us:0"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0"
static Vec3f sTagPointsFree[9];
static Vec3f sTagPointsOrdered[9];

View file

@ -14,7 +14,7 @@
#include "assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.h"
#include "terminal.h"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-us:0"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0"
#define FLAGS ACTOR_FLAG_4
@ -1395,7 +1395,7 @@ void func_80B3F3D8(void) {
Sfx_PlaySfxCentered2(NA_SE_PL_SKIP);
}
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-us:128"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) {
static Vec3f D_80B42DA0;

View file

@ -11,7 +11,7 @@
#include "ichain.h"
#include "terminal.h"
#pragma increment_block_number "gc-eu:206 gc-eu-mq:206 gc-us:208"
#pragma increment_block_number "gc-eu:205 gc-eu-mq:205 gc-jp:207 gc-jp-ce:207 gc-jp-mq:207 gc-us:207 gc-us-mq:207"
#define FLAGS ACTOR_FLAG_4

View file

@ -354,19 +354,19 @@ void Player_Action_CsAction(Player* this, PlayState* play);
// .bss part 1
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-us:0"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0"
static s32 D_80858AA0;
// TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving
// data around. It would be easier if we had more options for controlling BSS ordering in debug.
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-us:128"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
static s32 D_80858AA4;
static Vec3f sInteractWallCheckResult;
static Input* sControlInput;
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-us:192"
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192"
// .data

View file

@ -808,7 +808,7 @@ static s16 sQuestItemGreen[] = { 255, 255, 255, 255, 60, 100, 130, 50, 200 };
static s16 sQuestItemBlue[] = { 255, 255, 255, 0, 0, 255, 0, 255, 0 };
static s16 sQuestItemFlags[] = { 0x0012, 0x0013, 0x0014, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005 };
#if OOT_NTSC
#if OOT_NTSC && OOT_VERSION < OOT_GC_JP_CE
static void* sSaveXTextures[] = { gFileSelSaveXJPNTex, gFileSelSaveXENGTex };
#endif

View file

@ -170,7 +170,17 @@ void ConsoleLogo_Init(GameState* thisx) {
this->state.main = ConsoleLogo_Main;
this->state.destroy = ConsoleLogo_Destroy;
this->exit = false;
#if OOT_VERSION < OOT_GC_US
if (!(gPadMgr.validCtrlrsMask & 1)) {
gSaveContext.fileNum = 0xFEDC;
} else {
gSaveContext.fileNum = 0xFF;
}
#else
gSaveContext.fileNum = 0xFF;
#endif
Sram_Alloc(&this->state, &this->sramCtx);
this->ult = 0;
this->unk_1D4 = 0x14;