start matching some d/snd things

This commit is contained in:
robojumper
2025-05-30 22:21:49 +02:00
parent 77e17d4c1f
commit 83456a9cd8
43 changed files with 1561 additions and 384 deletions
+12 -19
View File
@@ -26,12 +26,20 @@ public:
void stopAllSound();
u32 changeNameToId(const char *name) {
return mOpenSndArchive->ConvertLabelStringToSoundId(name);
u32 id = -1;
if (mOpenSndArchive != nullptr) {
id = mOpenSndArchive->ConvertLabelStringToSoundId(name);
}
return id;
}
nw4r::snd::SoundArchivePlayer *getPlayer() {
return mActiveSndArchivePlayer;
}
nw4r::snd::SoundArchive *getArchive() {
return mOpenSndArchive;
}
void setLoadStringLabels(bool bLoad) {
mLoadLabelStringData = bLoad;
}
@@ -65,12 +73,7 @@ public:
virtual bool startSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x40
{
u32 id = -1;
if (mOpenSndArchive) {
id = changeNameToId(name);
}
return ArcPlayer::startSound(handle, id);
return ArcPlayer::startSound(handle, changeNameToId(name));
}
virtual bool prepareSound(nw4r::snd::SoundHandle *handle, u32 id) // at 0x44
@@ -85,12 +88,7 @@ public:
virtual bool prepareSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x4C
{
u32 id = -1;
if (mOpenSndArchive) {
id = changeNameToId(name);
}
return ArcPlayer::prepareSound(handle, id);
return ArcPlayer::prepareSound(handle, changeNameToId(name));
}
virtual bool holdSound(nw4r::snd::SoundHandle *handle, u32 id) // at 0x50
@@ -105,12 +103,7 @@ public:
virtual bool holdSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x58
{
u32 id = -1;
if (mOpenSndArchive) {
id = changeNameToId(name);
}
return ArcPlayer::holdSound(handle, id);
return ArcPlayer::holdSound(handle, changeNameToId(name));
}
private:
+35 -4
View File
@@ -21,9 +21,38 @@ public:
~SoundHeapMgr() {
destroySoundHeap();
}
virtual bool loadState(s32 id) {}
virtual int getCurrentLevel() {}
virtual void stateProc() {}
int saveState() {
return mSoundHeap.SaveState();
}
virtual bool loadState(s32 id) {
s32 level = mSoundHeap.GetCurrentLevel();
if (id > 0 && level >= id) {
mSoundHeap.LoadState(id);
return true;
} else {
return false;
}
}
virtual int getCurrentLevel() {
return mSoundHeap.GetCurrentLevel();
}
virtual void stateProc() {
OSMessage msg;
if (OSReceiveMessage(&mQueue1.mQueue, &msg, 0)) {
bool ok = loadState((s32)msg);
OSSendMessage(&mQueue3.mQueue, (OSMessage)ok, 0);
}
if (OSReceiveMessage(&mQueue2.mQueue, &msg, 0)) {
int ok = mSoundHeap.SaveState();
OSSendMessage(&mQueue3.mQueue, (OSMessage)ok, 0);
}
if (OSReceiveMessage(&mQueue, &msg, 0)) {
int level = getCurrentLevel();
OSSendMessage(&mQueue3.mQueue, (OSMessage)level, 0);
}
}
void createSoundHeap(Allocator *allocator, u32 size);
void destroySoundHeap();
@@ -34,7 +63,9 @@ public:
private:
nw4r::snd::SoundHeap mSoundHeap;
u8 unk[0x68 - 0x38];
// I guess we're not initializing this queue?
OSMessageQueue mQueue;
OSMessage mBuffer[4];
SoundMessageQueue mQueue1;
SoundMessageQueue mQueue2;
SoundMessageQueue mQueue3;
+1 -1
View File
@@ -12,7 +12,7 @@ namespace EGG {
struct MultiArcSimpleAudioMgr {
u8 field_0x000[0x0FC - 0x000];
s32 field_0x0FC;
ArcPlayer players[];
ArcPlayer players[1];
nw4r::snd::SoundArchivePlayer *getPlayer(int i) {
return players[i].getPlayer();
+23 -1
View File
@@ -6,7 +6,6 @@
#include "egg/core/eggHeap.h"
#include "egg/core/eggStreamDecomp.h"
namespace EGG {
class DvdRipper {
@@ -28,6 +27,29 @@ public:
typedef void (*UnkCallback)(void *);
public:
// Not sure
struct Arg {
Arg(const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize)
: path(path),
pOut(pOut),
pHeap(pHeap),
allocDir(allocDir),
offset(offset),
pRead(pRead),
fileSize(fileSize) {}
const char *path;
u8 *pOut;
Heap *pHeap;
EAllocDirection allocDir;
u32 offset;
u32 *pRead;
u32 *fileSize;
};
static u8 *loadToMainRAM(Arg &arg) {
return loadToMainRAM(arg.path, arg.pOut, arg.pHeap, arg.allocDir, arg.offset, arg.pRead, arg.fileSize);
}
static u8 *
loadToMainRAM(s32 entryNum, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize);
+18 -1
View File
@@ -35,6 +35,15 @@ protected:
class LookAtCamera : public BaseCamera {
public:
LookAtCamera() : mPos(0.0f, 10.0f, 0.0f), mAt(0.0f, 0.0f, 0.0f), mUp(0.0f, 1.0f, 0.0f) {}
LookAtCamera& operator=(const LookAtCamera &other) {
mViewMtx.copyFrom(other.mViewMtx);
mOtherMtx.copyFrom(other.mOtherMtx);
mPos = other.mPos;
mAt = other.mAt;
mUp = other.mUp;
return *this;
}
// Which way around?
virtual Matrix34f &getViewMatrix() override {
return mViewMtx;
@@ -53,7 +62,15 @@ public:
virtual void doDraw() override;
virtual Matrix34f &getViewMatrixOld() override;
protected:
Vector3f getDirection() const {
return mAt - mPos;
}
Vector3f getOtherDirection() const {
return mPos - mAt;
}
public:
/* 0x64 */ Vector3f mPos;
/* 0x70 */ Vector3f mAt;
/* 0x7C */ Vector3f mUp;
+9
View File
@@ -4,6 +4,7 @@
#include "common.h"
#include "egg/math/eggQuat.h"
#include "egg/math/eggVector.h"
#include "nw4r/math/math_types.h"
namespace EGG {
@@ -55,6 +56,14 @@ struct Matrix34f {
void multiplyTo(const Matrix34f &m2, Matrix34f &to) const;
void dump();
operator nw4r::math::MTX34 *() {
return (nw4r::math::MTX34 *)this;
}
operator const nw4r::math::MTX34 *() const {
return (nw4r::math::MTX34 *)this;
}
public:
void concat(const Matrix34f &, Matrix34f &) const;
void rotate(const Vector3f &rpy) const;