Skip to content

Commit 3df5c7b

Browse files
authored
Various alignments to debug + matching TUs (#2391)
1 parent 417922b commit 3df5c7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+763
-510
lines changed

config/ShieldD/splits.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,14 +2446,14 @@ JSystem/JAudio2/JASOscillator.cpp:
24462446
.text start:0x8048A950 end:0x8048B020
24472447
.rodata start:0x80654D60 end:0x80654E70
24482448
.data start:0x806FDFE8 end:0x806FE028
2449-
.sdata start:0x80748938 end:0x8074894C
2449+
.sdata start:0x80748938 end:0x80748948
24502450
.sdata2 start:0x80751C60 end:0x80751C88
24512451

24522452
JSystem/JAudio2/JASAiCtrl.cpp:
24532453
.text start:0x8048B020 end:0x8048BD30
24542454
.rodata start:0x80654E70 end:0x80654E80
24552455
.data start:0x806FE028 end:0x806FE188
2456-
.sdata start:0x8074894C end:0x80748970
2456+
.sdata start:0x80748948 end:0x80748970
24572457
.sbss start:0x8074CC68 end:0x8074CCA8
24582458
.sdata2 start:0x80751C88 end:0x80751CA8
24592459
.bss start:0x807C8D78 end:0x807C8D88

configure.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -742,14 +742,14 @@ def MatchingFor(*versions):
742742
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAExtraShape.cpp"),
743743
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAChildShape.cpp"),
744744
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAExTexShape.cpp"),
745-
Object(NonMatching, "JSystem/JParticle/JPADynamicsBlock.cpp"),
746-
Object(NonMatching, "JSystem/JParticle/JPAFieldBlock.cpp"),
745+
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPADynamicsBlock.cpp"),
746+
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAFieldBlock.cpp"),
747747
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAKeyBlock.cpp"),
748748
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPATexture.cpp"),
749749
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAResourceLoader.cpp"),
750750
Object(Equivalent, "JSystem/JParticle/JPAEmitterManager.cpp", extra_cflags=['-pragma "nosyminline off"']), # weak func order
751751
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAEmitter.cpp"),
752-
Object(NonMatching, "JSystem/JParticle/JPAParticle.cpp"),
752+
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAParticle.cpp"),
753753
Object(MatchingFor("GZ2E01"), "JSystem/JParticle/JPAMath.cpp"),
754754
],
755755
),
@@ -826,7 +826,7 @@ def MatchingFor(*versions):
826826
Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASTrackPort.cpp"),
827827
Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASRegisterParam.cpp"),
828828
Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASSeqCtrl.cpp"),
829-
Object(NonMatching, "JSystem/JAudio2/JASSeqParser.cpp"),
829+
Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASSeqParser.cpp"),
830830
Object(MatchingFor("GZ2E01"), "JSystem/JAudio2/JASSeqReader.cpp"),
831831
Object(NonMatching, "JSystem/JAudio2/JASAramStream.cpp"),
832832
Object(NonMatching, "JSystem/JAudio2/JASBank.cpp"),
@@ -907,12 +907,12 @@ def MatchingFor(*versions):
907907
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundStarter.cpp"),
908908
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundHandles.cpp"),
909909
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SeMgr.cpp"),
910-
Object(NonMatching, "Z2AudioLib/Z2SeqMgr.cpp"),
910+
Object(Equivalent, "Z2AudioLib/Z2SeqMgr.cpp"),
911911
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2StatusMgr.cpp"),
912912
Object(NonMatching, "Z2AudioLib/Z2SceneMgr.cpp"),
913913
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2FxLineMgr.cpp"),
914914
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundInfo.cpp"),
915-
Object(NonMatching, "Z2AudioLib/Z2Audience.cpp"),
915+
Object(Equivalent, "Z2AudioLib/Z2Audience.cpp"),
916916
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundObject.cpp"),
917917
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2SoundObjMgr.cpp"),
918918
Object(MatchingFor("GZ2E01"), "Z2AudioLib/Z2Creature.cpp"),

include/JSystem/J3DGraphAnimator/J3DAnimation.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define J3DANIMATION_H
33

44
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
5+
#include "JSystem/JUtility/JUTAssert.h"
56
#include "JSystem/JUtility/JUTNameTab.h"
67
#include "global.h"
78

@@ -590,10 +591,11 @@ class J3DAnmTextureSRTKey : public J3DAnmBase {
590591

591592
u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; }
592593
u16 getUpdateMaterialNum() const { return mTrackNum / 3; }
594+
u16 getPostUpdateMaterialNum() const { return field_0x4a / 3; }
593595

594-
int getUpdateTexMtxID(u16 idx) { return mUpdateTexMtxID[idx]; }
596+
int getUpdateTexMtxID(u16 idx) const { return mUpdateTexMtxID[idx]; }
595597
bool isValidUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx] != 0xffff; }
596-
u32 getTexMtxCalcType() const { return mTexMtxCalcType; }
598+
u32 getTexMtxCalcType() { return mTexMtxCalcType; }
597599
Vec* getSRTCenter(u16 idx) { return &mSRTCenter[idx]; }
598600

599601
/* 0x0C */ int mDecShift;
@@ -719,7 +721,10 @@ class J3DAnmColor : public J3DAnmBase {
719721

720722
u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; }
721723
bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; }
722-
u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; }
724+
u16 getUpdateMaterialID(u16 idx) const {
725+
JUT_ASSERT_MSG(1578, 0 <= mUpdateMaterialNum - idx, "Error : range over.")
726+
return mUpdateMaterialID[idx];
727+
}
723728

724729
/* 0x0C */ u16 field_0xc;
725730
/* 0x0E */ u16 field_0xe;

include/JSystem/JAudio2/JASDSPInterface.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ namespace JASDsp {
118118
extern TChannel* CH_BUF;
119119
extern FxBuf* FX_BUF;
120120
extern f32 sDSPVolume;
121+
122+
#ifdef DEBUG
123+
extern s32 dspMutex;
124+
#endif
121125
};
122126

123127
u16 DSP_CreateMap2(u32 msg);

include/JSystem/JAudio2/JASHeapCtrl.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "JSystem/JKernel/JKRHeap.h"
55
#include "JSystem/JSupport/JSUList.h"
6+
#include "JSystem/JUtility/JUTAssert.h"
67
#include <dolphin/os.h>
78
#include <dolphin/os.h>
89

@@ -112,7 +113,7 @@ class JASMemChunkPool : public OSMutex {
112113
mChunks = 0;
113114
}
114115

115-
bool checkArea(void* ptr) {
116+
bool checkArea(const void* ptr) const {
116117
return (u8*)this + 0xc <= (u8*)ptr && (u8*)ptr < (u8*)this + (ChunkSize + 0xc);
117118
}
118119

@@ -127,11 +128,11 @@ class JASMemChunkPool : public OSMutex {
127128
return rv;
128129
}
129130

130-
void free() {
131+
void free(void* mem) {
131132
mChunks--;
132133
}
133134

134-
bool isEmpty() {
135+
bool isEmpty() const {
135136
return mChunks == 0;
136137
}
137138

@@ -201,7 +202,8 @@ class JASMemChunkPool : public OSMutex {
201202
MemoryChunk* prevChunk = NULL;
202203
while (chunk != NULL) {
203204
if (chunk->checkArea(ptr)) {
204-
chunk->free();
205+
chunk->free(ptr);
206+
205207
if (chunk != field_0x18 && chunk->isEmpty()) {
206208
MemoryChunk* nextChunk = chunk->getNextChunk();
207209
delete chunk;
@@ -212,6 +214,8 @@ class JASMemChunkPool : public OSMutex {
212214
prevChunk = chunk;
213215
chunk = chunk->getNextChunk();
214216
}
217+
218+
JUT_PANIC(362,"Cannnot free for JASMemChunkPool")
215219
}
216220

217221
/* 0x18 */ MemoryChunk* field_0x18;

include/JSystem/JAudio2/JASSeqCtrl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class JASSeqCtrl {
3737
const JASSeqReader* getSeqReader() const { return &mReader; }
3838
void* getBase() { return mReader.getBase(); }
3939
void* getAddr(u32 param_0) { return mReader.getAddr(param_0); }
40-
u8 getByte(u32 param_0) { return mReader.getByte(param_0); }
41-
u16 get16(u32 param_0) { return mReader.get16(param_0); }
42-
u32 get24(int param_0) { return mReader.get24(param_0); }
43-
u32 get32(u32 param_0) { return mReader.get32(param_0); }
40+
u8 getByte(u32 param_0) const { return mReader.getByte(param_0); }
41+
u16 get16(u32 param_0) const { return mReader.get16(param_0); }
42+
u32 get24(u32 param_0) const { return mReader.get24(param_0); }
43+
u32 get32(u32 param_0) const { return mReader.get32(param_0); }
4444
void* getCur() { return mReader.getCur(); }
4545
u32 readByte() { return mReader.readByte(); }
4646
u32 read16() { return mReader.read16(); }

include/JSystem/JAudio2/JASSeqReader.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,30 @@ class JASSeqReader {
2525
field_0x04 = (u8*)param_1;
2626
}
2727

28-
u32 get24(int param_0) {
28+
u32 get24(int param_0) const {
2929
return (*(u32*)(field_0x00 + param_0 - 1)) & 0xffffff;
3030
}
3131

3232
u32* getBase() { return (u32*)field_0x00; }
3333
void* getAddr(u32 param_0) { return field_0x00 + param_0; }
34-
u8 getByte(u32 param_0) { return *(field_0x00 + param_0); }
35-
u16 get16(u32 param_0) { return *(u16*)(field_0x00 + param_0); }
36-
u32 get32(u32 param_0) { return *(u32*)(field_0x00 + param_0); }
34+
u8 getByte(u32 param_0) const { return *(field_0x00 + param_0); }
35+
u16 get16(u32 param_0) const { return *(u16*)(field_0x00 + param_0); }
36+
u32 get32(u32 param_0) const { return *(u32*)(field_0x00 + param_0); }
3737
u8* getCur() { return field_0x04; }
3838
u32 readByte() { return *field_0x04++; }
3939
u32 read16() {
40-
u16* tmp = (u16*)field_0x04;
41-
field_0x04 += 2;
42-
return *tmp;
40+
return *((u16*)field_0x04)++;
4341
}
4442
u32 read24() {
4543
field_0x04--;
46-
u32* tmp = (u32*)field_0x04;
47-
field_0x04 += 4;
48-
return *tmp & 0x00ffffff;
44+
return (*((u32*)field_0x04)++) & 0x00ffffff;
45+
}
46+
u16 getLoopCount() const {
47+
if (field_0x08 == 0) {
48+
return 0;
49+
}
50+
return field_0x2c[field_0x08 - 1];
4951
}
50-
u16 getLoopCount() const { return field_0x08 == 0 ? 0 : field_0x2c[field_0x08 - 1]; }
5152

5253
/* 0x00 */ u8* field_0x00;
5354
/* 0x04 */ u8* field_0x04;

include/JSystem/JAudio2/JASTrack.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace JASDsp {
1717
extern const u32 FILTER_MODE_IIR;
1818
};
1919

20+
#define MAX_CHILDREN 16
21+
2022
/**
2123
* @ingroup jsystem-jaudio
2224
*
@@ -125,14 +127,17 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
125127
static TList sTrackList;
126128

127129
JASSeqCtrl* getSeqCtrl() { return &mSeqCtrl; }
128-
u16 getPort(u32 param_0) { return mTrackPort.get(param_0); }
130+
u16 getPort(u32 param_0) const { return mTrackPort.get(param_0); }
129131
void setPort(u32 param_0, u16 param_1) { mTrackPort.set(param_0, param_1); }
130-
u32 checkPortIn(u32 param_0) { return mTrackPort.checkImport(param_0); }
131-
u32 checkPort(u32 param_0) { return mTrackPort.checkExport(param_0); }
132+
u32 checkPortIn(u32 param_0) const { return mTrackPort.checkImport(param_0); }
133+
u32 checkPort(u32 param_0) const { return mTrackPort.checkExport(param_0); }
132134
u32 readReg(JASRegisterParam::RegID param_0) { return mRegisterParam.read(param_0); }
133135
void writeReg(JASRegisterParam::RegID param_0, u32 param_1) { mRegisterParam.write(param_0, param_1); }
134136
JASTrack* getParent() { return mParent; }
135-
JASTrack* getChild(u32 index) { return mChildren[index]; }
137+
JASTrack* getChild(u32 index) {
138+
JUT_ASSERT(115, index < MAX_CHILDREN)
139+
return mChildren[index];
140+
}
136141
int getChannelMgrCount() { return mChannelMgrCount; }
137142
f32 getVibDepth() const { return mVibDepth; }
138143
void setVibDepth(f32 param_0) { mVibDepth = param_0; }
@@ -142,9 +147,9 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
142147
void setTremDepth(f32 param_0) { mTremDepth = param_0; }
143148
f32 getTremPitch() const { return mTremPitch; }
144149
void setTremPitch(f32 param_0) { mTremPitch = param_0; }
145-
u16 getVibDelay() const { return mVibDelay; }
150+
u32 getVibDelay() const { return mVibDelay; }
146151
void setVibDelay(u32 param_0) { mVibDelay = param_0; }
147-
u16 getTremDelay() const { return mTremDelay; }
152+
u32 getTremDelay() const { return mTremDelay; }
148153
void setTremDelay(u32 param_0) { mTremDelay = param_0; }
149154
u8 getStatus() const { return mStatus; }
150155
void setAutoDelete(u8 param_0) { mFlags.autoDelete = param_0; }
@@ -155,8 +160,8 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
155160
u16 getDirectRelease() const { return mDirectRelease; }
156161
void setDirectRelease(u16 param_0) {mDirectRelease = param_0; }
157162
u16 getTimebase() const { return mTimebase; }
158-
s8 getTranspose() const { return mTranspose; }
159-
void setTranspose(u32 param_0) { mTranspose = param_0; }
163+
int getTranspose() const { return mTranspose; }
164+
void setTranspose(s32 param_0) { mTranspose = param_0; }
160165
u16 getBankNumber() const { return mBankNumber; }
161166
void setBankNumber(u16 param_0) { mBankNumber = param_0; }
162167
u16 getProgNumber() const { return mProgNumber; }
@@ -187,7 +192,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
187192
/* 0x0e4 */ JASOscillator::Data mOscParam[2];
188193
/* 0x114 */ JASOscillator::Point mOscPoint[4];
189194
/* 0x12C */ JASTrack* mParent;
190-
/* 0x130 */ JASTrack* mChildren[16];
195+
/* 0x130 */ JASTrack* mChildren[MAX_CHILDREN];
191196
/* 0x170 */ TChannelMgr* mChannelMgrs[4];
192197
/* 0x180 */ TChannelMgr mDefaultChannelMgr;
193198
/* 0x1D0 */ int mChannelMgrCount;

include/JSystem/JAudio2/JASTrackPort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class JASTrackPort {
1717
/* 8029360C */ u32 checkImport(u32) const;
1818
/* 80293628 */ u32 checkExport(u32) const;
1919

20-
u16 get(u32 param_0) { return field_0x4[param_0]; }
20+
u16 get(u32 param_0) const { return field_0x4[param_0]; }
2121
void set(u32 param_0, u16 param_1) { field_0x4[param_0] = param_1; }
2222

2323
u16 field_0x0;

0 commit comments

Comments
 (0)