1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

match z_title.c (#2075)

This commit is contained in:
Dragorn421 2024-08-23 22:26:53 +02:00 committed by GitHub
parent 37f0774778
commit 614c411058
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 66 additions and 6 deletions

View file

@ -128,13 +128,13 @@ typedef struct ConsoleLogoState {
/* 0x00A4 */ u8* staticSegment;
/* 0x00A8 */ View view;
/* 0x01D0 */ SramContext sramCtx;
/* 0x01D4 */ u16 unk_1D4; // not used in mq dbg (some sort of timer that doesn't seem to affect anything)
/* 0x01D4 */ s16 unk_1D4;
/* 0x01D6 */ s16 coverAlpha;
/* 0x01D8 */ s16 addAlpha; // not used in mq dbg
/* 0x01DA */ u16 visibleDuration; // not used in mq dbg
/* 0x01D8 */ s16 addAlpha;
/* 0x01DA */ s16 visibleDuration;
/* 0x01DC */ s16 ult;
/* 0x01DE */ s16 uls;
/* 0x01E0 */ char unk_1E0[0x01];
/* 0x01E0 */ u8 unk_1E0;
/* 0x01E1 */ u8 exit;
/* 0x01E2 */ char unk_1E2[0x06];
} ConsoleLogoState; // size = 0x1E8

View file

@ -7,8 +7,19 @@
#include "global.h"
#include "alloca.h"
#include "versions.h"
#if PLATFORM_N64
#include "n64dd.h"
#endif
#include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h"
// TODO
void func_800014E8_unknown(void);
s32 func_801C8090_unknown(void);
void func_801C7BC4_unknown(void);
s32 func_801C7ED0_unknown(void);
#if OOT_DEBUG
void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) {
Gfx* gfx;
@ -33,10 +44,29 @@ void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) {
}
#endif
// Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate
// the fade-in/fade-out + the duration of the n64 logo animation
void ConsoleLogo_Calc(ConsoleLogoState* this) {
#if PLATFORM_N64
if ((this->coverAlpha == 0) && (this->visibleDuration != 0)) {
this->unk_1D4--;
this->visibleDuration--;
if (this->unk_1D4 == 0) {
this->unk_1D4 = 400;
}
} else {
this->coverAlpha += this->addAlpha;
if (this->coverAlpha <= 0) {
this->coverAlpha = 0;
this->addAlpha = 3;
} else if (this->coverAlpha >= 255) {
this->coverAlpha = 255;
this->exit = true;
}
}
this->uls = this->ult & 0x7F;
this->ult++;
#else
this->exit = true;
#endif
}
void ConsoleLogo_SetupView(ConsoleLogoState* this, f32 x, f32 y, f32 z) {
@ -154,13 +184,37 @@ void ConsoleLogo_Main(GameState* thisx) {
void ConsoleLogo_Destroy(GameState* thisx) {
ConsoleLogoState* this = (ConsoleLogoState*)thisx;
#if PLATFORM_N64
if (this->unk_1E0) {
if (func_801C8090_unknown() != 0) {
func_800D31A0();
}
func_801C7BC4_unknown();
}
#endif
Sram_InitSram(&this->state, &this->sramCtx);
#if PLATFORM_N64
func_800014E8_unknown();
#endif
}
void ConsoleLogo_Init(GameState* thisx) {
u32 size = (uintptr_t)_nintendo_rogo_staticSegmentRomEnd - (uintptr_t)_nintendo_rogo_staticSegmentRomStart;
ConsoleLogoState* this = (ConsoleLogoState*)thisx;
#if PLATFORM_N64
if ((B_80121AE0 != 0) && ((u8)B_80121AE1 != 0) && (B_80121AE2 == 0)) {
if (func_801C7ED0_unknown() != 0) {
func_800D31A0();
}
this->unk_1E0 = true;
} else {
this->unk_1E0 = false;
}
#endif
this->staticSegment = GAME_STATE_ALLOC(&this->state, size, "../z_title.c", 611);
PRINTF("z_title.c\n");
ASSERT(this->staticSegment != NULL, "this->staticSegment != NULL", "../z_title.c", 614);

View file

@ -26,4 +26,10 @@ func_801C8510_unknown = 0x801C8510;
D_801DA410 = 0x801DA410;
D_801E8090 = 0x801E8090;
// z_title.c
func_800014E8_unknown = 0x800014E8;
func_801C8090_unknown = 0x801C8090;
func_801C7BC4_unknown = 0x801C7BC4;
func_801C7ED0_unknown = 0x801C7ED0;
#endif