mirror of
https://github.com/zeldaret/tww.git
synced 2026-09-09 19:51:20 -04:00
+2
-2
@@ -680,12 +680,12 @@ config.libs = [
|
||||
Object(Matching, "JSystem/JAudio/JASWaveBank.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASBasicBank.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASBasicInst.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio/JASDrumSet.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASDrumSet.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio/JASBasicWaveBank.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASSimpleWaveBank.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASInstEffect.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio/JASInstSense.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio/JASInstRand.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASInstRand.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio/JASWSParser.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio/JASBNKParser.cpp"),
|
||||
Object(Matching, "JSystem/JAudio/JASWaveArcLoader.cpp"),
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
/* 0x0061 */ u8 field_0x0061;
|
||||
/* 0x0062 */ u8 field_0x0062;
|
||||
/* 0x0063 */ u8 field_0x0063;
|
||||
/* 0x0064 */ u8 field_0x0064[0x0065 - 0x0064];
|
||||
/* 0x0064 */ u8 field_0x0064;
|
||||
/* 0x0065 */ u8 field_0x0065;
|
||||
/* 0x0066 */ u8 field_0x0066;
|
||||
/* 0x0067 */ u8 field_0x0067[0x0068 - 0x0067];
|
||||
|
||||
@@ -1,24 +1,78 @@
|
||||
#ifndef JASBNKPARSER_H
|
||||
#define JASBNKPARSER_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio/JASOscillator.h"
|
||||
|
||||
namespace JASystem {
|
||||
class TBasicBank;
|
||||
namespace BNKParser {
|
||||
struct THeader;
|
||||
struct TInst;
|
||||
struct TKeymap;
|
||||
struct TOsc;
|
||||
struct TPerc;
|
||||
struct TPmap;
|
||||
struct TRand;
|
||||
struct TSense;
|
||||
struct TVmap;
|
||||
struct THeader {
|
||||
/* 0x000 */ u8 field_0x0[0x24];
|
||||
/* 0x024 */ u32 mInstOffsets[0x80];
|
||||
/* 0x224 */ u8 field_0x224[0x190];
|
||||
/* 0x3B4 */ u32 mPercOffsets[12];
|
||||
};
|
||||
struct TInst {
|
||||
/* 0x00 */ u8 field_0x0[8];
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 field_0xC;
|
||||
/* 0x10 */ u32 mOscOffsets[2];
|
||||
/* 0x18 */ u32 mRandOffsets[2];
|
||||
/* 0x20 */ u32 mSenseOffsets[2];
|
||||
/* 0x28 */ u32 mKeyRegionCount;
|
||||
/* 0x2C */ u32 mKeymapOffsets[2];
|
||||
};
|
||||
struct TKeymap {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
/* 0x08 */ u32 mVmapOffsets[1];
|
||||
};
|
||||
struct TOsc {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ u32 field_0x8;
|
||||
/* 0x0C */ u32 field_0xC;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ f32 field_0x14;
|
||||
};
|
||||
struct TPerc {
|
||||
/* 0x000 */ u32 mMagic;
|
||||
/* 0x004 */ u8 field_0x4[0x84];
|
||||
/* 0x088 */ u32 mPmapOffsets[0x80];
|
||||
/* 0x288 */ s8 field_0x288[0x80];
|
||||
/* 0x308 */ u16 field_0x308[0x80];
|
||||
};
|
||||
struct TPmap {
|
||||
/* 0x00 */ f32 field_0x0;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ u32 mRandOffsets[2];
|
||||
/* 0x10 */ u32 mVeloRegionCount;
|
||||
/* 0x14 */ u32 mVeloRegionOffsets[1];
|
||||
};
|
||||
struct TRand {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
};
|
||||
struct TSense {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x01 */ u8 field_0x1;
|
||||
/* 0x02 */ u8 field_0x2;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
};
|
||||
struct TVmap {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 field_0xC;
|
||||
};
|
||||
|
||||
TBasicBank* createBasicBank(void*);
|
||||
void findOscPtr(JASystem::TBasicBank*, JASystem::BNKParser::THeader*, JASystem::BNKParser::TOsc*);
|
||||
void getOscTableEndPtr(s16*);
|
||||
TOscillator::Osc_* findOscPtr(JASystem::TBasicBank*, JASystem::BNKParser::THeader*, JASystem::BNKParser::TOsc*);
|
||||
s16* getOscTableEndPtr(s16*);
|
||||
|
||||
extern u32 sUsedHeapSize;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef JASDRUMSET_H
|
||||
#define JASDRUMSET_H
|
||||
|
||||
#include "JSystem/JAudio/JASBasicInst.h"
|
||||
|
||||
namespace JASystem {
|
||||
class TInstEffect;
|
||||
class TInstParam;
|
||||
|
||||
class TDrumSet : public TInst {
|
||||
public:
|
||||
class TPerc {
|
||||
public:
|
||||
TPerc();
|
||||
~TPerc();
|
||||
void setEffectCount(u32);
|
||||
void setVeloRegionCount(u32);
|
||||
TBasicInst::TVeloRegion* getVeloRegion(int);
|
||||
void setEffect(int, JASystem::TInstEffect*);
|
||||
void setRelease(u32);
|
||||
|
||||
/* 0x00 */ f32 field_0x0;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ u16 field_0xc;
|
||||
/* 0x10 */ TInstEffect** mEffect;
|
||||
/* 0x14 */ u32 mEffectCount;
|
||||
/* 0x18 */ u32 mVelomapCount;
|
||||
/* 0x1C */ TBasicInst::TVeloRegion* mVelomap;
|
||||
};
|
||||
|
||||
TDrumSet() {}
|
||||
~TDrumSet();
|
||||
bool getParam(int, int, JASystem::TInstParam*) const;
|
||||
TPerc* getPerc(int);
|
||||
u32 getType() const { return 'PERC'; }
|
||||
|
||||
static const u32 sPercCount = 128;
|
||||
|
||||
/* 0x04 */ TPerc field_0x4[sPercCount];
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* JASDRUMSET_H */
|
||||
@@ -6,22 +6,45 @@
|
||||
|
||||
namespace JASystem {
|
||||
struct TInstParam {
|
||||
TInstParam() {
|
||||
field_0x0 = 0;
|
||||
field_0x4 = 0;
|
||||
mOscData = NULL;
|
||||
mOscCount = 0;
|
||||
field_0x10 = 1.0f;
|
||||
field_0x14 = 1.0f;
|
||||
field_0x18 = 1.0f;
|
||||
field_0x1c = 1.0f;
|
||||
field_0x20 = 0.5f;
|
||||
field_0x24 = 0.0f;
|
||||
field_0x28 = 0.0f;
|
||||
field_0x2c = 0.5f;
|
||||
field_0x30 = 0.0f;
|
||||
field_0x34 = 0.0f;
|
||||
field_0x38 = 0;
|
||||
field_0x3a = 0;
|
||||
field_0x3c = 0;
|
||||
field_0x40 = 0;
|
||||
}
|
||||
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x04 */ int field_0x4;
|
||||
/* 0x08 */ TOscillator::Osc_** field_0x8;
|
||||
/* 0x0C */ int field_0xc;
|
||||
/* 0x08 */ TOscillator::Osc_** mOscData;
|
||||
/* 0x0C */ u32 mOscCount;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ f32 field_0x14;
|
||||
/* 0x18 */ f32 field_0x18;
|
||||
/* 0x1C */ f32 field_0x1c;
|
||||
/* 0x20 */ f32 field_0x20;
|
||||
/* 0x24 */ u8 field_0x24[0x2C - 0x24];
|
||||
/* 0x24 */ f32 field_0x24;
|
||||
/* 0x28 */ f32 field_0x28;
|
||||
/* 0x2C */ f32 field_0x2c;
|
||||
/* 0x30 */ f32 field_0x30;
|
||||
/* 0x34 */ f32 field_0x34;
|
||||
/* 0x38 */ u8 field_0x38;
|
||||
/* 0x3A */ short field_0x3a;
|
||||
/* 0x3A */ u16 field_0x3a;
|
||||
/* 0x3C */ int field_0x3c;
|
||||
/* 0x40 */ int field_0x40;
|
||||
};
|
||||
class TInst {
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef JASINSTRAND_H
|
||||
#define JASINSTRAND_H
|
||||
|
||||
#include "JSystem/JAudio/JASInstEffect.h"
|
||||
|
||||
namespace JASystem {
|
||||
class TInstRand : public TInstEffect {
|
||||
public:
|
||||
TInstRand() {
|
||||
field_0x8 = 1.0f;
|
||||
field_0xc = 0.0f;
|
||||
}
|
||||
virtual f32 getY(int, int) const;
|
||||
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 field_0xc;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* JASINSTRAND_H */
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef JASINSTSENSE_H
|
||||
#define JASINSTSENSE_H
|
||||
|
||||
#include "JSystem/JAudio/JASInstEffect.h"
|
||||
|
||||
namespace JASystem {
|
||||
class TInstSense : public TInstEffect {
|
||||
public:
|
||||
TInstSense() {
|
||||
field_0x8 = 0;
|
||||
field_0x9 = 60;
|
||||
field_0xc = 1.0f;
|
||||
field_0x10 = 1.0f;
|
||||
}
|
||||
virtual f32 getY(int, int) const;
|
||||
void setParams(int, int, f32, f32);
|
||||
|
||||
u8 field_0x8;
|
||||
u8 field_0x9;
|
||||
f32 field_0xc;
|
||||
f32 field_0x10;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* JASINSTSENSE_H */
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "dolphin/types.h"
|
||||
|
||||
namespace JASystem {
|
||||
class TSimpleWaveBank : public TWaveBank, TWaveArc {
|
||||
class TSimpleWaveBank : public TWaveBank, public TWaveArc {
|
||||
public:
|
||||
class TWaveHandle : public JASystem::TWaveHandle {
|
||||
public:
|
||||
|
||||
@@ -7,17 +7,61 @@ namespace JASystem {
|
||||
class TBasicWaveBank;
|
||||
class TSimpleWaveBank;
|
||||
namespace WSParser {
|
||||
struct TCtrl;
|
||||
struct TCtrlGroup;
|
||||
struct TCtrlScene;
|
||||
struct TCtrlWave;
|
||||
struct TWave;
|
||||
struct TWaveArchive;
|
||||
struct TWaveArchiveBank;
|
||||
struct TCtrl {
|
||||
/* 0x00 */ u32 mMagic;
|
||||
/* 0x04 */ u32 mWaveCount;
|
||||
/* 0x08 */ u32 mCtrlWaveOffsets[1];
|
||||
};
|
||||
struct TCtrlGroup {
|
||||
/* 0x00 */ u32 mMagic;
|
||||
/* 0x04 */ u8 field_0x4[0x08 - 0x04];
|
||||
/* 0x08 */ u32 mCtrlGroupCount;
|
||||
/* 0x0C */ u32 mCtrlSceneOffsets[1];
|
||||
};
|
||||
struct TCtrlScene {
|
||||
/* 0x00 */ u32 mMagic;
|
||||
/* 0x04 */ u8 field_0x4[0x0C - 0x04];
|
||||
/* 0x0C */ u32 mCtrlOffset;
|
||||
};
|
||||
struct TCtrlWave {
|
||||
/* 0x00 */ u32 field_0x0;
|
||||
};
|
||||
struct THeader {
|
||||
/* 0x00 */ u8 field_0x0[0x10];
|
||||
/* 0x10 */ u32 mArchiveBankOffset;
|
||||
/* 0x14 */ u32 mCtrlGroupOffset;
|
||||
};
|
||||
struct TWave {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x01 */ u8 field_0x1;
|
||||
/* 0x02 */ u8 field_0x2;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ u32 mOffset;
|
||||
/* 0x0C */ u32 field_0xc;
|
||||
/* 0x10 */ u32 field_0x10;
|
||||
/* 0x14 */ u32 field_0x14;
|
||||
/* 0x18 */ u32 field_0x18;
|
||||
/* 0x1C */ u32 field_0x1c;
|
||||
/* 0x20 */ s16 field_0x20;
|
||||
/* 0x22 */ s16 field_0x22;
|
||||
/* 0x24 */ u8 field_0x24[0x28 - 0x24];
|
||||
/* 0x28 */ int field_0x28;
|
||||
};
|
||||
struct TWaveArchive {
|
||||
/* 0x00 */ char mFileName[0x74];
|
||||
/* 0x74 */ u32 mWaveOffsets[1];
|
||||
};
|
||||
struct TWaveArchiveBank {
|
||||
/* 0x00 */ u32 mMagic;
|
||||
/* 0x04 */ u8 field_0x4[0x08 - 0x04];
|
||||
/* 0x08 */ u32 mArchiveOffsets[1];
|
||||
};
|
||||
|
||||
u32 getGroupCount(void*);
|
||||
TBasicWaveBank* createBasicWaveBank(void*);
|
||||
TSimpleWaveBank* createSimpleWaveBank(void*);
|
||||
|
||||
extern u32 sUsedHeapSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace JASystem {
|
||||
class TWaveArc;
|
||||
|
||||
struct TWaveInfo {
|
||||
/* 0x00 */ u8 field_0x0;
|
||||
/* 0x00 */ u8 mBlockType;
|
||||
/* 0x01 */ u8 field_0x1;
|
||||
/* 0x02 */ u8 field_0x2;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ int mWavePtrOffs;
|
||||
/* 0x0C */ int field_0xc;
|
||||
/* 0x10 */ int field_0x10;
|
||||
/* 0x14 */ int field_0x14;
|
||||
/* 0x14 */ int mBlockCount;
|
||||
/* 0x18 */ int field_0x18;
|
||||
/* 0x1C */ int field_0x1c;
|
||||
/* 0x20 */ s16 field_0x20;
|
||||
|
||||
@@ -73,8 +73,8 @@ JAIZelBasic::JAIZelBasic() {
|
||||
field_0x01f8 = 0;
|
||||
field_0x0201 = 0;
|
||||
field_0x0204 = 0;
|
||||
field_0x0064[0] = 0;
|
||||
field_0x0064[1] = 0;
|
||||
field_0x0064 = 0;
|
||||
field_0x0065 = 0;
|
||||
field_0x00b8 = 0;
|
||||
field_0x00ba = 0;
|
||||
field_0x00bb = 0;
|
||||
@@ -332,8 +332,8 @@ void JAIZelBasic::bgmStop(u32 param_1, s32 param_2) {
|
||||
field_0x1f3c = 0;
|
||||
field_0x0201 = 0;
|
||||
mLastMinibossSubBGMType = 0;
|
||||
field_0x0064[0] = 0;
|
||||
field_0x0064[1] = 0;
|
||||
field_0x0064 = 0;
|
||||
field_0x0065 = 0;
|
||||
field_0x00b8 = 0;
|
||||
field_0x00cb = 0xff;
|
||||
field_0x00cc = 0;
|
||||
@@ -872,7 +872,7 @@ void JAIZelBasic::setOutputMode(u32 param_1) {
|
||||
|
||||
/* 802A98A0-802A9A20 .text talkIn__11JAIZelBasicFv */
|
||||
void JAIZelBasic::talkIn() {
|
||||
if (field_0x0064[0] != 1 && isDemo() != 1 && field_0x0098 != 0.0f) {
|
||||
if (field_0x0064 != 1 && isDemo() != 1 && field_0x0098 != 0.0f) {
|
||||
field_0x0084 = JAIZelParam::VOL_BGM_TALKING;
|
||||
if (mpMainBgmSound && field_0x0078 != JA_BGM_BIRDMAN_GOAL && field_0x0078 != JA_BGM_BIRDMAN_FAIL) {
|
||||
mpMainBgmSound->setVolume(calcMainBgmVol(), 2, 0);
|
||||
|
||||
@@ -43,7 +43,7 @@ JAIBasic::JAIBasic() {
|
||||
mAudioCamera = NULL;
|
||||
field_0x10 = 0;
|
||||
initLoadFileSw = 2;
|
||||
field_0x1c = 0;
|
||||
field_0x1c = NULL;
|
||||
field_0x8 = NULL;
|
||||
field_0x18 = 0;
|
||||
msCurrentHeap = JASDram;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "JSystem/JAudio/JAIBasic.h"
|
||||
#include "JSystem/JAudio/JASDSPInterface.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "global.h"
|
||||
|
||||
JAInter::Fx::initOnCodeFxScene_s* JAInter::Fx::initOnCodeFxScene;
|
||||
u8 JAInter::Fx::mSceneMax;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "JSystem/JAudio/JAIBasic.h"
|
||||
#include "JSystem/JAudio/JAIGlobalParameter.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "global.h"
|
||||
|
||||
JAInter::HeapBlock* JAInter::HeapMgr::sAutoHeap;
|
||||
JAInter::HeapBlock* JAInter::HeapMgr::sStayHeap;
|
||||
|
||||
@@ -4,19 +4,191 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JAudio/JASBNKParser.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio/JASBasicBank.h"
|
||||
#include "JSystem/JAudio/JASBasicInst.h"
|
||||
#include "JSystem/JAudio/JASCalc.h"
|
||||
#include "JSystem/JAudio/JASDrumSet.h"
|
||||
#include "JSystem/JAudio/JASInstRand.h"
|
||||
#include "JSystem/JAudio/JASInstSense.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
u32 JASystem::BNKParser::sUsedHeapSize;
|
||||
|
||||
/* 802870F0-802879A0 .text createBasicBank__Q28JASystem9BNKParserFPv */
|
||||
JASystem::TBasicBank* JASystem::BNKParser::createBasicBank(void*) {
|
||||
/* Nonmatching */
|
||||
JASystem::TBasicBank* JASystem::BNKParser::createBasicBank(void* stream) {
|
||||
JKRHeap* heap = TBank::getCurrentHeap();
|
||||
const u32 freeSize = heap->getFreeSize();
|
||||
THeader* header = (THeader*)stream;
|
||||
TBasicBank* bank = new (heap, 0) TBasicBank();
|
||||
if (bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
bank->setInstCount(0x100);
|
||||
|
||||
for (int i = 0; i < 0x80; i++) {
|
||||
TInst* instRaw = JSUConvertOffsetToPtr<TInst>(header, header->mInstOffsets[i]);
|
||||
if (instRaw != NULL) {
|
||||
TBasicInst* instp = new (heap, 0) TBasicInst();
|
||||
JUT_ASSERT(56, instp != 0);
|
||||
instp->field_0x4 = instRaw->field_0x8;
|
||||
instp->field_0x8 = instRaw->field_0xC;
|
||||
|
||||
instp->setOscCount(2);
|
||||
for (int oscIndex = 0, j = 0; j < 2; j++) {
|
||||
TOsc* oscRaw = JSUConvertOffsetToPtr<TOsc>(header, instRaw->mOscOffsets[j]);
|
||||
if (oscRaw != NULL) {
|
||||
TOscillator::Osc_* osc = findOscPtr(bank, header, oscRaw);
|
||||
if (osc == NULL) {
|
||||
osc = new (heap, 0) TOscillator::Osc_();
|
||||
JUT_ASSERT(72, osc != 0);
|
||||
osc->field_0x0 = oscRaw->field_0x0;
|
||||
osc->field_0x4 = oscRaw->field_0x4;
|
||||
s16* oscTable = JSUConvertOffsetToPtr<s16>(header, oscRaw->field_0x8);
|
||||
if (oscTable != NULL) {
|
||||
u32 tableLength = getOscTableEndPtr(oscTable) - oscTable;
|
||||
osc->table = new (heap, 0) s16[tableLength];
|
||||
JUT_ASSERT(82, osc->table != 0);
|
||||
Calc::bcopy(oscTable, osc->table, tableLength * sizeof(s16));
|
||||
} else {
|
||||
osc->table = NULL;
|
||||
}
|
||||
oscTable = JSUConvertOffsetToPtr<s16>(header, oscRaw->field_0xC);
|
||||
if (oscTable != NULL) {
|
||||
u32 tableLength = getOscTableEndPtr(oscTable) - oscTable;
|
||||
osc->rel_table = new (heap, 0) s16[tableLength];
|
||||
JUT_ASSERT(94, osc->rel_table != 0);
|
||||
Calc::bcopy(oscTable, osc->rel_table, tableLength);
|
||||
} else {
|
||||
osc->rel_table = NULL;
|
||||
}
|
||||
osc->field_0x10 = oscRaw->field_0x10;
|
||||
osc->field_0x14 = oscRaw->field_0x14;
|
||||
}
|
||||
instp->setOsc(oscIndex, osc);
|
||||
oscIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
instp->setEffectCount(4);
|
||||
for (int j = 0; j < 2; j++) {
|
||||
TRand* randRaw = JSUConvertOffsetToPtr<TRand>(header, instRaw->mRandOffsets[j]);
|
||||
if (randRaw != NULL) {
|
||||
TInstRand* randp = new (heap, 0) TInstRand();
|
||||
JUT_ASSERT(120, randp != 0);
|
||||
randp->setTarget(randRaw->field_0x0);
|
||||
randp->field_0x8 = randRaw->field_0x4;
|
||||
randp->field_0xc = randRaw->field_0x8;
|
||||
instp->setEffect(j, randp);
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
TSense* senseRaw = JSUConvertOffsetToPtr<TSense>(header, instRaw->mSenseOffsets[j]);
|
||||
if (senseRaw != NULL) {
|
||||
TInstSense* sensep = new (heap, 0) TInstSense();
|
||||
JUT_ASSERT(133, sensep != 0);
|
||||
sensep->setTarget(senseRaw->field_0x0);
|
||||
sensep->setParams(senseRaw->field_0x1, senseRaw->field_0x2, senseRaw->field_0x4, senseRaw->field_0x8);
|
||||
instp->setEffect(j + 2, sensep);
|
||||
}
|
||||
}
|
||||
|
||||
instp->setKeyRegionCount(instRaw->mKeyRegionCount);
|
||||
for (int j = 0; j < instRaw->mKeyRegionCount; j++) {
|
||||
TBasicInst::TKeymap* instKeymap = instp->getKeyRegion(j);
|
||||
TKeymap* keymapRaw = JSUConvertOffsetToPtr<TKeymap>(header, instRaw->mKeymapOffsets[j]);
|
||||
instKeymap->mBaseKey = keymapRaw->field_0x0;
|
||||
instKeymap->setVeloRegionCount(keymapRaw->field_0x4);
|
||||
for (int k = 0; k < keymapRaw->field_0x4; k++) {
|
||||
TBasicInst::TVeloRegion* instVeloRegion = instKeymap->getVeloRegion(k);
|
||||
TVmap* vmapRaw = JSUConvertOffsetToPtr<TVmap>(header, keymapRaw->mVmapOffsets[k]);
|
||||
instVeloRegion->mBaseVel = vmapRaw->field_0x0;
|
||||
instVeloRegion->field_0x04 = vmapRaw->field_0x4 & 0xFFFF;
|
||||
instVeloRegion->field_0x08 = vmapRaw->field_0x8;
|
||||
instVeloRegion->field_0x0c = vmapRaw->field_0xC;
|
||||
}
|
||||
}
|
||||
bank->setInst(i, instp);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
TPerc* percRaw = JSUConvertOffsetToPtr<TPerc>(header, header->mPercOffsets[i]);
|
||||
if (percRaw != NULL) {
|
||||
TDrumSet* setp = new (heap, 0) TDrumSet();
|
||||
JUT_ASSERT(183, setp != 0);
|
||||
for (int j = 0; j < 0x80; j++) {
|
||||
TPmap* pmapRaw = JSUConvertOffsetToPtr<TPmap>(header, percRaw->mPmapOffsets[j]);
|
||||
if (pmapRaw != NULL) {
|
||||
TDrumSet::TPerc* drumSetPerc = setp->getPerc(j);
|
||||
drumSetPerc->field_0x0 = pmapRaw->field_0x0;
|
||||
drumSetPerc->field_0x4 = pmapRaw->field_0x4;
|
||||
if (percRaw->mMagic == 'PER2') {
|
||||
drumSetPerc->field_0x8 = percRaw->field_0x288[j] / 127.0f;
|
||||
drumSetPerc->setRelease(percRaw->field_0x308[j]);
|
||||
}
|
||||
drumSetPerc->setEffectCount(2);
|
||||
for (int effectIndex = 0, k = 0; k < 2; k++) {
|
||||
TRand* randRaw = JSUConvertOffsetToPtr<TRand>(header, pmapRaw->mRandOffsets[k]);
|
||||
if (randRaw != NULL) {
|
||||
TInstRand* randp = new (heap, 0) TInstRand();
|
||||
JUT_ASSERT(207, randp != 0);
|
||||
randp->setTarget(randRaw->field_0x0);
|
||||
randp->field_0x8 = randRaw->field_0x4;
|
||||
randp->field_0xc = randRaw->field_0x8;
|
||||
drumSetPerc->setEffect(effectIndex, randp);
|
||||
effectIndex++;
|
||||
}
|
||||
}
|
||||
drumSetPerc->setVeloRegionCount(pmapRaw->mVeloRegionCount);
|
||||
for (int k = 0; k < pmapRaw->mVeloRegionCount; k++) {
|
||||
TBasicInst::TVeloRegion* instVeloRegion = drumSetPerc->getVeloRegion(k);
|
||||
TVmap* vmapRaw = JSUConvertOffsetToPtr<TVmap>(header, pmapRaw->mVeloRegionOffsets[k]);
|
||||
instVeloRegion->mBaseVel = vmapRaw->field_0x0;
|
||||
instVeloRegion->field_0x04 = vmapRaw->field_0x4 & 0xFFFF;
|
||||
instVeloRegion->field_0x08 = vmapRaw->field_0x8;
|
||||
instVeloRegion->field_0x0c = vmapRaw->field_0xC;
|
||||
}
|
||||
}
|
||||
}
|
||||
bank->setInst(i + 0xE4, setp);
|
||||
}
|
||||
}
|
||||
sUsedHeapSize += freeSize - heap->getFreeSize();
|
||||
return bank;
|
||||
}
|
||||
|
||||
/* 802879A0-80287AEC .text findOscPtr__Q28JASystem9BNKParserFPQ28JASystem10TBasicBankPQ38JASystem9BNKParser7THeaderPQ38JASystem9BNKParser4TOsc */
|
||||
void JASystem::BNKParser::findOscPtr(JASystem::TBasicBank*, JASystem::BNKParser::THeader*, JASystem::BNKParser::TOsc*) {
|
||||
/* Nonmatching */
|
||||
JASystem::TOscillator::Osc_* JASystem::BNKParser::findOscPtr(JASystem::TBasicBank* bank, JASystem::BNKParser::THeader* header, JASystem::BNKParser::TOsc* oscPtr) {
|
||||
u32* instOffsets = header->mInstOffsets - 1;
|
||||
for (int i = 0; i < 128; i++) {
|
||||
TInst* instRaw = JSUConvertOffsetToPtr<TInst>(header, instOffsets[i + 1]);
|
||||
if (instRaw != NULL) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
TOsc* oscRaw = JSUConvertOffsetToPtr<TOsc>(header, instRaw->mOscOffsets[j]);
|
||||
if (oscRaw == oscPtr) {
|
||||
JASystem::TInst* inst = bank->getInst(i);
|
||||
if (inst != NULL) {
|
||||
TInstParam param;
|
||||
inst->getParam(60, 127, ¶m);
|
||||
if (j < param.mOscCount) {
|
||||
return param.mOscData[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 80287AEC-80287B00 .text getOscTableEndPtr__Q28JASystem9BNKParserFPs */
|
||||
void JASystem::BNKParser::getOscTableEndPtr(s16*) {
|
||||
/* Nonmatching */
|
||||
s16* JASystem::BNKParser::getOscTableEndPtr(s16* param_1) {
|
||||
s16 v1;
|
||||
do {
|
||||
v1 = *param_1;
|
||||
param_1 += 3;
|
||||
} while (v1 <= 0xa);
|
||||
return param_1;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ JASystem::TBasicInst::~TBasicInst() {
|
||||
bool JASystem::TBasicInst::getParam(int key, int velo, TInstParam* param) const {
|
||||
param->field_0x0 = 0;
|
||||
param->field_0x38 = 0;
|
||||
param->field_0x8 = mOsc;
|
||||
param->field_0xc = mOscCount;
|
||||
param->mOscData = mOsc;
|
||||
param->mOscCount = mOscCount;
|
||||
param->field_0x10 *= field_0x4;
|
||||
param->field_0x14 *= field_0x8;
|
||||
for (int i = 0; i < mEffectCount; i++) {
|
||||
|
||||
@@ -3,61 +3,141 @@
|
||||
// Translation Unit: JASDrumSet.cpp
|
||||
//
|
||||
|
||||
#include "JASDrumSet.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio/JASDrumSet.h"
|
||||
#include "JSystem/JAudio/JASBank.h"
|
||||
#include "JSystem/JAudio/JASCalc.h"
|
||||
#include "JSystem/JAudio/JASInstEffect.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
/* 802851D4-80285470 .text getParam__Q28JASystem8TDrumSetCFiiPQ28JASystem10TInstParam */
|
||||
void JASystem::TDrumSet::getParam(int, int, JASystem::TInstParam*) const {
|
||||
/* Nonmatching */
|
||||
bool JASystem::TDrumSet::getParam(int key, int param_2, JASystem::TInstParam* param_3) const {
|
||||
JUT_ASSERT(24, key >= 0);
|
||||
if (key >= sPercCount) {
|
||||
OSReport("JASDrumSet: key %d >= sPercCount %d\n", key, sPercCount);
|
||||
return false;
|
||||
}
|
||||
const TPerc* perc = field_0x4 + key;
|
||||
param_3->field_0x0 = 0;
|
||||
param_3->field_0x38 = 1;
|
||||
param_3->field_0x10 *= perc->field_0x0;
|
||||
param_3->field_0x14 *= perc->field_0x4;
|
||||
param_3->field_0x20 = perc->field_0x8;
|
||||
param_3->field_0x3a = perc->field_0xc;
|
||||
static TOscillator::Osc_ osc;
|
||||
osc.field_0x0 = 0;
|
||||
osc.field_0x4 = 1.0f;
|
||||
osc.table = NULL;
|
||||
osc.rel_table = NULL;
|
||||
osc.field_0x10 = 1.0f;
|
||||
osc.field_0x14 = 0.0f;
|
||||
static TOscillator::Osc_* oscp = &osc;
|
||||
param_3->mOscData = &oscp;
|
||||
param_3->mOscCount = 1;
|
||||
for (int i = 0; i < perc->mEffectCount; i++) {
|
||||
TInstEffect* effect = perc->mEffect[i];
|
||||
if (effect) {
|
||||
f32 y = effect->getY(key, param_2);
|
||||
switch (effect->mTarget) {
|
||||
case 0:
|
||||
param_3->field_0x18 *= y;
|
||||
break;
|
||||
case 1:
|
||||
param_3->field_0x1c *= y;
|
||||
break;
|
||||
case 2:
|
||||
param_3->field_0x2c += y - 0.5;
|
||||
break;
|
||||
case 3:
|
||||
param_3->field_0x30 += y;
|
||||
break;
|
||||
case 4:
|
||||
param_3->field_0x34 += y;
|
||||
break;
|
||||
default:
|
||||
JUT_ASSERT(77, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < perc->mVelomapCount; i++) {
|
||||
TBasicInst::TVeloRegion* region = perc->mVelomap + i;
|
||||
if (param_2 > region->mBaseVel) {
|
||||
continue;
|
||||
}
|
||||
param_3->field_0x10 *= region->field_0x08;
|
||||
param_3->field_0x14 *= region->field_0x0c;
|
||||
param_3->field_0x4 = region->field_0x04;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 80285470-80285520 .text getPerc__Q28JASystem8TDrumSetFi */
|
||||
void JASystem::TDrumSet::getPerc(int) {
|
||||
/* Nonmatching */
|
||||
JASystem::TDrumSet::TPerc* JASystem::TDrumSet::getPerc(int index) {
|
||||
JUT_ASSERT(101, index < sPercCount);
|
||||
JUT_ASSERT(102, index >= 0);
|
||||
return field_0x4 + index;
|
||||
}
|
||||
|
||||
/* 80285520-80285554 .text __ct__Q38JASystem8TDrumSet5TPercFv */
|
||||
JASystem::TDrumSet::TPerc::TPerc() {
|
||||
/* Nonmatching */
|
||||
field_0x0 = 1.0f;
|
||||
field_0x4 = 1.0f;
|
||||
field_0x8 = 0.5f;
|
||||
field_0xc = 1000;
|
||||
mEffect = NULL;
|
||||
mEffectCount = 0;
|
||||
mVelomapCount = 0;
|
||||
mVelomap = NULL;
|
||||
}
|
||||
|
||||
/* 80285554-802855B0 .text __dt__Q38JASystem8TDrumSet5TPercFv */
|
||||
JASystem::TDrumSet::TPerc::~TPerc() {
|
||||
/* Nonmatching */
|
||||
delete[] mEffect;
|
||||
delete[] mVelomap;
|
||||
}
|
||||
|
||||
/* 802855B0-80285664 .text setEffectCount__Q38JASystem8TDrumSet5TPercFUl */
|
||||
void JASystem::TDrumSet::TPerc::setEffectCount(unsigned long) {
|
||||
/* Nonmatching */
|
||||
void JASystem::TDrumSet::TPerc::setEffectCount(u32 param_1) {
|
||||
delete[] mEffect;
|
||||
mEffectCount = param_1;
|
||||
if (param_1 == 0) {
|
||||
mEffect = NULL;
|
||||
return;
|
||||
}
|
||||
mEffect = new (TBank::getCurrentHeap(), 0) TInstEffect*[param_1];
|
||||
JUT_ASSERT(146, mEffect != 0);
|
||||
Calc::bzero(mEffect, param_1 * 4);
|
||||
}
|
||||
|
||||
/* 80285664-802856F8 .text setVeloRegionCount__Q38JASystem8TDrumSet5TPercFUl */
|
||||
void JASystem::TDrumSet::TPerc::setVeloRegionCount(unsigned long) {
|
||||
/* Nonmatching */
|
||||
void JASystem::TDrumSet::TPerc::setVeloRegionCount(u32 param_1) {
|
||||
delete[] mVelomap;
|
||||
mVelomap = new (TBank::getCurrentHeap(), 0) TBasicInst::TVeloRegion[param_1];
|
||||
JUT_ASSERT(155, mVelomap != 0);
|
||||
mVelomapCount = param_1;
|
||||
}
|
||||
|
||||
/* 802856F8-802857AC .text getVeloRegion__Q38JASystem8TDrumSet5TPercFi */
|
||||
void JASystem::TDrumSet::TPerc::getVeloRegion(int) {
|
||||
/* Nonmatching */
|
||||
JASystem::TBasicInst::TVeloRegion* JASystem::TDrumSet::TPerc::getVeloRegion(int index) {
|
||||
JUT_ASSERT(161, index < mVelomapCount);
|
||||
JUT_ASSERT(162, index >= 0);
|
||||
return mVelomap + index;
|
||||
}
|
||||
|
||||
/* 802857AC-80285864 .text setEffect__Q38JASystem8TDrumSet5TPercFiPQ28JASystem11TInstEffect */
|
||||
void JASystem::TDrumSet::TPerc::setEffect(int, JASystem::TInstEffect*) {
|
||||
/* Nonmatching */
|
||||
void JASystem::TDrumSet::TPerc::setEffect(int index, JASystem::TInstEffect* param_2) {
|
||||
JUT_ASSERT(177, index < mEffectCount);
|
||||
JUT_ASSERT(178, index >= 0);
|
||||
mEffect[index] = param_2;
|
||||
}
|
||||
|
||||
/* 80285864-802858D8 .text setRelease__Q38JASystem8TDrumSet5TPercFUl */
|
||||
void JASystem::TDrumSet::TPerc::setRelease(unsigned long) {
|
||||
/* Nonmatching */
|
||||
void JASystem::TDrumSet::TPerc::setRelease(u32 release) {
|
||||
JUT_ASSERT(195, release < 0x10000);
|
||||
field_0xc = release;
|
||||
}
|
||||
|
||||
/* 802858D8-8028595C .text __dt__Q28JASystem8TDrumSetFv */
|
||||
JASystem::TDrumSet::~TDrumSet() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 8028595C-80285968 .text getType__Q28JASystem8TDrumSetCFv */
|
||||
void JASystem::TDrumSet::getType() const {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
JASystem::TDrumSet::~TDrumSet() {}
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
// Translation Unit: JASInstRand.cpp
|
||||
//
|
||||
|
||||
#include "JASInstRand.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio/JASInstRand.h"
|
||||
#include "JSystem/JMath/random.h"
|
||||
|
||||
/* 80286B58-80286BF4 .text getY__Q28JASystem9TInstRandCFii */
|
||||
void JASystem::TInstRand::getY(int, int) const {
|
||||
/* Nonmatching */
|
||||
f32 JASystem::TInstRand::getY(int, int) const {
|
||||
static JMath::TRandom_fast_ oRandom(0);
|
||||
f32 tmp = (oRandom.get_ufloat_1() * 2.0f - 0.9999999f);
|
||||
tmp *= field_0xc;
|
||||
return tmp + field_0x8;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,38 @@
|
||||
// Translation Unit: JASInstSense.cpp
|
||||
//
|
||||
|
||||
#include "JASInstSense.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio/JASInstSense.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
/* 802868F0-80286A1C .text getY__Q28JASystem10TInstSenseCFii */
|
||||
void JASystem::TInstSense::getY(int, int) const {
|
||||
f32 JASystem::TInstSense::getY(int param_1, int param_2) const {
|
||||
/* Nonmatching */
|
||||
int r6 = 0;
|
||||
switch (field_0x8) {
|
||||
case 1:
|
||||
r6 = param_2;
|
||||
break;
|
||||
case 2:
|
||||
r6 = param_1;
|
||||
break;
|
||||
}
|
||||
if (field_0x9 == 0x7f || field_0x9 == 0) {
|
||||
return field_0xc + r6 * (field_0x10 - field_0xc) / 127.0f;
|
||||
}
|
||||
if (r6 < field_0x9) {
|
||||
return field_0xc + (1.0f - field_0xc) * r6 / field_0x9;
|
||||
}
|
||||
return field_0x10 - 1.0f * (r6 - field_0x9) / (0x7f - field_0x9) + 1.0f;
|
||||
}
|
||||
|
||||
/* 80286A1C-80286B58 .text setParams__Q28JASystem10TInstSenseFiiff */
|
||||
void JASystem::TInstSense::setParams(int trigger, int centerkey, float, float) {
|
||||
/* Nonmatching */
|
||||
void JASystem::TInstSense::setParams(int trigger, int centerkey, f32 param_3, f32 param_4) {
|
||||
JUT_ASSERT(43, trigger >= 0);
|
||||
JUT_ASSERT(44, trigger < 256);
|
||||
field_0x8 = trigger;
|
||||
JUT_ASSERT(47, centerkey >= 0);
|
||||
JUT_ASSERT(48, centerkey < 256);
|
||||
field_0x9 = centerkey;
|
||||
field_0xc = param_3;
|
||||
field_0x10 = param_4;
|
||||
}
|
||||
|
||||
@@ -4,19 +4,117 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JAudio/JASWSParser.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio/JASBasicWaveBank.h"
|
||||
#include "JSystem/JAudio/JASSimpleWaveBank.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
u32 JASystem::WSParser::sUsedHeapSize;
|
||||
|
||||
/* 80286BF4-80286C1C .text getGroupCount__Q28JASystem8WSParserFPv */
|
||||
u32 JASystem::WSParser::getGroupCount(void*) {
|
||||
/* Nonmatching */
|
||||
u32 JASystem::WSParser::getGroupCount(void* stream) {
|
||||
THeader* header = (THeader*)stream;
|
||||
return JSUConvertOffsetToPtr<TCtrlGroup>(header, header->mCtrlGroupOffset)->mCtrlGroupCount;
|
||||
}
|
||||
|
||||
/* 80286C1C-80286E38 .text createBasicWaveBank__Q28JASystem8WSParserFPv */
|
||||
JASystem::TBasicWaveBank* JASystem::WSParser::createBasicWaveBank(void*) {
|
||||
JASystem::TBasicWaveBank* JASystem::WSParser::createBasicWaveBank(void* stream) {
|
||||
/* Nonmatching */
|
||||
JKRHeap* heap = TWaveBank::getCurrentHeap();
|
||||
const u32 priorFreeSize = heap->getFreeSize();
|
||||
const THeader* header = (THeader*)stream;
|
||||
TBasicWaveBank* bank = new (heap, 0) TBasicWaveBank();
|
||||
if (bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const TCtrlGroup* ctrlGroupRaw = JSUConvertOffsetToPtr<TCtrlGroup>(header, header->mCtrlGroupOffset);
|
||||
bank->setGroupCount(ctrlGroupRaw->mCtrlGroupCount);
|
||||
u32 maxSize = 0;
|
||||
for (int groupIndex = 0; groupIndex < ctrlGroupRaw->mCtrlGroupCount; groupIndex++) {
|
||||
TCtrlScene* ctrlSceneRaw = JSUConvertOffsetToPtr<TCtrlScene>(header, ctrlGroupRaw->mCtrlSceneOffsets[groupIndex]);
|
||||
TCtrl* ctrlRaw = JSUConvertOffsetToPtr<TCtrl>(header, ctrlSceneRaw->mCtrlOffset);
|
||||
TBasicWaveBank::TWaveGroup* waveGroup = bank->getWaveGroup(groupIndex);
|
||||
TWaveArchiveBank* archiveBankRaw = JSUConvertOffsetToPtr<TWaveArchiveBank>(header, header->mArchiveBankOffset);
|
||||
TWaveArchive* archiveRaw = JSUConvertOffsetToPtr<TWaveArchive>(header, archiveBankRaw->mArchiveOffsets[groupIndex]);
|
||||
waveGroup->setWaveCount(ctrlRaw->mWaveCount);
|
||||
for (int waveIndex = 0; waveIndex < ctrlRaw->mWaveCount; waveIndex++) {
|
||||
TWave* waveRaw = JSUConvertOffsetToPtr<TWave>(header, archiveRaw->mWaveOffsets[waveIndex]);
|
||||
TWaveInfo info;
|
||||
|
||||
info.mBlockType = waveRaw->field_0x0;
|
||||
info.field_0x1 = waveRaw->field_0x1;
|
||||
info.field_0x2 = waveRaw->field_0x2;
|
||||
info.field_0x4 = waveRaw->field_0x4;
|
||||
info.mWavePtrOffs = waveRaw->mOffset;
|
||||
info.field_0xc = waveRaw->field_0xc;
|
||||
info.field_0x10 = waveRaw->field_0x10;
|
||||
info.mBlockCount = waveRaw->field_0x14;
|
||||
info.field_0x18 = waveRaw->field_0x18;
|
||||
info.field_0x1c = waveRaw->field_0x1c;
|
||||
info.field_0x20 = waveRaw->field_0x20;
|
||||
info.field_0x22 = waveRaw->field_0x22;
|
||||
info.field_0x28 = waveRaw->field_0x28;
|
||||
TCtrlWave* ctrlWaveRaw = JSUConvertOffsetToPtr<TCtrlWave>(header, ctrlRaw->mCtrlWaveOffsets[waveIndex]);
|
||||
u32 size = ctrlWaveRaw->field_0x0 & 0xFFFF;
|
||||
waveGroup->setWaveInfo(waveIndex, size, info);
|
||||
if (maxSize < size) {
|
||||
maxSize = size;
|
||||
}
|
||||
}
|
||||
waveGroup->setFileName(archiveRaw->mFileName);
|
||||
}
|
||||
bank->setWaveTableSize(maxSize + 1);
|
||||
sUsedHeapSize += priorFreeSize - heap->getFreeSize();
|
||||
return bank;
|
||||
}
|
||||
|
||||
/* 80286E38-80287048 .text createSimpleWaveBank__Q28JASystem8WSParserFPv */
|
||||
JASystem::TSimpleWaveBank* JASystem::WSParser::createSimpleWaveBank(void*) {
|
||||
JASystem::TSimpleWaveBank* JASystem::WSParser::createSimpleWaveBank(void* stream) {
|
||||
/* Nonmatching */
|
||||
JKRHeap* heap = TWaveBank::getCurrentHeap();
|
||||
const u32 priorFreeSize = heap->getFreeSize();
|
||||
const THeader* header = (THeader*)stream;
|
||||
const TCtrlGroup* ctrlGroupRaw = JSUConvertOffsetToPtr<TCtrlGroup>(header, header->mCtrlGroupOffset);
|
||||
if (ctrlGroupRaw->mCtrlGroupCount != 1) {
|
||||
return NULL;
|
||||
}
|
||||
TSimpleWaveBank* bank = new (heap, 0) TSimpleWaveBank();
|
||||
if (bank == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
u32 maxSize = 0;
|
||||
|
||||
const TCtrlScene* ctrlSceneRaw = JSUConvertOffsetToPtr<TCtrlScene>(header, ctrlGroupRaw->mCtrlSceneOffsets[0]);
|
||||
const TCtrl* ctrlRaw = JSUConvertOffsetToPtr<TCtrl>(header, ctrlSceneRaw->mCtrlOffset);
|
||||
const TWaveArchiveBank* archiveBankRaw = JSUConvertOffsetToPtr<TWaveArchiveBank>(header, header->mArchiveBankOffset);
|
||||
const TWaveArchive* archiveRaw = JSUConvertOffsetToPtr<TWaveArchive>(header, archiveBankRaw->mArchiveOffsets[0]);
|
||||
for (int waveIndex = 0; waveIndex < ctrlRaw->mWaveCount; waveIndex++) {
|
||||
TCtrlWave* ctrlWaveRaw = JSUConvertOffsetToPtr<TCtrlWave>(header, ctrlRaw->mCtrlWaveOffsets[waveIndex]);
|
||||
u32 size = ctrlWaveRaw->field_0x0 & 0xFFFF;
|
||||
if (maxSize < size) {
|
||||
maxSize = size;
|
||||
}
|
||||
}
|
||||
bank->setWaveTableSize(maxSize + 1);
|
||||
for (int waveIndex = 0; waveIndex < ctrlRaw->mWaveCount; waveIndex++) {
|
||||
TWave* waveRaw = JSUConvertOffsetToPtr<TWave>(header, archiveRaw->mWaveOffsets[waveIndex]);
|
||||
TWaveInfo info;
|
||||
info.mBlockType = waveRaw->field_0x1;
|
||||
info.field_0x1 = waveRaw->field_0x2;
|
||||
info.field_0x4 = waveRaw->field_0x4;
|
||||
info.mWavePtrOffs = waveRaw->mOffset;
|
||||
info.field_0xc = waveRaw->field_0xc;
|
||||
info.field_0x10 = waveRaw->field_0x10;
|
||||
info.mBlockCount = waveRaw->field_0x14;
|
||||
info.field_0x18 = waveRaw->field_0x18;
|
||||
info.field_0x1c = waveRaw->field_0x1c;
|
||||
info.field_0x20 = waveRaw->field_0x20;
|
||||
info.field_0x22 = waveRaw->field_0x22;
|
||||
TCtrlWave* ctrlWaveRaw = JSUConvertOffsetToPtr<TCtrlWave>(header, ctrlRaw->mCtrlWaveOffsets[waveIndex]);
|
||||
bank->setWaveInfo(ctrlWaveRaw->field_0x0 & 0xFFFF, info);
|
||||
}
|
||||
bank->setFileName(archiveRaw->mFileName);
|
||||
sUsedHeapSize += priorFreeSize - heap->getFreeSize();
|
||||
return bank;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user