Mostly finish seq_title.c

This commit is contained in:
Seeky 2024-09-02 19:50:25 +01:00
parent 3df34b8b42
commit 33d22acc6d
3 changed files with 103 additions and 36 deletions

View File

@ -64,9 +64,6 @@ mario.c:
.sbss start:0x805AE8E8 end:0x805AE8F8
.sdata2 start:0x805B23C8 end:0x805B2578
seqdef.c:
.data start:0x804287A8 end:0x804287F0
mario_pouch.c:
extab start:0x8000B820 end:0x8000B898
extabindex start:0x800177A0 end:0x80017854
@ -82,10 +79,14 @@ seq_title.c:
.text start:0x8017B130 end:0x8017BF2C
.ctors start:0x8031BF04 end:0x8031BF08
.rodata start:0x80336338 end:0x803364C0
.bss start:0x805122C4 end:0x80512360
.data start:0x80428788 end:0x804287A8
.bss start:0x805122B8 end:0x80512360
.sdata start:0x805AE0B0 end:0x805AE0B8
.sdata2 start:0x805B3070 end:0x805B30C0
seqdef.c:
.data start:0x804287A8 end:0x804287F0
seqdrv.c:
extab start:0x8000C3B8 end:0x8000C3C8
extabindex start:0x80018898 end:0x800188B0

View File

@ -13120,13 +13120,13 @@ _unload = .text:0x8017AF98; // type:function size:0x198
seq_titleInit = .text:0x8017B130; // type:function size:0x120
seq_titleMain = .text:0x8017B250; // type:function size:0x1C0
seq_titleExit = .text:0x8017B410; // type:function size:0x8C
seqTitleDispCb = .text:0x8017B49C; // type:function size:0x4
seqTitleDispCb = .text:0x8017B49C; // type:function size:0x4 scope:local
seqTitleInitLayout = .text:0x8017B4A0; // type:function size:0x3A0
func_8017b840 = .text:0x8017B840; // type:function size:0x6C
__dt__Q34nw4r3lyt19ArcResourceAccessorFv = .text:0x8017B840; // type:function size:0x6C
seqTitleDisp = .text:0x8017B8AC; // type:function size:0x3A0
getNextDanMapname = .text:0x8017BC4C; // type:function size:0x238
__sinit_seq_title_c = .text:0x8017BE84; // type:function size:0x4C
func_8017bed0 = .text:0x8017BED0; // type:function size:0x5C
__sinit_\seq_title_c = .text:0x8017BE84; // type:function size:0x4C
__dt__12SeqTitleWorkFv = .text:0x8017BED0; // type:function size:0x5C
seqInit_SPMARIO = .text:0x8017BF2C; // type:function size:0x40
seqMain = .text:0x8017BF6C; // type:function size:0x108
seqSetSeq = .text:0x8017C074; // type:function size:0x10
@ -17739,7 +17739,7 @@ func_802e4614 = .text:0x802E4614; // type:function size:0x70
func_802e4684 = .text:0x802E4684; // type:function size:0x6C
func_802e46f0 = .text:0x802E46F0; // type:function size:0x20
func_802e4710 = .text:0x802E4710; // type:function size:0x4C
func_802e475c = .text:0x802E475C; // type:function size:0x84
__dt__Q44nw4r2ut6detail12LinkListImplFv = .text:0x802E475C; // type:function size:0x84
func_802e47e0 = .text:0x802E47E0; // type:function size:0x48
func_802e4828 = .text:0x802E4828; // type:function size:0x44
func_802e486c = .text:0x802E486C; // type:function size:0x2C
@ -18000,8 +18000,8 @@ func_802f2844 = .text:0x802F2844; // type:function size:0x1C
func_802f2860 = .text:0x802F2860; // type:function size:0x90
func_802f28f0 = .text:0x802F28F0; // type:function size:0x58
func_802f2948 = .text:0x802F2948; // type:function size:0x110
func_802f2a58 = .text:0x802F2A58; // type:function size:0x74
func_802f2acc = .text:0x802F2ACC; // type:function size:0x40
__ct__Q34nw4r3lyt8DrawInfoFv = .text:0x802F2A58; // type:function size:0x74
__dt__Q34nw4r3lyt8DrawInfoFv = .text:0x802F2ACC; // type:function size:0x40
func_802f2b0c = .text:0x802F2B0C; // type:function size:0xE8
func_802f2bf4 = .text:0x802F2BF4; // type:function size:0x1BC
GetFrameSize__Q34nw4r3lyt13AnimTransformCFv = .text:0x802F2DB0; // type:function size:0xC
@ -18013,7 +18013,7 @@ func_802f30b4 = .text:0x802F30B4; // type:function size:0xBC
func_802f3170 = .text:0x802F3170; // type:function size:0x1EC
func_802f335c = .text:0x802F335C; // type:function size:0x31C
func_802f3678 = .text:0x802F3678; // type:function size:0x34
func_802f36ac = .text:0x802F36AC; // type:function size:0x40
__dt__Q34nw4r3lyt16ResourceAccessorFv = .text:0x802F36AC; // type:function size:0x40
func_802f36ec = .text:0x802F36EC; // type:function size:0x10
func_802f36fc = .text:0x802F36FC; // type:function size:0x8
func_802f3704 = .text:0x802F3704; // type:function size:0xCC
@ -29407,7 +29407,7 @@ jumptable_80428608 = .data:0x80428608; // type:object size:0x2C scope:local
lbl_80428634 = .data:0x80428634; // type:object size:0x1C
lbl_80428650 = .data:0x80428650; // type:object size:0xF0
jumptable_80428740 = .data:0x80428740; // type:object size:0x44 scope:local
lbl_80428788 = .data:0x80428788; // type:object size:0x20
languageNames = .data:0x80428788; // type:object size:0x20 scope:local
seq_data = .data:0x804287A8; // type:object size:0x48
jumptable_804287F0 = .data:0x804287F0; // type:object size:0xAC scope:local
lbl_804288a0 = .data:0x804288A0; // type:object size:0xE0
@ -33292,7 +33292,7 @@ lbl_805121f8 = .bss:0x805121F8; // type:object size:0x28
lbl_80512220 = .bss:0x80512220; // type:object size:0x20
lbl_80512240 = .bss:0x80512240; // type:object size:0x78
lbl_805122b8 = .bss:0x805122B8; // type:object size:0xC
lbl_805122c4 = .bss:0x805122C4; // type:object size:0x9C
work = .bss:0x805122C4; // type:object size:0x9C scope:local
seqWork = .bss:0x80512360; // type:object size:0x24 scope:local data:4byte
lbl_80512388 = .bss:0x80512388; // type:object size:0x1218
lbl_805135a0 = .bss:0x805135A0; // type:object size:0x60
@ -33629,7 +33629,7 @@ lbl_805ae098 = .sdata:0x805AE098; // type:object size:0x4 data:4byte
lbl_805ae09c = .sdata:0x805AE09C; // type:object size:0x4 data:4byte
lbl_805ae0a0 = .sdata:0x805AE0A0; // type:object size:0x8 data:4byte
lbl_805ae0a8 = .sdata:0x805AE0A8; // type:object size:0x8 data:4byte
wp = .sdata:0x805AE0B0; // type:object size:0x8 scope:local data:4byte
wp = .sdata:0x805AE0B0; // type:object size:0x4 scope:local data:4byte
now_seq = .sdata:0x805AE0B8; // type:object size:0x4 scope:local data:4byte
next_seq = .sdata:0x805AE0BC; // type:object size:0x4 scope:local data:4byte
prev_seq = .sdata:0x805AE0C0; // type:object size:0x4 scope:local data:4byte
@ -34464,7 +34464,7 @@ lbl_805af168 = .sbss:0x805AF168; // type:object size:0x1 data:byte
lbl_805af169 = .sbss:0x805AF169; // type:object size:0x7 data:byte
lbl_805af170 = .sbss:0x805AF170; // type:object size:0x8 data:4byte
lbl_805af178 = .sbss:0x805AF178; // type:object size:0x8 data:4byte
lbl_805af180 = .sbss:0x805AF180; // type:object size:0x8 data:4byte
mspAllocator__Q34nw4r3lyt6Layout = .sbss:0x805AF180; // type:object size:0x8 data:4byte
lbl_805af188 = .sbss:0x805AF188; // type:object size:0x8 data:4byte
lbl_805af190 = .sbss:0x805AF190; // type:object size:0x8 data:4byte
lbl_805af198 = .sbss:0x805AF198; // type:object size:0x8 data:4byte

View File

@ -39,9 +39,8 @@ void seq_titleInit(SeqWork * seqWork)
// Configure hud
func_8019be84();
// TODO: flag defines
gp->flags &= ~1;
gp->flags &= ~2;
gp->flags &= ~SPMARIO_FLAG_1;
gp->flags &= ~SPMARIO_FLAG_2;
seqWork->stage = -1;
@ -71,7 +70,7 @@ void seq_titleMain(SeqWork * seqWork)
}
else
{
if (wp->unknown_0x0++ > 1800)
if (++wp->unknown_0x0 > 1800)
seqWork->stage = 2;
}
}
@ -135,13 +134,7 @@ static const char * languageNames[] = {
"uk"
};
void * operator new(size_t size, MEMAllocator * allocator);
void * operator new(size_t size, MEMAllocator * allocator)
{
return MEMAllocFromAllocator(allocator, size);
}
// Not matching: has try-catch missing
// Not matching: try-catches are wrong
void seqTitleInitLayout()
{
// Load archive
@ -159,15 +152,34 @@ void seqTitleInitLayout()
MEMInitAllocatorForExpHeap(&wp->allocator, wp->heapHandle, 0x20);
nw4r::lyt::Layout::SetAllocator(&wp->allocator);
wp->layout = new (&wp->allocator) nw4r::lyt::Layout();
wp->arcResAccessor = new (&wp->allocator) nw4r::lyt::ArcResourceAccessor();
void * layoutMem = MEMAllocFromAllocator(&wp->allocator, sizeof(*wp->layout));
nw4r::lyt::Layout * layout;
try {
layout = new (layoutMem) nw4r::lyt::Layout();
}
catch (...) {
throw;
}
wp->layout = layout;
void * accessorMem = MEMAllocFromAllocator(&wp->allocator, sizeof(*wp->arcResAccessor));
nw4r::lyt::ArcResourceAccessor * arcResAccessor;
try {
arcResAccessor = new (accessorMem) nw4r::lyt::ArcResourceAccessor();
}
catch (...) {
throw;
}
wp->arcResAccessor = arcResAccessor;
wp->arcResAccessor->Attach(wp->arc, "arc");
void * lytRes = wp->arcResAccessor->GetResource(0, "title.brlyt", 0);
NW4R_ASSERT_PTR(3076, lytRes);
wp->layout->Build(lytRes, wp->arcResAccessor);
void * lpaRes = wp->arcResAccessor->GetResource(0, "title_start.brlan", 0);
void * lpaRes = wp->arcResAccessor->GetResource(0, "title_Start.brlan", 0);
NW4R_ASSERT_PTR(3081, lpaRes);
wp->animations[0] = wp->layout->CreateAnimTransform(lpaRes, wp->arcResAccessor);
@ -185,8 +197,6 @@ void seqTitleInitLayout()
spsndSFXOn("SFX_SYS_TITLE_APPEAR1");
}
// func_8017b840 - nw4r::lyt::ArcResourceAccessor::__dt
void seqTitleDisp()
{
// TODO: nw4r inlines
@ -199,7 +209,7 @@ void seqTitleDisp()
wp->layout->Animate(0);
wp->layout->CalculateMtx(wp->drawInfo);
f32 temp = (wp->animFrame / wp->animations[wp->animNum]->GetFrameSize());
f32 unk = cosf(temp * 6.283185f * 8.0f);
f32 unk = cosf(temp * PIx2 * 8.0f);
s32 unk2 = (s32) (255.0f - ((unk * 256.0f) + 128.0f));
if (unk2 > 0xff)
unk2 = 0xff;
@ -233,10 +243,66 @@ void seqTitleDisp()
GXSetProjection(cam->projMtx, cam->projectionType);
}
// getNextDanMapName
const char * getNextDanMapname(s32 dungeonNo)
{
if (dungeonNo < 100)
{
switch (dungeonNo)
{
case 9:
case 19:
return "dan_21";
case 29:
case 39:
return "dan_22";
case 49:
case 59:
return "dan_23";
case 69:
case 79:
case 89:
return "dan_24";
case 99:
return "dan_30";
}
// [ sinit ]
if (dungeonNo < 25)
return "dan_01";
if (dungeonNo < 49)
return "dan_02";
if (dungeonNo < 75)
return "dan_03";
return "dan_04";
}
else
{
switch (dungeonNo - 100)
{
case 9:
case 19:
return "dan_61";
case 29:
case 39:
return "dan_62";
case 49:
case 59:
return "dan_63";
case 69:
case 79:
case 89:
return "dan_64";
case 99:
return "dan_70";
}
// func_8017bed0
if (dungeonNo - 100 < 25)
return "dan_41";
if (dungeonNo - 100 < 49)
return "dan_42";
if (dungeonNo - 100 < 75)
return "dan_43";
return "dan_44";
}
}
}