diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2022-12-19 11:06:32 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-19 12:06:32 -0700 |
| commit | ca71275bbecc7db9a4eeca3a6ac4215b66de4318 (patch) | |
| tree | c2851f8cec211216fe0cb6a31a0260a62fc3bf53 /libs | |
| parent | 1114b13da81ab0b52fd4bb56a32f32331a21e581 (diff) | |
big d_a_alink pass (#214)
* d_a_alink pass1 wip
* more d_a_alink work
* remove asm
* more daalink work
* 20% dol code decompiled
* fixed some nonmatchings for building
* a few daalink functions and labeling some HIO data
Diffstat (limited to 'libs')
35 files changed, 259 insertions, 211 deletions
diff --git a/libs/JSystem/J2DGraph/J2DMatBlock.cpp b/libs/JSystem/J2DGraph/J2DMatBlock.cpp index 8585bfcd17..1268d8e9ab 100644 --- a/libs/JSystem/J2DGraph/J2DMatBlock.cpp +++ b/libs/JSystem/J2DGraph/J2DMatBlock.cpp @@ -995,17 +995,17 @@ void J2DTevBlock1::setGX() { for (int i = 0; i < 4; i++) { GXColorS10 color = mTevColor[i]; - GXTevRegID id; + int id; if (i == 3) { id = 0; } else { id = i + 1; } - GXSetTevColorS10(id, color); + GXSetTevColorS10((GXTevRegID)id, color); } GXSetNumTevStages(1); - GXSetTevColorIn(GX_TEVSTAGE0, ) + } #else #pragma push diff --git a/libs/JSystem/J2DGraph/J2DPicture.cpp b/libs/JSystem/J2DGraph/J2DPicture.cpp index b74dba0716..3e3a0ec79b 100644 --- a/libs/JSystem/J2DGraph/J2DPicture.cpp +++ b/libs/JSystem/J2DGraph/J2DPicture.cpp @@ -251,7 +251,7 @@ SECTION_DATA extern void* __vt__10J2DPicture[83 + 1 /* padding */] = { /* 802FC050-802FC118 2F6990 00C8+00 0/0 2/2 0/0 .text __ct__10J2DPictureFv */ #ifdef NONMATCHING J2DPicture::J2DPicture() - : field_0x10a(), field_0x12c(NULL), mWhite(), mBlack(), mCornerColor(), field_0x148(), + : field_0x10a(), mPalette(NULL), mWhite(), mBlack(), mCornerColor(), field_0x148(), field_0x14c() { for (int i = 0; i < 2; i++) { mTexture[i] = NULL; @@ -276,7 +276,7 @@ asm J2DPicture::J2DPicture() { * __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStreamP10JKRArchive */ #ifdef NONMATCHING J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, JKRArchive* p_archive) - : field_0x10a(), field_0x12c(NULL), mWhite(), mBlack(), mCornerColor(), field_0x148(), + : field_0x10a(), mPalette(NULL), mWhite(), mBlack(), mCornerColor(), field_0x148(), field_0x14c() { private_readStream(p_pane, p_stream, p_archive); } diff --git a/libs/JSystem/J2DGraph/J2DScreen.cpp b/libs/JSystem/J2DGraph/J2DScreen.cpp index bb60ce1778..d4aeeaa12b 100644 --- a/libs/JSystem/J2DGraph/J2DScreen.cpp +++ b/libs/JSystem/J2DGraph/J2DScreen.cpp @@ -468,10 +468,10 @@ SECTION_SDATA2 static f32 lit_1830 = 1.0f; // matches with literals #ifdef NONMATCHING void J2DScreen::draw(f32 x, f32 y, J2DGrafContext const* grafCtx) { - u32 x, y, width, height; + u32 l_x, l_y, width, height; if (mScissor) { - GXGetScissor(&x, &y, &width, &height); + GXGetScissor(&l_x, &l_y, &width, &height); } if (grafCtx != NULL) { @@ -483,7 +483,7 @@ void J2DScreen::draw(f32 x, f32 y, J2DGrafContext const* grafCtx) { } if (mScissor) { - GXSetScissor(x, y, width, height); + GXSetScissor(l_x, l_y, width, height); } GXSetNumIndStages(0); diff --git a/libs/JSystem/J3DGraphAnimator/J3DAnimation.cpp b/libs/JSystem/J3DGraphAnimator/J3DAnimation.cpp index 19bf206bbc..5a22db2d78 100644 --- a/libs/JSystem/J3DGraphAnimator/J3DAnimation.cpp +++ b/libs/JSystem/J3DGraphAnimator/J3DAnimation.cpp @@ -116,27 +116,15 @@ SECTION_SDATA2 static u8 lit_853[4] = { }; /* 803283FC-8032842C 322D3C 0030+00 0/0 25/25 285/285 .text init__12J3DFrameCtrlFs */ -// zero-initialized literal -#ifdef NONMATCHING -void J3DFrameCtrl::init(s16 pEnd) { +void J3DFrameCtrl::init(s16 i_end) { mAttribute = 2; - mState = false; + mState = 0; mStart = 0; - mEnd = pEnd; + mEnd = i_end; mLoop = 0; - mRate = 1.0f; - mFrame = 0.0f; + mRate = lit_852; + mFrame = FLOAT_LABEL(lit_853); } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DFrameCtrl::init(s16 param_0) { - nofralloc -#include "asm/JSystem/J3DGraphAnimator/J3DAnimation/init__12J3DFrameCtrlFs.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 80456438-80456440 004A38 0004+04 2/2 0/0 0/0 .sdata2 @973 */ @@ -151,14 +139,135 @@ SECTION_SDATA2 static f64 lit_975 = 4503601774854144.0 /* cast s32 to float */; /* 8032842C-803289CC 322D6C 05A0+00 0/0 92/92 382/382 .text checkPass__12J3DFrameCtrlFf */ +// matches with literals +#ifdef NONMATCHING +int J3DFrameCtrl::checkPass(f32 pass_frame) { + f32 cur_frame = mFrame; + f32 next_frame = cur_frame + mRate; + + switch (mAttribute) { + case 0: + case 1: + if (next_frame < mStart) { + next_frame = mStart; + } + + if (next_frame >= mEnd) { + next_frame = mEnd - 0.001f; + } + + if (cur_frame <= next_frame) { + if (cur_frame <= pass_frame && pass_frame < next_frame) { + return true; + } else { + return false; + } + } + + if (next_frame <= pass_frame && pass_frame < cur_frame) { + return true; + } + return false; + case 2: + if (cur_frame < mStart) { + while (next_frame < mStart) { + if (mLoop - mStart <= 0.0f) { + break; + } + next_frame += mLoop - mStart; + } + + if (next_frame <= pass_frame && pass_frame < mLoop) { + return true; + } else { + return false; + } + } else if (mEnd <= cur_frame) { + while (next_frame >= mEnd) { + if (mEnd - mLoop <= 0.0f) { + break; + } + next_frame -= mEnd - mLoop; + } + + if (mLoop <= pass_frame && pass_frame < next_frame) { + return true; + } else { + return false; + } + } else if (next_frame < mStart) { + while (next_frame < mStart) { + if (mLoop - mStart <= 0.0f) { + break; + } + next_frame += mLoop - mStart; + } + + if ((mStart <= pass_frame && pass_frame < cur_frame) || (next_frame <= pass_frame && pass_frame < mLoop)) { + return true; + } else { + return false; + } + } else if (mEnd <= next_frame) { + while (next_frame >= mEnd) { + if (mEnd - mLoop <= 0.0f) { + break; + } + + next_frame -= mEnd - mLoop; + } + + if ((cur_frame <= pass_frame && pass_frame < mEnd) || (mLoop <= pass_frame && pass_frame < next_frame)) { + return true; + } else { + return false; + } + } else if (cur_frame <= next_frame) { + if (cur_frame <= pass_frame && pass_frame < next_frame) { + return true; + } else { + return false; + } + } else if (next_frame <= pass_frame && pass_frame < cur_frame) { + return true; + } + return false; + case 3: + case 4: + if (next_frame >= mEnd) { + next_frame = mEnd - 0.001f; + } + + if (next_frame < mStart) { + next_frame = mStart; + } + + if (cur_frame <= next_frame) { + if (cur_frame <= pass_frame && pass_frame < next_frame) { + return true; + } else { + return false; + } + } + + if (next_frame <= pass_frame && pass_frame < cur_frame) { + return true; + } + return false; + default: + return false; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm int J3DFrameCtrl::checkPass(f32 param_0) { +asm int J3DFrameCtrl::checkPass(f32 pass_frame) { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DAnimation/checkPass__12J3DFrameCtrlFf.s" } #pragma pop +#endif /* 803289CC-80328E40 32330C 0474+00 0/0 3/3 0/0 .text update__12J3DFrameCtrlFv */ #pragma push @@ -171,6 +280,19 @@ asm void J3DFrameCtrl::update() { #pragma pop /* 80328E40-80328E90 323780 0050+00 0/0 3/3 0/0 .text __ct__15J3DAnmTransformFsPfPsPf */ +// matches with literals +#ifdef NONMATCHING +J3DAnmTransform::J3DAnmTransform(s16 param_0, f32* param_1, s16* param_2, f32* param_3) + : J3DAnmBase(param_0) { + field_0xc = param_1; + field_0x10 = param_2; + field_0x14 = param_3; + field_0x18 = 0; + field_0x1a = 0; + field_0x1c = 0; + field_0x1e = 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -179,6 +301,7 @@ asm J3DAnmTransform::J3DAnmTransform(s16 param_0, f32* param_1, s16* param_2, f3 #include "asm/JSystem/J3DGraphAnimator/J3DAnimation/__ct__15J3DAnmTransformFsPfPsPf.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80456448-80456450 004A48 0004+04 4/4 0/0 0/0 .sdata2 @1092 */ @@ -359,7 +482,7 @@ asm void J3DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J3DAnmClusterFull::getWeight(u16 param_0) const { +asm f32 J3DAnmClusterFull::getWeight(u16 param_0) const { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DAnimation/getWeight__17J3DAnmClusterFullCFUs.s" } @@ -370,7 +493,7 @@ asm void J3DAnmClusterFull::getWeight(u16 param_0) const { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J3DAnmClusterKey::getWeight(u16 param_0) const { +asm f32 J3DAnmClusterKey::getWeight(u16 param_0) const { nofralloc #include "asm/JSystem/J3DGraphAnimator/J3DAnimation/getWeight__16J3DAnmClusterKeyCFUs.s" } @@ -818,14 +941,9 @@ s32 J3DAnmCluster::getKind() const { } /* 8032C11C-8032C124 326A5C 0008+00 1/0 0/0 0/0 .text getWeight__13J3DAnmClusterCFUs */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DAnmCluster::getWeight(u16 param_0) const { - nofralloc -#include "asm/JSystem/J3DGraphAnimator/J3DAnimation/getWeight__13J3DAnmClusterCFUs.s" +f32 J3DAnmCluster::getWeight(u16 param_0) const { + return lit_852; } -#pragma pop /* 8032C124-8032C190 326A64 006C+00 1/0 0/0 0/0 .text __dt__17J3DAnmClusterFullFv */ #pragma push diff --git a/libs/JSystem/J3DGraphAnimator/J3DJoint.cpp b/libs/JSystem/J3DGraphAnimator/J3DJoint.cpp index 6f1e6b2fd2..fb10d64833 100644 --- a/libs/JSystem/J3DGraphAnimator/J3DJoint.cpp +++ b/libs/JSystem/J3DGraphAnimator/J3DJoint.cpp @@ -233,7 +233,7 @@ J3DJoint::J3DJoint() { mChild = NULL; mYounger = NULL; mJntNo = 0; - mMtxType = 1; + mKind = 1; mScaleCompensate = false; mTransformInfo = j3dDefaultTransformInfo; mBoundingSphereRadius = 0.0f; diff --git a/libs/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp b/libs/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp index f7332ea6bf..9aa446515e 100644 --- a/libs/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp +++ b/libs/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp @@ -93,8 +93,8 @@ J3DMaterialTable::~J3DMaterialTable() {} /* 8032F64C-8032F6F8 329F8C 00AC+00 0/0 1/1 5/5 .text * removeMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor */ #ifdef NONMATCHING -bool J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) { - bool ret = false; +int J3DMaterialTable::removeMatColorAnimator(J3DAnmColor* pAnmColor) { + int ret = false; u16 updateMatNum = pAnmColor->getUpdateMaterialNum(); for (u16 i = 0; i < updateMatNum; i++) { if (pAnmColor->isValidUpdateMaterialID(i)) { diff --git a/libs/JSystem/J3DGraphAnimator/J3DModel.cpp b/libs/JSystem/J3DGraphAnimator/J3DModel.cpp index c70594f53c..80f312c381 100644 --- a/libs/JSystem/J3DGraphAnimator/J3DModel.cpp +++ b/libs/JSystem/J3DGraphAnimator/J3DModel.cpp @@ -585,7 +585,7 @@ void J3DModel::prepareShapePackets() { if (getMtxCalcMode() == 2) { pkt->setBaseMtxPtr(&mInternalView); } else { - pkt->setBaseMtxPtr(j3dSys.getViewMtx()); + pkt->setBaseMtxPtr(&j3dSys.mViewMtx); } } } diff --git a/libs/JSystem/JAudio2/JAISound.cpp b/libs/JSystem/JAudio2/JAISound.cpp index 22a65961dd..2f943947c1 100644 --- a/libs/JSystem/JAudio2/JAISound.cpp +++ b/libs/JSystem/JAudio2/JAISound.cpp @@ -168,7 +168,7 @@ void JAISound::start_JAISound_(JAISoundID param_0, JGeometry::TVec3<f32> const* params.init(); fader.forceIn(); audience_ = param_2; - num_prepare_steps = 0; + prepareCount = 0; mCount = 0; if (param_1 == NULL || audience_ == NULL) { diff --git a/libs/JSystem/JFramework/JFWDisplay.cpp b/libs/JSystem/JFramework/JFWDisplay.cpp index 2ee0175cba..7134e6cf23 100644 --- a/libs/JSystem/JFramework/JFWDisplay.cpp +++ b/libs/JSystem/JFramework/JFWDisplay.cpp @@ -480,12 +480,10 @@ void JFWDisplay::waitBlanking(int param_0) { } } +#ifdef NONMATCHING /* ############################################################################################## */ /* 804511D0-804511D4 0006D0 0004+00 1/1 0/0 0/0 .sbss nextTick$2642 */ -static u8 nextTick[4] ALIGN_DECL(8); - -/* 804511D4-804511D8 0006D4 0004+00 1/1 0/0 0/0 .sbss None */ -static u8 data_804511D4[4]; +static OSTime nextTick ALIGN_DECL(8); /* 804511D8-804511DC 0006D8 0004+00 1/1 0/0 0/0 .sbss None */ static s8 data_804511D8; @@ -497,7 +495,6 @@ static u32 nextCount; static s8 data_804511E0; /* 80272CB0-80272DD0 26D5F0 0120+00 2/2 0/0 0/0 .text waitForTick__FUlUs */ -#ifdef NONMATCHING static void waitForTick(u32 param_0, u16 param_1) { if (param_0 != 0) { if (!data_804511D8) { @@ -531,6 +528,22 @@ static void waitForTick(u32 param_0, u16 param_1) { } } #else +/* ############################################################################################## */ +/* 804511D0-804511D4 0006D0 0004+00 1/1 0/0 0/0 .sbss nextTick$2642 */ +static u8 nextTick[4] ALIGN_DECL(8); + +/* 804511D4-804511D8 0006D4 0004+00 1/1 0/0 0/0 .sbss None */ +static u8 data_804511D4[4]; + +/* 804511D8-804511DC 0006D8 0004+00 1/1 0/0 0/0 .sbss None */ +static s8 data_804511D8; + +/* 804511DC-804511E0 0006DC 0004+00 1/1 0/0 0/0 .sbss nextCount$2650 */ +static u32 nextCount; + +/* 804511E0-804511E8 0006E0 0008+00 1/1 0/0 0/0 .sbss None */ +static s8 data_804511E0; + #pragma push #pragma optimization_level 0 #pragma optimizewithasm off diff --git a/libs/JSystem/JFramework/JFWSystem.cpp b/libs/JSystem/JFramework/JFWSystem.cpp index 329a6f2356..48efb937be 100644 --- a/libs/JSystem/JFramework/JFWSystem.cpp +++ b/libs/JSystem/JFramework/JFWSystem.cpp @@ -161,7 +161,7 @@ void JFWSystem::init() { if (rootHeap == NULL) { firstInit(); } - sInitCalled = true; + data_804511BC = true; JKRAram::create(CSetUpParam::aramAudioBufSize, CSetUpParam::aramGraphBufSize, CSetUpParam::streamPriority, CSetUpParam::decompPriority, diff --git a/libs/JSystem/JGadget/linklist.cpp b/libs/JSystem/JGadget/linklist.cpp index 513b9f3522..2a45b63615 100644 --- a/libs/JSystem/JGadget/linklist.cpp +++ b/libs/JSystem/JGadget/linklist.cpp @@ -89,20 +89,6 @@ JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::erase(iterator start, i /* 802DCB08-802DCBA8 2D7448 00A0+00 1/1 0/0 0/0 .text * splice__Q27JGadget13TNodeLinkListFQ37JGadget13TNodeLinkList8iteratorRQ27JGadget13TNodeLinkListQ37JGadget13TNodeLinkList8iterator */ -#ifdef NONMATCHING -void JGadget::TNodeLinkList::splice(iterator myIt, TNodeLinkList& otherList, iterator otherIt) { - TLinkListNode* otherNode = otherIt; - TLinkListNode* otherNextNode = otherNode->mNext; - - if (myIt == otherIt) { - return; - } - if (myIt.node != otherNextNode) { - otherList.Erase(otherNode); - Insert(myIt, otherNode); - } -} -#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -113,7 +99,6 @@ asm void JGadget::TNodeLinkList::splice(JGadget::TNodeLinkList::iterator param_0 #include "asm/JSystem/JGadget/linklist/func_802DCB08.s" } #pragma pop -#endif /* 802DCBA8-802DCBD4 2D74E8 002C+00 1/1 7/7 0/0 .text * Insert__Q27JGadget13TNodeLinkListFQ37JGadget13TNodeLinkList8iteratorPQ27JGadget13TLinkListNode */ diff --git a/libs/JSystem/JKernel/JKRAram.cpp b/libs/JSystem/JKernel/JKRAram.cpp index fad1d82be9..119155979c 100644 --- a/libs/JSystem/JKernel/JKRAram.cpp +++ b/libs/JSystem/JKernel/JKRAram.cpp @@ -10,6 +10,7 @@ #include "JSystem/JKernel/JKRAramStream.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JUtility/JUTException.h" +#include "MSL_C/string.h" #include "dol2asm.h" #include "dolphin/ar/ar.h" #include "global.h" @@ -28,7 +29,9 @@ extern "C" void mainRamToAram__7JKRAramFPUcUlUl15JKRExpandSwitchUlP7JKRHeapiPUl( extern "C" void aramToMainRam__7JKRAramFUlPUcUl15JKRExpandSwitchUlP7JKRHeapiPUl(); extern "C" static void JKRDecompressFromAramToMainRam__FUlPvUlUlUlPUl(); extern "C" static void decompSZS_subroutine__FPUcPUc(); +static int decompSZS_subroutine(u8* param_0, u8* param_1); extern "C" static void firstSrcData__Fv(); +static u8* firstSrcData(void); extern "C" static void nextSrcData__FPUc(); extern "C" void __sinit_JKRAram_cpp(); extern "C" void func_802D2DF0(void* _this); @@ -43,7 +46,6 @@ extern "C" u8 sAramObject__7JKRAram[4]; // External References: // -SECTION_INIT void memcpy(); extern "C" void alloc__7JKRHeapFUliP7JKRHeap(); extern "C" void alloc__7JKRHeapFUli(); extern "C" void free__7JKRHeapFPvP7JKRHeap(); @@ -281,7 +283,7 @@ static u32 readCount; static u32 maxDest; /* 804513FC-80451400 0008FC 0004+00 1/1 0/0 0/0 .sbss None */ -static u8 data_804513FC[4]; +static bool data_804513FC; /* 80451400-80451404 000900 0004+00 2/2 0/0 0/0 .sbss tsPtr */ static u32* tsPtr; @@ -297,8 +299,7 @@ static u32 tsArea; // doesn't use r13 void JKRDecompressFromAramToMainRam(u32 src, void* dst, u32 srcLength, u32 dstLength, u32 offset, u32* resourceSize) { -#define s_is_decompress_mutex_initialized lbl_804513FC -#define decompMutex lbl_804343C0 +#define s_is_decompress_mutex_initialized data_804513FC // STATIC BEGIN // This code is probably generated by the compiler for a static variable @@ -311,7 +312,7 @@ void JKRDecompressFromAramToMainRam(u32 src, void* dst, u32 srcLength, u32 dstLe // STATIC END OSLockMutex(&decompMutex); - u32 szpSize = getSZSBufferSize(); + u32 szpSize = JKRAram::getSZSBufferSize(); szpBuf = (u8*)JKRAllocFromSysHeap(szpSize, 0x20); ASSERT(szpBuf != 0); szpEnd = szpBuf + szpSize; @@ -431,7 +432,7 @@ static u8* nextSrcData(u8* current) { transLeft -= transSize; if (transLeft == 0) { - srcLimit = (u32)(dest + left) + transSize; + srcLimit = (dest + left) + transSize; } return dest; diff --git a/libs/JSystem/JKernel/JKRAramHeap.cpp b/libs/JSystem/JKernel/JKRAramHeap.cpp index a3d800e690..0e04176dc3 100644 --- a/libs/JSystem/JKernel/JKRAramHeap.cpp +++ b/libs/JSystem/JKernel/JKRAramHeap.cpp @@ -78,7 +78,7 @@ JKRAramHeap::JKRAramHeap(u32 startAddress, u32 size) { // close match, regalloc problem in the beginning of the while loop #ifdef NONMATCHING JKRAramHeap::~JKRAramHeap() { - JSUList<JKRAramBlock>* list = &lbl_8043430C; + JSUList<JKRAramBlock>* list = &sAramList; JSUListIterator<JKRAramBlock> iterator = list; while (iterator != list->getEnd()) { diff --git a/libs/JSystem/JKernel/JKRAramStream.cpp b/libs/JSystem/JKernel/JKRAramStream.cpp index 7f770f9f0a..90b754a50f 100644 --- a/libs/JSystem/JKernel/JKRAramStream.cpp +++ b/libs/JSystem/JKernel/JKRAramStream.cpp @@ -7,6 +7,8 @@ #include "JSystem/JKernel/JKRAramPiece.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSUFileStream.h" +#include "JSystem/JSupport/JSURandomInputStream.h" +#include "JSystem/JUtility/JUTException.h" #include "dol2asm.h" #include "global.h" @@ -125,10 +127,10 @@ s32 JKRAramStream::readFromAram(void) { #ifdef NONMATCHING s32 JKRAramStream::writeToAram(JKRAramStreamCommand* command) { u32 size; - u32 dstSize = command->mDstLength; + u32 dstSize = command->mSize; u32 offset = command->mOffset; u32 writtenLength = 0; - u32 destination = command->mDst; + u32 destination = command->mAddress; u8* buffer = command->mTransferBuffer; u32 bufferSize = command->mTransferBufferSize; JKRHeap* heap = command->mHeap; @@ -167,13 +169,11 @@ s32 JKRAramStream::writeToAram(JKRAramStreamCommand* command) { heap->dump(); } - panic_f__12JUTExceptionFPCciPCce("JKRAramStream.cpp", 0xac, "%s", - ":::Cannot alloc memory\n"); + JUTException::panic_f("JKRAramStream.cpp", 0xac, "%s", ":::Cannot alloc memory\n"); } if (buffer) { - seek__20JSURandomInputStreamFl17JSUStreamSeekFrom((JSURandomInputStream*)command->mStream, - offset, 0); + ((JSURandomInputStream*)command->mStream)->seek(offset, JSUStreamSeekFrom_SET); while (dstSize != 0) { u32 length; if (dstSize > size) { @@ -182,8 +182,7 @@ s32 JKRAramStream::writeToAram(JKRAramStreamCommand* command) { length = dstSize; } - s32 readLength = - read__14JSUInputStreamFPvl((JSUInputStream*)command->mStream, buffer, length); + s32 readLength = ((JSURandomInputStream*)command->mStream)->read(buffer, length); if (readLength == 0) { writtenLength = 0; break; diff --git a/libs/JSystem/JKernel/JKRDecomp.cpp b/libs/JSystem/JKernel/JKRDecomp.cpp index 1ea61165ed..f1f2a1799b 100644 --- a/libs/JSystem/JKernel/JKRDecomp.cpp +++ b/libs/JSystem/JKernel/JKRDecomp.cpp @@ -6,6 +6,7 @@ #include "JSystem/JKernel/JKRDecomp.h" #include "JSystem/JKernel/JKRAramPiece.h" #include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JKernel/JKRArchive.h" #include "dol2asm.h" #include "dolphin/types.h" diff --git a/libs/JSystem/JKernel/JKRDvdArchive.cpp b/libs/JSystem/JKernel/JKRDvdArchive.cpp index 1e2ee8eb91..70597f9992 100644 --- a/libs/JSystem/JKernel/JKRDvdArchive.cpp +++ b/libs/JSystem/JKernel/JKRDvdArchive.cpp @@ -8,6 +8,8 @@ #include "JSystem/JKernel/JKRDvdRipper.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JUtility/JUTException.h" +#include "MSL_C/math.h" +#include "MSL_C/string.h" #include "dol2asm.h" #include "global.h" @@ -29,7 +31,6 @@ extern "C" extern char const* const JKRDvdArchive__stringBase0; // External References: // -SECTION_INIT void memset(); extern "C" void alloc__7JKRHeapFUliP7JKRHeap(); extern "C" void alloc__7JKRHeapFUli(); extern "C" void free__7JKRHeapFPvP7JKRHeap(); @@ -70,7 +71,6 @@ extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" void abs(); extern "C" u8 sVolumeList__13JKRFileLoader[12]; extern "C" u8 sSystemHeap__7JKRHeap[4]; diff --git a/libs/JSystem/JKernel/JKRFileCache.cpp b/libs/JSystem/JKernel/JKRFileCache.cpp index 33f231947c..e480f0bc2c 100644 --- a/libs/JSystem/JKernel/JKRFileCache.cpp +++ b/libs/JSystem/JKernel/JKRFileCache.cpp @@ -319,7 +319,7 @@ void JKRFileCache::removeResourceAll(void) { iterator = mCacheBlockList.getFirst(); while (iterator != mCacheBlockList.getEnd()) { JKRFreeToHeap(mParentHeap, iterator->mMemoryPtr); - mCacheBlockList.remove(&iterator->mLink); + mCacheBlockList.remove(iterator.mLink); JSUListIterator<CCacheBlock> next = iterator++; CCacheBlock* cacheBlock = next.getObject(); delete cacheBlock; diff --git a/libs/JSystem/JKernel/JKRFileLoader.cpp b/libs/JSystem/JKernel/JKRFileLoader.cpp index 88e153fef8..7570bec016 100644 --- a/libs/JSystem/JKernel/JKRFileLoader.cpp +++ b/libs/JSystem/JKernel/JKRFileLoader.cpp @@ -177,17 +177,7 @@ SECTION_DEAD static char const* const pad_8039D152 = "\0\0\0\0\0"; #pragma pop /* 804508C0-804508C8 000340 0002+06 1/1 0/0 0/0 .sdata rootPath$2498 */ -SECTION_SDATA static u8 rootPath[2 + 6 /* padding */] = { - 0x2F, - 0x00, - /* padding */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; +SECTION_SDATA static char rootPath[2] = "/"; /* 802D44C4-802D45A0 2CEE04 00DC+00 1/1 0/0 0/0 .text fetchVolumeName__13JKRFileLoaderFPclPCc */ // matches, but lbl_804508C0 is accessed through r13 @@ -198,9 +188,9 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, long bufferSize, const // lbl_804508C0 = JKernel::rootPath$2498 "/" // lbl_803D2D18 = MSL_C::__lower_map - if (strcmp(path, lbl_8039D150) == 0) { - strcpy(buffer, lbl_804508C0); - return lbl_804508C0; + if (strcmp(path, "/") == 0) { + strcpy(buffer, rootPath); + return rootPath; } path++; @@ -211,7 +201,7 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, long bufferSize, const if (ch == -1) { lower_char = -1; } else { - lower_char = lbl_803D2D18[ch & 0xFF]; + lower_char = __lower_map[ch & 0xFF]; } *buffer = lower_char; @@ -223,7 +213,7 @@ const char* JKRFileLoader::fetchVolumeName(char* buffer, long bufferSize, const *buffer = '\0'; if (*path == '\0') { - path = lbl_804508C0; + path = rootPath; } return path; diff --git a/libs/JSystem/JKernel/JKRHeap.cpp b/libs/JSystem/JKernel/JKRHeap.cpp index 09ee11deeb..1087bc1eda 100644 --- a/libs/JSystem/JKernel/JKRHeap.cpp +++ b/libs/JSystem/JKernel/JKRHeap.cpp @@ -359,7 +359,7 @@ s32 JKRHeap::changeGroupID(u8 param_1) { */ // "not/nor" instruction in the wrong place #ifdef NONMATCHING -s32 JKRHeap::getMaxAllocatableSize(int alignment) { +u32 JKRHeap::getMaxAllocatableSize(int alignment) { u32 maxFreeBlock = (u32)getMaxFreeBlock(); s32 freeSize = getFreeSize(); diff --git a/libs/JSystem/JKernel/JKRMemArchive.cpp b/libs/JSystem/JKernel/JKRMemArchive.cpp index 5f53043543..4d834d4dba 100644 --- a/libs/JSystem/JKernel/JKRMemArchive.cpp +++ b/libs/JSystem/JKernel/JKRMemArchive.cpp @@ -206,10 +206,10 @@ bool JKRMemArchive::open(long entryNum, JKRArchive::EMountDirection mountDirecti mIsOpen = false; mMountDirection = mountDirection; - if (mMountDirection == JKRArchive::HEAD) { + if (mMountDirection == JKRArchive::MOUNT_DIRECTION_HEAD) { u32 loadedSize; mArcHeader = (SArcHeader*)JKRDvdRipper::loadToMainRAM( - entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap, JKRDvdRipper::FORWARD, 0, + entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, 0, &mCompression, &loadedSize); if (mArcHeader) { DCInvalidateRange(mArcHeader, loadedSize); @@ -217,7 +217,7 @@ bool JKRMemArchive::open(long entryNum, JKRArchive::EMountDirection mountDirecti } else { u32 loadedSize; mArcHeader = (SArcHeader*)JKRDvdRipper::loadToMainRAM( - entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap, JKRDvdRipper::BACKWARD, 0, + entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap, JKRDvdRipper::ALLOC_DIRECTION_BACKWARD, 0, &mCompression, &loadedSize); if (mArcHeader) { DCInvalidateRange(mArcHeader, loadedSize); @@ -269,7 +269,7 @@ bool JKRMemArchive::open(void* buffer, u32 bufferSize, JKRMemBreakFlag flag) { (u8*)(mArcHeader->file_data_offset + mArcHeader->header_length + (u32)mArcHeader); mIsOpen = (flag == JKRMEMBREAK_FLAG_UNKNOWN1); mHeap = JKRHeap::findFromRoot(buffer); - mCompression = JKRDecomp::NONE; + mCompression = COMPRESSION_NONE; return true; } #else diff --git a/libs/JSystem/JKernel/JKRSolidHeap.cpp b/libs/JSystem/JKernel/JKRSolidHeap.cpp index 79d79d5f6b..ab4185671a 100644 --- a/libs/JSystem/JKernel/JKRSolidHeap.cpp +++ b/libs/JSystem/JKernel/JKRSolidHeap.cpp @@ -323,7 +323,7 @@ void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const { getState_(p); setState_u32ID_(p, id); - setState_uUsedSize_(p, getUsedSize()); + setState_uUsedSize_(p, getUsedSize((JKRSolidHeap*)this)); setState_u32CheckCode_(p, (u32)mSolidHead + (u32)mSolidTail * 3); } #else diff --git a/libs/JSystem/JParticle/JPAMath.cpp b/libs/JSystem/JParticle/JPAMath.cpp index d0a4f911ae..36e6211995 100644 --- a/libs/JSystem/JParticle/JPAMath.cpp +++ b/libs/JSystem/JParticle/JPAMath.cpp @@ -15,13 +15,6 @@ struct JMath { static u8 sincosTable_[65536]; }; -struct JGeometry { - template <typename A1> - struct TVec3 {}; - /* TVec3<f32> */ - struct TVec3__template0 {}; -}; - // // Forward References: // diff --git a/libs/JSystem/JStudio/JStudio/functionvalue.cpp b/libs/JSystem/JStudio/JStudio/functionvalue.cpp index a79c09925d..9cd2828c9b 100644 --- a/libs/JSystem/JStudio/JStudio/functionvalue.cpp +++ b/libs/JSystem/JStudio/JStudio/functionvalue.cpp @@ -365,10 +365,10 @@ f64 interpolateValue_hermite(f64 c0, f64 c1, f64 x, f64 c2, f64 x2, f64 c3, f64 f64 b; a = c0 - c1; - b = a * (lbl_80455408 / (x2 - c1)); // (a - b) * 1.0 / (c - d) - c = b - lbl_80455408; // 1.0 - d = (lbl_80455410 + lbl_80455418 * b) * (b * b); // 3.0 - 2.0 * b - return (a * b * c * x3) + ((lbl_80455408 - d) * x + (d * c3)) + (a * (c * c) * c2); + b = a * (1.0 / (x2 - c1)); // (a - b) * 1.0 / (c - d) + c = b - 1.0; // 1.0 + d = (3.0 + -2.0 * b) * (b * b); // 3.0 - 2.0 * b + return (a * b * c * x3) + ((1.0 - d) * x + (d * c3)) + (a * (c * c) * c2); } #else /* 80281710-80281774 27C050 0064+00 4/4 0/0 0/0 .text @@ -387,15 +387,15 @@ asm f64 interpolateValue_hermite(f64 param_0, f64 param_1, f64 param_2, f64 para #ifdef NONMATCHING // really minor regalloc f64 interpolateValue_BSpline_uniform(f64 f1, f64 f2, f64 f3, f64 f4, f64 f5) { // pow3(1.0 - f1) - f64 f6 = (lbl_80455408 - f1); + f64 f6 = (1.0 - f1); f64 temp = f6; temp *= f6 * f6; f64 f0 = f1 * f1; f64 f8 = f0 * f1; - return ((lbl_80455420 * f8 - f0) + lbl_80455430) * f3 + (temp * f2 + f8 * f5) * lbl_80455428 + - f4 * (lbl_80455428 + lbl_80455420 * ((f1 + f0) - f8)); + return ((lit_799 * f8 - f0) + lit_801) * f3 + (temp * f2 + f8 * f5) * 0.5 + + f4 * (0.5 + lit_799 * ((f1 + f0) - f8)); } #else /* 80281774-802817D8 27C0B4 0064+00 1/1 0/0 0/0 .text diff --git a/libs/JSystem/JStudio/JStudio/fvb.cpp b/libs/JSystem/JStudio/JStudio/fvb.cpp index f822d7cd09..c7c256244f 100644 --- a/libs/JSystem/JStudio/JStudio/fvb.cpp +++ b/libs/JSystem/JStudio/JStudio/fvb.cpp @@ -562,7 +562,7 @@ void TObject_composite::prepare_data_(const data::TParse_TParagraph::TData& rDat ASSERT(pfn != NULL); pfn(pContent->data); - fnValue.data_set(*ops, pContent->data); + fnValue.data_set((TFunctionValue_composite::CompositeFunc)*ops, pContent->data); } #else /* 802842D4-80284338 27EC14 0064+00 1/0 0/0 0/0 .text diff --git a/libs/JSystem/JStudio/JStudio/stb.cpp b/libs/JSystem/JStudio/JStudio/stb.cpp index e624ce6b73..38af2c2c3a 100644 --- a/libs/JSystem/JStudio/JStudio/stb.cpp +++ b/libs/JSystem/JStudio/JStudio/stb.cpp @@ -333,7 +333,7 @@ TControl::~TControl() { #ifdef NONMATCHING void TControl::appendObject(TObject* p) { - p->setControl(this); + p->setControl_(this); mObjectContainer.Push_back(p); } #else diff --git a/libs/JSystem/JUtility/JUTDirectFile.cpp b/libs/JSystem/JUtility/JUTDirectFile.cpp index d791df3cc5..fbdf04b7ea 100644 --- a/libs/JSystem/JUtility/JUTDirectFile.cpp +++ b/libs/JSystem/JUtility/JUTDirectFile.cpp @@ -8,19 +8,6 @@ #include "dolphin/types.h" // -// Types: -// - -struct JUTDirectFile { - /* 802E8730 */ void fetch32byte(); - /* 802E87F8 */ JUTDirectFile(); - /* 802E881C */ ~JUTDirectFile(); - /* 802E8860 */ void fopen(char const*); - /* 802E88FC */ void fclose(); - /* 802E8958 */ void fgets(void*, int); -}; - -// // Forward References: // @@ -85,7 +72,7 @@ asm JUTDirectFile::~JUTDirectFile() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTDirectFile::fopen(char const* param_0) { +asm bool JUTDirectFile::fopen(char const* param_0) { nofralloc #include "asm/JSystem/JUtility/JUTDirectFile/fopen__13JUTDirectFileFPCc.s" } @@ -95,7 +82,7 @@ asm void JUTDirectFile::fopen(char const* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTDirectFile::fclose() { +asm bool JUTDirectFile::fclose() { nofralloc #include "asm/JSystem/JUtility/JUTDirectFile/fclose__13JUTDirectFileFv.s" } @@ -105,7 +92,7 @@ asm void JUTDirectFile::fclose() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JUTDirectFile::fgets(void* param_0, int param_1) { +asm int JUTDirectFile::fgets(void* param_0, int param_1) { nofralloc #include "asm/JSystem/JUtility/JUTDirectFile/fgets__13JUTDirectFileFPvi.s" } diff --git a/libs/JSystem/JUtility/JUTException.cpp b/libs/JSystem/JUtility/JUTException.cpp index 2bd2f9140f..36bee8c826 100644 --- a/libs/JSystem/JUtility/JUTException.cpp +++ b/libs/JSystem/JUtility/JUTException.cpp @@ -6,6 +6,7 @@ #include "JSystem/JUtility/JUTException.h" #include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTDirectPrint.h" +#include "JSystem/JUtility/JUTDirectFile.h" #include "MSL_C/MSL_Common/Src/float.h" #include "MSL_C/MSL_Common/Src/printf.h" #include "Runtime.PPCEABI.H/__va_arg.h" diff --git a/libs/JSystem/JUtility/JUTResFont.cpp b/libs/JSystem/JUtility/JUTResFont.cpp index 8c6cf5aeb1..6fb3d7a6fe 100644 --- a/libs/JSystem/JUtility/JUTResFont.cpp +++ b/libs/JSystem/JUtility/JUTResFont.cpp @@ -365,7 +365,7 @@ asm void JUTResFont::getWidthEntry(int param_0, JUTFont::TWidth* param_1) const /* 802DFD0C-802DFD58 2DA64C 004C+00 1/0 1/0 0/0 .text getCellWidth__10JUTResFontCFv */ // regalloc #ifdef NONMATCHING -u16 JUTResFont::getCellWidth() const { +int JUTResFont::getCellWidth() const { u16 width; if (mGly1Ptr && mGly1Ptr->magic != 0) { diff --git a/libs/JSystem/JUtility/JUTTexture.cpp b/libs/JSystem/JUtility/JUTTexture.cpp index 82e6b9e8c4..eb7e6e97ba 100644 --- a/libs/JSystem/JUtility/JUTTexture.cpp +++ b/libs/JSystem/JUtility/JUTTexture.cpp @@ -82,13 +82,9 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) { } if (mEmbPalette == NULL || !getEmbPaletteDelFlag()) { - JUTPalette* palette = new JUTPalette(); - if (palette) { - palette->storeTLUT(tlut, (_GXTlutFmt)tmp->colorFormat, - (JUTTransparency)tmp->alphaEnabled, tmp->numColors, - (void*)(tmp->format + tmp->paletteOffset)); - } - mEmbPalette = palette; + mEmbPalette = new JUTPalette(tlut, (_GXTlutFmt)tmp->colorFormat, + (JUTTransparency)tmp->alphaEnabled, tmp->numColors, + (void*)(tmp->format + tmp->paletteOffset)); mFlags = mFlags & 1 | 2; } else { mEmbPalette->storeTLUT(tlut, (_GXTlutFmt)tmp->colorFormat, @@ -185,10 +181,10 @@ void JUTTexture::initTexObj() { offset = 0x20; } - GXInitTexObj(mTexObj, &mTexInfo + offset, mTexInfo->width, mTexInfo->height, + GXInitTexObj(&mTexObj, &mTexInfo + offset, mTexInfo->width, mTexInfo->height, (GXTexFmt)mTexInfo->format, (GXTexWrapMode)mTexInfo->wrapS, (GXTexWrapMode)mTexInfo->wrapT, mTexInfo->mipmapEnabled); - GXInitTexObjLOD(mTexObj, (GXTexFilter)mTexInfo->minFilter, (GXTexFilter)mTexInfo->magFilter, + GXInitTexObjLOD(&mTexObj, (GXTexFilter)mTexInfo->minFilter, (GXTexFilter)mTexInfo->magFilter, mTexInfo->minLOD, mTexInfo->maxLOD, mTexInfo->LODBias, mTexInfo->biasClamp, mTexInfo->doEdgeLOD, (GXAnisotropy)mTexInfo->maxAnisotropy); } diff --git a/libs/Z2AudioLib/Z2AudioMgr.cpp b/libs/Z2AudioLib/Z2AudioMgr.cpp index b6424a7e29..905cb2b887 100644 --- a/libs/Z2AudioLib/Z2AudioMgr.cpp +++ b/libs/Z2AudioLib/Z2AudioMgr.cpp @@ -380,7 +380,7 @@ void Z2AudioMgr::resetRecover() { mSeqMgr.setTwilightGateVol(1.0f); mSeqMgr.setWindStoneVol(1.0f, 0); mStatusMgr.menuOut(); - mSeqMgr.bgmAllUnMute(0); + mSeqMgr.i_bgmAllUnMute(0); mSeqMgr.unMuteSceneBgm(0); } #else diff --git a/libs/Z2AudioLib/Z2SceneMgr.cpp b/libs/Z2AudioLib/Z2SceneMgr.cpp index e128658047..c139fc4120 100644 --- a/libs/Z2AudioLib/Z2SceneMgr.cpp +++ b/libs/Z2AudioLib/Z2SceneMgr.cpp @@ -4,6 +4,8 @@ // #include "Z2AudioLib/Z2SceneMgr.h" +#include "Z2AudioLib/Z2SoundMgr.h" +#include "Z2AudioLib/Z2SeqMgr.h" #include "dol2asm.h" #include "dolphin/types.h" @@ -39,29 +41,6 @@ struct Z2SoundObjMgr { /* 802C013C */ void deleteEnemyAll(); }; -struct Z2SoundMgr { - /* 802AA430 */ void resetFilterAll(); -}; - -struct Z2SeqMgr { - /* 802AF010 */ void bgmStart(u32, u32, s32); - /* 802AF408 */ void bgmStop(u32, s32); - /* 802AFB94 */ void bgmStreamPrepare(u32); - /* 802AFDEC */ void bgmStreamCheckReady(); - /* 802AFE18 */ void bgmStreamPlay(); - /* 802AFF8C */ void changeBgmStatus(s32); - /* 802B3318 */ void setHeightVolMod(bool, u32); - /* 802B3398 */ void setTimeProcVolMod(bool, u32); - /* 802B3EAC */ void checkBgmIDPlaying(u32); - /* 802B4128 */ void resetBattleBgmParams(); - /* 802B4164 */ void setBattleBgmOff(bool); - /* 802B9968 */ void setFieldBgmPlay(bool); - /* 802B99AC */ void unMuteSceneBgm(u32); - /* 802B9A24 */ void muteSceneBgm(u32, f32); - /* 802B9AD0 */ void setTwilightGateVol(f32); - /* 802B9AFC */ void setWindStoneVol(f32, u32); -}; - struct Z2SeMgr { /* 802AB80C */ void resetModY(); /* 802AD94C */ void seStopAll(u32); @@ -78,13 +57,6 @@ struct Z2EnvSeMgr { /* 802C6AC0 */ void initSceneEnvSe(s32, s8, f32); }; -template <typename A0> -struct JSUList {}; -/* JSUList<JAIStream> */ -struct JSUList__template2 { - /* 802B9994 */ void func_802B9994(void* _this) /* const */; -}; - struct JAUSoundTable { /* 802A7160 */ void getTypeID(JAISoundID) const; }; @@ -97,10 +69,6 @@ struct JASWaveArc { /* 8029A640 */ void erase(); }; -struct JAIStreamMgr { - /* 802B9978 */ void isActive() const; -}; - // // Forward References: // @@ -193,11 +161,11 @@ extern "C" extern u8 data_80450B3C[4]; extern "C" extern u8 data_80450B40[4]; extern "C" extern u8 data_80450B48[4]; extern "C" extern u8 data_80450B58[4]; -extern "C" extern u8 data_80450B60[4]; +extern "C" extern Z2SoundMgr* data_80450B60; extern "C" extern u8 data_80450B7C[4]; -extern "C" extern u8 data_80450B80[4]; +extern "C" extern Z2SceneMgr* data_80450B80; extern "C" extern u8 data_80450B84[4]; -extern "C" extern u8 data_80450B88[4]; +extern "C" extern Z2SeMgr* data_80450B88; extern "C" extern u8 data_80450CC0[4 + 4 /* padding */]; // @@ -208,7 +176,7 @@ extern "C" extern u8 data_80450CC0[4 + 4 /* padding */]; // Missing 2 instructions (beginning and end) #ifdef NONMATCHING Z2SceneMgr::Z2SceneMgr(void) { - lbl_80450B80 = this; + data_80450B80 = this; sceneNum = -1; timer = -1; BGM_ID = -1; @@ -269,25 +237,24 @@ SECTION_SDATA2 static f32 lit_3512 = 1.0f; /* 802B68E0-802B697C 2B1220 009C+00 3/3 2/2 2/2 .text setSceneExist__10Z2SceneMgrFb */ #ifdef NONMATCHING void Z2SceneMgr::setSceneExist(bool param_1) { - Z2SoundMgr* Z2soundMgrPtr; sceneExist = param_1; timer = 0; - Z2soundMgrPtr = lbl_80450B60; - if (param_1 == false) { - Z2soundMgrPtr->JAISoundParamsMove->moveVolume(FLOAT_LABEL(lit_3511), 0xb4); - } else { + + JAISeMgr* seMgr = data_80450B60->getSeMgr(); + + if (param_1) { inGame = 1; + if (SeWave_3 == 0x85) { - Z2soundMgrPtr->JAISoundParamsMove->moveVolume(FLOAT_LABEL(lit_3511), 0); + seMgr->getCategory(9)->getParams()->moveVolume(FLOAT_LABEL(lit_3511), 0); + } else if (SeWave_3 == 0x7F) { + data_80450B88->seMoveVolumeAll(FLOAT_LABEL(lit_3511), 0); } else { - if (SeWave_3 == 0x7f) { - lbl_80450B88->seMoveVolumeAll(FLOAT_LABEL(lit_3511), 0); - } else { - Z2soundMgrPtr->JAISoundParamsMove->moveVolume(lit_3512, 0x21); - } + seMgr->getCategory(9)->getParams()->moveVolume(lit_3512, 33); } + } else { + seMgr->getCategory(9)->getParams()->moveVolume(FLOAT_LABEL(lit_3511), 180); } - return; } #else #pragma push @@ -749,7 +716,7 @@ JAISoundID::JAISoundID(JAISoundID const& soundIdToSet) { // 1 Instruction off #ifdef NONMATCHING void Z2SeqMgr::setFieldBgmPlay(bool param_1) { - unk_1 = (param_1 & 1U) << 2 | unk_1 & 0xfb; + mFlags = (param_1 & 1U) << 2 | mFlags & 0xfb; } #else #pragma push diff --git a/libs/Z2AudioLib/Z2SoundObjMgr.cpp b/libs/Z2AudioLib/Z2SoundObjMgr.cpp index 6c7a7191ef..17d781338e 100644 --- a/libs/Z2AudioLib/Z2SoundObjMgr.cpp +++ b/libs/Z2AudioLib/Z2SoundObjMgr.cpp @@ -53,7 +53,7 @@ extern "C" void _savegpr_27(); extern "C" void _restgpr_23(); extern "C" void _restgpr_27(); extern "C" void strcmp(); -extern "C" extern u8 data_80450B48[4]; +extern "C" extern Z2SoundObjMgr* data_80450B48; extern "C" extern u8 data_80450B80[4]; extern "C" extern Z2SeqMgr* data_80450B84; extern "C" u8 mLinkPtr__14Z2CreatureLink[4 + 4 /* padding */]; @@ -66,9 +66,9 @@ extern "C" u8 mLinkPtr__14Z2CreatureLink[4 + 4 /* padding */]; #ifdef NONMATCHING // order wrong because this needs to inherit from JASGlobalInstance<T> Z2SoundObjMgr::Z2SoundObjMgr() { - data_80450B84 = this; + data_80450B48 = this; mGhostEnemyState = 0; - mIsTwilightBattle = false; + mTwilightBattle = false; setBattleInit(); setForceBattleArea(false, 700, 1100, 1500); } diff --git a/libs/Z2AudioLib/Z2SoundObject.cpp b/libs/Z2AudioLib/Z2SoundObject.cpp index 9cd329f33e..41a56257d9 100644 --- a/libs/Z2AudioLib/Z2SoundObject.cpp +++ b/libs/Z2AudioLib/Z2SoundObject.cpp @@ -11,13 +11,8 @@ // Types: // -struct Z2SoundObjArrow { - /* 802BEB38 */ Z2SoundObjArrow(); - /* 802BEB74 */ void init(Vec*, u8); -}; - struct Z2SoundInfo { - /* 802BBAC8 */ void getSwBit(JAISoundID) const; + /* 802BBAC8 */ int getSwBit(JAISoundID) const; }; struct Z2SeMgr { @@ -106,7 +101,7 @@ extern "C" void _restgpr_23(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" extern u32 __float_max; -extern "C" extern u8 data_80450B4C[4]; +extern "C" extern Z2SoundInfo* data_80450B4C; extern "C" extern u8 data_80450B60[4]; extern "C" extern Z2SoundStarter* data_80450B74; extern "C" extern u8 data_80450B88[4]; @@ -232,7 +227,7 @@ void Z2SoundObjBase::dispose() { for (link = getFirst(); link != NULL; link = link->getNext()) { handle = link->getObject(); if (handle != NULL && (bool)*handle) { - u32 swBit = lbl_80450B4C->getSwBit((*handle)->getID()); + u32 swBit = data_80450B4C->getSwBit((*handle)->getID()); if ((swBit & 0x8000) != 0) { handle->releaseSound(); } else { @@ -260,7 +255,7 @@ asm void Z2SoundObjBase::dispose() { // sInstance stuff #ifdef NONMATCHING bool Z2SoundObjBase::stopOK(Z2SoundHandlePool& pSoundHandlePool) { - return !(lbl_80450B4C->getSwBit(pSoundHandlePool->getID()) & 0x8000); + return !(data_80450B4C->getSwBit(pSoundHandlePool->getID()) & 0x8000); } #else #pragma push @@ -380,7 +375,8 @@ asm void Z2DopplerSoundObjBase::init(Vec* param_0, u8 param_1) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void Z2DopplerSoundObjBase::framework(u32 param_0, s8 param_1) { +// asm void Z2DopplerSoundObjBase::framework(u32 param_0, s8 param_1) { +extern "C" asm void framework__21Z2DopplerSoundObjBaseFUlSc() { nofralloc #include "asm/Z2AudioLib/Z2SoundObject/framework__21Z2DopplerSoundObjBaseFUlSc.s" } @@ -499,7 +495,8 @@ asm Z2SoundObjArrow::Z2SoundObjArrow() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void Z2SoundObjArrow::init(Vec* param_0, u8 param_1) { +// asm void Z2SoundObjArrow::init(Vec* param_0, u8 param_1) { +extern "C" asm void init__15Z2SoundObjArrowFP3VecUc() { nofralloc #include "asm/Z2AudioLib/Z2SoundObject/init__15Z2SoundObjArrowFP3VecUc.s" } diff --git a/libs/Z2AudioLib/Z2StatusMgr.cpp b/libs/Z2AudioLib/Z2StatusMgr.cpp index a194402f76..d011ed0690 100644 --- a/libs/Z2AudioLib/Z2StatusMgr.cpp +++ b/libs/Z2AudioLib/Z2StatusMgr.cpp @@ -108,7 +108,7 @@ extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" extern u8 struct_80450860[4]; extern "C" extern u8 data_80450B40[4]; extern "C" extern u8 data_80450B60[4]; -extern "C" extern u8 data_80450B7C[4]; +extern "C" extern Z2StatusMgr* data_80450B7C; extern "C" extern u8 data_80450B80[4]; extern "C" extern Z2SeqMgr* data_80450B84; extern "C" extern Z2SeMgr* data_80450B88; diff --git a/libs/dolphin/pad/Pad.c b/libs/dolphin/pad/Pad.c index b963c96a2c..98e8ca4aac 100644 --- a/libs/dolphin/pad/Pad.c +++ b/libs/dolphin/pad/Pad.c @@ -239,7 +239,7 @@ asm u32 PADInit() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void PADRead(PADStatus* status) { +asm u32 PADRead(PADStatus* status) { nofralloc #include "asm/dolphin/pad/Pad/PADRead.s" } |
