mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-08 21:54:50 -04:00
JAISoundTable almost
This commit is contained in:
@@ -3,10 +3,22 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct SoundInfo {
|
||||
/* 0x00 */ u32 mFlag;
|
||||
/* 0x04 */ u8 mPriority;
|
||||
/* 0x05 */ u8 _05;
|
||||
/* 0x06 */ u16 mOffsetNo;
|
||||
/* 0x08 */ u32 mPitch;
|
||||
/* 0x0C */ union Volume {
|
||||
u32 typeView;
|
||||
u8 byteView[4];
|
||||
} mVolume;
|
||||
};
|
||||
|
||||
namespace JAInter {
|
||||
namespace SoundTable {
|
||||
void init(u8*, u32);
|
||||
u8* getInfoPointer(u32);
|
||||
SoundInfo* getInfoPointer(u32);
|
||||
u8 getInfoFormat(u32);
|
||||
u8 getCategotyMax();
|
||||
|
||||
@@ -14,7 +26,7 @@ namespace JAInter {
|
||||
extern u8 mCategotyMax;
|
||||
extern u16* mSoundMax;
|
||||
extern u32 mDatasize;
|
||||
extern u8** mPointerCategory;
|
||||
extern SoundInfo** mPointerCategory;
|
||||
extern u8* mAddress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,20 +12,22 @@ u8 JAInter::SoundTable::mVersion;
|
||||
u8 JAInter::SoundTable::mCategotyMax;
|
||||
u16* JAInter::SoundTable::mSoundMax;
|
||||
u32 JAInter::SoundTable::mDatasize;
|
||||
u8** JAInter::SoundTable::mPointerCategory;
|
||||
SoundInfo** JAInter::SoundTable::mPointerCategory;
|
||||
u8* JAInter::SoundTable::mAddress;
|
||||
|
||||
/* 8029B570-8029B6FC .text init__Q27JAInter10SoundTableFPUcUl */
|
||||
void JAInter::SoundTable::init(u8* param_1, u32 param_2) {
|
||||
/* Nonmatching */
|
||||
/* Nonmatching - operand swap */
|
||||
mAddress = param_1;
|
||||
mDatasize = param_2;
|
||||
mVersion = param_1[3];
|
||||
mSoundMax = new (JAIBasic::getCurrentJAIHeap(), 4) u16[18];
|
||||
mPointerCategory = new (JAIBasic::getCurrentJAIHeap(), 4) u8*[18];
|
||||
mPointerCategory = new (JAIBasic::getCurrentJAIHeap(), 4) SoundInfo*[18];
|
||||
for (u8 i = 0; i < 18; i++) {
|
||||
mSoundMax[i] = *(u16*)(mAddress + i * 4 + 6);
|
||||
mPointerCategory[i] = mAddress + *(u16*)(mAddress + i * 4 + 8) * 16 + 80;
|
||||
mSoundMax[i] = reinterpret_cast<u16*>(&mAddress[6])[i*2];
|
||||
u32 temp = reinterpret_cast<u16*>(&mAddress[8])[i*2];
|
||||
mPointerCategory[i] = &(reinterpret_cast<SoundInfo*>(&mAddress[0x50])[temp]);
|
||||
|
||||
if (i < 16 && mSoundMax[i] != 0) {
|
||||
mCategotyMax = i + 1;
|
||||
}
|
||||
@@ -33,9 +35,9 @@ void JAInter::SoundTable::init(u8* param_1, u32 param_2) {
|
||||
}
|
||||
|
||||
/* 8029B6FC-8029B8CC .text getInfoPointer__Q27JAInter10SoundTableFUl */
|
||||
u8* JAInter::SoundTable::getInfoPointer(u32 param_1) {
|
||||
SoundInfo* JAInter::SoundTable::getInfoPointer(u32 param_1) {
|
||||
JUT_ASSERT_MSG(52, mAddress, "getInfoPointer サウンドテーブルがありません\n");
|
||||
u8* r31 = NULL;
|
||||
SoundInfo* r31 = NULL;
|
||||
u32 _category;
|
||||
switch (param_1 & JAISoundID_TypeMask) {
|
||||
case JAISoundID_Type_Se:
|
||||
@@ -54,7 +56,7 @@ u8* JAInter::SoundTable::getInfoPointer(u32 param_1) {
|
||||
}
|
||||
u32 tmp = param_1 & 0x3ff;
|
||||
if (mAddress && tmp < mSoundMax[_category]) {
|
||||
r31 = mPointerCategory[_category] + tmp * 16;
|
||||
r31 = &mPointerCategory[_category][tmp];
|
||||
}
|
||||
return r31;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user