1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
//
// Generated By: dol2asm
// Translation Unit: JAISeq
//
#include "JSystem/JAudio2/JAISeq.h"
#include "JSystem/JAudio2/JAISeqMgr.h"
#include "JSystem/JAudio2/JAISoundChild.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "dol2asm.h"
//
// Forward References:
//
extern "C" static bool func_802A0A6C(JASTrack*);
extern "C" void func_802A0A8C();
extern "C" void func_802A0B64();
extern "C" void playSeqData___6JAISeqFRC14JASSoundParams16JAISoundActivity();
extern "C" void reserveChildTracks___6JAISeqFi();
extern "C" void releaseChildTracks___6JAISeqFv();
extern "C" void prepare_getSeqData___6JAISeqFv();
extern "C" void prepare___6JAISeqFRC14JASSoundParams16JAISoundActivity();
extern "C" void JAISeqMgr_calc___6JAISeqFv();
extern "C" void die___6JAISeqFv();
extern "C" void func_802A1268(void* _this);
extern "C" void JAISound_tryDie___6JAISeqFv();
extern "C" void mixOut___6JAISeqFRC14JASSoundParams16JAISoundActivity();
extern "C" void JAISeqMgr_mixOut___6JAISeqFRC14JASSoundParams16JAISoundActivity();
extern "C" s32 getNumChild__6JAISeqCFv();
extern "C" void getChild__6JAISeqFi();
extern "C" void releaseChild__6JAISeqFi();
extern "C" void getTrack__6JAISeqFv();
extern "C" void getChildTrack__6JAISeqFi();
extern "C" void asSeq__6JAISeqFv();
extern "C" void getTempoMgr__6JAISeqFv();
//
// External References:
//
extern "C" void __ct__17JASGenericMemPoolFv();
extern "C" void __dt__17JASGenericMemPoolFv();
extern "C" void alloc__17JASGenericMemPoolFUl();
extern "C" void free__17JASGenericMemPoolFPvUl();
extern "C" void __ct__8JASTrackFv();
extern "C" void __dt__8JASTrackFv();
extern "C" void setChannelMgrCount__8JASTrackFUl();
extern "C" void assignExtBuffer__8JASTrackFUlP14JASSoundParams();
extern "C" void setSeqData__8JASTrackFPvUl();
extern "C" void startSeq__8JASTrackFv();
extern "C" void stopSeq__8JASTrackFv();
extern "C" void connectChild__8JASTrackFUlP8JASTrack();
extern "C" void mute__8JASTrackFb();
extern "C" void pause__8JASTrackFb();
extern "C" void setTempoRate__8JASTrackFf();
extern "C" void func_802932E0(void* _this);
extern "C" void mixOutAll__14JAISoundParamsFRC14JASSoundParamsP14JASSoundParamsf();
extern "C" void __ct__8JAISoundFv();
extern "C" void func_802A2328();
extern "C" bool asSe__8JAISoundFv();
extern "C" bool asStream__8JAISoundFv();
extern "C" void die_JAISound___8JAISoundFv();
extern "C" void increasePrepareCount_JAISound___8JAISoundFv();
extern "C" void calc_JAISound___8JAISoundFv();
extern "C" void initTrack_JAISound___8JAISoundFP8JASTrack();
extern "C" void init__13JAISoundChildFv();
extern "C" void mixOut__13JAISoundChildFP8JASTrack();
extern "C" void calc__13JAISoundChildFv();
extern "C" void __dl__FPv();
extern "C" void __ct__10JSUPtrLinkFPv();
extern "C" void __register_global_object();
extern "C" void _savegpr_24();
extern "C" void _savegpr_26();
extern "C" void _savegpr_27();
extern "C" void _savegpr_28();
extern "C" void _savegpr_29();
extern "C" void _restgpr_24();
extern "C" void _restgpr_26();
extern "C" void _restgpr_27();
extern "C" void _restgpr_28();
extern "C" void _restgpr_29();
extern "C" extern u8 data_80431B04[16 + 4 /* padding */];
extern "C" extern u8 struct_80451230[8];
extern "C" extern u8 data_80451318[8];
//
// Declarations:
//
/* 802A0A6C-802A0A8C 29B3AC 0020+00 1/1 0/0 0/0 .text
* JASTrack_isFreeOrStopped__20@unnamed@JAISeq_cpp@FP8JASTrack */
static bool func_802A0A6C(JASTrack* track) {
u8 status = track->getStatus();
return status == 0 || status == 2;
}
/* 803C98F4-803C9928 026A14 0030+04 1/1 2/2 0/0 .data __vt__6JAISeq */
SECTION_DATA extern void* __vt__6JAISeq[12 + 1 /* padding */] = {
(void*)NULL /* RTTI */,
(void*)NULL,
(void*)getNumChild__6JAISeqCFv,
(void*)getChild__6JAISeqFi,
(void*)releaseChild__6JAISeqFi,
(void*)asSe__8JAISoundFv,
(void*)asSeq__6JAISeqFv,
(void*)asStream__8JAISoundFv,
(void*)getTrack__6JAISeqFv,
(void*)getChildTrack__6JAISeqFi,
(void*)getTempoMgr__6JAISeqFv,
(void*)JAISound_tryDie___6JAISeqFv,
};
/* 80455798-8045579C 003D98 0004+00 3/3 0/0 0/0 .sdata2 @642 */
SECTION_SDATA2 static f32 lit_642 = 1.0f;
/* 8045579C-804557A0 003D9C 0004+00 4/4 0/0 0/0 .sdata2 @643 */
SECTION_SDATA2 static u8 lit_643[4] = {
0x00,
0x00,
0x00,
0x00,
};
/* 804557A0-804557A8 003DA0 0004+04 3/3 0/0 0/0 .sdata2 @644 */
SECTION_SDATA2 static f32 lit_644[1 + 1 /* padding */] = {
0.5f,
/* padding */
0.0f,
};
/* 802A0A8C-802A0B64 29B3CC 00D8+00 0/0 2/1 0/0 .text
* __ct__6JAISeqFP9JAISeqMgrP28JAISoundStrategyMgr<6JAISeq> */
// matches with literals
#ifdef NONMATCHING
JAISeq::JAISeq(JAISeqMgr* param_0, JAISoundStrategyMgr<JAISeq>* param_1) : JSULink<JAISeq>(this) {
inner_.seqMgr = param_0;
inner_.strategyMgr = param_1;
inner_.mSoundParams.init();
for (int i = 0; i < 32; i++) {
inner_.mSoundChild[i] = NULL;
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm JAISeq::JAISeq(JAISeqMgr* param_0, JAISoundStrategyMgr<JAISeq>* param_1) {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/func_802A0A8C.s"
}
#pragma pop
#endif
/* 802A0B64-802A0C04 29B4A4 00A0+00 0/0 1/1 0/0 .text
* JAISeqMgr_startID___6JAISeqF10JAISoundIDPCQ29JGeometry8TVec3<f>P11JAIAudienceii */
void JAISeq::JAISeqMgr_startID_(JAISoundID param_0, JGeometry::TVec3<f32> const* param_1, JAIAudience* param_2, int param_3, int param_4) {
inner_.field_0x39c = param_3;
reserveChildTracks_(param_4);
start_JAISound_(param_0, param_1, param_2);
if (inner_.strategyMgr) {
field_0x3a8 = inner_.strategyMgr->calc(param_0);
} else {
field_0x3a8 = NULL;
}
}
/* 802A0C04-802A0CA4 29B544 00A0+00 1/1 0/0 0/0 .text
* playSeqData___6JAISeqFRC14JASSoundParams16JAISoundActivity */
void JAISeq::playSeqData_(JASSoundParams const& param_0, JAISoundActivity param_1) {
inner_.outputTrack.setSeqData(inner_.mSeqData.field_0x0, inner_.mSeqData.field_0x4);
if (audible_) {
initTrack_JAISound_(&inner_.outputTrack);
} else {
inner_.outputTrack.setChannelMgrCount(1);
inner_.outputTrack.assignExtBuffer(0, &inner_.mSoundParams);
}
mixOut_(param_0, param_1);
inner_.outputTrack.startSeq();
}
/* ############################################################################################## */
/* 80434098-804340A4 060DB8 000C+00 1/1 0/0 0/0 .bss @716 */
static u8 lit_716[12];
/* 802A0CA4-802A0E48 29B5E4 01A4+00 1/1 0/0 0/0 .text reserveChildTracks___6JAISeqFi */
// Matches with literals
#ifdef NONMATCHING
void JAISeq::reserveChildTracks_(int param_0) {
for (int i = 0; i < 2; i++) {
JASPoolAllocObject_MultiThreaded<JASTrack>* allocobj = new JASPoolAllocObject_MultiThreaded<JASTrack>();
JASTrack* track = new (allocobj) JASTrack();
if (track) {
track->setAutoDelete(true);
inner_.outputTrack.connectChild(i, track);
for (int j = 0; j < 16; j++) {
if (i * 16 + j >= param_0) {
continue;
}
JASPoolAllocObject_MultiThreaded<JASTrack>* allocobj2 = new JASPoolAllocObject_MultiThreaded<JASTrack>();
JASTrack* track2 = new (allocobj2) JASTrack();
if (track2) {
track2->setAutoDelete(true);
track->connectChild(j, track2);
}
}
}
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JAISeq::reserveChildTracks_(int param_0) {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/reserveChildTracks___6JAISeqFi.s"
}
#pragma pop
#endif
/* 802A0E48-802A0EDC 29B788 0094+00 1/1 0/0 0/0 .text releaseChildTracks___6JAISeqFv */
void JAISeq::releaseChildTracks_() {
for (u32 i = 0; i < 2; i++) {
JASTrack* track = inner_.outputTrack.getChild(i);
if (track) {
for (u32 j = 0; j < 16; j++) {
JASTrack* track2 = track->getChild(j);
if (track2) {
delete track2;
}
}
delete track;
}
}
}
/* 802A0EDC-802A0F90 29B81C 00B4+00 1/1 0/0 0/0 .text prepare_getSeqData___6JAISeqFv */
bool JAISeq::prepare_getSeqData_() {
JAISoundID id(soundID);
if (id.isAnonymous()) {
return true;
}
JAISeqDataMgr* seqDataMgr = inner_.seqMgr->getSeqDataMgr();
switch (seqDataMgr->getSeqData(id, &inner_.mSeqData)) {
case 0:
status_.state.unk = 2;
break;
case 1:
increasePrepareCount_JAISound_();
return false;
case 2:
return true;
}
return false;
}
/* 802A0F90-802A108C 29B8D0 00FC+00 2/1 0/0 0/0 .text
* prepare___6JAISeqFRC14JASSoundParams16JAISoundActivity */
bool JAISeq::prepare_(JASSoundParams const& param_0, JAISoundActivity param_1) {
switch (status_.state.unk) {
case 6:
break;
case 2:
stop_JAISound_();
break;
case 0:
if (prepare_getSeqData_()) {
status_.state.unk = 5;
playSeqData_(param_0, param_1);
return true;
}
break;
case 1:
if (prepare_getSeqData_()) {
status_.state.unk = 3;
}
return false;
case 4:
status_.state.unk = 5;
playSeqData_(param_0, param_1);
return true;
case 5:
return true;
}
return false;
}
/* 802A108C-802A1180 29B9CC 00F4+00 0/0 1/1 0/0 .text JAISeqMgr_calc___6JAISeqFv */
void JAISeq::JAISeqMgr_calc_() {
if (inner_.outputTrack.getStatus() == 2 || (inner_.outputTrack.getStatus() == 0 && status_.state.unk == 2)) {
die_();
return;
}
if (calc_JAISound_()) {
inner_.mTempoMgr.calc();
for (int i = 0; i < 32; i++) {
if (inner_.mSoundChild[i]) {
inner_.mSoundChild[i]->calc();
}
}
if (field_0x3a8) {
field_0x3a8->calc(this);
}
}
}
/* ############################################################################################## */
/* 804340A4-804340B0 060DC4 000C+00 3/3 0/0 0/0 .bss @896 */
static u8 lit_896[12];
/* 804340B0-804340C0 060DD0 0010+00 3/3 4/4 0/0 .bss
* memPool_$localstatic3$getMemPool___35JASPoolAllocObject<13JAISoundChild>Fv */
extern u8 data_804340B0[16];
u8 data_804340B0[16];
/* 802A1180-802A1268 29BAC0 00E8+00 2/2 0/0 0/0 .text die___6JAISeqFv */
// matches with literals
#ifdef NONMATCHING
void JAISeq::die_() {
for (int i = 0; i < 32; i++) {
if (inner_.mSoundChild[i]) {
delete (JASPoolAllocObject<JAISoundChild>*)inner_.mSoundChild[i];
inner_.mSoundChild[i] = NULL;
}
}
if (field_0x3a8) {
inner_.strategyMgr->virtual4(field_0x3a8);
field_0x3a8 = NULL;
}
releaseChildTracks_();
die_JAISound_();
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JAISeq::die_() {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/die___6JAISeqFv.s"
}
#pragma pop
#endif
/* 802A1268-802A12BC 29BBA8 0054+00 3/3 4/4 0/0 .text __dt__27JASMemPool<13JAISoundChild>Fv */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
extern "C" asm void func_802A1268(void* _this) {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/func_802A1268.s"
}
#pragma pop
/* 802A12BC-802A1348 29BBFC 008C+00 1/0 0/0 0/0 .text JAISound_tryDie___6JAISeqFv */
// matches with literals
#ifdef NONMATCHING
bool JAISeq::JAISound_tryDie_() {
if (func_802A0A6C(&inner_.outputTrack)) {
die_();
return true;
}
fader.forceOut();
status_.state.flags.flag1 = 1;
JASCriticalSection cs;
inner_.outputTrack.stopSeq();
return false;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm bool JAISeq::JAISound_tryDie_() {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/JAISound_tryDie___6JAISeqFv.s"
}
#pragma pop
#endif
/* 802A1348-802A14FC 29BC88 01B4+00 2/2 0/0 0/0 .text
* mixOut___6JAISeqFRC14JASSoundParams16JAISoundActivity */
// matches with literals
#ifdef NONMATCHING
void JAISeq::mixOut_(JASSoundParams const& param_0, JAISoundActivity param_1) {
inner_.outputTrack.setTempoRate(inner_.mTempoMgr.getTempo());
inner_.outputTrack.mute(param_1.field_0x0.flags.flag1 || status_.isMute());
inner_.outputTrack.pause(param_1.field_0x0.flags.flag2 || status_.isPaused());
JASSoundParams stackParams;
params.mixOutAll(param_0, &stackParams, fader.getIntensity());
if (field_0x3a8) {
field_0x3a8->virtual4(this, stackParams);
}
if (audible_) {
int maxChannels = audience_->getMaxChannels();
for (int i = 0; i < maxChannels; i++) {
audience_->mixChannelOut(stackParams, audible_, i);
}
} else {
inner_.mSoundParams = stackParams;
for (int i = 0; i < 32; i++) {
if (inner_.mSoundChild[i]) {
JASTrack* track = JAISeq::getChildTrack(i);
if (track) {
inner_.mSoundChild[i]->mixOut(track);
}
}
}
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JAISeq::mixOut_(JASSoundParams const& param_0, JAISoundActivity param_1) {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/mixOut___6JAISeqFRC14JASSoundParams16JAISoundActivity.s"
}
#pragma pop
#endif
/* 802A14FC-802A1570 29BE3C 0074+00 0/0 1/1 0/0 .text
* JAISeqMgr_mixOut___6JAISeqFRC14JASSoundParams16JAISoundActivity */
void JAISeq::JAISeqMgr_mixOut_(JASSoundParams const& param_0, JAISoundActivity param_1) {
if (prepare_(param_0, param_1) && inner_.outputTrack.getStatus() == 1) {
mixOut_(param_0, param_1);
}
}
/* 802A1570-802A1578 29BEB0 0008+00 1/0 0/0 0/0 .text getNumChild__6JAISeqCFv */
s32 JAISeq::getNumChild() const {
return 32;
}
/* 802A1578-802A165C 29BEB8 00E4+00 1/0 0/0 0/0 .text getChild__6JAISeqFi */
// matches with literals
#ifdef NONMATCHING
JAISoundChild* JAISeq::getChild(int index) {
if (inner_.mSoundChild[index]) {
return inner_.mSoundChild[index];
}
JASPoolAllocObject<JAISoundChild>* allocobj = new JASPoolAllocObject<JAISoundChild>();
inner_.mSoundChild[index] = new (allocobj) JAISoundChild();
if (!inner_.mSoundChild[index]) {
return NULL;
}
return inner_.mSoundChild[index];
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm JAISoundChild* JAISeq::getChild(int param_0) {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/getChild__6JAISeqFi.s"
}
#pragma pop
#endif
/* 802A165C-802A1728 29BF9C 00CC+00 1/0 0/0 0/0 .text releaseChild__6JAISeqFi */
// matches with literals
#ifdef NONMATCHING
void JAISeq::releaseChild(int param_0) {
if (inner_.outputTrack.getStatus() == 1 && inner_.mSoundChild[param_0]) {
JASTrack* track = getChildTrack(param_0);
if (track) {
track->assignExtBuffer(0, NULL);
}
delete (JASPoolAllocObject<JAISoundChild>*)inner_.mSoundChild[param_0];
inner_.mSoundChild[param_0] = NULL;
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JAISeq::releaseChild(int param_0) {
nofralloc
#include "asm/JSystem/JAudio2/JAISeq/releaseChild__6JAISeqFi.s"
}
#pragma pop
#endif
/* 802A1728-802A1730 29C068 0008+00 1/0 0/0 0/0 .text getTrack__6JAISeqFv */
JASTrack* JAISeq::getTrack() {
return &inner_.outputTrack;
}
/* 802A1730-802A1768 29C070 0038+00 2/1 0/0 0/0 .text getChildTrack__6JAISeqFi */
JASTrack* JAISeq::getChildTrack(int param_0) {
u32 tmp = u32(param_0) >> 4;
JASTrack* track = inner_.outputTrack.getChild(tmp);
if (track) {
JASTrack* track2 = track->getChild(param_0 - (tmp << 4));
return track2;
}
return NULL;
}
/* 802A1768-802A176C 29C0A8 0004+00 1/0 0/0 0/0 .text asSeq__6JAISeqFv */
JAISeq* JAISeq::asSeq() {
return this;
}
/* 802A176C-802A1774 29C0AC 0008+00 1/0 0/0 0/0 .text getTempoMgr__6JAISeqFv */
JAITempoMgr* JAISeq::getTempoMgr() {
return &inner_.mTempoMgr;
}
|