mirror of https://github.com/zeldaret/tp
JASBNKParser OK, Z2Audience OK (#2929)
This commit is contained in:
parent
07a4e6b052
commit
251d49c6f1
|
|
@ -22058,7 +22058,7 @@ data_80451274 = .sbss:0x80451274; // type:object size:0x1 scope:local align:4 da
|
|||
mNoLoad__16JASBasicWaveBank = .sbss:0x80451278; // type:object size:0x4 scope:global align:4
|
||||
sUsedHeapSize__11JASWSParser = .sbss:0x80451280; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sUsedHeapSize__12JASBNKParser = .sbss:0x80451288; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
data_8045128C = .sbss:0x8045128C; // type:object size:0x1 scope:local align:4 data:byte
|
||||
__init__memPool___46JASPoolAllocObject_MultiThreaded<10JASChannel> = .sbss:0x8045128C; // type:object size:0x1 scope:local align:4 data:byte
|
||||
sAramHeap__16JASWaveArcLoader = .sbss:0x80451290; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sBankDisposeListSize__10JASChannel = .sbss:0x80451298; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
sDspDacBuffer__9JASDriver = .sbss:0x804512A0; // type:object size:0x4 scope:global align:4 data:4byte
|
||||
|
|
|
|||
|
|
@ -1031,7 +1031,7 @@ config.libs = [
|
|||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASBasicWaveBank.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASSimpleWaveBank.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASWSParser.cpp"),
|
||||
Object(NonMatching, "JSystem/JAudio2/JASBNKParser.cpp"), # missing bss var
|
||||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASBNKParser.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASWaveArcLoader.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASChannel.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASLfo.cpp"),
|
||||
|
|
@ -1106,7 +1106,7 @@ config.libs = [
|
|||
Object(Equivalent, "Z2AudioLib/Z2SceneMgr.cpp"), # weak func order
|
||||
Object(MatchingFor(ALL_GCN), "Z2AudioLib/Z2FxLineMgr.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "Z2AudioLib/Z2SoundInfo.cpp"),
|
||||
Object(Equivalent, "Z2AudioLib/Z2Audience.cpp"), # weak func order
|
||||
Object(MatchingFor(ALL_GCN), "Z2AudioLib/Z2Audience.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "Z2AudioLib/Z2SoundObject.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "Z2AudioLib/Z2SoundObjMgr.cpp"),
|
||||
Object(MatchingFor(ALL_GCN), "Z2AudioLib/Z2Creature.cpp"),
|
||||
|
|
|
|||
|
|
@ -50,11 +50,18 @@ struct JASGenericMemPool {
|
|||
void* alloc(u32);
|
||||
void free(void*, u32);
|
||||
|
||||
u32 getFreeMemCount() const {
|
||||
return freeMemCount;
|
||||
}
|
||||
|
||||
u32 getTotalMemCount() const {
|
||||
return totalMemCount;
|
||||
}
|
||||
|
||||
/* 0x00 */ void* field_0x0;
|
||||
/* 0x04 */ u32 freeMemCount;
|
||||
/* 0x08 */ u32 totalMemCount;
|
||||
/* 0x0C */ u32 usedMemCount;
|
||||
|
||||
};
|
||||
|
||||
namespace JASThreadingModel {
|
||||
|
|
@ -87,6 +94,13 @@ namespace JASThreadingModel {
|
|||
A0* mMutex;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A0>
|
||||
struct SingleThreaded {
|
||||
struct Lock {
|
||||
Lock(const A0& param_0) {}
|
||||
};
|
||||
};
|
||||
}; // namespace JASThreadingModel
|
||||
|
||||
/**
|
||||
|
|
@ -96,17 +110,32 @@ namespace JASThreadingModel {
|
|||
template <typename T>
|
||||
class JASMemPool : public JASGenericMemPool {
|
||||
public:
|
||||
void newMemPool(int param_0) { JASGenericMemPool::newMemPool(sizeof(T), param_0); }
|
||||
void newMemPool(int param_0) {
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
JASGenericMemPool::newMemPool(sizeof(T), param_0);
|
||||
}
|
||||
|
||||
void* alloc(u32 n) {
|
||||
JUT_ASSERT(182, n == sizeof(T));
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::alloc(n);
|
||||
}
|
||||
|
||||
void free(void* ptr, u32 n) {
|
||||
JUT_ASSERT(187, n == sizeof(T));
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
JASGenericMemPool::free(ptr, n);
|
||||
}
|
||||
|
||||
u32 getFreeMemCount() const {
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::getFreeMemCount();
|
||||
}
|
||||
|
||||
u32 getTotalMemCount() const {
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::getTotalMemCount();
|
||||
}
|
||||
};
|
||||
|
||||
namespace JASKernel { JKRHeap* getSystemHeap(); };
|
||||
|
|
@ -255,25 +284,35 @@ template <typename T>
|
|||
class JASPoolAllocObject {
|
||||
public:
|
||||
static void* operator new(size_t n) {
|
||||
JASMemPool<T>* memPool = getMemPool_();
|
||||
return memPool->alloc(sizeof(T));
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
return memPool_.alloc(n);
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
JASMemPool<T>* memPool_ = getMemPool_();
|
||||
memPool_->free(ptr, sizeof(T));
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
memPool_.free(ptr, n);
|
||||
}
|
||||
static void newMemPool(int param_0) {
|
||||
JASMemPool<T>* memPool_ = getMemPool_();
|
||||
memPool_->newMemPool(param_0);
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
memPool_.newMemPool(param_0);
|
||||
}
|
||||
static u32 getFreeMemCount() {
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
return memPool_.getFreeMemCount();
|
||||
}
|
||||
static u32 getTotalMemCount() {
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
return memPool_.getTotalMemCount();
|
||||
}
|
||||
|
||||
private:
|
||||
static JASMemPool<T>* getMemPool_() {
|
||||
// Fakematch? Is memPool_ both an in-function static and an out-of-function static?
|
||||
static JASMemPool<T> memPool_;
|
||||
static JASMemPool<T>& getMemPool_() {
|
||||
static JASMemPool<T> memPool_;
|
||||
return &memPool_;
|
||||
return memPool_;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -308,25 +347,28 @@ template <typename T>
|
|||
class JASPoolAllocObject_MultiThreaded {
|
||||
public:
|
||||
static void* operator new(size_t n) {
|
||||
JASMemPool_MultiThreaded<T>* memPool_ = getMemPool();
|
||||
return memPool_->alloc(sizeof(T));
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
return memPool_.alloc(sizeof(T));
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
JASMemPool_MultiThreaded<T>* memPool_ = getMemPool();
|
||||
memPool_->free(ptr, sizeof(T));
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
memPool_.free(ptr, sizeof(T));
|
||||
}
|
||||
|
||||
static void newMemPool(int n) {
|
||||
getMemPool()->newMemPool(n);
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
memPool_.newMemPool(n);
|
||||
}
|
||||
|
||||
private:
|
||||
static JASMemPool_MultiThreaded<T>* getMemPool() {
|
||||
// Fakematch? Is memPool_ both an in-function static and an out-of-function static?
|
||||
static JASMemPool_MultiThreaded<T> memPool_;
|
||||
static JASMemPool_MultiThreaded<T>& getMemPool() {
|
||||
static JASMemPool_MultiThreaded<T> memPool_;
|
||||
return &memPool_;
|
||||
return memPool_;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,28 +31,28 @@ struct TSinCosTable {
|
|||
T sinShort(s16 v) const { return table[(u16)v >> (16U - N)].first; }
|
||||
T cosShort(s16 v) const { return table[(u16)v >> (16U - N)].second; }
|
||||
|
||||
inline T sinLap(T v) {
|
||||
inline T sinLap(T v) const {
|
||||
if (v < (T)0.0) {
|
||||
return -table[(u16)(-(T)(1 << N) * v) & ((1 << N) - 1)].first;
|
||||
}
|
||||
return table[(u16)((T)(1 << N) * v) & ((1 << N) - 1)].first;
|
||||
}
|
||||
|
||||
inline T sinDegree(T degree) {
|
||||
inline T sinDegree(T degree) const {
|
||||
if (degree < (T)0.0) {
|
||||
return -table[(u16)(-((T)(1 << N) / (T)360.0) * degree) & ((1 << N) - 1)].first;
|
||||
}
|
||||
return table[(u16)(((T)(1 << N) / (T)360.0) * degree) & ((1 << N) - 1)].first;
|
||||
}
|
||||
|
||||
inline T cosDegree(T degree) {
|
||||
inline T cosDegree(T degree) const {
|
||||
if (degree < (T)0.0) {
|
||||
degree = -degree;
|
||||
}
|
||||
return table[(u16)(((T)(1 << N) / (T)360.0) * degree) & ((1 << N) - 1)].second;
|
||||
}
|
||||
|
||||
inline T sinRadian(T radian) {
|
||||
inline T sinRadian(T radian) const {
|
||||
if (radian < (T)0.0) {
|
||||
return -table[(u16)(-(T)(1 << N) / TAngleConstant_<T>::RADIAN_DEG360() * radian) & ((1 << N) - 1)].first;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,8 @@ struct Z2Audience : public JAIAudience, public JASGlobalInstance<Z2Audience> {
|
|||
virtual u32 calcPriority(JAIAudible* audible);
|
||||
virtual void mixChannelOut(const JASSoundParams& outParams, JAIAudible* audible, int channelNum);
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
Z2SpotMic* getLinkMic() { return mLinkMic; }
|
||||
JGeometry::TVec3<f32> getAudioCamPos(int camID) {
|
||||
return *mAudioCamera[camID].getPos();
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
|||
field_0x0b4 = i_dspChannel->field_0x074 + i_dspChannel->field_0x064;
|
||||
if (field_0x118 >= field_0x160 - 2) {
|
||||
JUT_WARN_DEVICE(810, 1, "%s", "buffer under error");
|
||||
field_0x0ae |= 4;
|
||||
field_0x0ae |= (u8)4;
|
||||
}
|
||||
} else {
|
||||
if (field_0x12c & 1) {
|
||||
|
|
|
|||
|
|
@ -305,3 +305,7 @@ JASOscillator::Point const* JASBNKParser::Ver0::getOscTableEndPtr(JASOscillator:
|
|||
} while (tmp <= 10);
|
||||
return points;
|
||||
}
|
||||
|
||||
// Fakematch? Why is this here?
|
||||
template<>
|
||||
JASMemPool_MultiThreaded<JASChannel> JASPoolAllocObject_MultiThreaded<JASChannel>::memPool_;
|
||||
|
|
|
|||
|
|
@ -195,11 +195,19 @@ JASGenericMemPool::~JASGenericMemPool() {
|
|||
|
||||
JKRSolidHeap* JASDram;
|
||||
|
||||
void JASGenericMemPool::newMemPool(u32 size, int param_1) {
|
||||
// TODO: What is this and Where does it go?
|
||||
struct TNextOnFreeList {
|
||||
u8 pad[4];
|
||||
}; // Size: 0x4
|
||||
|
||||
void JASGenericMemPool::newMemPool(u32 n, int param_1) {
|
||||
JUT_ASSERT(734, n >= sizeof(TNextOnFreeList));
|
||||
void* runner;
|
||||
for (int i = 0; i < param_1; i++) {
|
||||
void* chunk = new (JASDram, 0) u8[size];
|
||||
*(void**)chunk = field_0x0;
|
||||
field_0x0 = chunk;
|
||||
runner = new (JASDram, 0) u8[n];
|
||||
JUT_ASSERT(739, runner);
|
||||
*(void**)runner = field_0x0;
|
||||
field_0x0 = runner;
|
||||
}
|
||||
freeMemCount += param_1;
|
||||
totalMemCount += param_1;
|
||||
|
|
|
|||
|
|
@ -500,7 +500,11 @@ Z2Audience::Z2Audience() : JASGlobalInstance<Z2Audience>(true), field_0x4(1.0f),
|
|||
}
|
||||
|
||||
Z2Audience::~Z2Audience() {
|
||||
// JUT_ASSERT(751, !isActive()); // TODO: need to setup rest of JASMemPool stuff
|
||||
JUT_ASSERT(751, !isActive());
|
||||
}
|
||||
|
||||
bool Z2Audience::isActive() const {
|
||||
return Z2Audible::getTotalMemCount() != Z2Audible::getFreeMemCount();
|
||||
}
|
||||
|
||||
void Z2Audience::setAudioCamera(f32 (*param_0)[4], Vec& pos, Vec& param_2, f32 param_3,
|
||||
|
|
|
|||
Loading…
Reference in New Issue